summaryrefslogtreecommitdiff
path: root/arch/um/drivers
AgeCommit message (Collapse)Author
3 daysMerge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhostLinus Torvalds
Pull vhost,virtio updates from Michael Tsirkin: "This adds CPR support for vhost. Plus some fixes, notably for a host of races we had when callback fire around device reset" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: tools/virtio: add missing device-id/virtio.h wrapper header vhost/vsock: add VHOST_RESET_OWNER ioctl vhost: synchronize with RCU readers when freeing workers vhost/vsock: re-scan TX virtqueue on device start vhost/vsock: suppress EHOSTUNREACH fast-fail during CPR pause vhost/vsock: split out vhost_vsock_drop_backends helper virtio_pci: drop callback sync on reset virtio_pci_modern: move avq cleanup from reset to del_vqs virtio: synchronize callbacks after device reset virtio_vdpa: implement synchronize_cbs() platform/mellanox: mlxbf-tmfifo: implement synchronize_cbs() um: virtio_uml: implement synchronize_cbs() remoteproc: implement synchronize_cbs() for virtio devices virtio_ccw: always take irq_lock in the classic interrupt handler virtio_ccw: fix synchronize_cbs() after interrupt fallback
4 daysMerge tag 'uml-for-7.4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux Pull UML updates from Johannes Berg: - NOMMU support, mostly for mm/ testing The only bigger change, we added support for building with !CONFIG_MMU, mostly for testing, e.g. via kunit. Some new selftests targetted to NOMMU are moving elsewhere, but are runnable on ARCH=um without MMU. - Tighter page permissions Tighten page permissions to catch more bugs (ARCH=um is, after all, often used for testing), and also mark __init memory inaccessible for the same reason. - Various maintenance/cleanups Fix build on really old hosts, fix leaks, make the code a bit more robust, header cleanups, typo fixes, the usual. * tag 'uml-for-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux: (38 commits) um: place large BSS inputs in an output section um: fix shutdown __inittext access um: time-travel: fix sched_yield() behaviour um: require MMU for UML PCI support um: vector: avoid NULL queue dereference in legacy RX mode um: use %pB to print functions in stack traces um: mprotect() __init memory um: move init text between __init_begin/end um: improve checking for --no-warn-rwx-segments um: make stub compilation more robust um: link .lbss/.ldata/.lrodata correctly um: add perf-event support x86/um: remove unused <asm/required-features.h> header um: fix typo "hander" in comment um: Add definition of __NR_close_range for older host OSs um: virtio_uml: switch to dynamic root device um: Tighten exec permissions on page mappings Documentation: um: document nommu UML um: allow deselecting CONFIG_MMU um: nommu: add userspace runner processes ...
2026-10-06net: always dissect GSO packets in __virtio_net_hdr_to_skb()Eric Dumazet
Commit 9e8db5913264 ("net: avoid false positives in untrusted gso validation") added a '&& skb->network_header' check before flow-dissecting GSO packets without VIRTIO_NET_HDR_F_NEEDS_CSUM in __virtio_net_hdr_to_skb(), because some callers (such as tun_get_user(), tun_xdp_one(), virtnet_receive_done(), and raw_verify_header()) called virtio_net_hdr_*_to_skb() before initializing skb->network_header and skb->dev. Because __alloc_skb() and __build_skb_around() zero-initialize skb->network_header to 0 (unlike mac_header and transport_header which are initialized to ~0U), those four callers always had skb->network_header == 0 and bypassed flow dissection in __virtio_net_hdr_to_skb(). More generally, skb->network_header is an offset from skb->head (where 0 is also a valid offset whenever skb_headroom(skb) is 0), not a boolean flag. Whenever the 'if (gso_type && skb->network_header)' branch was skipped, the fallback 'else if (gso_type)' only pulled nh_min_len + thlen (40 bytes for TCPv4) without dissecting the packet, without validating ip_proto or n_proto, and without setting skb->transport_header. If the packet has a malformed network header, it is not rejected and a subsequent skb_probe_transport_header() also fails, leaving skb->transport_header at ~0U (0xffff). Similarly, if an IPv4 packet carries IP options (ihl > 5) or an IPv6 packet carries extension headers, pulling only nh_min_len + thlen can leave the TCP header outside skb->head. In both cases, tcp_hdrlen(skb) in skb_gso_transport_seglen() reads out-of-bounds: BUG: KASAN: slab-out-of-bounds in skb_gso_transport_seglen Read of size 2 by task poc/133 skb_gso_transport_seglen (net/core/gso.c:155) skb_gso_validate_mac_len (net/core/gso.c:270) tbf_enqueue (net/sched/sch_tbf.c:260) dev_qdisc_enqueue (net/core/dev.c:4227) __dev_queue_xmit (net/core/dev.c:4884) In addition, checking virtio_net_hdr_match_proto() only inside 'if (!skb->protocol)' before flow dissection both skipped validation when skb->protocol was pre-set by the caller and rejected VLAN-tagged frames whose outer L2 protocol is ETH_P_8021Q or ETH_P_8021AD. Fix this by: 1. Initializing skb->dev and skb->network_header (plus skb->protocol for IFF_TUN) before virtio_net_hdr_*_to_skb() in tun_get_user(), tun_xdp_one(), virtnet_receive_done(), and raw_verify_header(). In tun_get_user(), drop the redundant skb_reset_mac_header(skb) in the IFF_TUN case since __virtio_net_hdr_to_skb() unconditionally resets mac_header. 2. Removing '&& skb->network_header' and the unvalidated 'else if (gso_type)' fallback in __virtio_net_hdr_to_skb() so all GSO packets without VIRTIO_NET_HDR_F_NEEDS_CSUM are flow-dissected, have their transport header pulled into linear data, and have skb->transport_header set. 3. Moving the virtio_net_hdr_match_proto() check to after skb_flow_dissect_flow_keys_basic(), validating keys.basic.n_proto against hdr_gso_type. Fixes: 9e8db5913264 ("net: avoid false positives in untrusted gso validation") Fixes: d5be7f632bad ("net: validate untrusted gso packets without csum offload") Fixes: 924a9bc362a5 ("net: check if protocol extracted by virtio_net_hdr_set_proto is correct") Reported-by: Weiming Shi <bestswngs@gmail.com> Closes: https://lore.kernel.org/netdev/20260927163117.746432-2-bestswngs@gmail.com/ Signed-off-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: Willem de Bruijn <willemb@google.com> Cc: Michael S. Tsirkin <mst@redhat.com> Link: https://patch.msgid.link/20261001191140.2818991-3-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-28um: require MMU for UML PCI supportHajime Tazaki
Because UML_PCI (arch/um/drivers/Kconfig) selects FORCE_PCI, this contradicts the current dependency of CONFIG_PCI on CONFIG_MMU. This commit fixes this issue by adding right dependencies under !MMU environment. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202609271139.DpjVdepU-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609271351.tw8EOsgz-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609270410.Kc2FsJp1-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609270228.yku16Noi-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609270416.rEtAiqyF-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609270538.mV3NDkLu-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609271435.lANS7mTP-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609271512.pg5gWbIg-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609271717.pg5HjzeZ-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609271810.pxMMu5ZC-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609271940.FhRl0cBi-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609272107.sLZJEOtt-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609272234.F8tROOdL-lkp@intel.com/ Fixes: 626ff2b34dbb ("um: allow deselecting CONFIG_MMU") Signed-off-by: Hajime Tazaki <thehajime@gmail.com> Link: https://patch.msgid.link/20260927234537.1585880-1-thehajime@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-24um: vector: avoid NULL queue dereference in legacy RX modeHenry Barreto
Bringing a UML vector netdev up can panic in vector_net_open() with a fault in _raw_spin_lock(). vector_net_open() calls vector_reset_stats(), which takes the RX and TX queue locks. However, queue allocation depends on runtime transport options. With tap transport, vector RX/TX queues are not created and the legacy header buffers are used instead. Taking a queue lock then dereferences a NULL queue pointer. Take the queue locks in vector_reset_stats() only when the corresponding queue exists. Also move the RX queue lock in vector_poll() into the VECTOR_RX path, so legacy RX does not touch rx_queue. Signed-off-by: Henry Barreto <me@henrybarreto.dev> Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com> Link: https://patch.msgid.link/20260527213524.45903-1-contato@henrybarreto.dev Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-24um: virtio_uml: switch to dynamic root deviceJohan Hovold
Driver core expects devices to be dynamically allocated and will, for example, complain loudly when no release function has been provided. Use __root_device_register() to allocate and register the root device instead of open coding using a static device. Note that root_device_register(), which also creates a link to the module, cannot be used as the device is registered when parsing the module parameters which happens before the module kobject has been set up. Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260812142228.55316-1-johan@kernel.org Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-24um: ubd: validate COW header fields before useMichael Bommarito
read_cow_header() copies the backing-file path and computes geometry from header fields without validating them, and the historical "XXX Need to sanity-check the values read from the header" comment was never addressed. Three image-controlled fields are unsafe: - backing_file[]: not guaranteed NUL-terminated. cow_strdup() and the later strlen()/printf() walk off the end of the header buffer when a crafted image leaves the array unterminated (heap over-read). - sectorsize: used as a divisor in cow_sizes() (bitmap_len = (size + sectorsize - 1) / (8 * sectorsize)); a zero or negative sectorsize causes a divide-by-zero / bogus geometry. - For the V3/V3_b layouts the existing "align == 0" check printed a warning but fell through and then computed ROUND_UP(sizeof(header), 0), another divide-by-zero. Reject an unterminated backing_file for each header version, turn the align == 0 warnings into hard errors (goto out), and reject a non-positive sectorsize before the geometry math runs. A COW image is parsed from a file the guest opens (ubdN=cow,backing on the command line, or a cow file an unprivileged user can point ubd at), so a crafted header is attacker-reachable. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Reviewed-by: Richard Weinberger <richard@nod.at> Link: https://patch.msgid.link/20260622124823.1695944-1-michael.bommarito@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-24um: virtio_uml: fix heap overflow in vhost_user_get_config()Michael Bommarito
vhost_user_get_config() sizes its reply buffer from header + payload: size_t payload_size = sizeof(msg->payload.config) + cfg_size; size_t msg_size = sizeof(msg->header) + payload_size; ... msg = kzalloc(msg_size, GFP_KERNEL); but then receives the response with msg_size as the payload cap: rc = vhost_user_recv_resp(vu_dev, msg, msg_size); vhost_user_recv() reads the header, then full_read()s header.size bytes into &msg->payload after checking only "size > max_payload_size". The payload area is msg_size - sizeof(msg->header) == payload_size bytes, so passing msg_size as the cap lets a peer set header.size up to msg_size and write sizeof(struct vhost_user_msg_header) (12) bytes past the end of the kzalloc(msg_size) buffer -- a slab out-of-bounds write of peer-controlled content. Pass payload_size, which is the size the payload area was allocated for. A malicious or compromised vhost-user backend triggers this during device probe (vu_get -> vhost_user_get_config) with no guest action, which matters in the confidential-computing model where the guest does not trust the device backend. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Reviewed-by: Richard Weinberger <richard@nod.at> Link: https://patch.msgid.link/20260622124750.1694957-1-michael.bommarito@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-24um: vector: Use %pM format specifier for MAC addressesAndy Shevchenko
Convert to %pM instead of using custom code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20260603072958.107215-1-andriy.shevchenko@linux.intel.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-24um: virtio-pci: free the IRQ message buffersBenjamin Berg
These buffers are allocated when initializing the virtual queues, but were not freed again. Wrap all of the del_vqs calls to detach and free the unused buffers before deleting the IRQ VQ. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Link: https://patch.msgid.link/20260505124317.2330700-2-benjamin@sipsolutions.net Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-24um: mconsole: Fix out-of-bounds read in mconsole_log()Shengzhuo Wei
mconsole_parse() matches the 3-byte prefix "log", but mconsole_log() skips strlen("log ") = 4 bytes, advancing ptr past the NUL terminator when a client sends "log" without a trailing space. The length then comes from req->len, the raw recvfrom() count, instead of req->request.len, so printk() reads up to req->len - 4 bytes of stale data from a previous request left in the static mc_request buffer, leaking it to the kernel log. Use req->cmd->command for the actual command length, add skip_spaces(), use req->request.len, and guard against non-positive length. Signed-off-by: Shengzhuo Wei <me@cherr.cc> Link: https://patch.msgid.link/20260425-mconsole-oob-read-leak-v1-1-7d46e5892c5c@cherr.cc Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-24um: vector: reject too many interface argumentsPengpeng Hou
uml_parse_vector_ifspec() stores parsed key/value pairs in the fixed struct arglist token and value arrays, which are both sized to MAXVARGS. The parser increments numargs as it discovers pairs, but it never checks whether another slot is still available before writing into the arrays. Reject interface specifications that exceed MAXVARGS instead of writing past the end of the fixed argument arrays. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Link: https://patch.msgid.link/20260424070106.1-uml-vector-v2-pengpeng@iscas.ac.cn Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-24um: vector: Remove unnecessary NULL check in destroy_queue()Tiwei Bie
All callers of destroy_queue() already perform a NULL check, so a NULL qi will never be passed in. Inside destroy_queue(), we dereference qi immediately, and the subsequent NULL check on qi is unnecessary and confusing. Remove it to address the smatch warning. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/r/202604110937.MLUL70Lx-lkp@intel.com/ Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com> Link: https://patch.msgid.link/20260411163705.948426-1-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-24um: mconsole: use bounded version string formattingPengpeng Hou
mconsole_version() formats several UTS strings into a fixed 256-byte local buffer with sprintf() and no length bound. Use snprintf() so the version reply stays within the local buffer. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Link: https://patch.msgid.link/20260408160001.1-um-mconsole-v2-pengpeng@iscas.ac.cn Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-09-08um: virtio_uml: implement synchronize_cbs()Karl Mehltretter
virtio_uml invokes virtqueue callbacks from vu_interrupt() and vu_req_interrupt(), which share vu_dev->irq. The core's synchronize_rcu() fallback already covers these IRQ handlers. Implement synchronize_cbs() with synchronize_irq() to synchronize with that IRQ instead of waiting for an RCU grace period. Assisted-by: LLM Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20260908053817.26065-5-kmehltretter@gmail.com>
2026-07-23um: vector: fix use-after-free in vector_mmsg_rx()Michael Bommarito
When vector_mmsg_rx() discards a packet whose overlay header fails verify_header(), it frees the skb and continues the loop: if (header_check < 0) { dev_kfree_skb_irq(skb); vp->estats.rx_encaps_errors++; continue; } The normal and short-packet paths fall through to the bottom of the loop body, which clears the consumed slot and advances the cursors: (*skbuff_vector) = NULL; mmsg_vector++; skbuff_vector++; The verify_header() < 0 path skips that via continue, so the freed skb is left in skbuff_vector[] and the cursors do not advance. The next iteration reads the same slot, gets the freed skb, and frees it again, producing a refcount underflow / use-after-free in the RX path. Discard the slot the same way the other paths do before continuing. Only transports whose verify_header() can return negative are affected: GRE and L2TPv3 do so on a cookie/session-id mismatch (raw/tap do not), so any peer on such a transport can trigger it without authentication. Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at>
2026-04-08um: drivers: call kernel_strrchr() explicitly in cow_user.cMichael Bommarito
Building ARCH=um on glibc >= 2.43 fails: arch/um/drivers/cow_user.c: error: implicit declaration of function 'strrchr' [-Wimplicit-function-declaration] glibc 2.43's C23 const-preserving strrchr() macro does not survive UML's global -Dstrrchr=kernel_strrchr remap from arch/um/Makefile. Call kernel_strrchr() directly in cow_user.c so the source no longer depends on the -D rewrite. Fixes: 2c51a4bc0233 ("um: fix strrchr() problems") Suggested-by: Johannes Berg <johannes@sipsolutions.net> Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4-6 Assisted-by: Codex:gpt-5-4 Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Link: https://patch.msgid.link/20260408070102.2325572-1-michael.bommarito@gmail.com [remove unnecessary 'extern'] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-02-23ubd: Use pointer-to-pointers for io_thread_req arraysKees Cook
Having an unbounded array for irq_req_buffer and io_req_buffer doesn't provide any bounds safety, and confuses the needed allocation type, which is returning a pointer to pointers. Instead of the implicit cast, switch the variable types. Reported-by: Nathan Chancellor <nathan@kernel.org> Reported-by: Guenter Roeck <linux@roeck-us.net> Closes: https://lore.kernel.org/all/b04b6c13-7d0e-4a89-9e68-b572b6c686ac@roeck-us.net Fixes: 69050f8d6d07 ("treewide: Replace kmalloc with kmalloc_obj for non-scalar types") Acked-by: Richard Weinberger <richard@nod.at> Link: https://patch.msgid.link/20260223214341.work.846-kees@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
2026-02-22Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL usesKees Cook
Conversion performed via this Coccinelle script: // SPDX-License-Identifier: GPL-2.0-only // Options: --include-headers-for-types --all-includes --include-headers --keep-comments virtual patch @gfp depends on patch && !(file in "tools") && !(file in "samples")@ identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex, kzalloc_obj,kzalloc_objs,kzalloc_flex, kvmalloc_obj,kvmalloc_objs,kvmalloc_flex, kvzalloc_obj,kvzalloc_objs,kvzalloc_flex}; @@ ALLOC(... - , GFP_KERNEL ) $ make coccicheck MODE=patch COCCI=gfp.cocci Build and boot tested x86_64 with Fedora 42's GCC and Clang: Linux version 6.19.0+ (user@host) (gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7), GNU ld version 2.44-12.fc42) #1 SMP PREEMPT_DYNAMIC 1970-01-01 Linux version 6.19.0+ (user@host) (clang version 20.1.8 (Fedora 20.1.8-4.fc42), LLD 20.1.8) #1 SMP PREEMPT_DYNAMIC 1970-01-01 Signed-off-by: Kees Cook <kees@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21Convert more 'alloc_obj' cases to default GFP_KERNEL argumentsLinus Torvalds
This converts some of the visually simpler cases that have been split over multiple lines. I only did the ones that are easy to verify the resulting diff by having just that final GFP_KERNEL argument on the next line. Somebody should probably do a proper coccinelle script for this, but for me the trivial script actually resulted in an assertion failure in the middle of the script. I probably had made it a bit _too_ trivial. So after fighting that far a while I decided to just do some of the syntactically simpler cases with variations of the previous 'sed' scripts. The more syntactically complex multi-line cases would mostly really want whitespace cleanup anyway. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21Convert 'alloc_obj' family to use the new default GFP_KERNEL argumentLinus Torvalds
This was done entirely with mindless brute force, using git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' | xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/' to convert the new alloc_obj() users that had a simple GFP_KERNEL argument to just drop that argument. Note that due to the extreme simplicity of the scripting, any slightly more complex cases spread over multiple lines would not be triggered: they definitely exist, but this covers the vast bulk of the cases, and the resulting diff is also then easier to check automatically. For the same reason the 'flex' versions will be done as a separate conversion. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21treewide: Replace kmalloc with kmalloc_obj for non-scalar typesKees Cook
This is the result of running the Coccinelle script from scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to avoid scalar types (which need careful case-by-case checking), and instead replace kmalloc-family calls that allocate struct or union object instances: Single allocations: kmalloc(sizeof(TYPE), ...) are replaced with: kmalloc_obj(TYPE, ...) Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...) are replaced with: kmalloc_objs(TYPE, COUNT, ...) Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...) are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...) (where TYPE may also be *VAR) The resulting allocations no longer return "void *", instead returning "TYPE *". Signed-off-by: Kees Cook <kees@kernel.org>
2026-02-13Merge tag 'uml-for-7.0-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux Pull UML updates from Johannes Berg: "UML was _really_ quiet, with just four small commits: - two signal handling fixes - dynamic addition of virtio devices - a single code cleanup" * tag 'uml-for-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux: arch/um: remove unused varible err in remove_files_and_dir() um: virtio_uml: Support adding devices via mconsole um: Handle SIGCHLD in seccomp mode like other IRQ signals um: Preserve errno within signal handler
2026-01-20kernel.h: drop hex.h and update all hex.h usersRandy Dunlap
Remove <linux/hex.h> from <linux/kernel.h> and update all users/callers of hex.h interfaces to directly #include <linux/hex.h> as part of the process of putting kernel.h on a diet. Removing hex.h from kernel.h means that 36K C source files don't have to pay the price of parsing hex.h for the roughly 120 C source files that need it. This change has been build-tested with allmodconfig on most ARCHes. Also, all users/callers of <linux/hex.h> in the entire source tree have been updated if needed (if not already #included). Link: https://lkml.kernel.org/r/20251215005206.2362276-1-rdunlap@infradead.org Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Yury Norov (NVIDIA) <yury.norov@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2026-01-13um: virtio_uml: Support adding devices via mconsoleTiwei Bie
It can be used when we want to add virtio devices to UML while it's up and running. Virtio devices can be added to UML using the same syntax as the command line option: (mconsole) config virtio_uml.device=<socket>:<virtio_id>[:<platform_id>] Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Link: https://patch.msgid.link/20260106004259.1604736-1-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-11-24um: drivers: virtio: use string choices helperKuninori Morimoto
Remove hard-coded strings by using the string helper functions Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://patch.msgid.link/87h5uywtwp.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-10-27um: Remove file-based iomem emulation supportTiwei Bie
The file-based iomem emulation was introduced to support writing paravirtualized drivers based on emulated iomem regions. However, the only driver that makes use of it is an example driver called mmapper, which was written over two decades ago. We now have several modern device emulation mechanisms, such as vhost-user-based virtio-uml. Remove the file-based iomem emulation support to reduce the maintenance burden. Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Link: https://patch.msgid.link/20251027054519.1996090-5-tiwei.bie@linux.dev Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-10-06Merge tag 'uml-for-linux-6.18-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux Pull uml updates from Johannes Berg: - minor preparations for SMP support - SPARSE_IRQ support for kunit - help output cleanups * tag 'uml-for-linux-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux: um: Remove unused ipi_pipe field from cpuinfo_um um: Remove unused cpu_data and current_cpu_data macros um: Stop tracking virtual CPUs via mm_cpumask() um: Centralize stub size calculations um: Remove outdated comment about STUB_DATA_PAGES um: Remove unused offset and child_err fields from stub_data um: Indent time-travel help messages um: Fix help message for ssl-non-raw um: vector: Fix indentation for help message um: Add missing trailing newline to help messages um: virtio-pci: implement .shutdown() um: Support SPARSE_IRQ
2025-10-02Merge tag 'for-6.18/block-20250929' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux Pull block updates from Jens Axboe: - NVMe pull request via Keith: - FC target fixes (Daniel) - Authentication fixes and updates (Martin, Chris) - Admin controller handling (Kamaljit) - Target lockdep assertions (Max) - Keep-alive updates for discovery (Alastair) - Suspend quirk (Georg) - MD pull request via Yu: - Add support for a lockless bitmap. A key feature for the new bitmap are that the IO fastpath is lockless. If a user issues lots of write IO to the same bitmap bit in a short time, only the first write has additional overhead to update bitmap bit, no additional overhead for the following writes. By supporting only resync or recover written data, means in the case creating new array or replacing with a new disk, there is no need to do a full disk resync/recovery. - Switch ->getgeo() and ->bios_param() to using struct gendisk rather than struct block_device. - Rust block changes via Andreas. This series adds configuration via configfs and remote completion to the rnull driver. The series also includes a set of changes to the rust block device driver API: a few cleanup patches, and a few features supporting the rnull changes. The series removes the raw buffer formatting logic from `kernel::block` and improves the logic available in `kernel::string` to support the same use as the removed logic. - floppy arch cleanups - Reduce the number of dereferencing needed for ublk commands - Restrict supported sockets for nbd. Mostly done to eliminate a class of issues perpetually reported by syzbot, by using nonsensical socket setups. - A few s390 dasd block fixes - Fix a few issues around atomic writes - Improve DMA interation for integrity requests - Improve how iovecs are treated with regards to O_DIRECT aligment constraints. We used to require each segment to adhere to the constraints, now only the request as a whole needs to. - Clean up and improve p2p support, enabling use of p2p for metadata payloads - Improve locking of request lookup, using SRCU where appropriate - Use page references properly for brd, avoiding very long RCU sections - Fix ordering of recursively submitted IOs - Clean up and improve updating nr_requests for a live device - Various fixes and cleanups * tag 'for-6.18/block-20250929' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (164 commits) s390/dasd: enforce dma_alignment to ensure proper buffer validation s390/dasd: Return BLK_STS_INVAL for EINVAL from do_dasd_request ublk: remove redundant zone op check in ublk_setup_iod() nvme: Use non zero KATO for persistent discovery connections nvmet: add safety check for subsys lock nvme-core: use nvme_is_io_ctrl() for I/O controller check nvme-core: do ioccsz/iorcsz validation only for I/O controllers nvme-core: add method to check for an I/O controller blk-cgroup: fix possible deadlock while configuring policy blk-mq: fix null-ptr-deref in blk_mq_free_tags() from error path blk-mq: Fix more tag iteration function documentation selftests: ublk: fix behavior when fio is not installed ublk: don't access ublk_queue in ublk_unmap_io() ublk: pass ublk_io to __ublk_complete_rq() ublk: don't access ublk_queue in ublk_need_complete_req() ublk: don't access ublk_queue in ublk_check_commit_and_fetch() ublk: don't pass ublk_queue to ublk_fetch() ublk: don't access ublk_queue in ublk_config_io_buf() ublk: don't access ublk_queue in ublk_check_fetch_buf() ublk: pass q_id and tag to __ublk_check_and_get_req() ...
2025-09-10um: virtio_uml: Fix use-after-free after put_device in probeMiaoqian Lin
When register_virtio_device() fails in virtio_uml_probe(), the code sets vu_dev->registered = 1 even though the device was not successfully registered. This can lead to use-after-free or other issues. Fixes: 04e5b1fb0183 ("um: virtio: Remove device on disconnect") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-09-10um: Fix help message for ssl-non-rawTiwei Bie
Add the missing option name in the help message. Additionally, switch to __uml_help(), because this is a global option rather than a per-channel option. Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-09-10um: vector: Fix indentation for help messageTiwei Bie
For consistency with other help messages, use four spaces for indentation instead of a tab plus a space. Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-09-10um: Add missing trailing newline to help messagesTiwei Bie
Some help messages are missing a trailing newline. They should end with two newlines, but only one is present. Add the missing newline to make the --help output more readable. Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-09-10um: virtio-pci: implement .shutdown()Johannes Berg
We don't want queues stopped since the shutdown can still be doing things with PCI devices, so implement .shutdown() to avoid the generic virtio shutdown. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-08-13block: switch ->getgeo() to struct gendiskAl Viro
Instances are happier that way and it makes more sense anyway - the only part of the result that is related to partition we are given is the start sector, and that has been filled in by the caller. Everything else is a function of the disk. Only one instance (DASD) is ever looking at anything other than bdev->bd_disk and that one is trivial to adjust. Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2025-07-11um: vfio: Support adding devices via mconsoleTiwei Bie
It can be used when we want to pass through PCI devices to UML while it's up and running. PCI devices can be passed through to UML using the same syntax as the command line option: (mconsole) config vfio_uml.device=<domain:bus:slot.function> Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Link: https://patch.msgid.link/20250709010021.1076902-1-tiwei.bie@linux.dev Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-07-11um: rtc: Avoid shadowing err in uml_rtc_start()Tiwei Bie
Remove the declaration of 'err' inside the 'if (timetravel)' block, as it would otherwise be unavailable outside that block, potentially leading to uml_rtc_start() returning an uninitialized value. Fixes: dde8b58d5127 ("um: add a pseudo RTC") Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Link: https://patch.msgid.link/20250708090403.1067440-5-tiwei.bie@linux.dev Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-07-11um: virt-pci: Switch to msi_create_parent_irq_domain()Nam Cao
Move away from the legacy MSI domain setup, switch to use msi_create_parent_irq_domain(). Signed-off-by: Nam Cao <namcao@linutronix.de> Acked-by: Johannes Berg <johannes@sipsolutions.net> Tested-by: Johannes Berg <johannes@sipsolutions.net> Link: https://patch.msgid.link/5f0bd8e877e7bfdfb1a7e99d6b126caf6a7eea48.1751266049.git.namcao@linutronix.de Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-07-04um: virtio_pcidev: Rename UM_PCI_STAT_WAITINGTiwei Bie
Rename it to VIRTIO_PCIDEV_STAT_WAITING to make the code slightly more consistent. It was missed when refactoring virtio_pcidev into a separate module. Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Link: https://patch.msgid.link/20250606124428.148164-3-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-06-25um: vector: Reduce stack usage in vector_eth_configure()Tiwei Bie
When compiling with clang (19.1.7), initializing *vp using a compound literal may result in excessive stack usage. Fix it by initializing the required fields of *vp individually. Without this patch: $ objdump -d arch/um/drivers/vector_kern.o | ./scripts/checkstack.pl x86_64 0 ... 0x0000000000000540 vector_eth_configure [vector_kern.o]:1472 ... With this patch: $ objdump -d arch/um/drivers/vector_kern.o | ./scripts/checkstack.pl x86_64 0 ... 0x0000000000000540 vector_eth_configure [vector_kern.o]:208 ... Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202506221017.WtB7Usua-lkp@intel.com/ Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Link: https://patch.msgid.link/20250623110829.314864-1-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-06-25um: vfio: Prevent duplicate device assignmentsTiwei Bie
Ensure devices are assigned only once. Reject subsequent requests for duplicate assignments. Fixes: a0e2cb6a9063 ("um: Add VFIO-based virtual PCI driver") Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Link: https://patch.msgid.link/20250606124428.148164-4-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-06-25um: ubd: Add missing error check in start_io_thread()Tiwei Bie
The subsequent call to os_set_fd_block() overwrites the previous return value. OR the two return values together to fix it. Fixes: f88f0bdfc32f ("um: UBD Improvements") Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Link: https://patch.msgid.link/20250606124428.148164-2-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-06-08treewide, timers: Rename from_timer() to timer_container_of()Ingo Molnar
Move this API to the canonical timer_*() namespace. [ tglx: Redone against pre rc1 ] Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/aB2X0jCKQO56WdMt@gmail.com
2025-06-02um: vector: Use mac_pton() for MAC address parsingTiwei Bie
Use mac_pton() instead of custom approach. Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Link: https://patch.msgid.link/20250506045117.1896661-3-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-06-02um: vector: Clean up and modernize log messagesTiwei Bie
Use pr_*() and netdev_*() to print log messages. While at it, join split messages for easier grepping. Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Link: https://patch.msgid.link/20250506045117.1896661-2-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-06-02um: chan_kern: use raw spinlock for irqs_to_free_lockJohannes Berg
Since this is called deep in the ARCH=um IRQ infrastructure it must use a raw spinlock. It's not really part of the driver, but rather the core UML IRQ code. Link: https://patch.msgid.link/20250505103358.ae7dc659f8b4.I64ca7aece30e0b4b0b5b35ad89cdd63db197c0ce@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-05-05um: Remove legacy network transport infrastructureTiwei Bie
All legacy network transports have been removed. Vector transports provide the same capabilities with significantly higher network throughput. There is no reason to keep the legacy network transport infrastructure anymore. Remove it to reduce the maintenance burden. Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com> Link: https://patch.msgid.link/20250503051710.3286595-4-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-05-05um: vector: Eliminate the dependency on uml_netTiwei Bie
The only dependency on uml_net (i.e., the legacy network transport infrastructure) is the call to uml_net_setup_etheraddr(). Implement it inside vector to eliminate the uml_net dependency completely. It will allow us to remove uml_net in the next step. Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com> Link: https://patch.msgid.link/20250503051710.3286595-3-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-05-05um: Remove obsolete legacy network transportsTiwei Bie
These legacy network transports were marked as obsolete in commit 40814b98a570 ("um: Mark non-vector net transports as obsolete"). More than five years have passed since then. Remove these network transports to reduce the maintenance burden. Suggested-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com> Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com> Link: https://patch.msgid.link/20250503051710.3286595-2-tiwei.btw@antgroup.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-05-05irqdomain: um: use irq_domain_create_linear() helperJiri Slaby (SUSE)
um_pci_init() open-codes what the irq_domain_create_linear() helper does already. Use the helper instead of open-coding it. This needs retval checking modification. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Richard Weinberger <richard@nod.at> Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: linux-um@lists.infradead.org Link: https://patch.msgid.link/20250415104713.106819-1-jirislaby@kernel.org Signed-off-by: Johannes Berg <johannes.berg@intel.com>