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
66 bool
77 default y
88 select ARCH_EPHEMERAL_INODES
9+ select ARCH_HAS_GCOV_PROFILE_ALL
910 select ARCH_HAS_KCOV
1011 select ARCH_HAS_STRNCPY_FROM_USER
1112 select ARCH_HAS_STRNLEN_USER
arch/um/drivers/Kconfig+15−0
@@ -64,6 +64,13 @@ config XTERM_CHAN · 63 unmodified lines
6464 its own xterm.
6565 It is safe to say 'Y' here.
6666
67+config 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+
6774 config NOCONFIG_CHAN
6875 bool
6976 default !(XTERM_CHAN && TTY_CHAN && PTY_CHAN && PORT_CHAN && NULL_CHAN)
@@ -231,6 +238,14 @@ config UML_NET_DAEMON · 161 unmodified lines
231238
232239 If unsure, say N.
233240
241+config 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+
234249 config UML_NET_VECTOR
235250 bool "Vector I/O high performance network devices"
236251 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
7070 USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o vde_user.o vector_user.o
7171 CFLAGS_null.o = -DDEV_NULL=$(DEV_NULL_PATH)
7272
73+CFLAGS_xterm.o += '-DCONFIG_XTERM_CHAN_DEFAULT_EMULATOR="$(CONFIG_XTERM_CHAN_DEFAULT_EMULATOR)"'
74+
7375 include 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
133133 struct line *line = container_of(work, struct line, task.work);
134134
135135 if (!line->throttled)
136− chan_interrupt(line, line->driver->read_irq);
136+ chan_interrupt(line, line->read_irq);
137137 }
138138
139139 int enable_chan(struct line *line)
@@ -195,9 +195,9 @@ void free_irqs(void) · 55 unmodified lines
195195 chan = list_entry(ele, struct chan, free_list);
196196
197197 if (chan->input && chan->enabled)
198− um_free_irq(chan->line->driver->read_irq, chan);
198+ um_free_irq(chan->line->read_irq, chan);
199199 if (chan->output && chan->enabled)
200− um_free_irq(chan->line->driver->write_irq, chan);
200+ um_free_irq(chan->line->write_irq, chan);
201201 chan->enabled = 0;
202202 }
203203 }
@@ -215,9 +215,9 @@ static void close_one_chan(struct chan *chan, int delay_free_irq) · 11 unmodified lines
215215 spin_unlock_irqrestore(&irqs_to_free_lock, flags);
216216 } else {
217217 if (chan->input && chan->enabled)
218− um_free_irq(chan->line->driver->read_irq, chan);
218+ um_free_irq(chan->line->read_irq, chan);
219219 if (chan->output && chan->enabled)
220− um_free_irq(chan->line->driver->write_irq, chan);
220+ um_free_irq(chan->line->write_irq, chan);
221221 chan->enabled = 0;
222222 }
223223 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
220220 unsigned long *stack_out)
221221 {
222222 struct winch_data data;
223− int fds[2], n, err;
223+ int fds[2], n, err, pid;
224224 char c;
225225
226226 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
238238 * problem with /dev/net/tun, which if held open by this
239239 * thread, prevents the TUN/TAP device from being reused.
240240 */
241− err = run_helper_thread(winch_thread, &data, CLONE_FILES, stack_out);
242− if (err < 0) {
241+ pid = run_helper_thread(winch_thread, &data, CLONE_FILES, stack_out);
242+ if (pid < 0) {
243+ err = pid;
243244 printk(UM_KERN_ERR "fork of winch_thread failed - errno = %d\n",
244245 -err);
245246 goto out_close;
@@ -263,7 +264,7 @@ static int winch_tramp(int fd, struct tty_port *port, int *fd_out, · 17 unmodified lines
263264 goto out_close;
264265 }
265266
266− return err;
267+ return pid;
267268
268269 out_close:
269270 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
6565
6666 *init = ((struct daemon_init)
6767 { .sock_type = "unix",
68− .ctl_sock = "/tmp/uml.ctl" });
68+ .ctl_sock = CONFIG_UML_NET_DAEMON_DEFAULT_SOCK });
6969
7070 remain = split_if_spec(str, mac_out, &init->sock_type, &init->ctl_sock,
7171 NULL);
arch/um/drivers/line.c+13−9
@@ -139,7 +139,7 @@ static int flush_buffer(struct line *line) · 138 unmodified lines
139139 count = line->buffer + LINE_BUFSIZE - line->head;
140140
141141 n = write_chan(line->chan_out, line->head, count,
142− line->driver->write_irq);
142+ line->write_irq);
143143 if (n < 0)
144144 return n;
145145 if (n == count) {
@@ -156,7 +156,7 @@ static int flush_buffer(struct line *line) · 10 unmodified lines
156156
157157 count = line->tail - line->head;
158158 n = write_chan(line->chan_out, line->head, count,
159− line->driver->write_irq);
159+ line->write_irq);
160160
161161 if (n < 0)
162162 return n;
@@ -195,7 +195,7 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len) · 32 unmodified lines
195195 ret = buffer_data(line, buf, len);
196196 else {
197197 n = write_chan(line->chan_out, buf, len,
198− line->driver->write_irq);
198+ line->write_irq);
199199 if (n < 0) {
200200 ret = n;
201201 goto out_up;
@@ -215,7 +215,7 @@ void line_throttle(struct tty_struct *tty) · 13 unmodified lines
215215 {
216216 struct line *line = tty->driver_data;
217217
218− deactivate_chan(line->chan_in, line->driver->read_irq);
218+ deactivate_chan(line->chan_in, line->read_irq);
219219 line->throttled = 1;
220220 }
221221
@@ -224,7 +224,7 @@ void line_unthrottle(struct tty_struct *tty) · 2 unmodified lines
224224 struct line *line = tty->driver_data;
225225
226226 line->throttled = 0;
227− chan_interrupt(line, line->driver->read_irq);
227+ chan_interrupt(line, line->read_irq);
228228 }
229229
230230 static 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
260260 int err;
261261
262262 if (input) {
263− err = um_request_irq(driver->read_irq, fd, IRQ_READ,
264− line_interrupt, IRQF_SHARED,
263+ err = um_request_irq(UM_IRQ_ALLOC, fd, IRQ_READ,
264+ line_interrupt, 0,
265265 driver->read_irq_name, data);
266266 if (err < 0)
267267 return err;
268+
269+ line->read_irq = err;
268270 }
269271
270272 if (output) {
271− err = um_request_irq(driver->write_irq, fd, IRQ_WRITE,
272− line_write_interrupt, IRQF_SHARED,
273+ err = um_request_irq(UM_IRQ_ALLOC, fd, IRQ_WRITE,
274+ line_write_interrupt, 0,
273275 driver->write_irq_name, data);
274276 if (err < 0)
275277 return err;
278+
279+ line->write_irq = err;
276280 }
277281
278282 return 0;
arch/um/drivers/line.h+2−2
@@ -23,9 +23,7 @@ struct line_driver { · 22 unmodified lines
2323 const short minor_start;
2424 const short type;
2525 const short subtype;
26− const int read_irq;
2726 const char *read_irq_name;
28− const int write_irq;
2927 const char *write_irq_name;
3028 struct mc_device mc;
3129 struct tty_driver *driver;
@@ -35,6 +33,8 @@ struct line { · 3 unmodified lines
3533 struct tty_port port;
3634 int valid;
3735
36+ int read_irq, write_irq;
37+
3838 char *init_str;
3939 struct list_head chan_list;
4040 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
4747 .minor_start = 64,
4848 .type = TTY_DRIVER_TYPE_SERIAL,
4949 .subtype = 0,
50− .read_irq = SSL_IRQ,
5150 .read_irq_name = "ssl",
52− .write_irq = SSL_WRITE_IRQ,
5351 .write_irq_name = "ssl-write",
5452 .mc = {
5553 .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
5353 .minor_start = 0,
5454 .type = TTY_DRIVER_TYPE_CONSOLE,
5555 .subtype = SYSTEM_TYPE_CONSOLE,
56− .read_irq = CONSOLE_IRQ,
5756 .read_irq_name = "console",
58− .write_irq = CONSOLE_WRITE_IRQ,
5957 .write_irq_name = "console-write",
6058 .mc = {
6159 .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
6363
6464 u8 config_changed_irq:1;
6565 uint64_t vq_irq_vq_map;
66+ int recv_rc;
6667 };
6768
6869 struct virtio_uml_vq_info {
@@ -148,14 +149,6 @@ static int vhost_user_recv(struct virtio_uml_device *vu_dev, · 79 unmodified lines
148149
149150 rc = vhost_user_recv_header(fd, msg);
150151
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− }
159152 if (rc)
160153 return rc;
161154 size = msg->header.size;
@@ -164,6 +157,21 @@ static int vhost_user_recv(struct virtio_uml_device *vu_dev, · 2 unmodified lines
164157 return full_read(fd, &msg->payload, size, false);
165158 }
166159
160+static 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+
167175 static int vhost_user_recv_resp(struct virtio_uml_device *vu_dev,
168176 struct vhost_user_msg *msg,
169177 size_t max_payload_size)
@@ -171,8 +179,10 @@ static int vhost_user_recv_resp(struct virtio_uml_device *vu_dev, · 1 unmodified line
171179 int rc = vhost_user_recv(vu_dev, vu_dev->sock, msg,
172180 max_payload_size, true);
173181
174− if (rc)
182+ if (rc) {
183+ vhost_user_check_reset(vu_dev, rc);
175184 return rc;
185+ }
176186
177187 if (msg->header.flags != (VHOST_USER_FLAG_REPLY | VHOST_USER_VERSION))
178188 return -EPROTO;
@@ -369,6 +379,7 @@ static irqreturn_t vu_req_read_message(struct virtio_uml_device *vu_dev, · 190 unmodified lines
369379 sizeof(msg.msg.payload) +
370380 sizeof(msg.extra_payload));
371381
382+ vu_dev->recv_rc = rc;
372383 if (rc)
373384 return IRQ_NONE;
374385
@@ -412,7 +423,9 @@ static irqreturn_t vu_req_interrupt(int irq, void *data) · 37 unmodified lines
412423 if (!um_irq_timetravel_handler_used())
413424 ret = vu_req_read_message(vu_dev, NULL);
414425
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) {
416429 struct virtqueue *vq;
417430
418431 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
4242 }
4343
4444 /* Only changed by xterm_setup, which is a setup */
45−static char *terminal_emulator = "xterm";
45+static char *terminal_emulator = CONFIG_XTERM_CHAN_DEFAULT_EMULATOR;
4646 static char *title_switch = "-T";
4747 static char *exec_switch = "-e";
4848
@@ -79,8 +79,9 @@ __uml_setup("xterm=", xterm_setup, · 30 unmodified lines
7979 " respectively. The title switch must have the form '<switch> title',\n"
8080 " not '<switch>=title'. Similarly, the exec switch must have the form\n"
8181 " '<switch> command arg1 arg2 ...'.\n"
82−" The default values are 'xterm=xterm,-T,-e'. Values for gnome-terminal\n"
83−" are 'xterm=gnome-terminal,-t,-x'.\n\n"
82+" The default values are 'xterm=" CONFIG_XTERM_CHAN_DEFAULT_EMULATOR
83+ ",-T,-e'.\n"
84+" Values for gnome-terminal are 'xterm=gnome-terminal,-t,-x'.\n\n"
8485 );
8586
8687 static 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
44 generic-y += compat.h
55 generic-y += current.h
66 generic-y += device.h
7+generic-y += dma-mapping.h
78 generic-y += emergency-restart.h
89 generic-y += exec.h
910 generic-y += extable.h
arch/um/include/asm/irq.h+9−13
@@ -4,19 +4,15 @@ · 3 unmodified lines
44
55 #define TIMER_IRQ 0
66 #define UMN_IRQ 1
7−#define CONSOLE_IRQ 2
8−#define CONSOLE_WRITE_IRQ 3
9−#define UBD_IRQ 4
10−#define UM_ETH_IRQ 5
11−#define SSL_IRQ 6
12−#define SSL_WRITE_IRQ 7
13−#define ACCEPT_IRQ 8
14−#define MCONSOLE_IRQ 9
15−#define WINCH_IRQ 10
16−#define SIGIO_WRITE_IRQ 11
17−#define TELNETD_IRQ 12
18−#define XTERM_IRQ 13
19−#define RANDOM_IRQ 14
7+#define UBD_IRQ 2
8+#define UM_ETH_IRQ 3
9+#define ACCEPT_IRQ 4
10+#define MCONSOLE_IRQ 5
11+#define WINCH_IRQ 6
12+#define SIGIO_WRITE_IRQ 7
13+#define TELNETD_IRQ 8
14+#define XTERM_IRQ 9
15+#define RANDOM_IRQ 10
2016
2117 #ifdef CONFIG_UML_NET_VECTOR
2218
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
2323 {
2424 long res;
2525 void *stub_addr;
26+
27+ BUILD_BUG_ON(sizeof(*desc) % sizeof(long));
28+
2629 res = syscall_stub_data(mm_idp, (unsigned long *)desc,
27− (sizeof(*desc) + sizeof(long) - 1) &
28− ~(sizeof(long) - 1),
30+ sizeof(*desc) / sizeof(long),
2931 addr, &stub_addr);
3032 if (!res) {
3133 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