From patchwork Thu Sep 5 23:05:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13793079 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 A6457CD5BA4 for ; Thu, 5 Sep 2024 23:09:04 +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=4zHDp7syHBjxaXT3ulrQR7bOowlq2bKe8z5J5/LS/iw=; b=TTxRZX6rUdmJD3Thwj1bO1xpds cOkdK7231MF2BazZtJwgXb/yECaRUHy53OzAT7PyhP3WzBQJ8xV8YsGwxg7lOGzz7QY+V4q1SBg3K ANtDUu8OgppShkmtbawsG+kGOks+Xu1BYKr8tt57mGwnjWzzKNtEaCyfz4ytkApUT1K7hP1bs/VTa fHHIdKtoyngKG5o/gmHfV3ILaq4SI7bl66P8DETUMLM53n34GKAIzLdm0+ZjauuOQnMe8HL7oaAtw whU4ziCLEA0BfmxIr7/6hBmtfGhvCzQglrmFd7B7d5nrWxHX+ZbQ284EqdLARtOts7DjUf39X13Ai qAbIyHzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smLav-0000000A5L8-3HP4; Thu, 05 Sep 2024 23:08:53 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smLZ3-0000000A4vi-09aH for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 23:06:58 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F07305C5D0D; Thu, 5 Sep 2024 23:06:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C961C4CECB; Thu, 5 Sep 2024 23:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725577616; bh=1CvHL3X1djqDDP3CHNqU2LnQvflMkgfKJ74BejW/qME=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pvcd7lyX1KomLXt/dqsCYSLKNtxZbL34j7YsWjdm+D58Rn3qDSfmpe3xAEOq/2xey UKXPAVFb/SaeC7C6QJQEitBfhd/0CCKh1HRQ3H+PX9RfTmuXPE1RbiTNgEkD+1NuZJ Qa/6sFKvp8ax8EQHXPhtQ6TDtDiXR4zsheMiSmsPfSEFF0+RcQb59CdfOqwbQtOzut VIsnHQ6jAOYujY7P4/hISWe5GmHGSmkcm1ue+l05+sU+Kb7ipZmuj8AVkJiil4FokG I8v2OVLoOvJ8oECDILspnAfWKWvAtP9+u8iRL1Rw8dVm2U3UwTfgGvUbSuNZ4aOn97 zxMSKXrNT9Z+w== From: Mark Brown Date: Fri, 06 Sep 2024 00:05:24 +0100 Subject: [PATCH RFC 1/2] binfmt_elf: Wire up AT_HWCAP3 at AT_HWCAP4 MIME-Version: 1.0 Message-Id: <20240906-arm64-elf-hwcap3-v1-1-8df1a5e63508@kernel.org> References: <20240906-arm64-elf-hwcap3-v1-0-8df1a5e63508@kernel.org> In-Reply-To: <20240906-arm64-elf-hwcap3-v1-0-8df1a5e63508@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-99b12 X-Developer-Signature: v=1; a=openpgp-sha256; l=2249; i=broonie@kernel.org; h=from:subject:message-id; bh=1CvHL3X1djqDDP3CHNqU2LnQvflMkgfKJ74BejW/qME=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBm2jmHlUSCTyEan9xj94QRH1fAPoiO8sniob91kWqs wH6MgeeJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZto5hwAKCRAk1otyXVSH0DGUB/ sFykES43Vs38+h/g2aRkA7jtFVqXh7lOkhSkwiC5Rr4cxo6nLWNN46KSAenJ8uhtF62W+4pUoxtqnI r/MAM5CrzP9nw5o7N58DXaqk6uu4Aycy28541fxl8CfoyxPbS0fI1+pxzoIJ2+xTLs8fsalDNl7INS QjY4YmTG1HUSjFhZWRD3D3jDYEYafz0KSJh/im4w994yOuWHrRzuW5pM5GQv17vsFmtiCo1DnuxPZS dpljF575hDc2xKb/MGfNkqgr//E9dy/pvF6YAg7d9flsPxHyF5INnnzXYKdt1ebM6nEhFzT1OTBdFZ hJAgfovynsR+qGSYI5lCrPuvhN9rZ+ 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-20240905_160657_202581_682137E2 X-CRM114-Status: GOOD ( 10.59 ) 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 --- fs/binfmt_elf.c | 6 ++++++ fs/binfmt_elf_fdpic.c | 6 ++++++ fs/compat_binfmt_elf.c | 15 +++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 19fa49cd9907..32e45e65de8f 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_HWCAP3, 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 28a3439f163a..9365f48598a1 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c @@ -620,6 +620,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_HWCAP3 + 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 8f0af4f62631..0a219e26692a 100644 --- a/fs/compat_binfmt_elf.c +++ b/fs/compat_binfmt_elf.c @@ -80,6 +80,21 @@ #define ELF_HWCAP2 COMPAT_ELF_HWCAP2 #endif +#ifdef COMPAT_ELF_HWCAP3 +#undef ELF_HWCAP3 +#define ELF_HWCAP3 COMPAT_ELF_HWCAP3 +#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