From: Andrea della Porta <aporta@suse.de>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Andrea della Porta <andrea.porta@suse.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, nik.borisov@suse.com
Subject: Re: [PATCH 0/4] arm64: Make Aarch32 compatibility enablement optional at boot
Date: Thu, 19 Oct 2023 14:34:19 +0200 [thread overview]
Message-ID: <ZTEiS1G8rpvM5eAF@apocalypse> (raw)
In-Reply-To: <ZS_U9pqhLJ83h5Ig@FVFF77S0Q05N.cambridge.arm.com>
On 13:52 Wed 18 Oct , Mark Rutland wrote:
> On Wed, Oct 18, 2023 at 01:13:18PM +0200, Andrea della Porta wrote:
> > Aarch32 compatibility mode is enabled at compile time through
> > CONFIG_COMPAT Kconfig option. This patchset lets 32-bit support
> > (for both processes and syscalls) be enabled at boot time using
> > a kernel parameter. Also, it provides a mean for distributions
> > to set their own default without sacrificing compatibility support,
> > that is users can override default behaviour through the kernel
> > parameter.
>
> Can you elaborate on *why* people want such a policy?
>
Formerly, the reason was to reduce kernel attack surface by excluding
compat syscall, wherever applicable. Much less important but still a point,
I would also say this could be a good chance to get rid of somewhat old
and stale 32-bit libraries and programs, but this is of course debatable.
> > *** Notes about syscall management ***
> > VBAR_EL1 register, which holds the exception table address,
> > is setup very early in the boot process, before parse_early_param().
> > This means that it's not possible to access boot parameter before
> > setting the register. Also, setting the aforementioned register
> > for secondary cpus is done later in the boot flow.
> > Several ways to work around this has been considered, among which:
> >
> > * resetting VBAR_EL1 to point to one of two vector tables (the
> > former with 32-bit exceptions handler enabled and the latter
> > pointing to unhandled stub, just as if CONFIG_COMPAT is enabled)
> > depending on the proposed boot parameter. This has the disadvantage
> > to produce a somewhat messy patchset involving several lines,
> > has higher cognitive load since there are at least three places
> > where the register is getting changed (not near to each other),
> > and have implications on other code segments (namely kpti, kvm
> > and vdso), requiring special care.
> >
> > * patching the vector table contents once the early param is available.
> > This has most of the implications of the previous option
> > (except maybe not impacting other code segments), plus it sounds
> > a little 'hackish'.
> >
> > The chosen approach involves conditional executing 32-bit syscalls
> > depending on the parameter value.
>
> Why does the compat syscall path need to do anything?
I probably didn't catch your point here, compat syscall does not need to do
anything and they do not (just like they works right now with CONFIG_COMPAT
alone), except for the conditional instruction that excludes them at runtime.
Of course this conditional *is* doing something and somewhat redundant if
compat is disabled, but in this scenario I think it's unavoidable.
>
> On arm64 it's not possible to issue compat syscalls from a native 64-bit task.
> If you prevent the loading of AArch32 binaries, none of the compat syscalls
> will be reachable at all.
>
> That's the proper way to implement this, and we already have logic for that as
> part of the mismatched AArch32 support.
>
> > This of course results in a little performance loss, but has the following
> > advantages:
>
> A performance loss for what relative to what?
of a compat syscall as it is now enabling CONFIG_COMPAT vs the patched
syscall handlers that need a further conditional instruction to check
whether comapt is enabled or not.
>
> How much of a performance loss?
I did not take measurement yet since it was just a qualitative consideration
more than a quantitative one, also considering that chances are that it would
affect just very little population. The conditional instruction time taken
to execute is reasonably near to negligible if compared to any syscall execution.
_______________________________________________
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-19 12:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 11:13 [PATCH 0/4] arm64: Make Aarch32 compatibility enablement optional at boot Andrea della Porta
2023-10-18 11:13 ` [PATCH 1/4] arm64: Introduce aarch32_enabled() Andrea della Porta
2023-10-18 11:13 ` [PATCH 2/4] arm64/process: Make loading of 32bit processes depend on aarch32_enabled() Andrea della Porta
2023-10-18 12:52 ` Mark Rutland
2023-10-19 12:38 ` Andrea della Porta
2023-10-19 14:27 ` Mark Rutland
2023-10-19 14:32 ` Andrea della Porta
2023-10-19 14:50 ` Mark Rutland, Will Deacon
2023-10-18 11:13 ` [PATCH 3/4] arm64/entry-common: Make Aarch32 syscalls' availability " Andrea della Porta
2023-10-18 12:57 ` Mark Rutland
2023-10-19 12:48 ` Andrea della Porta
2023-10-22 20:30 ` kernel test robot
2023-10-18 11:13 ` [PATCH 4/4] arm64: Make Aarch32 emulation boot time configurable Andrea della Porta
2023-10-18 13:02 ` Mark Rutland
2023-10-19 12:50 ` Andrea della Porta
2023-10-18 12:27 ` [PATCH 0/4] arm64: Make Aarch32 compatibility enablement optional at boot Will Deacon
2023-10-18 12:44 ` Arnd Bergmann
2023-10-19 10:52 ` Andrea della Porta
2023-10-19 11:41 ` Arnd Bergmann
2023-10-19 9:17 ` Andrea della Porta
2023-10-18 12:52 ` Mark Rutland
2023-10-19 12:34 ` 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=ZTEiS1G8rpvM5eAF@apocalypse \
--to=aporta@suse.de \
--cc=andrea.porta@suse.com \
--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).