summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kamensky <alexander.kamensky42@gmail.com>2020-11-12 14:35:54 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-11-16 14:27:46 +0000
commiteced9bcb337087c076e847f8d9cbae95760c28ed (patch)
tree1100efe62d1a741e2071a0ec5d83cfa9dec566eb
parenta51ebb8d2d30436b449aa33b91ba8dd20410002b (diff)
downloadpoky-eced9bcb337087c076e847f8d9cbae95760c28ed.tar.gz
kexec: arm64: disabled check if kaslr-seed dtb property was wiped
qemuarm64 fails to kexec secondary kernel with following message: setup_2nd_dtb: kaslr-seed is not wiped to 0. kexec: setup_2nd_dtb failed. kexec: load failed. It happens because kaslr-seed is not wiped in case when CONFIG_RANDOMIZE_BASE is not set and qemu generates chosen/kaslr-seed property. Solution is to remove check in kexec-tools that kaslr-seed is 0. (From OE-Core rev: c11ce15b594c2d988378728701e7e5b0ddaba406) Signed-off-by: Alexander Kamensky <alexander.kamensky42@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-kernel/kexec/kexec-tools/0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch67
-rw-r--r--meta/recipes-kernel/kexec/kexec-tools_2.0.20.bb1
2 files changed, 68 insertions, 0 deletions
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch b/meta/recipes-kernel/kexec/kexec-tools/0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch
new file mode 100644
index 0000000000..c2301e711d
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch
@@ -0,0 +1,67 @@
1From d48ec5e1a5fb7907520dee71b1d94045486a0c29 Mon Sep 17 00:00:00 2001
2From: Alexander Kamensky <alexander.kamensky42@gmail.com>
3Date: Thu, 12 Nov 2020 12:56:46 -0800
4Subject: [PATCH] arm64: kexec: disabled check if kaslr-seed dtb property was
5 wiped
6
7Kexec when loading arm64 kernel checks if chosen/kaslr-seed dtb property is
8wiped. It's a good assertion to verify proper behavior of kernel. However,
9if bootloader creates and fills kaslr-seed property and kernel is not
10configured with CONFIG_RANDOMIZE_BASE then logic of reading and wiping
11kaslr-seed does not run. As a result kaslr-seed property is not zero and when
12kexec tries to load secondary kernel it fails with the following message:
13
14setup_2nd_dtb: kaslr-seed is not wiped to 0.
15kexec: setup_2nd_dtb failed.
16kexec: load failed.
17
18This was observed on Yocto Project on qemuarm64 machine with 5.8 kernel,
19qemu 5.1.0. Qemu created kaslr-seed property but kernel was not configured
20with CONFIG_RANDOMIZE_BASE.
21
22Although check has some value, there is a use-case where it breaks kexec,
23this patch removes it.
24
25Note in described use-case the fact that kaslr-seed is not wiped and user
26readable through /sys/firmware/fdt or
27/sys/firmware/devicetree/base/chosen/kaslr-seed is not a security problem
28as kaslr is disabled anyway.
29
30Signed-off-by: Alexander Kamensky <alexander.kamensky42@gmail.com>
31Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2020-November/021740.html]
32---
33 kexec/arch/arm64/kexec-arm64.c | 14 +-------------
34 1 file changed, 1 insertion(+), 13 deletions(-)
35
36Index: kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.c
37===================================================================
38--- kexec-tools-2.0.20.orig/kexec/arch/arm64/kexec-arm64.c
39+++ kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.c
40@@ -428,7 +428,7 @@ static int setup_2nd_dtb(struct dtb *dtb
41 int len, range_len;
42 int nodeoffset;
43 int new_size;
44- int result, kaslr_seed;
45+ int result;
46
47 result = fdt_check_header(dtb->buf);
48
49@@ -499,18 +499,6 @@ static int setup_2nd_dtb(struct dtb *dtb
50 return result;
51 }
52 } else {
53- kaslr_seed = fdt64_to_cpu(*prop);
54-
55- /* kaslr_seed must be wiped clean by primary
56- * kernel during boot
57- */
58- if (kaslr_seed != 0) {
59- dbgprintf("%s: kaslr-seed is not wiped to 0.\n",
60- __func__);
61- result = -EINVAL;
62- goto on_error;
63- }
64-
65 /*
66 * Invoke the getrandom system call with
67 * GRND_NONBLOCK, to make sure we
diff --git a/meta/recipes-kernel/kexec/kexec-tools_2.0.20.bb b/meta/recipes-kernel/kexec/kexec-tools_2.0.20.bb
index 1e81ecc2c7..69d2e9bfba 100644
--- a/meta/recipes-kernel/kexec/kexec-tools_2.0.20.bb
+++ b/meta/recipes-kernel/kexec/kexec-tools_2.0.20.bb
@@ -21,6 +21,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz
21 file://0006-kexec-arm-undefine-__NR_kexec_file_load-for-arm.patch \ 21 file://0006-kexec-arm-undefine-__NR_kexec_file_load-for-arm.patch \
22 file://0007-kexec-un-break-the-build-on-32-bit-x86.patch \ 22 file://0007-kexec-un-break-the-build-on-32-bit-x86.patch \
23 file://0001-kexec-Fix-build-with-fno-common.patch \ 23 file://0001-kexec-Fix-build-with-fno-common.patch \
24 file://0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch \
24 " 25 "
25 26
26SRC_URI[md5sum] = "46724b67f32501c5d3e778161347cad9" 27SRC_URI[md5sum] = "46724b67f32501c5d3e778161347cad9"