x86/fpu/xsaves: Fix improper uses of __ex_table
f31a9f7c7169 ("x86/xsaves: Use xsaves/xrstors to save and restore xsave area")
introduced alternative instructions for XSAVES/XRSTORS and commit:
adb9d526e982 ("x86/xsaves: Add xsaves and xrstors support for booting time")
added support for the XSAVES/XRSTORS instructions at boot time.
Unfortunately both failed to properly protect them against faulting:
The 'xstate_fault' macro will use the closest label named '1'
backward and that ends up in the .altinstr_replacement section
rather than in .text. This means that the kernel will never find
in the __ex_table the .text address where this instruction might
fault, leading to serious problems if userspace manages to
trigger the fault.
Signed-off-by: Quentin Casasnovas <firstname.lastname@example.org>
Signed-off-by: Jamie Iles <email@example.com>
[ Improved the changelog, fixed some whitespace noise. ]
Acked-by: Borislav Petkov <firstname.lastname@example.org>
Acked-by: Linus Torvalds <email@example.com>
Cc: Allan Xavier <firstname.lastname@example.org>
Cc: H. Peter Anvin <email@example.com>
Cc: Thomas Gleixner <firstname.lastname@example.org>
Fixes: adb9d526e982 ("x86/xsaves: Add xsaves and xrstors support for booting time")
Fixes: f31a9f7c7169 ("x86/xsaves: Use xsaves/xrstors to save and restore xsave area")
Signed-off-by: Ingo Molnar <email@example.com>
1 file changed