diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2007-05-02 13:27:15 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:15 -0400 |
commit | 35c7422649ee7a3d0eb4ebd32c997eeb45f81046 (patch) | |
tree | 8baebdb9aeb46844c7e9becc5a7699c47257f86d /arch | |
parent | 4cdd9c8931767e1c56a51a1078d33a8c340f4405 (diff) |
[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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/boot/misc.c | 2 | ||||
-rw-r--r-- | arch/arm/boot/compressed/misc.c | 2 | ||||
-rw-r--r-- | arch/arm26/boot/compressed/misc.c | 2 | ||||
-rw-r--r-- | arch/i386/boot/compressed/misc.c | 2 | ||||
-rw-r--r-- | arch/x86_64/boot/compressed/misc.c | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/arch/alpha/boot/misc.c b/arch/alpha/boot/misc.c index 1d65adf5691e..c00646b25f6e 100644 --- a/arch/alpha/boot/misc.c +++ b/arch/alpha/boot/misc.c | |||
@@ -98,7 +98,7 @@ extern int end; | |||
98 | static ulg free_mem_ptr; | 98 | static ulg free_mem_ptr; |
99 | static ulg free_mem_ptr_end; | 99 | static ulg free_mem_ptr_end; |
100 | 100 | ||
101 | #define HEAP_SIZE 0x2000 | 101 | #define HEAP_SIZE 0x3000 |
102 | 102 | ||
103 | #include "../../../lib/inflate.c" | 103 | #include "../../../lib/inflate.c" |
104 | 104 | ||
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 283891c736c4..9b444022cb9b 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c | |||
@@ -239,7 +239,7 @@ extern int end; | |||
239 | static ulg free_mem_ptr; | 239 | static ulg free_mem_ptr; |
240 | static ulg free_mem_ptr_end; | 240 | static ulg free_mem_ptr_end; |
241 | 241 | ||
242 | #define HEAP_SIZE 0x2000 | 242 | #define HEAP_SIZE 0x3000 |
243 | 243 | ||
244 | #include "../../../../lib/inflate.c" | 244 | #include "../../../../lib/inflate.c" |
245 | 245 | ||
diff --git a/arch/arm26/boot/compressed/misc.c b/arch/arm26/boot/compressed/misc.c index f17f50e5516f..0714d19c5776 100644 --- a/arch/arm26/boot/compressed/misc.c +++ b/arch/arm26/boot/compressed/misc.c | |||
@@ -182,7 +182,7 @@ extern int end; | |||
182 | static ulg free_mem_ptr; | 182 | static ulg free_mem_ptr; |
183 | static ulg free_mem_ptr_end; | 183 | static ulg free_mem_ptr_end; |
184 | 184 | ||
185 | #define HEAP_SIZE 0x2000 | 185 | #define HEAP_SIZE 0x3000 |
186 | 186 | ||
187 | #include "../../../../lib/inflate.c" | 187 | #include "../../../../lib/inflate.c" |
188 | 188 | ||
diff --git a/arch/i386/boot/compressed/misc.c b/arch/i386/boot/compressed/misc.c index 1ce7017fd627..b28505c544c9 100644 --- a/arch/i386/boot/compressed/misc.c +++ b/arch/i386/boot/compressed/misc.c | |||
@@ -189,7 +189,7 @@ static void putstr(const char *); | |||
189 | static unsigned long free_mem_ptr; | 189 | static unsigned long free_mem_ptr; |
190 | static unsigned long free_mem_end_ptr; | 190 | static unsigned long free_mem_end_ptr; |
191 | 191 | ||
192 | #define HEAP_SIZE 0x3000 | 192 | #define HEAP_SIZE 0x4000 |
193 | 193 | ||
194 | static char *vidmem = (char *)0xb8000; | 194 | static char *vidmem = (char *)0xb8000; |
195 | static int vidport; | 195 | static int vidport; |
diff --git a/arch/x86_64/boot/compressed/misc.c b/arch/x86_64/boot/compressed/misc.c index fed1167159c3..f932b0e89096 100644 --- a/arch/x86_64/boot/compressed/misc.c +++ b/arch/x86_64/boot/compressed/misc.c | |||
@@ -189,7 +189,7 @@ static void putstr(const char *); | |||
189 | static long free_mem_ptr; | 189 | static long free_mem_ptr; |
190 | static long free_mem_end_ptr; | 190 | static long free_mem_end_ptr; |
191 | 191 | ||
192 | #define HEAP_SIZE 0x6000 | 192 | #define HEAP_SIZE 0x7000 |
193 | 193 | ||
194 | static char *vidmem = (char *)0xb8000; | 194 | static char *vidmem = (char *)0xb8000; |
195 | static int vidport; | 195 | static int vidport; |