[PATCH] x86/sgx: Skip EPC initialization in the kdump kernel

sashiko-bot at kernel.org sashiko-bot at kernel.org
Wed Nov 11 04:54:04 PST 2026


> The kdump capture kernel cannot use SGX: EPC memory is e820-reserved,
> so it is not part of the crash dump, and no enclave will ever run
> during dump capture.  Yet sgx_init() runs unconditionally and pays the
> full EPC bookkeeping: sgx_setup_epc_section() allocates one struct
> sgx_epc_page (32 bytes) per 4K EPC page, i.e. EPC/128, plus a memremap
> of the whole EPC range.
> 
> The capture kernel has no memory other than the crashkernel
> reservation.  On a VM with 15.5G EPC the bookkeeping alone costs
> 124 MB of vmalloc - nearly half of the stock crashkernel=256M -
> and the cost scales with EPC size, not RAM.
> 
> That is enough to break kdump outright: with the default 256M the
> capture kernel OOMs in early userspace (udevadm and journald are killed
> before the root device is enumerated) and no vmcore is produced, while
> 512M works.  With this change the same 256M reservation captures a
> complete vmcore; SGX initializes as usual on normal boots.
> 
> Reported-by: Challvy Tee <challvy.tee at gmail.com>
> Signed-off-by: Yuanhe Shu <xiangzao at linux.alibaba.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261111123942.3842771-1-xiangzao@linux.alibaba.com?part=1




More information about the kexec mailing list