From patchwork Wed Oct 18 11:13:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea della Porta X-Patchwork-Id: 154820 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4712843vqb; Wed, 18 Oct 2023 04:13:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlkVWzGIv0YaUxwCTe1fWd3dBmF0LiLmlACVBDGyJ0m8dTa1/ut8uFCe0FMn+KuUFtkqAZ X-Received: by 2002:a92:c652:0:b0:357:a1e6:faa2 with SMTP id 18-20020a92c652000000b00357a1e6faa2mr1988122ill.1.1697627622741; Wed, 18 Oct 2023 04:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697627622; cv=none; d=google.com; s=arc-20160816; b=ATEfJE0nCGoApSmluJqb/jSzdKGYMXZ50qvRMi0UCNfMk+xX/LboB/S8NRVuaK3V+N 7ju4KSS7Wgh1CiX29dBH9C6f33pDTSWcM3jJOKKUv1VXO/cN2HuzPVpqsAvC535HuuC6 XOOXIIwONYQWtrCUvTJZ9Ym5pWeeneMllLhalTwmdgjisopL3Cn09AuO8IJ+u8OXXKXa 1tXcA/DnAWuZJDII9EO4XrdeAd61w0QCo6Zl8nnT04nyHEKFGT3REDOuj4xh1LMW+sv1 L4tIdRzVRNyv13HsNPuKFSsKxNdVEHfXwsor34J1X9MtZHN45huOVXcqcmdZiDGD0ZSx hOWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XvayeaWIBXD/TbklYtBLy+ocs1W3g7QMUZRRnl/IW6A=; fh=Fmfa0t6QgnUIyzgsSgnN1cYWfnFwLN+1Ba+VDm5h09M=; b=RdnPTsC4YW+etOrCi0YTcfDK0VB1RNM/7NQrwm2T3PYHO1pAMsLrqiYACAJe0Ot++d CkXRHZw8E209IS3JOmfJq9WwbU9fL3FYERJJ21o3EtcOfsCkB+jny2/mkkAixPL7lNbF K8QuG5V6CY2LtX53oQKvrVpkFtYSxEZi2m197v2wXJrONNpI3Hlv6K1sf/SGccAv6zfr 6uQLX62E5ZzZ687DTjsLuqj+NFvLJfiqlbp/n7CCBAuxF6/q4P+JBRkU6OwudpfdK+YC 2twRFPmLCfTeGpkRYhPPnI3bcmRFxLOO0JNwMoEiVxP2GySvFZv0u2BKVMlQGoMdcGYS edlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=tvXVPT2f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id v10-20020a63f20a000000b005ad11a5ac8fsi1826751pgh.323.2023.10.18.04.13.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 04:13:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=tvXVPT2f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 591708034663; Wed, 18 Oct 2023 04:13:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230189AbjJRLNe (ORCPT + 24 others); Wed, 18 Oct 2023 07:13:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbjJRLNb (ORCPT ); Wed, 18 Oct 2023 07:13:31 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CA7B113 for ; Wed, 18 Oct 2023 04:13:29 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3D4091FD6F; Wed, 18 Oct 2023 11:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1697627607; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XvayeaWIBXD/TbklYtBLy+ocs1W3g7QMUZRRnl/IW6A=; b=tvXVPT2fU8cdIZZ5PVqS+oONkUT5BgOIQTKI20cJHtwHddG4iR+Kjusrp0rp1UhtbxexS4 8yIbj5D1MvC0cbiKXos0K/UDGct4TTomnt/ox2tBuAOA1mnT6cB/8jVuN1j4mvYRFkuBXd N6k5PylA7ETC2CnpkLVGBzYlpV6gbIc= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2712E13915; Wed, 18 Oct 2023 11:13:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hbmbB9e9L2VHZwAAMHmgww (envelope-from ); Wed, 18 Oct 2023 11:13:27 +0000 From: Andrea della Porta To: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: nik.borisov@suse.com, Andrea della Porta Subject: [PATCH 1/4] arm64: Introduce aarch32_enabled() Date: Wed, 18 Oct 2023 13:13:19 +0200 Message-ID: <5621e481f1640782c649c8fb9145310339022540.1697614386.git.andrea.porta@suse.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -5.70 X-Spamd-Result: default: False [-5.70 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-3.00)[100.00%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FORGED_SENDER(0.30)[andrea.porta@suse.com,aporta@suse.de]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_NEQ_ENVFROM(0.10)[andrea.porta@suse.com,aporta@suse.de]; RCVD_TLS_ALL(0.00)[] X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 18 Oct 2023 04:13:40 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780091581825768071 X-GMAIL-MSGID: 1780091581825768071 Aarch32 bit support on 64bit kernels depends on whether CONFIG_COMPAT is selected or not. As it is a compile time option it doesn't provide the flexibility to have distributions set their own policy for Aarch32 support and give the user the flexibility to override it. As a first step introduce aarch32_enabled() which abstracts whether 32 bit compat is turned on or off. Upcoming patches will implement the ability to set Aarch32 compat state at boot time. Signed-off-by: Andrea della Porta --- arch/arm64/include/asm/compat.h | 12 ++++++++++++ arch/arm64/kernel/entry-common.c | 2 ++ 2 files changed, 14 insertions(+) diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index ae904a1ad529..f5ef71bd0024 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -98,6 +98,13 @@ static inline int is_compat_thread(struct thread_info *thread) long compat_arm_syscall(struct pt_regs *regs, int scno); +extern bool __aarch32_enabled; + +static inline bool aarch32_enabled(void) +{ + return __aarch32_enabled; +} + #else /* !CONFIG_COMPAT */ static inline int is_compat_thread(struct thread_info *thread) @@ -105,5 +112,10 @@ static inline int is_compat_thread(struct thread_info *thread) return 0; } +static inline bool aarch32_enabled(void) +{ + return false; +} + #endif /* CONFIG_COMPAT */ #endif /* __ASM_COMPAT_H */ diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c index 0fc94207e69a..69ff9b8c0bde 100644 --- a/arch/arm64/kernel/entry-common.c +++ b/arch/arm64/kernel/entry-common.c @@ -877,6 +877,8 @@ asmlinkage void noinstr el0t_32_error_handler(struct pt_regs *regs) { __el0_error_handler_common(regs); } + +bool __aarch32_enabled __ro_after_init = true; #else /* CONFIG_COMPAT */ UNHANDLED(el0t, 32, sync) UNHANDLED(el0t, 32, irq) From patchwork Wed Oct 18 11:13:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea della Porta X-Patchwork-Id: 154822 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4713083vqb; Wed, 18 Oct 2023 04:14:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOt9ynsoVwXZuuwIFHXW9d0MdbZXy07rAJjqzfHW7fULRQo75h55QNbU3rRIPEsrLu2TuV X-Received: by 2002:a05:6e02:2145:b0:357:4253:c822 with SMTP id d5-20020a056e02214500b003574253c822mr6317455ilv.3.1697627648634; Wed, 18 Oct 2023 04:14:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697627648; cv=none; d=google.com; s=arc-20160816; b=Uqb/+Xr4nFdI3DRR2rijKqsPfdaC6BokidjyvNVtEJZ6baMtHk657hfJUuDNK5NHcV vx+77BElA3bbWS99iqxRxi3dA3sAHFAyvRljB3lJRbndzFd57e758XZQvN/Jn432A7eX Rt6cnMuWUOxOR7p2Q7ROUYSp6MTEo8VokGwNK+s1OvoGTM/2W2c27uNPZ7SBF+lbgwZH gWPhUQsRAN/GItXqEP+rytt7G5KDNW/i1j7T+HiDUPYEyHdPVjkF+4k5LSlwmY8vBRhF 8gYlXwSHoyOSI86UgQkKKPqJYRdpDJd1GB+hc+a/bxerCKOAD6OkIg2qZsiTTwvnOkCS cGkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AxqPCsVu93zMNlESL0N42GEheOSU7BHbH8/1jpPYl4o=; fh=Fmfa0t6QgnUIyzgsSgnN1cYWfnFwLN+1Ba+VDm5h09M=; b=XOYhuI2AmM34niy31fKhBYoxFkt3j5DqijYTMjnSUDS+FUsdM+KQiz0DCtqQLyLW6K 07jeT8HIyU//kFGxLVKwVqRjZzqPjxBk1oZiRSVwdTByf9XFyZ8lTfh5pD4vmi3p+dvM S5nIsW5Y5s0ISzKPecCwCbjlVxWlHyDJB2uULUtAZJsV+QNiF9nknaW7+i5YOpEn9Rnq hT1u91w3b7RT0KUCVDZxu40MyMpCjOaq4Gsrc7iflaT/0tY/lpj0uqUaYtzlYkijGTra tt+QLczQxLYj6UqMjeJ95ND5esltIBHTBqpsNCasOtJXG9kob63W6gZ0dJ+GFUmPmtES 7ewA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=HDYzBKju; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id bw18-20020a056a02049200b005a019d60ffbsi2141115pgb.78.2023.10.18.04.14.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 04:14:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=HDYzBKju; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id DA43980C6517; Wed, 18 Oct 2023 04:14:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230246AbjJRLNh (ORCPT + 24 others); Wed, 18 Oct 2023 07:13:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbjJRLNb (ORCPT ); Wed, 18 Oct 2023 07:13:31 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76A89114 for ; Wed, 18 Oct 2023 04:13:29 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 047A81FD71; Wed, 18 Oct 2023 11:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1697627608; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AxqPCsVu93zMNlESL0N42GEheOSU7BHbH8/1jpPYl4o=; b=HDYzBKjuHW1BbT8KulHbZ4NzqLYCB12U4vKthmGMAi/oYagpeOPykJjM21yUVbm8QFrv4R QTlsQmwbDDHJ4lXe7v3VUW0Xgoxb4CBrOa2Z8oMVldrMMvot59pJmdk4+UK/zV8gNPL+Z+ h8E+CO8OZg9hG9Fr0ZwZ2ORJ8yxcO1E= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DD3BD13915; Wed, 18 Oct 2023 11:13:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id HnMLNNe9L2VLZwAAMHmgww (envelope-from ); Wed, 18 Oct 2023 11:13:27 +0000 From: Andrea della Porta To: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: nik.borisov@suse.com, Andrea della Porta Subject: [PATCH 2/4] arm64/process: Make loading of 32bit processes depend on aarch32_enabled() Date: Wed, 18 Oct 2023 13:13:20 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -4.17 X-Spamd-Result: default: False [-4.17 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-1.47)[91.46%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FORGED_SENDER(0.30)[andrea.porta@suse.com,aporta@suse.de]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_NEQ_ENVFROM(0.10)[andrea.porta@suse.com,aporta@suse.de]; RCVD_TLS_ALL(0.00)[] X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 18 Oct 2023 04:14:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780091609426062570 X-GMAIL-MSGID: 1780091609426062570 Major aspect of Aarch32 emulation is the ability to load 32bit processes. That's currently decided (among others) by compat_elf_check_arch(). Make the macro use aarch32_enabled() to decide if Aarch32 compat is enabled before loading a 32bit process. Signed-off-by: Andrea della Porta --- arch/arm64/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 657ea273c0f9..96832f1ec3ee 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -601,7 +601,7 @@ unsigned long arch_align_stack(unsigned long sp) #ifdef CONFIG_COMPAT int compat_elf_check_arch(const struct elf32_hdr *hdr) { - if (!system_supports_32bit_el0()) + if (!system_supports_32bit_el0() || !aarch32_enabled()) return false; if ((hdr)->e_machine != EM_ARM) From patchwork Wed Oct 18 11:13:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea della Porta X-Patchwork-Id: 154823 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4713183vqb; Wed, 18 Oct 2023 04:14:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHznB9Fv+Ofcl+JzY1T48THlS1BYhG64hPYVue9vtlArQjJYqck4BEaWEwolyKOajQ5q6LQ X-Received: by 2002:a05:6e02:1d8a:b0:34e:2a69:883c with SMTP id h10-20020a056e021d8a00b0034e2a69883cmr5864508ila.1.1697627660231; Wed, 18 Oct 2023 04:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697627660; cv=none; d=google.com; s=arc-20160816; b=EycXLaD8rcaHL5Oe0Lqyx8KINl09V0hIDCixlAUFxDdnW2iowIH/+9dpAqb6SOWidF IHtQ1UAc+trAV9E0NcYHK7aMTk4tPtLwh/Pf8vQgqu8K/+pdObvh4WKj2YJP5XC8y+7E E9qLrgdYg6WvfcyikfCNT7odbKCj0Xuy/NXyWenUAWtXgpNoZ5C8+Fff9TJFn+7bZ81G 77zXQWK3PE/6DhqU6Qlv9iK4cVGUQDCZVHECAsCjLN6rfpbEDmbgyBh4HnqDg9J7QTUS FLWY5H+azJ5H7AQ/ylAkzwuA5PGAwdHpwMsg+awtvHjUUrfOMNh0aaxoFVaQwIms8/23 2d5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u6u9y46jkVER60u+w3B28cBFCMC/ngKcpVS2qgksG3Q=; fh=Fmfa0t6QgnUIyzgsSgnN1cYWfnFwLN+1Ba+VDm5h09M=; b=GXdqhUFVcsXMFfBCX07NevMWskl2sxNi0DO/YnNGq0Hd8S+HsCD/igbxeNUJjtzRV7 BKN3s/WrSgHe3XZEAkQYIeBzFrzxmWt5UhmPheGcLfmj+j9okrPe1a2KQjbk2kZxIWwO IOq2MXr++YdyPJwu+TkTDrnVWdLG6Ihz7gwH41nekKNKnsN8d0mHTUMy4q0n8YOir6Dr nYpH3Pa6lbIOtTjdKan9twAzP+8TBCC64W4+RafbrjxHNiz6JFM4nWJ3uVZBGRhYphUU Of3wxJIlW/8kMFCHqovCyy9ylOHIqhr9u4/+c70B4+f1itgTSFFNgTsviU3ShjGCAL3m i37A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=X7SBrMoE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id bs191-20020a6328c8000000b005a0788d4a50si291575pgb.376.2023.10.18.04.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 04:14:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=X7SBrMoE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id CA4778114EE4; Wed, 18 Oct 2023 04:14:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230274AbjJRLNk (ORCPT + 24 others); Wed, 18 Oct 2023 07:13:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbjJRLNb (ORCPT ); Wed, 18 Oct 2023 07:13:31 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D748111 for ; Wed, 18 Oct 2023 04:13:30 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B48B521AC1; Wed, 18 Oct 2023 11:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1697627608; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u6u9y46jkVER60u+w3B28cBFCMC/ngKcpVS2qgksG3Q=; b=X7SBrMoEQA863Gp09EG6nMRYgpeIDOKNyRXqyAkkW+4By2yAHuAlxs+R5qEdc3uv6MkMCp J43eUsCyGcfMCZQSdG/Vc34Cewggg01DdijWLay3oeLCxm1bUTSDP35iZ7qY7cZCbB5K4R B8mSF0lltb02NNExrl1v4rW8FH9Hw90= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9BFB813915; Wed, 18 Oct 2023 11:13:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ZFg1JNi9L2VPZwAAMHmgww (envelope-from ); Wed, 18 Oct 2023 11:13:28 +0000 From: Andrea della Porta To: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: nik.borisov@suse.com, Andrea della Porta Subject: [PATCH 3/4] arm64/entry-common: Make Aarch32 syscalls' availability depend on aarch32_enabled() Date: Wed, 18 Oct 2023 13:13:21 +0200 Message-ID: <88bdea628a13747bff32c0c3055d6d6ef7264d96.1697614386.git.andrea.porta@suse.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -2.85 X-Spamd-Result: default: False [-2.85 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-0.15)[68.94%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; REPLY(-4.00)[]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FORGED_SENDER(0.30)[andrea.porta@suse.com,aporta@suse.de]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_NEQ_ENVFROM(0.10)[andrea.porta@suse.com,aporta@suse.de]; RCVD_TLS_ALL(0.00)[] X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 18 Oct 2023 04:14:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780091621052792675 X-GMAIL-MSGID: 1780091621052792675 Another major aspect of supporting running of 32bit processes is the ability to access 32bit syscalls. Such syscalls can be invoked by using the svc instruction. If Aarch32 emulation is disabled ensure that calling svc results in the same behavior as if CONFIG_COMPAT has not been enabled (i.e. a kernel panic). Signed-off-by: Andrea della Porta --- arch/arm64/kernel/entry-common.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c index 69ff9b8c0bde..32761760d9dd 100644 --- a/arch/arm64/kernel/entry-common.c +++ b/arch/arm64/kernel/entry-common.c @@ -802,6 +802,11 @@ asmlinkage void noinstr el0t_64_error_handler(struct pt_regs *regs) } #ifdef CONFIG_COMPAT +UNHANDLED(el0t, 32, sync_ni) +UNHANDLED(el0t, 32, irq_ni) +UNHANDLED(el0t, 32, fiq_ni) +UNHANDLED(el0t, 32, error_ni) + static void noinstr el0_cp15(struct pt_regs *regs, unsigned long esr) { enter_from_user_mode(regs); @@ -821,6 +826,11 @@ static void noinstr el0_svc_compat(struct pt_regs *regs) asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs) { + if (!aarch32_enabled()) { + el0t_32_sync_ni_handler(regs); + return; + } + unsigned long esr = read_sysreg(esr_el1); switch (ESR_ELx_EC(esr)) { @@ -865,17 +875,26 @@ asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs) asmlinkage void noinstr el0t_32_irq_handler(struct pt_regs *regs) { - __el0_irq_handler_common(regs); + if (!aarch32_enabled()) + el0t_32_irq_ni_handler(regs); + else + __el0_irq_handler_common(regs); } asmlinkage void noinstr el0t_32_fiq_handler(struct pt_regs *regs) { - __el0_fiq_handler_common(regs); + if (!aarch32_enabled()) + el0t_32_fiq_ni_handler(regs); + else + __el0_fiq_handler_common(regs); } asmlinkage void noinstr el0t_32_error_handler(struct pt_regs *regs) { - __el0_error_handler_common(regs); + if (!aarch32_enabled()) + el0t_32_error_ni_handler(regs); + else + __el0_error_handler_common(regs); } bool __aarch32_enabled __ro_after_init = true; From patchwork Wed Oct 18 11:13:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea della Porta X-Patchwork-Id: 154821 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4713051vqb; Wed, 18 Oct 2023 04:14:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPyCNbvtl3DuEb0UK/1gY4AmfxHWULOFcEGc4KX9bg4bUFBpanE9nQoXYkOHkwSc93fVLN X-Received: by 2002:a17:902:f154:b0:1bf:349f:b85c with SMTP id d20-20020a170902f15400b001bf349fb85cmr4923422plb.1.1697627646535; Wed, 18 Oct 2023 04:14:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697627646; cv=none; d=google.com; s=arc-20160816; b=gI2oz9Jfhyq+W/30B5+jwzut1wDr3CLzInSxwN6olfvTztpnXZjLQhVh3kQ1/S1Rso 6FvqTQBADzEY2HyxPt+acbBq7yBp6sa/eUkaqy1gupbyNJNV4rodkhuzjoK/dlPVCYXG y7GOwzj5F8829DHUkB/8389KQxHNZP+CXOYBYuCoH+iQr1+EsPeq0gzkme7Ujxc0q3nE 3F6ZHzHbLG7odcXtHDTtidcFcbOP6uM3P9bZwtCC/eHY9rR7XQaUAb88DY++S9QsVz8+ oD1tzJPRHahrvL1siEUS0I8U0/2glxxnUK8B/B6CH7ImlM1+zlQParPpxFYSCINUb94p JuQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wsR/3Y9czckKmpyD5dpakWYoef+ZcRQqjgka+TQ4G38=; fh=Fmfa0t6QgnUIyzgsSgnN1cYWfnFwLN+1Ba+VDm5h09M=; b=UHY4cVXY9kkQRq8DKBOwtwXYtBSC3ZyzPinJTu7VF97liv2E4doJw5CS6u3lQFRuHZ d21UES21HWPEirW7x5tiQG0jnlhw5sMs4XTzsfgy6cAWKafbHxjlJy/U6L9vF9piJe8z cFnpxmkyEqZ9ge9o6hcXzQYiv+xCmvl+pQsbFKnaqQmCWcoWi+KhWb6UVUcvdWxbRQnl NZ7oRlvtIWTgpKN0P7xTHyFsPi/p52E8IwhuBu0PrpawpyHz8eD5yNk4BirNbTdzlDBl OCFf+aW8TMdCuQjlo6FJeH/YDfvWk/OqttgqpkH3qkQ3SzXLj5/CUl7CJkkalM6SCISc nI+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=kzK0A7Ah; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z4-20020a170902708400b001bb3bcd05bbsi3655393plk.471.2023.10.18.04.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 04:14:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=kzK0A7Ah; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2EC598025895; Wed, 18 Oct 2023 04:14:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229690AbjJRLNn (ORCPT + 24 others); Wed, 18 Oct 2023 07:13:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230115AbjJRLNc (ORCPT ); Wed, 18 Oct 2023 07:13:32 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6BDBFE for ; Wed, 18 Oct 2023 04:13:30 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 876EC21B46; Wed, 18 Oct 2023 11:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1697627609; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wsR/3Y9czckKmpyD5dpakWYoef+ZcRQqjgka+TQ4G38=; b=kzK0A7Ah4wF9K5Iz3ITZDsOAS/SGjho+aaOpko47hOx+NTaRPXP0ZMtcHIMS2FReb2c2bs muBtEJKJTv8yMqE5ObWfV8BopGL73hobgywMYfmBZDwLdrINoEQRsDWhPxtwH3cYVxuGRP jBjEi4n36kW8I4tscrhT0TtVk/ZZBDA= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 694DE13915; Wed, 18 Oct 2023 11:13:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EpgfF9m9L2VRZwAAMHmgww (envelope-from ); Wed, 18 Oct 2023 11:13:29 +0000 From: Andrea della Porta To: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: nik.borisov@suse.com, Andrea della Porta Subject: [PATCH 4/4] arm64: Make Aarch32 emulation boot time configurable Date: Wed, 18 Oct 2023 13:13:22 +0200 Message-ID: <1029761eb218702d4aafa58d83c4bf9d3a760264.1697614386.git.andrea.porta@suse.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -5.70 X-Spamd-Result: default: False [-5.70 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-3.00)[100.00%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FORGED_SENDER(0.30)[andrea.porta@suse.com,aporta@suse.de]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_NEQ_ENVFROM(0.10)[andrea.porta@suse.com,aporta@suse.de]; RCVD_TLS_ALL(0.00)[] X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 18 Oct 2023 04:14:03 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780091607388791985 X-GMAIL-MSGID: 1780091607388791985 Distributions would like to reduce their attack surface as much as possible but at the same time they'd want to retain flexibility to cater to a variety of legacy software. This stems from the conjecture that compat layer is likely rarely tested and could have latent security bugs. Ideally distributions will set their default policy and also give users the ability to override it as appropriate. To enable this use case, introduce CONFIG_AARCH32_EMULATION_DEFAULT_DISABLED compile time option, which controls whether 32bit processes/syscalls should be allowed or not. This option is aimed mainly at distributions to set their preferred default behavior in their kernels. To allow users to override the distro's policy, introduce the 'aarch32_emulation' parameter which allows overriding CONFIG_AARCH32_EMULATION_DEFAULT_DISABLED state at boot time. Signed-off-by: Andrea della Porta --- Documentation/admin-guide/kernel-parameters.txt | 7 +++++++ arch/arm64/Kconfig | 9 +++++++++ arch/arm64/kernel/entry-common.c | 8 +++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 0a1731a0f0ef..a41c5e6f5d2e 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1,3 +1,10 @@ + aarch32_emulation= [ARM64] + Format: + When true, allows loading 32-bit programs and executing + 32-bit syscalls, essentially overriding + AARCH32_EMULATION_DEFAULT_DISABLED at boot time. when false, + unconditionally disables AARCH32 emulation. + acpi= [HW,ACPI,X86,ARM64,RISCV64] Advanced Configuration and Power Interface Format: { force | on | off | strict | noirq | rsdt | diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b10515c0200b..66c4cb273550 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1725,6 +1725,15 @@ config SETEND_EMULATION If unsure, say Y endif # ARMV8_DEPRECATED +config AARCH32_EMULATION_DEFAULT_DISABLED + bool "Aarch32 emulation disabled by default" + default n + depends on COMPAT + help + Make Aarch32 emulation disabled by default. This prevents loading 32-bit + processes and access to 32-bit syscalls. + + If unsure, leave it to its default value. endif # COMPAT menu "ARMv8.1 architectural features" diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c index 32761760d9dd..07f2b4e632b8 100644 --- a/arch/arm64/kernel/entry-common.c +++ b/arch/arm64/kernel/entry-common.c @@ -897,7 +897,13 @@ asmlinkage void noinstr el0t_32_error_handler(struct pt_regs *regs) __el0_error_handler_common(regs); } -bool __aarch32_enabled __ro_after_init = true; +bool __aarch32_enabled __ro_after_init = !IS_ENABLED(CONFIG_AARCH32_EMULATION_DEFAULT_DISABLED); + +static int aarch32_emulation_override_cmdline(char *arg) +{ + return kstrtobool(arg, &__aarch32_enabled); +} +early_param("aarch32_emulation", aarch32_emulation_override_cmdline); #else /* CONFIG_COMPAT */ UNHANDLED(el0t, 32, sync) UNHANDLED(el0t, 32, irq)