Release 4.10 arch/x86/kernel/stacktrace.c
/*
* Stack trace management functions
*
* Copyright (C) 2006-2009 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
*/
#include <linux/sched.h>
#include <linux/stacktrace.h>
#include <linux/export.h>
#include <linux/uaccess.h>
#include <asm/stacktrace.h>
#include <asm/unwind.h>
static int save_stack_address(struct stack_trace *trace, unsigned long addr,
bool nosched)
{
if (nosched && in_sched_functions(addr))
return 0;
if (trace->skip > 0) {
trace->skip--;
return 0;
}
if (trace->nr_entries >= trace->max_entries)
return -1;
trace->entries[trace->nr_entries++] = addr;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
andi kleen | andi kleen | 25 | 32.47% | 1 | 14.29% |
ingo molnar | ingo molnar | 18 | 23.38% | 1 | 14.29% |
alexei starovoitov | alexei starovoitov | 11 | 14.29% | 1 | 14.29% |
oleg nesterov | oleg nesterov | 11 | 14.29% | 1 | 14.29% |
josh poimboeuf | josh poimboeuf | 9 | 11.69% | 1 | 14.29% |
vegard nossum | vegard nossum | 2 | 2.60% | 1 | 14.29% |
arjan van de ven | arjan van de ven | 1 | 1.30% | 1 | 14.29% |
| Total | 77 | 100.00% | 7 | 100.00% |
static void __save_stack_trace(struct stack_trace *trace,
struct task_struct *task, struct pt_regs *regs,
bool nosched)
{
struct unwind_state state;
unsigned long addr;
if (regs)
save_stack_address(trace, regs->ip, nosched);
for (unwind_start(&state, task, regs, NULL); !unwind_done(&state);
unwind_next_frame(&state)) {
addr = unwind_get_return_address(&state);
if (!addr || save_stack_address(trace, addr, nosched))
break;
}
if (trace->nr_entries < trace->max_entries)
trace->entries[trace->nr_entries++] = ULONG_MAX;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
josh poimboeuf | josh poimboeuf | 75 | 61.98% | 1 | 12.50% |
ingo molnar | ingo molnar | 16 | 13.22% | 1 | 12.50% |
catalin marinas | catalin marinas | 10 | 8.26% | 1 | 12.50% |
arjan van de ven | arjan van de ven | 9 | 7.44% | 2 | 25.00% |
oleg nesterov | oleg nesterov | 7 | 5.79% | 1 | 12.50% |
andi kleen | andi kleen | 3 | 2.48% | 1 | 12.50% |
namhyung kim | namhyung kim | 1 | 0.83% | 1 | 12.50% |
| Total | 121 | 100.00% | 8 | 100.00% |
/*
* Save stack-backtrace addresses into a stack_trace buffer.
*/
void save_stack_trace(struct stack_trace *trace)
{
__save_stack_trace(trace, current, NULL, false);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
josh poimboeuf | josh poimboeuf | 21 | 100.00% | 1 | 100.00% |
| Total | 21 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL_GPL(save_stack_trace);
void save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
{
__save_stack_trace(trace, current, regs, false);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
vegard nossum | vegard nossum | 14 | 53.85% | 1 | 25.00% |
josh poimboeuf | josh poimboeuf | 4 | 15.38% | 1 | 25.00% |
soeren sandmann pedersen* | soeren sandmann pedersen* | 4 | 15.38% | 1 | 25.00% |
masami hiramatsu | masami hiramatsu | 4 | 15.38% | 1 | 25.00% |
| Total | 26 | 100.00% | 4 | 100.00% |
void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
{
if (!try_get_task_stack(tsk))
return;
__save_stack_trace(trace, tsk, NULL, true);
put_task_stack(tsk);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
arjan van de ven | arjan van de ven | 22 | 55.00% | 1 | 33.33% |
andy lutomirski | andy lutomirski | 14 | 35.00% | 1 | 33.33% |
josh poimboeuf | josh poimboeuf | 4 | 10.00% | 1 | 33.33% |
| Total | 40 | 100.00% | 3 | 100.00% |
EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
/* Userspace stacktrace - based on kernel/trace/trace_sysprof.c */
struct stack_frame_user {
const void __user *next_fp;
unsigned long ret_addr;
};
static int
copy_stack_frame(const void __user *fp, struct stack_frame_user *frame)
{
int ret;
if (!access_ok(VERIFY_READ, fp, sizeof(*frame)))
return 0;
ret = 1;
pagefault_disable();
if (__copy_from_user_inatomic(frame, fp, sizeof(*frame)))
ret = 0;
pagefault_enable();
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
torok edwin | torok edwin | 70 | 98.59% | 1 | 50.00% |
frederic weisbecker | frederic weisbecker | 1 | 1.41% | 1 | 50.00% |
| Total | 71 | 100.00% | 2 | 100.00% |
static inline void __save_stack_trace_user(struct stack_trace *trace)
{
const struct pt_regs *regs = task_pt_regs(current);
const void __user *fp = (const void __user *)regs->bp;
if (trace->nr_entries < trace->max_entries)
trace->entries[trace->nr_entries++] = regs->ip;
while (trace->nr_entries < trace->max_entries) {
struct stack_frame_user frame;
frame.next_fp = NULL;
frame.ret_addr = 0;
if (!copy_stack_frame(fp, &frame))
break;
if ((unsigned long)fp < regs->sp)
break;
if (frame.ret_addr) {
trace->entries[trace->nr_entries++] =
frame.ret_addr;
}
if (fp == frame.next_fp)
break;
fp = frame.next_fp;
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
torok edwin | torok edwin | 152 | 99.35% | 2 | 66.67% |
frederic weisbecker | frederic weisbecker | 1 | 0.65% | 1 | 33.33% |
| Total | 153 | 100.00% | 3 | 100.00% |
void save_stack_trace_user(struct stack_trace *trace)
{
/*
* Trace user stack if we are not a kernel thread
*/
if (current->mm) {
__save_stack_trace_user(trace);
}
if (trace->nr_entries < trace->max_entries)
trace->entries[trace->nr_entries++] = ULONG_MAX;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
torok edwin | torok edwin | 46 | 100.00% | 2 | 100.00% |
| Total | 46 | 100.00% | 2 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
torok edwin | torok edwin | 286 | 47.59% | 2 | 9.52% |
josh poimboeuf | josh poimboeuf | 117 | 19.47% | 1 | 4.76% |
ingo molnar | ingo molnar | 53 | 8.82% | 3 | 14.29% |
arjan van de ven | arjan van de ven | 32 | 5.32% | 3 | 14.29% |
andi kleen | andi kleen | 31 | 5.16% | 1 | 4.76% |
oleg nesterov | oleg nesterov | 18 | 3.00% | 1 | 4.76% |
vegard nossum | vegard nossum | 16 | 2.66% | 2 | 9.52% |
andy lutomirski | andy lutomirski | 14 | 2.33% | 1 | 4.76% |
alexei starovoitov | alexei starovoitov | 11 | 1.83% | 1 | 4.76% |
catalin marinas | catalin marinas | 10 | 1.66% | 1 | 4.76% |
soeren sandmann pedersen* | soeren sandmann pedersen* | 4 | 0.67% | 1 | 4.76% |
masami hiramatsu | masami hiramatsu | 4 | 0.67% | 1 | 4.76% |
frederic weisbecker | frederic weisbecker | 3 | 0.50% | 1 | 4.76% |
namhyung kim | namhyung kim | 1 | 0.17% | 1 | 4.76% |
paul gortmaker | paul gortmaker | 1 | 0.17% | 1 | 4.76% |
| Total | 601 | 100.00% | 21 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.