linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kprobes broken in linux-next (was Re: [tip:perf/kprobes] kprobes: Introduce NOKPROBE_SYMBOL()  macro to maintain kprobes blacklist)
       [not found] ` <tip-376e242429bf8539ef39a080ac113c8799840b13@git.kernel.org>
@ 2014-05-01  5:26   ` Vineet Gupta
  2014-05-02  1:13     ` Masami Hiramatsu
  0 siblings, 1 reply; 3+ messages in thread
From: Vineet Gupta @ 2014-05-01  5:26 UTC (permalink / raw)
  To: mingo, torvalds, rusty, rdunlap, jeremy, arnd, dl9pf, akpm,
	sparse, tglx, hpa, linux-kernel, anil.s.keshavamurthy, davem,
	ananth, masami.hiramatsu.pt, chrisw, akataria,
	linux-arch@vger.kernel.org, anton Kolesov, linux-next

On Thursday 24 April 2014 04:28 PM, tip-bot for Masami Hiramatsu wrote:
> Commit-ID:  376e242429bf8539ef39a080ac113c8799840b13
> Gitweb:     http://git.kernel.org/tip/376e242429bf8539ef39a080ac113c8799840b13
> Author:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> AuthorDate: Thu, 17 Apr 2014 17:17:05 +0900
> Committer:  Ingo Molnar <mingo@kernel.org>
> CommitDate: Thu, 24 Apr 2014 10:02:56 +0200
> 
> kprobes: Introduce NOKPROBE_SYMBOL() macro to maintain kprobes blacklist
> 
> Introduce NOKPROBE_SYMBOL() macro which builds a kprobes
> blacklist at kernel build time.
> 
....

> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 146e4ff..40ceb3c 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -109,6 +109,14 @@
>  #define BRANCH_PROFILE()
>  #endif
>  
> +#ifdef CONFIG_KPROBES
> +#define KPROBE_BLACKLIST()	VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
> +				*(_kprobe_blacklist)			      \
> +				VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
> +#else
> +#define KPROBE_BLACKLIST()
> +#endif
> +
>  #ifdef CONFIG_EVENT_TRACING
>  #define FTRACE_EVENTS()	. = ALIGN(8);					\
>  			VMLINUX_SYMBOL(__start_ftrace_events) = .;	\
> @@ -507,6 +515,7 @@
>  	*(.init.rodata)							\
>  	FTRACE_EVENTS()							\
>  	TRACE_SYSCALLS()						\
> +	KPROBE_BLACKLIST()						\
>  	MEM_DISCARD(init.rodata)					\
>  	CLK_OF_TABLES()							\
>  	RESERVEDMEM_OF_TABLES()						\

Linux-next fails to boot on ARC due to misaligned __start_kprobe_blacklist. Patch
below fixes it.

------------------------>
>From c5afc4ebf9c1c094a260e2aaff6c5b3106063039 Mon Sep 17 00:00:00 2001
From: Vineet Gupta <vgupta@synopsys.com>
Date: Thu, 1 May 2014 10:47:29 +0530
Subject: [PATCH] kprobes: Ensure blacklist data is aligned

ARC Linux (not supporting native unaligned access) was failing to boot
because __start_kprobe_blacklist was not aligned.

This was because per generated vmlinux.lds it was emitted right next
to .rodata with strings etc hence could be randomly unaligned.

Fix that by ensuring a word alignment. While 4 would suffice for 32bit
arches and problem at hand, it is probably better to put 8.

| Path: (null) CPU: 0 PID: 1 Comm: swapper Not tainted
| 3.15.0-rc3-next-20140430 #2
| task: 8f044000 ti: 8f01e000 task.ti: 8f01e000
|
| [ECR   ]: 0x00230400 => Misaligned r/w from 0x800fb0d3
| [EFA   ]: 0x800fb0d3
| [BLINK ]: do_one_initcall+0x86/0x1bc
| [ERET  ]: init_kprobes+0x52/0x120

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
 include/asm-generic/vmlinux.lds.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 40ceb3ceba79..8e0204a68c74 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -110,7 +110,8 @@
 #endif

 #ifdef CONFIG_KPROBES
-#define KPROBE_BLACKLIST()	VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
+#define KPROBE_BLACKLIST()	. = ALIGN(8);				      \
+				VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
 				*(_kprobe_blacklist)			      \
 				VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
 #else
-- 
1.8.3.2

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

* Re: kprobes broken in linux-next (was Re: [tip:perf/kprobes] kprobes: Introduce NOKPROBE_SYMBOL()  macro to maintain kprobes blacklist)
  2014-05-01  5:26   ` kprobes broken in linux-next (was Re: [tip:perf/kprobes] kprobes: Introduce NOKPROBE_SYMBOL() macro to maintain kprobes blacklist) Vineet Gupta
@ 2014-05-02  1:13     ` Masami Hiramatsu
  2014-05-07  4:56       ` Vineet Gupta
  0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu @ 2014-05-02  1:13 UTC (permalink / raw)
  To: Vineet Gupta
  Cc: mingo, torvalds, rusty, rdunlap, jeremy, arnd, dl9pf, akpm,
	sparse, tglx, hpa, linux-kernel, anil.s.keshavamurthy, davem,
	ananth, chrisw, akataria, linux-arch@vger.kernel.org,
	anton Kolesov, linux-next

(2014/05/01 14:26), Vineet Gupta wrote:
> On Thursday 24 April 2014 04:28 PM, tip-bot for Masami Hiramatsu wrote:
>> Commit-ID:  376e242429bf8539ef39a080ac113c8799840b13
>> Gitweb:     http://git.kernel.org/tip/376e242429bf8539ef39a080ac113c8799840b13
>> Author:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>> AuthorDate: Thu, 17 Apr 2014 17:17:05 +0900
>> Committer:  Ingo Molnar <mingo@kernel.org>
>> CommitDate: Thu, 24 Apr 2014 10:02:56 +0200
>>
>> kprobes: Introduce NOKPROBE_SYMBOL() macro to maintain kprobes blacklist
>>
>> Introduce NOKPROBE_SYMBOL() macro which builds a kprobes
>> blacklist at kernel build time.
>>
> ....
> 
>> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
>> index 146e4ff..40ceb3c 100644
>> --- a/include/asm-generic/vmlinux.lds.h
>> +++ b/include/asm-generic/vmlinux.lds.h
>> @@ -109,6 +109,14 @@
>>  #define BRANCH_PROFILE()
>>  #endif
>>  
>> +#ifdef CONFIG_KPROBES
>> +#define KPROBE_BLACKLIST()	VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
>> +				*(_kprobe_blacklist)			      \
>> +				VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
>> +#else
>> +#define KPROBE_BLACKLIST()
>> +#endif
>> +
>>  #ifdef CONFIG_EVENT_TRACING
>>  #define FTRACE_EVENTS()	. = ALIGN(8);					\
>>  			VMLINUX_SYMBOL(__start_ftrace_events) = .;	\
>> @@ -507,6 +515,7 @@
>>  	*(.init.rodata)							\
>>  	FTRACE_EVENTS()							\
>>  	TRACE_SYSCALLS()						\
>> +	KPROBE_BLACKLIST()						\
>>  	MEM_DISCARD(init.rodata)					\
>>  	CLK_OF_TABLES()							\
>>  	RESERVEDMEM_OF_TABLES()						\
> 
> Linux-next fails to boot on ARC due to misaligned __start_kprobe_blacklist. Patch
> below fixes it.
> 
> ------------------------>
>>From c5afc4ebf9c1c094a260e2aaff6c5b3106063039 Mon Sep 17 00:00:00 2001
> From: Vineet Gupta <vgupta@synopsys.com>
> Date: Thu, 1 May 2014 10:47:29 +0530
> Subject: [PATCH] kprobes: Ensure blacklist data is aligned
> 
> ARC Linux (not supporting native unaligned access) was failing to boot
> because __start_kprobe_blacklist was not aligned.
> 
> This was because per generated vmlinux.lds it was emitted right next
> to .rodata with strings etc hence could be randomly unaligned.
> 
> Fix that by ensuring a word alignment. While 4 would suffice for 32bit
> arches and problem at hand, it is probably better to put 8.
> 
> | Path: (null) CPU: 0 PID: 1 Comm: swapper Not tainted
> | 3.15.0-rc3-next-20140430 #2
> | task: 8f044000 ti: 8f01e000 task.ti: 8f01e000
> |
> | [ECR   ]: 0x00230400 => Misaligned r/w from 0x800fb0d3
> | [EFA   ]: 0x800fb0d3
> | [BLINK ]: do_one_initcall+0x86/0x1bc
> | [ERET  ]: init_kprobes+0x52/0x120
> 
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>

Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Thanks!

> ---
>  include/asm-generic/vmlinux.lds.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 40ceb3ceba79..8e0204a68c74 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -110,7 +110,8 @@
>  #endif
> 
>  #ifdef CONFIG_KPROBES
> -#define KPROBE_BLACKLIST()	VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
> +#define KPROBE_BLACKLIST()	. = ALIGN(8);				      \
> +				VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
>  				*(_kprobe_blacklist)			      \
>  				VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
>  #else
> 


-- 
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com

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

* Re: kprobes broken in linux-next (was Re: [tip:perf/kprobes] kprobes: Introduce NOKPROBE_SYMBOL()  macro to maintain kprobes blacklist)
  2014-05-02  1:13     ` Masami Hiramatsu
@ 2014-05-07  4:56       ` Vineet Gupta
  0 siblings, 0 replies; 3+ messages in thread
From: Vineet Gupta @ 2014-05-07  4:56 UTC (permalink / raw)
  To: Masami Hiramatsu, mingo, akpm
  Cc: linux-kernel, linux-arch@vger.kernel.org, anton Kolesov,
	linux-next


On Friday 02 May 2014 06:43 AM, Masami Hiramatsu wrote:
> (2014/05/01 14:26), Vineet Gupta wrote:
>> On Thursday 24 April 2014 04:28 PM, tip-bot for Masami Hiramatsu wrote:
>>> Commit-ID:  376e242429bf8539ef39a080ac113c8799840b13
>>> Gitweb:     http://git.kernel.org/tip/376e242429bf8539ef39a080ac113c8799840b13
>>> Author:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>>> AuthorDate: Thu, 17 Apr 2014 17:17:05 +0900
>>> Committer:  Ingo Molnar <mingo@kernel.org>
>>> CommitDate: Thu, 24 Apr 2014 10:02:56 +0200
>>>
>>> kprobes: Introduce NOKPROBE_SYMBOL() macro to maintain kprobes blacklist
>>>
>>> Introduce NOKPROBE_SYMBOL() macro which builds a kprobes
>>> blacklist at kernel build time.
>>>
>> ....
>>
>>> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
>>> index 146e4ff..40ceb3c 100644
>>> --- a/include/asm-generic/vmlinux.lds.h
>>> +++ b/include/asm-generic/vmlinux.lds.h
>>> @@ -109,6 +109,14 @@
>>>  #define BRANCH_PROFILE()
>>>  #endif
>>>  
>>> +#ifdef CONFIG_KPROBES
>>> +#define KPROBE_BLACKLIST()	VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
>>> +				*(_kprobe_blacklist)			      \
>>> +				VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
>>> +#else
>>> +#define KPROBE_BLACKLIST()
>>> +#endif
>>> +
>>>  #ifdef CONFIG_EVENT_TRACING
>>>  #define FTRACE_EVENTS()	. = ALIGN(8);					\
>>>  			VMLINUX_SYMBOL(__start_ftrace_events) = .;	\
>>> @@ -507,6 +515,7 @@
>>>  	*(.init.rodata)							\
>>>  	FTRACE_EVENTS()							\
>>>  	TRACE_SYSCALLS()						\
>>> +	KPROBE_BLACKLIST()						\
>>>  	MEM_DISCARD(init.rodata)					\
>>>  	CLK_OF_TABLES()							\
>>>  	RESERVEDMEM_OF_TABLES()						\
>>
>> Linux-next fails to boot on ARC due to misaligned __start_kprobe_blacklist. Patch
>> below fixes it.
>>
>> ------------------------>
>> >From c5afc4ebf9c1c094a260e2aaff6c5b3106063039 Mon Sep 17 00:00:00 2001
>> From: Vineet Gupta <vgupta@synopsys.com>
>> Date: Thu, 1 May 2014 10:47:29 +0530
>> Subject: [PATCH] kprobes: Ensure blacklist data is aligned
>>
>> ARC Linux (not supporting native unaligned access) was failing to boot
>> because __start_kprobe_blacklist was not aligned.
>>
>> This was because per generated vmlinux.lds it was emitted right next
>> to .rodata with strings etc hence could be randomly unaligned.
>>
>> Fix that by ensuring a word alignment. While 4 would suffice for 32bit
>> arches and problem at hand, it is probably better to put 8.
>>
>> | Path: (null) CPU: 0 PID: 1 Comm: swapper Not tainted
>> | 3.15.0-rc3-next-20140430 #2
>> | task: 8f044000 ti: 8f01e000 task.ti: 8f01e000
>> |
>> | [ECR   ]: 0x00230400 => Misaligned r/w from 0x800fb0d3
>> | [EFA   ]: 0x800fb0d3
>> | [BLINK ]: do_one_initcall+0x86/0x1bc
>> | [ERET  ]: init_kprobes+0x52/0x120
>>
>> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> 
> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> 
> Thanks!

Hi Ingo/Andrew,

Can one of you please pick this up - it doesn't show up in linux-next yet.

Thx,
-Vineet

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

end of thread, other threads:[~2014-05-07  4:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20140417081705.26341.96719.stgit@ltc230.yrl.intra.hitachi.co.jp>
     [not found] ` <tip-376e242429bf8539ef39a080ac113c8799840b13@git.kernel.org>
2014-05-01  5:26   ` kprobes broken in linux-next (was Re: [tip:perf/kprobes] kprobes: Introduce NOKPROBE_SYMBOL() macro to maintain kprobes blacklist) Vineet Gupta
2014-05-02  1:13     ` Masami Hiramatsu
2014-05-07  4:56       ` Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).