Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1833166pxj; Wed, 19 May 2021 15:16:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeXO6C5wuZmVZx9s201p+x+rL42KoCZjjbFGNDj0eUjdW2h4Ousz8f69PHDGUQu09yUvxG X-Received: by 2002:a05:6602:280d:: with SMTP id d13mr2054768ioe.90.1621462581398; Wed, 19 May 2021 15:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621462581; cv=none; d=google.com; s=arc-20160816; b=D7VK27JA3dzC86cRNazvaIxPVMB6TPI1O45nKvJ0TEtfbq835T9z+sW0CcEug0SzL7 fuTmFCMsnwpQwXG9Km9+Tlidv08Gg1UBrWCX/EW+YAdH/QcT5AVoDrapTQStb41LNfqh DXVSjGittxuQixuxRCHVcBl203iw1NrE/dRozSKh/1i1r8qZA57f3leBtGBE7H/Z3o03 2c8KOHVrhuQRt8QpPGheaw4d/oqqdxxfKOaWwna+nQ43pIUBmec4jku1/b8a1d42O/pH 2T/4rYFrKFfz7SiQD7k65NlVM4tEVWv1KqJqW5dnWfHSQuEuTUXdRQu7LnLfvsDwJ06a XJkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=3xn362g4yKpFNJ/+ydGmvkYKTtsP6XOTvJHgydURvVY=; b=DqRIDYuP43I4eglT8wgCq05sPeumihwsLHvRcp11N5fLQnG6p/7RC3LBK299Dy5BGO 53a0rNSs2IctrJfgzkxLJVxZM+cx7yzfS6Nb9dXrDenxTqiAKTY2oJmQVumBsaVykjYi TWUcEG5uKYtZzLrjNx8ddp57r1hrgCD8B7SGqt/bExJ1zNlxY59h3XyuwTBatCLVzpCr dfGZkO2wkj7nWy5cfrKVgBfEKDP6KvSMtPTcGML2FZdNhh4JUWq4GhgXk6RkhmDaJJPq CmwJpVcNKNnzA4d0DDTgJWvztDgDFc9RaK4PpqMueCnZpk/OzlHa+1kVtDBteRcRdzyx xKCQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l23si512425jas.94.2021.05.19.15.16.08; Wed, 19 May 2021 15:16:21 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229955AbhESWQZ (ORCPT + 99 others); Wed, 19 May 2021 18:16:25 -0400 Received: from mga04.intel.com ([192.55.52.120]:24024 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbhESWQV (ORCPT ); Wed, 19 May 2021 18:16:21 -0400 IronPort-SDR: pkuOXVHZbA1qShTff2ljYedicsWZkHXCAq8D8z5RZFbgxbSMuQltZIGwJkWGSsyCHGVmKnNGTp aQvIy+qzSAsA== X-IronPort-AV: E=McAfee;i="6200,9189,9989"; a="199134411" X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="199134411" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2021 15:15:00 -0700 IronPort-SDR: 4htN2xJSznuZVhLFhhbfFRkZUb4nixiLBd8DZWgrRmw3SzyxERNbqQvWzA8B9KUhCVR5lyo/+I JW12+IiyJbFA== X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="467381111" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.209.169.18]) ([10.209.169.18]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2021 15:14:58 -0700 Subject: Re: [PATCH v26 26/30] ELF: Introduce arch_setup_elf_property() To: Borislav Petkov 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 References: <20210427204315.24153-1-yu-cheng.yu@intel.com> <20210427204315.24153-27-yu-cheng.yu@intel.com> From: "Yu, Yu-cheng" Message-ID: Date: Wed, 19 May 2021 15:14:58 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/19/2021 11:10 AM, Borislav Petkov wrote: > 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? > ARCH_USE_GNU_PROPERTY is for defining parsing functions, e.g. arch_parse_elf_property(), arch_setup_property(). ARCH_BINFMT_ELF_STATE is for defining "struct arch_elf_state". However, those parsing functions take (struct arch_elf_state *) as an input. It probably makes sense to have ARCH_USE_GNU_PROPERTY dependent on ARCH_BINFMT_ELF_STATE. It would be ok as-is too. ARM people might have other plans in mind. [...] > >> 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... > I just looked at the ABI document. ARM has GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 X86 has: GNU_PROPERTY_X86_ISA_1_USED 0xc0000000 GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001 GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002 Yu-cheng