From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968261AbdIZIpj (ORCPT ); Tue, 26 Sep 2017 04:45:39 -0400 Received: from terminus.zytor.com ([65.50.211.136]:50843 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965430AbdIZIpg (ORCPT ); Tue, 26 Sep 2017 04:45:36 -0400 Date: Tue, 26 Sep 2017 01:36:43 -0700 From: tip-bot for Eric Biggers Message-ID: Cc: tglx@linutronix.de, luto@kernel.org, hpa@zytor.com, mingo@kernel.org, oleg@redhat.com, peterz@infradead.org, wanpeng.li@hotmail.com, keescook@chromium.org, bp@alien8.de, haokexin@gmail.com, ebiggers@google.com, torvalds@linux-foundation.org, luto@amacapital.net, riel@redhat.com, dave.hansen@linux.intel.com, fenghua.yu@intel.com, akpm@linux-foundation.org, ebiggers3@gmail.com, yu-cheng.yu@intel.com, linux-kernel@vger.kernel.org, dvyukov@google.com, mhalcrow@google.com Reply-To: fenghua.yu@intel.com, mhalcrow@google.com, linux-kernel@vger.kernel.org, dvyukov@google.com, yu-cheng.yu@intel.com, ebiggers3@gmail.com, akpm@linux-foundation.org, dave.hansen@linux.intel.com, riel@redhat.com, haokexin@gmail.com, bp@alien8.de, ebiggers@google.com, luto@amacapital.net, torvalds@linux-foundation.org, mingo@kernel.org, hpa@zytor.com, luto@kernel.org, tglx@linutronix.de, wanpeng.li@hotmail.com, keescook@chromium.org, peterz@infradead.org, oleg@redhat.com In-Reply-To: <20170924105913.9157-8-mingo@kernel.org> References: <20170924105913.9157-8-mingo@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/fpu] x86/fpu: Copy the full header in copy_user_to_xstate() Git-Commit-ID: af2c4322d986a08a6e793b74b83a62b325019c20 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: af2c4322d986a08a6e793b74b83a62b325019c20 Gitweb: http://git.kernel.org/tip/af2c4322d986a08a6e793b74b83a62b325019c20 Author: Eric Biggers AuthorDate: Sun, 24 Sep 2017 12:59:10 +0200 Committer: Ingo Molnar CommitDate: Tue, 26 Sep 2017 09:43:47 +0200 x86/fpu: Copy the full header in copy_user_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-8-mingo@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/kernel/fpu/xstate.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index 325db78..0cd7b73 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -1199,13 +1199,16 @@ int copy_user_to_xstate(struct xregs_state *xsave, const void __user *ubuf) int i; u64 xfeatures; u64 allowed_features; + struct xstate_header hdr; offset = offsetof(struct xregs_state, header); - size = sizeof(xfeatures); + size = sizeof(hdr); - if (__copy_from_user(&xfeatures, ubuf + offset, size)) + if (__copy_from_user(&hdr, ubuf + offset, size)) return -EFAULT; + xfeatures = hdr.xfeatures; + /* * Reject if the user sets any disabled or supervisor features: */