History

Merge tag 'for-linus-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml

Pull UML updates from Richard Weinberger: - Various cleanups and fixes: xterm, serial line, time travel - Set ARCH_HAS_GCOV_PROFILE_ALL * tag 'for-linus-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml: um: Fix out-of-bounds read in LDT setup um: chan_user: Fix winch_tramp() return value um: virtio_uml: Fix broken device handling in time-travel um: line: Use separate IRQs per line um: Enable ARCH_HAS_GCOV_PROFILE_ALL um: Use asm-generic/dma-mapping.h um: daemon: Make default socket configurable um: xterm: Make default terminal emulator configurable

Linus Torvalds committed 4 years ago

Commit 4e583ff2 parents a01fe7e 2a4a62a15 files · +85 −53Browse files

Unified · Split

15 files
  1. arch/um/Kconfig +1 −0
  2. arch/um/drivers/Kconfig +15 −0
  3. arch/um/drivers/Makefile +2 −0
  4. arch/um/drivers/chan_kern.c +5 −5
  5. arch/um/drivers/chan_user.c +5 −4
  6. arch/um/drivers/daemon_kern.c +1 −1
  7. arch/um/drivers/line.c +13 −9
  8. arch/um/drivers/line.h +2 −2
  9. arch/um/drivers/ssl.c +0 −2
  10. arch/um/drivers/stdio_console.c +0 −2
  11. arch/um/drivers/virtio_uml.c +23 −10
  12. arch/um/drivers/xterm.c +4 −3
  13. arch/um/include/asm/Kbuild +1 −0
  14. arch/um/include/asm/irq.h +9 −13
  15. arch/x86/um/ldt.c +4 −2
arch/um/Kconfig+1−0
@@ -6,6 +6,7 @@ config UML · 5 unmodified lines
6 bool6 bool
7 default y7 default y
8 select ARCH_EPHEMERAL_INODES8 select ARCH_EPHEMERAL_INODES
9 select ARCH_HAS_GCOV_PROFILE_ALL
9 select ARCH_HAS_KCOV10 select ARCH_HAS_KCOV
10 select ARCH_HAS_STRNCPY_FROM_USER11 select ARCH_HAS_STRNCPY_FROM_USER
11 select ARCH_HAS_STRNLEN_USER12 select ARCH_HAS_STRNLEN_USER
arch/um/drivers/Kconfig+15−0
@@ -64,6 +64,13 @@ config XTERM_CHAN · 63 unmodified lines
64 its own xterm.64 its own xterm.
65 It is safe to say 'Y' here.65 It is safe to say 'Y' here.
66 66
67config XTERM_CHAN_DEFAULT_EMULATOR
68 string "xterm channel default terminal emulator"
69 depends on XTERM_CHAN
70 default "xterm"
71 help
72 This option allows changing the default terminal emulator.
73
67config NOCONFIG_CHAN74config NOCONFIG_CHAN
68 bool75 bool
69 default !(XTERM_CHAN && TTY_CHAN && PTY_CHAN && PORT_CHAN && NULL_CHAN)76 default !(XTERM_CHAN && TTY_CHAN && PTY_CHAN && PORT_CHAN && NULL_CHAN)
@@ -231,6 +238,14 @@ config UML_NET_DAEMON · 161 unmodified lines
231 238
232 If unsure, say N.239 If unsure, say N.
233 240
241config UML_NET_DAEMON_DEFAULT_SOCK
242 string "Default socket for daemon transport"
243 default "/tmp/uml.ctl"
244 depends on UML_NET_DAEMON
245 help
246 This option allows setting the default socket for the daemon
247 transport, normally it defaults to /tmp/uml.ctl.
248
234config UML_NET_VECTOR249config UML_NET_VECTOR
235 bool "Vector I/O high performance network devices"250 bool "Vector I/O high performance network devices"
236 depends on UML_NET251 depends on UML_NET
arch/um/drivers/Makefile+2−0
@@ -70,4 +70,6 @@ obj-$(CONFIG_UML_PCI_OVER_VIRTIO) += virt-pci.o · 69 unmodified lines
70USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o vde_user.o vector_user.o70USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o vde_user.o vector_user.o
71CFLAGS_null.o = -DDEV_NULL=$(DEV_NULL_PATH)71CFLAGS_null.o = -DDEV_NULL=$(DEV_NULL_PATH)
72 72
73CFLAGS_xterm.o += '-DCONFIG_XTERM_CHAN_DEFAULT_EMULATOR="$(CONFIG_XTERM_CHAN_DEFAULT_EMULATOR)"'
74
73include arch/um/scripts/Makefile.rules75include arch/um/scripts/Makefile.rules
arch/um/drivers/chan_kern.c+5−5
@@ -133,7 +133,7 @@ static void line_timer_cb(struct work_struct *work) · 132 unmodified lines
133 struct line *line = container_of(work, struct line, task.work);133 struct line *line = container_of(work, struct line, task.work);
134 134
135 if (!line->throttled)135 if (!line->throttled)
136 chan_interrupt(line, line->driver->read_irq);136 chan_interrupt(line, line->read_irq);
137}137}
138 138
139int enable_chan(struct line *line)139int enable_chan(struct line *line)
@@ -195,9 +195,9 @@ void free_irqs(void) · 55 unmodified lines
195 chan = list_entry(ele, struct chan, free_list);195 chan = list_entry(ele, struct chan, free_list);
196 196
197 if (chan->input && chan->enabled)197 if (chan->input && chan->enabled)
198 um_free_irq(chan->line->driver->read_irq, chan);198 um_free_irq(chan->line->read_irq, chan);
199 if (chan->output && chan->enabled)199 if (chan->output && chan->enabled)
200 um_free_irq(chan->line->driver->write_irq, chan);200 um_free_irq(chan->line->write_irq, chan);
201 chan->enabled = 0;201 chan->enabled = 0;
202 }202 }
203}203}
@@ -215,9 +215,9 @@ static void close_one_chan(struct chan *chan, int delay_free_irq) · 11 unmodified lines
215 spin_unlock_irqrestore(&irqs_to_free_lock, flags);215 spin_unlock_irqrestore(&irqs_to_free_lock, flags);
216 } else {216 } else {
217 if (chan->input && chan->enabled)217 if (chan->input && chan->enabled)
218 um_free_irq(chan->line->driver->read_irq, chan);218 um_free_irq(chan->line->read_irq, chan);
219 if (chan->output && chan->enabled)219 if (chan->output && chan->enabled)
220 um_free_irq(chan->line->driver->write_irq, chan);220 um_free_irq(chan->line->write_irq, chan);
221 chan->enabled = 0;221 chan->enabled = 0;
222 }222 }
223 if (chan->ops->close != NULL)223 if (chan->ops->close != NULL)
arch/um/drivers/chan_user.c+5−4
@@ -220,7 +220,7 @@ static int winch_tramp(int fd, struct tty_port *port, int *fd_out, · 219 unmodified lines
220 unsigned long *stack_out)220 unsigned long *stack_out)
221{221{
222 struct winch_data data;222 struct winch_data data;
223 int fds[2], n, err;223 int fds[2], n, err, pid;
224 char c;224 char c;
225 225
226 err = os_pipe(fds, 1, 1);226 err = os_pipe(fds, 1, 1);
@@ -238,8 +238,9 @@ static int winch_tramp(int fd, struct tty_port *port, int *fd_out, · 11 unmodified lines
238 * problem with /dev/net/tun, which if held open by this238 * problem with /dev/net/tun, which if held open by this
239 * thread, prevents the TUN/TAP device from being reused.239 * thread, prevents the TUN/TAP device from being reused.
240 */240 */
241 err = run_helper_thread(winch_thread, &data, CLONE_FILES, stack_out);241 pid = run_helper_thread(winch_thread, &data, CLONE_FILES, stack_out);
242 if (err < 0) {242 if (pid < 0) {
243 err = pid;
243 printk(UM_KERN_ERR "fork of winch_thread failed - errno = %d\n",244 printk(UM_KERN_ERR "fork of winch_thread failed - errno = %d\n",
244 -err);245 -err);
245 goto out_close;246 goto out_close;
@@ -263,7 +264,7 @@ static int winch_tramp(int fd, struct tty_port *port, int *fd_out, · 17 unmodified lines
263 goto out_close;264 goto out_close;
264 }265 }
265 266
266 return err;267 return pid;
267 268
268 out_close:269 out_close:
269 close(fds[1]);270 close(fds[1]);
arch/um/drivers/daemon_kern.c+1−1
@@ -65,7 +65,7 @@ static int daemon_setup(char *str, char **mac_out, void *data) · 64 unmodified lines
65 65
66 *init = ((struct daemon_init)66 *init = ((struct daemon_init)
67 { .sock_type = "unix",67 { .sock_type = "unix",
68 .ctl_sock = "/tmp/uml.ctl" });68 .ctl_sock = CONFIG_UML_NET_DAEMON_DEFAULT_SOCK });
69 69
70 remain = split_if_spec(str, mac_out, &init->sock_type, &init->ctl_sock,70 remain = split_if_spec(str, mac_out, &init->sock_type, &init->ctl_sock,
71 NULL);71 NULL);
arch/um/drivers/line.c+13−9
@@ -139,7 +139,7 @@ static int flush_buffer(struct line *line) · 138 unmodified lines
139 count = line->buffer + LINE_BUFSIZE - line->head;139 count = line->buffer + LINE_BUFSIZE - line->head;
140 140
141 n = write_chan(line->chan_out, line->head, count,141 n = write_chan(line->chan_out, line->head, count,
142 line->driver->write_irq);142 line->write_irq);
143 if (n < 0)143 if (n < 0)
144 return n;144 return n;
145 if (n == count) {145 if (n == count) {
@@ -156,7 +156,7 @@ static int flush_buffer(struct line *line) · 10 unmodified lines
156 156
157 count = line->tail - line->head;157 count = line->tail - line->head;
158 n = write_chan(line->chan_out, line->head, count,158 n = write_chan(line->chan_out, line->head, count,
159 line->driver->write_irq);159 line->write_irq);
160 160
161 if (n < 0)161 if (n < 0)
162 return n;162 return n;
@@ -195,7 +195,7 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len) · 32 unmodified lines
195 ret = buffer_data(line, buf, len);195 ret = buffer_data(line, buf, len);
196 else {196 else {
197 n = write_chan(line->chan_out, buf, len,197 n = write_chan(line->chan_out, buf, len,
198 line->driver->write_irq);198 line->write_irq);
199 if (n < 0) {199 if (n < 0) {
200 ret = n;200 ret = n;
201 goto out_up;201 goto out_up;
@@ -215,7 +215,7 @@ void line_throttle(struct tty_struct *tty) · 13 unmodified lines
215{215{
216 struct line *line = tty->driver_data;216 struct line *line = tty->driver_data;
217 217
218 deactivate_chan(line->chan_in, line->driver->read_irq);218 deactivate_chan(line->chan_in, line->read_irq);
219 line->throttled = 1;219 line->throttled = 1;
220}220}
221 221
@@ -224,7 +224,7 @@ void line_unthrottle(struct tty_struct *tty) · 2 unmodified lines
224 struct line *line = tty->driver_data;224 struct line *line = tty->driver_data;
225 225
226 line->throttled = 0;226 line->throttled = 0;
227 chan_interrupt(line, line->driver->read_irq);227 chan_interrupt(line, line->read_irq);
228}228}
229 229
230static irqreturn_t line_write_interrupt(int irq, void *data)230static irqreturn_t line_write_interrupt(int irq, void *data)
@@ -260,19 +260,23 @@ int line_setup_irq(int fd, int input, int output, struct line *line, void *data) · 29 unmodified lines
260 int err;260 int err;
261 261
262 if (input) {262 if (input) {
263 err = um_request_irq(driver->read_irq, fd, IRQ_READ,263 err = um_request_irq(UM_IRQ_ALLOC, fd, IRQ_READ,
264 line_interrupt, IRQF_SHARED,264 line_interrupt, 0,
265 driver->read_irq_name, data);265 driver->read_irq_name, data);
266 if (err < 0)266 if (err < 0)
267 return err;267 return err;
268
269 line->read_irq = err;
268 }270 }
269 271
270 if (output) {272 if (output) {
271 err = um_request_irq(driver->write_irq, fd, IRQ_WRITE,273 err = um_request_irq(UM_IRQ_ALLOC, fd, IRQ_WRITE,
272 line_write_interrupt, IRQF_SHARED,274 line_write_interrupt, 0,
273 driver->write_irq_name, data);275 driver->write_irq_name, data);
274 if (err < 0)276 if (err < 0)
275 return err;277 return err;
278
279 line->write_irq = err;
276 }280 }
277 281
278 return 0;282 return 0;
arch/um/drivers/line.h+2−2
@@ -23,9 +23,7 @@ struct line_driver { · 22 unmodified lines
23 const short minor_start;23 const short minor_start;
24 const short type;24 const short type;
25 const short subtype;25 const short subtype;
26 const int read_irq;
27 const char *read_irq_name;26 const char *read_irq_name;
28 const int write_irq;
29 const char *write_irq_name;27 const char *write_irq_name;
30 struct mc_device mc;28 struct mc_device mc;
31 struct tty_driver *driver;29 struct tty_driver *driver;
@@ -35,6 +33,8 @@ struct line { · 3 unmodified lines
35 struct tty_port port;33 struct tty_port port;
36 int valid;34 int valid;
37 35
36 int read_irq, write_irq;
37
38 char *init_str;38 char *init_str;
39 struct list_head chan_list;39 struct list_head chan_list;
40 struct chan *chan_in, *chan_out;40 struct chan *chan_in, *chan_out;
arch/um/drivers/ssl.c+0−2
@@ -47,9 +47,7 @@ static struct line_driver driver = { · 46 unmodified lines
47 .minor_start = 64,47 .minor_start = 64,
48 .type = TTY_DRIVER_TYPE_SERIAL,48 .type = TTY_DRIVER_TYPE_SERIAL,
49 .subtype = 0,49 .subtype = 0,
50 .read_irq = SSL_IRQ,
51 .read_irq_name = "ssl",50 .read_irq_name = "ssl",
52 .write_irq = SSL_WRITE_IRQ,
53 .write_irq_name = "ssl-write",51 .write_irq_name = "ssl-write",
54 .mc = {52 .mc = {
55 .list = LIST_HEAD_INIT(driver.mc.list),53 .list = LIST_HEAD_INIT(driver.mc.list),
arch/um/drivers/stdio_console.c+0−2
@@ -53,9 +53,7 @@ static struct line_driver driver = { · 52 unmodified lines
53 .minor_start = 0,53 .minor_start = 0,
54 .type = TTY_DRIVER_TYPE_CONSOLE,54 .type = TTY_DRIVER_TYPE_CONSOLE,
55 .subtype = SYSTEM_TYPE_CONSOLE,55 .subtype = SYSTEM_TYPE_CONSOLE,
56 .read_irq = CONSOLE_IRQ,
57 .read_irq_name = "console",56 .read_irq_name = "console",
58 .write_irq = CONSOLE_WRITE_IRQ,
59 .write_irq_name = "console-write",57 .write_irq_name = "console-write",
60 .mc = {58 .mc = {
61 .list = LIST_HEAD_INIT(driver.mc.list),59 .list = LIST_HEAD_INIT(driver.mc.list),
arch/um/drivers/virtio_uml.c+23−10
@@ -63,6 +63,7 @@ struct virtio_uml_device { · 62 unmodified lines
63 63
64 u8 config_changed_irq:1;64 u8 config_changed_irq:1;
65 uint64_t vq_irq_vq_map;65 uint64_t vq_irq_vq_map;
66 int recv_rc;
66};67};
67 68
68struct virtio_uml_vq_info {69struct virtio_uml_vq_info {
@@ -148,14 +149,6 @@ static int vhost_user_recv(struct virtio_uml_device *vu_dev, · 79 unmodified lines
148 149
149 rc = vhost_user_recv_header(fd, msg);150 rc = vhost_user_recv_header(fd, msg);
150 151
151 if (rc == -ECONNRESET && vu_dev->registered) {
152 struct virtio_uml_platform_data *pdata;
153
154 pdata = vu_dev->pdata;
155
156 virtio_break_device(&vu_dev->vdev);
157 schedule_work(&pdata->conn_broken_wk);
158 }
159 if (rc)152 if (rc)
160 return rc;153 return rc;
161 size = msg->header.size;154 size = msg->header.size;
@@ -164,6 +157,21 @@ static int vhost_user_recv(struct virtio_uml_device *vu_dev, · 2 unmodified lines
164 return full_read(fd, &msg->payload, size, false);157 return full_read(fd, &msg->payload, size, false);
165}158}
166 159
160static void vhost_user_check_reset(struct virtio_uml_device *vu_dev,
161 int rc)
162{
163 struct virtio_uml_platform_data *pdata = vu_dev->pdata;
164
165 if (rc != -ECONNRESET)
166 return;
167
168 if (!vu_dev->registered)
169 return;
170
171 virtio_break_device(&vu_dev->vdev);
172 schedule_work(&pdata->conn_broken_wk);
173}
174
167static int vhost_user_recv_resp(struct virtio_uml_device *vu_dev,175static int vhost_user_recv_resp(struct virtio_uml_device *vu_dev,
168 struct vhost_user_msg *msg,176 struct vhost_user_msg *msg,
169 size_t max_payload_size)177 size_t max_payload_size)
@@ -171,8 +179,10 @@ static int vhost_user_recv_resp(struct virtio_uml_device *vu_dev, · 1 unmodified line
171 int rc = vhost_user_recv(vu_dev, vu_dev->sock, msg,179 int rc = vhost_user_recv(vu_dev, vu_dev->sock, msg,
172 max_payload_size, true);180 max_payload_size, true);
173 181
174 if (rc)182 if (rc) {
183 vhost_user_check_reset(vu_dev, rc);
175 return rc;184 return rc;
185 }
176 186
177 if (msg->header.flags != (VHOST_USER_FLAG_REPLY | VHOST_USER_VERSION))187 if (msg->header.flags != (VHOST_USER_FLAG_REPLY | VHOST_USER_VERSION))
178 return -EPROTO;188 return -EPROTO;
@@ -369,6 +379,7 @@ static irqreturn_t vu_req_read_message(struct virtio_uml_device *vu_dev, · 190 unmodified lines
369 sizeof(msg.msg.payload) +379 sizeof(msg.msg.payload) +
370 sizeof(msg.extra_payload));380 sizeof(msg.extra_payload));
371 381
382 vu_dev->recv_rc = rc;
372 if (rc)383 if (rc)
373 return IRQ_NONE;384 return IRQ_NONE;
374 385
@@ -412,7 +423,9 @@ static irqreturn_t vu_req_interrupt(int irq, void *data) · 37 unmodified lines
412 if (!um_irq_timetravel_handler_used())423 if (!um_irq_timetravel_handler_used())
413 ret = vu_req_read_message(vu_dev, NULL);424 ret = vu_req_read_message(vu_dev, NULL);
414 425
415 if (vu_dev->vq_irq_vq_map) {426 if (vu_dev->recv_rc) {
427 vhost_user_check_reset(vu_dev, vu_dev->recv_rc);
428 } else if (vu_dev->vq_irq_vq_map) {
416 struct virtqueue *vq;429 struct virtqueue *vq;
417 430
418 virtio_device_for_each_vq((&vu_dev->vdev), vq) {431 virtio_device_for_each_vq((&vu_dev->vdev), vq) {
arch/um/drivers/xterm.c+4−3
@@ -42,7 +42,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts) · 41 unmodified lines
42}42}
43 43
44/* Only changed by xterm_setup, which is a setup */44/* Only changed by xterm_setup, which is a setup */
45static char *terminal_emulator = "xterm";45static char *terminal_emulator = CONFIG_XTERM_CHAN_DEFAULT_EMULATOR;
46static char *title_switch = "-T";46static char *title_switch = "-T";
47static char *exec_switch = "-e";47static char *exec_switch = "-e";
48 48
@@ -79,8 +79,9 @@ __uml_setup("xterm=", xterm_setup, · 30 unmodified lines
79" respectively. The title switch must have the form '<switch> title',\n"79" respectively. The title switch must have the form '<switch> title',\n"
80" not '<switch>=title'. Similarly, the exec switch must have the form\n"80" not '<switch>=title'. Similarly, the exec switch must have the form\n"
81" '<switch> command arg1 arg2 ...'.\n"81" '<switch> command arg1 arg2 ...'.\n"
82" The default values are 'xterm=xterm,-T,-e'. Values for gnome-terminal\n"82" The default values are 'xterm=" CONFIG_XTERM_CHAN_DEFAULT_EMULATOR
83" are 'xterm=gnome-terminal,-t,-x'.\n\n"83 ",-T,-e'.\n"
84" Values for gnome-terminal are 'xterm=gnome-terminal,-t,-x'.\n\n"
84);85);
85 86
86static int xterm_open(int input, int output, int primary, void *d,87static int xterm_open(int input, int output, int primary, void *d,
arch/um/include/asm/Kbuild+1−0
@@ -4,6 +4,7 @@ generic-y += bug.h · 3 unmodified lines
4generic-y += compat.h4generic-y += compat.h
5generic-y += current.h5generic-y += current.h
6generic-y += device.h6generic-y += device.h
7generic-y += dma-mapping.h
7generic-y += emergency-restart.h8generic-y += emergency-restart.h
8generic-y += exec.h9generic-y += exec.h
9generic-y += extable.h10generic-y += extable.h
arch/um/include/asm/irq.h+9−13
@@ -4,19 +4,15 @@ · 3 unmodified lines
4 4
5#define TIMER_IRQ 05#define TIMER_IRQ 0
6#define UMN_IRQ 16#define UMN_IRQ 1
7#define CONSOLE_IRQ 27#define UBD_IRQ 2
8#define CONSOLE_WRITE_IRQ 38#define UM_ETH_IRQ 3
9#define UBD_IRQ 49#define ACCEPT_IRQ 4
10#define UM_ETH_IRQ 510#define MCONSOLE_IRQ 5
11#define SSL_IRQ 611#define WINCH_IRQ 6
12#define SSL_WRITE_IRQ 712#define SIGIO_WRITE_IRQ 7
13#define ACCEPT_IRQ 813#define TELNETD_IRQ 8
14#define MCONSOLE_IRQ 914#define XTERM_IRQ 9
15#define WINCH_IRQ 1015#define RANDOM_IRQ 10
16#define SIGIO_WRITE_IRQ 11
17#define TELNETD_IRQ 12
18#define XTERM_IRQ 13
19#define RANDOM_IRQ 14
20 16
21#ifdef CONFIG_UML_NET_VECTOR17#ifdef CONFIG_UML_NET_VECTOR
22 18
arch/x86/um/ldt.c+4−2
@@ -23,9 +23,11 @@ static long write_ldt_entry(struct mm_id *mm_idp, int func, · 22 unmodified lines
23{23{
24 long res;24 long res;
25 void *stub_addr;25 void *stub_addr;
26
27 BUILD_BUG_ON(sizeof(*desc) % sizeof(long));
28
26 res = syscall_stub_data(mm_idp, (unsigned long *)desc,29 res = syscall_stub_data(mm_idp, (unsigned long *)desc,
27 (sizeof(*desc) + sizeof(long) - 1) &30 sizeof(*desc) / sizeof(long),
28 ~(sizeof(long) - 1),
29 addr, &stub_addr);31 addr, &stub_addr);
30 if (!res) {32 if (!res) {
31 unsigned long args[] = { func,33 unsigned long args[] = { func,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t