]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
backport of arm64 vdso patch from Arnd for 4.9
authorSasha Levin <sashal@kernel.org>
Fri, 5 Jul 2019 21:15:53 +0000 (17:15 -0400)
committerSasha Levin <sashal@kernel.org>
Fri, 5 Jul 2019 21:15:53 +0000 (17:15 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.9/arm64-vdso-define-vdso_-start-end-as-array.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/arm64-vdso-define-vdso_-start-end-as-array.patch b/queue-4.9/arm64-vdso-define-vdso_-start-end-as-array.patch
new file mode 100644 (file)
index 0000000..a4a3ea7
--- /dev/null
@@ -0,0 +1,64 @@
+From 5d2aa303cfd98933b2d63131bb3df65084fdaad7 Mon Sep 17 00:00:00 2001
+From: Kees Cook <keescook@chromium.org>
+Date: Fri, 5 Jul 2019 20:47:20 +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 <jszhang@marvell.com>
+Acked-by: Catalin Marinas <catalin.marinas@arm.com>
+Suggested-by: Mark Rutland <mark.rutland@arm.com>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 c9b9a5a322eb..c0f315ecfa7c 100644
+--- a/arch/arm64/kernel/vdso.c
++++ b/arch/arm64/kernel/vdso.c
+@@ -37,7 +37,7 @@
+ #include <asm/vdso.h>
+ #include <asm/vdso_datapage.h>
+-extern char vdso_start, vdso_end;
++extern char vdso_start[], vdso_end[];
+ static unsigned long vdso_pages __ro_after_init;
+ /*
+@@ -124,14 +124,14 @@ static int __init vdso_init(void)
+       int i;
+       struct page **vdso_pagelist;
+-      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 *),
+@@ -144,7 +144,7 @@ static int __init vdso_init(void)
+       /* Grab the vDSO code pages. */
+       for (i = 0; i < vdso_pages; i++)
+-              vdso_pagelist[i + 1] = pfn_to_page(PHYS_PFN(__pa(&vdso_start)) + i);
++              vdso_pagelist[i + 1] = pfn_to_page(PHYS_PFN(__pa(vdso_start)) + i);
+       vdso_spec[0].pages = &vdso_pagelist[0];
+       vdso_spec[1].pages = &vdso_pagelist[1];
+-- 
+2.20.1
+
index 9d6da1c891537c7d74d6b56167fed734a519d3ef..e89482fd8095b5ee3d5cc6a05a6b11230a47ac70 100644 (file)
@@ -93,3 +93,4 @@ drm-imx-notify-drm-core-before-sending-event-during-crtc-disable.patch
 drm-imx-only-send-event-on-crtc-disable-if-kept-disabled.patch
 btrfs-ensure-replaced-device-doesn-t-have-pending-chunk-allocation.patch
 tty-rocket-fix-incorrect-forward-declaration-of-rp_i.patch
+arm64-vdso-define-vdso_-start-end-as-array.patch