Loading arch/x86/kernel/ldt_32.c +33 −27 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ #include <asm/desc.h> #include <asm/mmu_context.h> #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ #ifdef CONFIG_SMP static void flush_ldt(void *null) { if (current->active_mm) Loading Loading @@ -46,7 +46,8 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload) if (oldsize) memcpy(newldt, pc->ldt, oldsize * LDT_ENTRY_SIZE); oldldt = pc->ldt; memset(newldt+oldsize*LDT_ENTRY_SIZE, 0, (mincount-oldsize)*LDT_ENTRY_SIZE); memset(newldt + oldsize * LDT_ENTRY_SIZE, 0, (mincount - oldsize) * LDT_ENTRY_SIZE); pc->ldt = newldt; wmb(); pc->size = mincount; Loading @@ -55,6 +56,7 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload) if (reload) { #ifdef CONFIG_SMP cpumask_t mask; preempt_disable(); load_LDT(pc); mask = cpumask_of_cpu(smp_processor_id()); Loading @@ -77,6 +79,7 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload) static inline int copy_ldt(mm_context_t *new, mm_context_t *old) { int err = alloc_ldt(new, old->size, 0); if (err < 0) return err; memcpy(new->ldt, old->ldt, old->size * LDT_ENTRY_SIZE); Loading Loading @@ -196,7 +199,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) mutex_lock(&mm->context.lock); if (ldt_info.entry_number >= mm->context.size) { error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); error = alloc_ldt(¤t->mm->context, ldt_info.entry_number + 1, 1); if (error < 0) goto out_unlock; } Loading @@ -217,7 +221,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) /* Install the new entry ... */ install: write_ldt_entry(mm->context.ldt, ldt_info.entry_number, entry_1, entry_2); write_ldt_entry(mm->context.ldt, ldt_info.entry_number, entry_1, entry_2); error = 0; out_unlock: Loading @@ -226,7 +231,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) return error; } asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) { int ret = -ENOSYS; Loading arch/x86/kernel/ldt_64.c +36 −33 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ #include <asm/desc.h> #include <asm/proto.h> #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ #ifdef CONFIG_SMP static void flush_ldt(void *null) { if (current->active_mm) Loading Loading @@ -49,7 +49,8 @@ static int alloc_ldt(mm_context_t *pc, unsigned mincount, int reload) if (oldsize) memcpy(newldt, pc->ldt, oldsize * LDT_ENTRY_SIZE); oldldt = pc->ldt; memset(newldt+oldsize*LDT_ENTRY_SIZE, 0, (mincount-oldsize)*LDT_ENTRY_SIZE); memset(newldt + oldsize * LDT_ENTRY_SIZE, 0, (mincount - oldsize) * LDT_ENTRY_SIZE); wmb(); pc->ldt = newldt; wmb(); Loading Loading @@ -81,6 +82,7 @@ static int alloc_ldt(mm_context_t *pc, unsigned mincount, int reload) static inline int copy_ldt(mm_context_t *new, mm_context_t *old) { int err = alloc_ldt(new, old->size, 0); if (err < 0) return err; memcpy(new->ldt, old->ldt, old->size * LDT_ENTRY_SIZE); Loading Loading @@ -108,7 +110,6 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) } /* * * Don't touch the LDT register - we're already in the next thread. */ void destroy_context(struct mm_struct *mm) Loading Loading @@ -195,7 +196,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) mutex_lock(&mm->context.lock); if (ldt_info.entry_number >= (unsigned)mm->context.size) { error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); error = alloc_ldt(¤t->mm->context, ldt_info.entry_number + 1, 1); if (error < 0) goto out_unlock; } Loading Loading @@ -228,7 +230,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) return error; } asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) { int ret = -ENOSYS; Loading Loading
arch/x86/kernel/ldt_32.c +33 −27 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ #include <asm/desc.h> #include <asm/mmu_context.h> #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ #ifdef CONFIG_SMP static void flush_ldt(void *null) { if (current->active_mm) Loading Loading @@ -46,7 +46,8 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload) if (oldsize) memcpy(newldt, pc->ldt, oldsize * LDT_ENTRY_SIZE); oldldt = pc->ldt; memset(newldt+oldsize*LDT_ENTRY_SIZE, 0, (mincount-oldsize)*LDT_ENTRY_SIZE); memset(newldt + oldsize * LDT_ENTRY_SIZE, 0, (mincount - oldsize) * LDT_ENTRY_SIZE); pc->ldt = newldt; wmb(); pc->size = mincount; Loading @@ -55,6 +56,7 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload) if (reload) { #ifdef CONFIG_SMP cpumask_t mask; preempt_disable(); load_LDT(pc); mask = cpumask_of_cpu(smp_processor_id()); Loading @@ -77,6 +79,7 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload) static inline int copy_ldt(mm_context_t *new, mm_context_t *old) { int err = alloc_ldt(new, old->size, 0); if (err < 0) return err; memcpy(new->ldt, old->ldt, old->size * LDT_ENTRY_SIZE); Loading Loading @@ -196,7 +199,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) mutex_lock(&mm->context.lock); if (ldt_info.entry_number >= mm->context.size) { error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); error = alloc_ldt(¤t->mm->context, ldt_info.entry_number + 1, 1); if (error < 0) goto out_unlock; } Loading @@ -217,7 +221,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) /* Install the new entry ... */ install: write_ldt_entry(mm->context.ldt, ldt_info.entry_number, entry_1, entry_2); write_ldt_entry(mm->context.ldt, ldt_info.entry_number, entry_1, entry_2); error = 0; out_unlock: Loading @@ -226,7 +231,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) return error; } asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) { int ret = -ENOSYS; Loading
arch/x86/kernel/ldt_64.c +36 −33 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ #include <asm/desc.h> #include <asm/proto.h> #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ #ifdef CONFIG_SMP static void flush_ldt(void *null) { if (current->active_mm) Loading Loading @@ -49,7 +49,8 @@ static int alloc_ldt(mm_context_t *pc, unsigned mincount, int reload) if (oldsize) memcpy(newldt, pc->ldt, oldsize * LDT_ENTRY_SIZE); oldldt = pc->ldt; memset(newldt+oldsize*LDT_ENTRY_SIZE, 0, (mincount-oldsize)*LDT_ENTRY_SIZE); memset(newldt + oldsize * LDT_ENTRY_SIZE, 0, (mincount - oldsize) * LDT_ENTRY_SIZE); wmb(); pc->ldt = newldt; wmb(); Loading Loading @@ -81,6 +82,7 @@ static int alloc_ldt(mm_context_t *pc, unsigned mincount, int reload) static inline int copy_ldt(mm_context_t *new, mm_context_t *old) { int err = alloc_ldt(new, old->size, 0); if (err < 0) return err; memcpy(new->ldt, old->ldt, old->size * LDT_ENTRY_SIZE); Loading Loading @@ -108,7 +110,6 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) } /* * * Don't touch the LDT register - we're already in the next thread. */ void destroy_context(struct mm_struct *mm) Loading Loading @@ -195,7 +196,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) mutex_lock(&mm->context.lock); if (ldt_info.entry_number >= (unsigned)mm->context.size) { error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); error = alloc_ldt(¤t->mm->context, ldt_info.entry_number + 1, 1); if (error < 0) goto out_unlock; } Loading Loading @@ -228,7 +230,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) return error; } asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) { int ret = -ENOSYS; Loading