[PATCH v2] arm64: kaslr: Use standard early random function

Catalin Marinas catalin.marinas at arm.com
Fri Aug 7 13:35:14 EDT 2020


On Fri, Aug 07, 2020 at 07:45:21AM -0700, Guenter Roeck wrote:
> Commit 585524081ecd ("random: random.h should include archrandom.h, not
> the other way around") tries to fix a problem with recursive inclusion
> of linux/random.h and arch/archrandom.h for arm64. Unfortunately, this
> results in the following compile error if ARCH_RANDOM is disabled.
> 
> arch/arm64/kernel/kaslr.c: In function 'kaslr_early_init':
> arch/arm64/kernel/kaslr.c:128:6: error: implicit declaration of function
> '__early_cpu_has_rndr'; did you mean '__early_pfn_to_nid'?
> [-Werror=implicit-function-declaration]
>   if (__early_cpu_has_rndr()) {
>       ^~~~~~~~~~~~~~~~~~~~
>       __early_pfn_to_nid
> arch/arm64/kernel/kaslr.c:131:7: error: implicit declaration of function
> '__arm64_rndr' [-Werror=implicit-function-declaration]
>    if (__arm64_rndr(&raw))
>        ^~~~~~~~~~~~
> 
> Problem is that arch/archrandom.h is only included from linux/random.h if
> ARCH_RANDOM is enabled. If not, __arm64_rndr() and __early_cpu_has_rndr()
> are undeclared, causing the problem.
> 
> Use arch_get_random_seed_long_early() instead of arm64 specific functions
> to solve the problem.
> 
> Reported-by: Qian Cai <cai at lca.pw>
> Fixes: 585524081ecd ("random: random.h should include archrandom.h, not the other way around")
> Cc: Qian Cai <cai at lca.pw>
> Cc: Mark Brown <broonie at kernel.org>
> Reviewed-by: Mark Rutland <mark.rutland at arm.com>
> Reviewed-by: Mark Brown <broonie at kernel.org>
> Tested-by: Mark Brown <broonie at kernel.org>
> Signed-off-by: Guenter Roeck <linux at roeck-us.net>

Acked-by: Catalin Marinas <catalin.marinas at arm.com>

Linus, could you please pick this up directly? Otherwise, it will wait
until we reach -rc1 to avoid basing a branch on a random commit.

(at the moment I can't build Linus' tree at all, fails early with some
device tree errors)

Thanks.

-- 
Catalin



More information about the linux-arm-kernel mailing list