All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] arm64: use PIE code generation for KASLR kernel
@ 2022-04-27 17:12 Ard Biesheuvel
  2022-04-27 17:12 ` [RFC PATCH 1/2] arm64: jump_label: use more precise asm constraints Ard Biesheuvel
  2022-04-27 17:12 ` [RFC PATCH 2/2] arm64: kernel: switch to PIE code generation for relocatable kernels Ard Biesheuvel
  0 siblings, 2 replies; 17+ messages in thread
From: Ard Biesheuvel @ 2022-04-27 17:12 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: clang-built-linux, will, catalin.marinas, keescook, mark.rutland,
	nathan, Ard Biesheuvel, Sami Tolvanen, Nick Desaulniers

Building the KASLR kernel without -fpie but linking it with -pie works
in practice, but it is not something that is explicitly supported by the
toolchains - it happens to work because the default 'small' code model
used by both GCC and Clang relies mostly on ADRP+ADD/LDR to generate
symbol references.

Code generation with -fpie used to result in unnecessary overhead, as
all references to symbols with external visibility use emitted via
entries in the GOT, resulting in an additional load from memory for each
global variable access.

However, we can now manage this my using 'hidden' visibility (which is
already used in places such as the decompressor or the EFI stub), so we
can enable -fpie code generation without the overhead.

This series is RFC given that, beyond switching to a better supported
combination of compiler and linker options, I am not aware of any
advantages or disadvantages of making this change.

Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>

Ard Biesheuvel (2):
  arm64: jump_label: use more precise asm constraints
  arm64: kernel: switch to PIE code generation for relocatable kernels

 arch/arm64/Makefile                 | 4 ++++
 arch/arm64/include/asm/jump_label.h | 8 ++++----
 arch/arm64/kernel/vmlinux.lds.S     | 9 ++++-----
 3 files changed, 12 insertions(+), 9 deletions(-)

-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-04-29  7:55 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27 17:12 [RFC PATCH 0/2] arm64: use PIE code generation for KASLR kernel Ard Biesheuvel
2022-04-27 17:12 ` [RFC PATCH 1/2] arm64: jump_label: use more precise asm constraints Ard Biesheuvel
2022-04-27 18:58   ` Nick Desaulniers
2022-04-27 21:50     ` Ard Biesheuvel
2022-04-28  9:35       ` Ard Biesheuvel
2022-04-28  9:51   ` Mark Rutland
2022-04-28 16:05     ` Ard Biesheuvel
2022-04-27 17:12 ` [RFC PATCH 2/2] arm64: kernel: switch to PIE code generation for relocatable kernels Ard Biesheuvel
2022-04-28  2:40   ` Fangrui Song
2022-04-28  6:23     ` Ard Biesheuvel
2022-04-28  6:57       ` Fangrui Song
2022-04-28 16:03         ` Ard Biesheuvel
2022-04-28 18:53         ` Nick Desaulniers
2022-04-28 19:36           ` Ard Biesheuvel
2022-04-29  7:03             ` Fangrui Song
2022-04-29  7:27               ` Ard Biesheuvel
2022-04-29  7:53                 ` Fangrui Song

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.