diff options
author | Eric Biggers <ebiggers@google.com> | 2017-09-24 06:59:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-09-26 03:43:46 -0400 |
commit | 80d8ae86b36791a545ca28ddc95133ea59bba6e0 (patch) | |
tree | 2b1b3224513045f7245a2640deb74a8d45abca02 | |
parent | b11e2e18a7fc8eaa3d592c260d50c7129e094ded (diff) |
x86/fpu: Copy the full state_header in copy_kernel_to_xstate()
This is in preparation to verify the full xstate header as supplied by user-space.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Eric Biggers <ebiggers3@gmail.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Kevin Hao <haokexin@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael Halcrow <mhalcrow@google.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com>
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170924105913.9157-5-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/kernel/fpu/xstate.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index 2427aeea33b5..02591b96bb25 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c | |||
@@ -1148,11 +1148,13 @@ int copy_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf) | |||
1148 | int i; | 1148 | int i; |
1149 | u64 xfeatures; | 1149 | u64 xfeatures; |
1150 | u64 allowed_features; | 1150 | u64 allowed_features; |
1151 | struct xstate_header hdr; | ||
1151 | 1152 | ||
1152 | offset = offsetof(struct xregs_state, header); | 1153 | offset = offsetof(struct xregs_state, header); |
1153 | size = sizeof(xfeatures); | 1154 | size = sizeof(hdr); |
1154 | 1155 | ||
1155 | memcpy(&xfeatures, kbuf + offset, size); | 1156 | memcpy(&hdr, kbuf + offset, size); |
1157 | xfeatures = hdr.xfeatures; | ||
1156 | 1158 | ||
1157 | /* | 1159 | /* |
1158 | * Reject if the user sets any disabled or supervisor features: | 1160 | * Reject if the user sets any disabled or supervisor features: |