From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752690AbbC2NYy (ORCPT ); Sun, 29 Mar 2015 09:24:54 -0400 Received: from mail-la0-f45.google.com ([209.85.215.45]:35683 "EHLO mail-la0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752255AbbC2NYv (ORCPT ); Sun, 29 Mar 2015 09:24:51 -0400 MIME-Version: 1.0 In-Reply-To: <20150329121347.GC4973@pd.tnic> References: <202c56ca63823c338af8e2e54948dbe222da6343.1426728647.git.luto@kernel.org> <20150324194402.GA27598@gmail.com> <55155F9E.3030605@redhat.com> <20150329070816.GD18007@gmail.com> <20150329090233.GA1963@gmail.com> <20150329121347.GC4973@pd.tnic> From: Andy Lutomirski Date: Sun, 29 Mar 2015 06:24:29 -0700 Message-ID: Subject: Re: [PATCH] x86/asm/entry: Remove user_mode_ignore_vm86() To: Borislav Petkov Cc: Ingo Molnar , Denys Vlasenko , "H. Peter Anvin" , Brad Spengler , Linus Torvalds , "linux-kernel@vger.kernel.org" , Thomas Gleixner , Andrew Lutomirski , "linux-tip-commits@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 29, 2015 at 5:13 AM, Borislav Petkov wrote: > On Sun, Mar 29, 2015 at 11:02:34AM +0200, Ingo Molnar wrote: >> So how about doing the patch below? >> >> Thanks, >> >> Ingo >> >> ===================================> >> From 6677d6f073cfda7f1036eb06d13faaad5c6742cc Mon Sep 17 00:00:00 2001 >> From: Ingo Molnar >> Date: Sun, 29 Mar 2015 09:10:08 +0200 >> Subject: [PATCH] x86/asm/entry: Remove user_mode_ignore_vm86() >> >> user_mode_ignore_vm86() can be used instead of user_mode(), in >> places where we have already done a v8086_mode() security >> check of ptregs. >> >> But doing this check in the wrong place would be a bug that could >> result in security problems, and also the naming still isn't very clear. >> >> Furthermore, it only affects 32-bit kernels, while most development >> happens on 64-bit kernels. >> >> If we replace them with user_mode() checks then the cost is only a >> very minor increase in various slowpaths: >> >> text data bss dec hex filename >> 10573391 703562 1753042 13029995 c6d26b vmlinux.o.before >> 10573423 703562 1753042 13030027 c6d28b vmlinux.o.after >> >> So lets get rid of this distinction once and for all. >> >> Cc: Andy Lutomirski >> Cc: Borislav Petkov >> Cc: Denys Vlasenko >> Cc: H. Peter Anvin >> Cc: Linus Torvalds >> Cc: Oleg Nesterov >> Cc: Thomas Gleixner >> Signed-off-by: Ingo Molnar >> --- >> arch/x86/include/asm/ptrace.h | 17 ----------------- >> arch/x86/kernel/cpu/perf_event.c | 2 +- >> arch/x86/kernel/traps.c | 6 +++--- >> 3 files changed, 4 insertions(+), 21 deletions(-) > > I had some doubts about people using user_mode_ignore_vm86() in the > wrong way and thus introducing sec. bugs. > > Since this is only on the slow path, simplifying the code makes sense to > me. > > Acked-by: Borislav Petkov > Ditto. Acked-by: Andy Lutomirski > -- > Regards/Gruss, > Boris. > > ECO tip #101: Trim your mails when you reply. > -- -- Andy Lutomirski AMA Capital Management, LLC