From: Andrea della Porta <andrea.porta@suse.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: nik.borisov@suse.com, arnd@arndb.de, mark.rutland@arm.com,
Andrea della Porta <andrea.porta@suse.com>
Subject: [PATCH v2 4/4] arm64: Make Aarch32 support boot time configurable
Date: Mon, 23 Oct 2023 16:42:23 +0200 [thread overview]
Message-ID: <c94183bbc07d4bd897e5c51a2930d1622f6fd61c.1698069331.git.andrea.porta@suse.com> (raw)
In-Reply-To: <cover.1698069331.git.andrea.porta@suse.com>
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_SUPPORT_DEFAULT_DISABLED
compile time option, which controls whether 32bit processes/exceptions
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
'allow_32bit_el0' parameter which allows overriding
CONFIG_AARCH32_SUPPORT_DEFAULT_DISABLED state at boot time.
Signed-off-by: Andrea della Porta <andrea.porta@suse.com>
---
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..9752c4640bd7 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1,3 +1,10 @@
+ allow_32bit_el0= [ARM64]
+ Format: <bool>
+ When true, allows loading 32-bit programs and executing
+ 32-bit syscalls and exceptions, essentially overriding
+ AARCH32_SUPPORT_DEFAULT_DISABLED at boot time. when false,
+ unconditionally disables AARCH32 support.
+
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..c8e1b3535018 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_SUPPORT_DEFAULT_DISABLED
+ bool "Aarch32 support disabled by default"
+ default n
+ depends on COMPAT
+ help
+ Make Aarch32 support disabled by default. This prevents loading 32-bit
+ processes and access to 32-bit syscalls and exceptions.
+
+ 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..7698057ef4ce 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_SUPPORT_DEFAULT_DISABLED);
+
+static int aarch32_support_override_cmdline(char *arg)
+{
+ return kstrtobool(arg, &__aarch32_enabled);
+}
+early_param("allow_32bit_el0", aarch32_support_override_cmdline);
#else /* CONFIG_COMPAT */
UNHANDLED(el0t, 32, sync)
UNHANDLED(el0t, 32, irq)
--
2.35.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2023-10-23 14:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 14:42 [PATCH v2 0/4] arm64: Make Aarch32 compatibility enablement optional at boot Andrea della Porta
2023-10-23 14:42 ` [PATCH v2 1/4] arm64: Introduce aarch32_enabled() Andrea della Porta
2023-10-24 11:56 ` Robin Murphy
2023-11-15 15:36 ` Andrea della Porta
2023-10-23 14:42 ` [PATCH v2 2/4] arm64/process: Make loading of 32bit processes depend on aarch32_enabled() Andrea della Porta
2023-10-23 14:42 ` [PATCH v2 3/4] arm64/entry-common: Make Aarch32 exceptions' availability " Andrea della Porta
2023-10-25 11:27 ` Mark Rutland
2023-11-15 16:09 ` Andrea della Porta
2023-10-23 14:42 ` Andrea della Porta [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c94183bbc07d4bd897e5c51a2930d1622f6fd61c.1698069331.git.andrea.porta@suse.com \
--to=andrea.porta@suse.com \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=nik.borisov@suse.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).