Skip to contentSkip to conversation

Fix AP GDT descs to have limit = size - 1

PATCH In review Luca Barbieri 2 participants 2 messages Aug 7, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix AP GDT descs to have limit = size - 1

This is the right thing (also done by head.s).

arch/i386/kernel/cpu/common.c +1 -1
diff --exclude-from=/home/ldb/src/linux-exclude -urNd a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
@@ -451,7 +451,7 @@
 	 */
 	if (cpu) {
 		memcpy(cpu_gdt_table[cpu], cpu_gdt_table[0], GDT_SIZE);
-		cpu_gdt_descr[cpu].size = GDT_SIZE;
+		cpu_gdt_descr[cpu].size = GDT_SIZE - 1;
 		cpu_gdt_descr[cpu].address = (unsigned long)cpu_gdt_table[cpu];
 	}
 
#1 lore raw

arch/i386/kernel/cpu/common.c line 455

Quoted 4 lines · Luca Barbieri
arch/i386/kernel/cpu/common.c +1 -1
 		memcpy(cpu_gdt_table[cpu], cpu_gdt_table[0], GDT_SIZE);
-		cpu_gdt_descr[cpu].size = GDT_SIZE;
+		cpu_gdt_descr[cpu].size = GDT_SIZE - 1;
 		cpu_gdt_descr[cpu].address = (unsigned long)cpu_gdt_table[cpu];

indeed, good eyes!

i'm wondering whether this could have caused any problems - since the limit was not a proper multiple of 8 minus 1, no selector value could have caused a descriptor to be loaded from the invalid byte.

Ingo