From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: Re: [PATCH v7 03/14] x86/cet/ibt: Add IBT legacy code bitmap setup function Date: Fri, 7 Jun 2019 10:59:37 -0700 Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <20190607174336.GM3436@hirez.programming.kicks-ass.net> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Peter Zijlstra , Yu-cheng Yu Cc: 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 , Andy Lutomirski , 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 6/7/19 10:43 AM, Peter Zijlstra wrote: > I've no idea what the kernel should do; since you failed to answer the > question what happens when you point this to garbage. > > Does it then fault or what? Yeah, I think you'll fault with a rather mysterious CR2 value since you'll go look at the instruction that faulted and not see any references to the CR2 value. I think this new MSR probably needs to get included in oops output when CET is enabled. Why don't we require that a VMA be in place for the entire bitmap? Don't we need a "get" prctl function too in case something like a JIT is running and needs to find the location of this bitmap to set bits itself? Or, do we just go whole-hog and have the kernel manage the bitmap itself. Our interface here could be: prctl(PR_MARK_CODE_AS_LEGACY, start, size); and then have the kernel allocate and set the bitmap for those code locations. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com ([134.134.136.100]:9631 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730352AbfFGR7k (ORCPT ); Fri, 7 Jun 2019 13:59:40 -0400 Subject: Re: [PATCH v7 03/14] x86/cet/ibt: Add IBT legacy code bitmap setup function 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> From: Dave Hansen Message-ID: Date: Fri, 7 Jun 2019 10:59:37 -0700 MIME-Version: 1.0 In-Reply-To: <20190607174336.GM3436@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Peter Zijlstra , Yu-cheng Yu Cc: 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 , Andy Lutomirski , 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: <20190607175937.x145XXYBqjbFkxTz8iehJ-Z9BABKEKIRr1YGG2vPBfU@z> On 6/7/19 10:43 AM, Peter Zijlstra wrote: > I've no idea what the kernel should do; since you failed to answer the > question what happens when you point this to garbage. > > Does it then fault or what? Yeah, I think you'll fault with a rather mysterious CR2 value since you'll go look at the instruction that faulted and not see any references to the CR2 value. I think this new MSR probably needs to get included in oops output when CET is enabled. Why don't we require that a VMA be in place for the entire bitmap? Don't we need a "get" prctl function too in case something like a JIT is running and needs to find the location of this bitmap to set bits itself? Or, do we just go whole-hog and have the kernel manage the bitmap itself. Our interface here could be: prctl(PR_MARK_CODE_AS_LEGACY, start, size); and then have the kernel allocate and set the bitmap for those code locations.