linux/lib
Jeremy Fitzhardinge 35c7422649 [PATCH] x86: deflate stack usage in lib/inflate.c
inflate_fixed and huft_build together use around 2.7k of stack.  When
using 4k stacks, I saw stack overflows from interrupts arriving while
unpacking the root initrd:

do_IRQ: stack overflow: 384
 [<c0106b64>] show_trace_log_lvl+0x1a/0x30
 [<c01075e6>] show_trace+0x12/0x14
 [<c010763f>] dump_stack+0x16/0x18
 [<c0107ca4>] do_IRQ+0x6d/0xd9
 [<c010202b>] xen_evtchn_do_upcall+0x6e/0xa2
 [<c0106781>] xen_hypervisor_callback+0x25/0x2c
 [<c010116c>] xen_restore_fl+0x27/0x29
 [<c0330f63>] _spin_unlock_irqrestore+0x4a/0x50
 [<c0117aab>] change_page_attr+0x577/0x584
 [<c0117b45>] kernel_map_pages+0x8d/0xb4
 [<c016a314>] cache_alloc_refill+0x53f/0x632
 [<c016a6c2>] __kmalloc+0xc1/0x10d
 [<c0463d34>] malloc+0x10/0x12
 [<c04641c1>] huft_build+0x2a7/0x5fa
 [<c04645a5>] inflate_fixed+0x91/0x136
 [<c04657e2>] unpack_to_rootfs+0x5f2/0x8c1
 [<c0465acf>] populate_rootfs+0x1e/0xe4

(This was under Xen, but there's no reason it couldn't happen on bare
  hardware.)

This patch mallocs the local variables, thereby reducing the stack
usage to sane levels.

Also, up the heap size for the kernel decompressor to deal with the
extra allocation.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Tim Yamin <plasmaroo@gentoo.org>
Cc: Andi Kleen <ak@suse.de>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Ian Molton <spyro@f2s.com>
2007-05-02 19:27:15 +02:00
..
reed_solomon fix file specification in comments 2006-10-03 23:01:26 +02:00
zlib_deflate [PATCH] zlib_inflate: Upgrade library code to a recent version 2006-06-22 15:05:58 -07:00
zlib_inflate [PATCH] Fix ppc32 zImage inflate 2006-07-31 13:28:37 -07:00
.gitignore Add some basic .gitignore files 2005-10-18 08:26:15 -07:00
Kconfig [PATCH] sort the devres mess out 2007-02-11 11:18:07 -08:00
Kconfig.debug [MIPS] Don't force frame pointers for lockdep on MIPS 2007-04-27 16:20:26 +01:00
Makefile [NET]: div64_64 consolidate (rev3) 2007-04-25 22:23:33 -07:00
audit.c [PATCH] fix missing ifdefs in syscall classes hookup for generic targets 2006-09-22 17:48:56 -07:00
bitmap.c [PATCH] kernel-doc fixes for 2.6.20-git15 (non-drivers) 2007-03-01 14:53:37 -08:00
bitrev.c [PATCH] add MODULE_* attributes to bit reversal library 2006-12-10 10:07:52 -08:00
bug.c [PATCH] Generic BUG implementation 2006-12-08 08:28:39 -08:00
bust_spinlocks.c [PATCH] Extract and use wake_up_klogd() 2007-02-11 10:51:34 -08:00
cmdline.c [PATCH] Numerous fixes to kernel-doc info in source files. 2007-02-11 10:51:32 -08:00
cpumask.c [PATCH] Convert highest_possible_processor_id to nr_cpu_ids 2007-02-20 17:10:13 -08:00
crc-ccitt.c [PATCH] kernel-doc for lib/crc*.c 2006-06-25 10:01:20 -07:00
crc16.c [PATCH] kernel-doc for lib/crc*.c 2006-06-25 10:01:20 -07:00
crc32.c [PATCH] crc32: replace bitreverse by bitrev32 2006-12-08 08:28:39 -08:00
crc32defs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ctype.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
debug_locks.c [PATCH] lockdep: better lock debugging 2006-07-03 15:27:01 -07:00
dec_and_lock.c [PATCH] atomic: dec_and_lock use atomic primitives 2006-01-08 20:13:48 -08:00
devres.c iomap: implement pcim_iounmap_regions() 2007-04-28 14:15:58 -04:00
div64.c [S390]: Fix build on 31-bit. 2007-04-25 22:28:53 -07:00
dump_stack.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
extable.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
fault-inject.c [PATCH] fault injection: split up stacktrace filter Kconfig option 2007-02-20 17:10:14 -08:00
find_next_bit.c [PATCH] bitops: generic ext2_{set,clear,test,find_first_zero,find_next_zero}_bit() 2006-03-26 08:57:11 -08:00
gen_crc32table.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
genalloc.c [PATCH] genalloc warning fixes 2007-02-20 17:10:15 -08:00
halfmd4.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hweight.c [PATCH] optimize hweight64 for x86_64 2006-09-26 10:52:38 +02:00
idr.c [PATCH] Numerous fixes to kernel-doc info in source files. 2007-02-11 10:51:32 -08:00
inflate.c [PATCH] x86: deflate stack usage in lib/inflate.c 2007-05-02 19:27:15 +02:00
int_sqrt.c [PATCH] lib: Fix bug in int_sqrt() for 64 bit longs 2006-02-03 08:32:08 -08:00
iomap.c [PATCH] sort the devres mess out 2007-02-11 11:18:07 -08:00
iomap_copy.c [PATCH] add __iowrite64_copy 2006-06-20 20:24:58 -07:00
ioremap.c [PATCH] uml problems with linux/io.h 2006-12-13 09:05:52 -08:00
irq_regs.c [PATCH] irq_reqs: export __irq_regs 2006-10-06 08:53:40 -07:00
kernel_lock.c [PATCH] lockdep: prove spinlock rwlock locking correctness 2006-07-03 15:27:04 -07:00
klist.c Driver core: Don't call put methods while holding a spinlock 2006-09-25 21:08:40 -07:00
kobject.c kobject: Comment and warning fixes to kobject.c 2007-04-27 10:57:31 -07:00
kobject_uevent.c the overdue removal of the mount/umount uevents 2007-04-27 10:57:31 -07:00
kref.c kref: fix CPU ordering with respect to krefs 2007-04-27 10:57:29 -07:00
libcrc32c.c [PATCH] constify libcrc32c table 2006-06-25 10:01:09 -07:00
list_debug.c [PATCH] More list debugging context 2006-12-07 08:39:35 -08:00
locking-selftest-hardirq.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-mutex.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-rlock-hardirq.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-rlock-softirq.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-rlock.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-rsem.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-softirq.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-spin-hardirq.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-spin-softirq.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-spin.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-wlock-hardirq.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-wlock-softirq.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-wlock.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest-wsem.h [PATCH] lockdep: locking API self tests 2006-07-03 15:27:03 -07:00
locking-selftest.c [PATCH] lockdep: show more details about self-test failures 2006-12-07 08:39:43 -08:00
parser.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
percpu_counter.c [PATCH] percpu counter data type changes to suppport more than 2**31 ext3 free blocks counter 2006-06-23 07:43:06 -07:00
plist.c [PATCH] pi-futex: add plist implementation 2006-06-27 17:32:46 -07:00
prio_tree.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
radix-tree.c [PATCH] hotplug CPU: clean up hotcpu_notifier() use 2006-12-07 08:39:39 -08:00
random32.c [PATCH] severing module.h->sched.h 2006-12-04 02:00:22 -05:00
rbtree.c [PATCH] rbtree: fixed reversed RB_EMPTY_NODE and rb_next/prev 2006-09-30 20:26:56 +02:00
reciprocal_div.c [PATCH] SLAB: use a multiply instead of a divide in obj_to_index() 2006-12-13 09:05:49 -08:00
rwsem-spinlock.c Lockdep: add lockdep_set_class_and_subclass() and lockdep_set_subclass() 2006-10-11 01:45:14 -04:00
rwsem.c Lockdep: add lockdep_set_class_and_subclass() and lockdep_set_subclass() 2006-10-11 01:45:14 -04:00
semaphore-sleepers.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sha1.c [PATCH] Numerous fixes to kernel-doc info in source files. 2007-02-11 10:51:32 -08:00
smp_processor_id.c [PATCH] fix missing includes 2005-10-30 17:37:32 -08:00
sort.c [PATCH] Numerous fixes to kernel-doc info in source files. 2007-02-11 10:51:32 -08:00
spinlock_debug.c [PATCH] x86: all cpu backtrace 2006-12-07 02:14:01 +01:00
string.c [STRING]: Move strcasecmp/strncasecmp to lib/string.c 2007-04-26 01:54:39 -07:00
swiotlb.c Revert "[IA64] swiotlb abstraction (e.g. for Xen)" 2007-03-06 13:31:45 -08:00
textsearch.c Various typo fixes. 2007-02-17 19:07:33 +01:00
ts_bm.c [TEXTSEARCH]: Fix Boyer Moore initialization bug 2006-08-22 14:33:58 -07:00
ts_fsm.c [PATCH] lib/ts_fsm.c: constify structs 2006-09-29 09:18:23 -07:00
ts_kmp.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
vsprintf.c Add kvasprintf() 2007-04-30 16:40:40 -07:00