diff options
Diffstat (limited to 'arch/x86/kernel/traps_32.c')
-rw-r--r-- | arch/x86/kernel/traps_32.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c index 8ef8a9ddfec6..959d40edecd5 100644 --- a/arch/x86/kernel/traps_32.c +++ b/arch/x86/kernel/traps_32.c | |||
@@ -118,36 +118,32 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo, | |||
118 | unsigned long *stack, unsigned long bp, | 118 | unsigned long *stack, unsigned long bp, |
119 | const struct stacktrace_ops *ops, void *data) | 119 | const struct stacktrace_ops *ops, void *data) |
120 | { | 120 | { |
121 | #ifdef CONFIG_FRAME_POINTER | ||
122 | struct stack_frame *frame = (struct stack_frame *)bp; | 121 | struct stack_frame *frame = (struct stack_frame *)bp; |
123 | while (valid_stack_ptr(tinfo, frame, sizeof(*frame))) { | ||
124 | struct stack_frame *next; | ||
125 | unsigned long addr; | ||
126 | 122 | ||
127 | addr = frame->return_address; | 123 | /* |
128 | if (__kernel_text_address(addr)) | 124 | * if EBP is "deeper" into the stack than the actual stack pointer, |
129 | ops->address(data, addr, 1); | 125 | * we need to rewind the stack pointer a little to start at the |
130 | /* | 126 | * first stack frame, but only if EBP is in this stack frame. |
131 | * break out of recursive entries (such as | 127 | */ |
132 | * end_of_stack_stop_unwind_function). Also, | 128 | if (stack > (unsigned long *) bp |
133 | * we can never allow a frame pointer to | 129 | && valid_stack_ptr(tinfo, frame, sizeof(*frame))) |
134 | * move downwards! | 130 | stack = (unsigned long *) bp; |
135 | */ | 131 | |
136 | next = frame->next_frame; | ||
137 | bp = (unsigned long) next; | ||
138 | if (next <= frame) | ||
139 | break; | ||
140 | frame = next; | ||
141 | } | ||
142 | #else | ||
143 | while (valid_stack_ptr(tinfo, stack, sizeof(*stack))) { | 132 | while (valid_stack_ptr(tinfo, stack, sizeof(*stack))) { |
144 | unsigned long addr; | 133 | unsigned long addr; |
145 | 134 | ||
146 | addr = *stack++; | 135 | addr = *stack; |
147 | if (__kernel_text_address(addr)) | 136 | if (__kernel_text_address(addr)) { |
148 | ops->address(data, addr, 1); | 137 | if ((unsigned long) stack == bp + 4) { |
138 | ops->address(data, addr, 1); | ||
139 | frame = frame->next_frame; | ||
140 | bp = (unsigned long) frame; | ||
141 | } else { | ||
142 | ops->address(data, addr, 0); | ||
143 | } | ||
144 | } | ||
145 | stack++; | ||
149 | } | 146 | } |
150 | #endif | ||
151 | return bp; | 147 | return bp; |
152 | } | 148 | } |
153 | 149 | ||