Skip to content

Commit d1526e2

Browse files
author
Linus Torvalds
committed
Remove stack unwinder for now
It has caused more problems than it ever really solved, and is apparently not getting cleaned up and fixed. We can put it back when it's stable and isn't likely to make warning or bug events worse. In the meantime, enable frame pointers for more readable stack traces. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent d1998ef commit d1526e2

17 files changed

Lines changed: 3 additions & 1870 deletions

File tree

‎Makefile‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,6 @@ else
496496
CFLAGS += -fomit-frame-pointer
497497
endif
498498

499-
ifdef CONFIG_UNWIND_INFO
500-
CFLAGS += -fasynchronous-unwind-tables
501-
LDFLAGS_vmlinux += --eh-frame-hdr
502-
endif
503-
504499
ifdef CONFIG_DEBUG_INFO
505500
CFLAGS += -g
506501
endif

‎arch/i386/defconfig‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,8 +1493,6 @@ CONFIG_DEBUG_BUGVERBOSE=y
14931493
# CONFIG_DEBUG_VM is not set
14941494
# CONFIG_DEBUG_LIST is not set
14951495
# CONFIG_FRAME_POINTER is not set
1496-
CONFIG_UNWIND_INFO=y
1497-
CONFIG_STACK_UNWIND=y
14981496
# CONFIG_FORCED_INLINING is not set
14991497
# CONFIG_HEADERS_CHECK is not set
15001498
# CONFIG_RCU_TORTURE_TEST is not set

‎arch/i386/kernel/entry.S‎

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -979,38 +979,6 @@ ENTRY(spurious_interrupt_bug)
979979
jmp error_code
980980
CFI_ENDPROC
981981

982-
#ifdef CONFIG_STACK_UNWIND
983-
ENTRY(arch_unwind_init_running)
984-
CFI_STARTPROC
985-
movl 4(%esp), %edx
986-
movl (%esp), %ecx
987-
leal 4(%esp), %eax
988-
movl %ebx, PT_EBX(%edx)
989-
xorl %ebx, %ebx
990-
movl %ebx, PT_ECX(%edx)
991-
movl %ebx, PT_EDX(%edx)
992-
movl %esi, PT_ESI(%edx)
993-
movl %edi, PT_EDI(%edx)
994-
movl %ebp, PT_EBP(%edx)
995-
movl %ebx, PT_EAX(%edx)
996-
movl $__USER_DS, PT_DS(%edx)
997-
movl $__USER_DS, PT_ES(%edx)
998-
movl $0, PT_GS(%edx)
999-
movl %ebx, PT_ORIG_EAX(%edx)
1000-
movl %ecx, PT_EIP(%edx)
1001-
movl 12(%esp), %ecx
1002-
movl $__KERNEL_CS, PT_CS(%edx)
1003-
movl %ebx, PT_EFLAGS(%edx)
1004-
movl %eax, PT_OLDESP(%edx)
1005-
movl 8(%esp), %eax
1006-
movl %ecx, 8(%esp)
1007-
movl PT_EBX(%edx), %ebx
1008-
movl $__KERNEL_DS, PT_OLDSS(%edx)
1009-
jmpl *%eax
1010-
CFI_ENDPROC
1011-
ENDPROC(arch_unwind_init_running)
1012-
#endif
1013-
1014982
ENTRY(kernel_thread_helper)
1015983
pushl $0 # fake return address for unwinder
1016984
CFI_STARTPROC

‎arch/i386/kernel/traps.c‎

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@ asmlinkage void spurious_interrupt_bug(void);
9494
asmlinkage void machine_check(void);
9595

9696
int kstack_depth_to_print = 24;
97-
#ifdef CONFIG_STACK_UNWIND
98-
static int call_trace = 1;
99-
#else
100-
#define call_trace (-1)
101-
#endif
10297
ATOMIC_NOTIFIER_HEAD(i386die_chain);
10398

10499
int register_die_notifier(struct notifier_block *nb)
@@ -152,33 +147,6 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo,
152147
return ebp;
153148
}
154149

155-
struct ops_and_data {
156-
struct stacktrace_ops *ops;
157-
void *data;
158-
};
159-
160-
static asmlinkage int
161-
dump_trace_unwind(struct unwind_frame_info *info, void *data)
162-
{
163-
struct ops_and_data *oad = (struct ops_and_data *)data;
164-
int n = 0;
165-
unsigned long sp = UNW_SP(info);
166-
167-
if (arch_unw_user_mode(info))
168-
return -1;
169-
while (unwind(info) == 0 && UNW_PC(info)) {
170-
n++;
171-
oad->ops->address(oad->data, UNW_PC(info));
172-
if (arch_unw_user_mode(info))
173-
break;
174-
if ((sp & ~(PAGE_SIZE - 1)) == (UNW_SP(info) & ~(PAGE_SIZE - 1))
175-
&& sp > UNW_SP(info))
176-
break;
177-
sp = UNW_SP(info);
178-
}
179-
return n;
180-
}
181-
182150
#define MSG(msg) ops->warning(data, msg)
183151

184152
void dump_trace(struct task_struct *task, struct pt_regs *regs,
@@ -190,41 +158,6 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
190158
if (!task)
191159
task = current;
192160

193-
if (call_trace >= 0) {
194-
int unw_ret = 0;
195-
struct unwind_frame_info info;
196-
struct ops_and_data oad = { .ops = ops, .data = data };
197-
198-
if (regs) {
199-
if (unwind_init_frame_info(&info, task, regs) == 0)
200-
unw_ret = dump_trace_unwind(&info, &oad);
201-
} else if (task == current)
202-
unw_ret = unwind_init_running(&info, dump_trace_unwind,
203-
&oad);
204-
else {
205-
if (unwind_init_blocked(&info, task) == 0)
206-
unw_ret = dump_trace_unwind(&info, &oad);
207-
}
208-
if (unw_ret > 0) {
209-
if (call_trace == 1 && !arch_unw_user_mode(&info)) {
210-
ops->warning_symbol(data,
211-
"DWARF2 unwinder stuck at %s",
212-
UNW_PC(&info));
213-
if (UNW_SP(&info) >= PAGE_OFFSET) {
214-
MSG("Leftover inexact backtrace:");
215-
stack = (void *)UNW_SP(&info);
216-
if (!stack)
217-
return;
218-
ebp = UNW_FP(&info);
219-
} else
220-
MSG("Full inexact backtrace again:");
221-
} else if (call_trace >= 1)
222-
return;
223-
else
224-
MSG("Full inexact backtrace again:");
225-
} else
226-
MSG("Inexact backtrace:");
227-
}
228161
if (!stack) {
229162
unsigned long dummy;
230163
stack = &dummy;
@@ -1258,19 +1191,3 @@ static int __init kstack_setup(char *s)
12581191
return 1;
12591192
}
12601193
__setup("kstack=", kstack_setup);
1261-
1262-
#ifdef CONFIG_STACK_UNWIND
1263-
static int __init call_trace_setup(char *s)
1264-
{
1265-
if (strcmp(s, "old") == 0)
1266-
call_trace = -1;
1267-
else if (strcmp(s, "both") == 0)
1268-
call_trace = 0;
1269-
else if (strcmp(s, "newfallback") == 0)
1270-
call_trace = 1;
1271-
else if (strcmp(s, "new") == 2)
1272-
call_trace = 2;
1273-
return 1;
1274-
}
1275-
__setup("call_trace=", call_trace_setup);
1276-
#endif

‎arch/x86_64/Makefile‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ cflags-kernel-$(CONFIG_REORDER) += -ffunction-sections
4545
# actually it makes the kernel smaller too.
4646
cflags-y += -fno-reorder-blocks
4747
cflags-y += -Wno-sign-compare
48-
ifneq ($(CONFIG_UNWIND_INFO),y)
4948
cflags-y += -fno-asynchronous-unwind-tables
50-
endif
5149
ifneq ($(CONFIG_DEBUG_INFO),y)
5250
# -fweb shrinks the kernel a bit, but the difference is very small
5351
# it also messes up debugging, so don't use it for now.

‎arch/x86_64/defconfig‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,8 +1523,6 @@ CONFIG_DEBUG_FS=y
15231523
# CONFIG_DEBUG_VM is not set
15241524
# CONFIG_DEBUG_LIST is not set
15251525
# CONFIG_FRAME_POINTER is not set
1526-
CONFIG_UNWIND_INFO=y
1527-
CONFIG_STACK_UNWIND=y
15281526
# CONFIG_FORCED_INLINING is not set
15291527
# CONFIG_HEADERS_CHECK is not set
15301528
# CONFIG_RCU_TORTURE_TEST is not set

‎arch/x86_64/kernel/entry.S‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,36 +1155,3 @@ ENTRY(call_softirq)
11551155
ret
11561156
CFI_ENDPROC
11571157
ENDPROC(call_softirq)
1158-
1159-
#ifdef CONFIG_STACK_UNWIND
1160-
ENTRY(arch_unwind_init_running)
1161-
CFI_STARTPROC
1162-
movq %r15, R15(%rdi)
1163-
movq %r14, R14(%rdi)
1164-
xchgq %rsi, %rdx
1165-
movq %r13, R13(%rdi)
1166-
movq %r12, R12(%rdi)
1167-
xorl %eax, %eax
1168-
movq %rbp, RBP(%rdi)
1169-
movq %rbx, RBX(%rdi)
1170-
movq (%rsp), %rcx
1171-
movq %rax, R11(%rdi)
1172-
movq %rax, R10(%rdi)
1173-
movq %rax, R9(%rdi)
1174-
movq %rax, R8(%rdi)
1175-
movq %rax, RAX(%rdi)
1176-
movq %rax, RCX(%rdi)
1177-
movq %rax, RDX(%rdi)
1178-
movq %rax, RSI(%rdi)
1179-
movq %rax, RDI(%rdi)
1180-
movq %rax, ORIG_RAX(%rdi)
1181-
movq %rcx, RIP(%rdi)
1182-
leaq 8(%rsp), %rcx
1183-
movq $__KERNEL_CS, CS(%rdi)
1184-
movq %rax, EFLAGS(%rdi)
1185-
movq %rcx, RSP(%rdi)
1186-
movq $__KERNEL_DS, SS(%rdi)
1187-
jmpq *%rdx
1188-
CFI_ENDPROC
1189-
ENDPROC(arch_unwind_init_running)
1190-
#endif

‎arch/x86_64/kernel/traps.c‎

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
110110
}
111111

112112
int kstack_depth_to_print = 12;
113-
#ifdef CONFIG_STACK_UNWIND
114-
static int call_trace = 1;
115-
#else
116-
#define call_trace (-1)
117-
#endif
118113

119114
#ifdef CONFIG_KALLSYMS
120115
void printk_address(unsigned long address)
@@ -217,32 +212,6 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
217212
return NULL;
218213
}
219214

220-
struct ops_and_data {
221-
struct stacktrace_ops *ops;
222-
void *data;
223-
};
224-
225-
static int dump_trace_unwind(struct unwind_frame_info *info, void *context)
226-
{
227-
struct ops_and_data *oad = (struct ops_and_data *)context;
228-
int n = 0;
229-
unsigned long sp = UNW_SP(info);
230-
231-
if (arch_unw_user_mode(info))
232-
return -1;
233-
while (unwind(info) == 0 && UNW_PC(info)) {
234-
n++;
235-
oad->ops->address(oad->data, UNW_PC(info));
236-
if (arch_unw_user_mode(info))
237-
break;
238-
if ((sp & ~(PAGE_SIZE - 1)) == (UNW_SP(info) & ~(PAGE_SIZE - 1))
239-
&& sp > UNW_SP(info))
240-
break;
241-
sp = UNW_SP(info);
242-
}
243-
return n;
244-
}
245-
246215
#define MSG(txt) ops->warning(data, txt)
247216

248217
/*
@@ -270,40 +239,6 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
270239
if (!tsk)
271240
tsk = current;
272241

273-
if (call_trace >= 0) {
274-
int unw_ret = 0;
275-
struct unwind_frame_info info;
276-
struct ops_and_data oad = { .ops = ops, .data = data };
277-
278-
if (regs) {
279-
if (unwind_init_frame_info(&info, tsk, regs) == 0)
280-
unw_ret = dump_trace_unwind(&info, &oad);
281-
} else if (tsk == current)
282-
unw_ret = unwind_init_running(&info, dump_trace_unwind,
283-
&oad);
284-
else {
285-
if (unwind_init_blocked(&info, tsk) == 0)
286-
unw_ret = dump_trace_unwind(&info, &oad);
287-
}
288-
if (unw_ret > 0) {
289-
if (call_trace == 1 && !arch_unw_user_mode(&info)) {
290-
ops->warning_symbol(data,
291-
"DWARF2 unwinder stuck at %s",
292-
UNW_PC(&info));
293-
if ((long)UNW_SP(&info) < 0) {
294-
MSG("Leftover inexact backtrace:");
295-
stack = (unsigned long *)UNW_SP(&info);
296-
if (!stack)
297-
goto out;
298-
} else
299-
MSG("Full inexact backtrace again:");
300-
} else if (call_trace >= 1)
301-
goto out;
302-
else
303-
MSG("Full inexact backtrace again:");
304-
} else
305-
MSG("Inexact backtrace:");
306-
}
307242
if (!stack) {
308243
unsigned long dummy;
309244
stack = &dummy;
@@ -387,7 +322,6 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
387322
tinfo = current_thread_info();
388323
HANDLE_STACK (valid_stack_ptr(tinfo, stack));
389324
#undef HANDLE_STACK
390-
out:
391325
put_cpu();
392326
}
393327
EXPORT_SYMBOL(dump_trace);
@@ -1188,21 +1122,3 @@ static int __init kstack_setup(char *s)
11881122
return 0;
11891123
}
11901124
early_param("kstack", kstack_setup);
1191-
1192-
#ifdef CONFIG_STACK_UNWIND
1193-
static int __init call_trace_setup(char *s)
1194-
{
1195-
if (!s)
1196-
return -EINVAL;
1197-
if (strcmp(s, "old") == 0)
1198-
call_trace = -1;
1199-
else if (strcmp(s, "both") == 0)
1200-
call_trace = 0;
1201-
else if (strcmp(s, "newfallback") == 0)
1202-
call_trace = 1;
1203-
else if (strcmp(s, "new") == 0)
1204-
call_trace = 2;
1205-
return 0;
1206-
}
1207-
early_param("call_trace", call_trace_setup);
1208-
#endif

‎arch/x86_64/kernel/vmlinux.lds.S‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,7 @@ SECTIONS
221221
/* Sections to be discarded */
222222
/DISCARD/ : {
223223
*(.exitcall.exit)
224-
#ifndef CONFIG_UNWIND_INFO
225224
*(.eh_frame)
226-
#endif
227225
}
228226

229227
STABS_DEBUG

‎include/asm-generic/vmlinux.lds.h‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@
119119
*(__ksymtab_strings) \
120120
} \
121121
\
122-
EH_FRAME \
123-
\
124122
/* Built-in module parameters. */ \
125123
__param : AT(ADDR(__param) - LOAD_OFFSET) { \
126124
VMLINUX_SYMBOL(__start___param) = .; \
@@ -160,26 +158,6 @@
160158
*(.kprobes.text) \
161159
VMLINUX_SYMBOL(__kprobes_text_end) = .;
162160

163-
#ifdef CONFIG_STACK_UNWIND
164-
#define EH_FRAME \
165-
/* Unwind data binary search table */ \
166-
. = ALIGN(8); \
167-
.eh_frame_hdr : AT(ADDR(.eh_frame_hdr) - LOAD_OFFSET) { \
168-
VMLINUX_SYMBOL(__start_unwind_hdr) = .; \
169-
*(.eh_frame_hdr) \
170-
VMLINUX_SYMBOL(__end_unwind_hdr) = .; \
171-
} \
172-
/* Unwind data */ \
173-
. = ALIGN(8); \
174-
.eh_frame : AT(ADDR(.eh_frame) - LOAD_OFFSET) { \
175-
VMLINUX_SYMBOL(__start_unwind) = .; \
176-
*(.eh_frame) \
177-
VMLINUX_SYMBOL(__end_unwind) = .; \
178-
}
179-
#else
180-
#define EH_FRAME
181-
#endif
182-
183161
/* DWARF debug sections.
184162
Symbols in the DWARF debugging sections are relative to
185163
the beginning of the section so we begin them at 0. */

0 commit comments

Comments
 (0)