public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86, relocs: add percpu fixup for GNU ld 2.23
@ 2013-10-16  6:43 Kees Cook
  2013-10-16  6:51 ` H. Peter Anvin
  2013-10-18 13:20 ` [tip:x86/kaslr] x86/relocs: Add " tip-bot for Kees Cook
  0 siblings, 2 replies; 5+ messages in thread
From: Kees Cook @ 2013-10-16  6:43 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Thomas Gleixner, H. Peter Anvin, x86,
	Michael Davidson, Cong Ding

The GNU linker tries to put __per_cpu_load into the percpu area, resulting
in a lack of its relocation. Force this symbol to be relocated. Seen
starting with GNU ld 2.23 and later.

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/x86/tools/relocs.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index 1fa291f..7a85f29 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -729,6 +729,7 @@ static void percpu_init(void)
  *
  * The GNU linker incorrectly associates:
  *	__init_begin
+ *	__per_cpu_load
  *
  * The "gold" linker incorrectly associates:
  *	init_per_cpu__irq_stack_union
@@ -738,6 +739,7 @@ static int is_percpu_sym(ElfW(Sym) *sym, const char *symname)
 {
 	return (sym->st_shndx == per_cpu_shndx) &&
 		strcmp(symname, "__init_begin") &&
+		strcmp(symname, "__per_cpu_load") &&
 		strncmp(symname, "init_per_cpu_", 13);
 }
 
-- 
1.7.9.5


-- 
Kees Cook
Chrome OS Security

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86, relocs: add percpu fixup for GNU ld 2.23
  2013-10-16  6:43 [PATCH] x86, relocs: add percpu fixup for GNU ld 2.23 Kees Cook
@ 2013-10-16  6:51 ` H. Peter Anvin
  2013-10-16 14:55   ` Kees Cook
  2013-10-18 13:20 ` [tip:x86/kaslr] x86/relocs: Add " tip-bot for Kees Cook
  1 sibling, 1 reply; 5+ messages in thread
From: H. Peter Anvin @ 2013-10-16  6:51 UTC (permalink / raw)
  To: Kees Cook, Ingo Molnar
  Cc: linux-kernel, Thomas Gleixner, x86, Michael Davidson, Cong Ding

On 10/15/2013 11:43 PM, Kees Cook wrote:
> The GNU linker tries to put __per_cpu_load into the percpu area, resulting
> in a lack of its relocation. Force this symbol to be relocated. Seen
> starting with GNU ld 2.23 and later.
> 
> Reported-by: Ingo Molnar <mingo@kernel.org>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  arch/x86/tools/relocs.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
> index 1fa291f..7a85f29 100644
> --- a/arch/x86/tools/relocs.c
> +++ b/arch/x86/tools/relocs.c
> @@ -729,6 +729,7 @@ static void percpu_init(void)
>   *
>   * The GNU linker incorrectly associates:
>   *	__init_begin
> + *	__per_cpu_load
>   *
>   * The "gold" linker incorrectly associates:
>   *	init_per_cpu__irq_stack_union
> @@ -738,6 +739,7 @@ static int is_percpu_sym(ElfW(Sym) *sym, const char *symname)
>  {
>  	return (sym->st_shndx == per_cpu_shndx) &&
>  		strcmp(symname, "__init_begin") &&
> +		strcmp(symname, "__per_cpu_load") &&
>  		strncmp(symname, "init_per_cpu_", 13);
>  }
>  
> 

Why isn't this list using a regex like other symbol classes?

	-hpa


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86, relocs: add percpu fixup for GNU ld 2.23
  2013-10-16  6:51 ` H. Peter Anvin
@ 2013-10-16 14:55   ` Kees Cook
  2013-10-16 15:22     ` H. Peter Anvin
  0 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2013-10-16 14:55 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, LKML, Thomas Gleixner, x86@kernel.org,
	Michael Davidson, Cong Ding

On Tue, Oct 15, 2013 at 11:51 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 10/15/2013 11:43 PM, Kees Cook wrote:
>> The GNU linker tries to put __per_cpu_load into the percpu area, resulting
>> in a lack of its relocation. Force this symbol to be relocated. Seen
>> starting with GNU ld 2.23 and later.
>>
>> Reported-by: Ingo Molnar <mingo@kernel.org>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> ---
>>  arch/x86/tools/relocs.c |    2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
>> index 1fa291f..7a85f29 100644
>> --- a/arch/x86/tools/relocs.c
>> +++ b/arch/x86/tools/relocs.c
>> @@ -729,6 +729,7 @@ static void percpu_init(void)
>>   *
>>   * The GNU linker incorrectly associates:
>>   *   __init_begin
>> + *   __per_cpu_load
>>   *
>>   * The "gold" linker incorrectly associates:
>>   *   init_per_cpu__irq_stack_union
>> @@ -738,6 +739,7 @@ static int is_percpu_sym(ElfW(Sym) *sym, const char *symname)
>>  {
>>       return (sym->st_shndx == per_cpu_shndx) &&
>>               strcmp(symname, "__init_begin") &&
>> +             strcmp(symname, "__per_cpu_load") &&
>>               strncmp(symname, "init_per_cpu_", 13);
>>  }
>>
>>
>
> Why isn't this list using a regex like other symbol classes?

I assume because it was initially a single item and it has grown
slowly. Would you like me to convert it to a regex instead?

-Kees

-- 
Kees Cook
Chrome OS Security

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86, relocs: add percpu fixup for GNU ld 2.23
  2013-10-16 14:55   ` Kees Cook
@ 2013-10-16 15:22     ` H. Peter Anvin
  0 siblings, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2013-10-16 15:22 UTC (permalink / raw)
  To: Kees Cook
  Cc: Ingo Molnar, LKML, Thomas Gleixner, x86@kernel.org,
	Michael Davidson, Cong Ding

On 10/16/2013 07:55 AM, Kees Cook wrote:
>>
>> Why isn't this list using a regex like other symbol classes?
> 
> I assume because it was initially a single item and it has grown
> slowly. Would you like me to convert it to a regex instead?
> 

Yes, please.

	-hpa



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:x86/kaslr] x86/relocs: Add percpu fixup for GNU ld 2.23
  2013-10-16  6:43 [PATCH] x86, relocs: add percpu fixup for GNU ld 2.23 Kees Cook
  2013-10-16  6:51 ` H. Peter Anvin
@ 2013-10-18 13:20 ` tip-bot for Kees Cook
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Kees Cook @ 2013-10-18 13:20 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, dinggnu, keescook, md, tglx

Commit-ID:  aec58bafaf89279522c44ec8ca9211eabb2b6976
Gitweb:     http://git.kernel.org/tip/aec58bafaf89279522c44ec8ca9211eabb2b6976
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Tue, 15 Oct 2013 23:43:14 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 18 Oct 2013 08:45:09 +0200

x86/relocs: Add percpu fixup for GNU ld 2.23

The GNU linker tries to put __per_cpu_load into the percpu area,
resulting in a lack of its relocation. Force this symbol to be
relocated. Seen starting with GNU ld 2.23 and later.

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Michael Davidson <md@google.com>
Cc: Cong Ding <dinggnu@gmail.com>
Link: http://lkml.kernel.org/r/20131016064314.GA2739@www.outflux.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/tools/relocs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index 71a2533..11f9285 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -729,6 +729,7 @@ static void percpu_init(void)
  *
  * The GNU linker incorrectly associates:
  *	__init_begin
+ *	__per_cpu_load
  *
  * The "gold" linker incorrectly associates:
  *	init_per_cpu__irq_stack_union
@@ -738,6 +739,7 @@ static int is_percpu_sym(ElfW(Sym) *sym, const char *symname)
 {
 	return (sym->st_shndx == per_cpu_shndx) &&
 		strcmp(symname, "__init_begin") &&
+		strcmp(symname, "__per_cpu_load") &&
 		strncmp(symname, "init_per_cpu_", 13);
 }
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-18 13:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-16  6:43 [PATCH] x86, relocs: add percpu fixup for GNU ld 2.23 Kees Cook
2013-10-16  6:51 ` H. Peter Anvin
2013-10-16 14:55   ` Kees Cook
2013-10-16 15:22     ` H. Peter Anvin
2013-10-18 13:20 ` [tip:x86/kaslr] x86/relocs: Add " tip-bot for Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox