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, 23 Aug 2012 16:46:57 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	Jacob Shin <jacob.shin@....com>
Cc:	"H. Peter Anvin" <hpa@...or.com>, X86-ML <x86@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Andreas Herrmann <andreas.herrmann3@....com>,
	Tejun Heo <tj@...nel.org>,
	Borislav Petkov <borislav.petkov@....com>,
	Dave Young <dyoung@...hat.com>,
	Chao Wang <chaowang@...hat.com>,
	Vivek Goyal <vgoyal@...hat.com>
Subject: Re: [PATCH 3/4] x86: Only direct map addresses that are marked as E820_RAM

On Thu, Aug 23, 2012 at 3:35 PM, Jacob Shin <jacob.shin@....com> wrote:
>> >So I believe in V2 of the patchset this was done, however, Dave Young
>> >from redhat reported that it broke their KVM guest with a user supplied
>> >memory map that looked like this:
>> >
>> >>>[    0.000000] e820: user-defined physical RAM map:
>> >>>[    0.000000] user: [mem 0x0000000000010000-0x000000000009dbff] usable
>> >>>[    0.000000] user: [mem 0x0000000024000000-0x0000000033f6bfff] usable
>> >
>
> I looked into this a bit more, and I think what's happening is that this
> user defined memory map leaves out the region where the kernel is loaded on
> to during the boot process. The kernel and the direct mapped page tables up
> to initial max_pfn_mapped reside somwhere under 512M (KERNEL_IMAGE_SIZE),
> I guess it depends on how big your uncompressed kernel is.
>
> And at the first attempt to set_fixmap_nocache(FIX_APIC_BASE, address) in
> arch/x86/apic/apic.c: register_lapic_address runs into badness because the
> memory region where the initial page tables live is no longer mapped
> because of the above user supplied memory map.
>
> So I guess there is a disconnect between really early code that seems to
> rely on the boot loader as to where in physical memory it resides and its
> initial page tables live, and the later memory initialization code where
> it looks at the E820 (and here user can interject their own memory map
> using the command line arguments)
>
> Not really sure how to handle this case .. any advice?

Maybe you can just put back kernel range to E820 as RAM?

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index f4b9b80..e1a1f28 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -830,6 +830,9 @@ void __init setup_arch(char **cmdline_p)
        insert_resource(&iomem_resource, &code_resource);
        insert_resource(&iomem_resource, &data_resource);
        insert_resource(&iomem_resource, &bss_resource);
+       e820_add_range(code_resource.start, code_resource.end -
code_resource.start + 1, E820_RAM);
+       e820_add_range(data_resource.start, data_resource.end -
data_resource.start + 1, E820_RAM);
+       e820_add_range(bss_resource.start, bss_resource.end -
bss_resource.start + 1, E820_RAM);

        trim_bios_range();
 #ifdef CONFIG_X86_32
--
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