diff options
Diffstat (limited to 'arch/um/sys-x86_64/syscalls.c')
-rw-r--r-- | arch/um/sys-x86_64/syscalls.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index f309fa9bc232..01b91f9fa789 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c | |||
@@ -59,18 +59,20 @@ static long arch_prctl_tt(int code, unsigned long addr) | |||
59 | 59 | ||
60 | #ifdef CONFIG_MODE_SKAS | 60 | #ifdef CONFIG_MODE_SKAS |
61 | 61 | ||
62 | static long arch_prctl_skas(int code, unsigned long __user *addr) | 62 | long arch_prctl_skas(struct task_struct *task, int code, |
63 | unsigned long __user *addr) | ||
63 | { | 64 | { |
64 | unsigned long *ptr = addr, tmp; | 65 | unsigned long *ptr = addr, tmp; |
65 | long ret; | 66 | long ret; |
66 | int pid = current->mm->context.skas.id.u.pid; | 67 | int pid = task->mm->context.skas.id.u.pid; |
67 | 68 | ||
68 | /* | 69 | /* |
69 | * With ARCH_SET_FS (and ARCH_SET_GS is treated similarly to | 70 | * With ARCH_SET_FS (and ARCH_SET_GS is treated similarly to |
70 | * be safe), we need to call arch_prctl on the host because | 71 | * be safe), we need to call arch_prctl on the host because |
71 | * setting %fs may result in something else happening (like a | 72 | * setting %fs may result in something else happening (like a |
72 | * GDT being set instead). So, we let the host fiddle the | 73 | * GDT or thread.fs being set instead). So, we let the host |
73 | * registers and restore them afterwards. | 74 | * fiddle the registers and thread struct and restore the |
75 | * registers afterwards. | ||
74 | * | 76 | * |
75 | * So, the saved registers are stored to the process (this | 77 | * So, the saved registers are stored to the process (this |
76 | * needed because a stub may have been the last thing to run), | 78 | * needed because a stub may have been the last thing to run), |
@@ -118,7 +120,7 @@ static long arch_prctl_skas(int code, unsigned long __user *addr) | |||
118 | 120 | ||
119 | long sys_arch_prctl(int code, unsigned long addr) | 121 | long sys_arch_prctl(int code, unsigned long addr) |
120 | { | 122 | { |
121 | return CHOOSE_MODE_PROC(arch_prctl_tt, arch_prctl_skas, code, | 123 | return CHOOSE_MODE_PROC(arch_prctl_tt, arch_prctl_skas, current, code, |
122 | (unsigned long __user *) addr); | 124 | (unsigned long __user *) addr); |
123 | } | 125 | } |
124 | 126 | ||
@@ -141,6 +143,6 @@ void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) | |||
141 | if(to->thread.arch.fs == 0) | 143 | if(to->thread.arch.fs == 0) |
142 | return; | 144 | return; |
143 | 145 | ||
144 | arch_prctl_skas(ARCH_SET_FS, (void __user *) to->thread.arch.fs); | 146 | arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs); |
145 | } | 147 | } |
146 | 148 | ||