1. 31 Aug, 2023 5 commits
    • Paolo Bonzini's avatar
      Merge tag 'kvm-riscv-6.6-1' of https://github.com/kvm-riscv/linux into HEAD · e43ae8b6
      Paolo Bonzini authored
      KVM/riscv changes for 6.6
      
      - Zba, Zbs, Zicntr, Zicsr, Zifencei, and Zihpm support for Guest/VM
      - Added ONE_REG interface for SATP mode
      - Added ONE_REG interface to enable/disable multiple ISA extensions
      - Improved error codes returned by ONE_REG interfaces
      - Added KVM_GET_REG_LIST ioctl() implementation for KVM RISC-V
      - Added get-reg-list selftest for KVM RISC-V
      e43ae8b6
    • Paolo Bonzini's avatar
      Merge tag 'kvm-s390-next-6.6-1' of... · 69fd3876
      Paolo Bonzini authored
      Merge tag 'kvm-s390-next-6.6-1' of https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD
      
      - PV crypto passthrough enablement (Tony, Steffen, Viktor, Janosch)
        Allows a PV guest to use crypto cards. Card access is governed by
        the firmware and once a crypto queue is "bound" to a PV VM every
        other entity (PV or not) looses access until it is not bound
        anymore. Enablement is done via flags when creating the PV VM.
      
      - Guest debug fixes (Ilya)
      69fd3876
    • Paolo Bonzini's avatar
      Merge tag 'kvm-x86-selftests-6.6' of https://github.com/kvm-x86/linux into HEAD · 1814db83
      Paolo Bonzini authored
      KVM: x86: Selftests changes for 6.6:
      
       - Add testcases to x86's sync_regs_test for detecting KVM TOCTOU bugs
      
       - Add support for printf() in guest code and covert all guest asserts to use
         printf-based reporting
      
       - Clean up the PMU event filter test and add new testcases
      
       - Include x86 selftests in the KVM x86 MAINTAINERS entry
      1814db83
    • Paolo Bonzini's avatar
      Merge tag 'kvm-x86-generic-6.6' of https://github.com/kvm-x86/linux into HEAD · 0d15bf96
      Paolo Bonzini authored
      Common KVM changes for 6.6:
      
       - Wrap kvm_{gfn,hva}_range.pte in a union to allow mmu_notifier events to pass
         action specific data without needing to constantly update the main handlers.
      
       - Drop unused function declarations
      0d15bf96
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD · e0fb12c6
      Paolo Bonzini authored
      KVM/arm64 updates for Linux 6.6
      
      - Add support for TLB range invalidation of Stage-2 page tables,
        avoiding unnecessary invalidations. Systems that do not implement
        range invalidation still rely on a full invalidation when dealing
        with large ranges.
      
      - Add infrastructure for forwarding traps taken from a L2 guest to
        the L1 guest, with L0 acting as the dispatcher, another baby step
        towards the full nested support.
      
      - Simplify the way we deal with the (long deprecated) 'CPU target',
        resulting in a much needed cleanup.
      
      - Fix another set of PMU bugs, both on the guest and host sides,
        as we seem to never have any shortage of those...
      
      - Relax the alignment requirements of EL2 VA allocations for
        non-stack allocations, as we were otherwise wasting a lot of that
        precious VA space.
      
      - The usual set of non-functional cleanups, although I note the lack
        of spelling fixes...
      e0fb12c6
  2. 28 Aug, 2023 16 commits
  3. 27 Aug, 2023 2 commits
  4. 26 Aug, 2023 8 commits
  5. 25 Aug, 2023 9 commits
    • Helge Deller's avatar
      lib/clz_ctz.c: Fix __clzdi2() and __ctzdi2() for 32-bit kernels · 382d4cd1
      Helge Deller authored
      The gcc compiler translates on some architectures the 64-bit
      __builtin_clzll() function to a call to the libgcc function __clzdi2(),
      which should take a 64-bit parameter on 32- and 64-bit platforms.
      
      But in the current kernel code, the built-in __clzdi2() function is
      defined to operate (wrongly) on 32-bit parameters if BITS_PER_LONG ==
      32, thus the return values on 32-bit kernels are in the range from
      [0..31] instead of the expected [0..63] range.
      
      This patch fixes the in-kernel functions __clzdi2() and __ctzdi2() to
      take a 64-bit parameter on 32-bit kernels as well, thus it makes the
      functions identical for 32- and 64-bit kernels.
      
      This bug went unnoticed since kernel 3.11 for over 10 years, and here
      are some possible reasons for that:
      
       a) Some architectures have assembly instructions to count the bits and
          which are used instead of calling __clzdi2(), e.g. on x86 the bsr
          instruction and on ppc cntlz is used. On such architectures the
          wrong __clzdi2() implementation isn't used and as such the bug has
          no effect and won't be noticed.
      
       b) Some architectures link to libgcc.a, and the in-kernel weak
          functions get replaced by the correct 64-bit variants from libgcc.a.
      
       c) __builtin_clzll() and __clzdi2() doesn't seem to be used in many
          places in the kernel, and most likely only in uncritical functions,
          e.g. when printing hex values via seq_put_hex_ll(). The wrong return
          value will still print the correct number, but just in a wrong
          formatting (e.g. with too many leading zeroes).
      
       d) 32-bit kernels aren't used that much any longer, so they are less
          tested.
      
      A trivial testcase to verify if the currently running 32-bit kernel is
      affected by the bug is to look at the output of /proc/self/maps:
      
      Here the kernel uses a correct implementation of __clzdi2():
      
        root@debian:~# cat /proc/self/maps
        00010000-00019000 r-xp 00000000 08:05 787324     /usr/bin/cat
        00019000-0001a000 rwxp 00009000 08:05 787324     /usr/bin/cat
        0001a000-0003b000 rwxp 00000000 00:00 0          [heap]
        f7551000-f770d000 r-xp 00000000 08:05 794765     /usr/lib/hppa-linux-gnu/libc.so.6
        ...
      
      and this kernel uses the broken implementation of __clzdi2():
      
        root@debian:~# cat /proc/self/maps
        0000000010000-0000000019000 r-xp 00000000 000000008:000000005 787324  /usr/bin/cat
        0000000019000-000000001a000 rwxp 000000009000 000000008:000000005 787324  /usr/bin/cat
        000000001a000-000000003b000 rwxp 00000000 00:00 0  [heap]
        00000000f73d1000-00000000f758d000 r-xp 00000000 000000008:000000005 794765  /usr/lib/hppa-linux-gnu/libc.so.6
        ...
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Fixes: 4df87bb7 ("lib: add weak clz/ctz functions")
      Cc: Chanho Min <chanho.min@lge.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: stable@vger.kernel.org # v3.11+
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      382d4cd1
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2023-08-25-11-07' of... · 6f0edbb8
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2023-08-25-11-07' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull misc fixes from Andrew Morton:
       "18 hotfixes. 13 are cc:stable and the remainder pertain to post-6.4
        issues or aren't considered suitable for a -stable backport"
      
      * tag 'mm-hotfixes-stable-2023-08-25-11-07' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        shmem: fix smaps BUG sleeping while atomic
        selftests: cachestat: catch failing fsync test on tmpfs
        selftests: cachestat: test for cachestat availability
        maple_tree: disable mas_wr_append() when other readers are possible
        madvise:madvise_free_pte_range(): don't use mapcount() against large folio for sharing check
        madvise:madvise_free_huge_pmd(): don't use mapcount() against large folio for sharing check
        madvise:madvise_cold_or_pageout_pte_range(): don't use mapcount() against large folio for sharing check
        mm: multi-gen LRU: don't spin during memcg release
        mm: memory-failure: fix unexpected return value in soft_offline_page()
        radix tree: remove unused variable
        mm: add a call to flush_cache_vmap() in vmap_pfn()
        selftests/mm: FOLL_LONGTERM need to be updated to 0x100
        nilfs2: fix general protection fault in nilfs_lookup_dirty_data_buffers()
        mm/gup: handle cont-PTE hugetlb pages correctly in gup_must_unshare() via GUP-fast
        selftests: cgroup: fix test_kmem_basic less than error
        mm: enable page walking API to lock vmas during the walk
        smaps: use vm_normal_page_pmd() instead of follow_trans_huge_pmd()
        mm/gup: reintroduce FOLL_NUMA as FOLL_HONOR_NUMA_FAULT
      6f0edbb8
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-6.5-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 4942fed8
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
       "This is obviously not ideal, particularly for something this late in
        the cycle.
      
        Unfortunately we found some uABI issues in the vector support while
        reviewing the GDB port, which has triggered a revert -- probably a
        good sign we should have reviewed GDB before merging this, I guess I
        just dropped the ball because I was so worried about the context
        extension and libc suff I forgot. Hence the late revert.
      
        There's some risk here as we're still exposing the vector context for
        signal handlers, but changing that would have meant reverting all of
        the vector support. The issues we've found so far have been fixed
        already and they weren't absolute showstoppers, so we're essentially
        just playing it safe by holding ptrace support for another release (or
        until we get through a proper userspace code review).
      
        Summary:
      
         - The vector ucontext extension has been extended with vlenb
      
         - The vector registers ELF core dump note type has been changed to
           avoid aliasing with the CSR type used in embedded systems
      
         - Support for accessing vector registers via ptrace() has been
           reverted
      
         - Another build fix for the ISA spec changes around Zifencei/Zicsr
           that manifests on some systems built with binutils-2.37 and
           gcc-11.2"
      
      * tag 'riscv-for-linus-6.5-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: Fix build errors using binutils2.37 toolchains
        RISC-V: vector: export VLENB csr in __sc_riscv_v_state
        RISC-V: Remove ptrace support for vectors
      4942fed8
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · 98c6b8a5
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - fix an irq mapping leak in gpio-sim
      
       - associate the GPIO device's software node with the irq domain in
         gpio-sim
      
      * tag 'gpio-fixes-for-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: sim: pass the GPIO device's software node to irq domain
        gpio: sim: dispose of irq mappings before destroying the irq_sim domain
      98c6b8a5
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v6.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · a87eaffb
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
       "Here are some Renesas and AMD driver fixes, the AMD fix affects
        important laptops in the wild so this one is pretty important. It
        seems a bit tough to get this right.
      
         - Fix DT parsing and related locking in the Renesas driver.
      
         - Fix wakeup IRQs in the AMD driver once again. Really tricky this
           one"
      
      * tag 'pinctrl-v6.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: amd: Mask wake bits on probe again
        pinctrl: renesas: rza2: Add lock around pinctrl_generic{{add,remove}_group,{add,remove}_function}
        pinctrl: renesas: rzv2m: Fix NULL pointer dereference in rzv2m_dt_subnode_to_map()
        pinctrl: renesas: rzg2l: Fix NULL pointer dereference in rzg2l_dt_subnode_to_map()
      a87eaffb
    • Sean Christopherson's avatar
      KVM: x86: Update MAINTAINTERS to include selftests · c92b922a
      Sean Christopherson authored
      Give KVM x86 the same treatment as all other KVM architectures, and
      officially take ownership of x86 specific KVM selftests (changes have
      been routed through kvm and/or kvm-x86 for quite some time).
      
      Cc: kvm@vger.kernel.org
      Link: https://lore.kernel.org/r/20230817234114.1420092-1-seanjc@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
      c92b922a
    • Sean Christopherson's avatar
      KVM: selftests: Explicit set #UD when *potentially* injecting exception · 02dc2543
      Sean Christopherson authored
      Explicitly set the exception vector to #UD when potentially injecting an
      exception in sync_regs_test's subtests that try to detect TOCTOU bugs
      in KVM's handling of exceptions injected by userspace.  A side effect of
      the original KVM bug was that KVM would clear the vector, but relying on
      KVM to clear the vector (i.e. make it #DE) makes it less likely that the
      test would ever find *new* KVM bugs, e.g. because only the first iteration
      would run with a legal vector to start.
      
      Explicitly inject #UD for race_events_inj_pen() as well, e.g. so that it
      doesn't inherit the illegal 255 vector from race_events_exc(), which
      currently runs first.
      
      Link: https://lore.kernel.org/r/20230817233430.1416463-3-seanjc@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
      02dc2543
    • Sean Christopherson's avatar
      KVM: selftests: Reload "good" vCPU state if vCPU hits shutdown · 5002b112
      Sean Christopherson authored
      Reload known good vCPU state if the vCPU triple faults in any of the
      race_sync_regs() subtests, e.g. if KVM successfully injects an exception
      (the vCPU isn't configured to handle exceptions).  On Intel, the VMCS
      is preserved even after shutdown, but AMD's APM states that the VMCB is
      undefined after a shutdown and so KVM synthesizes an INIT to sanitize
      vCPU/VMCB state, e.g. to guard against running with a garbage VMCB.
      
      The synthetic INIT results in the vCPU never exiting to userspace, as it
      gets put into Real Mode at the reset vector, which is full of zeros (as is
      GPA 0 and beyond), and so executes ADD for a very, very long time.
      
      Fixes: 60c4063b ("KVM: selftests: Extend x86's sync_regs_test to check for event vector races")
      Cc: Michal Luczaj <mhal@rbox.co>
      Link: https://lore.kernel.org/r/20230817233430.1416463-2-seanjc@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
      5002b112
    • Linus Torvalds's avatar
      Merge tag 'sound-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · ced5bf24
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Hopefully the last bits for 6.5. It's slightly higher LOCs than
        wished, but it doesn't look scary.
      
        The biggest change is MAINTAINERS update for TI; it's good to have the
        update before the final release, so that people can contact to the
        right persons for bug reports (which shouldn't happen of course!)
      
        The rest are all device-specific fixes and quirks, most for various
        ASoC platforms"
      
      * tag 'sound-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ASoC: amd: yc: Fix a non-functional mic on Lenovo 82SJ
        ALSA: ymfpci: Fix the missing snd_card_free() call at probe error
        ASoC: cs35l41: Correct amp_gain_tlv values
        ASoC: amd: yc: Add VivoBook Pro 15 to quirks list for acp6x
        ASoC: tas2781: fixed register access error when switching to other chips
        ASoC: cs35l56: Add an ACPI match table
        ASoC: cs35l56: Read firmware uuid from a device property instead of _SUB
        ASoC: SOF: ipc4-pcm: fix possible null pointer deference
        MAINTAINERS: Add entries for TEXAS INSTRUMENTS ASoC DRIVERS
      ced5bf24