From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: Re: [RFC PATCH v9 05/27] x86/cet/shstk: Add Kconfig option for user-mode Shadow Stack protection Date: Wed, 26 Feb 2020 10:05:50 -0800 Message-ID: References: <20200205181935.3712-1-yu-cheng.yu@intel.com> <20200205181935.3712-6-yu-cheng.yu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <20200205181935.3712-6-yu-cheng.yu@intel.com> Content-Language: en-US Sender: linux-doc-owner@vger.kernel.org To: Yu-cheng Yu , 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 List-Id: linux-arch.vger.kernel.org On 2/5/20 10:19 AM, Yu-cheng Yu wrote: > +# Check assembler Shadow Stack suppot ^ support > +ifdef CONFIG_X86_INTEL_SHADOW_STACK_USER > + ifeq ($(call as-instr, saveprevssp, y),) > + $(error CONFIG_X86_INTEL_SHADOW_STACK_USER not supported by the assembler) > + endif > +endif Is this *just* looking for instruction support in the assembler? We usually just .byte them, like this for pkeys: asm volatile(".byte 0x0f,0x01,0xee\n\t" : "=a" (pkru), "=d" (edx) : "c" (ecx)); That way everybody with old toolchains can still build the kernel (and run/test code with your config option on, btw...). From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [RFC PATCH v9 05/27] x86/cet/shstk: Add Kconfig option for user-mode Shadow Stack protection References: <20200205181935.3712-1-yu-cheng.yu@intel.com> <20200205181935.3712-6-yu-cheng.yu@intel.com> From: Dave Hansen Message-ID: Date: Wed, 26 Feb 2020 10:05:50 -0800 MIME-Version: 1.0 In-Reply-To: <20200205181935.3712-6-yu-cheng.yu@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-doc-owner@vger.kernel.org To: Yu-cheng Yu , 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 , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , x86-patch-review@intel.com List-ID: Message-ID: <20200226180550.GyrEX--diSKE-QZyx2t6P72bwvDVhVM0qPhLeZ-7zvU@z> On 2/5/20 10:19 AM, Yu-cheng Yu wrote: > +# Check assembler Shadow Stack suppot ^ support > +ifdef CONFIG_X86_INTEL_SHADOW_STACK_USER > + ifeq ($(call as-instr, saveprevssp, y),) > + $(error CONFIG_X86_INTEL_SHADOW_STACK_USER not supported by the assembler) > + endif > +endif Is this *just* looking for instruction support in the assembler? We usually just .byte them, like this for pkeys: asm volatile(".byte 0x0f,0x01,0xee\n\t" : "=a" (pkru), "=d" (edx) : "c" (ecx)); That way everybody with old toolchains can still build the kernel (and run/test code with your config option on, btw...).