Changeset e13daa5d in mainline for kernel/arch/amd64/src


Ignore:
Timestamp:
2008-03-19T21:13:49Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
047aa46
Parents:
20b8bf3
Message:

Fortify ia32 and amd64 kernels against mallicious uspace applications that set
DF prior to entering the kernel. For AMD64 syscalls, we don't use the CLD
instruction, but make use of the SFMASK MSR instead. Simics works fine with
it, but QEMU seems to have a problem.

Location:
kernel/arch/amd64/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/asm_utils.S

    r20b8bf3 re13daa5d  
    249249
    250250        save_all_gpr
     251        cld
    251252
    252253        movq $(\i), %rdi        # %rdi - first parameter
  • kernel/arch/amd64/src/boot/boot.S

    r20b8bf3 re13daa5d  
    5555
    5656multiboot_image_start:
     57        cld
    5758        movl $START_STACK, %esp                 # initialize stack pointer
    5859        lgdtl bootstrap_gdtr                    # initialize Global Descriptor Table register
     
    127128        mov $VESA_INIT_SEGMENT << 4, %edi
    128129        mov $e_vesa_init - vesa_init, %ecx
    129         cld
    130130        rep movsb
    131131
     
    283283        movq $AP_BOOT_OFFSET, %rdi
    284284        movq $_hardcoded_unmapped_size, %rcx
    285         cld
    286285        rep movsb
    287286       
     
    557556       
    558557        movw $0x0c00, %ax                               # black background, light red foreground
    559         cld
    560558       
    561559        ploop:
  • kernel/arch/amd64/src/syscall.c

    r20b8bf3 re13daa5d  
    6363        /* Mask RFLAGS on syscall
    6464         * - disable interrupts, until we exchange the stack register
    65          *   (mask the IE bit)
     65         *   (mask the IF bit)
     66         * - clear DF so that the string instructions operate in
     67         *   the right direction
    6668         */
    67         write_msr(AMD_MSR_SFMASK, 0x200);
     69        write_msr(AMD_MSR_SFMASK, RFLAGS_IF | RFLAGS_DF);
    6870}
    6971
Note: See TracChangeset for help on using the changeset viewer.