From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by sourceware.org (Postfix) with ESMTPS id 97ED9399BC18 for ; Wed, 9 Jun 2021 16:55:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 97ED9399BC18 IronPort-SDR: UKVT/2aEHB+Zk85zWLuVHwToiDLAO5HNuDpOYQ0NjshXBRaBhniAQNVJrZUPfPgmxfIdR1AcJR IlhhN4wZKu0A== X-IronPort-AV: E=McAfee;i="6200,9189,10010"; a="268968634" X-IronPort-AV: E=Sophos;i="5.83,261,1616482800"; d="scan'208";a="268968634" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2021 09:55:38 -0700 IronPort-SDR: pJc/qyiR6bDGeiUYimzZmGMKNw08Bh6dfU7tWOXSti3VIyvPOxFDFRaXes3wHI2fTOxq3vG6iB Sd5drJFXHa5A== X-IronPort-AV: E=Sophos;i="5.83,261,1616482800"; d="scan'208";a="469931412" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.251.151.26]) ([10.251.151.26]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2021 09:55:37 -0700 Subject: Re: [PATCH v2 3/3] elf: Remove has_interp property from arch_adjust_elf_prot() To: Dave Martin , Mark Brown Cc: Catalin Marinas , Will Deacon , Szabolcs Nagy , Jeremy Linton , "H . J . Lu" , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, libc-alpha@sourceware.org References: <20210604112450.13344-1-broonie@kernel.org> <20210604112450.13344-4-broonie@kernel.org> <20210609151724.GM4187@arm.com> From: "Yu, Yu-cheng" Message-ID: <6e0b1dbd-688c-aba6-e376-91ce9440d741@intel.com> Date: Wed, 9 Jun 2021 09:55:36 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210609151724.GM4187@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2021 16:55:42 -0000 On 6/9/2021 8:17 AM, Dave Martin wrote: > On Fri, Jun 04, 2021 at 12:24:50PM +0100, Mark Brown wrote: >> Since we have added an is_interp flag to arch_parse_elf_property() we can >> drop the has_interp flag from arch_elf_adjust_prot(), the only user was >> the arm64 code which no longer needs it and any future users will be able >> to use arch_parse_elf_properties() to determine if an interpreter is in >> use. > > So far so good, but can we also drop the has_interp argument from > arch_parse_elf_properties()? > > Cross-check with Yu-Cheng Yu's series, but I don't see this being used > any more (except for passthrough in binfmt_elf.c). > > Since we are treating the interpreter and main executable orthogonally > to each other now, I don't think we should need a has_interp argument to > pass knowledge between the interpreter and executable handling phases > here. > For CET, arch_parse_elf_property() needs to know has_interp and is_interp. Like the following, on top of your patches: diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 607b782afe2c..9e6f142b5cef 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -837,8 +837,15 @@ unsigned long KSTK_ESP(struct task_struct *task) } int arch_parse_elf_property(u32 type, const void *data, size_t datasz, - bool compat, struct arch_elf_state *state) + bool compat, bool has_interp, bool is_interp, + struct arch_elf_state *state) { + /* + * Parse static-linked executable or the loader. + */ + if (has_interp != is_interp) + return 0; + if (type != GNU_PROPERTY_X86_FEATURE_1_AND) return 0; Thanks, Yu-cheng