[PATCH v2] fix eal/linux: unregister alarm callback before free
Thomas Monjalon
thomas at monjalon.net
Tue May 27 16:53:57 CEST 2025
Hello,
Did you see the comment from David about fixing for Windows and FreeBSD at the same time?
I think you just need to apply the same logic in 3 different places.
If you cannot test all, that's OK to submit the changes without full coverage testing.
Thank you
22/05/2025 17:59, Rui Ferreira:
> This was flagged by Address sanitizer as a use after free. The
> intr_handle ptr is shared between the main thread and the interrupt
> thread. The interrupt thread can dereference the ptr after free (from
> the alarm callback). free is called when the main thread cleans up.
>
> The interrupt thread never terminates (eal_intr_thread_main) so
> use rte_intr_callback_unregister_sync during cleanup to
> ensure the callback is removed before freeing the ptr.
>
> To be more defensive clear out the pointer and registration
> variable if we can unregister.
>
> rte_intr_callback_unregister_sync may (optionally) use traces
> so the alarm cleanup must happen before eal_trace_fini to avoid
> accessing freed memory.
>
> Bugzilla ID: 1683
>
> Signed-off-by: Rui Ferreira <rui.ferreira1 at h-partners.com>
> ---
> .mailmap | 1 +
> lib/eal/linux/eal.c | 3 ++-
> lib/eal/linux/eal_alarm.c | 9 ++++++++-
> 3 files changed, 11 insertions(+), 2 deletions(-)
More information about the dev
mailing list