diff options
author | Alexander van Heukelum <heukelum@fastmail.fm> | 2013-03-27 17:18:05 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-02 20:36:32 -0400 |
commit | 5522ddb3fc0dfd4a503c8278eafd88c9f2d3fada (patch) | |
tree | dc3ffbbc5f43defb97fe06dc801e3478073ffda3 /arch | |
parent | 20b4fb485227404329e41ad15588afad3df23050 (diff) |
x86, vm86: fix VM86 syscalls: use SYSCALL_DEFINEx(...)
Commit 49cb25e9290 x86: 'get rid of pt_regs argument in vm86/vm86old'
got rid of the pt_regs stub for sys_vm86old and sys_vm86. The functions
were, however, not changed to use the calling convention for syscalls.
[AV: killed asmlinkage_protect() - it's done automatically now]
Reported-and-tested-by: Hans de Bruin <jmdebruin@xmsnet.nl>
Cc: stable@vger.kernel.org
Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/syscalls.h | 4 | ||||
-rw-r--r-- | arch/x86/kernel/vm86_32.c | 38 |
2 files changed, 16 insertions, 26 deletions
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h index 5f87b35fd2ef..2917a6452c49 100644 --- a/arch/x86/include/asm/syscalls.h +++ b/arch/x86/include/asm/syscalls.h | |||
@@ -37,8 +37,8 @@ asmlinkage long sys_get_thread_area(struct user_desc __user *); | |||
37 | unsigned long sys_sigreturn(void); | 37 | unsigned long sys_sigreturn(void); |
38 | 38 | ||
39 | /* kernel/vm86_32.c */ | 39 | /* kernel/vm86_32.c */ |
40 | int sys_vm86old(struct vm86_struct __user *); | 40 | asmlinkage long sys_vm86old(struct vm86_struct __user *); |
41 | int sys_vm86(unsigned long, unsigned long); | 41 | asmlinkage long sys_vm86(unsigned long, unsigned long); |
42 | 42 | ||
43 | #else /* CONFIG_X86_32 */ | 43 | #else /* CONFIG_X86_32 */ |
44 | 44 | ||
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c index 1cf5766dde16..e8edcf52e069 100644 --- a/arch/x86/kernel/vm86_32.c +++ b/arch/x86/kernel/vm86_32.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/capability.h> | 33 | #include <linux/capability.h> |
34 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
35 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
36 | #include <linux/syscalls.h> | ||
36 | #include <linux/sched.h> | 37 | #include <linux/sched.h> |
37 | #include <linux/kernel.h> | 38 | #include <linux/kernel.h> |
38 | #include <linux/signal.h> | 39 | #include <linux/signal.h> |
@@ -48,7 +49,6 @@ | |||
48 | #include <asm/io.h> | 49 | #include <asm/io.h> |
49 | #include <asm/tlbflush.h> | 50 | #include <asm/tlbflush.h> |
50 | #include <asm/irq.h> | 51 | #include <asm/irq.h> |
51 | #include <asm/syscalls.h> | ||
52 | 52 | ||
53 | /* | 53 | /* |
54 | * Known problems: | 54 | * Known problems: |
@@ -202,36 +202,32 @@ out: | |||
202 | static int do_vm86_irq_handling(int subfunction, int irqnumber); | 202 | static int do_vm86_irq_handling(int subfunction, int irqnumber); |
203 | static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk); | 203 | static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk); |
204 | 204 | ||
205 | int sys_vm86old(struct vm86_struct __user *v86) | 205 | SYSCALL_DEFINE1(vm86old, struct vm86_struct __user *, v86) |
206 | { | 206 | { |
207 | struct kernel_vm86_struct info; /* declare this _on top_, | 207 | struct kernel_vm86_struct info; /* declare this _on top_, |
208 | * this avoids wasting of stack space. | 208 | * this avoids wasting of stack space. |
209 | * This remains on the stack until we | 209 | * This remains on the stack until we |
210 | * return to 32 bit user space. | 210 | * return to 32 bit user space. |
211 | */ | 211 | */ |
212 | struct task_struct *tsk; | 212 | struct task_struct *tsk = current; |
213 | int tmp, ret = -EPERM; | 213 | int tmp; |
214 | 214 | ||
215 | tsk = current; | ||
216 | if (tsk->thread.saved_sp0) | 215 | if (tsk->thread.saved_sp0) |
217 | goto out; | 216 | return -EPERM; |
218 | tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs, | 217 | tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs, |
219 | offsetof(struct kernel_vm86_struct, vm86plus) - | 218 | offsetof(struct kernel_vm86_struct, vm86plus) - |
220 | sizeof(info.regs)); | 219 | sizeof(info.regs)); |
221 | ret = -EFAULT; | ||
222 | if (tmp) | 220 | if (tmp) |
223 | goto out; | 221 | return -EFAULT; |
224 | memset(&info.vm86plus, 0, (int)&info.regs32 - (int)&info.vm86plus); | 222 | memset(&info.vm86plus, 0, (int)&info.regs32 - (int)&info.vm86plus); |
225 | info.regs32 = current_pt_regs(); | 223 | info.regs32 = current_pt_regs(); |
226 | tsk->thread.vm86_info = v86; | 224 | tsk->thread.vm86_info = v86; |
227 | do_sys_vm86(&info, tsk); | 225 | do_sys_vm86(&info, tsk); |
228 | ret = 0; /* we never return here */ | 226 | return 0; /* we never return here */ |
229 | out: | ||
230 | return ret; | ||
231 | } | 227 | } |
232 | 228 | ||
233 | 229 | ||
234 | int sys_vm86(unsigned long cmd, unsigned long arg) | 230 | SYSCALL_DEFINE2(vm86, unsigned long, cmd, unsigned long, arg) |
235 | { | 231 | { |
236 | struct kernel_vm86_struct info; /* declare this _on top_, | 232 | struct kernel_vm86_struct info; /* declare this _on top_, |
237 | * this avoids wasting of stack space. | 233 | * this avoids wasting of stack space. |
@@ -239,7 +235,7 @@ int sys_vm86(unsigned long cmd, unsigned long arg) | |||
239 | * return to 32 bit user space. | 235 | * return to 32 bit user space. |
240 | */ | 236 | */ |
241 | struct task_struct *tsk; | 237 | struct task_struct *tsk; |
242 | int tmp, ret; | 238 | int tmp; |
243 | struct vm86plus_struct __user *v86; | 239 | struct vm86plus_struct __user *v86; |
244 | 240 | ||
245 | tsk = current; | 241 | tsk = current; |
@@ -248,8 +244,7 @@ int sys_vm86(unsigned long cmd, unsigned long arg) | |||
248 | case VM86_FREE_IRQ: | 244 | case VM86_FREE_IRQ: |
249 | case VM86_GET_IRQ_BITS: | 245 | case VM86_GET_IRQ_BITS: |
250 | case VM86_GET_AND_RESET_IRQ: | 246 | case VM86_GET_AND_RESET_IRQ: |
251 | ret = do_vm86_irq_handling(cmd, (int)arg); | 247 | return do_vm86_irq_handling(cmd, (int)arg); |
252 | goto out; | ||
253 | case VM86_PLUS_INSTALL_CHECK: | 248 | case VM86_PLUS_INSTALL_CHECK: |
254 | /* | 249 | /* |
255 | * NOTE: on old vm86 stuff this will return the error | 250 | * NOTE: on old vm86 stuff this will return the error |
@@ -257,28 +252,23 @@ int sys_vm86(unsigned long cmd, unsigned long arg) | |||
257 | * interpreted as (invalid) address to vm86_struct. | 252 | * interpreted as (invalid) address to vm86_struct. |
258 | * So the installation check works. | 253 | * So the installation check works. |
259 | */ | 254 | */ |
260 | ret = 0; | 255 | return 0; |
261 | goto out; | ||
262 | } | 256 | } |
263 | 257 | ||
264 | /* we come here only for functions VM86_ENTER, VM86_ENTER_NO_BYPASS */ | 258 | /* we come here only for functions VM86_ENTER, VM86_ENTER_NO_BYPASS */ |
265 | ret = -EPERM; | ||
266 | if (tsk->thread.saved_sp0) | 259 | if (tsk->thread.saved_sp0) |
267 | goto out; | 260 | return -EPERM; |
268 | v86 = (struct vm86plus_struct __user *)arg; | 261 | v86 = (struct vm86plus_struct __user *)arg; |
269 | tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs, | 262 | tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs, |
270 | offsetof(struct kernel_vm86_struct, regs32) - | 263 | offsetof(struct kernel_vm86_struct, regs32) - |
271 | sizeof(info.regs)); | 264 | sizeof(info.regs)); |
272 | ret = -EFAULT; | ||
273 | if (tmp) | 265 | if (tmp) |
274 | goto out; | 266 | return -EFAULT; |
275 | info.regs32 = current_pt_regs(); | 267 | info.regs32 = current_pt_regs(); |
276 | info.vm86plus.is_vm86pus = 1; | 268 | info.vm86plus.is_vm86pus = 1; |
277 | tsk->thread.vm86_info = (struct vm86_struct __user *)v86; | 269 | tsk->thread.vm86_info = (struct vm86_struct __user *)v86; |
278 | do_sys_vm86(&info, tsk); | 270 | do_sys_vm86(&info, tsk); |
279 | ret = 0; /* we never return here */ | 271 | return 0; /* we never return here */ |
280 | out: | ||
281 | return ret; | ||
282 | } | 272 | } |
283 | 273 | ||
284 | 274 | ||