Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp7114072ybf; Fri, 6 Mar 2020 10:37:44 -0800 (PST) X-Google-Smtp-Source: ADFU+vsu0UHDpmsNLFKMB8zif0XnnJMx7MtuxfpkoxprwMxL15X7vw8ZYsihrVv8vPZqsqoet+jy X-Received: by 2002:a9d:c65:: with SMTP id 92mr3180112otr.23.1583519864611; Fri, 06 Mar 2020 10:37:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583519864; cv=none; d=google.com; s=arc-20160816; b=BfmPwjyre7O2i9Wb0Q+EFE0r8qDqoHPOrdrspxoR9JUYPvI0Gnv1ZPJumwEWHY2pzP jCmLnaRJ8nh6bfgQL8sPQUIv6sMdgqaSKGfZB4JuYpntySB4pHhaar0E1sonCUn69qsW 3OSwBFshasYyef4RJ5p6h0uabPYakU1JIeSYaZUi6/EGQQzRb/UaXFZPw8780aH1TTgC ub7223XwpYgFWLnTM5F6PVLz2j8qcseXUIxm0RvfkSeAnjmxYtA6uNjtg/oYUGeL3fBN XcAZjoonG7yMlvcKobOVaK8zxGLvvjsmn0LCq+BZHdMgF4QyQjA4zMFOsf7QEzE8NqAT dBWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id; bh=+cLO47gMg7GIhPtBwX/rDWzawMCqa+ahFuvJsdL6rl8=; b=a5zPxKBIv8LqArgEY6h+y2O7DyGmGYz4xqFl95dcBod/DPwW+aDO7CwNrjJFHSO1kN 6emOP2Nfbo469BVbo6Q1zbicVAgzWx04GpgR/Xpd3OAFQhPpoFCp0cuViuAxBDl/aw/R L/3S/kOrU5sDc9hNhulUJ/ib0zOXwssdtxq37xBU6Oi/gXf7PhYq4Mida5Efc1ZuVbwS 2rF2e1SKmjGkRkS7WmWnn5vPYXXF4iF8RApoYiQxeewfLKIr38BBKr37ohBtYTDfDbTV azzvPexvdORziu95e+Ol2/r0g0njE/jiRO4irqI6CtxpMTLq05/B025cCNR6LMRdfwDR GKXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f20si1723545otl.313.2020.03.06.10.37.32; Fri, 06 Mar 2020 10:37:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726300AbgCFShO (ORCPT + 99 others); Fri, 6 Mar 2020 13:37:14 -0500 Received: from mga12.intel.com ([192.55.52.136]:28577 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725873AbgCFShO (ORCPT ); Fri, 6 Mar 2020 13:37:14 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2020 10:37:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,523,1574150400"; d="scan'208";a="275637536" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by fmsmga002.fm.intel.com with ESMTP; 06 Mar 2020 10:37:13 -0800 Message-ID: <070d9d78981f0aad2baf740233e8dfc32ecd29d7.camel@intel.com> Subject: Re: [RFC PATCH v9 05/27] x86/cet/shstk: Add Kconfig option for user-mode Shadow Stack protection From: Yu-cheng Yu To: Dave Hansen , 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 Date: Fri, 06 Mar 2020 10:37:13 -0800 In-Reply-To: References: <20200205181935.3712-1-yu-cheng.yu@intel.com> <20200205181935.3712-6-yu-cheng.yu@intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-02-26 at 10:05 -0800, Dave Hansen wrote: > 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...). We used to do this for CET instructions, but after adding kernel-mode instructions and inserting ENDBR's, the code becomes cluttered. I also found an earlier discussion on the ENDBR: https://lore.kernel.org/lkml/CALCETrVRH8LeYoo7V1VBPqg4WS0Enxtizt=T7dPvgoeWfJrdzA@mail.gmail.com/ It makes sense to let the user know early on that the system cannot support CET and cannot build a CET-enabled kernel. One thing we can do is to disable CET in Kconfig and not in kernel build, which I will do in the next version. Yu-cheng