diff options
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/Kconfig | 10 | ||||
-rw-r--r-- | arch/um/Kconfig.i386 | 10 | ||||
-rw-r--r-- | arch/um/Makefile-i386 | 1 | ||||
-rw-r--r-- | arch/um/drivers/chan_kern.c | 5 | ||||
-rw-r--r-- | arch/um/drivers/chan_user.c | 2 | ||||
-rw-r--r-- | arch/um/drivers/daemon_user.c | 6 | ||||
-rw-r--r-- | arch/um/drivers/fd.c | 9 | ||||
-rw-r--r-- | arch/um/drivers/mcast_user.c | 20 | ||||
-rw-r--r-- | arch/um/drivers/port_user.c | 9 | ||||
-rw-r--r-- | arch/um/drivers/pty.c | 11 | ||||
-rw-r--r-- | arch/um/drivers/tty.c | 9 | ||||
-rw-r--r-- | arch/um/drivers/xterm.c | 9 | ||||
-rw-r--r-- | arch/um/include/chan_user.h | 4 | ||||
-rw-r--r-- | arch/um/include/um_uaccess.h | 19 | ||||
-rw-r--r-- | arch/um/kernel/skas/include/uaccess-skas.h | 10 | ||||
-rw-r--r-- | arch/um/kernel/skas/uaccess.c | 8 | ||||
-rw-r--r-- | arch/um/kernel/trap_kern.c | 9 | ||||
-rw-r--r-- | arch/um/kernel/tt/include/uaccess-tt.h | 8 | ||||
-rw-r--r-- | arch/um/kernel/tt/uaccess.c | 8 |
19 files changed, 71 insertions, 96 deletions
diff --git a/arch/um/Kconfig b/arch/um/Kconfig index 3b5f47c46907..563301fe5df8 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig | |||
@@ -7,7 +7,6 @@ config UML | |||
7 | bool | 7 | bool |
8 | default y | 8 | default y |
9 | 9 | ||
10 | # XXX: does UM have a mmu/swap? | ||
11 | config MMU | 10 | config MMU |
12 | bool | 11 | bool |
13 | default y | 12 | default y |
@@ -36,12 +35,6 @@ config IRQ_RELEASE_METHOD | |||
36 | bool | 35 | bool |
37 | default y | 36 | default y |
38 | 37 | ||
39 | menu "Host processor type and features" | ||
40 | |||
41 | source "arch/i386/Kconfig.cpu" | ||
42 | |||
43 | endmenu | ||
44 | |||
45 | menu "UML-specific options" | 38 | menu "UML-specific options" |
46 | 39 | ||
47 | config MODE_TT | 40 | config MODE_TT |
@@ -209,7 +202,8 @@ config MAGIC_SYSRQ | |||
209 | config SMP | 202 | config SMP |
210 | bool "Symmetric multi-processing support (EXPERIMENTAL)" | 203 | bool "Symmetric multi-processing support (EXPERIMENTAL)" |
211 | default n | 204 | default n |
212 | depends on (MODE_TT && EXPERIMENTAL && !SMP_BROKEN) || (BROKEN && SMP_BROKEN) | 205 | #SMP_BROKEN is for x86_64. |
206 | depends on MODE_TT && EXPERIMENTAL && (!SMP_BROKEN || (BROKEN && SMP_BROKEN)) | ||
213 | help | 207 | help |
214 | This option enables UML SMP support. | 208 | This option enables UML SMP support. |
215 | It is NOT related to having a real SMP box. Not directly, at least. | 209 | It is NOT related to having a real SMP box. Not directly, at least. |
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386 index 5d92cacd56c6..c71b39a677aa 100644 --- a/arch/um/Kconfig.i386 +++ b/arch/um/Kconfig.i386 | |||
@@ -1,3 +1,9 @@ | |||
1 | menu "Host processor type and features" | ||
2 | |||
3 | source "arch/i386/Kconfig.cpu" | ||
4 | |||
5 | endmenu | ||
6 | |||
1 | config UML_X86 | 7 | config UML_X86 |
2 | bool | 8 | bool |
3 | default y | 9 | default y |
@@ -42,7 +48,3 @@ config ARCH_HAS_SC_SIGNALS | |||
42 | config ARCH_REUSE_HOST_VSYSCALL_AREA | 48 | config ARCH_REUSE_HOST_VSYSCALL_AREA |
43 | bool | 49 | bool |
44 | default y | 50 | default y |
45 | |||
46 | config X86_CMPXCHG | ||
47 | bool | ||
48 | default y | ||
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386 index 1f7dcb064aee..7a0e04e34bf9 100644 --- a/arch/um/Makefile-i386 +++ b/arch/um/Makefile-i386 | |||
@@ -35,4 +35,3 @@ cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) | |||
35 | 35 | ||
36 | CFLAGS += $(cflags-y) | 36 | CFLAGS += $(cflags-y) |
37 | USER_CFLAGS += $(cflags-y) | 37 | USER_CFLAGS += $(cflags-y) |
38 | |||
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index 16e7dc89f61d..5b58fad45290 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c | |||
@@ -89,8 +89,7 @@ static int not_configged_write(int fd, const char *buf, int len, void *data) | |||
89 | return(-EIO); | 89 | return(-EIO); |
90 | } | 90 | } |
91 | 91 | ||
92 | static int not_configged_console_write(int fd, const char *buf, int len, | 92 | static int not_configged_console_write(int fd, const char *buf, int len) |
93 | void *data) | ||
94 | { | 93 | { |
95 | my_puts("Using a channel type which is configured out of " | 94 | my_puts("Using a channel type which is configured out of " |
96 | "UML\n"); | 95 | "UML\n"); |
@@ -299,7 +298,7 @@ int console_write_chan(struct list_head *chans, const char *buf, int len) | |||
299 | chan = list_entry(ele, struct chan, list); | 298 | chan = list_entry(ele, struct chan, list); |
300 | if(!chan->output || (chan->ops->console_write == NULL)) | 299 | if(!chan->output || (chan->ops->console_write == NULL)) |
301 | continue; | 300 | continue; |
302 | n = chan->ops->console_write(chan->fd, buf, len, chan->data); | 301 | n = chan->ops->console_write(chan->fd, buf, len); |
303 | if(chan->primary) ret = n; | 302 | if(chan->primary) ret = n; |
304 | } | 303 | } |
305 | return(ret); | 304 | return(ret); |
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c index 1c55d5802489..5d50d4a44abf 100644 --- a/arch/um/drivers/chan_user.c +++ b/arch/um/drivers/chan_user.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include "choose-mode.h" | 20 | #include "choose-mode.h" |
21 | #include "mode.h" | 21 | #include "mode.h" |
22 | 22 | ||
23 | int generic_console_write(int fd, const char *buf, int n, void *unused) | 23 | int generic_console_write(int fd, const char *buf, int n) |
24 | { | 24 | { |
25 | struct termios save, new; | 25 | struct termios save, new; |
26 | int err; | 26 | int err; |
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c index c1b03f7c1daa..1bb085b2824d 100644 --- a/arch/um/drivers/daemon_user.c +++ b/arch/um/drivers/daemon_user.c | |||
@@ -98,7 +98,7 @@ static int connect_to_switch(struct daemon_data *pri) | |||
98 | printk("daemon_open : control setup request failed, err = %d\n", | 98 | printk("daemon_open : control setup request failed, err = %d\n", |
99 | -n); | 99 | -n); |
100 | err = -ENOTCONN; | 100 | err = -ENOTCONN; |
101 | goto out; | 101 | goto out_free; |
102 | } | 102 | } |
103 | 103 | ||
104 | n = os_read_file(pri->control, sun, sizeof(*sun)); | 104 | n = os_read_file(pri->control, sun, sizeof(*sun)); |
@@ -106,12 +106,14 @@ static int connect_to_switch(struct daemon_data *pri) | |||
106 | printk("daemon_open : read of data socket failed, err = %d\n", | 106 | printk("daemon_open : read of data socket failed, err = %d\n", |
107 | -n); | 107 | -n); |
108 | err = -ENOTCONN; | 108 | err = -ENOTCONN; |
109 | goto out_close; | 109 | goto out_free; |
110 | } | 110 | } |
111 | 111 | ||
112 | pri->data_addr = sun; | 112 | pri->data_addr = sun; |
113 | return(fd); | 113 | return(fd); |
114 | 114 | ||
115 | out_free: | ||
116 | kfree(sun); | ||
115 | out_close: | 117 | out_close: |
116 | os_close_file(fd); | 118 | os_close_file(fd); |
117 | out: | 119 | out: |
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c index f0b888f66e05..3296e86a03a5 100644 --- a/arch/um/drivers/fd.c +++ b/arch/um/drivers/fd.c | |||
@@ -76,13 +76,6 @@ static void fd_close(int fd, void *d) | |||
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | static int fd_console_write(int fd, const char *buf, int n, void *d) | ||
80 | { | ||
81 | struct fd_chan *data = d; | ||
82 | |||
83 | return(generic_console_write(fd, buf, n, &data->tt)); | ||
84 | } | ||
85 | |||
86 | struct chan_ops fd_ops = { | 79 | struct chan_ops fd_ops = { |
87 | .type = "fd", | 80 | .type = "fd", |
88 | .init = fd_init, | 81 | .init = fd_init, |
@@ -90,7 +83,7 @@ struct chan_ops fd_ops = { | |||
90 | .close = fd_close, | 83 | .close = fd_close, |
91 | .read = generic_read, | 84 | .read = generic_read, |
92 | .write = generic_write, | 85 | .write = generic_write, |
93 | .console_write = fd_console_write, | 86 | .console_write = generic_console_write, |
94 | .window_size = generic_window_size, | 87 | .window_size = generic_window_size, |
95 | .free = generic_free, | 88 | .free = generic_free, |
96 | .winch = 1, | 89 | .winch = 1, |
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c index 5db136e2651c..afe85bfa66e0 100644 --- a/arch/um/drivers/mcast_user.c +++ b/arch/um/drivers/mcast_user.c | |||
@@ -54,7 +54,7 @@ static int mcast_open(void *data) | |||
54 | struct mcast_data *pri = data; | 54 | struct mcast_data *pri = data; |
55 | struct sockaddr_in *sin = pri->mcast_addr; | 55 | struct sockaddr_in *sin = pri->mcast_addr; |
56 | struct ip_mreq mreq; | 56 | struct ip_mreq mreq; |
57 | int fd, yes = 1, err = 0; | 57 | int fd, yes = 1, err = -EINVAL; |
58 | 58 | ||
59 | 59 | ||
60 | if ((sin->sin_addr.s_addr == 0) || (sin->sin_port == 0)) | 60 | if ((sin->sin_addr.s_addr == 0) || (sin->sin_port == 0)) |
@@ -63,40 +63,40 @@ static int mcast_open(void *data) | |||
63 | fd = socket(AF_INET, SOCK_DGRAM, 0); | 63 | fd = socket(AF_INET, SOCK_DGRAM, 0); |
64 | 64 | ||
65 | if (fd < 0){ | 65 | if (fd < 0){ |
66 | err = -errno; | ||
66 | printk("mcast_open : data socket failed, errno = %d\n", | 67 | printk("mcast_open : data socket failed, errno = %d\n", |
67 | errno); | 68 | errno); |
68 | err = -errno; | ||
69 | goto out; | 69 | goto out; |
70 | } | 70 | } |
71 | 71 | ||
72 | if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) { | 72 | if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) { |
73 | err = -errno; | ||
73 | printk("mcast_open: SO_REUSEADDR failed, errno = %d\n", | 74 | printk("mcast_open: SO_REUSEADDR failed, errno = %d\n", |
74 | errno); | 75 | errno); |
75 | err = -errno; | ||
76 | goto out_close; | 76 | goto out_close; |
77 | } | 77 | } |
78 | 78 | ||
79 | /* set ttl according to config */ | 79 | /* set ttl according to config */ |
80 | if (setsockopt(fd, SOL_IP, IP_MULTICAST_TTL, &pri->ttl, | 80 | if (setsockopt(fd, SOL_IP, IP_MULTICAST_TTL, &pri->ttl, |
81 | sizeof(pri->ttl)) < 0) { | 81 | sizeof(pri->ttl)) < 0) { |
82 | err = -errno; | ||
82 | printk("mcast_open: IP_MULTICAST_TTL failed, error = %d\n", | 83 | printk("mcast_open: IP_MULTICAST_TTL failed, error = %d\n", |
83 | errno); | 84 | errno); |
84 | err = -errno; | ||
85 | goto out_close; | 85 | goto out_close; |
86 | } | 86 | } |
87 | 87 | ||
88 | /* set LOOP, so data does get fed back to local sockets */ | 88 | /* set LOOP, so data does get fed back to local sockets */ |
89 | if (setsockopt(fd, SOL_IP, IP_MULTICAST_LOOP, &yes, sizeof(yes)) < 0) { | 89 | if (setsockopt(fd, SOL_IP, IP_MULTICAST_LOOP, &yes, sizeof(yes)) < 0) { |
90 | err = -errno; | ||
90 | printk("mcast_open: IP_MULTICAST_LOOP failed, error = %d\n", | 91 | printk("mcast_open: IP_MULTICAST_LOOP failed, error = %d\n", |
91 | errno); | 92 | errno); |
92 | err = -errno; | ||
93 | goto out_close; | 93 | goto out_close; |
94 | } | 94 | } |
95 | 95 | ||
96 | /* bind socket to mcast address */ | 96 | /* bind socket to mcast address */ |
97 | if (bind(fd, (struct sockaddr *) sin, sizeof(*sin)) < 0) { | 97 | if (bind(fd, (struct sockaddr *) sin, sizeof(*sin)) < 0) { |
98 | printk("mcast_open : data bind failed, errno = %d\n", errno); | ||
99 | err = -errno; | 98 | err = -errno; |
99 | printk("mcast_open : data bind failed, errno = %d\n", errno); | ||
100 | goto out_close; | 100 | goto out_close; |
101 | } | 101 | } |
102 | 102 | ||
@@ -105,22 +105,22 @@ static int mcast_open(void *data) | |||
105 | mreq.imr_interface.s_addr = 0; | 105 | mreq.imr_interface.s_addr = 0; |
106 | if (setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP, | 106 | if (setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP, |
107 | &mreq, sizeof(mreq)) < 0) { | 107 | &mreq, sizeof(mreq)) < 0) { |
108 | err = -errno; | ||
108 | printk("mcast_open: IP_ADD_MEMBERSHIP failed, error = %d\n", | 109 | printk("mcast_open: IP_ADD_MEMBERSHIP failed, error = %d\n", |
109 | errno); | 110 | errno); |
110 | printk("There appears not to be a multicast-capable network " | 111 | printk("There appears not to be a multicast-capable network " |
111 | "interface on the host.\n"); | 112 | "interface on the host.\n"); |
112 | printk("eth0 should be configured in order to use the " | 113 | printk("eth0 should be configured in order to use the " |
113 | "multicast transport.\n"); | 114 | "multicast transport.\n"); |
114 | err = -errno; | 115 | goto out_close; |
115 | goto out_close; | ||
116 | } | 116 | } |
117 | 117 | ||
118 | return fd; | 118 | return fd; |
119 | 119 | ||
120 | out_close: | 120 | out_close: |
121 | os_close_file(fd); | 121 | os_close_file(fd); |
122 | out: | 122 | out: |
123 | return err; | 123 | return err; |
124 | } | 124 | } |
125 | 125 | ||
126 | static void mcast_close(int fd, void *data) | 126 | static void mcast_close(int fd, void *data) |
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c index ed4a1a6c5d83..c43e8bb32502 100644 --- a/arch/um/drivers/port_user.c +++ b/arch/um/drivers/port_user.c | |||
@@ -100,13 +100,6 @@ static void port_close(int fd, void *d) | |||
100 | os_close_file(fd); | 100 | os_close_file(fd); |
101 | } | 101 | } |
102 | 102 | ||
103 | static int port_console_write(int fd, const char *buf, int n, void *d) | ||
104 | { | ||
105 | struct port_chan *data = d; | ||
106 | |||
107 | return(generic_console_write(fd, buf, n, &data->tt)); | ||
108 | } | ||
109 | |||
110 | struct chan_ops port_ops = { | 103 | struct chan_ops port_ops = { |
111 | .type = "port", | 104 | .type = "port", |
112 | .init = port_init, | 105 | .init = port_init, |
@@ -114,7 +107,7 @@ struct chan_ops port_ops = { | |||
114 | .close = port_close, | 107 | .close = port_close, |
115 | .read = generic_read, | 108 | .read = generic_read, |
116 | .write = generic_write, | 109 | .write = generic_write, |
117 | .console_write = port_console_write, | 110 | .console_write = generic_console_write, |
118 | .window_size = generic_window_size, | 111 | .window_size = generic_window_size, |
119 | .free = port_free, | 112 | .free = port_free, |
120 | .winch = 1, | 113 | .winch = 1, |
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c index 0306a1b215b7..1c555c38de4d 100644 --- a/arch/um/drivers/pty.c +++ b/arch/um/drivers/pty.c | |||
@@ -118,13 +118,6 @@ static int pty_open(int input, int output, int primary, void *d, | |||
118 | return(fd); | 118 | return(fd); |
119 | } | 119 | } |
120 | 120 | ||
121 | static int pty_console_write(int fd, const char *buf, int n, void *d) | ||
122 | { | ||
123 | struct pty_chan *data = d; | ||
124 | |||
125 | return(generic_console_write(fd, buf, n, &data->tt)); | ||
126 | } | ||
127 | |||
128 | struct chan_ops pty_ops = { | 121 | struct chan_ops pty_ops = { |
129 | .type = "pty", | 122 | .type = "pty", |
130 | .init = pty_chan_init, | 123 | .init = pty_chan_init, |
@@ -132,7 +125,7 @@ struct chan_ops pty_ops = { | |||
132 | .close = generic_close, | 125 | .close = generic_close, |
133 | .read = generic_read, | 126 | .read = generic_read, |
134 | .write = generic_write, | 127 | .write = generic_write, |
135 | .console_write = pty_console_write, | 128 | .console_write = generic_console_write, |
136 | .window_size = generic_window_size, | 129 | .window_size = generic_window_size, |
137 | .free = generic_free, | 130 | .free = generic_free, |
138 | .winch = 0, | 131 | .winch = 0, |
@@ -145,7 +138,7 @@ struct chan_ops pts_ops = { | |||
145 | .close = generic_close, | 138 | .close = generic_close, |
146 | .read = generic_read, | 139 | .read = generic_read, |
147 | .write = generic_write, | 140 | .write = generic_write, |
148 | .console_write = pty_console_write, | 141 | .console_write = generic_console_write, |
149 | .window_size = generic_window_size, | 142 | .window_size = generic_window_size, |
150 | .free = generic_free, | 143 | .free = generic_free, |
151 | .winch = 0, | 144 | .winch = 0, |
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c index 6fbb670ee274..94c9265a4f2c 100644 --- a/arch/um/drivers/tty.c +++ b/arch/um/drivers/tty.c | |||
@@ -60,13 +60,6 @@ static int tty_open(int input, int output, int primary, void *d, | |||
60 | return(fd); | 60 | return(fd); |
61 | } | 61 | } |
62 | 62 | ||
63 | static int tty_console_write(int fd, const char *buf, int n, void *d) | ||
64 | { | ||
65 | struct tty_chan *data = d; | ||
66 | |||
67 | return(generic_console_write(fd, buf, n, &data->tt)); | ||
68 | } | ||
69 | |||
70 | struct chan_ops tty_ops = { | 63 | struct chan_ops tty_ops = { |
71 | .type = "tty", | 64 | .type = "tty", |
72 | .init = tty_chan_init, | 65 | .init = tty_chan_init, |
@@ -74,7 +67,7 @@ struct chan_ops tty_ops = { | |||
74 | .close = generic_close, | 67 | .close = generic_close, |
75 | .read = generic_read, | 68 | .read = generic_read, |
76 | .write = generic_write, | 69 | .write = generic_write, |
77 | .console_write = tty_console_write, | 70 | .console_write = generic_console_write, |
78 | .window_size = generic_window_size, | 71 | .window_size = generic_window_size, |
79 | .free = generic_free, | 72 | .free = generic_free, |
80 | .winch = 0, | 73 | .winch = 0, |
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c index b530f1a6540d..aaa636661043 100644 --- a/arch/um/drivers/xterm.c +++ b/arch/um/drivers/xterm.c | |||
@@ -194,13 +194,6 @@ static void xterm_free(void *d) | |||
194 | free(d); | 194 | free(d); |
195 | } | 195 | } |
196 | 196 | ||
197 | static int xterm_console_write(int fd, const char *buf, int n, void *d) | ||
198 | { | ||
199 | struct xterm_chan *data = d; | ||
200 | |||
201 | return(generic_console_write(fd, buf, n, &data->tt)); | ||
202 | } | ||
203 | |||
204 | struct chan_ops xterm_ops = { | 197 | struct chan_ops xterm_ops = { |
205 | .type = "xterm", | 198 | .type = "xterm", |
206 | .init = xterm_init, | 199 | .init = xterm_init, |
@@ -208,7 +201,7 @@ struct chan_ops xterm_ops = { | |||
208 | .close = xterm_close, | 201 | .close = xterm_close, |
209 | .read = generic_read, | 202 | .read = generic_read, |
210 | .write = generic_write, | 203 | .write = generic_write, |
211 | .console_write = xterm_console_write, | 204 | .console_write = generic_console_write, |
212 | .window_size = generic_window_size, | 205 | .window_size = generic_window_size, |
213 | .free = xterm_free, | 206 | .free = xterm_free, |
214 | .winch = 1, | 207 | .winch = 1, |
diff --git a/arch/um/include/chan_user.h b/arch/um/include/chan_user.h index f77d9aa4c164..659bb3cac32f 100644 --- a/arch/um/include/chan_user.h +++ b/arch/um/include/chan_user.h | |||
@@ -25,7 +25,7 @@ struct chan_ops { | |||
25 | void (*close)(int, void *); | 25 | void (*close)(int, void *); |
26 | int (*read)(int, char *, void *); | 26 | int (*read)(int, char *, void *); |
27 | int (*write)(int, const char *, int, void *); | 27 | int (*write)(int, const char *, int, void *); |
28 | int (*console_write)(int, const char *, int, void *); | 28 | int (*console_write)(int, const char *, int); |
29 | int (*window_size)(int, void *, unsigned short *, unsigned short *); | 29 | int (*window_size)(int, void *, unsigned short *, unsigned short *); |
30 | void (*free)(void *); | 30 | void (*free)(void *); |
31 | int winch; | 31 | int winch; |
@@ -37,7 +37,7 @@ extern struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops, tty_ops, | |||
37 | extern void generic_close(int fd, void *unused); | 37 | extern void generic_close(int fd, void *unused); |
38 | extern int generic_read(int fd, char *c_out, void *unused); | 38 | extern int generic_read(int fd, char *c_out, void *unused); |
39 | extern int generic_write(int fd, const char *buf, int n, void *unused); | 39 | extern int generic_write(int fd, const char *buf, int n, void *unused); |
40 | extern int generic_console_write(int fd, const char *buf, int n, void *state); | 40 | extern int generic_console_write(int fd, const char *buf, int n); |
41 | extern int generic_window_size(int fd, void *unused, unsigned short *rows_out, | 41 | extern int generic_window_size(int fd, void *unused, unsigned short *rows_out, |
42 | unsigned short *cols_out); | 42 | unsigned short *cols_out); |
43 | extern void generic_free(void *data); | 43 | extern void generic_free(void *data); |
diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/um_uaccess.h index 84c0868cd561..f8760a3f43b0 100644 --- a/arch/um/include/um_uaccess.h +++ b/arch/um/include/um_uaccess.h | |||
@@ -17,8 +17,25 @@ | |||
17 | #include "uaccess-skas.h" | 17 | #include "uaccess-skas.h" |
18 | #endif | 18 | #endif |
19 | 19 | ||
20 | #define __under_task_size(addr, size) \ | ||
21 | (((unsigned long) (addr) < TASK_SIZE) && \ | ||
22 | (((unsigned long) (addr) + (size)) < TASK_SIZE)) | ||
23 | |||
24 | #define __access_ok_vsyscall(type, addr, size) \ | ||
25 | ((type == VERIFY_READ) && \ | ||
26 | ((unsigned long) (addr) >= FIXADDR_USER_START) && \ | ||
27 | ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \ | ||
28 | ((unsigned long) (addr) + (size) >= (unsigned long)(addr))) | ||
29 | |||
30 | #define __addr_range_nowrap(addr, size) \ | ||
31 | ((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) | ||
32 | |||
20 | #define access_ok(type, addr, size) \ | 33 | #define access_ok(type, addr, size) \ |
21 | CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size) | 34 | (__addr_range_nowrap(addr, size) && \ |
35 | (__under_task_size(addr, size) || \ | ||
36 | __access_ok_vsyscall(type, addr, size) || \ | ||
37 | segment_eq(get_fs(), KERNEL_DS) || \ | ||
38 | CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size))) | ||
22 | 39 | ||
23 | static inline int copy_from_user(void *to, const void __user *from, int n) | 40 | static inline int copy_from_user(void *to, const void __user *from, int n) |
24 | { | 41 | { |
diff --git a/arch/um/kernel/skas/include/uaccess-skas.h b/arch/um/kernel/skas/include/uaccess-skas.h index 7da0c2def0ef..f611f83ad4ff 100644 --- a/arch/um/kernel/skas/include/uaccess-skas.h +++ b/arch/um/kernel/skas/include/uaccess-skas.h | |||
@@ -9,14 +9,8 @@ | |||
9 | #include "asm/errno.h" | 9 | #include "asm/errno.h" |
10 | #include "asm/fixmap.h" | 10 | #include "asm/fixmap.h" |
11 | 11 | ||
12 | #define access_ok_skas(type, addr, size) \ | 12 | /* No SKAS-specific checking. */ |
13 | ((segment_eq(get_fs(), KERNEL_DS)) || \ | 13 | #define access_ok_skas(type, addr, size) 0 |
14 | (((unsigned long) (addr) < TASK_SIZE) && \ | ||
15 | ((unsigned long) (addr) + (size) <= TASK_SIZE)) || \ | ||
16 | ((type == VERIFY_READ ) && \ | ||
17 | ((unsigned long) (addr) >= FIXADDR_USER_START) && \ | ||
18 | ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \ | ||
19 | ((unsigned long) (addr) + (size) >= (unsigned long)(addr)))) | ||
20 | 14 | ||
21 | extern int copy_from_user_skas(void *to, const void __user *from, int n); | 15 | extern int copy_from_user_skas(void *to, const void __user *from, int n); |
22 | extern int copy_to_user_skas(void __user *to, const void *from, int n); | 16 | extern int copy_to_user_skas(void __user *to, const void *from, int n); |
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c index 75195281081e..a5a47528dec7 100644 --- a/arch/um/kernel/skas/uaccess.c +++ b/arch/um/kernel/skas/uaccess.c | |||
@@ -143,7 +143,7 @@ int copy_from_user_skas(void *to, const void __user *from, int n) | |||
143 | return(0); | 143 | return(0); |
144 | } | 144 | } |
145 | 145 | ||
146 | return(access_ok_skas(VERIFY_READ, from, n) ? | 146 | return(access_ok(VERIFY_READ, from, n) ? |
147 | buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to): | 147 | buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to): |
148 | n); | 148 | n); |
149 | } | 149 | } |
@@ -164,7 +164,7 @@ int copy_to_user_skas(void __user *to, const void *from, int n) | |||
164 | return(0); | 164 | return(0); |
165 | } | 165 | } |
166 | 166 | ||
167 | return(access_ok_skas(VERIFY_WRITE, to, n) ? | 167 | return(access_ok(VERIFY_WRITE, to, n) ? |
168 | buffer_op((unsigned long) to, n, 1, copy_chunk_to_user, &from) : | 168 | buffer_op((unsigned long) to, n, 1, copy_chunk_to_user, &from) : |
169 | n); | 169 | n); |
170 | } | 170 | } |
@@ -193,7 +193,7 @@ int strncpy_from_user_skas(char *dst, const char __user *src, int count) | |||
193 | return(strnlen(dst, count)); | 193 | return(strnlen(dst, count)); |
194 | } | 194 | } |
195 | 195 | ||
196 | if(!access_ok_skas(VERIFY_READ, src, 1)) | 196 | if(!access_ok(VERIFY_READ, src, 1)) |
197 | return(-EFAULT); | 197 | return(-EFAULT); |
198 | 198 | ||
199 | n = buffer_op((unsigned long) src, count, 0, strncpy_chunk_from_user, | 199 | n = buffer_op((unsigned long) src, count, 0, strncpy_chunk_from_user, |
@@ -221,7 +221,7 @@ int clear_user_skas(void __user *mem, int len) | |||
221 | return(0); | 221 | return(0); |
222 | } | 222 | } |
223 | 223 | ||
224 | return(access_ok_skas(VERIFY_WRITE, mem, len) ? | 224 | return(access_ok(VERIFY_WRITE, mem, len) ? |
225 | buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL) : len); | 225 | buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL) : len); |
226 | } | 226 | } |
227 | 227 | ||
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c index 95c8f8733baf..0d4c10a73607 100644 --- a/arch/um/kernel/trap_kern.c +++ b/arch/um/kernel/trap_kern.c | |||
@@ -95,7 +95,16 @@ survive: | |||
95 | pte = pte_offset_kernel(pmd, address); | 95 | pte = pte_offset_kernel(pmd, address); |
96 | } while(!pte_present(*pte)); | 96 | } while(!pte_present(*pte)); |
97 | err = 0; | 97 | err = 0; |
98 | /* The below warning was added in place of | ||
99 | * pte_mkyoung(); if (is_write) pte_mkdirty(); | ||
100 | * If it's triggered, we'd see normally a hang here (a clean pte is | ||
101 | * marked read-only to emulate the dirty bit). | ||
102 | * However, the generic code can mark a PTE writable but clean on a | ||
103 | * concurrent read fault, triggering this harmlessly. So comment it out. | ||
104 | */ | ||
105 | #if 0 | ||
98 | WARN_ON(!pte_young(*pte) || (is_write && !pte_dirty(*pte))); | 106 | WARN_ON(!pte_young(*pte) || (is_write && !pte_dirty(*pte))); |
107 | #endif | ||
99 | flush_tlb_page(vma, address); | 108 | flush_tlb_page(vma, address); |
100 | out: | 109 | out: |
101 | up_read(&mm->mmap_sem); | 110 | up_read(&mm->mmap_sem); |
diff --git a/arch/um/kernel/tt/include/uaccess-tt.h b/arch/um/kernel/tt/include/uaccess-tt.h index dc2ebfa8c54f..b9bfe9c481c4 100644 --- a/arch/um/kernel/tt/include/uaccess-tt.h +++ b/arch/um/kernel/tt/include/uaccess-tt.h | |||
@@ -19,19 +19,13 @@ | |||
19 | extern unsigned long end_vm; | 19 | extern unsigned long end_vm; |
20 | extern unsigned long uml_physmem; | 20 | extern unsigned long uml_physmem; |
21 | 21 | ||
22 | #define under_task_size(addr, size) \ | ||
23 | (((unsigned long) (addr) < TASK_SIZE) && \ | ||
24 | (((unsigned long) (addr) + (size)) < TASK_SIZE)) | ||
25 | |||
26 | #define is_stack(addr, size) \ | 22 | #define is_stack(addr, size) \ |
27 | (((unsigned long) (addr) < STACK_TOP) && \ | 23 | (((unsigned long) (addr) < STACK_TOP) && \ |
28 | ((unsigned long) (addr) >= STACK_TOP - ABOVE_KMEM) && \ | 24 | ((unsigned long) (addr) >= STACK_TOP - ABOVE_KMEM) && \ |
29 | (((unsigned long) (addr) + (size)) <= STACK_TOP)) | 25 | (((unsigned long) (addr) + (size)) <= STACK_TOP)) |
30 | 26 | ||
31 | #define access_ok_tt(type, addr, size) \ | 27 | #define access_ok_tt(type, addr, size) \ |
32 | ((type == VERIFY_READ) || (segment_eq(get_fs(), KERNEL_DS)) || \ | 28 | (is_stack(addr, size)) |
33 | (((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) && \ | ||
34 | (under_task_size(addr, size) || is_stack(addr, size)))) | ||
35 | 29 | ||
36 | extern unsigned long get_fault_addr(void); | 30 | extern unsigned long get_fault_addr(void); |
37 | 31 | ||
diff --git a/arch/um/kernel/tt/uaccess.c b/arch/um/kernel/tt/uaccess.c index a72aa632972f..1cb60726567e 100644 --- a/arch/um/kernel/tt/uaccess.c +++ b/arch/um/kernel/tt/uaccess.c | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | int copy_from_user_tt(void *to, const void __user *from, int n) | 9 | int copy_from_user_tt(void *to, const void __user *from, int n) |
10 | { | 10 | { |
11 | if(!access_ok_tt(VERIFY_READ, from, n)) | 11 | if(!access_ok(VERIFY_READ, from, n)) |
12 | return(n); | 12 | return(n); |
13 | 13 | ||
14 | return(__do_copy_from_user(to, from, n, ¤t->thread.fault_addr, | 14 | return(__do_copy_from_user(to, from, n, ¤t->thread.fault_addr, |
@@ -17,7 +17,7 @@ int copy_from_user_tt(void *to, const void __user *from, int n) | |||
17 | 17 | ||
18 | int copy_to_user_tt(void __user *to, const void *from, int n) | 18 | int copy_to_user_tt(void __user *to, const void *from, int n) |
19 | { | 19 | { |
20 | if(!access_ok_tt(VERIFY_WRITE, to, n)) | 20 | if(!access_ok(VERIFY_WRITE, to, n)) |
21 | return(n); | 21 | return(n); |
22 | 22 | ||
23 | return(__do_copy_to_user(to, from, n, ¤t->thread.fault_addr, | 23 | return(__do_copy_to_user(to, from, n, ¤t->thread.fault_addr, |
@@ -28,7 +28,7 @@ int strncpy_from_user_tt(char *dst, const char __user *src, int count) | |||
28 | { | 28 | { |
29 | int n; | 29 | int n; |
30 | 30 | ||
31 | if(!access_ok_tt(VERIFY_READ, src, 1)) | 31 | if(!access_ok(VERIFY_READ, src, 1)) |
32 | return(-EFAULT); | 32 | return(-EFAULT); |
33 | 33 | ||
34 | n = __do_strncpy_from_user(dst, src, count, | 34 | n = __do_strncpy_from_user(dst, src, count, |
@@ -47,7 +47,7 @@ int __clear_user_tt(void __user *mem, int len) | |||
47 | 47 | ||
48 | int clear_user_tt(void __user *mem, int len) | 48 | int clear_user_tt(void __user *mem, int len) |
49 | { | 49 | { |
50 | if(!access_ok_tt(VERIFY_WRITE, mem, len)) | 50 | if(!access_ok(VERIFY_WRITE, mem, len)) |
51 | return(len); | 51 | return(len); |
52 | 52 | ||
53 | return(__do_clear_user(mem, len, ¤t->thread.fault_addr, | 53 | return(__do_clear_user(mem, len, ¤t->thread.fault_addr, |