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 ADD70C64E7A for ; Fri, 27 Nov 2020 17:10:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 386C422240 for ; Fri, 27 Nov 2020 17:10:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="Qw32cDom" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731276AbgK0RKU (ORCPT ); Fri, 27 Nov 2020 12:10:20 -0500 Received: from mail.skyhub.de ([5.9.137.197]:43272 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731169AbgK0RKU (ORCPT ); Fri, 27 Nov 2020 12:10:20 -0500 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> Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org 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