Skip to content
  1. Aug 04, 2023
    • Linus Torvalds's avatar
      Merge tag 's390-6.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 5e0ba145
      Linus Torvalds authored
      Pull s390 fixes from Heiko Carstens:
      
       - Split kernel large page mappings into 4k mappings in case debug
         pagealloc is enabled again. This got accidentally removed by commit
         bb1520d5 ("s390/mm: start kernel with DAT enabled")
      
       - Fix error handling in KVM's sthyi handling
      
       - Add missing include to s390's uapi ptrace.h
      
       - Update defconfigs
      
      * tag 's390-6.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/ptrace: add missing linux/const.h include
        KVM: s390: fix sthyi error handling
        s390: update defconfigs
        s390/vmem: split pages when debug pagealloc is enabled
      5e0ba145
  2. Aug 03, 2023
    • Linus Torvalds's avatar
      Merge tag 'soc-fixes-6.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · ec351c8f
      Linus Torvalds authored
      Pull ARM SoC fixes from Arnd Bergmann:
       "A couple of platforms get a lone dts fix each:
      
         - SoCFPGA: Fix incorrect I2C property for SCL signal
      
         - Renesas: Fix interrupt names for MTU3 channels on RZ/G2L and
           RZ/V2L.
      
         - Juno/Vexpress: remove a dangling symlink
      
         - at91: sam9x60 SoC detection compatible strings
      
         - nspire: Fix arm primecell compatible string
      
        On the NXP i.MX platform, there multiple issues that get addressed:
      
         - A couple of ARM DTS fixes for i.MX6SLL usbphy and supported CPU
           frequency of sk-imx53 board
      
         - Add missing pull-up for imx8mn-var-som onboard PHY reset pinmux
      
         - A couple of imx8mm-venice fixes from Tim Harvey to diable
           disp_blk_ctrl
      
         - A couple of phycore-imx8mm fixes from Yashwanth Varakala to correct
           VPU label and gpio-line-names
      
         - Fix imx8mp-blk-ctrl driver to register HSIO PLL clock as
           bus_power_dev child, so that runtime PM can translate into the
           necessary GPC power domain action
      
        On the driver side, there are two fixes for tegra memory controller
        drivers addressing regressions from the merge window, a couple of
        minor correctness fixes for SCMI and SMCCC firmware, as well as a
        build fix for an lcd backlight driver"
      
      * tag 'soc-fixes-6.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (22 commits)
        backlight: corgi_lcd: fix missing prototype
        memory: tegra: make icc_set_bw return zero if BWMGR not supported
        arm64: dts: renesas: rzg2l: Update overfow/underflow IRQ names for MTU3 channels
        dt-bindings: serial: atmel,at91-usart: update compatible for sam9x60
        ARM: dts: at91: sam9x60: fix the SOC detection
        ARM: dts: nspire: Fix arm primecell compatible string
        firmware: arm_scmi: Fix chan_free cleanup on SMC
        firmware: arm_scmi: Drop OF node reference in the transport channel setup
        soc: imx: imx8mp-blk-ctrl: register HSIO PLL clock as bus_power_dev child
        ARM: dts: nxp/imx: limit sk-imx53 supported frequencies
        firmware: arm_scmi: Fix signed error return values handling
        firmware: smccc: Fix use of uninitialised results structure
        arm64: dts: freescale: Fix VPU G2 clock
        arm64: dts: imx8mn-var-som: add missing pull-up for onboard PHY reset pinmux
        arm64: dts: phycore-imx8mm: Correction in gpio-line-names
        arm64: dts: phycore-imx8mm: Label typo-fix of VPU
        ARM: dts: nxp/imx6sll: fix wrong property name in usbphy node
        arm64: dts: imx8mm-venice-gw7904: disable disp_blk_ctrl
        arm64: dts: imx8mm-venice-gw7903: disable disp_blk_ctrl
        arm64: dts: arm: Remove the dangling vexpress-v2m-rs1.dtsi symlink
        ...
      ec351c8f
    • Linus Torvalds's avatar
      Merge tag 'bitmap-6.5-rc5' of https://github.com:/norov/linux · a4e98a30
      Linus Torvalds authored
      Pull bitmap fixes from Yury Norov:
      
       - Fix for bitmap documentation
      
       - Fix for kernel build under certain configurations
      
      * tag 'bitmap-6.5-rc5' of https://github.com:/norov/linux:
        lib/bitmap: workaround const_eval test build failure
        cpumask: eliminate kernel-doc warnings
      a4e98a30
    • Linus Torvalds's avatar
      Merge tag 'exfat-for-6.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat · 4b954598
      Linus Torvalds authored
      Pull exfat fixes from Namjae Jeon:
      
       - Fix page allocation failure from allocation bitmap by using
         kvmalloc_array/kvfree
      
       - Add the check to validate if filename entries exceeds max filename
         length
      
       - Fix potential deadlock condition from dir_emit*()
      
      * tag 'exfat-for-6.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat:
        exfat: release s_lock before calling dir_emit()
        exfat: check if filename entries exceeds max filename length
        exfat: use kvmalloc_array/kvfree instead of kmalloc_array/kfree
      4b954598
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 79d65ee5
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Three small fixes, all in drivers"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: pm80xx: Fix error return code in pm8001_pci_probe()
        scsi: zfcp: Defer fc_rport blocking until after ADISC response
        scsi: storvsc: Limit max_sectors for virtual Fibre Channel devices
      79d65ee5
    • ndesaulniers@google.com's avatar
      word-at-a-time: use the same return type for has_zero regardless of endianness · 79e8328e
      ndesaulniers@google.com authored
      Compiling big-endian targets with Clang produces the diagnostic:
      
        fs/namei.c:2173:13: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
      	} while (!(has_zero(a, &adata, &constants) | has_zero(b, &bdata, &constants)));
      	          ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                     ||
        fs/namei.c:2173:13: note: cast one or both operands to int to silence this warning
      
      It appears that when has_zero was introduced, two definitions were
      produced with different signatures (in particular different return
      types).
      
      Looking at the usage in hash_name() in fs/namei.c, I suspect that
      has_zero() is meant to be invoked twice per while loop iteration; using
      logical-or would not update `bdata` when `a` did not have zeros.  So I
      think it's preferred to always return an unsigned long rather than a
      bool than update the while loop in hash_name() to use a logical-or
      rather than bitwise-or.
      
      [ Also changed powerpc version to do the same  - Linus ]
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/1832
      Link: https://lore.kernel.org/lkml/20230801-bitwise-v1-1-799bec468dc4@google.com/
      Fixes: 36126f8f
      
       ("word-at-a-time: make the interfaces truly generic")
      Debugged-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      79e8328e
  3. Aug 01, 2023
    • Heiko Carstens's avatar
      s390/ptrace: add missing linux/const.h include · 388acb47
      Heiko Carstens authored
      Adrian Reber reported the following CRIU build bug after
      commit b8af5999
      
       ("s390/ptrace: make all psw related
      defines also available for asm"):
      
      compel/arch/s390/src/lib/infect.c: In function 'arch_can_dump_task':
      compel/arch/s390/src/lib/infect.c:523:25: error: 'UL' undeclared (first use in this function)
        523 |         if (psw->mask & PSW_MASK_RI) {
            |                         ^~~~~~~~~~~
      
      Add the missing linux/const.h include to fix this.
      
      Reported-by: default avatarAdrian Reber <areber@redhat.com>
      Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2225745
      Link: https://github.com/checkpoint-restore/criu/pull/2232
      Tested-by: default avatarAdrian Reber <areber@redhat.com>
      Fixes: b8af5999
      
       ("s390/ptrace: make all psw related defines also available for asm")
      Link: https://lore.kernel.org/r/20230731183926.330932-1-hca@linux.ibm.com
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      388acb47
  4. Jul 31, 2023
    • Linus Torvalds's avatar
      Linux 6.5-rc4 · 5d0c230f
      Linus Torvalds authored
      5d0c230f
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · d5bb4b89
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A bunch of fixes for the Qualcomm QSPI driver, fixing multiple issues
        with the newly added DMA mode - it had a number of issues exposed when
        tested in a wider range of use cases, both race condition style issues
        and issues with different inputs to those that had been used in test"
      
      * tag 'spi-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi: spi-qcom-qspi: Add mem_ops to avoid PIO for badly sized reads
        spi: spi-qcom-qspi: Fallback to PIO for xfers that aren't multiples of 4 bytes
        spi: spi-qcom-qspi: Add DMA_CHAIN_DONE to ALL_IRQS
        spi: spi-qcom-qspi: Call dma_wmb() after setting up descriptors
        spi: spi-qcom-qspi: Use GFP_ATOMIC flag while allocating for descriptor
        spi: spi-qcom-qspi: Ignore disabled interrupts' status in isr
      d5bb4b89
    • Linus Torvalds's avatar
      Merge tag 'regulator-fix-v6.5-rc3' of... · 3dfe6886
      Linus Torvalds authored
      Merge tag 'regulator-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
      
      Pull regulator fixes from Mark Brown:
       "A couple of small fixes for the the mt6358 driver, fixing error
        reporting and a bootstrapping issue"
      
      * tag 'regulator-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
        regulator: mt6358: Fix incorrect VCN33 sync error message
        regulator: mt6358: Sync VCN33_* enable status after checking ID
      3dfe6886
    • Linus Torvalds's avatar
      Merge tag 'usb-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 88f66f13
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are a set of USB driver fixes for 6.5-rc4. Include in here are:
      
         - new USB serial device ids
      
         - dwc3 driver fixes for reported issues
      
         - typec driver fixes for reported problems
      
         - gadget driver fixes
      
         - reverts of some problematic USB changes that went into -rc1
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'usb-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (24 commits)
        usb: misc: ehset: fix wrong if condition
        usb: dwc3: pci: skip BYT GPIO lookup table for hardwired phy
        usb: cdns3: fix incorrect calculation of ep_buf_size when more than one config
        usb: gadget: call usb_gadget_check_config() to verify UDC capability
        usb: typec: Use sysfs_emit_at when concatenating the string
        usb: typec: Iterate pds array when showing the pd list
        usb: typec: Set port->pd before adding device for typec_port
        usb: typec: qcom: fix return value check in qcom_pmic_typec_probe()
        Revert "usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init()"
        Revert "usb: xhci: tegra: Fix error check"
        USB: gadget: Fix the memory leak in raw_gadget driver
        usb: gadget: core: remove unbalanced mutex_unlock in usb_gadget_activate
        Revert "usb: dwc3: core: Enable AutoRetry feature in the controller"
        Revert "xhci: add quirk for host controllers that don't update endpoint DCS"
        USB: quirks: add quirk for Focusrite Scarlett
        usb: xhci-mtk: set the dma max_seg_size
        MAINTAINERS: drop invalid usb/cdns3 Reviewer e-mail
        usb: dwc3: don't reset device side if dwc3 was configured as host-only
        usb: typec: ucsi: move typec_set_mode(TYPEC_STATE_SAFE) to ucsi_unregister_partner()
        usb: ohci-at91: Fix the unhandle interrupt when resume
        ...
      88f66f13
    • Linus Torvalds's avatar
      Merge tag 'tty-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · e6d34ced
      Linus Torvalds authored
      Pull tty/serial fixes from Greg KH:
       "Here are some small TTY and serial driver fixes for 6.5-rc4 for some
        reported problems. Included in here is:
      
         - TIOCSTI fix for braille readers
      
         - documentation fix for minor numbers
      
         - MAINTAINERS update for new serial files in -rc1
      
         - minor serial driver fixes for reported problems
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'tty-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        serial: 8250_dw: Preserve original value of DLF register
        tty: serial: sh-sci: Fix sleeping in atomic context
        serial: sifive: Fix sifive_serial_console_setup() section
        Documentation: devices.txt: reconcile serial/ucc_uart minor numers
        MAINTAINERS: Update TTY layer for lists and recently added files
        tty: n_gsm: fix UAF in gsm_cleanup_mux
        TIOCSTI: always enable for CAP_SYS_ADMIN
      e6d34ced
    • Linus Torvalds's avatar
      Merge tag 'staging-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 3d6b77a8
      Linus Torvalds authored
      Pull staging driver fixes from Greg KH:
       "Here are three small staging driver fixes for 6.5-rc4 that resolve
        some reported problems. These fixes are:
      
         - fix for an old bug in the r8712 driver
      
         - fbtft driver fix for a spi device
      
         - potential overflow fix in the ks7010 driver
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'staging-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: ks7010: potential buffer overflow in ks_wlan_set_encode_ext()
        staging: fbtft: ili9341: use macro FBTFT_REGISTER_SPI_DRIVER
        staging: r8712: Fix memory leak in _r8712_init_xmit_priv()
      3d6b77a8
    • Linus Torvalds's avatar
      Merge tag 'char-misc-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · cf270e7b
      Linus Torvalds authored
      Pull char driver and Documentation fixes from Greg KH:
       "Here is a char driver fix and some documentation updates for 6.5-rc4
        that contain the following changes:
      
         - sram/genalloc bugfix for reported problem
      
         - security-bugs.rst update based on recent discussions
      
         - embargoed-hardware-issues minor cleanups and then partial revert
           for the project/company lists
      
        All of these have been in linux-next for a while with no reported
        problems, and the documentation updates have all been reviewed by the
        relevant developers"
      
      * tag 'char-misc-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        misc/genalloc: Name subpools by of_node_full_name()
        Documentation: embargoed-hardware-issues.rst: add AMD to the list
        Documentation: embargoed-hardware-issues.rst: clean out empty and unused entries
        Documentation: security-bugs.rst: clarify CVE handling
        Documentation: security-bugs.rst: update preferences when dealing with the linux-distros group
      cf270e7b
    • Linus Torvalds's avatar
      Merge tag 'probes-fixes-v6.5-rc3' of... · b0b9850e
      Linus Torvalds authored
      Merge tag 'probes-fixes-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
      
      Pull probe fixes from Masami Hiramatsu:
      
       - probe-events: add NULL check for some BTF API calls which can return
         error code and NULL.
      
       - ftrace selftests: check fprobe and kprobe event correctly. This fixes
         a miss condition of the test command.
      
       - kprobes: do not allow probing functions that start with "__cfi_" or
         "__pfx_" since those are auto generated for kernel CFI and not
         executed.
      
      * tag 'probes-fixes-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        kprobes: Prohibit probing on CFI preamble symbol
        selftests/ftrace: Fix to check fprobe event eneblement
        tracing/probes: Fix to add NULL check for BTF APIs
      b0b9850e
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 98a05fe8
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "x86:
      
         - Do not register IRQ bypass consumer if posted interrupts not
           supported
      
         - Fix missed device interrupt due to non-atomic update of IRR
      
         - Use GFP_KERNEL_ACCOUNT for pid_table in ipiv
      
         - Make VMREAD error path play nice with noinstr
      
         - x86: Acquire SRCU read lock when handling fastpath MSR writes
      
         - Support linking rseq tests statically against glibc 2.35+
      
         - Fix reference count for stats file descriptors
      
         - Detect userspace setting invalid CR0
      
        Non-KVM:
      
         - Remove coccinelle script that has caused multiple confusion
           ("debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE()
           usage", acked by Greg)"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (21 commits)
        KVM: selftests: Expand x86's sregs test to cover illegal CR0 values
        KVM: VMX: Don't fudge CR0 and CR4 for restricted L2 guest
        KVM: x86: Disallow KVM_SET_SREGS{2} if incoming CR0 is invalid
        Revert "debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage"
        KVM: selftests: Verify stats fd is usable after VM fd has been closed
        KVM: selftests: Verify stats fd can be dup()'d and read
        KVM: selftests: Verify userspace can create "redundant" binary stats files
        KVM: selftests: Explicitly free vcpus array in binary stats test
        KVM: selftests: Clean up stats fd in common stats_test() helper
        KVM: selftests: Use pread() to read binary stats header
        KVM: Grab a reference to KVM for VM and vCPU stats file descriptors
        selftests/rseq: Play nice with binaries statically linked against glibc 2.35+
        Revert "KVM: SVM: Skip WRMSR fastpath on VM-Exit if next RIP isn't valid"
        KVM: x86: Acquire SRCU read lock when handling fastpath MSR writes
        KVM: VMX: Use vmread_error() to report VM-Fail in "goto" path
        KVM: VMX: Make VMREAD error path play nice with noinstr
        KVM: x86/irq: Conditionally register IRQ bypass consumer again
        KVM: X86: Use GFP_KERNEL_ACCOUNT for pid_table in ipiv
        KVM: x86: check the kvm_cpu_get_interrupt result before using it
        KVM: x86: VMX: set irr_pending in kvm_apic_update_irr
        ...
      98a05fe8
    • Linus Torvalds's avatar
      Merge tag 'locking_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · c959e900
      Linus Torvalds authored
      Pull locking fix from Borislav Petkov:
      
       - Fix a rtmutex race condition resulting from sharing of the sort key
         between the lock waiters and the PI chain tree (->pi_waiters) of a
         task by giving each tree their own sort key
      
      * tag 'locking_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/rtmutex: Fix task->pi_waiters integrity
      c959e900
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d410b62e
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
      
       - AMD's automatic IBRS doesn't enable cross-thread branch target
         injection protection (STIBP) for user processes. Enable STIBP on such
         systems.
      
       - Do not delete (but put the ref instead) of AMD MCE error thresholding
         sysfs kobjects when destroying them in order not to delete the kernfs
         pointer prematurely
      
       - Restore annotation in ret_from_fork_asm() in order to fix kthread
         stack unwinding from being marked as unreliable and thus breaking
         livepatching
      
      * tag 'x86_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cpu: Enable STIBP on AMD if Automatic IBRS is enabled
        x86/MCE/AMD: Decrement threshold_bank refcount when removing threshold blocks
        x86: Fix kthread unwind
      d410b62e
    • Linus Torvalds's avatar
      Merge tag 'irq_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · eb9fe179
      Linus Torvalds authored
      Pull irq fixes from Borislav Petkov:
      
       - Work around an erratum on GIC700, where a race between a CPU handling
         a wake-up interrupt, a change of affinity, and another CPU going to
         sleep can result in a lack of wake-up event on the next interrupt
      
       - Fix the locking required on a VPE for GICv4
      
       - Enable Rockchip 3588001 erratum workaround for RK3588S
      
       - Fix the irq-bcm6345-l1 assumtions of the boot CPU always be the first
         CPU in the system
      
      * tag 'irq_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/gic-v3: Workaround for GIC-700 erratum 2941627
        irqchip/gic-v3: Enable Rockchip 3588001 erratum workaround for RK3588S
        irqchip/gic-v4.1: Properly lock VPEs when doing a directLPI invalidation
        irq-bcm6345-l1: Do not assume a fixed block to cpu mapping
      eb9fe179
  5. Jul 30, 2023
    • Linus Torvalds's avatar
      Merge tag '6.5-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 · d31e3792
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
       "Four small SMB3 client fixes:
      
         - two reconnect fixes (to address the case where non-default
           iocharset gets incorrectly overridden at reconnect with the
           default charset)
      
         - fix for NTLMSSP_AUTH request setting a flag incorrectly)
      
         - Add missing check for invalid tlink (tree connection) in ioctl"
      
      * tag '6.5-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: add missing return value check for cifs_sb_tlink
        smb3: do not set NTLMSSP_VERSION flag for negotiate not auth request
        cifs: fix charset issue in reconnection
        fs/nls: make load_nls() take a const parameter
      d31e3792
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · b88e123c
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Fix to /sys/kernel/tracing/per_cpu/cpu*/stats read and entries.
      
         If a resize shrinks the buffer it clears the read count to notify
         readers that they need to reset. But the read count is also used for
         accounting and this causes the numbers to be off. Instead, create a
         separate variable to use to notify readers to reset.
      
       - Fix the ref counts of the "soft disable" mode. The wrong value was
         used for testing if soft disable mode should be enabled or disable,
         but instead, just change the logic to do the enable and disable in
         place when the SOFT_MODE is set or cleared.
      
       - Several kernel-doc fixes
      
       - Removal of unused external declarations
      
      * tag 'trace-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tracing: Fix warning in trace_buffered_event_disable()
        ftrace: Remove unused extern declarations
        tracing: Fix kernel-doc warnings in trace_seq.c
        tracing: Fix kernel-doc warnings in trace_events_trigger.c
        tracing/synthetic: Fix kernel-doc warnings in trace_events_synth.c
        ring-buffer: Fix kernel-doc warnings in ring_buffer.c
        ring-buffer: Fix wrong stat of cpu_buffer->read
      b88e123c
    • Sven Joachim's avatar
      arch/*/configs/*defconfig: Replace AUTOFS4_FS by AUTOFS_FS · 1f2190d6
      Sven Joachim authored
      Commit a2225d93
      
       ("autofs: remove left-over autofs4 stubs")
      promised the removal of the fs/autofs/Kconfig fragment for AUTOFS4_FS
      within a couple of releases, but five years later this still has not
      happened yet, and AUTOFS4_FS is still enabled in 63 defconfigs.
      
      Get rid of it mechanically:
      
         git grep -l CONFIG_AUTOFS4_FS -- '*defconfig' |
             xargs sed -i 's/AUTOFS4_FS/AUTOFS_FS/'
      
      Also just remove the AUTOFS4_FS config option stub.  Anybody who hasn't
      regenerated their config file in the last five years will need to just
      get the new name right when they do.
      
      Signed-off-by: default avatarSven Joachim <svenjoac@gmx.de>
      Acked-by: default avatarIan Kent <raven@themaw.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1f2190d6
  6. Jul 29, 2023
    • Linus Torvalds's avatar
      Merge tag 'loongarch-fixes-6.5-1' of... · 12214540
      Linus Torvalds authored
      Merge tag 'loongarch-fixes-6.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
      
      Pull LoongArch fixes from Huacai Chen:
       "Some bug fixes for build system, builtin cmdline handling, bpf and
        {copy, clear}_user, together with a trivial cleanup"
      
      * tag 'loongarch-fixes-6.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
        LoongArch: Cleanup __builtin_constant_p() checking for cpu_has_*
        LoongArch: BPF: Fix check condition to call lu32id in move_imm()
        LoongArch: BPF: Enable bpf_probe_read{, str}() on LoongArch
        LoongArch: Fix return value underflow in exception path
        LoongArch: Fix CMDLINE_EXTEND and CMDLINE_BOOTLOADER handling
        LoongArch: Fix module relocation error with binutils 2.41
        LoongArch: Only fiddle with CHECKFLAGS if `need-compiler'
      12214540
    • Sean Christopherson's avatar
      KVM: selftests: Expand x86's sregs test to cover illegal CR0 values · 5a759117
      Sean Christopherson authored
      
      
      Add coverage to x86's set_sregs_test to verify KVM rejects vendor-agnostic
      illegal CR0 values, i.e. CR0 values whose legality doesn't depend on the
      current VMX mode.  KVM historically has neglected to reject bad CR0s from
      userspace, i.e. would happily accept a completely bogus CR0 via
      KVM_SET_SREGS{2}.
      
      Punt VMX specific subtests to future work, as they would require quite a
      bit more effort, and KVM gets coverage for CR0 checks in general through
      other means, e.g. KVM-Unit-Tests.
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230613203037.1968489-4-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      5a759117
    • Sean Christopherson's avatar
      KVM: VMX: Don't fudge CR0 and CR4 for restricted L2 guest · c4abd735
      Sean Christopherson authored
      Stuff CR0 and/or CR4 to be compliant with a restricted guest if and only
      if KVM itself is not configured to utilize unrestricted guests, i.e. don't
      stuff CR0/CR4 for a restricted L2 that is running as the guest of an
      unrestricted L1.  Any attempt to VM-Enter a restricted guest with invalid
      CR0/CR4 values should fail, i.e. in a nested scenario, KVM (as L0) should
      never observe a restricted L2 with incompatible CR0/CR4, since nested
      VM-Enter from L1 should have failed.
      
      And if KVM does observe an active, restricted L2 with incompatible state,
      e.g. due to a KVM bug, fudging CR0/CR4 instead of letting VM-Enter fail
      does more harm than good, as KVM will often neglect to undo the side
      effects, e.g. won't clear rmode.vm86_active on nested VM-Exit, and thus
      the damage can easily spill over to L1.  On the other hand, letting
      VM-Enter fail due to bad guest state is more likely to contain the damage
      to L2 as KVM relies on hardware to perform most guest state consistency
      checks, i.e. KVM needs to be able to reflect a failed nested VM-Enter into
      L1 irrespective of (un)restricted guest behavior.
      
      Cc: Jim Mattson <jmattson@google.com>
      Cc: stable@vger.kernel.org
      Fixes: bddd82d1
      
       ("KVM: nVMX: KVM needs to unset "unrestricted guest" VM-execution control in vmcs02 if vmcs12 doesn't set it")
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230613203037.1968489-3-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c4abd735
    • Sean Christopherson's avatar
      KVM: x86: Disallow KVM_SET_SREGS{2} if incoming CR0 is invalid · 26a0652c
      Sean Christopherson authored
      
      
      Reject KVM_SET_SREGS{2} with -EINVAL if the incoming CR0 is invalid,
      e.g. due to setting bits 63:32, illegal combinations, or to a value that
      isn't allowed in VMX (non-)root mode.  The VMX checks in particular are
      "fun" as failure to disallow Real Mode for an L2 that is configured with
      unrestricted guest disabled, when KVM itself has unrestricted guest
      enabled, will result in KVM forcing VM86 mode to virtual Real Mode for
      L2, but then fail to unwind the related metadata when synthesizing a
      nested VM-Exit back to L1 (which has unrestricted guest enabled).
      
      Opportunistically fix a benign typo in the prototype for is_valid_cr4().
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatar <syzbot+5feef0b9ee9c8e9e5689@syzkaller.appspotmail.com>
      Closes: https://lore.kernel.org/all/000000000000f316b705fdf6e2b4@google.com
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230613203037.1968489-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      26a0652c
    • Sean Christopherson's avatar
      Revert "debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage" · 88021836
      Sean Christopherson authored
      Remove coccinelle's recommendation to use DEFINE_DEBUGFS_ATTRIBUTE()
      instead of DEFINE_SIMPLE_ATTRIBUTE().  Regardless of whether or not the
      "significant overhead" incurred by debugfs_create_file() is actually
      meaningful, warnings from the script have led to a rash of low-quality
      patches that have sowed confusion and consumed maintainer time for little
      to no benefit.  There have been no less than four attempts to "fix" KVM,
      and a quick search on lore shows that KVM is not alone.
      
      This reverts commit 5103068e
      
      .
      
      Link: https://lore.kernel.org/all/87tu2nbnz3.fsf@mpe.ellerman.id.au
      Link: https://lore.kernel.org/all/c0b98151-16b6-6d8f-1765-0f7d46682d60@redhat.com
      Link: https://lkml.kernel.org/r/20230706072954.4881-1-duminjie%40vivo.com
      Link: https://lore.kernel.org/all/Y2FsbufV00jbyF0B@google.com
      Link: https://lore.kernel.org/all/Y2ENJJ1YiSg5oHiy@orome
      Link: https://lore.kernel.org/all/7560b350e7b23786ce712118a9a504356ff1cca4.camel@kernel.org
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230726202920.507756-1-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      88021836
    • Sean Christopherson's avatar
      KVM: selftests: Verify stats fd is usable after VM fd has been closed · 211c0189
      Sean Christopherson authored
      
      
      Verify that VM and vCPU binary stats files are usable even after userspace
      has put its last direct reference to the VM.  This is a regression test
      for a UAF bug where KVM didn't gift the stats files a reference to the VM.
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230711230131.648752-8-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      211c0189
    • Sean Christopherson's avatar
      KVM: selftests: Verify stats fd can be dup()'d and read · 65f1f57f
      Sean Christopherson authored
      
      
      Expand the binary stats test to verify that a stats fd can be dup()'d
      and read, to (very) roughly simulate userspace passing around the file.
      Adding the dup() test is primarily an intermediate step towards verifying
      that userspace can read VM/vCPU stats before _and_ after userspace closes
      its copy of the VM fd; the dup() test itself is only mildly interesting.
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230711230131.648752-7-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      65f1f57f
    • Sean Christopherson's avatar
      KVM: selftests: Verify userspace can create "redundant" binary stats files · 47d1be8a
      Sean Christopherson authored
      
      
      Verify that KVM doesn't artificially limit KVM_GET_STATS_FD to a single
      file per VM/vCPU.  There's no known use case for getting multiple stats
      fds, but it should work, and more importantly creating multiple files will
      make it easier to test that KVM correct manages VM refcounts for stats
      files.
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230711230131.648752-6-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      47d1be8a
    • Sean Christopherson's avatar
      KVM: selftests: Explicitly free vcpus array in binary stats test · 33b02704
      Sean Christopherson authored
      
      
      Explicitly free the all-encompassing vcpus array in the binary stats test
      so that the test is consistent with respect to freeing all dynamically
      allocated resources (versus letting them be freed on exit).
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230711230131.648752-5-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      33b02704
    • Sean Christopherson's avatar
      KVM: selftests: Clean up stats fd in common stats_test() helper · 87d53582
      Sean Christopherson authored
      
      
      Move the stats fd cleanup code into stats_test() and drop the
      superfluous vm_stats_test() and vcpu_stats_test() helpers in order to
      decouple creation of the stats file from consuming/testing the file
      (deduping code is a bonus).  This will make it easier to test various
      edge cases related to stats, e.g. that userspace can dup() a stats fd,
      that userspace can have multiple stats files for a singleVM/vCPU, etc.
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230711230131.648752-4-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      87d53582
    • Sean Christopherson's avatar
      KVM: selftests: Use pread() to read binary stats header · 625646ae
      Sean Christopherson authored
      
      
      Use pread() with an explicit offset when reading the header and the header
      name for a binary stats fd so that the common helper and the binary stats
      test don't subtly rely on the file effectively being untouched, e.g. to
      allow multiple reads of the header, name, etc.
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230711230131.648752-3-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      625646ae
    • Sean Christopherson's avatar
      KVM: Grab a reference to KVM for VM and vCPU stats file descriptors · eed3013f
      Sean Christopherson authored
      Grab a reference to KVM prior to installing VM and vCPU stats file
      descriptors to ensure the underlying VM and vCPU objects are not freed
      until the last reference to any and all stats fds are dropped.
      
      Note, the stats paths manually invoke fd_install() and so don't need to
      grab a reference before creating the file.
      
      Fixes: ce55c049 ("KVM: stats: Support binary stats retrieval for a VCPU")
      Fixes: fcfe1bae
      
       ("KVM: stats: Support binary stats retrieval for a VM")
      Reported-by: default avatarZheng Zhang <zheng.zhang@email.ucr.edu>
      Closes: https://lore.kernel.org/all/CAC_GQSr3xzZaeZt85k_RCBd5kfiOve8qXo7a81Cq53LuVQ5r=Q@mail.gmail.com
      Cc: stable@vger.kernel.org
      Cc: Kees Cook <keescook@chromium.org>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Message-Id: <20230711230131.648752-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      eed3013f
    • Sean Christopherson's avatar
      selftests/rseq: Play nice with binaries statically linked against glibc 2.35+ · 3bcbc209
      Sean Christopherson authored
      To allow running rseq and KVM's rseq selftests as statically linked
      binaries, initialize the various "trampoline" pointers to point directly
      at the expect glibc symbols, and skip the dlysm() lookups if the rseq
      size is non-zero, i.e. the binary is statically linked *and* the libc
      registered its own rseq.
      
      Define weak versions of the symbols so as not to break linking against
      libc versions that don't support rseq in any capacity.
      
      The KVM selftests in particular are often statically linked so that they
      can be run on targets with very limited runtime environments, i.e. test
      machines.
      
      Fixes: 233e667e
      
       ("selftests/rseq: Uplift rseq selftests for compatibility with glibc-2.35")
      Cc: Aaron Lewis <aaronlewis@google.com>
      Cc: kvm@vger.kernel.org
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230721223352.2333911-1-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      3bcbc209
    • Sean Christopherson's avatar
      Revert "KVM: SVM: Skip WRMSR fastpath on VM-Exit if next RIP isn't valid" · b439eb8a
      Sean Christopherson authored
      Now that handle_fastpath_set_msr_irqoff() acquires kvm->srcu, i.e. allows
      dereferencing memslots during WRMSR emulation, drop the requirement that
      "next RIP" is valid.  In hindsight, acquiring kvm->srcu would have been a
      better fix than avoiding the pastpath, but at the time it was thought that
      accessing SRCU-protected data in the fastpath was a one-off edge case.
      
      This reverts commit 5c30e810
      
      .
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230721224337.2335137-3-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b439eb8a
    • Sean Christopherson's avatar
      KVM: x86: Acquire SRCU read lock when handling fastpath MSR writes · 3f2739bd
      Sean Christopherson authored
      Temporarily acquire kvm->srcu for read when potentially emulating WRMSR in
      the VM-Exit fastpath handler, as several of the common helpers used during
      emulation expect the caller to provide SRCU protection.  E.g. if the guest
      is counting instructions retired, KVM will query the PMU event filter when
      stepping over the WRMSR.
      
        dump_stack+0x85/0xdf
        lockdep_rcu_suspicious+0x109/0x120
        pmc_event_is_allowed+0x165/0x170
        kvm_pmu_trigger_event+0xa5/0x190
        handle_fastpath_set_msr_irqoff+0xca/0x1e0
        svm_vcpu_run+0x5c3/0x7b0 [kvm_amd]
        vcpu_enter_guest+0x2108/0x2580
      
      Alternatively, check_pmu_event_filter() could acquire kvm->srcu, but this
      isn't the first bug of this nature, e.g. see commit 5c30e810 ("KVM:
      SVM: Skip WRMSR fastpath on VM-Exit if next RIP isn't valid").  Providing
      protection for the entirety of WRMSR emulation will allow reverting the
      aforementioned commit, and will avoid having to play whack-a-mole when new
      uses of SRCU-protected structures are inevitably added in common emulation
      helpers.
      
      Fixes: dfdeda67
      
       ("KVM: x86/pmu: Prevent the PMU from counting disallowed events")
      Reported-by: default avatarGreg Thelen <gthelen@google.com>
      Reported-by: default avatarAaron Lewis <aaronlewis@google.com>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230721224337.2335137-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      3f2739bd
    • Sean Christopherson's avatar
      KVM: VMX: Use vmread_error() to report VM-Fail in "goto" path · a062dad7
      Sean Christopherson authored
      
      
      Use vmread_error() to report VM-Fail on VMREAD for the "asm goto" case,
      now that trampoline case has yet another wrapper around vmread_error() to
      play nice with instrumentation.
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230721235637.2345403-3-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      a062dad7
    • Sean Christopherson's avatar
      KVM: VMX: Make VMREAD error path play nice with noinstr · c20d403f
      Sean Christopherson authored
      
      
      Mark vmread_error_trampoline() as noinstr, and add a second trampoline
      for the CONFIG_CC_HAS_ASM_GOTO_OUTPUT=n case to enable instrumentation
      when handling VM-Fail on VMREAD.  VMREAD is used in various noinstr
      flows, e.g. immediately after VM-Exit, and objtool rightly complains that
      the call to the error trampoline leaves a no-instrumentation section
      without annotating that it's safe to do so.
      
        vmlinux.o: warning: objtool: vmx_vcpu_enter_exit+0xc9:
        call to vmread_error_trampoline() leaves .noinstr.text section
      
      Note, strictly speaking, enabling instrumentation in the VM-Fail path
      isn't exactly safe, but if VMREAD fails the kernel/system is likely hosed
      anyways, and logging that there is a fatal error is more important than
      *maybe* encountering slightly unsafe instrumentation.
      
      Reported-by: default avatarSu Hui <suhui@nfschina.com>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230721235637.2345403-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c20d403f
    • Like Xu's avatar
      KVM: x86/irq: Conditionally register IRQ bypass consumer again · 5e1fe4a2
      Like Xu authored
      As was attempted commit 14717e20
      
       ("kvm: Conditionally register IRQ
      bypass consumer"): "if we don't support a mechanism for bypassing IRQs,
      don't register as a consumer.  Initially this applied to AMD processors,
      but when AVIC support was implemented for assigned devices,
      kvm_arch_has_irq_bypass() was always returning true.
      
      We can still skip registering the consumer where enable_apicv
      or posted-interrupts capability is unsupported or globally disabled.
      This eliminates meaningless dev_info()s when the connect fails
      between producer and consumer", such as on Linux hosts where enable_apicv
      or posted-interrupts capability is unsupported or globally disabled.
      
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Reported-by: default avatarYong He <alexyonghe@tencent.com>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217379
      Signed-off-by: default avatarLike Xu <likexu@tencent.com>
      Message-Id: <20230724111236.76570-1-likexu@tencent.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      5e1fe4a2