aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/oprofile/backtrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/oprofile/backtrace.c')
-rw-r--r--arch/x86/oprofile/backtrace.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index 3855096c59b8..d640a86198b1 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
@@ -48,35 +48,30 @@ static struct stacktrace_ops backtrace_ops = {
48 .walk_stack = print_context_stack, 48 .walk_stack = print_context_stack,
49}; 49};
50 50
51struct frame_head { 51static struct stack_frame *dump_user_backtrace(struct stack_frame *head)
52 struct frame_head *bp;
53 unsigned long ret;
54} __attribute__((packed));
55
56static struct frame_head *dump_user_backtrace(struct frame_head *head)
57{ 52{
58 struct frame_head bufhead[2]; 53 struct stack_frame bufhead[2];
59 54
60 /* Also check accessibility of one struct frame_head beyond */ 55 /* Also check accessibility of one struct stack_frame beyond */
61 if (!access_ok(VERIFY_READ, head, sizeof(bufhead))) 56 if (!access_ok(VERIFY_READ, head, sizeof(bufhead)))
62 return NULL; 57 return NULL;
63 if (__copy_from_user_inatomic(bufhead, head, sizeof(bufhead))) 58 if (__copy_from_user_inatomic(bufhead, head, sizeof(bufhead)))
64 return NULL; 59 return NULL;
65 60
66 oprofile_add_trace(bufhead[0].ret); 61 oprofile_add_trace(bufhead[0].return_address);
67 62
68 /* frame pointers should strictly progress back up the stack 63 /* frame pointers should strictly progress back up the stack
69 * (towards higher addresses) */ 64 * (towards higher addresses) */
70 if (head >= bufhead[0].bp) 65 if (head >= bufhead[0].next_frame)
71 return NULL; 66 return NULL;
72 67
73 return bufhead[0].bp; 68 return bufhead[0].next_frame;
74} 69}
75 70
76void 71void
77x86_backtrace(struct pt_regs * const regs, unsigned int depth) 72x86_backtrace(struct pt_regs * const regs, unsigned int depth)
78{ 73{
79 struct frame_head *head = (struct frame_head *)frame_pointer(regs); 74 struct stack_frame *head = (struct stack_frame *)frame_pointer(regs);
80 75
81 if (!user_mode_vm(regs)) { 76 if (!user_mode_vm(regs)) {
82 unsigned long stack = kernel_stack_pointer(regs); 77 unsigned long stack = kernel_stack_pointer(regs);