In the Linux kernel, the following vulnerability has been resolved:
resource,kexec: walksystemramresrev must retain resource flags
walksystemramresrev() erroneously discards resource flags when passing the information to the callback.
This causes systems with IORESOURCESYSRAMDRIVER_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 CONFIGIMAKEXEC=y. Adding printk's showed the flags were being discarded and as a result the check for IORESOURCESYSRAMDRIVER_MANAGED passes.
findnextiomem_res: name(System RAM (kmem)) start(10000000000) end(1034fffffff) flags(83000200)
locatememholetopdown: start(10000000000) end(1034fffffff) flags(0)
[.] BUG: unable to handle page fault for address: ffff89834ffff000 [.] #PF: supervisor read access in kernel mode [.] #PF: errorcode(0x0000) - not-present page [.] PGD c04c8bf067 P4D c04c8bf067 PUD c04c8be067 PMD 0 [.] Oops: 0000 [#1] SMP [.] RIP: 0010:imarestoremeasurementlist+0x95/0x4b0 [.] RSP: 0018:ffffc900000d3a80 EFLAGS: 00010286 [.] RAX: 0000000000001000 RBX: 0000000000000000 RCX: ffff89834ffff000 [.] RDX: 0000000000000018 RSI: ffff89834ffff000 RDI: ffff89834ffff018 [.] RBP: ffffc900000d3ba0 R08: 0000000000000020 R09: ffff888132b8a900 [.] R10: 4000000000000000 R11: 000000003a616d69 R12: 0000000000000000 [.] R13: ffffffff8404ac28 R14: 0000000000000000 R15: ffff89834ffff000 [.] FS: 0000000000000000(0000) GS:ffff893d44640000(0000) knlGS:0000000000000000 [.] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [.] ata5: SATA link down (SStatus 0 SControl 300) [.] CR2: ffff89834ffff000 CR3: 000001034d00f001 CR4: 0000000000770ef0 [.] PKRU: 55555554 [.] Call Trace: [.] <TASK> [.] ? die+0x78/0xc0 [.] ? pagefaultoops+0x2a8/0x3a0 [.] ? excpagefault+0x84/0x130 [.] ? asmexcpagefault+0x22/0x30 [.] ? imarestoremeasurementlist+0x95/0x4b0 [.] ? templatedescinitfields+0x317/0x410 [.] ? cryptoalloctfmnode+0x9c/0xc0 [.] ? initimalsm+0x30/0x30 [.] imaloadkexecbuffer+0x72/0xa0 [.] imainit+0x44/0xa0 [.] _initstubkmodima_3731201initima7+0x1e/0xb0 [.] ? initimalsm+0x30/0x30 [.] dooneinitcall+0xad/0x200 [.] ? idralloccyclic+0xaa/0x110 [.] ? newslab+0x12c/0x420 [.] ? newslab+0x12c/0x420 [.] ? number+0x12a/0x430 [.] ? sysvecapictimerinterrupt+0xa/0x80 [.] ? asmsysvecapictimerinterrupt+0x16/0x20 [.] ? parseargs+0xd4/0x380 [.] ? parseargs+0x14b/0x380 [.] kernelinitfreeable+0x1c1/0x2b0 [.] ? restinit+0xb0/0xb0 [.] kernelinit+0x16/0x1a0 [.] retfromfork+0x2f/0x40 [.] ? restinit+0xb0/0xb0 [.] retfromfork_asm+0x11/0x20 [.] </TASK>