x86/boot: Fail gracefully if SMP MP-table early_memremap fails
PATCH 1/1 x86/boot: Fail gracefully if SMP MP-table early_memremap fails
At least one older motherboard (Micronics W6-LI Pentium Pro) has been observed to fill in the physptr but not actually populate the mpc when only one CPU is present. In this specific case, this leads to the size field being zero which causes early_memremap to fail. This then causes a NULL pointer exception in smp_read_mpc.
Add a simple return check. Returning -1 here will cause the MP-table to be ignored and the system to boot in nosmp mode.
--- arch/x86/kernel/mpparse.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kernel/mpparse.c +4 -0
@@ -438,6 +438,10 @@ static int __init check_physptr(struct mpf_intel *mpf, unsigned int early) size =get_mpc_size (mpf->physptr); mpc =early_memremap (mpf->physptr, size); +if (!mpc) { +pr_err ("MPTABLE: mpc early_memremap() failed\n" ); +return -1 ; + }/* * Read the physical hardware table. Anything here will
Signature · 1 line
2.36.1
Borislav Petkov
maintainerQuoted 26 lines · Russ Dill
At least one older motherboard (Micronics W6-LI Pentium Pro) has been observed to fill in the physptr but not actually populate the mpc when only one CPU is present. In this specific case, this leads to the size field being zero which causes
early_memremapto fail. This then causes a NULL pointer exception insmp_read_mpc.Add a simple return check. Returning -1 here will cause the MP-table to be ignored and the system to boot in nosmp mode.
Signed-off-by Russ Dill <[email protected]>Cc Tom Lendacky <[email protected]>Cc Ingo Molnar <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Yinghai Lu <[email protected]>Cc Dave Hansen <[email protected]>Cc H. Peter Anvin <[email protected]>--- arch/x86/kernel/mpparse.c | 4 ++++ 1 file changed, 4 insertions(+)arch/x86/kernel/mpparse.c +0
-0
arch/x86/kernel/mpparse.c static int __init check_physptr(struct mpf_intel *mpf, unsigned int early) · line 439
Quoted 2 lines
arch/x86/kernel/mpparse.c +0
-0@@ -438,6 +438,10 @@ static int __init check_physptr(struct mpf_intel *mpf, unsigned int early) size =get_mpc_size (mpf->physptr);
If the size is 0, why aren't you checking size and returning early here instead of the early_memremap() result which gets called with size=0?
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette