kretprobe triggers General Protection Faults
A message that is not in the archive (sent off-list or not yet received): [email protected]
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
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com
Hi Mathieu,
Quoted 7 lines · Mathieu Desnoyers
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:
Quoted 7 lines
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?
Quoted 5 lines
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?
Quoted 1 line
Any thoughts on how kretprobes should handle this ?
I'll try to reproduce it in kvm environment.
Thank you!
Signature · 4 lines
Masami HIRAMATSU IT Management Research Dept. Linux Technology Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: [email protected]