patches for DPDK stable branches
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Gongming Chen <chengongming1900@outlook.com>
Cc: maxime.coquelin@redhat.com, chenbox@nvidia.com, dev@dpdk.org,
	 Gongming Chen <chengm11@chinatelecom.cn>,
	stable@dpdk.org,  Thomas Monjalon <thomas@monjalon.net>
Subject: Re: [PATCH v4] vhost: fix crash caused by accessing a freed vsocket
Date: Tue, 9 Jul 2024 09:26:12 +0200	[thread overview]
Message-ID: <CAJFAV8z6PR02A95f-hDCRZXu60q6AdSE6vXFh9pdsXm8b-HCLg@mail.gmail.com> (raw)
In-Reply-To: <TYAP286MB06491A9489C631C9D6EEA2FFD8DA2@TYAP286MB0649.JPNP286.PROD.OUTLOOK.COM>

Hello,

On Mon, Jul 8, 2024 at 6:41 AM Gongming Chen
<chengongming1900@outlook.com> wrote:
>
> From: Gongming Chen <chengm11@chinatelecom.cn>
>
> When a vhost user message handling error in the event dispatch thread,
> vsocket reconn is added to the reconnection list of the reconnection
> thread.
> Since the reconnection, event dispatching and app configuration thread
> do not have common thread protection restrictions, the app config
> thread freed vsocket in the rte_vhost_driver_unregister process,
> but vsocket reconn can still exist in the reconn_list through this
> mechanism.
> Then in the reconnection thread, the vsocket is connected again and
> conn is added to the dispatch thread.
> Finally, the vsocket that has been freed by rte_vhost_driver_unregister
> is accessed again in the event dispatch thread, resulting in a
> use-after-free error.
>
> This patch adds a vhost threads read-write lock to restrict
> reconnection, event dispatching and app configuration threads.
> When the vhost driver unregisters, it exclusively holds the lock to
> safely free the vsocket.
>
> #0  0x0000000000000025 in ?? ()
> #1  0x0000000003ed7ca0 in vhost_user_read_cb at lib/vhost/socket.c:323
> #2  0x0000000003ed625f in fdset_event_dispatch at lib/vhost/fd_man.c:365
>
> Fixes: e623e0c6d8a5 ("vhost: add vhost-user client mode")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gongming Chen <chengm11@chinatelecom.cn>

Maxime is off for the coming weeks.
Adding one lock is risky at this point of the release, especially as
it is mixed with other locks.

I prefer not to take this fix without an in depth review, and ideally
a ack from Maxime.
I marked this patch as deferred to the next release.


-- 
David Marchand


      reply	other threads:[~2024-07-09  7:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 16:05 [PATCH v1] " Gongming Chen
2024-05-10  7:28 ` Gongming Chen
2024-07-02  7:48   ` Maxime Coquelin
2024-07-08 23:50     ` Gongming Chen
2024-07-08  2:17 ` [PATCH v2] " Gongming Chen
2024-07-08  2:23 ` [PATCH v3] " Gongming Chen
2024-07-08  4:41 ` [PATCH v4] " Gongming Chen
2024-07-09  7:26   ` David Marchand [this message]

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=CAJFAV8z6PR02A95f-hDCRZXu60q6AdSE6vXFh9pdsXm8b-HCLg@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=chenbox@nvidia.com \
    --cc=chengm11@chinatelecom.cn \
    --cc=chengongming1900@outlook.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).