28 Sep, 2022

1 commit

  • [ Upstream commit 782b1f70f8a8b28571949d2ba43fe88b96d75ec3 ]

    OpenWrt's UML with 5.15 was producing odd errors/warnings during preinit
    part of the early userspace portion:

    |[ 0.000000] Kernel command line: ubd0=root.img root=98:0 console=tty
    |[...]
    |[ 0.440000] random: jshn: uninitialized urandom read (4 bytes read)
    |[ 0.460000] random: jshn: uninitialized urandom read (4 bytes read)
    |/etc/preinit: line 47: can't create /dev/tty: No such device or address
    |/etc/preinit: line 48: can't create /dev/tty: No such device or address
    |/etc/preinit: line 58: can't open /dev/tty: No such device or address
    |[...] repeated many times

    That "/dev/tty" came from the command line (which is automatically
    added if no console= parameter was specified for the uml binary).

    The TLDP project tells the following about the /dev/tty:

    | /dev/tty stands for the controlling terminal (if any) for the current
    | process.[...]
    | /dev/tty is something like a link to the actually terminal device[..]

    The "(if any)" is important here, since it's possible for processes to
    not have a controlling terminal.

    I think this was a simple typo and the author wanted tty0 there.

    CC: Thomas Meyer
    Fixes: d7ffac33631b ("um: stdio_console: Make preferred console")
    Signed-off-by: Christian Lamparter
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Christian Lamparter
     

25 Aug, 2022

1 commit

  • [ Upstream commit dda520d07b95072a0b63f6c52a8eb566d08ea897 ]

    QEMU has a -no-reboot option, which halts instead of reboots when the
    guest asks to reboot. This is invaluable when used with
    CONFIG_PANIC_TIMEOUT=-1 (and panic_on_warn), because it allows panics
    and warnings to be caught immediately in CI. Implement this in UML too,
    by way of a basic setup param.

    Signed-off-by: Jason A. Donenfeld
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Jason A. Donenfeld
     

17 Aug, 2022

3 commits

  • [ Upstream commit 9e70cbd11b03889c92462cf52edb2bd023c798fa ]

    Initialising the hwrng struct with zeros causes a
    compile-time sparse warning:

    $ ARCH=um make -j10 W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
    ...
    CHECK arch/um/drivers/random.c
    arch/um/drivers/random.c:31:31: sparse: warning: Using plain integer as NULL pointer

    Fix the warning by not initialising the hwrng struct
    with zeros as it is initialised anyway during module
    init.

    Fixes: 72d3e093afae ("um: random: Register random as hwrng-core device")
    Reported-by: kernel test robot
    Signed-off-by: Christopher Obbard
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Christopher Obbard
     
  • commit 0b9ba6135d7f18b82f3d8bebb55ded725ba88e0e upstream.

    UML generally does not provide access to special CPU instructions like
    RDRAND, and execution tends to be rather deterministic, with no real
    hardware interrupts, making good randomness really very hard, if not
    all together impossible. Not only is this a security eyebrow raiser, but
    it's also quite annoying when trying to do various pieces of UML-based
    automation that takes a long time to boot, if ever.

    Fix this by trivially calling getrandom() in the host and using that
    seed as "bootloader randomness", which initializes the rng immediately
    at UML boot.

    The old behavior can be restored the same way as on any other arch, by
    way of CONFIG_TRUST_BOOTLOADER_RANDOMNESS=n or
    random.trust_bootloader=0. So seen from that perspective, this just
    makes UML act like other archs, which is positive in its own right.

    Additionally, wire up arch_get_random_{int,long}() in the same way, so
    that reseeds can also make use of the host RNG, controllable by
    CONFIG_TRUST_CPU_RANDOMNESS and random.trust_cpu, per usual.

    Cc: stable@vger.kernel.org
    Acked-by: Johannes Berg
    Acked-By: Anton Ivanov
    Signed-off-by: Jason A. Donenfeld
    Signed-off-by: Greg Kroah-Hartman

    Jason A. Donenfeld
     
  • commit c6496e0a4a90d8149203c16323cff3fa46e422e7 upstream.

    Commit e3a33af812c6 ("um: fix and optimize xor select template for CONFIG64 and timetravel mode")
    caused a build regression when CONFIG_XOR_BLOCKS and CONFIG_UML_TIME_TRAVEL_SUPPORT
    are selected.
    Fix it by removing the straying parenthesis.

    Cc: stable@vger.kernel.org
    Fixes: e3a33af812c6 ("um: fix and optimize xor select template for CONFIG64 and timetravel mode")
    Signed-off-by: Benjamin Beichler
    [rw: Added commit message]
    Signed-off-by: Richard Weinberger
    Signed-off-by: Greg Kroah-Hartman

    Benjamin Beichler
     

29 Jul, 2022

2 commits

  • [ Upstream commit af9fb41ed315ce95f659f0b10b4d59a71975381d ]

    If a device implementation crashes, virtio_uml will mark it
    as dead by calling virtio_break_device() and scheduling the
    work that will remove it.

    This still seems like the right thing to do, but it's done
    directly while reading the message, and if time-travel is
    used, this is in the time-travel handler, outside of the
    normal Linux machinery. Therefore, we cannot acquire locks
    or do normal "linux-y" things because e.g. lockdep will be
    confused about the context.

    Move handling this situation out of the read function and
    into the actual IRQ handler and response handling instead,
    so that in the case of time-travel we don't call it in the
    wrong context.

    Chances are the system will still crash immediately, since
    the device implementation crashing may also cause the time-
    travel controller to go down, but at least all of that now
    happens without strange warnings from lockdep.

    Fixes: c8177aba37ca ("um: time-travel: rework interrupt handling in ext mode")
    Cc: stable@vger.kernel.org
    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Johannes Berg
     
  • [ Upstream commit db0dd9cee82270e032123169ceff659eced5115d ]

    Allow the virtio_uml device to be probed from the devicetree so that
    sub-devices can be specified using the standard virtio bindings, for
    example:

    virtio@1 {
    compatible = "virtio,uml";
    socket-path = "i2c.sock";
    virtio-device-id = ;

    i2c-controller {
    compatible = "virtio,device22";
    #address-cells = ;
    #size-cells = ;

    light-sensor@01 {
    compatible = "ti,opt3001";
    reg = ;
    };
    };
    };

    Signed-off-by: Vincent Whitchurch
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Vincent Whitchurch
     

23 Jul, 2022

2 commits

  • commit 564d998106397394b6aad260f219b882b3347e62 upstream.

    Implement apply_returns() stub for UM, just like all the other patching
    routines.

    Fixes: 15e67227c49a ("x86: Undo return-thunk damage")
    Reported-by: Randy Dunlap
    Signed-off-by: Borislav Petkov
    Link: https://lore.kernel.org/r/Ys%2Ft45l%2FgarIrD0u@worktop.programming.kicks-ass.net
    Signed-off-by: Greg Kroah-Hartman

    Peter Zijlstra
     
  • commit 7508500900814d14e2e085cdc4e28142721abbdf upstream.

    Rewrite retpoline thunk call sites to be indirect calls for
    spectre_v2=off. This ensures spectre_v2=off is as near to a
    RETPOLINE=n build as possible.

    This is the replacement for objtool writing alternative entries to
    ensure the same and achieves feature-parity with the previous
    approach.

    One noteworthy feature is that it relies on the thunks to be in
    machine order to compute the register index.

    Specifically, this does not yet address the Jcc __x86_indirect_thunk_*
    calls generated by clang, a future patch will add this.

    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Borislav Petkov
    Acked-by: Josh Poimboeuf
    Tested-by: Alexei Starovoitov
    Link: https://lore.kernel.org/r/20211026120310.232495794@infradead.org
    [cascardo: small conflict fixup at arch/x86/kernel/module.c]
    Signed-off-by: Thadeu Lima de Souza Cascardo
    Signed-off-by: Greg Kroah-Hartman

    Peter Zijlstra
     

15 Jun, 2022

1 commit

  • [ Upstream commit d5a9597d6916a76663085db984cb8fe97f0a5c56 ]

    Today, all possible serial lines (ssl*=) as well as all
    possible consoles (con*=) each share a single interrupt
    (with a fixed number) with others of the same type.

    Now, if you have two lines, say ssl0 and ssl1, and one
    of them is connected to an fd you cannot read (e.g. a
    file), but the other gets a read interrupt, then both
    of them get the interrupt since it's shared. Then, the
    read() call will return EOF, since it's a file being
    written and there's nothing to read (at least not at
    the current offset, at the end).

    Unfortunately, this is treated as a read error, and we
    close this line, losing all the possible output.

    It might be possible to work around this and make the
    IRQ sharing work, however, now that we have dynamically
    allocated IRQs that are easy to use, simply use that to
    achieve separating between the events; then there's no
    interrupt for that line and we never attempt the read
    in the first place, thus not closing the line.

    This manifested itself in the wifi hostap/hwsim tests
    where the parallel script communicates via one serial
    console and the kernel messages go to another (a file)
    and sending data on the communication console caused
    the kernel messages to stop flowing into the file.

    Reported-by: Jouni Malinen
    Signed-off-by: Johannes Berg
    Acked-By: anton ivanov
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Johannes Berg
     

09 Jun, 2022

3 commits

  • commit 57ae0b67b747031bc41fb44643aa5344ab58607e upstream.

    The previous fix here was only partially correct, it did
    result in returning a proper error value in case of error,
    but it also clobbered the pid that we need to return from
    this function (not just zero for success).

    As a result, it returned 0 here, but later this is treated
    as a pid and used to kill the process, but since it's now
    0 we kill(0, SIGKILL), which makes UML kill itself rather
    than just the helper thread.

    Fix that and make it more obvious by using a separate
    variable for the pid.

    Fixes: ccf1236ecac4 ("um: fix error return code in winch_tramp()")
    Reported-and-tested-by: Nathan Chancellor
    Signed-off-by: Johannes Berg
    Cc: stable@vger.kernel.org
    Signed-off-by: Richard Weinberger
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • commit 365719035526e8eda214a1cedb2e1c96e969a0d7 upstream.

    If DMA (PCI over virtio) is enabled, then some drivers may
    enable CONFIG_DMA_OPS as well, and then we pull in the x86
    definition of get_arch_dma_ops(), which uses the dma_ops
    symbol, which isn't defined.

    Since we don't have real DMA ops nor any kind of IOMMU fix
    this in the simplest possible way: pull in the asm-generic
    file instead of inheriting the x86 one. It's not clear why
    those drivers that do (e.g. VDPA) "select DMA_OPS", and if
    they'd even work with this, but chances are nobody will be
    wanting to do that anyway, so fixing the build failure is
    good enough.

    Reported-by: Randy Dunlap
    Fixes: 68f5d3f3b654 ("um: add PCI over virtio emulation driver")
    Signed-off-by: Johannes Berg
    Tested-by: Randy Dunlap
    Acked-by: Randy Dunlap
    Cc: stable@vger.kernel.org
    Signed-off-by: Richard Weinberger
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • commit c200e4bb44e80b343c09841e7caaaca0aac5e5fa upstream.

    User mode linux is the last user of the PT_DTRACE flag. Using the flag to indicate
    single stepping is a little confusing and worse changing tsk->ptrace without locking
    could potentionally cause problems.

    So use a thread info flag with a better name instead of flag in tsk->ptrace.

    Remove the definition PT_DTRACE as uml is the last user.

    Cc: stable@vger.kernel.org
    Acked-by: Johannes Berg
    Tested-by: Kees Cook
    Reviewed-by: Oleg Nesterov
    Link: https://lkml.kernel.org/r/20220505182645.497868-3-ebiederm@xmission.com
    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     

30 May, 2022

1 commit

  • commit 9f13fb0cd11ed2327abff69f6501a2c124c88b5a upstream.

    In the event that random_get_entropy() can't access a cycle counter or
    similar, falling back to returning 0 is really not the best we can do.
    Instead, at least calling random_get_entropy_fallback() would be
    preferable, because that always needs to return _something_, even
    falling back to jiffies eventually. It's not as though
    random_get_entropy_fallback() is super high precision or guaranteed to
    be entropic, but basically anything that's not zero all the time is
    better than returning zero all the time.

    This is accomplished by just including the asm-generic code like on
    other architectures, which means we can get rid of the empty stub
    function here.

    Cc: Thomas Gleixner
    Cc: Arnd Bergmann
    Cc: Richard Weinberger
    Cc: Anton Ivanov
    Acked-by: Johannes Berg
    Signed-off-by: Jason A. Donenfeld
    Signed-off-by: Greg Kroah-Hartman

    Jason A. Donenfeld
     

14 Apr, 2022

1 commit

  • [ Upstream commit e3a33af812c611d99756e2ec61e9d7068d466bdf ]

    Due to dropped inclusion of asm-generic/xor.h, xor_block_8regs symbol is
    missing with CONFIG64 and break compilation, as the asm/xor_64.h also did
    not include it. The patch recreate the logic from arch/x86, which check
    whether AVX is available and add fallbacks for 32bit and 64bit config of
    um.

    A very minor additional "fix" is, the return of the macro parameter
    instead of NULL, as this is the original intent of the macro, but
    this does not change the actual behavior.

    Fixes: c0ecca6604b8 ("um: enable the use of optimized xor routines in UML")
    Signed-off-by: Benjamin Beichler
    Acked-By: Anton Ivanov
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Benjamin Beichler
     

08 Apr, 2022

1 commit

  • commit 1a3a6a2a035bb6c3a7ef4c788d8fd69a7b2d6284 upstream.

    Moving to an EPOLL based IRQ controller broke uml_mconsole stop/go
    commands. This fixes it and restores stop/go functionality.

    Fixes: ff6a17989c08 ("Epoll based IRQ controller")
    Signed-off-by: Anton Ivanov
    Signed-off-by: Richard Weinberger
    Signed-off-by: Greg Kroah-Hartman

    Anton Ivanov
     

16 Mar, 2022

1 commit

  • commit b81e0c2372e65e5627864ba034433b64b2fc73f5 upstream.

    Drop various include not actually used in genhd.h itself, and
    move the remaning includes closer together.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Johannes Thumshirn
    Link: https://lore.kernel.org/r/20210920123328.1399408-15-hch@lst.de
    Signed-off-by: Jens Axboe
    Reported-by: Sudip Mukherjee a
    Reported-by: "H. Nikolaus Schaller"
    Reported-by: Guenter Roeck
    Cc: "Maciej W. Rozycki"
    [ resolves MIPS build failure by luck, root cause needs to be fixed in
    Linus's tree properly, but this is needed for now to fix the build - gregkh ]
    Signed-off-by: Greg Kroah-Hartman

    Christoph Hellwig
     

27 Jan, 2022

6 commits

  • commit 4b86366fdfbedec42f8f7ee037775f2839921d34 upstream.

    This file is generated, we should ignore it.

    Fixes: d8fb32f4790f ("um: Add support for host CPU flags and alignment")
    Signed-off-by: Johannes Berg
    Acked-By: anton.ivanov@cambridgegreys.com
    Signed-off-by: Richard Weinberger
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • [ Upstream commit 077b7320942b64b0da182aefd83c374462a65535 ]

    The function names init_registers() and restore_registers() are used
    in several net/ethernet/ and gpu/drm/ drivers for other purposes (not
    calls to UML functions), so rename them.

    This fixes multiple build errors.

    Signed-off-by: Randy Dunlap
    Cc: Jeff Dike
    Cc: Richard Weinberger
    Cc: Anton Ivanov
    Cc: linux-um@lists.infradead.org
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Randy Dunlap
     
  • [ Upstream commit 85e73968a040c642fd38f6cba5b73b61f5d0f052 ]

    When creating an external event, the current time needs to
    be propagated to other participants of a simulation. This
    is done in the places here where we kick a virtq etc.

    However, it must be done for _all_ external events, and
    that includes making the initial socket connection and
    later closing it. Call time_travel_propagate_time() to do
    this before making or closing the socket connection.

    Apparently, at least for the initial connection creation,
    due to the remote side in my use cases using microseconds
    (rather than nanoseconds), this wasn't a problem yet; only
    started failing between 5.14-rc1 and 5.15-rc1 (didn't test
    others much), or possibly depending on the configuration,
    where more delays happen before the virtio devices are
    initialized.

    Fixes: 88ce64249233 ("um: Implement time-travel=ext")
    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Johannes Berg
     
  • [ Upstream commit d73820df6437b5d0a57be53faf39db46a0264b3a ]

    There were a few 32-bit compile warnings that of course
    turned into errors with -Werror, fix the 32-bit build.

    Fixes: 68f5d3f3b654 ("um: add PCI over virtio emulation driver")
    Reported-by: Al Viro
    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Johannes Berg
     
  • [ Upstream commit bbe33504d4a7fdab9011211e55e262c869b3f6cc ]

    Rename set_signals() as there's at least one driver that
    uses the same name and can now be built on UM due to PCI
    support, and thus we can get symbol conflicts.

    Also rename set_signals_trace() to be consistent.

    Reported-by: kernel test robot
    Fixes: 68f5d3f3b654 ("um: add PCI over virtio emulation driver")
    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Johannes Berg
     
  • [ Upstream commit 5f8539e2ff962e25b57742ca7106456403abbc94 ]

    Many places in the kernel use 'udelay' as an identifier, and
    are broken with the current "#define udelay um_udelay". Fix
    this by adding an argument to the macro, and do the same to
    'ndelay' as well, just in case.

    Fixes: 0bc8fb4dda2b ("um: Implement ndelay/udelay in time-travel mode")
    Reported-by: kernel test robot
    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Johannes Berg
     

25 Nov, 2021

1 commit

  • commit e21294a7aaae32c5d7154b187113a04db5852e37 upstream.

    Now that force_fatal_sig exists it is unnecessary and a bit confusing
    to use force_sigsegv in cases where the simpler force_fatal_sig is
    wanted. So change every instance we can to make the code clearer.

    Acked-by: Geert Uytterhoeven
    Reviewed-by: Philippe Mathieu-Daudé
    Link: https://lkml.kernel.org/r/877de7jrev.fsf@disp2133
    Signed-off-by: "Eric W. Biederman"
    Cc: Thomas Backlund
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     

10 Sep, 2021

1 commit

  • Pull UML updates from Richard Weinberger:

    - Support for VMAP_STACK

    - Support for splice_write in hostfs

    - Fixes for virt-pci

    - Fixes for virtio_uml

    - Various fixes

    * tag 'for-linus-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
    um: fix stub location calculation
    um: virt-pci: fix uapi documentation
    um: enable VMAP_STACK
    um: virt-pci: don't do DMA from stack
    hostfs: support splice_write
    um: virtio_uml: fix memory leak on init failures
    um: virtio_uml: include linux/virtio-uml.h
    lib/logic_iomem: fix sparse warnings
    um: make PCI emulation driver init/exit static

    Linus Torvalds
     

09 Sep, 2021

2 commits

  • Merge more updates from Andrew Morton:
    "147 patches, based on 7d2a07b769330c34b4deabeed939325c77a7ec2f.

    Subsystems affected by this patch series: mm (memory-hotplug, rmap,
    ioremap, highmem, cleanups, secretmem, kfence, damon, and vmscan),
    alpha, percpu, procfs, misc, core-kernel, MAINTAINERS, lib,
    checkpatch, epoll, init, nilfs2, coredump, fork, pids, criu, kconfig,
    selftests, ipc, and scripts"

    * emailed patches from Andrew Morton : (94 commits)
    scripts: check_extable: fix typo in user error message
    mm/workingset: correct kernel-doc notations
    ipc: replace costly bailout check in sysvipc_find_ipc()
    selftests/memfd: remove unused variable
    Kconfig.debug: drop selecting non-existing HARDLOCKUP_DETECTOR_ARCH
    configs: remove the obsolete CONFIG_INPUT_POLLDEV
    prctl: allow to setup brk for et_dyn executables
    pid: cleanup the stale comment mentioning pidmap_init().
    kernel/fork.c: unexport get_{mm,task}_exe_file
    coredump: fix memleak in dump_vma_snapshot()
    fs/coredump.c: log if a core dump is aborted due to changed file permissions
    nilfs2: use refcount_dec_and_lock() to fix potential UAF
    nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group
    nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group
    nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group
    nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group
    nilfs2: fix NULL pointer in nilfs_##name##_attr_release
    nilfs2: fix memory leak in nilfs_sysfs_create_device_group
    trap: cleanup trap_init()
    init: move usermodehelper_enable() to populate_rootfs()
    ...

    Linus Torvalds
     
  • There are some empty trap_init() definitions in different ARCHs, Introduce
    a new weak trap_init() function to clean them up.

    Link: https://lkml.kernel.org/r/20210812123602.76356-1-wangkefeng.wang@huawei.com
    Signed-off-by: Kefeng Wang
    Acked-by: Russell King (Oracle) [arm32]
    Acked-by: Vineet Gupta [arc]
    Acked-by: Michael Ellerman [powerpc]
    Cc: Yoshinori Sato
    Cc: Ley Foon Tan
    Cc: Jonas Bonn
    Cc: Stefan Kristiansson
    Cc: Stafford Horne
    Cc: James E.J. Bottomley
    Cc: Helge Deller
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Paul Walmsley
    Cc: Jeff Dike
    Cc: Richard Weinberger
    Cc: Anton Ivanov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kefeng Wang
     

06 Sep, 2021

1 commit

  • Pull tracing updates from Steven Rostedt:

    - simplify the Kconfig use of FTRACE and TRACE_IRQFLAGS_SUPPORT

    - bootconfig can now start histograms

    - bootconfig supports group/all enabling

    - histograms now can put values in linear size buckets

    - execnames can be passed to synthetic events

    - introduce "event probes" that attach to other events and can retrieve
    data from pointers of fields, or record fields as different types (a
    pointer to a string as a string instead of just a hex number)

    - various fixes and clean ups

    * tag 'trace-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (35 commits)
    tracing/doc: Fix table format in histogram code
    selftests/ftrace: Add selftest for testing duplicate eprobes and kprobes
    selftests/ftrace: Add selftest for testing eprobe events on synthetic events
    selftests/ftrace: Add test case to test adding and removing of event probe
    selftests/ftrace: Fix requirement check of README file
    selftests/ftrace: Add clear_dynamic_events() to test cases
    tracing: Add a probe that attaches to trace events
    tracing/probes: Reject events which have the same name of existing one
    tracing/probes: Have process_fetch_insn() take a void * instead of pt_regs
    tracing/probe: Change traceprobe_set_print_fmt() to take a type
    tracing/probes: Use struct_size() instead of defining custom macros
    tracing/probes: Allow for dot delimiter as well as slash for system names
    tracing/probe: Have traceprobe_parse_probe_arg() take a const arg
    tracing: Have dynamic events have a ref counter
    tracing: Add DYNAMIC flag for dynamic events
    tracing: Replace deprecated CPU-hotplug functions.
    MAINTAINERS: Add an entry for os noise/latency
    tracepoint: Fix kerneldoc comments
    bootconfig/tracing/ktest: Update ktest example for boot-time tracing
    tools/bootconfig: Use per-group/all enable option in ftrace2bconf script
    ...

    Linus Torvalds
     

04 Sep, 2021

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - Add -s option (strict mode) to merge_config.sh to make it fail when
    any symbol is redefined.

    - Show a warning if a different compiler is used for building external
    modules.

    - Infer --target from ARCH for CC=clang to let you cross-compile the
    kernel without CROSS_COMPILE.

    - Make the integrated assembler default (LLVM_IAS=1) for CC=clang.

    - Add to the kernel source instead of borrowing
    from the compiler.

    - Add Nick Desaulniers as a Kbuild reviewer.

    - Drop stale cc-option tests.

    - Fix the combination of CONFIG_TRIM_UNUSED_KSYMS and CONFIG_LTO_CLANG
    to handle symbols in inline assembly.

    - Show a warning if 'FORCE' is missing for if_changed rules.

    - Various cleanups

    * tag 'kbuild-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (39 commits)
    kbuild: redo fake deps at include/ksym/*.h
    kbuild: clean up objtool_args slightly
    modpost: get the *.mod file path more simply
    checkkconfigsymbols.py: Fix the '--ignore' option
    kbuild: merge vmlinux_link() between ARCH=um and other architectures
    kbuild: do not remove 'linux' link in scripts/link-vmlinux.sh
    kbuild: merge vmlinux_link() between the ordinary link and Clang LTO
    kbuild: remove stale *.symversions
    kbuild: remove unused quiet_cmd_update_lto_symversions
    gen_compile_commands: extract compiler command from a series of commands
    x86: remove cc-option-yn test for -mtune=
    arc: replace cc-option-yn uses with cc-option
    s390: replace cc-option-yn uses with cc-option
    ia64: move core-y in arch/ia64/Makefile to arch/ia64/Kbuild
    sparc: move the install rule to arch/sparc/Makefile
    security: remove unneeded subdir-$(CONFIG_...)
    kbuild: sh: remove unused install script
    kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y
    kbuild: Switch to 'f' variants of integrated assembler flag
    kbuild: Shuffle blank line to improve comment meaning
    ...

    Linus Torvalds
     

02 Sep, 2021

3 commits

  • Pull printk updates from Petr Mladek:

    - Optionally, provide an index of possible printk messages via
    /printk/index/. It can be used when monitoring important
    kernel messages on a farm of various hosts. The monitor has to be
    updated when some messages has changed or are not longer available by
    a newly deployed kernel.

    - Add printk.console_no_auto_verbose boot parameter. It allows to
    generate crash dump even with slow consoles in a reasonable time
    frame.

    - Remove printk_safe buffers. The messages are always stored directly
    to the main logbuffer, even in NMI or recursive context. Also it
    allows to serialize syslog operations by a mutex instead of a spin
    lock.

    - Misc clean up and build fixes.

    * tag 'printk-for-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
    printk/index: Fix -Wunused-function warning
    lib/nmi_backtrace: Serialize even messages about idle CPUs
    printk: Add printk.console_no_auto_verbose boot parameter
    printk: Remove console_silent()
    lib/test_scanf: Handle n_bits == 0 in random tests
    printk: syslog: close window between wait and read
    printk: convert @syslog_lock to mutex
    printk: remove NMI tracking
    printk: remove safe buffers
    printk: track/limit recursion
    lib/nmi_backtrace: explicitly serialize banner and regs
    printk: Move the printk() kerneldoc comment to its new home
    printk/index: Fix warning about missing prototypes
    MIPS/asm/printk: Fix build failure caused by printk
    printk: index: Add indexing support to dev_printk
    printk: Userspace format indexing support
    printk: Rework parse_prefix into printk_parse_prefix
    printk: Straighten out log_flags into printk_info_flags
    string_helpers: Escape double quotes in escape_special
    printk/console: Check consistent sequence number when handling race in console_unlock()

    Linus Torvalds
     
  • Pull asm-generic updates from Arnd Bergmann:
    "The main content for 5.15 is a series that cleans up the handling of
    strncpy_from_user() and strnlen_user(), removing a lot of slightly
    incorrect versions of these in favor of the lib/strn*.c helpers that
    implement these correctly and more efficiently.

    The only architectures that retain a private version now are mips,
    ia64, um and parisc. I had offered to convert those at all, but Thomas
    Bogendoerfer wanted to keep the mips version for the moment until he
    had a chance to do regression testing.

    The branch also contains two patches for bitops and for ffs()"

    * tag 'asm-generic-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
    bitops/non-atomic: make @nr unsigned to avoid any DIV
    asm-generic: ffs: Drop bogus reference to ffz location
    asm-generic: reverse GENERIC_{STRNCPY_FROM,STRNLEN}_USER symbols
    asm-generic: remove extra strn{cpy_from,len}_user declarations
    asm-generic: uaccess: remove inline strncpy_from_user/strnlen_user
    s390: use generic strncpy/strnlen from_user
    microblaze: use generic strncpy/strnlen from_user
    csky: use generic strncpy/strnlen from_user
    arc: use generic strncpy/strnlen from_user
    hexagon: use generic strncpy/strnlen from_user
    h8300: remove stale strncpy_from_user
    asm-generic/uaccess.h: remove __strncpy_from_user/__strnlen_user

    Linus Torvalds
     
  • Pull tty / serial updates from Greg KH:
    "Here is the "big" set of tty/serial driver patches for 5.15-rc1

    Nothing major in here at all, just some driver updates and more
    cleanups on old tty apis and code that needed it that includes:

    - tty.h cleanup of things that didn't belong in it

    - other tty cleanups by Jiri

    - driver cleanups

    - rs485 support added to amba-pl011 driver

    - dts updates

    - stm32 serial driver updates

    - other minor fixes and driver updates

    All have been in linux-next for a while with no reported problems"

    * tag 'tty-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (83 commits)
    tty: serial: uartlite: Use read_poll_timeout for a polling loop
    tty: serial: uartlite: Use constants in early_uartlite_putc
    tty: Fix data race between tiocsti() and flush_to_ldisc()
    serial: vt8500: Use of_device_get_match_data
    serial: tegra: Use of_device_get_match_data
    serial: 8250_ingenic: Use of_device_get_match_data
    tty: serial: linflexuart: Remove redundant check to simplify the code
    tty: serial: fsl_lpuart: do software reset for imx7ulp and imx8qxp
    tty: serial: fsl_lpuart: enable two stop bits for lpuart32
    tty: serial: fsl_lpuart: fix the wrong mapbase value
    mxser: use semi-colons instead of commas
    tty: moxa: use semi-colons instead of commas
    tty: serial: fsl_lpuart: check dma_tx_in_progress in tx dma callback
    tty: replace in_irq() with in_hardirq()
    serial: sh-sci: fix break handling for sysrq
    serial: stm32: use devm_platform_get_and_ioremap_resource()
    serial: stm32: use the defined variable to simplify code
    Revert "arm pl011 serial: support multi-irq request"
    tty: serial: samsung: Add Exynos850 SoC data
    tty: serial: samsung: Fix driver data macros style
    ...

    Linus Torvalds
     

01 Sep, 2021

1 commit

  • Pull networking updates from Jakub Kicinski:
    "Core:

    - Enable memcg accounting for various networking objects.

    BPF:

    - Introduce bpf timers.

    - Add perf link and opaque bpf_cookie which the program can read out
    again, to be used in libbpf-based USDT library.

    - Add bpf_task_pt_regs() helper to access user space pt_regs in
    kprobes, to help user space stack unwinding.

    - Add support for UNIX sockets for BPF sockmap.

    - Extend BPF iterator support for UNIX domain sockets.

    - Allow BPF TCP congestion control progs and bpf iterators to call
    bpf_setsockopt(), e.g. to switch to another congestion control
    algorithm.

    Protocols:

    - Support IOAM Pre-allocated Trace with IPv6.

    - Support Management Component Transport Protocol.

    - bridge: multicast: add vlan support.

    - netfilter: add hooks for the SRv6 lightweight tunnel driver.

    - tcp:
    - enable mid-stream window clamping (by user space or BPF)
    - allow data-less, empty-cookie SYN with TFO_SERVER_COOKIE_NOT_REQD
    - more accurate DSACK processing for RACK-TLP

    - mptcp:
    - add full mesh path manager option
    - add partial support for MP_FAIL
    - improve use of backup subflows
    - optimize option processing

    - af_unix: add OOB notification support.

    - ipv6: add IFLA_INET6_RA_MTU to expose MTU value advertised by the
    router.

    - mac80211: Target Wake Time support in AP mode.

    - can: j1939: extend UAPI to notify about RX status.

    Driver APIs:

    - Add page frag support in page pool API.

    - Many improvements to the DSA (distributed switch) APIs.

    - ethtool: extend IRQ coalesce uAPI with timer reset modes.

    - devlink: control which auxiliary devices are created.

    - Support CAN PHYs via the generic PHY subsystem.

    - Proper cross-chip support for tag_8021q.

    - Allow TX forwarding for the software bridge data path to be
    offloaded to capable devices.

    Drivers:

    - veth: more flexible channels number configuration.

    - openvswitch: introduce per-cpu upcall dispatch.

    - Add internet mix (IMIX) mode to pktgen.

    - Transparently handle XDP operations in the bonding driver.

    - Add LiteETH network driver.

    - Renesas (ravb):
    - support Gigabit Ethernet IP

    - NXP Ethernet switch (sja1105):
    - fast aging support
    - support for "H" switch topologies
    - traffic termination for ports under VLAN-aware bridge

    - Intel 1G Ethernet
    - support getcrosststamp() with PCIe PTM (Precision Time
    Measurement) for better time sync
    - support Credit-Based Shaper (CBS) offload, enabling HW traffic
    prioritization and bandwidth reservation

    - Broadcom Ethernet (bnxt)
    - support pulse-per-second output
    - support larger Rx rings

    - Mellanox Ethernet (mlx5)
    - support ethtool RSS contexts and MQPRIO channel mode
    - support LAG offload with bridging
    - support devlink rate limit API
    - support packet sampling on tunnels

    - Huawei Ethernet (hns3):
    - basic devlink support
    - add extended IRQ coalescing support
    - report extended link state

    - Netronome Ethernet (nfp):
    - add conntrack offload support

    - Broadcom WiFi (brcmfmac):
    - add WPA3 Personal with FT to supported cipher suites
    - support 43752 SDIO device

    - Intel WiFi (iwlwifi):
    - support scanning hidden 6GHz networks
    - support for a new hardware family (Bz)

    - Xen pv driver:
    - harden netfront against malicious backends

    - Qualcomm mobile
    - ipa: refactor power management and enable automatic suspend
    - mhi: move MBIM to WWAN subsystem interfaces

    Refactor:

    - Ambient BPF run context and cgroup storage cleanup.

    - Compat rework for ndo_ioctl.

    Old code removal:

    - prism54 remove the obsoleted driver, deprecated by the p54 driver.

    - wan: remove sbni/granch driver"

    * tag 'net-next-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (1715 commits)
    net: Add depends on OF_NET for LiteX's LiteETH
    ipv6: seg6: remove duplicated include
    net: hns3: remove unnecessary spaces
    net: hns3: add some required spaces
    net: hns3: clean up a type mismatch warning
    net: hns3: refine function hns3_set_default_feature()
    ipv6: remove duplicated 'net/lwtunnel.h' include
    net: w5100: check return value after calling platform_get_resource()
    net/mlxbf_gige: Make use of devm_platform_ioremap_resourcexxx()
    net: mdio: mscc-miim: Make use of the helper function devm_platform_ioremap_resource()
    net: mdio-ipq4019: Make use of devm_platform_ioremap_resource()
    fou: remove sparse errors
    ipv4: fix endianness issue in inet_rtm_getroute_build_skb()
    octeontx2-af: Set proper errorcode for IPv4 checksum errors
    octeontx2-af: Fix static code analyzer reported issues
    octeontx2-af: Fix mailbox errors in nix_rss_flowkey_cfg
    octeontx2-af: Fix loop in free and unmap counter
    af_unix: fix potential NULL deref in unix_dgram_connect()
    dpaa2-eth: Replace strlcpy with strscpy
    octeontx2-af: Use NDC TX for transmit packet data
    ...

    Linus Torvalds
     

27 Aug, 2021

7 commits

  • The API changes were propagated to most drivers, but clearly
    arch/um/drivers/ was missed, perhaps due to looking only at
    the drivers/ folder. Fix that.

    Fixes: f3ccfda19319 ("ethtool: extend coalesce setting uAPI with CQE mode")
    Signed-off-by: Johannes Berg
    Link: https://lore.kernel.org/r/20210827094759.f3ab06684bd0.I985181cc00fe017cfe6413d9e1bb720cbe852e6d@changeid
    Signed-off-by: Jakub Kicinski

    Johannes Berg
     
  • In commit 9f0b4807a44f ("um: rework userspace stubs to not hard-code
    stub location") I changed stub_segv_handler() to do a calculation with
    a pointer to a stack variable to find the data page that we're using
    for the stack and the rest of the data. This same commit was meant to
    do it as well for stub_clone_handler(), but the change inadvertently
    went into commit 84b2789d6115 ("um: separate child and parent errors
    in clone stub") instead.

    This was reported to not be compiled correctly by gcc 5, causing the
    code to crash here. I'm not sure why, perhaps it's UB because the var
    isn't initialized? In any case, this trick always seemed bad, so just
    create a new inline function that does the calculation in assembly.

    Reported-by: subashab@codeaurora.org
    Fixes: 9f0b4807a44f ("um: rework userspace stubs to not hard-code stub location")
    Fixes: 84b2789d6115 ("um: separate child and parent errors in clone stub")
    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger

    Johannes Berg
     
  • This works just fine, so select HAVE_ARCH_VMAP_STACK to
    let users enable VMAP_STACK if desired.

    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger

    Johannes Berg
     
  • When enabling VMAP_STACK, SG helpers immediately complained
    that we were doing DMA from stack. Use per-CPU variables to
    avoid that.

    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger

    Johannes Berg
     
  • If initialization fails, e.g. because the connection failed,
    we leak the 'vu_dev'. Fix that. Reported by smatch.

    Fixes: 5d38f324993f ("um: drivers: Add virtio vhost-user driver")
    Signed-off-by: Johannes Berg
    Acked-By: Anton Ivanov
    Signed-off-by: Richard Weinberger

    Johannes Berg
     
  • This fixes a sparse warning, since the function defined
    here should have a declaration (or be static).

    Reported-by: kernel test robot
    Fixes: 43c590cb8666 ("um: virtio/pci: enable suspend/resume")
    Signed-off-by: Johannes Berg
    Acked-By: Anton Ivanov
    Signed-off-by: Richard Weinberger

    Johannes Berg
     
  • The functions aren't used elsewhere, so they can be static.

    Reported-by: kernel test robot
    Fixes: 68f5d3f3b654 ("um: add PCI over virtio emulation driver")
    Signed-off-by: Johannes Berg
    Acked-By: Anton Ivanov
    Signed-off-by: Richard Weinberger

    Johannes Berg