Skip to content

Commit d1a1dc0

Browse files
Dave Hansentorvalds
authored andcommitted
consolidate per-arch stack overflow debugging options
Original posting: http://lkml.kernel.org/r/[email protected] Several architectures have similar stack debugging config options. They all pretty much do the same thing, some with slightly differing help text. This patch changes the architectures to instead enable a Kconfig boolean, and then use that boolean in the generic Kconfig.debug to present the actual menu option. This removes a bunch of duplication and adds consistency across arches. Signed-off-by: Dave Hansen <[email protected]> Reviewed-by: H. Peter Anvin <[email protected]> Reviewed-by: James Hogan <[email protected]> Acked-by: Chris Metcalf <[email protected]> [for tile] Signed-off-by: Dave Hansen <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 8bb495e commit d1a1dc0

File tree

24 files changed

+33
-90
lines changed

24 files changed

+33
-90
lines changed

arch/arc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ config ARC
3434
select OF
3535
select OF_EARLY_FLATTREE
3636
select PERF_USE_VMALLOC
37+
select HAVE_DEBUG_STACKOVERFLOW
3738

3839
config SCHED_OMIT_FRAME_POINTER
3940
def_bool y

arch/arc/Kconfig.debug

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ config EARLY_PRINTK
1515
with klogd/syslogd or the X server. You should normally N here,
1616
unless you want to debug such a crash.
1717

18-
config DEBUG_STACKOVERFLOW
19-
bool "Check for stack overflows"
20-
depends on DEBUG_KERNEL
21-
help
22-
This option will cause messages to be printed if free stack space
23-
drops below a certain limit.
24-
2518
config 16KSTACKS
2619
bool "Use 16Kb for kernel stacks instead of 8Kb"
2720
help

arch/blackfin/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ config BLACKFIN
4141
select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS
4242
select HAVE_MOD_ARCH_SPECIFIC
4343
select MODULES_USE_ELF_RELA
44+
select HAVE_DEBUG_STACKOVERFLOW
4445

4546
config GENERIC_CSUM
4647
def_bool y

arch/blackfin/Kconfig.debug

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ menu "Kernel hacking"
22

33
source "lib/Kconfig.debug"
44

5-
config DEBUG_STACKOVERFLOW
6-
bool "Check for stack overflows"
7-
depends on DEBUG_KERNEL
8-
help
9-
This option will cause messages to be printed if free stack space
10-
drops below a certain limit.
11-
125
config DEBUG_VERBOSE
136
bool "Verbose fault messages"
147
default y

arch/frv/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ config FRV
1414
select ARCH_WANT_IPC_PARSE_VERSION
1515
select OLD_SIGSUSPEND3
1616
select OLD_SIGACTION
17+
select HAVE_DEBUG_STACKOVERFLOW
1718

1819
config ZONE_DMA
1920
bool

arch/frv/Kconfig.debug

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ menu "Kernel hacking"
22

33
source "lib/Kconfig.debug"
44

5-
config DEBUG_STACKOVERFLOW
6-
bool "Check for stack overflows"
7-
depends on DEBUG_KERNEL
8-
95
config GDBSTUB
106
bool "Remote GDB kernel debugging"
117
depends on DEBUG_KERNEL

arch/m32r/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ config M32R
1616
select GENERIC_ATOMIC64
1717
select ARCH_USES_GETTIMEOFFSET
1818
select MODULES_USE_ELF_RELA
19+
select HAVE_DEBUG_STACKOVERFLOW
1920

2021
config SBUS
2122
bool

arch/m32r/Kconfig.debug

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ menu "Kernel hacking"
22

33
source "lib/Kconfig.debug"
44

5-
config DEBUG_STACKOVERFLOW
6-
bool "Check for stack overflows"
7-
depends on DEBUG_KERNEL
8-
help
9-
This option will cause messages to be printed if free stack space
10-
drops below a certain limit.
11-
125
config DEBUG_PAGEALLOC
136
bool "Debug page memory allocations"
147
depends on DEBUG_KERNEL && BROKEN

arch/metag/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ config METAG
3030
select OF
3131
select OF_EARLY_FLATTREE
3232
select SPARSE_IRQ
33+
select HAVE_DEBUG_STACKOVERFLOW
3334

3435
config STACKTRACE_SUPPORT
3536
def_bool y

arch/metag/Kconfig.debug

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ config TRACE_IRQFLAGS_SUPPORT
66

77
source "lib/Kconfig.debug"
88

9-
config DEBUG_STACKOVERFLOW
10-
bool "Check for stack overflows"
11-
depends on DEBUG_KERNEL
12-
help
13-
This option will cause messages to be printed if free stack space
14-
drops below a certain limit.
15-
169
config 4KSTACKS
1710
bool "Use 4Kb for kernel stacks instead of 8Kb"
1811
depends on DEBUG_KERNEL

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ config MIPS
4242
select MODULES_USE_ELF_REL if MODULES
4343
select MODULES_USE_ELF_RELA if MODULES && 64BIT
4444
select CLONE_BACKWARDS
45+
select HAVE_DEBUG_STACKOVERFLOW
4546

4647
menu "Machine selection"
4748

arch/mips/Kconfig.debug

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ config CMDLINE_OVERRIDE
6767

6868
Normally, you will choose 'N' here.
6969

70-
config DEBUG_STACKOVERFLOW
71-
bool "Check for stack overflows"
72-
depends on DEBUG_KERNEL
73-
help
74-
This option will cause messages to be printed if free stack space
75-
drops below a certain limit(2GB on MIPS). The debugging option
76-
provides another way to check stack overflow happened on kernel mode
77-
stack usually caused by nested interruption.
78-
7970
config SMTC_IDLE_HOOK_DEBUG
8071
bool "Enable additional debug checks before going into CPU idle loop"
8172
depends on DEBUG_KERNEL && MIPS_MT_SMTC

arch/mn10300/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ config MN10300
1313
select MODULES_USE_ELF_RELA
1414
select OLD_SIGSUSPEND3
1515
select OLD_SIGACTION
16+
select HAVE_DEBUG_STACKOVERFLOW
1617

1718
config AM33_2
1819
def_bool n

arch/mn10300/Kconfig.debug

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ menu "Kernel hacking"
22

33
source "lib/Kconfig.debug"
44

5-
config DEBUG_STACKOVERFLOW
6-
bool "Check for stack overflows"
7-
depends on DEBUG_KERNEL
8-
95
config DEBUG_DECOMPRESS_KERNEL
106
bool "Using serial port during decompressing kernel"
117
depends on DEBUG_KERNEL

arch/openrisc/Kconfig

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ config OPENRISC
2222
select GENERIC_STRNCPY_FROM_USER
2323
select GENERIC_STRNLEN_USER
2424
select MODULES_USE_ELF_RELA
25+
select HAVE_DEBUG_STACKOVERFLOW
2526

2627
config MMU
2728
def_bool y
@@ -128,16 +129,6 @@ config CMDLINE
128129

129130
menu "Debugging options"
130131

131-
config DEBUG_STACKOVERFLOW
132-
bool "Check for kernel stack overflow"
133-
default y
134-
help
135-
Make extra checks for space available on stack in some
136-
critical functions. This will cause kernel to run a bit slower,
137-
but will catch most of kernel stack overruns and exit gracefully.
138-
139-
Say Y if you are unsure.
140-
141132
config JUMP_UPON_UNHANDLED_EXCEPTION
142133
bool "Try to die gracefully"
143134
default y

arch/parisc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ config PARISC
2727
select MODULES_USE_ELF_RELA
2828
select CLONE_BACKWARDS
2929
select TTY # Needed for pdc_cons.c
30+
select HAVE_DEBUG_STACKOVERFLOW
3031

3132
help
3233
The PA-RISC microprocessor is designed by Hewlett-Packard and used

arch/parisc/Kconfig.debug

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,3 @@ config DEBUG_RODATA
1313
If in doubt, say "N".
1414

1515
endmenu
16-
17-
config DEBUG_STACKOVERFLOW
18-
bool "Check for stack overflows"
19-
default y
20-
depends on DEBUG_KERNEL
21-
---help---
22-
Say Y here if you want to check the overflows of kernel, IRQ
23-
and exception stacks. This option will cause messages of the
24-
stacks in detail when free stack space drops below a certain
25-
limit.
26-
If in doubt, say "N".

arch/powerpc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ config PPC
138138
select ARCH_USE_BUILTIN_BSWAP
139139
select OLD_SIGSUSPEND
140140
select OLD_SIGACTION if PPC32
141+
select HAVE_DEBUG_STACKOVERFLOW
141142

142143
config EARLY_PRINTK
143144
bool

arch/powerpc/Kconfig.debug

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ config PRINT_STACK_DEPTH
2828
too small and stack traces cause important information to
2929
scroll off the screen.
3030

31-
config DEBUG_STACKOVERFLOW
32-
bool "Check for stack overflows"
33-
depends on DEBUG_KERNEL
34-
help
35-
This option will cause messages to be printed if free stack space
36-
drops below a certain limit.
37-
3831
config HCALL_STATS
3932
bool "Hypervisor call instrumentation"
4033
depends on PPC_PSERIES && DEBUG_FS && TRACEPOINTS

arch/tile/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ config TILE
2525
select HAVE_ARCH_TRACEHOOK
2626
select HAVE_SYSCALL_TRACEPOINTS
2727
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
28+
select HAVE_DEBUG_STACKOVERFLOW
2829

2930
# FIXME: investigate whether we need/want these options.
3031
# select HAVE_IOREMAP_PROT

arch/tile/Kconfig.debug

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ config EARLY_PRINTK
1414
with klogd/syslogd. You should normally N here,
1515
unless you want to debug such a crash.
1616

17-
config DEBUG_STACKOVERFLOW
18-
bool "Check for stack overflows"
19-
depends on DEBUG_KERNEL
20-
help
21-
This option will cause messages to be printed if free stack space
22-
drops below a certain limit.
23-
2417
config DEBUG_EXTRA_FLAGS
2518
string "Additional compiler arguments when building with '-g'"
2619
depends on DEBUG_INFO

arch/x86/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ config X86
121121
select OLD_SIGACTION if X86_32
122122
select COMPAT_OLD_SIGACTION if IA32_EMULATION
123123
select RTC_LIB
124+
select HAVE_DEBUG_STACKOVERFLOW
124125

125126
config INSTRUCTION_DECODER
126127
def_bool y

arch/x86/Kconfig.debug

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,6 @@ config EARLY_PRINTK_DBGP
5959
with klogd/syslogd or the X server. You should normally N here,
6060
unless you want to debug such a crash. You need usb debug device.
6161

62-
config DEBUG_STACKOVERFLOW
63-
bool "Check for stack overflows"
64-
depends on DEBUG_KERNEL
65-
---help---
66-
Say Y here if you want to check the overflows of kernel, IRQ
67-
and exception stacks. This option will cause messages of the
68-
stacks in detail when free stack space drops below a certain
69-
limit.
70-
If in doubt, say "N".
71-
7262
config X86_PTDUMP
7363
bool "Export kernel pagetable layout to userspace via debugfs"
7464
depends on DEBUG_KERNEL

lib/Kconfig.debug

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,27 @@ config ASYNC_RAID6_TEST
14751475

14761476
If unsure, say N.
14771477

1478+
config HAVE_DEBUG_STACKOVERFLOW
1479+
bool
1480+
1481+
config DEBUG_STACKOVERFLOW
1482+
bool "Check for stack overflows"
1483+
depends on DEBUG_KERNEL && HAVE_DEBUG_STACKOVERFLOW
1484+
---help---
1485+
Say Y here if you want to check for overflows of kernel, IRQ
1486+
and exception stacks (if your archicture uses them). This
1487+
option will show detailed messages if free stack space drops
1488+
below a certain limit.
1489+
1490+
These kinds of bugs usually occur when call-chains in the
1491+
kernel get too deep, especially when interrupts are
1492+
involved.
1493+
1494+
Use this in cases where you see apparently random memory
1495+
corruption, especially if it appears in 'struct thread_info'
1496+
1497+
If in doubt, say "N".
1498+
14781499
source "samples/Kconfig"
14791500

14801501
source "lib/Kconfig.kgdb"

0 commit comments

Comments
 (0)