[v2] ARM: mm: Facilitate debugging CONFIG_KUSER_HELPERS disabled
diff mbox series

Message ID 20181025190110.7564-1-f.fainelli@gmail.com
State Accepted
Commit e2b85f709a705808a71560de60732fd49e4516a5
Headers show
Series
  • [v2] ARM: mm: Facilitate debugging CONFIG_KUSER_HELPERS disabled
Related show

Commit Message

Florian Fainelli Oct. 25, 2018, 7:01 p.m. UTC
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.

Suggested-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 arch/arm/mm/fault.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Andrew Lunn Oct. 25, 2018, 7:26 p.m. UTC | #1
On Thu, Oct 25, 2018 at 12:01:08PM -0700, Florian Fainelli wrote:
> 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.

Hi Florian

Nice. I wish we had this a couple of months ago.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Thanks
    Andrew
Florian Fainelli Oct. 31, 2018, 10:54 p.m. UTC | #2
On 10/25/18 12:26 PM, Andrew Lunn wrote:
> On Thu, Oct 25, 2018 at 12:01:08PM -0700, Florian Fainelli wrote:
>> 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.
> 
> Hi Florian
> 
> Nice. I wish we had this a couple of months ago.
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Thanks Andrew, submitted as 8807/1.

Patch
diff mbox series

diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index f4ea4c62c613..58f69fa07df9 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -173,6 +173,12 @@  __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_ratelimited(KERN_DEBUG
+				   "%s: CONFIG_KUSER_HELPERS disabled at 0x%08lx\n",
+				   tsk->comm, addr);
+#endif
 
 	tsk->thread.address = addr;
 	tsk->thread.error_code = fsr;