lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 2 Oct 2023 10:07:21 -0600
From: Logan Gunthorpe <>
To: "Gustavo A. R. Silva" <>,
 Bjorn Helgaas <>
Subject: Re: [PATCH][next] PCI/P2PDMA: Fix undefined behavior bug in struct

On 2023-10-01 15:08, Gustavo A. R. Silva wrote:
> `struct dev_pagemap` is a flexible structure, which means that it
> contains a flexible-array member at the bottom. This could potentially
> lead to an overwrite of the objects following `pgmap` in `struct
> pci_p2pdma_pagemap`, when `nr_range > 1`.
> Fix this by placing the declaration of object `pgmap` at the end of
> `struct pci_p2pdma_pagemap`.
> -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting
> ready to enable it globally.
> Fixes: 0afea3814358 ("PCI/P2PDMA: Add provider's pci_dev to pci_p2pdma_pagemap struct")
> Fixes: a6e6fe6549f6 ("PCI/P2PDMA: Introduce private pagemap structure")
> Cc:
> Signed-off-by: Gustavo A. R. Silva <>

Makes sense to me, thanks.

Although, I'm not sure the fixes tags are appropriate. The
flexible-array member was introduced in 5.10 (b7b3c01b19) and both the
"fixed" commits predate that change by a number of releases.

Also, it's probably worth noting in the commit message that the p2pdma
code hardcodes nr_ranges to 1 (in pci_p2pdma_add_resource); so there is
no way to actually hit any bug with the current code.

I totally agree that the patch should be applied to prevent possible
bugs being introduced in the future:

Reviewed-by: Logan Gunthorpe <>


Powered by blists - more mailing lists