x86/arch_prctl/64: Remove FSBASE/GSBASE < 4G optimization
[deliverable/linux.git] / arch / x86 / kernel / ptrace.c
index 0f4d2a5df2dc208470f6c50bc9f913c1195d69af..e72ab40fa969ada21f7c4682c3c604979ac2af3f 100644 (file)
@@ -303,29 +303,11 @@ static int set_segment_reg(struct task_struct *task,
 
        switch (offset) {
        case offsetof(struct user_regs_struct,fs):
-               /*
-                * If this is setting fs as for normal 64-bit use but
-                * setting fs_base has implicitly changed it, leave it.
-                */
-               if ((value == FS_TLS_SEL && task->thread.fsindex == 0 &&
-                    task->thread.fs != 0) ||
-                   (value == 0 && task->thread.fsindex == FS_TLS_SEL &&
-                    task->thread.fs == 0))
-                       break;
                task->thread.fsindex = value;
                if (task == current)
                        loadsegment(fs, task->thread.fsindex);
                break;
        case offsetof(struct user_regs_struct,gs):
-               /*
-                * If this is setting gs as for normal 64-bit use but
-                * setting gs_base has implicitly changed it, leave it.
-                */
-               if ((value == GS_TLS_SEL && task->thread.gsindex == 0 &&
-                    task->thread.gs != 0) ||
-                   (value == 0 && task->thread.gsindex == GS_TLS_SEL &&
-                    task->thread.gs == 0))
-                       break;
                task->thread.gsindex = value;
                if (task == current)
                        load_gs_index(task->thread.gsindex);
@@ -453,31 +435,17 @@ static unsigned long getreg(struct task_struct *task, unsigned long offset)
 #ifdef CONFIG_X86_64
        case offsetof(struct user_regs_struct, fs_base): {
                /*
-                * do_arch_prctl may have used a GDT slot instead of
-                * the MSR.  To userland, it appears the same either
-                * way, except the %fs segment selector might not be 0.
+                * XXX: This will not behave as expected if called on
+                * current or if fsindex != 0.
                 */
-               unsigned int seg = task->thread.fsindex;
-               if (task->thread.fs != 0)
-                       return task->thread.fs;
-               if (task == current)
-                       asm("movl %%fs,%0" : "=r" (seg));
-               if (seg != FS_TLS_SEL)
-                       return 0;
-               return get_desc_base(&task->thread.tls_array[FS_TLS]);
+               return task->thread.fs;
        }
        case offsetof(struct user_regs_struct, gs_base): {
                /*
-                * Exactly the same here as the %fs handling above.
+                * XXX: This will not behave as expected if called on
+                * current or if fsindex != 0.
                 */
-               unsigned int seg = task->thread.gsindex;
-               if (task->thread.gs != 0)
-                       return task->thread.gs;
-               if (task == current)
-                       asm("movl %%gs,%0" : "=r" (seg));
-               if (seg != GS_TLS_SEL)
-                       return 0;
-               return get_desc_base(&task->thread.tls_array[GS_TLS]);
+               return task->thread.gs;
        }
 #endif
        }
This page took 0.024399 seconds and 5 git commands to generate.