arm64: module: move module randomization to module.c
authorMark Rutland <mark.rutland@arm.com>
Tue, 30 May 2023 11:03:26 +0000 (12:03 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Tue, 6 Jun 2023 16:39:05 +0000 (17:39 +0100)
commite46b7103aef39c3f421f0bff7a10ae5a29cd5cee
treea65a4f3aaba6b2bc2470b6e62299f2bc2045f4e8
parent6e13b6b923b35a965d128a40ef0c5d9dd101e603
arm64: module: move module randomization to module.c

When CONFIG_RANDOMIZE_BASE=y, module_alloc_base is a variable which is
configured by kaslr_module_init() in kaslr.c, and otherwise it is an
expression defined in module.h.

As kaslr_module_init() is no longer tightly coupled with the KASLR
initialization code, we can centralize this in module.c.

This patch moves kaslr_module_init() to module.c, making
module_alloc_base a static variable, and removing redundant includes from
kaslr.c. For the defintion of struct arm64_ftr_override we must include
<asm/cpufeature.h>, which was previously included transitively via
another header.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Cc: Will Deacon <will@kernel.org>
Tested-by: Shanker Donthineni <sdonthineni@nvidia.com>
Link: https://lore.kernel.org/r/20230530110328.2213762-5-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/module.h
arch/arm64/kernel/kaslr.c
arch/arm64/kernel/module.c