lkml.org 
[lkml]   [2015]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: trace: trace_kprobe.c always shows interrupts off
Date
Hi Mathieu, Steven,

From: Steven Rostedt [mailto:rostedt@goodmis.org]
>
>On Tue, 17 Nov 2015 16:35:35 +0000 (UTC)
>Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
>
>> Hi,
>>
>> I notice that trace_kprobe.c does local_save_flags() within
>> __kprobe_trace_func(), which is called (at least on x86) with
>> interrupts always disabled. This is then used as interrupt on/off
>> state within the recorded event, which is misleading.
>
>Kinda. The kprobe itself has interrupts disabled, so it's only a white
>lie.
>
>>
>> I also don't understand why arch/x86/kernel/kprobes/ftrace.c
>> pre handler disables interrupts, considering the following
>> comment above arch/x86/kernel/kprobes/core.c: kprobe_int3_handler()
>>
>> * Interrupts are disabled on entry as trap3 is an interrupt gate and they
>> * remain disabled throughout this function.
>
>I think you answered your own question. The key piece you may be
>missing is that kprobe_ftrace_handler() is not called from a trap, but
>from a function traced callback, which does not disable interrupts.

right, since the user can not forcibly change any kprobes to
jump, those handlers should be ran under the same environment.

>> A struct pt_regs is received by this function, but I don't see
>> any way to get the state of irq enable/disable from struct pt_regs
>> across architectures.
>>
>> Any thoughts on how to fix this ?
>
>Create a cross arch: flags = regs_irq_save(regs) function.
>

Good idea! Anyway, we can start on x86, in other arch we can
prepare a dummy function to return current interrupt state(as
we are doing now).

Thank you,

----
Masami Hiramatsu



\
 
 \ /
  Last update: 2015-11-18 08:21    [W:0.047 / U:6.132 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site