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: <200810031643.28731.nickpiggin@yahoo.com.au>
Date:	Fri, 3 Oct 2008 16:43:28 +1000
From:	Nick Piggin <nickpiggin@...oo.com.au>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Andy Whitcroft <apw@...dowen.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, kniht@...ux.vnet.ibm.com,
	mel@....ul.ie
Subject: Re: [PATCH 1/1] handle initialising compound pages at orders greater than MAX_ORDER

On Friday 03 October 2008 07:30, Andrew Morton wrote:
> On Thu,  2 Oct 2008 17:19:56 +0100
>
> Andy Whitcroft <apw@...dowen.org> wrote:
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -268,13 +268,14 @@ void prep_compound_page(struct page *page, unsigned
> > long order) {
> >  	int i;
> >  	int nr_pages = 1 << order;
> > +	struct page *p = page + 1;
> >
> >  	set_compound_page_dtor(page, free_compound_page);
> >  	set_compound_order(page, order);
> >  	__SetPageHead(page);
> > -	for (i = 1; i < nr_pages; i++) {
> > -		struct page *p = page + i;
> > -
> > +	for (i = 1; i < nr_pages; i++, p++) {
> > +		if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0))
> > +			p = pfn_to_page(page_to_pfn(page) + i);
> >  		__SetPageTail(p);
> >  		p->first_page = page;
> >  	}
>
> gad.  Wouldn't it be clearer to do
>
> 	for (i = 1; i < nr_pages; i++) {
> 		struct page *p = pfn_to_page(i);
> 		__SetPageTail(p);
> 		p->first_page = page;
> 	}
>
> Oh well, I guess we can go with the obfuscated, uncommented version for
> now :(
>
> This patch applies to 2.6.26 (and possibly earlier) but I don't think
> those kernels can trigger the bug?

I think the problem is that pfn_to_page isn't always trivial. I would
prefer to have seen a new function for hugetlb to use, and keep the
branch-less version for the page allocator itself.
--
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