|
@@ -205,7 +205,7 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long sp,
|
|
|
(struct user_desc __user *)tls, 0);
|
|
|
else
|
|
|
#endif
|
|
|
- err = do_arch_prctl(p, ARCH_SET_FS, tls);
|
|
|
+ err = do_arch_prctl_64(p, ARCH_SET_FS, tls);
|
|
|
if (err)
|
|
|
goto out;
|
|
|
}
|
|
@@ -548,7 +548,7 @@ static long prctl_map_vdso(const struct vdso_image *image, unsigned long addr)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-long do_arch_prctl(struct task_struct *task, int option, unsigned long addr)
|
|
|
+long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2)
|
|
|
{
|
|
|
int ret = 0;
|
|
|
int doit = task == current;
|
|
@@ -556,62 +556,64 @@ long do_arch_prctl(struct task_struct *task, int option, unsigned long addr)
|
|
|
|
|
|
switch (option) {
|
|
|
case ARCH_SET_GS:
|
|
|
- if (addr >= TASK_SIZE_MAX)
|
|
|
+ if (arg2 >= TASK_SIZE_MAX)
|
|
|
return -EPERM;
|
|
|
cpu = get_cpu();
|
|
|
task->thread.gsindex = 0;
|
|
|
- task->thread.gsbase = addr;
|
|
|
+ task->thread.gsbase = arg2;
|
|
|
if (doit) {
|
|
|
load_gs_index(0);
|
|
|
- ret = wrmsrl_safe(MSR_KERNEL_GS_BASE, addr);
|
|
|
+ ret = wrmsrl_safe(MSR_KERNEL_GS_BASE, arg2);
|
|
|
}
|
|
|
put_cpu();
|
|
|
break;
|
|
|
case ARCH_SET_FS:
|
|
|
/* Not strictly needed for fs, but do it for symmetry
|
|
|
with gs */
|
|
|
- if (addr >= TASK_SIZE_MAX)
|
|
|
+ if (arg2 >= TASK_SIZE_MAX)
|
|
|
return -EPERM;
|
|
|
cpu = get_cpu();
|
|
|
task->thread.fsindex = 0;
|
|
|
- task->thread.fsbase = addr;
|
|
|
+ task->thread.fsbase = arg2;
|
|
|
if (doit) {
|
|
|
/* set the selector to 0 to not confuse __switch_to */
|
|
|
loadsegment(fs, 0);
|
|
|
- ret = wrmsrl_safe(MSR_FS_BASE, addr);
|
|
|
+ ret = wrmsrl_safe(MSR_FS_BASE, arg2);
|
|
|
}
|
|
|
put_cpu();
|
|
|
break;
|
|
|
case ARCH_GET_FS: {
|
|
|
unsigned long base;
|
|
|
+
|
|
|
if (doit)
|
|
|
rdmsrl(MSR_FS_BASE, base);
|
|
|
else
|
|
|
base = task->thread.fsbase;
|
|
|
- ret = put_user(base, (unsigned long __user *)addr);
|
|
|
+ ret = put_user(base, (unsigned long __user *)arg2);
|
|
|
break;
|
|
|
}
|
|
|
case ARCH_GET_GS: {
|
|
|
unsigned long base;
|
|
|
+
|
|
|
if (doit)
|
|
|
rdmsrl(MSR_KERNEL_GS_BASE, base);
|
|
|
else
|
|
|
base = task->thread.gsbase;
|
|
|
- ret = put_user(base, (unsigned long __user *)addr);
|
|
|
+ ret = put_user(base, (unsigned long __user *)arg2);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
#ifdef CONFIG_CHECKPOINT_RESTORE
|
|
|
# ifdef CONFIG_X86_X32_ABI
|
|
|
case ARCH_MAP_VDSO_X32:
|
|
|
- return prctl_map_vdso(&vdso_image_x32, addr);
|
|
|
+ return prctl_map_vdso(&vdso_image_x32, arg2);
|
|
|
# endif
|
|
|
# if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
|
|
|
case ARCH_MAP_VDSO_32:
|
|
|
- return prctl_map_vdso(&vdso_image_32, addr);
|
|
|
+ return prctl_map_vdso(&vdso_image_32, arg2);
|
|
|
# endif
|
|
|
case ARCH_MAP_VDSO_64:
|
|
|
- return prctl_map_vdso(&vdso_image_64, addr);
|
|
|
+ return prctl_map_vdso(&vdso_image_64, arg2);
|
|
|
#endif
|
|
|
|
|
|
default:
|
|
@@ -622,9 +624,9 @@ long do_arch_prctl(struct task_struct *task, int option, unsigned long addr)
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, addr)
|
|
|
+SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
|
|
|
{
|
|
|
- return do_arch_prctl(current, option, addr);
|
|
|
+ return do_arch_prctl_64(current, option, arg2);
|
|
|
}
|
|
|
|
|
|
unsigned long KSTK_ESP(struct task_struct *task)
|