[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d6d049b1-ab7a-4f68-9956-55c24de8e737@redhat.com>
Date: Thu, 12 Jun 2025 11:34:39 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Jason Wang <jasowang@...hat.com>
Cc: netdev@...r.kernel.org, Willem de Bruijn
<willemdebruijn.kernel@...il.com>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, "Michael S. Tsirkin" <mst@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Eugenio Pérez
<eperezma@...hat.com>, Yuri Benditovich <yuri.benditovich@...nix.com>,
Akihiko Odaki <akihiko.odaki@...nix.com>
Subject: Re: [PATCH RFC v3 2/8] virtio_pci_modern: allow configuring extended
features
On 6/12/25 2:57 AM, Jason Wang wrote:
> On Fri, Jun 6, 2025 at 7:46 PM Paolo Abeni <pabeni@...hat.com> wrote:
>> -u64 vp_modern_get_features(struct virtio_pci_modern_device *mdev);
>> -u64 vp_modern_get_driver_features(struct virtio_pci_modern_device *mdev);
>> -void vp_modern_set_features(struct virtio_pci_modern_device *mdev,
>> - u64 features);
>> +void
>> +vp_modern_get_driver_extended_features(struct virtio_pci_modern_device *mdev,
>> + u64 *features);
>> +void vp_modern_get_extended_features(struct virtio_pci_modern_device *mdev,
>> + u64 *features);
>> +void vp_modern_set_extended_features(struct virtio_pci_modern_device *mdev,
>> + const u64 *features);
>> +
>> +static inline u64
>> +vp_modern_get_features(struct virtio_pci_modern_device *mdev)
>> +{
>> + u64 features_array[VIRTIO_FEATURES_DWORDS];
>> + int i;
>> +
>> + vp_modern_get_extended_features(mdev, features_array);
>> + for (i = 1; i < VIRTIO_FEATURES_DWORDS; ++i)
>> + WARN_ON_ONCE(features_array[i]);
>
> It looks to me it's sufficient and safe to just return
> featuers_array[0] here. Or maybe we need some comment to explain why
> we need WARN here.
vp_modern_get_extended_features() can return a 'features' array
including extended features. Callers of vp_modern_get_features() can
deal with/expect features to be present only in the lower 64 bit range.
This check is intended to catch early device bug/inconsistencies, but
I'm unsure if e.g. syzkaller could hit with some fancy setup.
I can drop the check in the next revision.
/P
Powered by blists - more mailing lists