Skip to contentSkip to conversation

4/4GB: remove FIXADDR_TOP changing

PATCH In review Kirill Korotaev 2 participants 2 messages Nov 11, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 4/4GB: remove FIXADDR_TOP changing

This patch fixes VSYSCALL_BASE/FIXADDR_TOP relations problems in 4gb split kernels (under some combinations of options/patches):
- if FIXADDR_TOP is changed, VSYSCALL_BASE in vsyscall.lds should be changed as well
- original 4gb split changes FIXADDR_TOP to be sure that stack is 2 pages aligned, but vsyscall.lds uses hardcoded constants inside. So we had /sbin/init loading problems due to ld-linux.so trying to access wrong addresses in VSYSCALL page.

The fix is the aligment of 4gb pages instead of alignment of FIXADDR_TOP

Kirill

P.S. These 4GB split patches are against modified 2.6.8.1 kernel, but should be appliable to last Fedora kernels

include/asm-i386/kmap_types.h renamed from include/asm-i386/kmap_types.h.4gb-fix +4 -2
@@ -10,7 +10,8 @@ enum km_type {
 	 * the 4G/4G virtual stack must be THREAD_SIZE aligned on each cpu.
 	 */
 	KM_BOUNCE_READ,
-	KM_VSTACK_BASE,
+	__KM_VSTACK_BASE,
+	KM_VSTACK_BASE = __KM_VSTACK_BASE + (__KM_VSTACK_BASE % 2),
 	KM_VSTACK_TOP = KM_VSTACK_BASE + STACK_PAGE_COUNT-1,
 
 	KM_LDT_PAGE15,
@@ -29,7 +30,8 @@ enum km_type {
 	KM_IRQ1,
 	KM_SOFTIRQ0,
 	KM_SOFTIRQ1,
-	KM_TYPE_NR
+	__KM_TYPE_NR,
+	KM_TYPE_NR=__KM_TYPE_NR + (__KM_TYPE_NR % 2)
 };
 
 #endif
include/asm-i386/fixmap.h renamed from include/asm-i386/fixmap.h.4gb-fix +7 -2
@@ -21,6 +21,8 @@
 #include <linux/threads.h>
 #include <asm/kmap_types.h>
 
+#define __FIXADDR_TOP (0xfffff000UL)
+
 /*
  * Here we define all the compile-time 'special' virtual
  * addresses. The point is to have a constant address at
@@ -77,7 +79,10 @@ enum fixed_addresses {
 	FIX_CYCLONE_TIMER, /*cyclone timer register*/
 	FIX_VSTACK_HOLE_2,
 #endif 
-	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
+	/* reserved pte's for temporary kernel mappings */
+	__FIX_KMAP_BEGIN,
+	FIX_KMAP_BEGIN = __FIX_KMAP_BEGIN + (__FIX_KMAP_BEGIN & 1) +
+		((__FIXADDR_TOP >> PAGE_SHIFT) & 1),
 	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
 #ifdef CONFIG_ACPI_BOOT
 	FIX_ACPI_BEGIN,
@@ -118,7 +123,7 @@ extern void __set_fixmap (enum fixed_add
  * IMPORTANT: we have to align FIXADDR_TOP so that the virtual stack
  * is THREAD_SIZE aligned.
  */
-#define FIXADDR_TOP	(0xffffe000UL & ~(THREAD_SIZE-1))
+#define FIXADDR_TOP	__FIXADDR_TOP
 #define __FIXADDR_SIZE	(__end_of_permanent_fixed_addresses << PAGE_SHIFT)
 #define FIXADDR_START	(FIXADDR_TOP - __FIXADDR_SIZE)
 
#1 lore raw
Quoted 11 lines · Kirill Korotaev

This patch fixes VSYSCALL_BASE/FIXADDR_TOP relations problems in 4gb split kernels (under some combinations of options/patches):
- if FIXADDR_TOP is changed, VSYSCALL_BASE in vsyscall.lds should be changed as well
- original 4gb split changes FIXADDR_TOP to be sure that stack is 2 pages aligned, but vsyscall.lds uses hardcoded constants inside. So we had /sbin/init loading problems due to ld-linux.so trying to access wrong addresses in VSYSCALL page.

The fix is the aligment of 4gb pages instead of alignment of FIXADDR_TOP

indeed - thanks!

Ingo