Page 1 of 1

grsecurity-2.9.1-2.6.32.60-201302202031 compilation problem

PostPosted: Fri Feb 22, 2013 3:31 am
by jorgus
Hi,

I think there is a problem with the changes in mm/page_alloc.c introduced in grsecurity-2.9.1-2.6.32.60-201302202031.patch. When trying to compile 2.6.32.60 for x86 I get compilation errors:

mm/page_alloc.c: In function ‘pfn_to_bitidx’:
mm/page_alloc.c:4970: error: implicit declaration of function ‘round_down’
make[2]: *** [mm/page_alloc.o] Error 1

After comparing grsecurity-2.9.1-2.6.32.60-201302202031.patch with grsecurity-2.9.1-2.6.32.60-201302181144.patch it clearly looks that the following change is the culprit:

diff -u b/mm/page_alloc.c b/mm/page_alloc.c
--- b/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4964,7 +4967,7 @@
pfn &= (PAGES_PER_SECTION-1);
return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
#else
- pfn = pfn - zone->zone_start_pfn;
+ pfn = pfn - round_down(zone->zone_start_pfn, pageblock_nr_pages);
return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
#endif /* CONFIG_SPARSEMEM */
}

Diving deeper it seems that to trigger the error you need to set a different memory model than CONFIG_SPARSEMEM. This probably rules out amd64, where at least with my configs I see no other choice than sparse memory. Indeed I encountered the error in x86 kernel only, where the model was set to CONFIG_FLATMEM.

Re: grsecurity-2.9.1-2.6.32.60-201302202031 compilation prob

PostPosted: Fri Feb 22, 2013 8:16 am
by spender
Thanks for the report, I'll have this fixed in the next patch (I didn't catch it in my x86/x64 configurations).

-Brad

Re: grsecurity-2.9.1-2.6.32.60-201302202031 compilation prob

PostPosted: Mon Feb 25, 2013 7:21 pm
by jorgus
I courteously confirm that grsecurity-2.9.1-2.6.32.60-201302222044.patch solved the problem. Thank you :)

--
Simon