From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937096AbdIZIrd (ORCPT ); Tue, 26 Sep 2017 04:47:33 -0400 Received: from terminus.zytor.com ([65.50.211.136]:57401 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936757AbdIZIoX (ORCPT ); Tue, 26 Sep 2017 04:44:23 -0400 Date: Tue, 26 Sep 2017 01:35:33 -0700 From: tip-bot for Eric Biggers Message-ID: Cc: luto@kernel.org, dvyukov@google.com, tglx@linutronix.de, torvalds@linux-foundation.org, hpa@zytor.com, bp@alien8.de, akpm@linux-foundation.org, oleg@redhat.com, linux-kernel@vger.kernel.org, dave.hansen@linux.intel.com, haokexin@gmail.com, keescook@chromium.org, mingo@kernel.org, yu-cheng.yu@intel.com, ebiggers@google.com, mhalcrow@google.com, peterz@infradead.org, fenghua.yu@intel.com, luto@amacapital.net, ebiggers3@gmail.com, wanpeng.li@hotmail.com, riel@redhat.com Reply-To: yu-cheng.yu@intel.com, ebiggers@google.com, mhalcrow@google.com, peterz@infradead.org, fenghua.yu@intel.com, luto@amacapital.net, ebiggers3@gmail.com, wanpeng.li@hotmail.com, riel@redhat.com, luto@kernel.org, dvyukov@google.com, tglx@linutronix.de, torvalds@linux-foundation.org, hpa@zytor.com, bp@alien8.de, akpm@linux-foundation.org, oleg@redhat.com, haokexin@gmail.com, dave.hansen@linux.intel.com, linux-kernel@vger.kernel.org, keescook@chromium.org, mingo@kernel.org In-Reply-To: <20170924105913.9157-5-mingo@kernel.org> References: <20170924105913.9157-5-mingo@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/fpu] x86/fpu: Copy the full state_header in copy_kernel_to_xstate() Git-Commit-ID: 80d8ae86b36791a545ca28ddc95133ea59bba6e0 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 80d8ae86b36791a545ca28ddc95133ea59bba6e0 Gitweb: http://git.kernel.org/tip/80d8ae86b36791a545ca28ddc95133ea59bba6e0 Author: Eric Biggers AuthorDate: Sun, 24 Sep 2017 12:59:07 +0200 Committer: Ingo Molnar CommitDate: Tue, 26 Sep 2017 09:43:46 +0200 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 Cc: Andrew Morton Cc: Andy Lutomirski Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Dave Hansen Cc: Dmitry Vyukov Cc: Eric Biggers Cc: Fenghua Yu Cc: Kees Cook Cc: Kevin Hao Cc: Linus Torvalds Cc: Michael Halcrow Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Cc: Wanpeng Li Cc: Yu-cheng Yu Cc: kernel-hardening@lists.openwall.com Link: http://lkml.kernel.org/r/20170924105913.9157-5-mingo@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/kernel/fpu/xstate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index 2427aee..02591b96 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) int i; u64 xfeatures; u64 allowed_features; + struct xstate_header hdr; offset = offsetof(struct xregs_state, header); - size = sizeof(xfeatures); + size = sizeof(hdr); - memcpy(&xfeatures, kbuf + offset, size); + memcpy(&hdr, kbuf + offset, size); + xfeatures = hdr.xfeatures; /* * Reject if the user sets any disabled or supervisor features: