From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754728AbdCIBNJ (ORCPT ); Wed, 8 Mar 2017 20:13:09 -0500 Received: from mga07.intel.com ([134.134.136.100]:14459 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752378AbdCIBNH (ORCPT ); Wed, 8 Mar 2017 20:13:07 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,266,1486454400"; d="scan'208";a="1120254786" Message-ID: <1489021909.131264.30.camel@ranerica-desktop> Subject: Re: [v6 PATCH 00/21] x86: Enable User-Mode Instruction Prevention From: Ricardo Neri To: Stas Sergeev Cc: Andy Lutomirski , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andy Lutomirski , Borislav Petkov , Peter Zijlstra , Andrew Morton , Brian Gerst , Chris Metcalf , Dave Hansen , Paolo Bonzini , Liang Z Li , Masami Hiramatsu , Huang Rui , Jiri Slaby , Jonathan Corbet , "Michael S. Tsirkin" , Paul Gortmaker , Vlastimil Babka , Chen Yucong , Alexandre Julliard , Fenghua Yu , "Ravi V. Shankar" , Shuah Khan , "linux-kernel@vger.kernel.org" , X86 ML , linux-msdos@vger.kernel.org, wine-devel@winehq.org Date: Wed, 08 Mar 2017 17:11:49 -0800 In-Reply-To: References: <20170308003254.27833-1-ricardo.neri-calderon@linux.intel.com> <79ba0fff-4c01-2bfa-06cb-5cfc98dd710c@list.ru> <997ba581-ecfa-b773-a48e-85b92a439836@list.ru> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2017-03-08 at 19:53 +0300, Stas Sergeev wrote: > 08.03.2017 19:46, Andy Lutomirski пишет: > >> No no, since I meant prot mode, this is not what I need. > >> I would never need to disable UMIP as to allow the > >> prot mode apps to do SLDT. Instead it would be good > >> to have an ability to provide a replacement for the dummy > >> emulation that is currently being proposed for kernel. > >> All is needed for this, is just to deliver a SIGSEGV. > > That's what I meant. Turning off FIXUP_UMIP would leave UMIP on but > > turn off the fixup, so you'd get a SIGSEGV indicating #GP (or a vm86 > > GP exit). > But then I am confused with the word "compat" in > your "COMPAT_MASK0_X86_UMIP_FIXUP" and > "sys_adjust_compat_mask(int op, int word, u32 mask);" > > Leaving UMIP on and only disabling a fixup doesn't > sound like a compat option to me. I would expect > compat to disable it completely. I guess that the _UMIP_FIXUP part makes it clear that emulation, not UMIP is disabled, allowing the SIGSEGV be delivered to the user space program. Would having a COMPAT_MASK0_X86_UMIP_FIXUP to disable emulation and a COMPAT_MASK0_X86_UMIP to disable UMIP make sense? Also, wouldn't having a COMPAT_MASK0_X86_UMIP to disable UMIP defeat its purpose? Applications could simply use this compat mask to bypass UMIP and gain access to the instructions it protects. Thanks and BR, Ricardo From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Neri Subject: Re: [v6 PATCH 00/21] x86: Enable User-Mode Instruction Prevention Date: Wed, 08 Mar 2017 17:11:49 -0800 Message-ID: <1489021909.131264.30.camel@ranerica-desktop> References: <20170308003254.27833-1-ricardo.neri-calderon@linux.intel.com> <79ba0fff-4c01-2bfa-06cb-5cfc98dd710c@list.ru> <997ba581-ecfa-b773-a48e-85b92a439836@list.ru> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: Sender: linux-msdos-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="utf-8" To: Stas Sergeev Cc: Andy Lutomirski , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andy Lutomirski , Borislav Petkov , Peter Zijlstra , Andrew Morton , Brian Gerst , Chris Metcalf , Dave Hansen , Paolo Bonzini , Liang Z Li , Masami Hiramatsu , Huang Rui , Jiri Slaby , Jonathan Corbet , "Michael S. Tsirkin" , Paul Gortmaker , Vlastimil Babka , Chen Yucong <> On Wed, 2017-03-08 at 19:53 +0300, Stas Sergeev wrote: > 08.03.2017 19:46, Andy Lutomirski пишет: > >> No no, since I meant prot mode, this is not what I need. > >> I would never need to disable UMIP as to allow the > >> prot mode apps to do SLDT. Instead it would be good > >> to have an ability to provide a replacement for the dummy > >> emulation that is currently being proposed for kernel. > >> All is needed for this, is just to deliver a SIGSEGV. > > That's what I meant. Turning off FIXUP_UMIP would leave UMIP on but > > turn off the fixup, so you'd get a SIGSEGV indicating #GP (or a vm86 > > GP exit). > But then I am confused with the word "compat" in > your "COMPAT_MASK0_X86_UMIP_FIXUP" and > "sys_adjust_compat_mask(int op, int word, u32 mask);" > > Leaving UMIP on and only disabling a fixup doesn't > sound like a compat option to me. I would expect > compat to disable it completely. I guess that the _UMIP_FIXUP part makes it clear that emulation, not UMIP is disabled, allowing the SIGSEGV be delivered to the user space program. Would having a COMPAT_MASK0_X86_UMIP_FIXUP to disable emulation and a COMPAT_MASK0_X86_UMIP to disable UMIP make sense? Also, wouldn't having a COMPAT_MASK0_X86_UMIP to disable UMIP defeat its purpose? Applications could simply use this compat mask to bypass UMIP and gain access to the instructions it protects. Thanks and BR, Ricardo