Script to extract kernel stack sizes

Keith Owens (
Fri, 28 Feb 1997 22:31:20 +1100

Ingo Molnar <> mailed a script to check
kernel stack sizes. This is a modification to include modules as well
as vmlinux, to handle those procs where subl $0x...,%esp is not the
first instruction (common in 2.0, some in 2.1) and to look for dynamic
arrays on stack. Also replaces 3 grep, 2 awk, 1 cut with 1 sed. mingo
suggested I mail to the list.

objdump --disassemble vmlinux modules/*.o | \
sed -ne '/subl.*$0x.*,%esp/s/.*<\([^+>]*\).*$0x\([^,]*\).*/\2 \1/p;/subl[^(]*,%esp/p' | \
egrep '^... |%esp' | sort -r | less

Partial list on a 2.1.26 system, 5c4 for a stack size is a bit nasty.
The entries at the bottom (address <routine+offset> subl %eax,%esp)
indicate dynamic arrays on kernel stacks - I hope the length checks on
those arrays are right.

5c4 UMSDOS_ioctl_dir
588 huft_build
51c inflate_dynamic
490 inflate_fixed
44c smb_proc_readdir_long
440 smb_proc_setattr_trans2
428 smb_proc_getattr_trans2
348 vfat_find
2a0 elf_core_dump
28c rd_load_image
278 umsdos_find
278 block_read
274 block_write
250 umsdos_rename_f
24c umsdos_readdir_x
244 UMSDOS_unlink
22c umsdos_lookup_x
228 UMSDOS_link
21c cdrom_read_intr
204 scsi_make_blocked_list
204 cdrom_buffer_sectors
0000422d <nfs_lookup+1d> subl %eax,%esp
0000153a <ncp_rename+1e> subl %eax,%esp
0000152d <ncp_rename+11> subl %eax,%esp
000013f8 <ncp_unlink+14> subl %eax,%esp
000012c0 <ncp_rmdir+14> subl %eax,%esp
0000116b <ncp_mkdir+17> subl %eax,%esp
00000f73 <ncp_create+17> subl %eax,%esp
00000a5d <ncp_lookup+21> subl %eax,%esp