diff options
Diffstat (limited to 'arch/um/sys-x86_64')
-rw-r--r-- | arch/um/sys-x86_64/Makefile | 5 | ||||
-rw-r--r-- | arch/um/sys-x86_64/syscalls.c | 75 |
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? |
8 | lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ | 8 | lib-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 | ||
15 | USER_OBJS := ptrace_user.o sigcontext.o | 15 | USER_OBJS := ptrace_user.o sigcontext.o |
16 | 16 | ||
17 | SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c memcpy.S \ | 17 | SYMLINKS = 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 | ||
20 | include arch/um/scripts/Makefile.rules | 20 | include arch/um/scripts/Makefile.rules |
@@ -23,6 +23,7 @@ bitops.c-dir = lib | |||
23 | csum-copy.S-dir = lib | 23 | csum-copy.S-dir = lib |
24 | csum-partial.c-dir = lib | 24 | csum-partial.c-dir = lib |
25 | csum-wrappers.c-dir = lib | 25 | csum-wrappers.c-dir = lib |
26 | ldt.c-dir = /arch/um/sys-i386 | ||
26 | memcpy.S-dir = lib | 27 | memcpy.S-dir = lib |
27 | thunk.S-dir = lib | 28 | thunk.S-dir = lib |
28 | module.c-dir = kernel | 29 | module.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 |
32 | extern int modify_ldt(int func, void *ptr, unsigned long bytecount); | ||
33 | |||
34 | long 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 | ||
46 | extern int userspace_pid[]; | ||
47 | |||
48 | #include "skas_ptrace.h" | ||
49 | |||
50 | long 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 | |||
100 | long 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 | ||
107 | extern long arch_prctl(int code, unsigned long addr); | 32 | extern long arch_prctl(int code, unsigned long addr); |
108 | 33 | ||
109 | static long arch_prctl_tt(int code, unsigned long addr) | 34 | static long arch_prctl_tt(int code, unsigned long addr) |