From f1dc67d0e7df21b3d27beb3ec7b2c9e2b721daff Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Sat, 25 May 2019 00:08:43 +0200 Subject: um: Add an option to make serial driver non-raw In some cases, for example when the program(s) running inside UML isn't/aren't interactive (like the hwsim tests for wpa_supplicant) there's really no value in having the serial lines configured to be raw as they are now by default. Setting them to non-raw lets one abort the whole UML with Ctrl-C, which is really the right thing to do in these cases, basically the whole UML instance is more like a single (testing) program. Add a "ssl-non-raw" option to UML to support such a mode. Signed-off-by: Johannes Berg Signed-off-by: Richard Weinberger --- arch/um/drivers/chan_user.h | 2 +- arch/um/drivers/ssl.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'arch/um') diff --git a/arch/um/drivers/chan_user.h b/arch/um/drivers/chan_user.h index 72222bb036f5..4e51b85e2a23 100644 --- a/arch/um/drivers/chan_user.h +++ b/arch/um/drivers/chan_user.h @@ -11,7 +11,7 @@ struct chan_opts { void (*const announce)(char *dev_name, int dev); char *xterm_title; - const int raw; + int raw; }; struct chan_ops { diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c index b213201b8a3b..26c5716fac0f 100644 --- a/arch/um/drivers/ssl.c +++ b/arch/um/drivers/ssl.c @@ -196,3 +196,11 @@ static int ssl_chan_setup(char *str) __setup("ssl", ssl_chan_setup); __channel_help(ssl_chan_setup, "ssl"); + +static int ssl_non_raw_setup(char *str) +{ + opts.raw = 0; + return 1; +} +__setup("ssl-non-raw", ssl_non_raw_setup); +__channel_help(ssl_non_raw_setup, "set serial lines to non-raw mode"); -- cgit v1.2.3-59-g8ed1b From 40814b98a57089463eb4be09c72205f551481f39 Mon Sep 17 00:00:00 2001 From: Brendan Higgins Date: Tue, 10 Dec 2019 14:34:03 -0800 Subject: um: Mark non-vector net transports as obsolete UML_NET_VECTOR now supports filters compiled with pcap outside of UML; it also supports: EoGRE, EoL2TPv3, RAW (+/- BPF), TAP and BESS. While vector drivers are not 1:1 replacements for the existing drivers, you can achieve the same topologies and the same connectivity at much higher performance (2.5 to 9 Gbit on mid-range Ryzen desktop) - the old drivers test out in the 500Mbit range on the same hardware. For all these reasons, the non-vector based transports are now unnecessary, and some, most notably pcap and vde are maintenance burdens. Thus, it makes sense to at least start thinking about removing the non-vector transports, so for now, mark them as obsolete. Link: https://lore.kernel.org/lkml/15f048d3-07ab-61c1-c6e0-0712e626dd33@cambridgegreys.com/T/#u Suggested-by: Anton Ivanov Signed-off-by: Brendan Higgins Signed-off-by: Richard Weinberger --- arch/um/drivers/Kconfig | 81 +++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 40 deletions(-) (limited to 'arch/um') diff --git a/arch/um/drivers/Kconfig b/arch/um/drivers/Kconfig index 388096fb45a2..72d417055782 100644 --- a/arch/um/drivers/Kconfig +++ b/arch/um/drivers/Kconfig @@ -147,7 +147,7 @@ config UML_NET make use of UML networking. config UML_NET_ETHERTAP - bool "Ethertap transport" + bool "Ethertap transport (obsolete)" depends on UML_NET help The Ethertap User-Mode Linux network transport allows a single @@ -167,14 +167,13 @@ config UML_NET_ETHERTAP has examples of the UML command line to use to enable Ethertap networking. - If you'd like to set up an IP network with the host and/or the - outside world, say Y to this, the Daemon Transport and/or the - Slip Transport. You'll need at least one of them, but may choose - more than one without conflict. If you don't need UML networking, - say N. + NOTE: THIS TRANSPORT IS DEPRECATED AND WILL BE REMOVED SOON!!! Please + migrate to UML_NET_VECTOR. + + If unsure, say N. config UML_NET_TUNTAP - bool "TUN/TAP transport" + bool "TUN/TAP transport (obsolete)" depends on UML_NET help The UML TUN/TAP network transport allows a UML instance to exchange @@ -185,8 +184,13 @@ config UML_NET_TUNTAP To use this transport, your host kernel must have support for TUN/TAP devices, either built-in or as a module. + NOTE: THIS TRANSPORT IS DEPRECATED AND WILL BE REMOVED SOON!!! Please + migrate to UML_NET_VECTOR. + + If unsure, say N. + config UML_NET_SLIP - bool "SLIP transport" + bool "SLIP transport (obsolete)" depends on UML_NET help The slip User-Mode Linux network transport allows a running UML to @@ -201,16 +205,13 @@ config UML_NET_SLIP has examples of the UML command line to use to enable slip networking, and details of a few quirks with it. - The Ethertap Transport is preferred over slip because of its - limitations. If you prefer slip, however, say Y here. Otherwise - choose the Multicast transport (to network multiple UMLs on - multiple hosts), Ethertap (to network with the host and the - outside world), and/or the Daemon transport (to network multiple - UMLs on a single host). You may choose more than one without - conflict. If you don't need UML networking, say N. + NOTE: THIS TRANSPORT IS DEPRECATED AND WILL BE REMOVED SOON!!! Please + migrate to UML_NET_VECTOR. + + If unsure, say N. config UML_NET_DAEMON - bool "Daemon transport" + bool "Daemon transport (obsolete)" depends on UML_NET help This User-Mode Linux network transport allows one or more running @@ -225,13 +226,10 @@ config UML_NET_DAEMON has examples of the UML command line to use to enable Daemon networking. - If you'd like to set up a network with other UMLs on a single host, - say Y. If you need a network between UMLs on multiple physical - hosts, choose the Multicast Transport. To set up a network with - the host and/or other IP machines, say Y to the Ethertap or Slip - transports. You'll need at least one of them, but may choose - more than one without conflict. If you don't need UML networking, - say N. + NOTE: THIS TRANSPORT IS DEPRECATED AND WILL BE REMOVED SOON!!! Please + migrate to UML_NET_VECTOR. + + If unsure, say N. config UML_NET_VECTOR bool "Vector I/O high performance network devices" @@ -245,7 +243,7 @@ config UML_NET_VECTOR drivers. config UML_NET_VDE - bool "VDE transport" + bool "VDE transport (obsolete)" depends on UML_NET help This User-Mode Linux network transport allows one or more running @@ -263,11 +261,13 @@ config UML_NET_VDE That site has a good overview of what VDE is and also examples of the UML command line to use to enable VDE networking. - If you need UML networking with VDE, - say Y. + NOTE: THIS TRANSPORT IS DEPRECATED AND WILL BE REMOVED SOON!!! Please + migrate to UML_NET_VECTOR. + + If unsure, say N. config UML_NET_MCAST - bool "Multicast transport" + bool "Multicast transport (obsolete)" depends on UML_NET help This Multicast User-Mode Linux network transport allows multiple @@ -284,15 +284,13 @@ config UML_NET_MCAST has examples of the UML command line to use to enable Multicast networking, and notes about the security of this approach. - If you need UMLs on multiple physical hosts to communicate as if - they shared an Ethernet network, say Y. If you need to communicate - with other IP machines, make sure you select one of the other - transports (possibly in addition to Multicast; they're not - exclusive). If you don't need to network UMLs say N to each of - the transports. + NOTE: THIS TRANSPORT IS DEPRECATED AND WILL BE REMOVED SOON!!! Please + migrate to UML_NET_VECTOR. + + If unsure, say N. config UML_NET_PCAP - bool "pcap transport" + bool "pcap transport (obsolete)" depends on UML_NET help The pcap transport makes a pcap packet stream on the host look @@ -304,11 +302,13 @@ config UML_NET_PCAP That site has examples of the UML command line to use to enable this option. - If you intend to use UML as a network monitor for the host, say - Y here. Otherwise, say N. + NOTE: THIS TRANSPORT IS DEPRECATED AND WILL BE REMOVED SOON!!! Please + migrate to UML_NET_VECTOR. + + If unsure, say N. config UML_NET_SLIRP - bool "SLiRP transport" + bool "SLiRP transport (obsolete)" depends on UML_NET help The SLiRP User-Mode Linux network transport allows a running UML @@ -328,9 +328,10 @@ config UML_NET_SLIRP that of a host behind a firewall that masquerades all network connections passing through it (but is less secure). - To use this you should first have slirp compiled somewhere - accessible on the host, and have read its documentation. If you - don't need UML networking, say N. + NOTE: THIS TRANSPORT IS DEPRECATED AND WILL BE REMOVED SOON!!! Please + migrate to UML_NET_VECTOR. + + If unsure, say N. Startup example: "eth0=slirp,FE:FD:01:02:03:04,/usr/local/bin/slirp" -- cgit v1.2.3-59-g8ed1b From 87c9366e17259040a9118e06b6dc8de986e5d3d1 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 4 Dec 2019 17:43:46 +0100 Subject: Revert "um: Enable CONFIG_CONSTRUCTORS" This reverts commit 786b2384bf1c ("um: Enable CONFIG_CONSTRUCTORS"). There are two issues with this commit, uncovered by Anton in tests on some (Debian) systems: 1) I completely forgot to call any constructors if CONFIG_CONSTRUCTORS isn't set. Don't recall now if it just wasn't needed on my system, or if I never tested this case. 2) With that fixed, it works - with CONFIG_CONSTRUCTORS *unset*. If I set CONFIG_CONSTRUCTORS, it fails again, which isn't totally unexpected since whatever wanted to run is likely to have to run before the kernel init etc. that calls the constructors in this case. Basically, some constructors that gcc emits (libc has?) need to run very early during init; the failure mode otherwise was that the ptrace fork test already failed: ---------------------- $ ./linux mem=512M Core dump limits : soft - 0 hard - NONE Checking that ptrace can change system call numbers...check_ptrace : child exited with exitcode 6, while expecting 0; status 0x67f Aborted ---------------------- Thinking more about this, it's clear that we simply cannot support CONFIG_CONSTRUCTORS in UML. All the cases we need now (gcov, kasan) involve not use of the __attribute__((constructor)), but instead some constructor code/entry generated by gcc. Therefore, we cannot distinguish between kernel constructors and system constructors. Thus, revert this commit. Cc: stable@vger.kernel.org [5.4+] Fixes: 786b2384bf1c ("um: Enable CONFIG_CONSTRUCTORS") Reported-by: Anton Ivanov Signed-off-by: Johannes Berg Acked-by: Anton Ivanov Signed-off-by: Richard Weinberger --- arch/um/include/asm/common.lds.S | 2 +- arch/um/kernel/dyn.lds.S | 1 + init/Kconfig | 1 + kernel/gcov/Kconfig | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) (limited to 'arch/um') diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S index 7145ce699982..eca6c452a41b 100644 --- a/arch/um/include/asm/common.lds.S +++ b/arch/um/include/asm/common.lds.S @@ -82,8 +82,8 @@ __preinit_array_end = .; } .init_array : { - /* dummy - we call this ourselves */ __init_array_start = .; + *(.init_array) __init_array_end = .; } .fini_array : { diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S index c69d69ee96be..f5001481010c 100644 --- a/arch/um/kernel/dyn.lds.S +++ b/arch/um/kernel/dyn.lds.S @@ -103,6 +103,7 @@ SECTIONS be empty, which isn't pretty. */ . = ALIGN(32 / 8); .preinit_array : { *(.preinit_array) } + .init_array : { *(.init_array) } .fini_array : { *(.fini_array) } .data : { INIT_TASK_DATA(KERNEL_STACK_SIZE) diff --git a/init/Kconfig b/init/Kconfig index a34064a031a5..47d40f399000 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -54,6 +54,7 @@ config CC_DISABLE_WARN_MAYBE_UNINITIALIZED config CONSTRUCTORS bool + depends on !UML config IRQ_WORK bool diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig index 060e8e726755..3941a9c48f83 100644 --- a/kernel/gcov/Kconfig +++ b/kernel/gcov/Kconfig @@ -4,7 +4,7 @@ menu "GCOV-based kernel profiling" config GCOV_KERNEL bool "Enable gcov-based kernel profiling" depends on DEBUG_FS - select CONSTRUCTORS + select CONSTRUCTORS if !UML default n ---help--- This option enables gcov-based code profiling (e.g. for code coverage -- cgit v1.2.3-59-g8ed1b From d65197ad52494bed3b5e64708281b8295f76c391 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 13 Dec 2019 10:01:28 +0100 Subject: um: Fix time-travel=inf-cpu with xor/raid6 Today, I erroneously built a time-travel configuration with btrfs enabled, and noticed it cannot boot in time-travel=inf-cpu mode, both xor and raid6 speed measurement gets stuck. For xor, work around it by picking the first algorithm if inf-cpu mode is enabled. For raid6, I didn't find such a workaround, so disallow enabling time-travel mode if RAID6_PQ_BENCHMARK is enabled. With this, and RAID6_PQ_BENCHMARK disabled, I can boot a kernel that has btrfs enabled in time-travel=inf-cpu mode. Signed-off-by: Johannes Berg Acked-by: Anton Ivanov Signed-off-by: Richard Weinberger --- arch/um/Kconfig | 2 ++ arch/um/include/asm/Kbuild | 1 - arch/um/include/asm/xor.h | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 arch/um/include/asm/xor.h (limited to 'arch/um') diff --git a/arch/um/Kconfig b/arch/um/Kconfig index 6f0edd0c0220..0917f8443c28 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig @@ -189,6 +189,8 @@ config SECCOMP config UML_TIME_TRAVEL_SUPPORT bool prompt "Support time-travel mode (e.g. for test execution)" + # inf-cpu mode is incompatible with the benchmarking + depends on !RAID6_PQ_BENCHMARK help Enable this option to support time travel inside the UML instance. diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild index 398006d27e40..db7d9d4e30d8 100644 --- a/arch/um/include/asm/Kbuild +++ b/arch/um/include/asm/Kbuild @@ -25,5 +25,4 @@ generic-y += switch_to.h generic-y += topology.h generic-y += trace_clock.h generic-y += word-at-a-time.h -generic-y += xor.h generic-y += kprobes.h diff --git a/arch/um/include/asm/xor.h b/arch/um/include/asm/xor.h new file mode 100644 index 000000000000..7a3208c47cfc --- /dev/null +++ b/arch/um/include/asm/xor.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#include +#include + +/* pick an arbitrary one - measuring isn't possible with inf-cpu */ +#define XOR_SELECT_TEMPLATE(x) \ + (time_travel_mode == TT_MODE_INFCPU ? &xor_block_8regs : NULL) -- cgit v1.2.3-59-g8ed1b