cregit-Linux how code gets into the kernel

Release 4.7 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>


static int backtrace_stack(void *data, char *name) { /* Yes, we want all stacks */ return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jan blunckjan blunck18100.00%1100.00%
Total18100.00%1100.00%


static int backtrace_address(void *data, unsigned long addr, int reliable) { unsigned int *depth = data; if ((*depth)--) oprofile_add_trace(addr); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jan blunckjan blunck3382.50%133.33%
alexei starovoitovalexei starovoitov410.00%133.33%
arjan van de venarjan van de ven37.50%133.33%
Total40100.00%3100.00%

static struct stacktrace_ops backtrace_ops = { .stack = backtrace_stack, .address = backtrace_address, .walk_stack = print_context_stack, }; #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

PersonTokensPropCommitsCommitProp
jiri olsajiri olsa8086.02%133.33%
robert richterrobert richter1212.90%133.33%
peter zijlstrapeter zijlstra11.08%133.33%
Total93100.00%3100.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

PersonTokensPropCommitsCommitProp
jiri olsajiri olsa6498.46%150.00%
h. peter anvinh. peter anvin11.54%150.00%
Total65100.00%2100.00%

#else
static inline int x86_backtrace_32(struct pt_regs * const regs, unsigned int depth) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jiri olsajiri olsa20100.00%1100.00%
Total20100.00%1100.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

PersonTokensPropCommitsCommitProp
hugh dickinshugh dickins4454.32%116.67%
greg banksgreg banks1720.99%116.67%
robert richterrobert richter1214.81%116.67%
jiri olsajiri olsa67.41%116.67%
gerald brittongerald britton11.23%116.67%
peter zijlstrapeter zijlstra11.23%116.67%
Total81100.00%6100.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)) { unsigned long stack = kernel_stack_pointer(regs); if (depth) dump_trace(NULL, regs, (unsigned long *)stack, 0, &backtrace_ops, &depth); return; } if (x86_backtrace_32(regs, depth)) return; while (depth-- && head) head = dump_user_backtrace(head); }

Contributors

PersonTokensPropCommitsCommitProp
greg banksgreg banks5353.00%111.11%
jan blunckjan blunck2222.00%222.22%
jiri olsajiri olsa1212.00%222.22%
masami hiramatsumasami hiramatsu99.00%111.11%
namhyung kimnamhyung kim22.00%111.11%
andy lutomirskiandy lutomirski11.00%111.11%
gerald brittongerald britton11.00%111.11%
Total100100.00%9100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
jiri olsajiri olsa19240.94%211.76%
jan blunckjan blunck9219.62%211.76%
greg banksgreg banks8217.48%15.88%
hugh dickinshugh dickins469.81%15.88%
robert richterrobert richter285.97%211.76%
masami hiramatsumasami hiramatsu91.92%15.88%
frederic weisbeckerfrederic weisbecker51.07%15.88%
alexei starovoitovalexei starovoitov40.85%15.88%
arjan van de venarjan van de ven30.64%15.88%
gerald brittongerald britton20.43%15.88%
namhyung kimnamhyung kim20.43%15.88%
peter zijlstrapeter zijlstra20.43%15.88%
h. peter anvinh. peter anvin10.21%15.88%
andy lutomirskiandy lutomirski10.21%15.88%
Total469100.00%17100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}