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]
Date:	Thu, 29 May 2008 11:58:04 -0700
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Yinghai Lu <yhlu.kernel@...il.com>
CC:	Jeremy Fitzhardinge <jeremy@...p.org>,
	Rusty Russell <rusty@...tcorp.com.au>, x86@...nel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86: extend e820 ealy_res support 32bit - fix #2

Yinghai Lu wrote:
> On Thu, May 29, 2008 at 6:37 AM, Jeremy Fitzhardinge <jeremy@...p.org> wrote:
>> Yinghai Lu wrote:
>>> can we use e820 entries for that? So the domain builder could have
>>> several entries for E820_RAM and E820_RESERVED...
>>>
>> I tried this, but it doesn't work; the kernel crashes during boot,
>> presumably because it's trying to use the reserved memory as heap.  I
>> suspect the e820 maps are not registered early enough or something...
>>
>> (One thought: if reserving in the E820 map were enough, then couldn't we use
>> it for all the early reservations?)
> 
> "e820 reserved entries" means kernel will only read it.
> 
> reserve_early will be converted to bootmem via reserve_bootmem[_generic]
> and later it could be freed and be reused.
> 

Hang on...

E820_RESERVED is supposed to mean "nothing touches this address space; 
the kernel cannot use it either as RAM nor for I/O allocations."

The kernel *cannot* assume it is safe to read.  There might be an I/O 
device there.

Now, to support using the E820 map for early reservations, we can simply 
define new "fake" E820 types.  The easiest way to do that, is to 
pre-sanitize the map so that all unknown-type entries are collapsed into 
a "fake" type E820_UNKNOWN:

/* Real E820 types */
#define E820_NONE	0
#define E820_RAM        1
#define E820_RESERVED   2
#define E820_ACPI       3
#define E820_NVS        4

/* Fake E820 types */
#define E820_UNKNOWN	5
#define E820_BOOTMEM	6	/* Pre-bootmem allocation in kernel */

/* .... */

/* Look for unknown types */
if (e820->type >= E820_UNKNOWN)
	e820->type = E820_UNKNOWN;

/* Now all numbers above E820_UNKNOWN are available for the kernel */

We can either do this sanitization in the kernel proper, in which case 
the values we pick have no real importance, as they can change from one 
version to the next, or in the boot code (Xen domain builder, ELILO, 
etc.)  The latter case would allow us to pass in new types, but in that 
case, we want to pick a Linux-specific range much higher up the 
numberspace, for obvious reasons.

	-hpa
--
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