Skip to content

Commit 4e583ff

Browse files
committed
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
2 parents a01fe7e + 2a4a62a commit 4e583ff

File tree

15 files changed

+85
-53
lines changed

15 files changed

+85
-53
lines changed

arch/um/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config UML
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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ config XTERM_CHAN
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
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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,6 @@ obj-$(CONFIG_UML_PCI_OVER_VIRTIO) += virt-pci.o
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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static void line_timer_cb(struct work_struct *work)
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)
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)
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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static int winch_tramp(int fd, struct tty_port *port, int *fd_out,
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,
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,
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int daemon_setup(char *str, char **mac_out, void *data)
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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static int flush_buffer(struct line *line)
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)
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)
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)
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)
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)
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ struct line_driver {
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 {
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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ static struct line_driver driver = {
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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ static struct line_driver driver = {
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),

0 commit comments

Comments
 (0)