Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100631
b: refs/heads/master
c: 9f6b4e3
h: refs/heads/master
i:
  100629: cb21c75
  100627: a1ed7a1
  100623: 47a197d
v: v3
  • Loading branch information
Ingo Molnar authored and Thomas Gleixner committed May 23, 2008
1 parent 7e8a74a commit 8f5937b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ef4ab15ff34fd9c65e92bee70f58e7179da881c5
refs/heads/master: 9f6b4e3f4a24f2590f1c96f117fc45fbea9b0fa4
28 changes: 19 additions & 9 deletions trunk/kernel/trace/trace_sysprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,26 @@ struct stack_frame {

static int copy_stack_frame(const void __user *fp, struct stack_frame *frame)
{
int ret;

if (!access_ok(VERIFY_READ, fp, sizeof(*frame)))
return 0;

if (__copy_from_user_inatomic(frame, frame_pointer, sizeof(*frame)))
return 0;
ret = 1;
pagefault_disable();
if (__copy_from_user_inatomic(frame, fp, sizeof(*frame)))
ret = 0;
pagefault_enable();

return 1;
return ret;
}

static void timer_notify(struct pt_regs *regs, int cpu)
{
const void __user *frame_pointer;
struct trace_array_cpu *data;
struct stack_frame frame;
struct trace_array *tr;
const void __user *fp;
int is_user;
int i;

Expand All @@ -77,21 +82,26 @@ static void timer_notify(struct pt_regs *regs, int cpu)

trace_special(tr, data, 0, current->pid, regs->ip);

frame_pointer = (void __user *)regs->bp;
fp = (void __user *)regs->bp;

for (i = 0; i < sample_max_depth; i++) {
if (!copy_stack_frame(frame_pointer, &frame))
frame.next_fp = 0;
frame.return_address = 0;
if (!copy_stack_frame(fp, &frame))
break;
if ((unsigned long)frame_pointer < regs->sp)
if ((unsigned long)fp < regs->sp)
break;

trace_special(tr, data, 1, frame.return_address,
(unsigned long)frame_pointer);
frame_pointer = frame.next_fp;
(unsigned long)fp);
fp = frame.next_fp;
}

trace_special(tr, data, 2, current->pid, i);

/*
* Special trace entry if we overflow the max depth:
*/
if (i == sample_max_depth)
trace_special(tr, data, -1, -1, -1);
}
Expand Down

0 comments on commit 8f5937b

Please sign in to comment.