DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: zhaoxinxin <15957197901@163.com>, dev@dpdk.org
Subject: Re: [PATCH] vhost: Fix the crash caused by accessing the released memory
Date: Mon, 24 Jun 2024 11:20:00 +0200	[thread overview]
Message-ID: <4a43b1af-cab5-4ce9-b0b0-e5d8e7e18af6@redhat.com> (raw)
In-Reply-To: <20240619122739.42573-1-15957197901@163.com>

Hi,

On 6/19/24 14:27, zhaoxinxin wrote:
> The rte_vhost_driver_unregister() vhost_user_read_cb()
> vhost_user_client_reconnect() can be called at the same time by 3 threads.
> when memory of vsocket is freed in rte_vhost_driver_unregister(),
> then vhost_user_read_cb() maybe add vsocket to reconn_list,
> the invalid memory of vsocket is accessed in vhost_user_client_reconnect().

It is not clear to me why 3 threads are calling
rte_vhost_driver_unregister() at the same time, isn't it an application
issue?

> The core trace is:
> Program terminated with signal 11, Segmentation fault.
> The fix is to perform a delete operation again after releasing the memory
>

We need a Fixes tag and Cc stable@dpdk.org so that it is backported.

> Signed-off-by: zhaoxinxin <15957197901@163.com>

The format is Firstname Lastname <email>


> ---
>   lib/vhost/socket.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
> index a75728a2e4..01946096c4 100644
> --- a/lib/vhost/socket.c
> +++ b/lib/vhost/socket.c
> @@ -1121,6 +1121,8 @@ rte_vhost_driver_unregister(const char *path)
>   		if (vsocket->is_server) {
>   			close(vsocket->socket_fd);
>   			unlink(path);
> +		} else if (vsocket->reconnect) {
> +			vhost_user_remove_reconnect(vsocket);
>   		}
>   
>   		pthread_mutex_destroy(&vsocket->conn_mutex);


  reply	other threads:[~2024-06-24  9:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19 12:27 zhaoxinxin
2024-06-24  9:20 ` Maxime Coquelin [this message]
2024-06-25  1:56   ` 15957197901
2024-12-03  6:49   ` 15957197901
  -- strict thread matches above, loose matches on Subject: below --
2024-06-25  9:31 Xinxin Zhao
2024-06-25  2:13 zhaoxinxin
2024-06-25 13:51 ` Patrick Robb
2024-06-19  8:39 zhaoxinxin
2024-06-18  5:59 zhaoxinxin
2024-06-17  3:35 zhaoxinxin

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=4a43b1af-cab5-4ce9-b0b0-e5d8e7e18af6@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=15957197901@163.com \
    --cc=dev@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 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).