aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/process_64.c')
-rw-r--r--arch/x86/kernel/process_64.c261
1 files changed, 139 insertions, 122 deletions
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index a8e53626ac9a..c958120fb1b6 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -37,11 +37,11 @@
37#include <linux/kdebug.h> 37#include <linux/kdebug.h>
38#include <linux/tick.h> 38#include <linux/tick.h>
39#include <linux/prctl.h> 39#include <linux/prctl.h>
40#include <linux/uaccess.h>
41#include <linux/io.h>
40 42
41#include <asm/uaccess.h>
42#include <asm/pgtable.h> 43#include <asm/pgtable.h>
43#include <asm/system.h> 44#include <asm/system.h>
44#include <asm/io.h>
45#include <asm/processor.h> 45#include <asm/processor.h>
46#include <asm/i387.h> 46#include <asm/i387.h>
47#include <asm/mmu_context.h> 47#include <asm/mmu_context.h>
@@ -51,6 +51,7 @@
51#include <asm/proto.h> 51#include <asm/proto.h>
52#include <asm/ia32.h> 52#include <asm/ia32.h>
53#include <asm/idle.h> 53#include <asm/idle.h>
54#include <asm/syscalls.h>
54 55
55asmlinkage extern void ret_from_fork(void); 56asmlinkage extern void ret_from_fork(void);
56 57
@@ -62,6 +63,13 @@ void idle_notifier_register(struct notifier_block *n)
62{ 63{
63 atomic_notifier_chain_register(&idle_notifier, n); 64 atomic_notifier_chain_register(&idle_notifier, n);
64} 65}
66EXPORT_SYMBOL_GPL(idle_notifier_register);
67
68void idle_notifier_unregister(struct notifier_block *n)
69{
70 atomic_notifier_chain_unregister(&idle_notifier, n);
71}
72EXPORT_SYMBOL_GPL(idle_notifier_unregister);
65 73
66void enter_idle(void) 74void enter_idle(void)
67{ 75{
@@ -85,29 +93,12 @@ void exit_idle(void)
85 __exit_idle(); 93 __exit_idle();
86} 94}
87 95
88#ifdef CONFIG_HOTPLUG_CPU 96#ifndef CONFIG_SMP
89DECLARE_PER_CPU(int, cpu_state);
90
91#include <asm/nmi.h>
92/* We halt the CPU with physical CPU hotplug */
93static inline void play_dead(void)
94{
95 idle_task_exit();
96 wbinvd();
97 mb();
98 /* Ack it */
99 __get_cpu_var(cpu_state) = CPU_DEAD;
100
101 local_irq_disable();
102 while (1)
103 halt();
104}
105#else
106static inline void play_dead(void) 97static inline void play_dead(void)
107{ 98{
108 BUG(); 99 BUG();
109} 100}
110#endif /* CONFIG_HOTPLUG_CPU */ 101#endif
111 102
112/* 103/*
113 * The idle thread. There's no useful work to be 104 * The idle thread. There's no useful work to be
@@ -120,7 +111,7 @@ void cpu_idle(void)
120 current_thread_info()->status |= TS_POLLING; 111 current_thread_info()->status |= TS_POLLING;
121 /* endless idle loop with no priority at all */ 112 /* endless idle loop with no priority at all */
122 while (1) { 113 while (1) {
123 tick_nohz_stop_sched_tick(); 114 tick_nohz_stop_sched_tick(1);
124 while (!need_resched()) { 115 while (!need_resched()) {
125 116
126 rmb(); 117 rmb();
@@ -152,7 +143,7 @@ void cpu_idle(void)
152} 143}
153 144
154/* Prints also some state that isn't saved in the pt_regs */ 145/* Prints also some state that isn't saved in the pt_regs */
155void __show_regs(struct pt_regs * regs) 146void __show_regs(struct pt_regs *regs, int all)
156{ 147{
157 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; 148 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
158 unsigned long d0, d1, d2, d3, d6, d7; 149 unsigned long d0, d1, d2, d3, d6, d7;
@@ -161,60 +152,65 @@ void __show_regs(struct pt_regs * regs)
161 152
162 printk("\n"); 153 printk("\n");
163 print_modules(); 154 print_modules();
164 printk("Pid: %d, comm: %.20s %s %s %.*s\n", 155 printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s\n",
165 current->pid, current->comm, print_tainted(), 156 current->pid, current->comm, print_tainted(),
166 init_utsname()->release, 157 init_utsname()->release,
167 (int)strcspn(init_utsname()->version, " "), 158 (int)strcspn(init_utsname()->version, " "),
168 init_utsname()->version); 159 init_utsname()->version);
169 printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); 160 printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
170 printk_address(regs->ip, 1); 161 printk_address(regs->ip, 1);
171 printk("RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->sp, 162 printk(KERN_INFO "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss,
172 regs->flags); 163 regs->sp, regs->flags);
173 printk("RAX: %016lx RBX: %016lx RCX: %016lx\n", 164 printk(KERN_INFO "RAX: %016lx RBX: %016lx RCX: %016lx\n",
174 regs->ax, regs->bx, regs->cx); 165 regs->ax, regs->bx, regs->cx);
175 printk("RDX: %016lx RSI: %016lx RDI: %016lx\n", 166 printk(KERN_INFO "RDX: %016lx RSI: %016lx RDI: %016lx\n",
176 regs->dx, regs->si, regs->di); 167 regs->dx, regs->si, regs->di);
177 printk("RBP: %016lx R08: %016lx R09: %016lx\n", 168 printk(KERN_INFO "RBP: %016lx R08: %016lx R09: %016lx\n",
178 regs->bp, regs->r8, regs->r9); 169 regs->bp, regs->r8, regs->r9);
179 printk("R10: %016lx R11: %016lx R12: %016lx\n", 170 printk(KERN_INFO "R10: %016lx R11: %016lx R12: %016lx\n",
180 regs->r10, regs->r11, regs->r12); 171 regs->r10, regs->r11, regs->r12);
181 printk("R13: %016lx R14: %016lx R15: %016lx\n", 172 printk(KERN_INFO "R13: %016lx R14: %016lx R15: %016lx\n",
182 regs->r13, regs->r14, regs->r15); 173 regs->r13, regs->r14, regs->r15);
183 174
184 asm("movl %%ds,%0" : "=r" (ds)); 175 asm("movl %%ds,%0" : "=r" (ds));
185 asm("movl %%cs,%0" : "=r" (cs)); 176 asm("movl %%cs,%0" : "=r" (cs));
186 asm("movl %%es,%0" : "=r" (es)); 177 asm("movl %%es,%0" : "=r" (es));
187 asm("movl %%fs,%0" : "=r" (fsindex)); 178 asm("movl %%fs,%0" : "=r" (fsindex));
188 asm("movl %%gs,%0" : "=r" (gsindex)); 179 asm("movl %%gs,%0" : "=r" (gsindex));
189 180
190 rdmsrl(MSR_FS_BASE, fs); 181 rdmsrl(MSR_FS_BASE, fs);
191 rdmsrl(MSR_GS_BASE, gs); 182 rdmsrl(MSR_GS_BASE, gs);
192 rdmsrl(MSR_KERNEL_GS_BASE, shadowgs); 183 rdmsrl(MSR_KERNEL_GS_BASE, shadowgs);
184
185 if (!all)
186 return;
193 187
194 cr0 = read_cr0(); 188 cr0 = read_cr0();
195 cr2 = read_cr2(); 189 cr2 = read_cr2();
196 cr3 = read_cr3(); 190 cr3 = read_cr3();
197 cr4 = read_cr4(); 191 cr4 = read_cr4();
198 192
199 printk("FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", 193 printk(KERN_INFO "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
200 fs,fsindex,gs,gsindex,shadowgs); 194 fs, fsindex, gs, gsindex, shadowgs);
201 printk("CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, es, cr0); 195 printk(KERN_INFO "CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds,
202 printk("CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, cr4); 196 es, cr0);
197 printk(KERN_INFO "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3,
198 cr4);
203 199
204 get_debugreg(d0, 0); 200 get_debugreg(d0, 0);
205 get_debugreg(d1, 1); 201 get_debugreg(d1, 1);
206 get_debugreg(d2, 2); 202 get_debugreg(d2, 2);
207 printk("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); 203 printk(KERN_INFO "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
208 get_debugreg(d3, 3); 204 get_debugreg(d3, 3);
209 get_debugreg(d6, 6); 205 get_debugreg(d6, 6);
210 get_debugreg(d7, 7); 206 get_debugreg(d7, 7);
211 printk("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); 207 printk(KERN_INFO "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
212} 208}
213 209
214void show_regs(struct pt_regs *regs) 210void show_regs(struct pt_regs *regs)
215{ 211{
216 printk("CPU %d:", smp_processor_id()); 212 printk(KERN_INFO "CPU %d:", smp_processor_id());
217 __show_regs(regs); 213 __show_regs(regs, 1);
218 show_trace(NULL, regs, (void *)(regs + 1), regs->bp); 214 show_trace(NULL, regs, (void *)(regs + 1), regs->bp);
219} 215}
220 216
@@ -239,6 +235,14 @@ void exit_thread(void)
239 t->io_bitmap_max = 0; 235 t->io_bitmap_max = 0;
240 put_cpu(); 236 put_cpu();
241 } 237 }
238#ifdef CONFIG_X86_DS
239 /* Free any DS contexts that have not been properly released. */
240 if (unlikely(t->ds_ctx)) {
241 /* we clear debugctl to make sure DS is not used. */
242 update_debugctlmsr(0);
243 ds_free(t->ds_ctx);
244 }
245#endif /* CONFIG_X86_DS */
242} 246}
243 247
244void flush_thread(void) 248void flush_thread(void)
@@ -314,10 +318,10 @@ void prepare_to_copy(struct task_struct *tsk)
314 318
315int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, 319int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
316 unsigned long unused, 320 unsigned long unused,
317 struct task_struct * p, struct pt_regs * regs) 321 struct task_struct *p, struct pt_regs *regs)
318{ 322{
319 int err; 323 int err;
320 struct pt_regs * childregs; 324 struct pt_regs *childregs;
321 struct task_struct *me = current; 325 struct task_struct *me = current;
322 326
323 childregs = ((struct pt_regs *) 327 childregs = ((struct pt_regs *)
@@ -362,10 +366,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
362 if (test_thread_flag(TIF_IA32)) 366 if (test_thread_flag(TIF_IA32))
363 err = do_set_thread_area(p, -1, 367 err = do_set_thread_area(p, -1,
364 (struct user_desc __user *)childregs->si, 0); 368 (struct user_desc __user *)childregs->si, 0);
365 else 369 else
366#endif 370#endif
367 err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8); 371 err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8);
368 if (err) 372 if (err)
369 goto out; 373 goto out;
370 } 374 }
371 err = 0; 375 err = 0;
@@ -472,13 +476,27 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
472 next = &next_p->thread; 476 next = &next_p->thread;
473 477
474 debugctl = prev->debugctlmsr; 478 debugctl = prev->debugctlmsr;
475 if (next->ds_area_msr != prev->ds_area_msr) { 479
476 /* we clear debugctl to make sure DS 480#ifdef CONFIG_X86_DS
477 * is not in use when we change it */ 481 {
478 debugctl = 0; 482 unsigned long ds_prev = 0, ds_next = 0;
479 update_debugctlmsr(0); 483
480 wrmsrl(MSR_IA32_DS_AREA, next->ds_area_msr); 484 if (prev->ds_ctx)
485 ds_prev = (unsigned long)prev->ds_ctx->ds;
486 if (next->ds_ctx)
487 ds_next = (unsigned long)next->ds_ctx->ds;
488
489 if (ds_next != ds_prev) {
490 /*
491 * We clear debugctl to make sure DS
492 * is not in use when we change it:
493 */
494 debugctl = 0;
495 update_debugctlmsr(0);
496 wrmsrl(MSR_IA32_DS_AREA, ds_next);
497 }
481 } 498 }
499#endif /* CONFIG_X86_DS */
482 500
483 if (next->debugctlmsr != debugctl) 501 if (next->debugctlmsr != debugctl)
484 update_debugctlmsr(next->debugctlmsr); 502 update_debugctlmsr(next->debugctlmsr);
@@ -516,13 +534,13 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
516 memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); 534 memset(tss->io_bitmap, 0xff, prev->io_bitmap_max);
517 } 535 }
518 536
519#ifdef X86_BTS 537#ifdef CONFIG_X86_PTRACE_BTS
520 if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS)) 538 if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS))
521 ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS); 539 ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS);
522 540
523 if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS)) 541 if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS))
524 ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES); 542 ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES);
525#endif 543#endif /* CONFIG_X86_PTRACE_BTS */
526} 544}
527 545
528/* 546/*
@@ -537,14 +555,14 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
537struct task_struct * 555struct task_struct *
538__switch_to(struct task_struct *prev_p, struct task_struct *next_p) 556__switch_to(struct task_struct *prev_p, struct task_struct *next_p)
539{ 557{
540 struct thread_struct *prev = &prev_p->thread, 558 struct thread_struct *prev = &prev_p->thread;
541 *next = &next_p->thread; 559 struct thread_struct *next = &next_p->thread;
542 int cpu = smp_processor_id(); 560 int cpu = smp_processor_id();
543 struct tss_struct *tss = &per_cpu(init_tss, cpu); 561 struct tss_struct *tss = &per_cpu(init_tss, cpu);
544 unsigned fsindex, gsindex; 562 unsigned fsindex, gsindex;
545 563
546 /* we're going to use this soon, after a few expensive things */ 564 /* we're going to use this soon, after a few expensive things */
547 if (next_p->fpu_counter>5) 565 if (next_p->fpu_counter > 5)
548 prefetch(next->xstate); 566 prefetch(next->xstate);
549 567
550 /* 568 /*
@@ -552,13 +570,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
552 */ 570 */
553 load_sp0(tss, next); 571 load_sp0(tss, next);
554 572
555 /* 573 /*
556 * Switch DS and ES. 574 * Switch DS and ES.
557 * This won't pick up thread selector changes, but I guess that is ok. 575 * This won't pick up thread selector changes, but I guess that is ok.
558 */ 576 */
559 savesegment(es, prev->es); 577 savesegment(es, prev->es);
560 if (unlikely(next->es | prev->es)) 578 if (unlikely(next->es | prev->es))
561 loadsegment(es, next->es); 579 loadsegment(es, next->es);
562 580
563 savesegment(ds, prev->ds); 581 savesegment(ds, prev->ds);
564 if (unlikely(next->ds | prev->ds)) 582 if (unlikely(next->ds | prev->ds))
@@ -584,50 +602,50 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
584 */ 602 */
585 arch_leave_lazy_cpu_mode(); 603 arch_leave_lazy_cpu_mode();
586 604
587 /* 605 /*
588 * Switch FS and GS. 606 * Switch FS and GS.
607 *
608 * Segment register != 0 always requires a reload. Also
609 * reload when it has changed. When prev process used 64bit
610 * base always reload to avoid an information leak.
589 */ 611 */
590 { 612 if (unlikely(fsindex | next->fsindex | prev->fs)) {
591 /* segment register != 0 always requires a reload. 613 loadsegment(fs, next->fsindex);
592 also reload when it has changed. 614 /*
593 when prev process used 64bit base always reload 615 * Check if the user used a selector != 0; if yes
594 to avoid an information leak. */ 616 * clear 64bit base, since overloaded base is always
595 if (unlikely(fsindex | next->fsindex | prev->fs)) { 617 * mapped to the Null selector
596 loadsegment(fs, next->fsindex); 618 */
597 /* check if the user used a selector != 0 619 if (fsindex)
598 * if yes clear 64bit base, since overloaded base 620 prev->fs = 0;
599 * is always mapped to the Null selector 621 }
600 */ 622 /* when next process has a 64bit base use it */
601 if (fsindex) 623 if (next->fs)
602 prev->fs = 0; 624 wrmsrl(MSR_FS_BASE, next->fs);
603 } 625 prev->fsindex = fsindex;
604 /* when next process has a 64bit base use it */ 626
605 if (next->fs) 627 if (unlikely(gsindex | next->gsindex | prev->gs)) {
606 wrmsrl(MSR_FS_BASE, next->fs); 628 load_gs_index(next->gsindex);
607 prev->fsindex = fsindex; 629 if (gsindex)
608 630 prev->gs = 0;
609 if (unlikely(gsindex | next->gsindex | prev->gs)) {
610 load_gs_index(next->gsindex);
611 if (gsindex)
612 prev->gs = 0;
613 }
614 if (next->gs)
615 wrmsrl(MSR_KERNEL_GS_BASE, next->gs);
616 prev->gsindex = gsindex;
617 } 631 }
632 if (next->gs)
633 wrmsrl(MSR_KERNEL_GS_BASE, next->gs);
634 prev->gsindex = gsindex;
618 635
619 /* Must be after DS reload */ 636 /* Must be after DS reload */
620 unlazy_fpu(prev_p); 637 unlazy_fpu(prev_p);
621 638
622 /* 639 /*
623 * Switch the PDA and FPU contexts. 640 * Switch the PDA and FPU contexts.
624 */ 641 */
625 prev->usersp = read_pda(oldrsp); 642 prev->usersp = read_pda(oldrsp);
626 write_pda(oldrsp, next->usersp); 643 write_pda(oldrsp, next->usersp);
627 write_pda(pcurrent, next_p); 644 write_pda(pcurrent, next_p);
628 645
629 write_pda(kernelstack, 646 write_pda(kernelstack,
630 (unsigned long)task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET); 647 (unsigned long)task_stack_page(next_p) +
648 THREAD_SIZE - PDA_STACKOFFSET);
631#ifdef CONFIG_CC_STACKPROTECTOR 649#ifdef CONFIG_CC_STACKPROTECTOR
632 write_pda(stack_canary, next_p->stack_canary); 650 write_pda(stack_canary, next_p->stack_canary);
633 /* 651 /*
@@ -664,7 +682,7 @@ long sys_execve(char __user *name, char __user * __user *argv,
664 char __user * __user *envp, struct pt_regs *regs) 682 char __user * __user *envp, struct pt_regs *regs)
665{ 683{
666 long error; 684 long error;
667 char * filename; 685 char *filename;
668 686
669 filename = getname(name); 687 filename = getname(name);
670 error = PTR_ERR(filename); 688 error = PTR_ERR(filename);
@@ -722,55 +740,55 @@ asmlinkage long sys_vfork(struct pt_regs *regs)
722unsigned long get_wchan(struct task_struct *p) 740unsigned long get_wchan(struct task_struct *p)
723{ 741{
724 unsigned long stack; 742 unsigned long stack;
725 u64 fp,ip; 743 u64 fp, ip;
726 int count = 0; 744 int count = 0;
727 745
728 if (!p || p == current || p->state==TASK_RUNNING) 746 if (!p || p == current || p->state == TASK_RUNNING)
729 return 0; 747 return 0;
730 stack = (unsigned long)task_stack_page(p); 748 stack = (unsigned long)task_stack_page(p);
731 if (p->thread.sp < stack || p->thread.sp > stack+THREAD_SIZE) 749 if (p->thread.sp < stack || p->thread.sp >= stack+THREAD_SIZE)
732 return 0; 750 return 0;
733 fp = *(u64 *)(p->thread.sp); 751 fp = *(u64 *)(p->thread.sp);
734 do { 752 do {
735 if (fp < (unsigned long)stack || 753 if (fp < (unsigned long)stack ||
736 fp > (unsigned long)stack+THREAD_SIZE) 754 fp >= (unsigned long)stack+THREAD_SIZE)
737 return 0; 755 return 0;
738 ip = *(u64 *)(fp+8); 756 ip = *(u64 *)(fp+8);
739 if (!in_sched_functions(ip)) 757 if (!in_sched_functions(ip))
740 return ip; 758 return ip;
741 fp = *(u64 *)fp; 759 fp = *(u64 *)fp;
742 } while (count++ < 16); 760 } while (count++ < 16);
743 return 0; 761 return 0;
744} 762}
745 763
746long do_arch_prctl(struct task_struct *task, int code, unsigned long addr) 764long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
747{ 765{
748 int ret = 0; 766 int ret = 0;
749 int doit = task == current; 767 int doit = task == current;
750 int cpu; 768 int cpu;
751 769
752 switch (code) { 770 switch (code) {
753 case ARCH_SET_GS: 771 case ARCH_SET_GS:
754 if (addr >= TASK_SIZE_OF(task)) 772 if (addr >= TASK_SIZE_OF(task))
755 return -EPERM; 773 return -EPERM;
756 cpu = get_cpu(); 774 cpu = get_cpu();
757 /* handle small bases via the GDT because that's faster to 775 /* handle small bases via the GDT because that's faster to
758 switch. */ 776 switch. */
759 if (addr <= 0xffffffff) { 777 if (addr <= 0xffffffff) {
760 set_32bit_tls(task, GS_TLS, addr); 778 set_32bit_tls(task, GS_TLS, addr);
761 if (doit) { 779 if (doit) {
762 load_TLS(&task->thread, cpu); 780 load_TLS(&task->thread, cpu);
763 load_gs_index(GS_TLS_SEL); 781 load_gs_index(GS_TLS_SEL);
764 } 782 }
765 task->thread.gsindex = GS_TLS_SEL; 783 task->thread.gsindex = GS_TLS_SEL;
766 task->thread.gs = 0; 784 task->thread.gs = 0;
767 } else { 785 } else {
768 task->thread.gsindex = 0; 786 task->thread.gsindex = 0;
769 task->thread.gs = addr; 787 task->thread.gs = addr;
770 if (doit) { 788 if (doit) {
771 load_gs_index(0); 789 load_gs_index(0);
772 ret = checking_wrmsrl(MSR_KERNEL_GS_BASE, addr); 790 ret = checking_wrmsrl(MSR_KERNEL_GS_BASE, addr);
773 } 791 }
774 } 792 }
775 put_cpu(); 793 put_cpu();
776 break; 794 break;
@@ -824,8 +842,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
824 rdmsrl(MSR_KERNEL_GS_BASE, base); 842 rdmsrl(MSR_KERNEL_GS_BASE, base);
825 else 843 else
826 base = task->thread.gs; 844 base = task->thread.gs;
827 } 845 } else
828 else
829 base = task->thread.gs; 846 base = task->thread.gs;
830 ret = put_user(base, (unsigned long __user *)addr); 847 ret = put_user(base, (unsigned long __user *)addr);
831 break; 848 break;