lkml.org 
[lkml]   [2008]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] boot: increase stack size for kernel boot loader decompressor
On Tue, Apr 8, 2008 at 1:23 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Alexander van Heukelum <heukelum@mailshack.com> wrote:
>
> > I did see that the malloc space that the inflate code is using is
> > taken from _after_ the end of the bss. I don't see how this is
> > protected from being used/overwritten. Changing the stack size changes
> > the memory layout a bit... maybe you were so unlucky to create a
> > vmlinux image that was just barely smaller than some threshold and
> > increasing the stack size made the decompression/relocation area be
> > located somewhere else?
> >
> > Test patch follows.
>
> that's a really interesting theory.
>
> FWIIW, i've been booting allyesconfig bzImages for a long time (with
> only minimal amount of drivers disabled - mostly old ISA ones that
> assume the presence of the real hardware), and they boot and work fine
> on both 32-bit and 64-bit typical whitebox PCs. That means huge bzImages
> that decompresses into a ~41 MB kernel image. I'd expect that to be a
> rather severe test of the decompressor.

i don't that Alexander's patch is needed.

also because Alex move heap before _end,
we may need add some extra for buffer offset

/* Replace the compressed data size with the uncompressed size */
subl input_len(%ebp), %ebx
movl output_len(%ebp), %eax
addl %eax, %ebx
/* Add 8 bytes for every 32K input block */
shrl $12, %eax
addl %eax, %ebx
/* Add 32K + 18 bytes of extra slack and align on a 4K boundary */
addl $(32768 + 18 + 4095), %ebx
andl $~4095, %ebx =============================> need add
heap size too.
....



/* Replace the compressed data size with the uncompressed size */
movl input_len(%rip), %eax
subq %rax, %rbx
movl output_len(%rip), %eax
addq %rax, %rbx
/* Add 8 bytes for every 32K input block */
shrq $12, %rax
addq %rax, %rbx
/* Add 32K + 18 bytes of extra slack and align on a 4K boundary */
addq $(32768 + 18 + 4095), %rbx
=============================> need add heap size too.
andq $~4095, %rbx

do we need to move pgtable before _end?

YH


\
 
 \ /
  Last update: 2008-04-08 19:57    [W:0.091 / U:26.000 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site