From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>,
dev@dpdk.org, Chenbo Xia <chenbox@nvidia.com>,
Fan Zhang <fanzhang.oss@gmail.com>,
Jay Zhou <jianjay.zhou@huawei.com>
Cc: anoobj@marvell.com, Akhil Goyal <gakhil@marvell.com>, stable@dpdk.org
Subject: Re: [v6 1/5] vhost: skip crypto op fetch before vring init
Date: Thu, 27 Feb 2025 10:19:10 +0100 [thread overview]
Message-ID: <de649087-3686-4372-a1ac-d9a05961b6c0@redhat.com> (raw)
In-Reply-To: <81fac570-cdd7-45f7-b209-ce999d5c3d0e@redhat.com>
On 2/27/25 10:15 AM, Maxime Coquelin wrote:
> Hi Gowri,
>
> Thanks for the change, but I think there is an issue with the locking,
> more below:
>
> On 2/26/25 7:43 PM, Gowrishankar Muthukrishnan wrote:
>> Until virtio avail ring is initialized (by VHOST_USER_SET_VRING_ADDR),
>> worker thread should not try to fetch crypto op, which would lead to
>> memory fault.
>>
>> Fixes: 939066d96563 ("vhost/crypto: add public function implementation")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
>> Acked-by: Akhil Goyal <gakhil@marvell.com>
>> ---
>> v6:
>> - added lock checks.
>> ---
>> lib/vhost/vhost_crypto.c | 20 ++++++++++++++++++++
>> 1 file changed, 20 insertions(+)
>>
>> diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
>> index 3dc41a3bd5..d3d13eff07 100644
>> --- a/lib/vhost/vhost_crypto.c
>> +++ b/lib/vhost/vhost_crypto.c
>> @@ -8,6 +8,7 @@
>> #include <rte_mbuf.h>
>> #include <rte_cryptodev.h>
>> +#include "iotlb.h"
>> #include "rte_vhost_crypto.h"
>> #include "vhost.h"
>> #include "vhost_user.h"
>> @@ -1580,7 +1581,26 @@ rte_vhost_crypto_fetch_requests(int vid,
>> uint32_t qid,
>> vq = dev->virtqueue[qid];
>> + if (unlikely(vq == NULL)) {
>> + VC_LOG_ERR("Invalid virtqueue %u", qid);
>> + return 0;
>> + }
>> +
>> + if (unlikely(rte_rwlock_read_trylock(&vq->access_lock) != 0))
>> + return 0;
>> +
>> + vhost_user_iotlb_rd_lock(vq);
>> + if (unlikely(!vq->access_ok)) {
>> + VC_LOG_DBG("Virtqueue %u vrings not yet initialized", qid);
>> + vhost_user_iotlb_rd_unlock(vq);
>> + rte_rwlock_read_unlock(&vq->access_lock);
>> + return 0;
>> + }
>> +
>> avail_idx = *((volatile uint16_t *)&vq->avail->idx);
>> + vhost_user_iotlb_rd_unlock(vq);
>> + rte_rwlock_read_unlock(&vq->access_lock);
>> +
>
> You should only unlock at the end of the function, otherwise there is
> not much protection.
Ha, and also you should be able to remove:
__rte_no_thread_safety_analysis /* FIXME: requires iotlb_lock? */
in vhost_crypto_process_one_req() once implemented.
Regards,
Maxime
>
>> start_idx = vq->last_used_idx;
>> count = avail_idx - start_idx;
>> count = RTE_MIN(count, VHOST_CRYPTO_MAX_BURST_SIZE);
>
next prev parent reply other threads:[~2025-02-27 9:19 UTC|newest]
Thread overview: 109+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-24 7:36 [v1 00/16] crypto/virtio: vDPA and asymmetric support Gowrishankar Muthukrishnan
2024-12-24 7:36 ` [v1 01/16] vhost: include AKCIPHER algorithms in crypto_config Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 02/16] crypto/virtio: remove redundant crypto queue free Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 03/16] crypto/virtio: add asymmetric RSA support Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 04/16] test/crypto: check for RSA capability Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 05/16] test/crypto: return proper codes in create session Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 06/16] test/crypto: add asymmetric tests for virtio PMD Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 07/16] vhost: add asymmetric RSA support Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 08/16] examples/vhost_crypto: add asymmetric support Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 09/16] crypto/virtio: fix dataqueues iteration Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 10/16] crypto/virtio: refactor queue operations Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 11/16] crypto/virtio: add packed ring support Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 12/16] common/virtio: common virtio log Gowrishankar Muthukrishnan
2024-12-24 8:14 ` David Marchand
2025-01-07 10:57 ` [EXTERNAL] " Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 13/16] common/virtio: move vDPA to common directory Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 14/16] common/virtio: support cryptodev in vdev setup Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 15/16] crypto/virtio: add vhost backend to virtio_user Gowrishankar Muthukrishnan
2024-12-24 7:37 ` [v1 16/16] test/crypto: test virtio_crypto_user PMD Gowrishankar Muthukrishnan
2025-01-07 17:52 ` [v2 0/2] crypto/virtio: add RSA support Gowrishankar Muthukrishnan
2025-01-07 17:52 ` [v2 1/2] crypto/virtio: add asymmetric " Gowrishankar Muthukrishnan
2025-01-07 17:52 ` [v2 2/2] test/crypto: add asymmetric tests for virtio PMD Gowrishankar Muthukrishnan
2025-02-21 17:41 ` [v3 0/6] crypto/virtio: enhancements for RSA and vDPA Gowrishankar Muthukrishnan
2025-02-21 17:41 ` [v3 1/6] crypto/virtio: add asymmetric RSA support Gowrishankar Muthukrishnan
2025-02-21 17:41 ` [v3 2/6] crypto/virtio: refactor queue operations Gowrishankar Muthukrishnan
2025-02-21 17:41 ` [v3 3/6] crypto/virtio: add packed ring support Gowrishankar Muthukrishnan
2025-02-21 17:41 ` [v3 4/6] crypto/virtio: add vDPA backend Gowrishankar Muthukrishnan
2025-02-21 17:41 ` [v3 5/6] test/crypto: add asymmetric tests for virtio PMD Gowrishankar Muthukrishnan
2025-02-21 17:41 ` [v3 6/6] test/crypto: add tests for virtio user PMD Gowrishankar Muthukrishnan
2025-02-22 9:16 ` [v4 0/6] crypto/virtio: enhancements for RSA and vDPA Gowrishankar Muthukrishnan
2025-02-22 9:16 ` [v4 1/6] crypto/virtio: add asymmetric RSA support Gowrishankar Muthukrishnan
2025-02-22 9:16 ` [v4 2/6] crypto/virtio: refactor queue operations Gowrishankar Muthukrishnan
2025-02-22 9:16 ` [v4 3/6] crypto/virtio: add packed ring support Gowrishankar Muthukrishnan
2025-02-22 9:16 ` [v4 4/6] crypto/virtio: add vDPA backend Gowrishankar Muthukrishnan
2025-02-22 9:16 ` [v4 5/6] test/crypto: add asymmetric tests for virtio PMD Gowrishankar Muthukrishnan
2025-02-22 9:16 ` [v4 6/6] test/crypto: add tests for virtio user PMD Gowrishankar Muthukrishnan
2025-02-24 7:25 ` [v4 0/6] crypto/virtio: enhancements for RSA and vDPA Akhil Goyal
2025-02-26 18:58 ` [v5 " Gowrishankar Muthukrishnan
2025-02-26 18:58 ` [v5 1/6] crypto/virtio: add asymmetric RSA support Gowrishankar Muthukrishnan
2025-02-26 18:58 ` [v5 2/6] crypto/virtio: refactor queue operations Gowrishankar Muthukrishnan
2025-02-26 18:58 ` [v5 3/6] crypto/virtio: add packed ring support Gowrishankar Muthukrishnan
2025-02-26 18:58 ` [v5 4/6] crypto/virtio: add vDPA backend Gowrishankar Muthukrishnan
2025-02-26 18:58 ` [v5 5/6] test/crypto: add asymmetric tests for virtio PMD Gowrishankar Muthukrishnan
2025-02-26 18:58 ` [v5 6/6] test/crypto: add tests for virtio user PMD Gowrishankar Muthukrishnan
2025-01-07 18:02 ` [v2 0/2] vhost: add RSA support Gowrishankar Muthukrishnan
2025-01-07 18:02 ` [v2 1/2] vhost: add asymmetric " Gowrishankar Muthukrishnan
2025-01-29 16:07 ` Maxime Coquelin
2025-01-07 18:02 ` [v2 2/2] examples/vhost_crypto: add asymmetric support Gowrishankar Muthukrishnan
2025-01-29 16:13 ` Maxime Coquelin
2025-01-30 9:29 ` [EXTERNAL] " Gowrishankar Muthukrishnan
2025-02-21 17:30 ` [v3 0/5] vhost: add RSA support Gowrishankar Muthukrishnan
2025-02-21 17:30 ` [v3 1/5] vhost: skip crypto op fetch before vring init Gowrishankar Muthukrishnan
2025-02-21 17:30 ` [v3 2/5] vhost: update vhost_user crypto session parameters Gowrishankar Muthukrishnan
2025-02-21 17:30 ` [v3 3/5] examples/vhost_crypto: fix user callbacks Gowrishankar Muthukrishnan
2025-02-21 17:30 ` [v3 4/5] vhost: support asymmetric RSA crypto ops Gowrishankar Muthukrishnan
2025-02-21 17:30 ` [v3 5/5] examples/vhost_crypto: support asymmetric crypto Gowrishankar Muthukrishnan
2025-02-22 8:38 ` [v4 0/5] vhost: add RSA support Gowrishankar Muthukrishnan
2025-02-22 8:38 ` [v4 1/5] vhost: skip crypto op fetch before vring init Gowrishankar Muthukrishnan
2025-02-24 7:13 ` Akhil Goyal
2025-02-22 8:38 ` [v4 2/5] vhost: update vhost_user crypto session parameters Gowrishankar Muthukrishnan
2025-02-24 7:14 ` Akhil Goyal
2025-02-22 8:38 ` [v4 3/5] examples/vhost_crypto: fix user callbacks Gowrishankar Muthukrishnan
2025-02-24 7:15 ` Akhil Goyal
2025-02-22 8:38 ` [v4 4/5] vhost: support asymmetric RSA crypto ops Gowrishankar Muthukrishnan
2025-02-24 7:24 ` Akhil Goyal
2025-02-22 8:38 ` [v4 5/5] examples/vhost_crypto: support asymmetric crypto Gowrishankar Muthukrishnan
2025-02-24 7:19 ` Akhil Goyal
2025-02-24 7:28 ` [v4 0/5] vhost: add RSA support Akhil Goyal
2025-02-24 10:35 ` [v5 " Gowrishankar Muthukrishnan
2025-02-24 10:35 ` [v5 1/5] vhost: skip crypto op fetch before vring init Gowrishankar Muthukrishnan
2025-02-25 16:17 ` Maxime Coquelin
2025-02-26 17:40 ` [EXTERNAL] " Gowrishankar Muthukrishnan
2025-02-24 10:35 ` [v5 2/5] vhost: update vhost_user crypto session parameters Gowrishankar Muthukrishnan
2025-02-24 10:35 ` [v5 3/5] examples/vhost_crypto: fix user callbacks Gowrishankar Muthukrishnan
2025-02-24 10:35 ` [v5 4/5] vhost: support asymmetric RSA crypto ops Gowrishankar Muthukrishnan
2025-02-24 10:35 ` [v5 5/5] examples/vhost_crypto: support asymmetric crypto Gowrishankar Muthukrishnan
2025-02-26 18:43 ` [v6 0/5] vhost: add RSA support Gowrishankar Muthukrishnan
2025-02-26 18:43 ` [v6 1/5] vhost: skip crypto op fetch before vring init Gowrishankar Muthukrishnan
2025-02-27 9:15 ` Maxime Coquelin
2025-02-27 9:19 ` Maxime Coquelin [this message]
2025-02-27 13:15 ` [EXTERNAL] " Gowrishankar Muthukrishnan
2025-02-27 18:07 ` Gowrishankar Muthukrishnan
2025-02-26 18:43 ` [v6 2/5] vhost: update vhost_user crypto session parameters Gowrishankar Muthukrishnan
2025-02-26 18:43 ` [v6 3/5] examples/vhost_crypto: fix user callbacks Gowrishankar Muthukrishnan
2025-02-26 18:43 ` [v6 4/5] vhost: support asymmetric RSA crypto ops Gowrishankar Muthukrishnan
2025-02-26 18:43 ` [v6 5/5] examples/vhost_crypto: support asymmetric crypto Gowrishankar Muthukrishnan
2025-02-27 13:59 ` [v7 0/5] vhost: add RSA support Gowrishankar Muthukrishnan
2025-02-27 13:59 ` [v7 1/5] vhost: skip crypto op fetch before vring init Gowrishankar Muthukrishnan
2025-02-27 13:59 ` [v7 2/5] vhost: update vhost_user crypto session parameters Gowrishankar Muthukrishnan
2025-02-27 13:59 ` [v7 3/5] examples/vhost_crypto: fix user callbacks Gowrishankar Muthukrishnan
2025-02-27 13:59 ` [v7 4/5] vhost: support asymmetric RSA crypto ops Gowrishankar Muthukrishnan
2025-02-27 13:59 ` [v7 5/5] examples/vhost_crypto: support asymmetric crypto Gowrishankar Muthukrishnan
2025-02-27 18:15 ` [v8 0/5] vhost: add RSA support Gowrishankar Muthukrishnan
2025-02-27 18:15 ` [v8 1/5] vhost: skip crypto op fetch before vring init Gowrishankar Muthukrishnan
2025-02-27 18:15 ` [v8 2/5] vhost: update vhost_user crypto session parameters Gowrishankar Muthukrishnan
2025-02-27 18:15 ` [v8 3/5] examples/vhost_crypto: fix user callbacks Gowrishankar Muthukrishnan
2025-02-27 18:15 ` [v8 4/5] vhost: support asymmetric RSA crypto ops Gowrishankar Muthukrishnan
2025-02-27 18:15 ` [v8 5/5] examples/vhost_crypto: support asymmetric crypto Gowrishankar Muthukrishnan
2025-01-07 18:08 ` [v2 0/2] crypto/virtio: add packed ring support Gowrishankar Muthukrishnan
2025-01-07 18:08 ` [v2 1/2] crypto/virtio: refactor queue operations Gowrishankar Muthukrishnan
2025-01-07 18:08 ` [v2 2/2] crypto/virtio: add packed ring support Gowrishankar Muthukrishnan
2025-01-07 18:44 ` [v2 0/4] crypto/virtio: add vDPA backend support Gowrishankar Muthukrishnan
2025-01-07 18:44 ` [v2 1/4] common/virtio: move vDPA to common directory Gowrishankar Muthukrishnan
2025-02-06 9:40 ` Maxime Coquelin
2025-02-06 14:21 ` [EXTERNAL] " Gowrishankar Muthukrishnan
2025-01-07 18:44 ` [v2 2/4] common/virtio: support cryptodev in vdev setup Gowrishankar Muthukrishnan
2025-01-07 18:44 ` [v2 3/4] crypto/virtio: add vhost backend to virtio_user Gowrishankar Muthukrishnan
2025-02-06 13:14 ` Maxime Coquelin
2025-01-07 18:44 ` [v2 4/4] test/crypto: test virtio_crypto_user PMD Gowrishankar Muthukrishnan
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=de649087-3686-4372-a1ac-d9a05961b6c0@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=anoobj@marvell.com \
--cc=chenbox@nvidia.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=gakhil@marvell.com \
--cc=gmuthukrishn@marvell.com \
--cc=jianjay.zhou@huawei.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;
as well as URLs for NNTP newsgroup(s).