Changeset 0cd21bf in mainline for kernel/arch/ia32/src/asm.S


Ignore:
Timestamp:
2010-07-13T10:01:39Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
80c9416
Parents:
1b6c058
Message:

Sanitize EFLAGS in sysenter_handler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/asm.S

    r1b6c058 r0cd21bf  
    3232
    3333#include <arch/pm.h>
     34#include <arch/cpu.h>
    3435#include <arch/mm/page.h>
    3536
     
    190191.global sysenter_handler
    191192sysenter_handler:
    192         sti
    193193        subl $(ISTATE_REAL_SIZE), %esp
    194194
     
    231231        movw %ax, %es
    232232       
    233         cld
     233        /*
     234         * Sanitize EFLAGS.
     235         *
     236         * SYSENTER does not clear the NT flag, which could thus proliferate
     237         * from here to the IRET instruction via a context switch and result
     238         * in crash.
     239         *
     240         * SYSENTER does not clear DF, which the ABI assumes to be cleared.
     241         *
     242         * SYSENTER clears IF, which we would like to be set for syscalls.
     243         *
     244         */
     245        pushl $(EFLAGS_IF)  /* specify EFLAGS bits that we want to set */
     246        popfl               /* set bits from the mask, clear or ignore others */
     247
    234248        call syscall_handler
    235249       
Note: See TracChangeset for help on using the changeset viewer.