linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG kretprobes] kretprobe triggers General Protection Faults
       [not found] <1164803689.30103.1393357052243.JavaMail.zimbra@efficios.com>
@ 2014-02-25 19:46 ` Mathieu Desnoyers
  2014-02-26  2:48   ` Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Desnoyers @ 2014-02-25 19:46 UTC (permalink / raw)
  To: Masami Hiramatsu, David S. Miller, Anil S Keshavamurthy,
	Ananth N Mavinakayanahalli
  Cc: Steven Rostedt, Linux Kernel Mailing List

Hi,

I had a bug report[1] from a user trying to add a kretprobe on the system
call entry code path:

arch/x86/kernel/entry_64.S:

ffffffff813dffe2 <system_call_fastpath+0x16>:
        cmpl $__NR_syscall_max,%eax
#endif
        ja badsys
        movq %r10,%rcx
        call *sys_call_table(,%rax,8)  # XXX:    rip relative
        movq %rax,RAX-ARGOFFSET(%rsp)   <--- return address pointing here

And all hell breaks loose (various types of faults, machine reboots,
applications exit randomly, etc.). I understand that this code path
is not marked as unsafe against kprobes, and I tested that a kprobes
indeed works fine there. However, kretprobes probably presumes a function
stack layout that is just not valid for the syscall entry routine.

Any thoughts on how kretprobes should handle this ?

Thanks,

Mathieu

[1] http://bugs.lttng.org/issues/687

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

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

* Re: [BUG kretprobes] kretprobe triggers General Protection Faults
  2014-02-25 19:46 ` [BUG kretprobes] kretprobe triggers General Protection Faults Mathieu Desnoyers
@ 2014-02-26  2:48   ` Masami Hiramatsu
  0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2014-02-26  2:48 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: David S. Miller, Anil S Keshavamurthy,
	Ananth N Mavinakayanahalli, Steven Rostedt,
	Linux Kernel Mailing List

Hi Mathieu,

(2014/02/26 4:46), Mathieu Desnoyers wrote:
> Hi,
> 
> I had a bug report[1] from a user trying to add a kretprobe on the system
> call entry code path:
> 
> arch/x86/kernel/entry_64.S:
> 
> ffffffff813dffe2 <system_call_fastpath+0x16>:
>         cmpl $__NR_syscall_max,%eax
> #endif
>         ja badsys
>         movq %r10,%rcx
>         call *sys_call_table(,%rax,8)  # XXX:    rip relative
>         movq %rax,RAX-ARGOFFSET(%rsp)   <--- return address pointing here

Hm, I guess you put kretprobes on the functions on the sys_call_table,
right?

> And all hell breaks loose (various types of faults, machine reboots,
> applications exit randomly, etc.). I understand that this code path
> is not marked as unsafe against kprobes, and I tested that a kprobes
> indeed works fine there. However, kretprobes probably presumes a function
> stack layout that is just not valid for the syscall entry routine.

All the syscall entry functions caused this issue? or some
specific function(s) ?
And could you tell me the kernel version you used?

> Any thoughts on how kretprobes should handle this ?

I'll try to reproduce it in kvm environment.

Thank you!

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



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

end of thread, other threads:[~2014-02-26  2:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1164803689.30103.1393357052243.JavaMail.zimbra@efficios.com>
2014-02-25 19:46 ` [BUG kretprobes] kretprobe triggers General Protection Faults Mathieu Desnoyers
2014-02-26  2:48   ` Masami Hiramatsu

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).