diff options
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/Kconfig_net | 2 | ||||
-rw-r--r-- | arch/um/Makefile | 30 | ||||
-rw-r--r-- | arch/um/Makefile-i386 | 31 | ||||
-rw-r--r-- | arch/um/Makefile-x86_64 | 6 | ||||
-rw-r--r-- | arch/um/drivers/Makefile | 17 | ||||
-rw-r--r-- | arch/um/kernel/uml.lds.S | 4 | ||||
-rw-r--r-- | arch/um/scripts/Makefile.unmap | 4 | ||||
-rw-r--r-- | arch/um/sys-i386/ldt.c | 114 | ||||
-rw-r--r-- | arch/um/sys-i386/unmap.c | 2 | ||||
-rw-r--r-- | arch/um/sys-x86_64/signal.c | 2 | ||||
-rw-r--r-- | arch/um/sys-x86_64/unmap.c | 2 |
11 files changed, 125 insertions, 89 deletions
diff --git a/arch/um/Kconfig_net b/arch/um/Kconfig_net index 1c2f9a70d91d..fa2ab2dd78b7 100644 --- a/arch/um/Kconfig_net +++ b/arch/um/Kconfig_net | |||
@@ -135,7 +135,7 @@ config UML_NET_MCAST | |||
135 | 135 | ||
136 | config UML_NET_PCAP | 136 | config UML_NET_PCAP |
137 | bool "pcap transport" | 137 | bool "pcap transport" |
138 | depends on UML_NET && BROKEN | 138 | depends on UML_NET && EXPERIMENTAL |
139 | help | 139 | help |
140 | The pcap transport makes a pcap packet stream on the host look | 140 | The pcap transport makes a pcap packet stream on the host look |
141 | like an ethernet device inside UML. This is useful for making | 141 | like an ethernet device inside UML. This is useful for making |
diff --git a/arch/um/Makefile b/arch/um/Makefile index 4a375bbac109..eb4ac403bd93 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile | |||
@@ -51,25 +51,26 @@ MRPROPER_DIRS += $(ARCH_DIR)/include2 | |||
51 | endif | 51 | endif |
52 | SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH) | 52 | SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH) |
53 | 53 | ||
54 | include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH) | 54 | # -Dvmap=kernel_vmap affects everything, and prevents anything from |
55 | # referencing the libpcap.o symbol so named. | ||
56 | |||
57 | CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ | ||
58 | $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap | ||
55 | 59 | ||
56 | core-y += $(SUBARCH_CORE) | 60 | USER_CFLAGS := $(patsubst -I%,,$(CFLAGS)) |
57 | libs-y += $(SUBARCH_LIBS) | 61 | USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \ |
62 | $(MODE_INCLUDE) | ||
58 | 63 | ||
59 | # -Derrno=kernel_errno - This turns all kernel references to errno into | 64 | # -Derrno=kernel_errno - This turns all kernel references to errno into |
60 | # kernel_errno to separate them from the libc errno. This allows -fno-common | 65 | # kernel_errno to separate them from the libc errno. This allows -fno-common |
61 | # in CFLAGS. Otherwise, it would cause ld to complain about the two different | 66 | # in CFLAGS. Otherwise, it would cause ld to complain about the two different |
62 | # errnos. | 67 | # errnos. |
63 | 68 | ||
64 | CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ | ||
65 | $(ARCH_INCLUDE) $(MODE_INCLUDE) | ||
66 | |||
67 | USER_CFLAGS := $(patsubst -I%,,$(CFLAGS)) | ||
68 | USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \ | ||
69 | $(MODE_INCLUDE) $(ARCH_USER_CFLAGS) | ||
70 | CFLAGS += -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask | 69 | CFLAGS += -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask |
71 | CFLAGS += $(call cc-option,-fno-unit-at-a-time,) | 70 | CFLAGS += $(call cc-option,-fno-unit-at-a-time,) |
72 | 71 | ||
72 | include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH) | ||
73 | |||
73 | #This will adjust *FLAGS accordingly to the platform. | 74 | #This will adjust *FLAGS accordingly to the platform. |
74 | include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) | 75 | include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) |
75 | 76 | ||
@@ -116,18 +117,19 @@ CONFIG_KERNEL_STACK_ORDER ?= 2 | |||
116 | STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] ) | 117 | STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] ) |
117 | 118 | ||
118 | ifndef START | 119 | ifndef START |
119 | START = $$(($(TOP_ADDR) - $(SIZE))) | 120 | START = $(shell echo $$[ $(TOP_ADDR) - $(SIZE) ] ) |
120 | endif | 121 | endif |
121 | 122 | ||
122 | CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \ | 123 | CPPFLAGS_vmlinux.lds = -U$(SUBARCH) \ |
123 | -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \ | 124 | -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \ |
124 | -DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE-y) \ | 125 | -DELF_FORMAT="$(ELF_FORMAT)" $(CPP_MODE-y) \ |
125 | -DKERNEL_STACK_SIZE=$(STACK_SIZE) -DSUBARCH=$(SUBARCH)) | 126 | -DKERNEL_STACK_SIZE=$(STACK_SIZE) \ |
127 | -DUNMAP_PATH=arch/um/sys-$(SUBARCH)/unmap_fin.o | ||
126 | 128 | ||
127 | #The wrappers will select whether using "malloc" or the kernel allocator. | 129 | #The wrappers will select whether using "malloc" or the kernel allocator. |
128 | LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc | 130 | LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc |
129 | 131 | ||
130 | CFLAGS_vmlinux = $(LINK-y) $(LINK_WRAPS) | 132 | CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) |
131 | define cmd_vmlinux__ | 133 | define cmd_vmlinux__ |
132 | $(CC) $(CFLAGS_vmlinux) -o $@ \ | 134 | $(CC) $(CFLAGS_vmlinux) -o $@ \ |
133 | -Wl,-T,$(vmlinux-lds) $(vmlinux-init) \ | 135 | -Wl,-T,$(vmlinux-lds) $(vmlinux-init) \ |
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386 index 301059062a3e..93d0818fa816 100644 --- a/arch/um/Makefile-i386 +++ b/arch/um/Makefile-i386 | |||
@@ -1,4 +1,4 @@ | |||
1 | SUBARCH_CORE := arch/um/sys-i386/ arch/i386/crypto/ | 1 | core-y += arch/um/sys-i386/ arch/i386/crypto/ |
2 | 2 | ||
3 | TOP_ADDR := $(CONFIG_TOP_ADDR) | 3 | TOP_ADDR := $(CONFIG_TOP_ADDR) |
4 | 4 | ||
@@ -8,21 +8,32 @@ ifeq ($(CONFIG_MODE_SKAS),y) | |||
8 | endif | 8 | endif |
9 | endif | 9 | endif |
10 | 10 | ||
11 | LDFLAGS += -m elf_i386 | ||
12 | ELF_ARCH := $(SUBARCH) | ||
13 | ELF_FORMAT := elf32-$(SUBARCH) | ||
14 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S | ||
15 | |||
16 | ifeq ("$(origin SUBARCH)", "command line") | ||
17 | ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)") | ||
18 | CFLAGS += $(call cc-option,-m32) | ||
19 | USER_CFLAGS += $(call cc-option,-m32) | ||
20 | HOSTCFLAGS += $(call cc-option,-m32) | ||
21 | HOSTLDFLAGS += $(call cc-option,-m32) | ||
22 | AFLAGS += $(call cc-option,-m32) | ||
23 | LINK-y += $(call cc-option,-m32) | ||
24 | UML_OBJCOPYFLAGS += -F $(ELF_FORMAT) | ||
25 | |||
26 | export LDFLAGS HOSTCFLAGS HOSTLDFLAGS UML_OBJCOPYFLAGS | ||
27 | endif | ||
28 | endif | ||
29 | |||
11 | CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH) $(STUB_CFLAGS) | 30 | CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH) $(STUB_CFLAGS) |
12 | ARCH_USER_CFLAGS := | ||
13 | 31 | ||
14 | ifneq ($(CONFIG_GPROF),y) | 32 | ifneq ($(CONFIG_GPROF),y) |
15 | ARCH_CFLAGS += -DUM_FASTCALL | 33 | ARCH_CFLAGS += -DUM_FASTCALL |
16 | endif | 34 | endif |
17 | 35 | ||
18 | ELF_ARCH := $(SUBARCH) | 36 | SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h |
19 | ELF_FORMAT := elf32-$(SUBARCH) | ||
20 | |||
21 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S | ||
22 | |||
23 | SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util | ||
24 | |||
25 | SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h | ||
26 | 37 | ||
27 | prepare: $(SYS_HEADERS) | 38 | prepare: $(SYS_HEADERS) |
28 | 39 | ||
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64 index d80bd0052e6b..aa2f7174ebca 100644 --- a/arch/um/Makefile-x86_64 +++ b/arch/um/Makefile-x86_64 | |||
@@ -1,11 +1,13 @@ | |||
1 | # Copyright 2003 - 2004 Pathscale, Inc | 1 | # Copyright 2003 - 2004 Pathscale, Inc |
2 | # Released under the GPL | 2 | # Released under the GPL |
3 | 3 | ||
4 | SUBARCH_LIBS := arch/um/sys-x86_64/ | 4 | libs-y += arch/um/sys-x86_64/ |
5 | START := 0x60000000 | 5 | START := 0x60000000 |
6 | 6 | ||
7 | #We #undef __x86_64__ for kernelspace, not for userspace where | ||
8 | #it's needed for headers to work! | ||
7 | CFLAGS += -U__$(SUBARCH)__ -fno-builtin $(STUB_CFLAGS) | 9 | CFLAGS += -U__$(SUBARCH)__ -fno-builtin $(STUB_CFLAGS) |
8 | ARCH_USER_CFLAGS := -D__x86_64__ | 10 | USER_CFLAGS += -fno-builtin |
9 | 11 | ||
10 | ELF_ARCH := i386:x86-64 | 12 | ELF_ARCH := i386:x86-64 |
11 | ELF_FORMAT := elf64-x86-64 | 13 | ELF_FORMAT := elf64-x86-64 |
diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile index b2de9916c32c..d6c31a95b887 100644 --- a/arch/um/drivers/Makefile +++ b/arch/um/drivers/Makefile | |||
@@ -10,7 +10,6 @@ slip-objs := slip_kern.o slip_user.o | |||
10 | slirp-objs := slirp_kern.o slirp_user.o | 10 | slirp-objs := slirp_kern.o slirp_user.o |
11 | daemon-objs := daemon_kern.o daemon_user.o | 11 | daemon-objs := daemon_kern.o daemon_user.o |
12 | mcast-objs := mcast_kern.o mcast_user.o | 12 | mcast-objs := mcast_kern.o mcast_user.o |
13 | #pcap-objs := pcap_kern.o pcap_user.o $(PCAP) | ||
14 | net-objs := net_kern.o net_user.o | 13 | net-objs := net_kern.o net_user.o |
15 | mconsole-objs := mconsole_kern.o mconsole_user.o | 14 | mconsole-objs := mconsole_kern.o mconsole_user.o |
16 | hostaudio-objs := hostaudio_kern.o | 15 | hostaudio-objs := hostaudio_kern.o |
@@ -18,6 +17,17 @@ ubd-objs := ubd_kern.o ubd_user.o | |||
18 | port-objs := port_kern.o port_user.o | 17 | port-objs := port_kern.o port_user.o |
19 | harddog-objs := harddog_kern.o harddog_user.o | 18 | harddog-objs := harddog_kern.o harddog_user.o |
20 | 19 | ||
20 | LDFLAGS_pcap.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libpcap.a) | ||
21 | |||
22 | $(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o | ||
23 | $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o) | ||
24 | #XXX: The call below does not work because the flags are added before the | ||
25 | # object name, so nothing from the library gets linked. | ||
26 | #$(call if_changed,ld) | ||
27 | |||
28 | # When the above is fixed, don't forget to add this too! | ||
29 | #targets := $(obj)/pcap.o | ||
30 | |||
21 | obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o | 31 | obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o |
22 | obj-$(CONFIG_SSL) += ssl.o | 32 | obj-$(CONFIG_SSL) += ssl.o |
23 | obj-$(CONFIG_STDERR_CONSOLE) += stderr_console.o | 33 | obj-$(CONFIG_STDERR_CONSOLE) += stderr_console.o |
@@ -26,7 +36,7 @@ obj-$(CONFIG_UML_NET_SLIP) += slip.o slip_common.o | |||
26 | obj-$(CONFIG_UML_NET_SLIRP) += slirp.o slip_common.o | 36 | obj-$(CONFIG_UML_NET_SLIRP) += slirp.o slip_common.o |
27 | obj-$(CONFIG_UML_NET_DAEMON) += daemon.o | 37 | obj-$(CONFIG_UML_NET_DAEMON) += daemon.o |
28 | obj-$(CONFIG_UML_NET_MCAST) += mcast.o | 38 | obj-$(CONFIG_UML_NET_MCAST) += mcast.o |
29 | #obj-$(CONFIG_UML_NET_PCAP) += pcap.o $(PCAP) | 39 | obj-$(CONFIG_UML_NET_PCAP) += pcap.o |
30 | obj-$(CONFIG_UML_NET) += net.o | 40 | obj-$(CONFIG_UML_NET) += net.o |
31 | obj-$(CONFIG_MCONSOLE) += mconsole.o | 41 | obj-$(CONFIG_MCONSOLE) += mconsole.o |
32 | obj-$(CONFIG_MMAPPER) += mmapper_kern.o | 42 | obj-$(CONFIG_MMAPPER) += mmapper_kern.o |
@@ -41,6 +51,7 @@ obj-$(CONFIG_UML_WATCHDOG) += harddog.o | |||
41 | obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o | 51 | obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o |
42 | obj-$(CONFIG_UML_RANDOM) += random.o | 52 | obj-$(CONFIG_UML_RANDOM) += random.o |
43 | 53 | ||
44 | USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o | 54 | # pcap_user.o must be added explicitly. |
55 | USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o | ||
45 | 56 | ||
46 | include arch/um/scripts/Makefile.rules | 57 | include arch/um/scripts/Makefile.rules |
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S index 163476a8cb1b..b03326d391c9 100644 --- a/arch/um/kernel/uml.lds.S +++ b/arch/um/kernel/uml.lds.S | |||
@@ -16,8 +16,8 @@ SECTIONS | |||
16 | __binary_start = .; | 16 | __binary_start = .; |
17 | 17 | ||
18 | #ifdef MODE_TT | 18 | #ifdef MODE_TT |
19 | .remap_data : { arch/um/sys-SUBARCH/unmap_fin.o (.data .bss) } | 19 | .remap_data : { UNMAP_PATH (.data .bss) } |
20 | .remap : { arch/um/sys-SUBARCH/unmap_fin.o (.text) } | 20 | .remap : { UNMAP_PATH (.text) } |
21 | 21 | ||
22 | . = ALIGN(4096); /* Init code and data */ | 22 | . = ALIGN(4096); /* Init code and data */ |
23 | #endif | 23 | #endif |
diff --git a/arch/um/scripts/Makefile.unmap b/arch/um/scripts/Makefile.unmap index 37a8f9765295..802d027a1e13 100644 --- a/arch/um/scripts/Makefile.unmap +++ b/arch/um/scripts/Makefile.unmap | |||
@@ -12,8 +12,8 @@ $(obj)/unmap.o: _c_flags = $(call unprofile,$(CFLAGS)) | |||
12 | 12 | ||
13 | quiet_cmd_wrapld = LD $@ | 13 | quiet_cmd_wrapld = LD $@ |
14 | define cmd_wrapld | 14 | define cmd_wrapld |
15 | $(LD) -r -o $(obj)/unmap_tmp.o $< $(shell $(CC) -print-file-name=libc.a); \ | 15 | $(LD) $(LDFLAGS) -r -o $(obj)/unmap_tmp.o $< $(shell $(CC) $(CFLAGS) -print-file-name=libc.a); \ |
16 | $(OBJCOPY) $(obj)/unmap_tmp.o $@ -G switcheroo | 16 | $(OBJCOPY) $(UML_OBJCOPYFLAGS) $(obj)/unmap_tmp.o $@ -G switcheroo |
17 | endef | 17 | endef |
18 | 18 | ||
19 | $(obj)/unmap_fin.o : $(obj)/unmap.o FORCE | 19 | $(obj)/unmap_fin.o : $(obj)/unmap.o FORCE |
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c index dc755b0b9db8..bd3c34aa52e5 100644 --- a/arch/um/sys-i386/ldt.c +++ b/arch/um/sys-i386/ldt.c | |||
@@ -4,96 +4,106 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/config.h" | 6 | #include "linux/config.h" |
7 | #include "linux/sched.h" | ||
7 | #include "linux/slab.h" | 8 | #include "linux/slab.h" |
9 | #include "linux/types.h" | ||
8 | #include "asm/uaccess.h" | 10 | #include "asm/uaccess.h" |
9 | #include "asm/ptrace.h" | 11 | #include "asm/ptrace.h" |
12 | #include "asm/smp.h" | ||
13 | #include "asm/ldt.h" | ||
10 | #include "choose-mode.h" | 14 | #include "choose-mode.h" |
11 | #include "kern.h" | 15 | #include "kern.h" |
16 | #include "mode_kern.h" | ||
12 | 17 | ||
13 | #ifdef CONFIG_MODE_TT | 18 | #ifdef CONFIG_MODE_TT |
14 | extern int modify_ldt(int func, void *ptr, unsigned long bytecount); | ||
15 | 19 | ||
16 | /* XXX this needs copy_to_user and copy_from_user */ | 20 | extern int modify_ldt(int func, void *ptr, unsigned long bytecount); |
17 | 21 | ||
18 | int sys_modify_ldt_tt(int func, void __user *ptr, unsigned long bytecount) | 22 | static int do_modify_ldt_tt(int func, void *ptr, unsigned long bytecount) |
19 | { | 23 | { |
20 | if (!access_ok(VERIFY_READ, ptr, bytecount)) | ||
21 | return -EFAULT; | ||
22 | |||
23 | return modify_ldt(func, ptr, bytecount); | 24 | return modify_ldt(func, ptr, bytecount); |
24 | } | 25 | } |
26 | |||
25 | #endif | 27 | #endif |
26 | 28 | ||
27 | #ifdef CONFIG_MODE_SKAS | 29 | #ifdef CONFIG_MODE_SKAS |
28 | extern int userspace_pid[]; | ||
29 | 30 | ||
31 | #include "skas.h" | ||
30 | #include "skas_ptrace.h" | 32 | #include "skas_ptrace.h" |
31 | 33 | ||
32 | int sys_modify_ldt_skas(int func, void __user *ptr, unsigned long bytecount) | 34 | static int do_modify_ldt_skas(int func, void *ptr, unsigned long bytecount) |
33 | { | 35 | { |
34 | struct ptrace_ldt ldt; | 36 | struct ptrace_ldt ldt; |
35 | void *buf; | 37 | u32 cpu; |
36 | int res, n; | 38 | int res; |
37 | 39 | ||
38 | buf = kmalloc(bytecount, GFP_KERNEL); | 40 | ldt = ((struct ptrace_ldt) { .func = func, |
39 | if(buf == NULL) | 41 | .ptr = ptr, |
40 | return(-ENOMEM); | 42 | .bytecount = bytecount }); |
41 | 43 | ||
42 | res = 0; | 44 | cpu = get_cpu(); |
45 | res = ptrace(PTRACE_LDT, userspace_pid[cpu], 0, (unsigned long) &ldt); | ||
46 | put_cpu(); | ||
47 | |||
48 | return res; | ||
49 | } | ||
50 | #endif | ||
51 | |||
52 | int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) | ||
53 | { | ||
54 | struct user_desc info; | ||
55 | int res = 0; | ||
56 | void *buf = NULL; | ||
57 | void *p = NULL; /* What we pass to host. */ | ||
43 | 58 | ||
44 | switch(func){ | 59 | switch(func){ |
45 | case 1: | 60 | case 1: |
46 | case 0x11: | 61 | case 0x11: /* write_ldt */ |
47 | res = copy_from_user(buf, ptr, bytecount); | 62 | /* Do this check now to avoid overflows. */ |
48 | break; | 63 | if (bytecount != sizeof(struct user_desc)) { |
49 | } | 64 | res = -EINVAL; |
65 | goto out; | ||
66 | } | ||
67 | |||
68 | if(copy_from_user(&info, ptr, sizeof(info))) { | ||
69 | res = -EFAULT; | ||
70 | goto out; | ||
71 | } | ||
50 | 72 | ||
51 | if(res != 0){ | 73 | p = &info; |
52 | res = -EFAULT; | 74 | break; |
75 | case 0: | ||
76 | case 2: /* read_ldt */ | ||
77 | |||
78 | /* The use of info avoids kmalloc on the write case, not on the | ||
79 | * read one. */ | ||
80 | buf = kmalloc(bytecount, GFP_KERNEL); | ||
81 | if (!buf) { | ||
82 | res = -ENOMEM; | ||
83 | goto out; | ||
84 | } | ||
85 | p = buf; | ||
86 | default: | ||
87 | res = -ENOSYS; | ||
53 | goto out; | 88 | goto out; |
54 | } | 89 | } |
55 | 90 | ||
56 | ldt = ((struct ptrace_ldt) { .func = func, | 91 | res = CHOOSE_MODE_PROC(do_modify_ldt_tt, do_modify_ldt_skas, func, |
57 | .ptr = buf, | 92 | p, bytecount); |
58 | .bytecount = bytecount }); | ||
59 | #warning Need to look up userspace_pid by cpu | ||
60 | res = ptrace(PTRACE_LDT, userspace_pid[0], 0, (unsigned long) &ldt); | ||
61 | if(res < 0) | 93 | if(res < 0) |
62 | goto out; | 94 | goto out; |
63 | 95 | ||
64 | switch(func){ | 96 | switch(func){ |
65 | case 0: | 97 | case 0: |
66 | case 2: | 98 | case 2: |
67 | n = res; | 99 | /* Modify_ldt was for reading and returned the number of read |
68 | res = copy_to_user(ptr, buf, n); | 100 | * bytes.*/ |
69 | if(res != 0) | 101 | if(copy_to_user(ptr, p, res)) |
70 | res = -EFAULT; | 102 | res = -EFAULT; |
71 | else | ||
72 | res = n; | ||
73 | break; | 103 | break; |
74 | } | 104 | } |
75 | 105 | ||
76 | out: | 106 | out: |
77 | kfree(buf); | 107 | kfree(buf); |
78 | return(res); | 108 | return res; |
79 | } | ||
80 | #endif | ||
81 | |||
82 | int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) | ||
83 | { | ||
84 | return(CHOOSE_MODE_PROC(sys_modify_ldt_tt, sys_modify_ldt_skas, func, | ||
85 | ptr, bytecount)); | ||
86 | } | 109 | } |
87 | |||
88 | |||
89 | |||
90 | /* | ||
91 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
92 | * Emacs will notice this stuff at the end of the file and automatically | ||
93 | * adjust the settings for this buffer only. This must remain at the end | ||
94 | * of the file. | ||
95 | * --------------------------------------------------------------------------- | ||
96 | * Local variables: | ||
97 | * c-file-style: "linux" | ||
98 | * End: | ||
99 | */ | ||
diff --git a/arch/um/sys-i386/unmap.c b/arch/um/sys-i386/unmap.c index 136875263d27..1b0ad0e4adcd 100644 --- a/arch/um/sys-i386/unmap.c +++ b/arch/um/sys-i386/unmap.c | |||
@@ -15,7 +15,7 @@ int switcheroo(int fd, int prot, void *from, void *to, int size) | |||
15 | if(munmap(to, size) < 0){ | 15 | if(munmap(to, size) < 0){ |
16 | return(-1); | 16 | return(-1); |
17 | } | 17 | } |
18 | if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){ | 18 | if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1 ){ |
19 | return(-1); | 19 | return(-1); |
20 | } | 20 | } |
21 | if(munmap(from, size) < 0){ | 21 | if(munmap(from, size) < 0){ |
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c index 73a7926f7370..8fdaed06c10d 100644 --- a/arch/um/sys-x86_64/signal.c +++ b/arch/um/sys-x86_64/signal.c | |||
@@ -168,7 +168,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, | |||
168 | 168 | ||
169 | frame = (struct rt_sigframe __user *) | 169 | frame = (struct rt_sigframe __user *) |
170 | round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; | 170 | round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; |
171 | ((unsigned char *) frame) -= 128; | 171 | frame = (struct rt_sigframe *) ((unsigned long) frame - 128); |
172 | 172 | ||
173 | if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) | 173 | if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) |
174 | goto out; | 174 | goto out; |
diff --git a/arch/um/sys-x86_64/unmap.c b/arch/um/sys-x86_64/unmap.c index bc7094cce47e..f4a4bffd8a18 100644 --- a/arch/um/sys-x86_64/unmap.c +++ b/arch/um/sys-x86_64/unmap.c | |||
@@ -15,7 +15,7 @@ int switcheroo(int fd, int prot, void *from, void *to, int size) | |||
15 | if(munmap(to, size) < 0){ | 15 | if(munmap(to, size) < 0){ |
16 | return(-1); | 16 | return(-1); |
17 | } | 17 | } |
18 | if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){ | 18 | if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1){ |
19 | return(-1); | 19 | return(-1); |
20 | } | 20 | } |
21 | if(munmap(from, size) < 0){ | 21 | if(munmap(from, size) < 0){ |