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: <20080103182928.GC3028@redhat.com>
Date:	Thu, 3 Jan 2008 13:29:31 -0500
From:	Vivek Goyal <vgoyal@...hat.com>
To:	Andi Kleen <ak@...e.de>
Cc:	ebiederm@...ssion.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [1/8] GBPAGES: Handle kernel near memory hole in
	clear_kernel_mapping

On Thu, Jan 03, 2008 at 06:26:57PM +0100, Andi Kleen wrote:
> 
> This was a long standing obscure problem in the relocatable kernel. The
> AMD GART driver needs to unmap part of the GART in the kernel direct mapping to 
> prevent cache corruption. With the relocatable kernel it is in theory possible 
> that the separate kernel text mapping straddles that area too. 
> 
> Normally it should not happen because GART tends to be >= 2GB, and the kernel 
> is normally not loaded that high, but it is possible in theory. 
> 
> Teach clear_kernel_mapping() about this case.
> 
> This will become more important once the kernel mapping uses 1GB pages.
> 
> Cc: ebiederm@...ssion.com
> Cc: vgoyal@...hat.com
> 
> Signed-off-by: Andi Kleen <ak@...e.de>
> 
> ---
>  arch/x86/mm/init_64.c |   20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> Index: linux/arch/x86/mm/init_64.c
> ===================================================================
> --- linux.orig/arch/x86/mm/init_64.c
> +++ linux/arch/x86/mm/init_64.c
> @@ -411,7 +411,8 @@ void __init paging_init(void)
>     from the CPU leading to inconsistent cache lines. address and size
>     must be aligned to 2MB boundaries. 
>     Does nothing when the mapping doesn't exist. */
> -void __init clear_kernel_mapping(unsigned long address, unsigned long size) 
> +static void __init
> +__clear_kernel_mapping(unsigned long address, unsigned long size)
>  {
>  	unsigned long end = address + size;
>  
> @@ -441,6 +442,23 @@ void __init clear_kernel_mapping(unsigne
>  	__flush_tlb_all();
>  } 
>  
> +#define overlaps(as,ae,bs,be) ((ae) >= (bs) && (as) <= (be))
> +
> +void __init clear_kernel_mapping(unsigned long address, unsigned long size)
> +{
> +	int sh = PMD_SHIFT;
> +	unsigned long kernel = __pa(__START_KERNEL_map);
> +
> +	if (overlaps(kernel>>sh, (kernel + KERNEL_TEXT_SIZE)>>sh,
> +			__pa(address)>>sh, __pa(address + size)>>sh)) {
> +		printk(KERN_INFO
> +			"Kernel at %lx overlaps memory hole at %lx-%lx\n",
> +				kernel, __pa(address), __pa(address+size));
> +		__clear_kernel_mapping(__START_KERNEL_map+__pa(address), size);

Hi Andi,

Got a question. How will kernel continue to run if we unmap the kernel
text/data region mappings?

Thanks
Vivek
--
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