Skip to contentSkip to conversation

arm64: adjust KASLR relocation after ARCH_RANDOM removal

PATCH Applied Lukas Bulwahn 3 participants 3 messages Jul 21, 2022 – Aug 17, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: adjust KASLR relocation after ARCH_RANDOM removal

Commit aacd149b6238 ("arm64: head: avoid relocating the kernel twice for KASLR") adds the new file arch/arm64/kernel/pi/kaslr_early.c with a small code part guarded by '#ifdef CONFIG_ARCH_RANDOM'.

Concurrently, commit 9592eef7c16e ("random: remove CONFIG_ARCH_RANDOM") removes the config CONFIG_ARCH_RANDOM and turns all '#ifdef CONFIG_ARCH_RANDOM' code parts into unconditional code parts, which is generally safe to do.

Remove a needless ifdef guard after the ARCH_RANDOM removal.

---
 arch/arm64/kernel/pi/kaslr_early.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/arm64/kernel/pi/kaslr_early.c +3 -5
index 6c3855e69395..17bff6e399e4 100644
@@ -94,11 +94,9 @@ asmlinkage u64 kaslr_early_init(void *fdt)
 
 	seed = get_kaslr_seed(fdt);
 	if (!seed) {
-#ifdef CONFIG_ARCH_RANDOM
-		 if (!__early_cpu_has_rndr() ||
-		     !__arm64_rndr((unsigned long *)&seed))
-#endif
-		return 0;
+		if (!__early_cpu_has_rndr() ||
+		    !__arm64_rndr((unsigned long *)&seed))
+			return 0;
 	}
 
 	/*
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Lukas Bulwahn

Commit aacd149b6238 ("arm64: head: avoid relocating the kernel twice for KASLR") adds the new file arch/arm64/kernel/pi/kaslr_early.c with a small code part guarded by '#ifdef CONFIG_ARCH_RANDOM'.

Quoted 8 lines

Concurrently, commit 9592eef7c16e ("random: remove CONFIG_ARCH_RANDOM") removes the config CONFIG_ARCH_RANDOM and turns all '#ifdef CONFIG_ARCH_RANDOM' code parts into unconditional code parts, which is generally safe to do.

Remove a needless ifdef guard after the ARCH_RANDOM removal.

Quoted 26 lines
---
 arch/arm64/kernel/pi/kaslr_early.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/arm64/kernel/pi/kaslr_early.c +3 -6
index 6c3855e69395..17bff6e399e4 100644
@@ -94,11 +94,9 @@ asmlinkage u64 kaslr_early_init(void *fdt)
 
        seed = get_kaslr_seed(fdt);
        if (!seed) {
-#ifdef CONFIG_ARCH_RANDOM
-                if (!__early_cpu_has_rndr() ||
-                    !__arm64_rndr((unsigned long *)&seed))
-#endif
-               return 0;
+               if (!__early_cpu_has_rndr() ||
+                   !__arm64_rndr((unsigned long *)&seed))
+                       return 0;
        }
 
        /*
--

2.17.1

maintainer Applied
#2 lore raw
In reply to Lukas Bulwahn
Quoted 10 lines · Lukas Bulwahn

Commit aacd149b6238 ("arm64: head: avoid relocating the kernel twice for KASLR") adds the new file arch/arm64/kernel/pi/kaslr_early.c with a small code part guarded by '#ifdef CONFIG_ARCH_RANDOM'.

Concurrently, commit 9592eef7c16e ("random: remove CONFIG_ARCH_RANDOM") removes the config CONFIG_ARCH_RANDOM and turns all '#ifdef CONFIG_ARCH_RANDOM' code parts into unconditional code parts, which is generally safe to do.

[...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64: adjust KASLR relocation after ARCH_RANDOM removal

      https://git.kernel.org/arm64/c/ff5900092227

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev