From 8c18602ef2063d6774a00a322e5b3020b88237f2 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Fri, 5 Jul 2019 17:15:53 -0400 Subject: [PATCH] backport of arm64 vdso patch from Arnd for 4.4 Signed-off-by: Sasha Levin --- ...vdso-define-vdso_-start-end-as-array.patch | 64 +++++++++++++++++++ queue-4.4/series | 1 + 2 files changed, 65 insertions(+) create mode 100644 queue-4.4/arm64-vdso-define-vdso_-start-end-as-array.patch diff --git a/queue-4.4/arm64-vdso-define-vdso_-start-end-as-array.patch b/queue-4.4/arm64-vdso-define-vdso_-start-end-as-array.patch new file mode 100644 index 00000000000..e85f97eaa57 --- /dev/null +++ b/queue-4.4/arm64-vdso-define-vdso_-start-end-as-array.patch @@ -0,0 +1,64 @@ +From 20e4b1c1795901ca724d71154020922e3eb74990 Mon Sep 17 00:00:00 2001 +From: Kees Cook +Date: Fri, 5 Jul 2019 20:55:50 +0200 +Subject: arm64, vdso: Define vdso_{start,end} as array + +Commit dbbb08f500d6146398b794fdc68a8e811366b451 upstream. + +Adjust vdso_{start|end} to be char arrays to avoid compile-time analysis +that flags "too large" memcmp() calls with CONFIG_FORTIFY_SOURCE. + +Cc: Jisheng Zhang +Acked-by: Catalin Marinas +Suggested-by: Mark Rutland +Signed-off-by: Kees Cook +Signed-off-by: Will Deacon +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + arch/arm64/kernel/vdso.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c +index 97bc68f4c689..908bc5ab94c1 100644 +--- a/arch/arm64/kernel/vdso.c ++++ b/arch/arm64/kernel/vdso.c +@@ -36,7 +36,7 @@ + #include + #include + +-extern char vdso_start, vdso_end; ++extern char vdso_start[], vdso_end[]; + static unsigned long vdso_pages; + static struct page **vdso_pagelist; + +@@ -115,14 +115,14 @@ static int __init vdso_init(void) + { + int i; + +- if (memcmp(&vdso_start, "\177ELF", 4)) { ++ if (memcmp(vdso_start, "\177ELF", 4)) { + pr_err("vDSO is not a valid ELF object!\n"); + return -EINVAL; + } + +- vdso_pages = (&vdso_end - &vdso_start) >> PAGE_SHIFT; ++ vdso_pages = (vdso_end - vdso_start) >> PAGE_SHIFT; + pr_info("vdso: %ld pages (%ld code @ %p, %ld data @ %p)\n", +- vdso_pages + 1, vdso_pages, &vdso_start, 1L, vdso_data); ++ vdso_pages + 1, vdso_pages, vdso_start, 1L, vdso_data); + + /* Allocate the vDSO pagelist, plus a page for the data. */ + vdso_pagelist = kcalloc(vdso_pages + 1, sizeof(struct page *), +@@ -135,7 +135,7 @@ static int __init vdso_init(void) + + /* Grab the vDSO code pages. */ + for (i = 0; i < vdso_pages; i++) +- vdso_pagelist[i + 1] = virt_to_page(&vdso_start + i * PAGE_SIZE); ++ vdso_pagelist[i + 1] = virt_to_page(vdso_start + i * PAGE_SIZE); + + /* Populate the special mapping structures */ + vdso_spec[0] = (struct vm_special_mapping) { +-- +2.20.1 + diff --git a/queue-4.4/series b/queue-4.4/series index d716e137881..30482aa5b93 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -68,3 +68,4 @@ lib-mpi-fix-karactx-leak-in-mpi_powm.patch btrfs-ensure-replaced-device-doesn-t-have-pending-chunk-allocation.patch tty-rocket-fix-incorrect-forward-declaration-of-rp_i.patch arc-handle-gcc-generated-__builtin_trap-for-older-compiler.patch +arm64-vdso-define-vdso_-start-end-as-array.patch -- 2.47.3