ARM: mm: Facilitate debugging CONFIG_KUSER_HELPERS disabled
PATCH 1/1 ARM: mm: Facilitate debugging CONFIG_KUSER_HELPERS disabled
Some software such as perf makes unconditional use of the special [vectors] page which is only provided when CONFIG_KUSER_HELPERS is enabled in the kernel.
Facilitate the debugging of such situations by printing a debug message to the kernel log showing the task name and the faulting address.
--- arch/arm/mm/fault.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/mm/fault.c +5 -0
@@ -173,6 +173,11 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr, show_regs(regs); }#endif +#ifndef CONFIG_KUSER_HELPERS +if ((sig ==SIGSEGV ) && ((addr &PAGE_MASK ) ==0xffff0000 )) +printk (KERN_DEBUG "%s: CONFIG_KUSER_HELPERS disabled at 0x%08lx\n" , + tsk->comm, addr); +#endif tsk->thread.address = addr; tsk->thread.error_code = fsr;
Signature · 1 line
2.17.1
Quoted 6 lines · Florian Fainelli
Some software such as perf makes unconditional use of the special [vectors] page which is only provided when
CONFIG_KUSER_HELPERSis enabled in the kernel.Facilitate the debugging of such situations by printing a debug message to the kernel log showing the task name and the faulting address.
Can't someone trigger this segv deliberately and spam the kerne log? Doesn't this need something like printk_ratelimit or something to ensure this message only gets printed once?
Eric
Quoted 22 lines
Suggested-by Russell King <[email protected]>Signed-off-by Florian Fainelli <[email protected]>--- arch/arm/mm/fault.c | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/mm/fault.c +5
-0@@ -173,6 +173,11 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr, show_regs(regs); }#endif +#ifndef CONFIG_KUSER_HELPERS +if ((sig ==SIGSEGV ) && ((addr &PAGE_MASK ) ==0xffff0000 )) +printk (KERN_DEBUG "%s: CONFIG_KUSER_HELPERS disabled at 0x%08lx\n" , + tsk->comm, addr); +#endif tsk->thread.address = addr; tsk->thread.error_code = fsr;
Quoted 19 lines · Florian Fainelli
Some software such as perf makes unconditional use of the special [vectors] page which is only provided when
CONFIG_KUSER_HELPERSis enabled in the kernel.Facilitate the debugging of such situations by printing a debug message to the kernel log showing the task name and the faulting address.
Suggested-by Russell King <[email protected]>Signed-off-by Florian Fainelli <[email protected]>--- arch/arm/mm/fault.c | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/mm/fault.c +0
-0
arch/arm/mm/fault.c __do_user_fault(struct task_struct *tsk, unsigned long addr, · line 176
Quoted 4 lines
arch/arm/mm/fault.c +1
-0@@ -173,6 +173,11 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr, show_regs(regs); }#endif +#ifndef CONFIG_KUSER_HELPERS
Just have one doubt, if the condition is "#ifdef CONFIG_KUSER_HELPER" as commit message suggests the scenario is valid when CONFIG_KUSER_HELPER is enabled ? No ?
Quoted 10 lines
arch/arm/mm/fault.c +4
-1+if ((sig ==SIGSEGV ) && ((addr &PAGE_MASK ) ==0xffff0000 )) +printk (KERN_DEBUG "%s: CONFIG_KUSER_HELPERS disabled at 0x%08lx\n" , + tsk->comm, addr); +#endif tsk->thread.address = addr; tsk->thread.error_code = fsr; --2.17.1
Quoted 15 lines · Souptick Joarder
Quoted 14 lines · Florian Fainelli
Some software such as perf makes unconditional use of the special [vectors] page which is only provided when
CONFIG_KUSER_HELPERSis enabled in the kernel.Facilitate the debugging of such situations by printing a debug message to the kernel log showing the task name and the faulting address.
Suggested-by Russell King <[email protected]>Signed-off-by Florian Fainelli <[email protected]>--- arch/arm/mm/fault.c | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 13 lines
arch/arm/mm/fault.c __do_user_fault(struct task_struct *tsk, unsigned long addr, · line 176
Quoted 9 lines
arch/arm/mm/fault.c +1
-0@@ -173,6 +173,11 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr, show_regs(regs); }#endif +#ifndef CONFIG_KUSER_HELPERS Just have one doubt, if the condition is "#ifdef
CONFIG_KUSER_HELPER" as commit message suggests the scenario is valid whenCONFIG_KUSER_HELPERis enabled ? No ?
#ifndef CONFIG_KUSER_HELPERS is what is intended here, when that option is not enabled, there is no [vectors] page provided in a program's virtual address space, so accesses to that virtual address will cause a fault which we are catching here.
When CONFIG_KUSER_HELPERS is enabled, every program gets a valid vectors page in its virtual address space, and accessing that address would not cause a fault, since the page is there.
Does this clarify the intent of this commit?
Quoted 11 lines
Quoted 11 lines
arch/arm/mm/fault.c +4
-1+if ((sig ==SIGSEGV ) && ((addr &PAGE_MASK ) ==0xffff0000 )) +printk (KERN_DEBUG "%s: CONFIG_KUSER_HELPERS disabled at 0x%08lx\n" , + tsk->comm, addr); +#endif tsk->thread.address = addr; tsk->thread.error_code = fsr; --2.17.1
Signature · 1 line
Florian
Quoted 6 lines · Eric W. Biederman
Quoted 4 lines · Florian Fainelli
Some software such as perf makes unconditional use of the special [vectors] page which is only provided when
CONFIG_KUSER_HELPERSis enabled in the kernel.
Quoted 6 lines
Quoted 2 lines
Facilitate the debugging of such situations by printing a debug message to the kernel log showing the task name and the faulting address.
Can't someone trigger this segv deliberately and spam the kerne log? Doesn't this need something like
printk_ratelimitor something to ensure this message only gets printed once?
Yes, good point, thanks.
Signature · 1 line
Florian
Quoted 36 lines · Florian Fainelli
Quoted 15 lines · Souptick Joarder
Quoted 14 lines · Florian Fainelli
Some software such as perf makes unconditional use of the special [vectors] page which is only provided when
CONFIG_KUSER_HELPERSis enabled in the kernel.Facilitate the debugging of such situations by printing a debug message to the kernel log showing the task name and the faulting address.
Suggested-by Russell King <[email protected]>Signed-off-by Florian Fainelli <[email protected]>--- arch/arm/mm/fault.c | 5 +++++ 1 file changed, 5 insertions(+)Quoted 13 lines
arch/arm/mm/fault.c __do_user_fault(struct task_struct *tsk, unsigned long addr, · line 176
Quoted 9 lines
arch/arm/mm/fault.c +1
-0@@ -173,6 +173,11 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr, show_regs(regs); }#endif +#ifndef CONFIG_KUSER_HELPERS Just have one doubt, if the condition is "#ifdef
CONFIG_KUSER_HELPER" as commit message suggests the scenario is valid whenCONFIG_KUSER_HELPERis enabled ? No ?#ifndef
CONFIG_KUSER_HELPERSis what is intended here, when that option is not enabled, there is no [vectors] page provided in a program's virtual address space, so accesses to that virtual address will cause a fault which we are catching here.
Quoted 5 lines
When
CONFIG_KUSER_HELPERSis enabled, every program gets a valid vectors page in its virtual address space, and accessing that address would not cause a fault, since the page is there.Does this clarify the intent of this commit?
Yes, It's clear. It might be good to add little more description on commit message here.
But it's your choice on taking this input :-)
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/mm/fault.c +4
-0+if ((sig ==SIGSEGV ) && ((addr &PAGE_MASK ) ==0xffff0000 )) +printk (KERN_DEBUG "%s: CONFIG_KUSER_HELPERS disabled at 0x%08lx\n" , + tsk->comm, addr); +#endif Quoted 5 lines
Quoted 5 lines
arch/arm/mm/fault.c +0
-1tsk->thread.address = addr; tsk->thread.error_code = fsr; --2.17.1
--
Florian
Russell King - ARM Linux
maintainerQuoted 15 lines · Souptick Joarder
Quoted 14 lines · Florian Fainelli
Some software such as perf makes unconditional use of the special [vectors] page which is only provided when
CONFIG_KUSER_HELPERSis enabled in the kernel.Facilitate the debugging of such situations by printing a debug message to the kernel log showing the task name and the faulting address.
Suggested-by Russell King <[email protected]>Signed-off-by Florian Fainelli <[email protected]>--- arch/arm/mm/fault.c | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 18 lines
arch/arm/mm/fault.c __do_user_fault(struct task_struct *tsk, unsigned long addr, · line 176
Quoted 9 lines
arch/arm/mm/fault.c +1
-0@@ -173,6 +173,11 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr, show_regs(regs); }#endif +#ifndef CONFIG_KUSER_HELPERS Just have one doubt, if the condition is "#ifdef
CONFIG_KUSER_HELPER" as commit message suggests the scenario is valid whenCONFIG_KUSER_HELPERis enabled ? No ?Quoted 4 lines
arch/arm/mm/fault.c +4
-0+if ((sig ==SIGSEGV ) && ((addr &PAGE_MASK ) ==0xffff0000 )) +printk (KERN_DEBUG "%s: CONFIG_KUSER_HELPERS disabled at 0x%08lx\n" , + tsk->comm, addr); +#endif
The idea is to print a message when we get a SEGV _and_ the faulting address is in the vectors page _and_ CONFIG_KUSER_HELPERS is _not_ set (which makes the page inaccessible.) The message points users to enable it and/or why the application has failed.
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up