Re: [PATCH v4 18/21] arm64: Move "nokaslr" over to the early cpufeature infrastructure

From: Marc Zyngier
Date: Sun Jan 24 2021 - 13:42:09 EST


On Mon, 18 Jan 2021 14:46:36 +0000,
David Brazdil <dbrazdil@xxxxxxxxxx> wrote:
>
> On Mon, Jan 18, 2021 at 09:45:30AM +0000, Marc Zyngier wrote:
> > Given that the early cpufeature infrastructure has borrowed quite
> > a lot of code from the kaslr implementation, let's reimplement
> > the matching of the "nokaslr" option with it.
> >
> > Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
> Acked-by: David Brazdil <dbrazdil@xxxxxxxxxx>

[...]

> > @@ -126,7 +95,7 @@ u64 __init kaslr_early_init(void)
> > * Check if 'nokaslr' appears on the command line, and
> > * return 0 if that is the case.
> > */
> > - if (is_kaslr_disabled_cmdline(fdt)) {
> > + if (kaslr_feature_val & kaslr_feature_mask & 0xf) {
>
> nit: Isn't the 0xf redundant here? You don't re-mask for VH either.

Actually, I do. See the two back to back ubfx that extract both the
mask and the feature. The "& 0xf" here serves the same purpose.

Is it redundant? At the moment, quite possibly. But since we have
space for 16 "features", this is an indication that we are only using
the first one. I expect that eventually, we'll use it for other
things.

Thanks,

M.

--
Without deviation from the norm, progress is not possible.