mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Kees Cook <keescook@chromium.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Jisheng Zhang <jszhang@marvell.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array
Date: Mon,  5 Jun 2017 21:52:30 -0700	[thread overview]
Message-ID: <1496724755-104187-2-git-send-email-keescook@chromium.org> (raw)
In-Reply-To: <1496724755-104187-1-git-send-email-keescook@chromium.org>

Adjust vdso_{start|end} to be char arrays to avoid compile-time analysis
that flags "too large" memcmp() calls with CONFIG_FORTIFY_SOURCE.

Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Jisheng Zhang <jszhang@marvell.com>
---
 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 41b6e31f8f55..ae35f1855e06 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;
 
 /*
@@ -125,14 +125,14 @@ static int __init vdso_init(void)
 	struct page **vdso_pagelist;
 	unsigned long pfn;
 
-	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 *),
@@ -145,7 +145,7 @@ static int __init vdso_init(void)
 
 
 	/* Grab the vDSO code pages. */
-	pfn = sym_to_pfn(&vdso_start);
+	pfn = sym_to_pfn(vdso_start);
 
 	for (i = 0; i < vdso_pages; i++)
 		vdso_pagelist[i + 1] = pfn_to_page(pfn + i);
-- 
2.7.4

  reply	other threads:[~2017-06-06  4:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06  4:52 [PATCH] FORTIFY_SOURCE build fixes Kees Cook
2017-06-06  4:52 ` Kees Cook [this message]
2017-06-06  9:43   ` [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array Catalin Marinas
2017-06-06  9:49     ` Will Deacon
2017-06-06 16:11       ` Kees Cook
2017-06-06  4:52 ` [PATCH 2/6] efi: Avoid fortify checks in EFI stub Kees Cook
2017-06-06 17:13   ` Ard Biesheuvel
2017-06-06 17:17     ` Mark Rutland
2017-06-07  3:12       ` Kees Cook
2017-06-07  8:54         ` Ard Biesheuvel
2017-06-08  2:37           ` Kees Cook
2017-06-09  9:01             ` Ard Biesheuvel
2017-06-16  9:14               ` Ard Biesheuvel
2017-06-07  9:27         ` Mark Rutland
2017-06-06  4:52 ` [PATCH 3/6] x86/power/64: Use char arrays for asm function names Kees Cook
2017-06-06  4:52 ` [PATCH 4/6] kexec_file: Adjust declaration of kexec_purgatory Kees Cook
2017-06-06  4:52 ` [PATCH 5/6] staging/rts5208: Fix read overflow in memcpy Kees Cook
2017-06-06  4:52 ` [PATCH 6/6] IB/rxe: Do not copy extra stack memory to skb Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1496724755-104187-2-git-send-email-keescook@chromium.org \
    --to=keescook@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=jszhang@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®