grsecurity-2.9.1-2.6.32.60-201302202031 compilation problem
Posted: Fri Feb 22, 2013 3:31 am
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.
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.