From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu-cheng Yu Subject: Re: [PATCH v7 03/14] x86/cet/ibt: Add IBT legacy code bitmap setup function Date: Fri, 07 Jun 2019 12:56:40 -0700 Message-ID: <9d3cedc83c236ee7a109325113fd1c1f9d849f25.camel@intel.com> References: <20190606200926.4029-1-yu-cheng.yu@intel.com> <20190606200926.4029-4-yu-cheng.yu@intel.com> <20190607080832.GT3419@hirez.programming.kicks-ass.net> <20190607174336.GM3436@hirez.programming.kicks-ass.net> <34E0D316-552A-401C-ABAA-5584B5BC98C5@amacapital.net> <352e6172-938d-f8e4-c195-9fd1b881bdee@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <352e6172-938d-f8e4-c195-9fd1b881bdee@intel.com> Sender: linux-kernel-owner@vger.kernel.org To: Dave Hansen , Andy Lutomirski Cc: Peter Zijlstra , x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit List-Id: linux-arch.vger.kernel.org On Fri, 2019-06-07 at 11:58 -0700, Dave Hansen wrote: > On 6/7/19 11:29 AM, Andy Lutomirski wrote: > ... > > > I think this new MSR probably needs to get included in oops output when > > > CET is enabled. > > > > This shouldn’t be able to OOPS because it only happens at CPL 3, > > right? We should put it into core dumps, though. > > Good point. > > Yu-cheng, can you just confirm that the bitmap can't be referenced in > ring-0, no matter what? We should also make sure that no funny business > happens if we put an address in the bitmap that faults, or is > non-canonical. Do we have any self-tests for that? Yes, the bitmap is user memory, but the kernel can still get to it (e.g. copy_from_user()). We can do more check on the address. > > Let's say userspace gets a fault on this. Do they have the > introspection capability to figure out why they faulted, say in their > signal handler? The bitmap address is kept by the application; the kernel won't provide it again to user-space. In the signal handler, the app can find out from its own record. [...] From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com ([134.134.136.100]:16835 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729342AbfFGUEn (ORCPT ); Fri, 7 Jun 2019 16:04:43 -0400 Message-ID: <9d3cedc83c236ee7a109325113fd1c1f9d849f25.camel@intel.com> Subject: Re: [PATCH v7 03/14] x86/cet/ibt: Add IBT legacy code bitmap setup function From: Yu-cheng Yu Date: Fri, 07 Jun 2019 12:56:40 -0700 In-Reply-To: <352e6172-938d-f8e4-c195-9fd1b881bdee@intel.com> References: <20190606200926.4029-1-yu-cheng.yu@intel.com> <20190606200926.4029-4-yu-cheng.yu@intel.com> <20190607080832.GT3419@hirez.programming.kicks-ass.net> <20190607174336.GM3436@hirez.programming.kicks-ass.net> <34E0D316-552A-401C-ABAA-5584B5BC98C5@amacapital.net> <352e6172-938d-f8e4-c195-9fd1b881bdee@intel.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Dave Hansen , Andy Lutomirski Cc: Peter Zijlstra , x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin Message-ID: <20190607195640.ZonfVEH7vrqPqm2siszj-4M64y0PokuJudEOJcdvu-4@z> On Fri, 2019-06-07 at 11:58 -0700, Dave Hansen wrote: > On 6/7/19 11:29 AM, Andy Lutomirski wrote: > ... > > > I think this new MSR probably needs to get included in oops output when > > > CET is enabled. > > > > This shouldn’t be able to OOPS because it only happens at CPL 3, > > right? We should put it into core dumps, though. > > Good point. > > Yu-cheng, can you just confirm that the bitmap can't be referenced in > ring-0, no matter what? We should also make sure that no funny business > happens if we put an address in the bitmap that faults, or is > non-canonical. Do we have any self-tests for that? Yes, the bitmap is user memory, but the kernel can still get to it (e.g. copy_from_user()). We can do more check on the address. > > Let's say userspace gets a fault on this. Do they have the > introspection capability to figure out why they faulted, say in their > signal handler? The bitmap address is kept by the application; the kernel won't provide it again to user-space. In the signal handler, the app can find out from its own record. [...]