[PATCH 0/4] hw/nvme: make model & firmware version cnofigurable

Daniel P. Berrangé posted 4 patches 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260306165717.3360110-1-berrange@redhat.com
Maintainers: Keith Busch <kbusch@kernel.org>, Klaus Jensen <its@irrelevant.dk>, Jesper Devantier <foss@defmacro.it>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, Stefan Hajnoczi <stefanha@redhat.com>, Fam Zheng <fam@euphon.net>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
docs/system/devices/nvme.rst | 10 ++++++++++
hw/nvme/ctrl.c               | 31 ++++++++++++++++++++++++++++---
hw/nvme/nvme.h               |  2 ++
include/block/nvme.h         | 10 +++++++---
4 files changed, 47 insertions(+), 6 deletions(-)
[PATCH 0/4] hw/nvme: make model & firmware version cnofigurable
Posted by Daniel P. Berrangé 1 month, 1 week ago
These are both currently set to QEMU specific hardcoded defaults,
and in common with other block devices, should allow user overrides.

The pre-existing serial field should also be length checked to
detect & report invalid user input instead of silently truncating.

Daniel P. Berrangé (4):
  include/block: define constants for NVME string fields
  hw/nvme: report error for oversized 'serial' parameter
  hw/nvme: add user controlled 'model' property
  hw/nvme: add user controlled 'firmware-version' property

 docs/system/devices/nvme.rst | 10 ++++++++++
 hw/nvme/ctrl.c               | 31 ++++++++++++++++++++++++++++---
 hw/nvme/nvme.h               |  2 ++
 include/block/nvme.h         | 10 +++++++---
 4 files changed, 47 insertions(+), 6 deletions(-)

-- 
2.53.0


Re: [PATCH 0/4] hw/nvme: make model & firmware version cnofigurable
Posted by Avi Kivity 3 weeks, 3 days ago
On Fri, Mar 6, 2026 at 6:57 PM Daniel P. Berrangé <berrange@redhat.com>
wrote:

> These are both currently set to QEMU specific hardcoded defaults,
> and in common with other block devices, should allow user overrides.
>
> The pre-existing serial field should also be length checked to
> detect & report invalid user input instead of silently truncating.
>
> Daniel P. Berrangé (4):
>   include/block: define constants for NVME string fields
>   hw/nvme: report error for oversized 'serial' parameter
>   hw/nvme: add user controlled 'model' property
>   hw/nvme: add user controlled 'firmware-version' property
>
>
Ping on this, I'd really like to see it merged.
Re: [PATCH 0/4] hw/nvme: make model & firmware version cnofigurable
Posted by Keith Busch 1 month, 1 week ago
On Fri, Mar 06, 2026 at 04:57:13PM +0000, Daniel P. Berrangé wrote:
> The pre-existing serial field should also be length checked to
> detect & report invalid user input instead of silently truncating.

Generally fine with that, but worried about user regressions from
unknowingly relying on the truncation behavior. Could these overflow
conditions just emit a truncation warn_report instead of failing to
start?
Re: [PATCH 0/4] hw/nvme: make model & firmware version cnofigurable
Posted by Daniel P. Berrangé 1 month ago
On Fri, Mar 06, 2026 at 10:05:37AM -0700, Keith Busch wrote:
> On Fri, Mar 06, 2026 at 04:57:13PM +0000, Daniel P. Berrangé wrote:
> > The pre-existing serial field should also be length checked to
> > detect & report invalid user input instead of silently truncating.
> 
> Generally fine with that, but worried about user regressions from
> unknowingly relying on the truncation behavior. Could these overflow
> conditions just emit a truncation warn_report instead of failing to
> start?

There is always that possibility that someone is unknowingly having
their data truncated, however, we have generally taken the view that
it is fair game to introduce error checking for invalid input in
these kind of cases. As prior art, we introduced error checking to
the SCSI serial to remove truncation:

  commit 75997e182b695f2e3f0a2d649734952af5caf3ee
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   Tue Jun 4 18:17:55 2024 +0200

    scsi-disk: Don't silently truncate serial number

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|