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:	Sun, 28 Mar 2010 03:01:13 +0200
From:	Johannes Weiner <hannes@...xchg.org>
To:	Yinghai Lu <yinghai@...nel.org>
Cc:	Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Miller <davem@...emloft.net>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Subject: Re: [PATCH -v3] x86: Make sure free_init_pages() free pages in boundary

On Sat, Mar 27, 2010 at 05:50:06PM -0700, Yinghai Lu wrote:
> > diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> > index e71c5cb..018e793 100644
> > --- a/arch/x86/mm/init.c
> > +++ b/arch/x86/mm/init.c
> > @@ -336,6 +336,11 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
> >  	if (addr >= end)
> >  		return;
> >  
> > +	if (WARN_ON(addr & ~PAGE_MASK || end & ~PAGE_MASK)) {
> > +		addr = PAGE_ALIGN(addr);
> > +		end &= PAGE_MASK;
> > +	}
> > +
> >  	/*
> >  	 * If debugging page accesses then do not free this memory but
> >  	 * mark them not present - any buggy init-section access will
> > @@ -355,11 +360,10 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
> >  
> >  	printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
> >  
> > -	for (; addr < end; addr += PAGE_SIZE) {
> > +	for (; addr != end; addr += PAGE_SIZE) {
> >  		ClearPageReserved(virt_to_page(addr));
> >  		init_page_count(virt_to_page(addr));
> > -		memset((void *)(addr & ~(PAGE_SIZE-1)),
> > -			POISON_FREE_INITMEM, PAGE_SIZE);
> > +		memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
> >  		free_page(addr);
> >  		totalram_pages++;
> >  	}
> something wrong here, if someone pass (0x10, 0x20), the will be aligned to [0x1000, 0]
> you will get dead loop

You are right!  It should be enough to move the alignment fixup above the addr >= end
check and in that case?  So we would get the warning and then simply return.

> will update that.

Thanks!

> YH

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