aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/sys-x86_64')
-rw-r--r--arch/um/sys-x86_64/Makefile5
-rw-r--r--arch/um/sys-x86_64/syscalls.c75
2 files changed, 3 insertions, 77 deletions
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index 06c3633457a..ea977df395a 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -5,7 +5,7 @@
5# 5#
6 6
7#XXX: why into lib-y? 7#XXX: why into lib-y?
8lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ 8lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o ldt.o mem.o memcpy.o \
9 ptrace.o ptrace_user.o sigcontext.o signal.o stub.o \ 9 ptrace.o ptrace_user.o sigcontext.o signal.o stub.o \
10 stub_segv.o syscalls.o syscall_table.o sysrq.o thunk.o 10 stub_segv.o syscalls.o syscall_table.o sysrq.o thunk.o
11 11
@@ -14,7 +14,7 @@ obj-$(CONFIG_MODULES) += module.o um_module.o
14 14
15USER_OBJS := ptrace_user.o sigcontext.o 15USER_OBJS := ptrace_user.o sigcontext.o
16 16
17SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c memcpy.S \ 17SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c ldt.c memcpy.S \
18 thunk.S module.c 18 thunk.S module.c
19 19
20include arch/um/scripts/Makefile.rules 20include arch/um/scripts/Makefile.rules
@@ -23,6 +23,7 @@ bitops.c-dir = lib
23csum-copy.S-dir = lib 23csum-copy.S-dir = lib
24csum-partial.c-dir = lib 24csum-partial.c-dir = lib
25csum-wrappers.c-dir = lib 25csum-wrappers.c-dir = lib
26ldt.c-dir = /arch/um/sys-i386
26memcpy.S-dir = lib 27memcpy.S-dir = lib
27thunk.S-dir = lib 28thunk.S-dir = lib
28module.c-dir = kernel 29module.c-dir = kernel
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index 3259a4db453..6acee5c4ada 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -29,81 +29,6 @@ asmlinkage long sys_uname64(struct new_utsname __user * name)
29} 29}
30 30
31#ifdef CONFIG_MODE_TT 31#ifdef CONFIG_MODE_TT
32extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
33
34long sys_modify_ldt_tt(int func, void *ptr, unsigned long bytecount)
35{
36 /* XXX This should check VERIFY_WRITE depending on func, check this
37 * in i386 as well.
38 */
39 if (!access_ok(VERIFY_READ, ptr, bytecount))
40 return -EFAULT;
41 return(modify_ldt(func, ptr, bytecount));
42}
43#endif
44
45#ifdef CONFIG_MODE_SKAS
46extern int userspace_pid[];
47
48#include "skas_ptrace.h"
49
50long sys_modify_ldt_skas(int func, void *ptr, unsigned long bytecount)
51{
52 struct ptrace_ldt ldt;
53 void *buf;
54 int res, n;
55
56 buf = kmalloc(bytecount, GFP_KERNEL);
57 if(buf == NULL)
58 return(-ENOMEM);
59
60 res = 0;
61
62 switch(func){
63 case 1:
64 case 0x11:
65 res = copy_from_user(buf, ptr, bytecount);
66 break;
67 }
68
69 if(res != 0){
70 res = -EFAULT;
71 goto out;
72 }
73
74 ldt = ((struct ptrace_ldt) { .func = func,
75 .ptr = buf,
76 .bytecount = bytecount });
77#warning Need to look up userspace_pid by cpu
78 res = ptrace(PTRACE_LDT, userspace_pid[0], 0, (unsigned long) &ldt);
79 if(res < 0)
80 goto out;
81
82 switch(func){
83 case 0:
84 case 2:
85 n = res;
86 res = copy_to_user(ptr, buf, n);
87 if(res != 0)
88 res = -EFAULT;
89 else
90 res = n;
91 break;
92 }
93
94 out:
95 kfree(buf);
96 return(res);
97}
98#endif
99
100long sys_modify_ldt(int func, void *ptr, unsigned long bytecount)
101{
102 return(CHOOSE_MODE_PROC(sys_modify_ldt_tt, sys_modify_ldt_skas, func,
103 ptr, bytecount));
104}
105
106#ifdef CONFIG_MODE_TT
107extern long arch_prctl(int code, unsigned long addr); 32extern long arch_prctl(int code, unsigned long addr);
108 33
109static long arch_prctl_tt(int code, unsigned long addr) 34static long arch_prctl_tt(int code, unsigned long addr)