]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerSasha Levin <sasha.levin@oracle.com>
Sat, 14 Mar 2015 19:37:19 +0000 (15:37 -0400)
commit6ddd115f4c15c2fe03bc2e214c3c95a9626156e2
tree3f0d0aad84934a920b515ab2dc27092282b8b2f6
parentce5dd33cbf06346752eeb5530e135d953d6b7abb
x86/fpu/xsaves: Fix improper uses of __ex_table

commit 06c8173eb92bbfc03a0fe8bb64315857d0badd06 upstream.

Commit:

  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 <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: Allan Xavier <mr.a.xavier@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
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 <mingo@kernel.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
arch/x86/include/asm/xsave.h