All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Rui Ferreira <rui.ferreira1@h-partners.com>
Cc: dev@dpdk.org, stable@dpdk.org,
	David Marchand <david.marchand@redhat.com>,
	 Konstantin Ananyev <konstantin.ananyev@huawei.com>
Subject: Re: [PATCH v2] fix eal/linux: unregister alarm callback before free
Date: Tue, 27 May 2025 16:53:57 +0200	[thread overview]
Message-ID: <1969712.QZUTf85G27@thomas> (raw)
In-Reply-To: <20250522155944.65342-1-rui.ferreira1@h-partners.com>

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@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(-)




  parent reply	other threads:[~2025-05-27 14:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-20 16:01 [PATCH] eal/linux: unregister alarm callback before free ptr Rui Ferreira
2025-05-21  8:49 ` David Marchand
2025-05-21 11:43 ` Konstantin Ananyev
2025-05-22 15:59 ` [PATCH v2] fix eal/linux: unregister alarm callback before free Rui Ferreira
2025-05-27 10:22   ` Konstantin Ananyev
2025-05-27 14:53   ` Thomas Monjalon [this message]
2025-05-29  8:39     ` Rui Ferreira (A)
2025-05-30  8:18       ` [PATCH v2 0/2] fix eal: " Rui Ferreira
2025-05-30  8:18         ` [PATCH v2 1/2] fix eal/linux: " Rui Ferreira
2025-05-30  8:18         ` [PATCH v2 2/2] fix eal/freebsd: " Rui Ferreira
2025-06-03  8:29           ` Bruce Richardson
2025-06-09 12:45             ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1969712.QZUTf85G27@thomas \
    --to=thomas@monjalon.net \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@huawei.com \
    --cc=rui.ferreira1@h-partners.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.