DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Radu Nicolau <radu.nicolau@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: David Marchand <david.marchand@redhat.com>, <dev@dpdk.org>,
	<stable@dpdk.org>, Chenbo Xia <chenbox@nvidia.com>,
	Jay Zhou <jianjay.zhou@huawei.com>,
	Fan Zhang <fanzhang.oss@gmail.com>
Subject: Re: [PATCH] vhost/crypto: fix segfault
Date: Mon, 29 Jun 2026 09:35:21 +0100	[thread overview]
Message-ID: <dc3a218b-815b-4d18-838e-c3f463b4391b@intel.com> (raw)
In-Reply-To: <CAO55csyCW5nms7=nCzLw9PA0kptGrGQgQARZ1HJEGBu_Ws4CFQ@mail.gmail.com>


On 29-Jun-26 9:18 AM, Maxime Coquelin wrote:
> On Fri, Jun 26, 2026 at 10:50 AM Radu Nicolau <radu.nicolau@intel.com> wrote:
>>
>> On 25-Jun-26 1:44 PM, David Marchand wrote:
>>> On Wed, 24 Jun 2026 at 16:21, Radu Nicolau <radu.nicolau@intel.com> wrote:
>>>> Fix potential call with dev->mem uninitialized, one common usecase
>>>> example being running the autotest with more than one device.
>>>>
>>>> Fixes: 3bb595ecd682 ("vhost/crypto: add request handler")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
>>>> ---
>>>>    lib/vhost/vhost_crypto.c | 4 ++++
>>>>    1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
>>>> index 648e2d731b..3679eaca1e 100644
>>>> --- a/lib/vhost/vhost_crypto.c
>>>> +++ b/lib/vhost/vhost_crypto.c
>>>> @@ -1512,6 +1512,10 @@ vhost_crypto_process_one_req(struct vhost_crypto *vcrypto,
>>>>                   VC_LOG_ERR("Invalid descriptor");
>>>>                   return -1;
>>>>           }
>>>> +       if (unlikely((vc_req->dev->mem) == NULL)) {
>>> (Unneeded extra ())
>>>
>>> It sounds to me that some initialisation failed, or processing happens
>>> without waiting initialisation finished.
>> Indeed calling this function with dev->mem uninitialized is caused by
>> some init/deinit state bug, but I still think we should keep this check
>> in for added safety.
>>
>> I will follow up with a v2 to remove the redundant () and also I will
>> look into fixing the root cause.
> Or maybe this crypto backend is lacking proper protection between
> control and data paths?
> If dev->mem is reset to NULL asynchrously by the control path without
> proper locking, then
> the above fix is not enough. For example, the above check could pass
> and dev->mem be
> reset right after.
100% there is a deeper root cause for this segfault and I'm working to 
find it, but it may take a while. That's why I propose this as a stop 
gap fix, it adds an extra check but of course it doesn't remove the root 
cause.

  reply	other threads:[~2026-06-29  8:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 14:20 [PATCH] vhost/crypto: fix segfault Radu Nicolau
2026-06-25 12:44 ` David Marchand
2026-06-26  8:48   ` Radu Nicolau
2026-06-29  8:18     ` Maxime Coquelin
2026-06-29  8:35       ` Radu Nicolau [this message]
2026-06-26 10:55 ` [PATCH v2] " Radu Nicolau

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=dc3a218b-815b-4d18-838e-c3f463b4391b@intel.com \
    --to=radu.nicolau@intel.com \
    --cc=chenbox@nvidia.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=maxime.coquelin@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox