From patchwork Fri Oct 4 20:26:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13822985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9A7BCF8857 for ; Fri, 4 Oct 2024 20:33:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CcejZ0+EPQk2xoiVGTInjs2v871QaRgZ8Pb6wu9T/Ng=; b=j59UfpckYkEPDYlhwbI1EE+udQ bTSMUQRI3aMKcRCOOSfC9azs+ng6CWyKDa4A7RIm3J9r/MusJdOTUi++VtYnVW0PORVisNS0Zx2Nv z4L3ub8Fkra8x9WLEpF3muhMk+d45kyszIC+C2MGCh7jszr16w6EEAEtnjMneX59akYTXGYX+qjdY WyY4wA8+PL1bQR5UP1FI4ooBTsEOx4XzNLC2v4t0XAiEd1JNHF2S36mcvMI+RRiuzYIoqKmtNfw9e zJPyPnS1cI2CMLMMyKUe4AjguOtAbPl6TEPdlTkf4a5URr/0BDII5fsPehu73/8Fol4tLAQdcD9Jb v+XaL8wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swozV-0000000EA1x-3OsB; Fri, 04 Oct 2024 20:33:33 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swovX-0000000E9JK-3z7L for linux-arm-kernel@lists.infradead.org; Fri, 04 Oct 2024 20:30:11 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4F2CA5C58EB; Fri, 4 Oct 2024 20:29:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54D85C4CECC; Fri, 4 Oct 2024 20:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728073767; bh=EAWikPEgBRDcPQVvYschVwTUbFp2A2GnHRw6U8lWf/4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uEWkw0Pjiw8jWyrIk2sOJs1WxJD6fhDL5sW+VYmqI0nc3SGdkPygyhUxxwc0bzj+V cXQ5UgKZnCepgNi+H2KM0G5wCYdo4q4vr5bIIbnTDtsCtAXdSnsEYW+dffGpgI3fTK Fh1QkZIjmcIzIseor/Xhe18NXFqX0sG9KBXGJHZs3LIrpry8QjgbmdsKuk6+UNjI1w LoteBJfguzR23NfKBz0dVwmUQxwyQmsxkuQuPWyl80AY/5RW4Lzf0AyWMsIu6fIsOs 1oJoyLqck5qguyPFWxUA9pvK3aYNl+inpbYtCYdoq1wj8m9ZSc0FB4LfNNUNQ5cw64 vv/HaYpDnwD8A== From: Mark Brown Date: Fri, 04 Oct 2024 21:26:29 +0100 Subject: [PATCH RFC v2 1/2] binfmt_elf: Wire up AT_HWCAP3 at AT_HWCAP4 MIME-Version: 1.0 Message-Id: <20241004-arm64-elf-hwcap3-v2-1-799d1daad8b0@kernel.org> References: <20241004-arm64-elf-hwcap3-v2-0-799d1daad8b0@kernel.org> In-Reply-To: <20241004-arm64-elf-hwcap3-v2-0-799d1daad8b0@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara , Eric Biederman , Kees Cook , Catalin Marinas , Will Deacon , Jonathan Corbet Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yury Khrustalev , Wilco Dijkstra , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-9b746 X-Developer-Signature: v=1; a=openpgp-sha256; l=2313; i=broonie@kernel.org; h=from:subject:message-id; bh=EAWikPEgBRDcPQVvYschVwTUbFp2A2GnHRw6U8lWf/4=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBnAFAfEtsuUDv/4hQuE+NlcqOoKmOut3E+Mphu2SzM 02DaJeaJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZwBQHwAKCRAk1otyXVSH0PYRB/ 4k1lZXzkyNW2MOkIOzxzR9UIzyGg7f6hVKp6g+zvkR+sWx+qyl3ES0fxiZ7dlzvY3dA1v3smeW27hF l8a+Je0xn2rLSYd6IuoiacEn57zEUd0Hzkdzzw4O2mVH2WwIkWw/7YnYe6PVRLuxunkhrVS6Aalmjp pbbuL94P0JufS2k9tsv4cQA2a7jWsv2k7iHFEKB8XDH4Dwp/EV+wTtHL/TR6BWCeR1a+qBp2/0oQf5 dZRK07kZ9H2M8/3ioktfSs75pAHwT63xDy7LvCJHrneU4HrdeoZVADkBhdbfVuoFOVKerP2+qrKmmj QK3OHTRSMnREjhop7O/MS2MPVcomaD X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241004_132928_108395_1B5B1A98 X-CRM114-Status: GOOD ( 10.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org AT_HWCAP3 and AT_HWCAP4 were recently defined for use on PowerPC in commit 3281366a8e79 ("uapi/auxvec: Define AT_HWCAP3 and AT_HWCAP4 aux vector, entries"). Since we want to start using AT_HWCAP3 on arm64 add support for exposing both these new hwcaps via binfmt_elf. Signed-off-by: Mark Brown Acked-by: Kees Cook Reviewed-by: Anshuman Khandual --- fs/binfmt_elf.c | 6 ++++++ fs/binfmt_elf_fdpic.c | 6 ++++++ fs/compat_binfmt_elf.c | 10 ++++++++++ 3 files changed, 22 insertions(+) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 06dc4a57ba78a7939bbde96bf181eefa950ea13a..3039a6b7aba4bd38f26e21b626b579cc03f3a03e 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -257,6 +257,12 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec, NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes); #ifdef ELF_HWCAP2 NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2); +#endif +#ifdef ELF_HWCAP3 + NEW_AUX_ENT(AT_HWCAP3, ELF_HWCAP3); +#endif +#ifdef ELF_HWCAP4 + NEW_AUX_ENT(AT_HWCAP4, ELF_HWCAP4); #endif NEW_AUX_ENT(AT_EXECFN, bprm->exec); if (k_platform) { diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 4fe5bb9f1b1f5e0be6e8d1ef5b20492935b90633..31d253bd3961a8679678c600f4346bba23502598 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c @@ -623,6 +623,12 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, NEW_AUX_ENT(AT_HWCAP, ELF_HWCAP); #ifdef ELF_HWCAP2 NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2); +#endif +#ifdef ELF_HWCAP3 + NEW_AUX_ENT(AT_HWCAP3, ELF_HWCAP3); +#endif +#ifdef ELF_HWCAP4 + NEW_AUX_ENT(AT_HWCAP4, ELF_HWCAP4); #endif NEW_AUX_ENT(AT_PAGESZ, PAGE_SIZE); NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC); diff --git a/fs/compat_binfmt_elf.c b/fs/compat_binfmt_elf.c index 8f0af4f626316ed2e92204ff9bf381cd14103ae9..d5ef5469e4e620f6ee97f40ce9cbbfa48e37e33c 100644 --- a/fs/compat_binfmt_elf.c +++ b/fs/compat_binfmt_elf.c @@ -80,6 +80,16 @@ #define ELF_HWCAP2 COMPAT_ELF_HWCAP2 #endif +#ifdef COMPAT_ELF_HWCAP3 +#undef ELF_HWCAP3 +#define ELF_HWCAP3 COMPAT_ELF_HWCAP3 +#endif + +#ifdef COMPAT_ELF_HWCAP4 +#undef ELF_HWCAP4 +#define ELF_HWCAP4 COMPAT_ELF_HWCAP4 +#endif + #ifdef COMPAT_ARCH_DLINFO #undef ARCH_DLINFO #define ARCH_DLINFO COMPAT_ARCH_DLINFO