On 2/7/25 12:00, Kees Cook wrote: > On Fri, Feb 07, 2025 at 10:42:34AM +1100, Balbir Singh wrote: >> When CONFIG_PCI_P2PDMA is enabled, it maps the PFN's via a >> ZONE_DEVICE mapping using devm_memremap_pages(). The mapped >> virtual address range corresponds to the pci_resource_start() >> of the BAR address and size corresponding to the BAR length. >> >> When KASLR is enabled, the direct map range of the kernel is >> reduced to the size of physical memory plus additional padding. >> If the BAR address is beyond this limit, PCI peer to peer DMA >> mappings fail. >> >> Fix this by not shrinking the size of direct map when CONFIG_PCI_P2PDMA >> is enabled. This reduces the total available entropy, but it's >> better than the current work around of having to disable KASLR >> completely. >> >> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> >> Cc: Andy Lutomirski <luto@xxxxxxxxxx> >> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> >> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> >> Cc: Ingo Molnar <mingo@xxxxxxxxxx> >> Cc: Borislav Petkov <bp@xxxxxxxxx> >> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx> >> Cc: Kees Cook <kees@xxxxxxxxxx> >> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> >> Link: https://lore.kernel.org/lkml/20250206023201.1481957-1-balbirs@xxxxxxxxxx/ >> >> Signed-off-by: Balbir Singh <balbirs@xxxxxxxxxx> > > Thanks for the update! > > Reviewed-by: Kees Cook <kees@xxxxxxxxxx> > Thank you Kees! I wanted to request that we pick this up in linux-next via the relevant subtree for further testing Balbir Singh