[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1306332225.2211.9.camel@dan>
Date: Wed, 25 May 2011 10:03:45 -0400
From: Dan Rosenberg <drosenberg@...curity.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Ingo Molnar <mingo@...e.hu>, Tony Luck <tony.luck@...il.com>,
linux-kernel@...r.kernel.org, davej@...hat.com,
kees.cook@...onical.com, davem@...emloft.net, eranian@...gle.com,
torvalds@...ux-foundation.org, adobriyan@...il.com,
penberg@...nel.org, Arjan van de Ven <arjan@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Valdis.Kletnieks@...edu, pageexec@...email.hu
Subject: Re: [RFC][PATCH] Randomize kernel base address on boot
On Tue, 2011-05-24 at 16:06 -0700, H. Peter Anvin wrote:
> On 05/24/2011 02:16 PM, Ingo Molnar wrote:
> >
> > On some systems holes can be pretty low as well - you'd have to research e820
> > maps submitted to lkml to see how common this is - but it's not terribly
> > common.
> >
> > Some really old systems might have a hole between 15MB-16MB - but that's not an
> > issue if we load at 16 MB or higher.
> >
>
> It definitely happens, and not just at 15-16 MiB either.
>
> Doing this without actually consulting the memory map is dangerous as
> hell; plus you have to verify that you're not clobbering anything else,
> like the command line, initramfs or the linked list of data.
>
My current idea is to use int 0x15, eax = 0xe801 (which seems to be
nearly universally supported) and use bx/dx to determine the amount of
contiguous, usable memory above 16 MB, which seems to be exactly what we
want to know. If the BIOS does not support this function I'll be sure
to catch that and skip the randomization. Likewise, if the amount of
returned memory seems insufficient or otherwise confusing, I'll skip the
randomization.
Given this information, do you have a conservative guess for how close
to the top of available memory we can put the kernel? As in, let's say
we have an XYZ MB chunk of contiguous, free memory, how should I
calculate the highest, safe place to put the kernel in that region?
I'm going to continue to enforce the requirement that 16 MB is the
lowest address we can safely load the kernel, and I'd still appreciate
any information on why 2/4 MB default alignment might cause problems.
Thanks,
Dan
> -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