From: Greg Kroah-Hartman Date: Mon, 10 Aug 2020 15:12:57 +0000 (+0200) Subject: 5.7-stable patches X-Git-Tag: v4.19.139~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5a90cc578738cd72fb47dcce3af4c2e52d5d7ee3;p=thirdparty%2Fkernel%2Fstable-queue.git 5.7-stable patches added patches: arm64-kaslr-use-standard-early-random-function.patch --- diff --git a/queue-5.7/arm64-kaslr-use-standard-early-random-function.patch b/queue-5.7/arm64-kaslr-use-standard-early-random-function.patch new file mode 100644 index 00000000000..6391946b388 --- /dev/null +++ b/queue-5.7/arm64-kaslr-use-standard-early-random-function.patch @@ -0,0 +1,76 @@ +From 9bceb80b3cc483e6763c39a4928402fa82815d3e Mon Sep 17 00:00:00 2001 +From: Guenter Roeck +Date: Fri, 7 Aug 2020 07:45:21 -0700 +Subject: arm64: kaslr: Use standard early random function + +From: Guenter Roeck + +commit 9bceb80b3cc483e6763c39a4928402fa82815d3e upstream. + +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)) + ^~~~~~~~~~~~ + +The 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 +Fixes: 585524081ecd ("random: random.h should include archrandom.h, not the other way around") +Cc: Qian Cai +Cc: Mark Brown +Reviewed-by: Mark Rutland +Reviewed-by: Mark Brown +Tested-by: Mark Brown +Signed-off-by: Guenter Roeck +Signed-off-by: Linus Torvalds +Cc: Sedat Dilek +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm64/kernel/kaslr.c | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +--- a/arch/arm64/kernel/kaslr.c ++++ b/arch/arm64/kernel/kaslr.c +@@ -84,6 +84,7 @@ u64 __init kaslr_early_init(u64 dt_phys) + void *fdt; + u64 seed, offset, mask, module_range; + const u8 *cmdline, *str; ++ unsigned long raw; + int size; + + /* +@@ -122,15 +123,12 @@ u64 __init kaslr_early_init(u64 dt_phys) + } + + /* +- * Mix in any entropy obtainable architecturally, open coded +- * since this runs extremely early. ++ * Mix in any entropy obtainable architecturally if enabled ++ * and supported. + */ +- if (__early_cpu_has_rndr()) { +- unsigned long raw; + +- if (__arm64_rndr(&raw)) +- seed ^= raw; +- } ++ if (arch_get_random_seed_long_early(&raw)) ++ seed ^= raw; + + if (!seed) { + kaslr_status = KASLR_DISABLED_NO_SEED; diff --git a/queue-5.7/series b/queue-5.7/series index c0500436c99..d138124f766 100644 --- a/queue-5.7/series +++ b/queue-5.7/series @@ -76,3 +76,4 @@ tcp-apply-a-floor-of-1-for-rtt-samples-from-tcp-timestamps.patch mptcp-be-careful-on-subflow-creation.patch mptcp-fix-bogus-sendmsg-return-code-under-pressure.patch ima-move-appraise_bootparam-dependency-on-arch_policy-to-runtime.patch +arm64-kaslr-use-standard-early-random-function.patch