Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2324202imm; Thu, 7 Jun 2018 08:48:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL+rEt8TLk10QY1hnWuTYnsndGXhUwE0zDBBiwtRLL4C6RZzW1Mg8X/BYE5TgfmbIbV5ywa X-Received: by 2002:a17:902:6b0c:: with SMTP id o12-v6mr2537411plk.159.1528386484336; Thu, 07 Jun 2018 08:48:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528386484; cv=none; d=google.com; s=arc-20160816; b=0rYRej+1JiL6EA+FEHfWH9vea3JCmAOhWEYnqJZPj/6LbP4rbO6gMn5Tbbi5I72pT1 Avjk6xAO4nJvBDoP6/PycwSMrJ6jEHX0+GPdMZe1JNv7th4B20iQUVSk9orbZCCogroB lvQ1AddBG3qEdPfea9yyV+ok/Sz9pLycnkmVH5xrqHachFltHcRBuxH/jmZOhZ83nOHj ljJdnRrLy/ExbIGrUKYdoj8fxSlTrgvam9VmljNem4M1/Ds1VWHMlO/womiAxqwqpzY2 0r4dqQ4FTIrl0HCipJqJmDMJoohxAOndE1r/xQteeFpSPZpPWQTTMMZNAGq1I9B+xx4A FN3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=VLjOogQqx7Le3wRY1NuhB/B3Mf+yuaKssm8+KYVz/os=; b=YsTJ/PGsv9eomWIqQEtbZYzDyX9eq+pP2WZW9eo0MbACeclPi5NntgrPFc8ufCIvQF 5s9gn9nJjX/2kW/IqtHGZdizm8vEV0xLpUdzn1IvFuDOl6WFT1Wk5qM8dilqmhU+gVvr GVWwf4xzpkU1W82X+P4Tvt291NnAr7oPURWqk5IxgmF0TbmX5ebdxvxydoK3cMSMNMFc Z/CB/Fl9zxboEQd9TWt0AVgeNDpJrhKWotMdbulSlV2fZEF9MCi7VyAYgScX34tQPtOi Np3PB0XV9WKARN5qIEdCXvm8Hwit3FcOJDHmgjyu8XRXVqWfRB2H0pw7eVYZFPEPHEm8 SaHA== 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 bf6-v6si13582203plb.44.2018.06.07.08.47.49; Thu, 07 Jun 2018 08:48:04 -0700 (PDT) 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 S934547AbeFGPqe (ORCPT + 99 others); Thu, 7 Jun 2018 11:46:34 -0400 Received: from mga09.intel.com ([134.134.136.24]:36282 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934269AbeFGOkd (ORCPT ); Thu, 7 Jun 2018 10:40:33 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jun 2018 07:40:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,486,1520924400"; d="scan'208";a="47542289" Received: from 2b52.sc.intel.com ([143.183.136.51]) by orsmga008.jf.intel.com with ESMTP; 07 Jun 2018 07:40:31 -0700 From: Yu-cheng Yu To: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , "H.J. Lu" , Vedvyas Shanbhogue , "Ravi V. Shankar" , Dave Hansen , Andy Lutomirski , Jonathan Corbet , Oleg Nesterov , Arnd Bergmann , Mike Kravetz Cc: Yu-cheng Yu Subject: [PATCH 2/9] x86/cet: Add Kconfig option for user-mode shadow stack Date: Thu, 7 Jun 2018 07:36:58 -0700 Message-Id: <20180607143705.3531-3-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180607143705.3531-1-yu-cheng.yu@intel.com> References: <20180607143705.3531-1-yu-cheng.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce Kconfig option X86_INTEL_SHADOW_STACK_USER. An application has shadow stack protection when all the following are true: (1) The kernel has X86_INTEL_SHADOW_STACK_USER enabled, (2) The running processor supports the shadow stack, (3) The application is built with shadow stack enabled tools & libs and, and at runtime, all dependent shared libs can support shadow stack. If this kernel config option is enabled, but (2) or (3) above is not true, the application runs without the shadow stack protection. Existing legacy applications will continue to work without the shadow stack protection. The user-mode shadow stack protection is only implemented for the 64-bit kernel. Thirty-two bit applications are supported under the compatibility mode. Signed-off-by: Yu-cheng Yu --- arch/x86/Kconfig | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c07f492b871a..dd580d4910fc 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1925,6 +1925,30 @@ config X86_INTEL_MEMORY_PROTECTION_KEYS If unsure, say y. +config X86_INTEL_CET + def_bool n + +config ARCH_HAS_SHSTK + def_bool n + +config X86_INTEL_SHADOW_STACK_USER + prompt "Intel Shadow Stack for user-mode" + def_bool n + depends on CPU_SUP_INTEL && X86_64 + select X86_INTEL_CET + select ARCH_HAS_SHSTK + ---help--- + Shadow stack provides hardware protection against program stack + corruption. Only when all the following are true will an application + have the shadow stack protection: the kernel supports it (i.e. this + feature is enabled), the application is compiled and linked with + shadow stack enabled, and the processor supports this feature. + When the kernel has this configuration enabled, existing non shadow + stack applications will continue to work, but without shadow stack + protection. + + If unsure, say y. + config EFI bool "EFI runtime service support" depends on ACPI -- 2.15.1