Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1658348 > unrolled thread
| Started by | Kees Cook <keescook@chromium.org> |
|---|---|
| First post | 2017-06-06 07:00 +0200 |
| Last post | 2017-06-06 18:20 +0200 |
| Articles | 6 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] FORTIFY_SOURCE build fixes Kees Cook <keescook@chromium.org> - 2017-06-06 07:00 +0200
[PATCH 4/6] kexec_file: Adjust declaration of kexec_purgatory Kees Cook <keescook@chromium.org> - 2017-06-06 07:00 +0200
[PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array Kees Cook <keescook@chromium.org> - 2017-06-06 07:00 +0200
Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array Catalin Marinas <catalin.marinas@arm.com> - 2017-06-06 11:50 +0200
Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array Will Deacon <will.deacon@arm.com> - 2017-06-06 11:50 +0200
Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array Kees Cook <keescook@chromium.org> - 2017-06-06 18:20 +0200
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Date | 2017-06-06 07:00 +0200 |
| Subject | [PATCH] FORTIFY_SOURCE build fixes |
| Message-ID | <tPeKZ-460-5@gated-at.bofh.it> |
I was originally carrying these patches in my KSPP tree, but akpm is taking the FORTIFY_SOURCE patch into -mm. As such, these fixes should be included as well. -Kees
[toc] | [next] | [standalone]
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Date | 2017-06-06 07:00 +0200 |
| Subject | [PATCH 4/6] kexec_file: Adjust declaration of kexec_purgatory |
| Message-ID | <tPeL0-460-27@gated-at.bofh.it> |
| In reply to | #1658348 |
Defining kexec_purgatory as a zero-length char array upsets compile
time size checking. Since this is built on a per-arch basis, define
it as an unsized char array (like is done for other similar things,
e.g. linker sections). This silences the warning generated by the future
CONFIG_FORTIFY_SOURCE, which did not like the memcmp() of a "0 byte"
array. This drops the __weak and uses an extern instead, since both
users define kexec_purgatory.
Cc: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
kernel/kexec_file.c | 7 -------
kernel/kexec_internal.h | 2 ++
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index f78f719dae36..5710591a9b6d 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -26,13 +26,6 @@
#include <linux/vmalloc.h>
#include "kexec_internal.h"
-/*
- * Declare these symbols weak so that if architecture provides a purgatory,
- * these will be overridden.
- */
-char __weak kexec_purgatory[0];
-size_t __weak kexec_purgatory_size = 0;
-
static int kexec_calculate_store_digests(struct kimage *image);
/* Architectures can provide this probe function */
diff --git a/kernel/kexec_internal.h b/kernel/kexec_internal.h
index 799a8a452187..50dfcb039a41 100644
--- a/kernel/kexec_internal.h
+++ b/kernel/kexec_internal.h
@@ -17,6 +17,8 @@ extern struct mutex kexec_mutex;
#ifdef CONFIG_KEXEC_FILE
#include <linux/purgatory.h>
void kimage_file_post_load_cleanup(struct kimage *image);
+extern char kexec_purgatory[];
+extern size_t kexec_purgatory_size;
#else /* CONFIG_KEXEC_FILE */
static inline void kimage_file_post_load_cleanup(struct kimage *image) { }
#endif /* CONFIG_KEXEC_FILE */
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Date | 2017-06-06 07:00 +0200 |
| Subject | [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array |
| Message-ID | <tPeL0-460-23@gated-at.bofh.it> |
| In reply to | #1658348 |
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
[toc] | [prev] | [next] | [standalone]
| From | Catalin Marinas <catalin.marinas@arm.com> |
|---|---|
| Date | 2017-06-06 11:50 +0200 |
| Subject | Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array |
| Message-ID | <tPjhD-6Wc-1@gated-at.bofh.it> |
| In reply to | #1658353 |
On Mon, Jun 05, 2017 at 09:52:30PM -0700, Kees Cook wrote:
> 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>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
[toc] | [prev] | [next] | [standalone]
| From | Will Deacon <will.deacon@arm.com> |
|---|---|
| Date | 2017-06-06 11:50 +0200 |
| Subject | Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array |
| Message-ID | <tPjhE-6Wc-19@gated-at.bofh.it> |
| In reply to | #1658546 |
On Tue, Jun 06, 2017 at 10:43:52AM +0100, Catalin Marinas wrote:
> On Mon, Jun 05, 2017 at 09:52:30PM -0700, Kees Cook wrote:
> > 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>
>
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Kees -- I'm assuming this series is going via some other tree, but let me
know if you want this patch to go via arm64.
Will
[toc] | [prev] | [next] | [standalone]
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Date | 2017-06-06 18:20 +0200 |
| Subject | Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array |
| Message-ID | <tPpn3-2GL-13@gated-at.bofh.it> |
| In reply to | #1658555 |
On Tue, Jun 6, 2017 at 2:49 AM, Will Deacon <will.deacon@arm.com> wrote:
> On Tue, Jun 06, 2017 at 10:43:52AM +0100, Catalin Marinas wrote:
>> On Mon, Jun 05, 2017 at 09:52:30PM -0700, Kees Cook wrote:
>> > 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>
>>
>> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
>
> Kees -- I'm assuming this series is going via some other tree, but let me
> know if you want this patch to go via arm64.
Greg has picked up the staging fix, so it's fine if it goes via other
trees. I think akpm will pick up anything that is left over. So, yeah,
please take it via arm64.
(And I need to fix git send-email to actually Cc people on
"Suggested-by", etc... hmm)
-Kees
--
Kees Cook
Pixel Security
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web