On Thu, Oct 17, 2024 at 03:03:47PM -0400, Gregory Price wrote: > walk_system_ram_res_rev() erroneously discards resource flags when > passing the information to the callback. > > This causes systems with IORESOURCE_SYSRAM_DRIVER_MANAGED memory to > have these resources selected during kexec to store kexec buffers > if that memory happens to be at placed above normal system ram. > > This leads to undefined behavior after reboot. If the kexec buffer > is never touched, nothing happens. If the kexec buffer is touched, > it could lead to a crash (like below) or undefined behavior. > > Tested on a system with CXL memory expanders with driver managed > memory, TPM enabled, and CONFIG_IMA_KEXEC=y. Adding printk's > showed the flags were being discarded and as a result the check > for IORESOURCE_SYSRAM_DRIVER_MANAGED passes. > > find_next_iomem_res: name(System RAM (kmem)) > start(10000000000) > end(1034fffffff) > flags(83000200) > > locate_mem_hole_top_down: start(10000000000) end(1034fffffff) flags(0) > > [.] BUG: unable to handle page fault for address: ffff89834ffff000 Please, cut this down to only important ~3-5 lines as suggested in the Submitting Patches documentation. Yeah, I see that Andrew applied it to hist testing branch, if it's not going to be updated there, consider above as a hint for the future contributions with backtraces. -- With Best Regards, Andy Shevchenko