diff options
| -rw-r--r-- | meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch | 61 | ||||
| -rw-r--r-- | meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb | 3 |
2 files changed, 63 insertions, 1 deletions
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch new file mode 100644 index 0000000000..b22ac3aca4 --- /dev/null +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | From 10afeecd10499fbd64b2c68d3b076c6906df441f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Wed, 5 Sep 2018 17:07:48 +0200 | ||
| 4 | Subject: [PATCH] kexec-arm64.c: workaround for getrandom() syscall | ||
| 5 | |||
| 6 | The syscall was added to OE's klibc. | ||
| 7 | Fix | ||
| 8 | |||
| 9 | | ../git/kexec/arch/arm64/kexec-arm64.c:19:10: fatal error: syscall.h: No such file or directory | ||
| 10 | | #include <syscall.h> | ||
| 11 | |||
| 12 | and | ||
| 13 | |||
| 14 | | ../git/kexec/arch/arm64/kexec-arm64.c: In function 'setup_2nd_dtb': | ||
| 15 | | ../git/kexec/arch/arm64/kexec-arm64.c:499:12: warning: implicit declaration of function 'getrandom'; did you mean 'srandom'? [-Wimplicit-function-declaration] | ||
| 16 | | result = getrandom(&fdt_val64, | ||
| 17 | |||
| 18 | |||
| 19 | Upstream-Status: Inappropriate [klibc specific] | ||
| 20 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 21 | --- | ||
| 22 | kexec/arch/arm64/kexec-arm64.c | 12 +++++++++++- | ||
| 23 | 1 file changed, 11 insertions(+), 1 deletion(-) | ||
| 24 | |||
| 25 | diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c | ||
| 26 | index 7a12479..8a7f5c5 100644 | ||
| 27 | --- a/kexec/arch/arm64/kexec-arm64.c | ||
| 28 | +++ b/kexec/arch/arm64/kexec-arm64.c | ||
| 29 | @@ -16,7 +16,11 @@ | ||
| 30 | #include <elf.h> | ||
| 31 | |||
| 32 | #include <unistd.h> | ||
| 33 | + | ||
| 34 | +#ifndef __KLIBC__ | ||
| 35 | #include <syscall.h> | ||
| 36 | +#endif | ||
| 37 | + | ||
| 38 | #include <errno.h> | ||
| 39 | #include <linux/random.h> | ||
| 40 | |||
| 41 | @@ -487,10 +491,16 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash) | ||
| 42 | * have a valid random seed to pass to the | ||
| 43 | * secondary kernel. | ||
| 44 | */ | ||
| 45 | +#ifndef __KLIBC__ | ||
| 46 | result = syscall(SYS_getrandom, &fdt_val64, | ||
| 47 | sizeof(fdt_val64), | ||
| 48 | GRND_NONBLOCK); | ||
| 49 | - | ||
| 50 | +#else | ||
| 51 | + extern ssize_t getrandom(void *, size_t, unsigned int); | ||
| 52 | + result = getrandom(&fdt_val64, | ||
| 53 | + sizeof(fdt_val64), | ||
| 54 | + GRND_NONBLOCK); | ||
| 55 | +#endif | ||
| 56 | if(result == -1) { | ||
| 57 | dbgprintf("%s: Reading random bytes failed.\n", | ||
| 58 | __func__); | ||
| 59 | -- | ||
| 60 | 2.7.4 | ||
| 61 | |||
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb index d6d3dc8352..4bbda4c9e1 100644 --- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb +++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb | |||
| @@ -51,7 +51,8 @@ SRC_URI_append_x86-64 = " file://x86_sys_io.patch file://x86_basename.patch \ | |||
| 51 | 51 | ||
| 52 | SRC_URI_append_aarch64 = " file://arm64_purgatory-Makefile-remove-unknown-flags.patch \ | 52 | SRC_URI_append_aarch64 = " file://arm64_purgatory-Makefile-remove-unknown-flags.patch \ |
| 53 | file://arm64_kexec-image-header.h-add-missing-le64toh.patch \ | 53 | file://arm64_kexec-image-header.h-add-missing-le64toh.patch \ |
| 54 | file://arm64-crashdump-arm64.c-fix-warning.patch" | 54 | file://arm64-crashdump-arm64.c-fix-warning.patch \ |
| 55 | file://arm64_kexec-arm64.c-workaround-for-getrandom-syscall.patch" | ||
| 55 | 56 | ||
| 56 | SRC_URI_append_powerpc = " file://powerpc-purgatory-Makefile-remove-unknown-flags.patch" | 57 | SRC_URI_append_powerpc = " file://powerpc-purgatory-Makefile-remove-unknown-flags.patch" |
| 57 | 58 | ||
