Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1762101pxj; Wed, 19 May 2021 13:19:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfa6cQTxumAoGRHW5EnNPEbEOxeE7/xxM2V1AkiiGZqaBJadgHjn6N4rUiwuInuaLAdq3H X-Received: by 2002:a02:7fc1:: with SMTP id r184mr1082765jac.109.1621455590023; Wed, 19 May 2021 13:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621455590; cv=none; d=google.com; s=arc-20160816; b=LUF2yBpFEofSoOAJOBiEDfIbZY1LlS350DE/C6cxDl+9Ep6Y60GvEGWtZluAKuegn+ k8dHL0YhsHpy7DNo/gRDIrx6KiKPuFl3w4+I6LasI9grRoq36W212ZEPlPA4/3JeoBLf vSMl3tmDcl7IQzH6GBBT5kvzSdHtx136yznsaC2vCwLIzCgiJUihJT4wwAdTyC33/2mU j2+mrhuAf+A4uuG++uZ4zg0n6O1loVu3bYhEXHLKrC7V6S5CmSXWVB0mbeQhi2upvBl2 bPalzAKGD3KNa2hSGXM/9Ay1YNBc35F3vHLv66M+GplFc0rYk2/LpFltFwbm9DhFinbk APkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Kmnk3HRb3cmXxIvZwaL4Yb+pBm6cxLnt2meHDxXrqsM=; b=rHNLn7cAmXjqSMJwcjFnQ/RKJtuBAryOQyCrGelShyXY0Rq2RcfaQXuu2vxDE4QQv7 pat8+nUWuh3EdxuW0depLTRYP+fbAZY6r6HFMuCy2riUiHBhd/4PyJdoUOqkkIQgCgb8 T00OmWV3tvCFA6QDdHc4Sh8zUNE74leRe3heBrA+2gdtY/oD/8zj130Ngeh6C0wMysYa O8THbBPaH17hbpJzd0B4cWRAR64P+cQkO/VDptLUQQVW4ZQCvAOvoOA/ZrcZiwsLFax8 v85rnazHHdD+O78ZUmSKMwYCZer6KgijOzhDdbQJRJPGyRHn83OoR/7GlXgoDI5CRQwp Hz5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=TwMVUgsb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si722556ila.105.2021.05.19.13.19.37; Wed, 19 May 2021 13:19:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=TwMVUgsb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231206AbhESSLm (ORCPT + 99 others); Wed, 19 May 2021 14:11:42 -0400 Received: from mail.skyhub.de ([5.9.137.197]:41704 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbhESSLi (ORCPT ); Wed, 19 May 2021 14:11:38 -0400 Received: from zn.tnic (p200300ec2f0c020044d5f4cdafdb3fab.dip0.t-ipconnect.de [IPv6:2003:ec:2f0c:200:44d5:f4cd:afdb:3fab]) (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 5BE581EC04DE; Wed, 19 May 2021 20:10:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1621447816; 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=Kmnk3HRb3cmXxIvZwaL4Yb+pBm6cxLnt2meHDxXrqsM=; b=TwMVUgsb6IXeVBZzA6d5aIhwEuci3CpWN6/cdOkZQyGtLUAzYw4RKdPvGNXcuIU6QknbQE blXQ5U8G76V6aHPP8i0Lk7VoyusBNhIFKA7FWrMplro0XkfH2rUpKn1fzY2R/5xB7GG1gy yLMfKTZuUJSPwmUwo+E1+IYdMLiMf/4= Date: Wed, 19 May 2021 20:10:11 +0200 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 , Haitao Huang , Mark Brown , Catalin Marinas Subject: Re: [PATCH v26 26/30] ELF: Introduce arch_setup_elf_property() Message-ID: References: <20210427204315.24153-1-yu-cheng.yu@intel.com> <20210427204315.24153-27-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210427204315.24153-27-yu-cheng.yu@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 27, 2021 at 01:43:11PM -0700, Yu-cheng Yu wrote: > @@ -1951,6 +1951,8 @@ config X86_SHADOW_STACK > depends on AS_WRUSS > depends on ARCH_HAS_SHADOW_STACK > select ARCH_USES_HIGH_VMA_FLAGS > + select ARCH_USE_GNU_PROPERTY > + select ARCH_BINFMT_ELF_STATE ^^^^^^^^ What's that for? Isn't ARCH_USE_GNU_PROPERTY enough? > +int arch_setup_elf_property(struct arch_elf_state *state) > +{ > + int r = 0; > + > + if (!IS_ENABLED(CONFIG_X86_SHADOW_STACK)) > + return r; > + > + memset(¤t->thread.cet, 0, sizeof(struct cet_status)); > + > + if (static_cpu_has(X86_FEATURE_SHSTK)) { cpu_feature_enabled > + if (state->gnu_property & GNU_PROPERTY_X86_FEATURE_1_SHSTK) > + r = shstk_setup(); > + } > + > + return r; > +} > +#endif ... > diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h > index 30f68b42eeb5..24ba55ba8278 100644 > --- a/include/uapi/linux/elf.h > +++ b/include/uapi/linux/elf.h > @@ -455,4 +455,13 @@ typedef struct elf64_note { > /* Bits for GNU_PROPERTY_AARCH64_FEATURE_1_BTI */ > #define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) > > +/* .note.gnu.property types for x86: */ > +#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002 Why not 0xc0000001? ARM64 is 0xc0000000... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette