Thread (38 messages) 38 messages, 4 authors, 2021-01-26

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

From: Ard Biesheuvel <ardb@kernel.org>
Date: 2021-01-25 15:26:42
Also in: kvmarm, lkml

On Mon, 25 Jan 2021 at 15:28, Marc Zyngier [off-list ref] wrote:
On 2021-01-25 14:19, Ard Biesheuvel wrote:
quoted
On Mon, 25 Jan 2021 at 14:54, Marc Zyngier [off-list ref] wrote:
quoted
On 2021-01-25 12:54, Ard Biesheuvel wrote:
[...]
quoted
quoted
quoted
This struct now takes up
- ~100 bytes for the characters themselves (which btw are not emitted
into __initdata or __initconst)
- 6x8 bytes for the char pointers
- 6x24 bytes for the RELA relocations that annotate these pointers as
quantities that need to be relocated at boot (on a kernel built with
KASLR)

I know it's only a drop in the ocean, but in this case, where the
struct is statically declared and defined only once, and in the same
place, we could easily turn this into

static const struct {
   char alias[24];
   char param[20];
};

and get rid of all the overhead. The only slightly annoying thing is
that the array sizes need to be kept in sync with the largest instance
appearing in the array, but this is easy when the struct type is
declared in the same place where its only instance is defined.
Fair enough. I personally find the result butt-ugly, but I agree
that it certainly saves some memory. Does the following work for
you? I can even give symbolic names to the various constants (how
generous of me! ;-).
To be honest, I was anticipating more of a discussion, but this looks
reasonable to me.
It looked like a reasonable ask: all the strings are completely useless
once the kernel has booted, and I'm the first to moan that I can't boot
an arm64 kernel with less than 60MB of RAM (OK, it's a pretty bloated
kernel...).
quoted
Does 'char    feature[80];' really need 80 bytes though?
It really needs 75 bytes, because of this:

        { "arm64.nopauth",
          "id_aa64isar1.gpi=0 id_aa64isar1.gpa=0 "
          "id_aa64isar1.api=0 id_aa64isar1.apa=0"          },

80 is a round enough number.
Fair enough. This will inflate the struct substantially, but at least
it's all __initconst data now, and it's all NUL bytes so it compresses
much better than the pointers and RELA entries.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help