Zero out gs and fs whenever we enter the kernel
authorKevin Klues <klueska@parcad.millennium.berkeley.edu>
Fri, 23 Apr 2010 23:39:02 +0000 (16:39 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:44 +0000 (17:35 -0700)
kern/arch/i686/trapentry.S

index 3693511..f282bee 100644 (file)
@@ -78,6 +78,9 @@
        pushl %fs;                                                                 \
        pushl %gs;                                                                 \
        pushal;                                                                    \
+       movw $0, %ax;                                                              \
+       movw %ax, %gs;                                                             \
+       movw %ax, %fs;                                                             \
        movw $GD_KD, %ax;                                                          \
        movw %ax, %ds;                                                             \
        movw %ax, %es;                                                             \
@@ -193,6 +196,9 @@ _alltraps:
        pushl %fs
        pushl %gs
        pushal
+       movw $0, %ax;
+       movw %ax, %gs;
+       movw %ax, %fs;
        movw $GD_KD, %ax                # data segments aren't accessible by default
        movw %ax, %ds
        movw %ax, %es
@@ -218,6 +224,9 @@ _allirqs:
        pushl %fs
        pushl %gs
        pushal
+       movw $0, %ax;
+       movw %ax, %gs;
+       movw %ax, %fs;
        movw $GD_KD, %ax                # data segments aren't accessible by default
        movw %ax, %ds
        movw %ax, %es
@@ -252,6 +261,9 @@ sysenter_handler:
        pushl %fs
        pushl %gs
        pushal
+       movw $0, %ax;
+       movw %ax, %gs;
+       movw %ax, %fs;
        movw $GD_KD, %ax
        movw %ax, %ds
        movw %ax, %es