]> git.baikalelectronics.ru Git - kernel.git/commit
x86/fpu/xsaves: Fix improper uses of __ex_table
authorQuentin Casasnovas <quentin.casasnovas@oracle.com>
Thu, 5 Mar 2015 12:19:22 +0000 (13:19 +0100)
committerIngo Molnar <mingo@kernel.org>
Thu, 5 Mar 2015 17:20:36 +0000 (18:20 +0100)
commit36afc02af30f73f62c69737b5c888432e77a83b5
tree73ecc10d3017c9ae7a6403fca3afbf3d7ec12997
parent8969f66a11c98187b635772927f2d77ac6a457c2
x86/fpu/xsaves: Fix improper uses of __ex_table

Commit:

  57fefce984a2 ("x86/xsaves: Use xsaves/xrstors to save and restore xsave area")

introduced alternative instructions for XSAVES/XRSTORS and commit:

  4aeb501d3d90 ("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 <quentin.casasnovas@oracle.com>
Signed-off-by: Jamie Iles <jamie.iles@oracle.com>
[ Improved the changelog, fixed some whitespace noise. ]
Acked-by: Borislav Petkov <bp@alien8.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: <stable@vger.kernel.org>
Cc: Allan Xavier <mr.a.xavier@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 4aeb501d3d90 ("x86/xsaves: Add xsaves and xrstors support for booting time")
Fixes: 57fefce984a2 ("x86/xsaves: Use xsaves/xrstors to save and restore xsave area")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/xsave.h