回复: [PATCH] app/testpmd: avoid cmdline use-after-free on SIGINT
Bruce Richardson
bruce.richardson at intel.com
Mon Apr 27 12:43:06 CEST 2026
On Mon, Apr 27, 2026 at 10:33:42AM +0000, Sunyang Wu wrote:
> Hi Bruce,
>
> Thanks for the review.
>
> I do not think a memory barrier alone would be sufficient here.
>
> In the intended case, prompt_exit() is used from the signal path to
> interrupt the thread currently running prompt(). In that case, the
> NULL store is already ordered before cmdline_stdin_exit(). However,
> for a later signal or a signal delivered to another thread, a plain
> barrier would still not make concurrent access to testpmd_cl safe.
>
> I think the better fix is to keep the existing prompt_exit() behavior,
> but use a local cmdline pointer for lifetime management and atomic
> load/store for testpmd_cl so the signal path cannot observe freed
> state.
>
> If this approach looks reasonable to you, I will send a v2.
>
Sounds reasonable to me, but I'm not an expert on the behaviour of weakly
ordered platforms! I think do a v2 with your proposal anyway, since it's
likely an improvement over the v1.
/Bruce
More information about the stable
mailing list