Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Merge x86 fixes from Ingo Molnar:
"Two followup fixes related to the previous LDT fix"

Also applied a further FPU emulation fix from Andy Lutomirski to the
branch before actually merging it.

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
x86/ldt: Further fix FPU emulation
x86/ldt: Correct FPU emulation access to LDT
x86/ldt: Correct LDT access in single stepping logic

+22 -9
+2 -2
arch/x86/kernel/step.c
··· 28 28 struct desc_struct *desc; 29 29 unsigned long base; 30 30 31 - seg &= ~7UL; 31 + seg >>= 3; 32 32 33 33 mutex_lock(&child->mm->context.lock); 34 34 if (unlikely(!child->mm->context.ldt || 35 - (seg >> 3) >= child->mm->context.ldt->size)) 35 + seg >= child->mm->context.ldt->size)) 36 36 addr = -1L; /* bogus selector, access would fault */ 37 37 else { 38 38 desc = &child->mm->context.ldt->entries[seg];
+1 -2
arch/x86/math-emu/fpu_entry.c
··· 29 29 30 30 #include <asm/uaccess.h> 31 31 #include <asm/traps.h> 32 - #include <asm/desc.h> 33 32 #include <asm/user.h> 34 33 #include <asm/fpu/internal.h> 35 34 ··· 180 181 math_abort(FPU_info, SIGILL); 181 182 } 182 183 183 - code_descriptor = LDT_DESCRIPTOR(FPU_CS); 184 + code_descriptor = FPU_get_ldt_descriptor(FPU_CS); 184 185 if (SEG_D_SIZE(code_descriptor)) { 185 186 /* The above test may be wrong, the book is not clear */ 186 187 /* Segmented 32 bit protected mode */
+18 -3
arch/x86/math-emu/fpu_system.h
··· 16 16 #include <linux/kernel.h> 17 17 #include <linux/mm.h> 18 18 19 - /* s is always from a cpu register, and the cpu does bounds checking 20 - * during register load --> no further bounds checks needed */ 21 - #define LDT_DESCRIPTOR(s) (((struct desc_struct *)current->mm->context.ldt)[(s) >> 3]) 19 + #include <asm/desc.h> 20 + #include <asm/mmu_context.h> 21 + 22 + static inline struct desc_struct FPU_get_ldt_descriptor(unsigned seg) 23 + { 24 + static struct desc_struct zero_desc; 25 + struct desc_struct ret = zero_desc; 26 + 27 + #ifdef CONFIG_MODIFY_LDT_SYSCALL 28 + seg >>= 3; 29 + mutex_lock(&current->mm->context.lock); 30 + if (current->mm->context.ldt && seg < current->mm->context.ldt->size) 31 + ret = current->mm->context.ldt->entries[seg]; 32 + mutex_unlock(&current->mm->context.lock); 33 + #endif 34 + return ret; 35 + } 36 + 22 37 #define SEG_D_SIZE(x) ((x).b & (3 << 21)) 23 38 #define SEG_G_BIT(x) ((x).b & (1 << 23)) 24 39 #define SEG_GRANULARITY(x) (((x).b & (1 << 23)) ? 4096 : 1)
+1 -2
arch/x86/math-emu/get_address.c
··· 20 20 #include <linux/stddef.h> 21 21 22 22 #include <asm/uaccess.h> 23 - #include <asm/desc.h> 24 23 25 24 #include "fpu_system.h" 26 25 #include "exception.h" ··· 157 158 addr->selector = PM_REG_(segment); 158 159 } 159 160 160 - descriptor = LDT_DESCRIPTOR(PM_REG_(segment)); 161 + descriptor = FPU_get_ldt_descriptor(addr->selector); 161 162 base_address = SEG_BASE_ADDR(descriptor); 162 163 address = base_address + offset; 163 164 limit = base_address