[PATCH 4/4] arm64: Make Aarch32 emulation boot time configurable

Andrea della Porta aporta at suse.de
Thu Oct 19 05:50:13 PDT 2023


On 14:02 Wed 18 Oct     , Mark Rutland wrote:
> On Wed, Oct 18, 2023 at 01:13:22PM +0200, Andrea della Porta wrote:
> > 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 <andrea.porta at 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..a41c5e6f5d2e 100644
> > --- a/Documentation/admin-guide/kernel-parameters.txt
> > +++ b/Documentation/admin-guide/kernel-parameters.txt
> > @@ -1,3 +1,10 @@
> > +	aarch32_emulation=	[ARM64]
> > +			Format: <bool>
> > +			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.
> 
> Can we please drop the 'emulation' part of the name? We don't use that
> terminology on arm64 for regular execution of compat tasks, and only use that
> to refer to true emulation of deprecated instructions.
> 
> We already have the 'allow_mismatched_32bit_el0' option; can we please us a
> name that aligns with that? e.g. 'allow_32bit_el0=false' to disable support.
> 

Sure, 'allow_mismatched_32bit_el0' will do. I'll prepare a patch accordingly.

Andrea



More information about the linux-arm-kernel mailing list