Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array

2017-06-06 Thread Kees Cook
On Tue, Jun 6, 2017 at 2:49 AM, Will Deacon  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 
>> > Signed-off-by: Kees Cook 
>> > Cc: Catalin Marinas 
>> > Cc: Will Deacon 
>> > Cc: Jisheng Zhang 
>>
>> Acked-by: Catalin Marinas 
>
> 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


Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array

2017-06-06 Thread Kees Cook
On Tue, Jun 6, 2017 at 2:49 AM, Will Deacon  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 
>> > Signed-off-by: Kees Cook 
>> > Cc: Catalin Marinas 
>> > Cc: Will Deacon 
>> > Cc: Jisheng Zhang 
>>
>> Acked-by: Catalin Marinas 
>
> 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


Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array

2017-06-06 Thread Will Deacon
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 
> > Signed-off-by: Kees Cook 
> > Cc: Catalin Marinas 
> > Cc: Will Deacon 
> > Cc: Jisheng Zhang 
> 
> Acked-by: Catalin Marinas 

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


Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array

2017-06-06 Thread Will Deacon
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 
> > Signed-off-by: Kees Cook 
> > Cc: Catalin Marinas 
> > Cc: Will Deacon 
> > Cc: Jisheng Zhang 
> 
> Acked-by: Catalin Marinas 

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


Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array

2017-06-06 Thread Catalin Marinas
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 
> Signed-off-by: Kees Cook 
> Cc: Catalin Marinas 
> Cc: Will Deacon 
> Cc: Jisheng Zhang 

Acked-by: Catalin Marinas 


Re: [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array

2017-06-06 Thread Catalin Marinas
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 
> Signed-off-by: Kees Cook 
> Cc: Catalin Marinas 
> Cc: Will Deacon 
> Cc: Jisheng Zhang 

Acked-by: Catalin Marinas 


[PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array

2017-06-05 Thread Kees Cook
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 
Signed-off-by: Kees Cook 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: Jisheng Zhang 
---
 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 
 #include 
 
-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(_start, "\177ELF", 4)) {
+   if (memcmp(vdso_start, "\177ELF", 4)) {
pr_err("vDSO is not a valid ELF object!\n");
return -EINVAL;
}
 
-   vdso_pages = (_end - _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, _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(_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



[PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array

2017-06-05 Thread Kees Cook
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 
Signed-off-by: Kees Cook 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: Jisheng Zhang 
---
 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 
 #include 
 
-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(_start, "\177ELF", 4)) {
+   if (memcmp(vdso_start, "\177ELF", 4)) {
pr_err("vDSO is not a valid ELF object!\n");
return -EINVAL;
}
 
-   vdso_pages = (_end - _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, _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(_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