From: sashiko-bot@kernel.org
To: "Farhan Ali" <alifm@linux.ibm.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v15 5/7] vfio-pci/zdev: Add a device feature for error information
Date: Tue, 05 May 2026 23:27:04 +0000 [thread overview]
Message-ID: <20260505232704.A6F95C2BCB4@smtp.kernel.org> (raw)
In-Reply-To: <20260505200510.2954-6-alifm@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] UAPI structure `vfio_device_feature_zpci_err` uses non-portable bitfields and contains implicit padding, violating UAPI design guidelines.
--
commit 9302e2545ccb75aab62ae8f60f8aba469ebfdf04
Author: Farhan Ali <alifm@linux.ibm.com>
vfio-pci/zdev: Add a device feature for error information
This commit adds a new device feature to expose zPCI platform specific error
information to userspace. This allows userspace to take appropriate actions to
handle an error on the device and perform mediated recovery.
> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
> index 5de618a3a5eee..3eead86a00ab2 100644
> --- a/include/uapi/linux/vfio.h
> +++ b/include/uapi/linux/vfio.h
[ ... ]
> +struct vfio_device_feature_zpci_err {
> + __u32 feature_flags; /* Indicate future features */
> + __u32 reserved1;
> + __u32 fh; /* function handle */
> + __u32 fid; /* function id */
> + __u32 ett : 4; /* expected table type */
> + __u32 mvn : 12; /* MSI vector number */
> + __u32 dmaas : 8; /* DMA address space */
> + __u32 reserved2 : 6;
> + __u32 q : 1; /* event qualifier */
> + __u32 rw : 1; /* read/write */
Since the memory layout, ordering, and packing of C bitfields are highly
compiler-dependent, could this compromise cross-platform ABI stability or
break compatibility with other languages interacting with the kernel?
Using standard __u32 fields and bitmask macros instead might be a safer
approach for a UAPI header.
> + __u64 faddr; /* failing address */
The faddr member requires 8-byte alignment, but it appears to be positioned
after exactly 20 bytes of prior fields. Does this force 4 bytes of implicit
compiler padding before it?
> + __u32 reserved3;
> + __u16 reserved4;
> + __u16 pec; /* PCI event code */
> + __u8 reserved5[28]; /* Allow for future expansion */
> +};
The explicit data size of this structure appears to be 68 bytes, which
would force another 4 bytes of implicit trailing padding to align the 72-byte
structure.
Could this implicit padding make ioctl size validation fragile?
Additionally, if the compiler fails to zero the implicit padding during
struct initialization with err = {}, is there a risk that copy_to_user()
will leak uninitialized kernel stack memory to userspace?
Using explicit reserved padding fields to ensure manual, deterministic 8-byte
alignment could avoid these issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260505200510.2954-1-alifm@linux.ibm.com?part=5
next prev parent reply other threads:[~2026-05-05 23:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 20:05 [PATCH v15 0/7] Error recovery for vfio-pci devices on s390x Farhan Ali
2026-05-05 20:05 ` [PATCH v15 1/7] PCI: Allow per function PCI slots to fix slot reset on s390 Farhan Ali
2026-05-05 21:29 ` sashiko-bot
2026-05-05 20:05 ` [PATCH v15 2/7] PCI: Avoid saving config space state if inaccessible Farhan Ali
2026-05-05 21:58 ` sashiko-bot
2026-05-05 20:05 ` [PATCH v15 3/7] PCI: Fail FLR when config space is inaccessible Farhan Ali
2026-05-05 22:20 ` sashiko-bot
2026-05-05 20:05 ` [PATCH v15 4/7] s390/pci: Store PCI error information for passthrough devices Farhan Ali
2026-05-05 22:56 ` sashiko-bot
2026-05-06 9:38 ` Niklas Schnelle
2026-05-06 17:20 ` Farhan Ali
2026-05-08 19:58 ` Niklas Schnelle
2026-05-05 20:05 ` [PATCH v15 5/7] vfio-pci/zdev: Add a device feature for error information Farhan Ali
2026-05-05 23:27 ` sashiko-bot [this message]
2026-05-05 20:05 ` [PATCH v15 6/7] vfio/pci: Add a reset_done callback for vfio-pci driver Farhan Ali
2026-05-05 23:56 ` sashiko-bot
2026-05-05 20:05 ` [PATCH v15 7/7] vfio/pci: Remove the pcie check for VFIO_PCI_ERR_IRQ_INDEX Farhan Ali
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=20260505232704.A6F95C2BCB4@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alifm@linux.ibm.com \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko@lists.linux.dev \
/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