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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1abxrf9o3.fsf@ebiederm.dsl.xmission.com>
Date:	Mon, 02 Apr 2007 02:43:56 -0600
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	vgoyal@...ibm.com
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Jurriaan <thunder7@...all.nl>,
	Helge Hafting <helgehaf@...el.hist.no>,
	linux-kernel@...r.kernel.org
Subject: Re: 2.6.21-rc5-mm3 - no boot, "address not 2M aligned"

Vivek Goyal <vgoyal@...ibm.com> writes:

> On Sat, Mar 31, 2007 at 11:29:57PM -0700, Andrew Morton wrote:
>> On Sun, 01 Apr 2007 00:15:51 -0600 ebiederm@...ssion.com (Eric W. Biederman)
> wrote:
>> 
>> > Does anyone know how to express the constraint of a 2M aligned number in
> Kconfig?
>> 
>> Nope, but we could make CONFIG_PHYSICAL_START be in units of 2MB, which
>> would be a bit hard to use.
>> 
>> Adding a BUILD_BUG_ON which checks this constraint might help.  Plus a
>> useful comment right at the BUILD_BUG_ON site explaining what to do about
>> it.
>
> How about attached patch?

Looks like that will work.

Vivek.  If I can get the x86_64 vmlinux to have type ET_DYN (to mark
it as relocatable) is there any reason to keep CONFIG_PHYSICAL_START?
I think I can switch the vmlinux header type in about 100 lines or so
of code.  Assuming I can ever get 30 minutes with the appropriate
kernel.

> Thanks
> Vivek
>
>
>
> o X86_64 kernel should run from 2MB aligned address for two reasons.
> 	- Performance.
> 	- For relocatable kernels, page tables are updated based on difference
> 	  between compile time address and load time physical address.
> 	  This difference should be multiple of 2MB as kernel text and data
> 	  is mapped using 2MB pages and PMD should be pointing to a 2MB
> 	  aligned address. Life is simpler if both compile time and load time
> 	  kernel addresses are 2MB aligned.
>
> o Flag the error at compile time if one is trying to build a kernel which
>   does not meet alignment restrictions.
>
> Signed-off-by: Vivek Goyal <vgoyal@...ibm.com>
> ---
>
>  arch/x86_64/kernel/head64.c |    8 ++++++++
>  include/asm-x86_64/page.h   |    1 +
>  2 files changed, 9 insertions(+)
>
> diff -puN
> arch/x86_64/kernel/head64.c~x86_64-check-for-config-physical-start-aligned-2M
> arch/x86_64/kernel/head64.c
> ---
> linux-2.6.21-rc5-mm3-vanilla/arch/x86_64/kernel/head64.c~x86_64-check-for-config-physical-start-aligned-2M
> 2007-04-02 20:46:43.000000000 +0530
> +++ linux-2.6.21-rc5-mm3-vanilla-root/arch/x86_64/kernel/head64.c 2007-04-02
> 21:20:45.000000000 +0530
> @@ -62,6 +62,14 @@ void __init x86_64_start_kernel(char * r
>  {
>  	int i;
>  
> +	/*
> +	 * Make sure kernel is aligned to 2MB address. Catching it at compile
> +	 * time is better. Change your config file and compile the kernel
> +	 * for a 2MB aligned address (CONFIG_PHYSICAL_START)
> +	 */
> +	BUILD_BUG_ON(ALIGN(CONFIG_PHYSICAL_START, __KERNEL_ALIGN)
> +			!= CONFIG_PHYSICAL_START);

Just as a nit.
     	BUILD_BUG_ON(CONFIG_PHYSICAL_START & (__KERNEL_ALIGN - 1))
is a little shorter...   Although maybe not quite as readable.
> +
>  	/* clear bss before set_intr_gate with early_idt_handler */
>  	clear_bss();
>  
> diff -puN
> include/asm-x86_64/page.h~x86_64-check-for-config-physical-start-aligned-2M
> include/asm-x86_64/page.h
> ---
> linux-2.6.21-rc5-mm3-vanilla/include/asm-x86_64/page.h~x86_64-check-for-config-physical-start-aligned-2M
> 2007-04-02 20:50:55.000000000 +0530
> +++ linux-2.6.21-rc5-mm3-vanilla-root/include/asm-x86_64/page.h 2007-04-02
> 20:51:34.000000000 +0530
> @@ -79,6 +79,7 @@ extern unsigned long phys_base;
>  #endif /* !__ASSEMBLY__ */
>  
>  #define __PHYSICAL_START	CONFIG_PHYSICAL_START
> +#define __KERNEL_ALIGN		0x200000
>  #define __START_KERNEL		(__START_KERNEL_map + __PHYSICAL_START)
>  #define __START_KERNEL_map	0xffffffff80000000
>  #define __PAGE_OFFSET           0xffff810000000000

Do we want to use the __KERNEL_ALIGN directive in the test in misc.c?

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