lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1r6pwu806.fsf@ebiederm.dsl.xmission.com>
Date:	Fri, 04 May 2007 05:46:01 -0600
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Jeremy Fitzhardinge <jeremy@...p.org>
Cc:	Rusty Russell <rusty@...tcorp.com.au>,
	"H. Peter Anvin" <hpa@...or.com>, Andi Kleen <ak@...e.de>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] i386: always clear bss

Jeremy Fitzhardinge <jeremy@...p.org> writes:

> When the paravirt dispatcher gets run immediately on entry to
> startup_32, the bss isn't cleared.  This happens to work if the
> hypervisor's domain builder loaded the complete kernel image and
> cleared the bss for us, but this may not always be true (for example,
> if we're running out of a decompressed bzImage).
>
> Change head.S so that it unconditionally clears the bss before doing
> the paravirt dispatch or continuing on to normal native boot.
>
> There are a couple of points to note:
>  - We can't, in general, load the segment registers before paravirt
>    dispatch, because we could be running with a non-standard gdt and
>    segment selectors.  In practice though, all code which ends up
>    jumping into startup_32 will have already set the segment registers
>    up to sane values, so we don't need to do it again.
>  - Paging may or may not be enabled, and if enabled we may or may not
>    be mapped to the proper kernel virtual address.  To deal with this,
>    we compare the kernel's linked address with where we're actually
>    running, and use that to offset the bss pointer.

NAK.  

Skipping the segment register load is likely fine.
Supporting V!=P at startup_32 is not.
Assuming that we have a stack at startup_32 is not.

If you want to figure out where the kernel is loaded you can do
(from arch/i386/boot/head.S)
> 
> /* Calculate the delta between where we were compiled to run
>  * at and where we were actually loaded at.  This can only be done
>  * with a short local call on x86.  Nothing  else will tell us what
>  * address we are running at.  The reserved chunk of the real-mode
>  * data at 0x34-0x3f are used as the stack for this calculation.
>  * Only 4 bytes are needed.
>  */
> 	leal 0x40(%esi), %esp
> 	call 1f
> 1:	popl %ebp
> 	subl $1b, %ebp
> 

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ