Release 4.14 arch/x86/oprofile/backtrace.c
/**
* @file backtrace.c
*
* @remark Copyright 2002 OProfile authors
* @remark Read the file COPYING
*
* @author John Levon
* @author David Smith
*/
#include <linux/oprofile.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/compat.h>
#include <linux/uaccess.h>
#include <asm/ptrace.h>
#include <asm/stacktrace.h>
#include <asm/unwind.h>
#ifdef CONFIG_COMPAT
static struct stack_frame_ia32 *
dump_user_backtrace_32(struct stack_frame_ia32 *head)
{
/* Also check accessibility of one struct frame_head beyond: */
struct stack_frame_ia32 bufhead[2];
struct stack_frame_ia32 *fp;
unsigned long bytes;
bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead));
if (bytes != 0)
return NULL;
fp = (struct stack_frame_ia32 *) compat_ptr(bufhead[0].next_frame);
oprofile_add_trace(bufhead[0].return_address);
/* frame pointers should strictly progress back up the stack
* (towards higher addresses) */
if (head >= fp)
return NULL;
return fp;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jiri Olsa | 80 | 86.02% | 1 | 33.33% |
Robert Richter | 12 | 12.90% | 1 | 33.33% |
Peter Zijlstra | 1 | 1.08% | 1 | 33.33% |
Total | 93 | 100.00% | 3 | 100.00% |
static inline int
x86_backtrace_32(struct pt_regs * const regs, unsigned int depth)
{
struct stack_frame_ia32 *head;
/* User process is IA32 */
if (!current || !test_thread_flag(TIF_IA32))
return 0;
head = (struct stack_frame_ia32 *) regs->bp;
while (depth-- && head)
head = dump_user_backtrace_32(head);
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jiri Olsa | 64 | 98.46% | 1 | 50.00% |
H. Peter Anvin | 1 | 1.54% | 1 | 50.00% |
Total | 65 | 100.00% | 2 | 100.00% |
#else
static inline int
x86_backtrace_32(struct pt_regs * const regs, unsigned int depth)
{
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jiri Olsa | 20 | 100.00% | 1 | 100.00% |
Total | 20 | 100.00% | 1 | 100.00% |
#endif /* CONFIG_COMPAT */
static struct stack_frame *dump_user_backtrace(struct stack_frame *head)
{
/* Also check accessibility of one struct frame_head beyond: */
struct stack_frame bufhead[2];
unsigned long bytes;
bytes = copy_from_user_nmi(bufhead, head, sizeof(bufhead));
if (bytes != 0)
return NULL;
oprofile_add_trace(bufhead[0].return_address);
/* frame pointers should strictly progress back up the stack
* (towards higher addresses) */
if (head >= bufhead[0].next_frame)
return NULL;
return bufhead[0].next_frame;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Hugh Dickins | 43 | 53.09% | 1 | 16.67% |
Greg Banks | 18 | 22.22% | 1 | 16.67% |
Robert Richter | 12 | 14.81% | 1 | 16.67% |
Jiri Olsa | 6 | 7.41% | 1 | 16.67% |
Peter Zijlstra | 1 | 1.23% | 1 | 16.67% |
Gerald Britton | 1 | 1.23% | 1 | 16.67% |
Total | 81 | 100.00% | 6 | 100.00% |
void
x86_backtrace(struct pt_regs * const regs, unsigned int depth)
{
struct stack_frame *head = (struct stack_frame *)frame_pointer(regs);
if (!user_mode(regs)) {
struct unwind_state state;
unsigned long addr;
if (!depth)
return;
oprofile_add_trace(regs->ip);
if (!--depth)
return;
for (unwind_start(&state, current, regs, NULL);
!unwind_done(&state); unwind_next_frame(&state)) {
addr = unwind_get_return_address(&state);
if (!addr)
break;
oprofile_add_trace(addr);
if (!--depth)
break;
}
return;
}
if (x86_backtrace_32(regs, depth))
return;
while (depth-- && head)
head = dump_user_backtrace(head);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Josh Poimboeuf | 71 | 47.97% | 3 | 30.00% |
Greg Banks | 53 | 35.81% | 1 | 10.00% |
Jiri Olsa | 12 | 8.11% | 2 | 20.00% |
Jan Blunck | 10 | 6.76% | 2 | 20.00% |
Andrew Lutomirski | 1 | 0.68% | 1 | 10.00% |
Gerald Britton | 1 | 0.68% | 1 | 10.00% |
Total | 148 | 100.00% | 10 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jiri Olsa | 192 | 43.64% | 2 | 13.33% |
Greg Banks | 83 | 18.86% | 1 | 6.67% |
Josh Poimboeuf | 74 | 16.82% | 3 | 20.00% |
Hugh Dickins | 45 | 10.23% | 1 | 6.67% |
Robert Richter | 28 | 6.36% | 2 | 13.33% |
Jan Blunck | 12 | 2.73% | 2 | 13.33% |
Peter Zijlstra | 2 | 0.45% | 1 | 6.67% |
Gerald Britton | 2 | 0.45% | 1 | 6.67% |
Andrew Lutomirski | 1 | 0.23% | 1 | 6.67% |
H. Peter Anvin | 1 | 0.23% | 1 | 6.67% |
Total | 440 | 100.00% | 15 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.