From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A32DC63798 for ; Fri, 27 Nov 2020 17:10:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EB0C5221F7 for ; Fri, 27 Nov 2020 17:10:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="Qw32cDom" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB0C5221F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 608046B0036; Fri, 27 Nov 2020 12:10:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B7C16B005C; Fri, 27 Nov 2020 12:10:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A65A6B0072; Fri, 27 Nov 2020 12:10:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id 353166B0036 for ; Fri, 27 Nov 2020 12:10:23 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E84A8348D for ; Fri, 27 Nov 2020 17:10:22 +0000 (UTC) X-FDA: 77530836684.21.way40_040618227389 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id BA61118043676 for ; Fri, 27 Nov 2020 17:10:22 +0000 (UTC) X-HE-Tag: way40_040618227389 X-Filterd-Recvd-Size: 4798 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Nov 2020 17:10:20 +0000 (UTC) Received: from zn.tnic (p200300ec2f0ffb00fa2fd8ad942748bd.dip0.t-ipconnect.de [IPv6:2003:ec:2f0f:fb00:fa2f:d8ad:9427:48bd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 456451EC042F; Fri, 27 Nov 2020 18:10:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1606497018; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=u6W3Ih82jfxbD+DI9YweOatwjesltCvnSeq3TqSUtnU=; b=Qw32cDom4Nr5D+nAiugyMDt4WopNk82UIfnsTh5TWW1Ae4XcJ39IcPoa+GzKogo5QrQHIx mhiTK2D5SSwXq/kn76nb1bJDepO55LKV+yfJo5RWlQTjDati38TpRWUk7AU1iO/ivRrs2Z jO7gcT+EvHc/iDMLoOBjlIBtqbVpVmA= Date: Fri, 27 Nov 2020 18:10:12 +0100 From: Borislav Petkov To: 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 , 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 , Weijiang Yang , Pengfei Xu Subject: Re: [PATCH v15 05/26] x86/cet/shstk: Add Kconfig option for user-mode Shadow Stack Message-ID: <20201127171012.GD13163@zn.tnic> References: <20201110162211.9207-1-yu-cheng.yu@intel.com> <20201110162211.9207-6-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201110162211.9207-6-yu-cheng.yu@intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Nov 10, 2020 at 08:21:50AM -0800, Yu-cheng Yu wrote: > +config X86_CET > + def_bool n > + > +config ARCH_HAS_SHADOW_STACK > + def_bool n > + > +config X86_SHADOW_STACK_USER Is X86_SHADOW_STACK_KERNEL coming too? Regardless, you can add it when it comes and you can use only X86_CET for now and drop this one and simplify this pile of Kconfig symbols. > + prompt "Intel Shadow Stacks for user-mode" > + def_bool n > + depends on CPU_SUP_INTEL && X86_64 > + depends on AS_HAS_SHADOW_STACK > + select ARCH_USES_HIGH_VMA_FLAGS > + select X86_CET > + select ARCH_HAS_SHADOW_STACK > + help > + Shadow Stacks provides protection against program stack > + corruption. It's a hardware feature. This only matters > + if you have the right hardware. It's a security hardening > + feature and apps must be enabled to use it. You get no > + protection "for free" on old userspace. The hardware can > + support user and kernel, but this option is for user space > + only. > + Support for this feature is only known to be present on > + processors released in 2020 or later. CET features are also > + known to increase kernel text size by 3.7 KB. This help text needs some rewriting. You can find an inspiration about more adequate style in that same Kconfig file. > + > + If unsure, say N. > + > config EFI > bool "EFI runtime service support" > depends on ACPI > diff --git a/scripts/as-x86_64-has-shadow-stack.sh b/scripts/as-x86_64-has-shadow-stack.sh > new file mode 100755 > index 000000000000..fac1d363a1b8 > --- /dev/null > +++ b/scripts/as-x86_64-has-shadow-stack.sh > @@ -0,0 +1,4 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > + > +echo "wrussq %rax, (%rbx)" | $* -x assembler -c - 2> /dev/null otherwise you get {standard input}: Assembler messages: {standard input}:1: Error: no such instruction: `wrussq %rax,(%rbx) on non-enlightened toolchains during build. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette