kernel-ark/arch/x86_64/kernel
John Blackwood 97c2803c9c [PATCH] x86_64: Plug GS leak in arch_prctl()
In linux-2.6.16, we have noticed a problem where the gs base value
returned from an arch_prtcl(ARCH_GET_GS, ...) call will be incorrect if:

   - the current/calling task has NOT set its own gs base yet to a
     non-zero value,

   - some other task that ran on the same processor previously set their
     own gs base to a non-zero value.

In this situation, the ARCH_GET_GS code will read and return the
MSR_KERNEL_GS_BASE msr register.

However, since the __switch_to() code does NOT load/zero the
MSR_KERNEL_GS_BASE register when the task that is switched IN has a zero
next->gs value, the caller of arch_prctl(ARCH_GET_GS, ...) will get back
the value of some previous tasks's gs base value instead of 0.

    Change the arch_prctl() ARCH_GET_GS code to only read and return
    the MSR_KERNEL_GS_BASE msr register if the 'gs' register of the calling
    task is non-zero.

    Side note: Since in addition to using arch_prctl(ARCH_SET_GS, ...),
    a task can also setup a gs base value by using modify_ldt() and write
    an index value into 'gs' from user space, the patch below reads
    'gs' instead of using thread.gs, since in the modify_ldt() case,
    the thread.gs value will be 0, and incorrect value would be returned
    (the task->thread.gs value).

    When the user has not set its own gs base value and the 'gs'
    register is zero, then the MSR_KERNEL_GS_BASE register will not be
    read and a value of zero will be returned by reading and returning
    'task->thread.gs'.

    The first patch shown below is an attempt at implementing this
    approach.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-09 11:53:53 -07:00
..
acpi
cpufreq
aperture.c [PATCH] x86_64: Rename e820_mapped to e820_any_mapped 2006-04-09 11:53:17 -07:00
apic.c [PATCH] Don't pass boot parameters to argv_init[] 2006-03-31 12:18:53 -08:00
asm-offsets.c
crash_dump.c
crash.c
e820.c [PATCH] x86_64: Introduce e820_all_mapped 2006-04-09 11:53:50 -07:00
early_printk.c [PATCH] Don't pass boot parameters to argv_init[] 2006-03-31 12:18:53 -08:00
entry.S [PATCH] x86_64: When user could have changed RIP always force IRET 2006-04-09 11:53:52 -07:00
functionlist
genapic_cluster.c
genapic_flat.c
genapic.c
head64.c
head.S
i387.c
i8259.c
init_task.c
io_apic.c
ioport.c
irq.c
kprobes.c
ldt.c
machine_kexec.c
Makefile
mce_amd.c
mce_intel.c
mce.c [PATCH] x86_64: Don't run NMI watchdog during machine checks 2006-04-09 11:53:52 -07:00
module.c
mpparse.c
nmi.c [PATCH] x86_64: Don't run NMI watchdog during machine checks 2006-04-09 11:53:52 -07:00
pci-dma.c [PATCH] x86_64: Fix compilation with CONFIG_PCI=n / allnoconfig 2006-04-09 11:53:51 -07:00
pci-gart.c
pci-nommu.c
pci-swiotlb.c
pmtimer.c [PATCH] Don't pass boot parameters to argv_init[] 2006-03-31 12:18:53 -08:00
process.c [PATCH] x86_64: Plug GS leak in arch_prctl() 2006-04-09 11:53:53 -07:00
ptrace.c
reboot.c
relocate_kernel.S
setup64.c [PATCH] Don't pass boot parameters to argv_init[] 2006-03-31 12:18:53 -08:00
setup.c [PATCH] x86_64: Clear APIC feature bit when local APIC is disabled 2006-04-09 11:53:51 -07:00
signal.c
smp.c
smpboot.c [PATCH] Don't pass boot parameters to argv_init[] 2006-03-31 12:18:53 -08:00
suspend_asm.S
suspend.c
sys_x86_64.c
syscall.c
time.c [PATCH] x86_64: Fix drift with HPET timer enabled 2006-04-09 11:53:53 -07:00
trampoline.S
traps.c [PATCH] Don't pass boot parameters to argv_init[] 2006-03-31 12:18:53 -08:00
vmlinux.lds.S [PATCH] x86_64: Fixup read_mostly section on internode cache line size for vSMP 2006-04-09 11:53:52 -07:00
vsmp.c
vsyscall.c
x8664_ksyms.c [PATCH] x86_64: Don't export strlen twice 2006-04-09 11:53:52 -07:00