1. 27 Jul, 2023 3 commits
    • Linus Torvalds's avatar
      Merge tag 'for-6.5-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 64de76ce
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
      
       - fix accounting of global block reserve size when block group tree is
         enabled
      
       - the async discard has been enabled in 6.2 unconditionally, but for
         zoned mode it does not make that much sense to do it asynchronously
         as the zones are reset as needed
      
       - error handling and proper error value propagation fixes
      
      * tag 'for-6.5-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: check for commit error at btrfs_attach_transaction_barrier()
        btrfs: check if the transaction was aborted at btrfs_wait_for_commit()
        btrfs: remove BUG_ON()'s in add_new_free_space()
        btrfs: account block group tree when calculating global reserve size
        btrfs: zoned: do not enable async discard
      64de76ce
    • Linus Torvalds's avatar
      Merge tag 'fixes-2023-07-27' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock · 379e6671
      Linus Torvalds authored
      Pull memblock fix from Mike Rapoport:
       "A call to memblock_free() or memblock_phys_free() issued after
        memblock data is discarded will result in use after free in
        memblock_isolate_range().
      
        Avoid those issues by making sure that memblock_discard points
        memblock.reserved.regions back at the static buffer"
      
      * tag 'fixes-2023-07-27' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
        mm,memblock: reset memblock.reserved to system init state to prevent UAF
      379e6671
    • Jann Horn's avatar
      mm: lock_vma_under_rcu() must check vma->anon_vma under vma lock · 657b5146
      Jann Horn authored
      lock_vma_under_rcu() tries to guarantee that __anon_vma_prepare() can't
      be called in the VMA-locked page fault path by ensuring that
      vma->anon_vma is set.
      
      However, this check happens before the VMA is locked, which means a
      concurrent move_vma() can concurrently call unlink_anon_vmas(), which
      disassociates the VMA's anon_vma.
      
      This means we can get UAF in the following scenario:
      
        THREAD 1                   THREAD 2
        ========                   ========
        <page fault>
          lock_vma_under_rcu()
            rcu_read_lock()
            mas_walk()
            check vma->anon_vma
      
                                   mremap() syscall
                                     move_vma()
                                      vma_start_write()
                                       unlink_anon_vmas()
                                   <syscall end>
      
          handle_mm_fault()
            __handle_mm_fault()
              handle_pte_fault()
                do_pte_missing()
                  do_anonymous_page()
                    anon_vma_prepare()
                      __anon_vma_prepare()
                        find_mergeable_anon_vma()
                          mas_walk() [looks up VMA X]
      
                                   munmap() syscall (deletes VMA X)
      
                          reusable_anon_vma() [called on freed VMA X]
      
      This is a security bug if you can hit it, although an attacker would
      have to win two races at once where the first race window is only a few
      instructions wide.
      
      This patch is based on some previous discussion with Linus Torvalds on
      the security list.
      
      Cc: stable@vger.kernel.org
      Fixes: 5e31275c ("mm: add per-VMA lock and helper functions to control it")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      657b5146
  2. 26 Jul, 2023 4 commits
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v6.5-3' of... · 0a8db05b
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v6.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull x86 platform driver fixes from Hans de Goede:
       "Misc small fixes and hw-id additions"
      
      * tag 'platform-drivers-x86-v6.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
        platform/x86: huawei-wmi: Silence ambient light sensor
        platform/x86: msi-laptop: Fix rfkill out-of-sync on MSI Wind U100
        platform/x86: asus-wmi: Fix setting RGB mode on some TUF laptops
        platform/x86: think-lmi: Use kfree_sensitive instead of kfree
        platform/x86/intel/hid: Add HP Dragonfly G2 to VGBS DMI quirks
        platform/x86: intel: hid: Always call BTNL ACPI method
        platform/x86/amd/pmf: Notify OS power slider update
        platform/x86/amd/pmf: reduce verbosity of apmf_get_system_params
        platform/x86: serial-multi-instantiate: Auto detect IRQ resource for CSC3551
        platform/x86/amd: pmc: Use release_mem_region() to undo request_mem_region_muxed()
        platform/x86: touchscreen_dmi.c: small changes for Archos 101 Cesium Educ tablet
      0a8db05b
    • Linus Torvalds's avatar
      Merge tag '6.5-rc3-ksmbd-server-fixes' of git://git.samba.org/ksmbd · f40125c0
      Linus Torvalds authored
      Pull ksmbd server fixes from Steve French:
      
       - fixes for two possible out of bounds access (in negotiate, and in
         decrypt msg)
      
       - fix unsigned compared to zero warning
      
       - fix path lookup crossing a mountpoint
      
       - fix case when first compound request is a tree connect
      
       - fix memory leak if reads are compounded
      
      * tag '6.5-rc3-ksmbd-server-fixes' of git://git.samba.org/ksmbd:
        ksmbd: fix out of bounds in init_smb2_rsp_hdr()
        ksmbd: no response from compound read
        ksmbd: validate session id and tree id in compound request
        ksmbd: fix out of bounds in smb3_decrypt_req()
        ksmbd: check if a mount point is crossed during path lookup
        ksmbd: Fix unsigned expression compared with zero
      f40125c0
    • Linus Torvalds's avatar
      mm: suppress mm fault logging if fatal signal already pending · 5f0bc0b0
      Linus Torvalds authored
      Commit eda00472 ("mm: make the page fault mmap locking killable")
      intentionally made it much easier to trigger the "page fault fails
      because a fatal signal is pending" situation, by having the mmap locking
      fail early in that case.
      
      We have long aborted page faults in other fatal cases when the actual IO
      for a page is interrupted by SIGKILL - which is particularly useful for
      the traditional case of NFS hanging due to network issues, but local
      filesystems could cause it too if you happened to get the SIGKILL while
      waiting for a page to be faulted in (eg lock_folio_maybe_drop_mmap()).
      
      So aborting the page fault wasn't a new condition - but it now triggers
      earlier, before we even get to 'handle_mm_fault()'.  And as a result the
      error doesn't go through our 'fault_signal_pending()' logic, and doesn't
      get filtered away there.
      
      Normally you'd never even notice, because if a fatal signal is pending,
      the new SIGSEGV we send ends up being ignored anyway.
      
      But it turns out that there is one very noticeable exception: if you
      enable 'show_unhandled_signals', the aborted page fault will be logged
      in the kernel messages, and you'll get a scary line looking something
      like this in your logs:
      
        pverados[2183248]: segfault at 55e5a00f9ae0 ip 000055e5a00f9ae0 sp 00007ffc0720bea8 error 14 in perl[55e5a00d4000+195000] likely on CPU 10 (core 4, socket 0)
      
      which is rather misleading.  It's not really a segfault at all, it's
      just "the thread was killed before the page fault completed, so we
      aborted the page fault".
      
      Fix this by just making it clear that a pending fatal signal means that
      any new signal coming in after that is implicitly handled.  This will
      avoid the misleading logging, since now the signal isn't 'unhandled' any
      more.
      Reported-and-tested-by: default avatarFiona Ebner <f.ebner@proxmox.com>
      Tested-by: default avatarThomas Lamprecht <t.lamprecht@proxmox.com>
      Link: https://lore.kernel.org/lkml/8d063a26-43f5-0bb7-3203-c6a04dc159f8@proxmox.com/Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
      Fixes: eda00472 ("mm: make the page fault mmap locking killable")
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5f0bc0b0
    • Filipe Manana's avatar
      btrfs: check for commit error at btrfs_attach_transaction_barrier() · b28ff3a7
      Filipe Manana authored
      btrfs_attach_transaction_barrier() is used to get a handle pointing to the
      current running transaction if the transaction has not started its commit
      yet (its state is < TRANS_STATE_COMMIT_START). If the transaction commit
      has started, then we wait for the transaction to commit and finish before
      returning - however we completely ignore if the transaction was aborted
      due to some error during its commit, we simply return ERR_PT(-ENOENT),
      which makes the caller assume everything is fine and no errors happened.
      
      This could make an fsync return success (0) to user space when in fact we
      had a transaction abort and the target inode changes were therefore not
      persisted.
      
      Fix this by checking for the return value from btrfs_wait_for_commit(),
      and if it returned an error, return it back to the caller.
      
      Fixes: d4edf39b ("Btrfs: fix uncompleted transaction")
      CC: stable@vger.kernel.org # 4.19+
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      b28ff3a7
  3. 25 Jul, 2023 12 commits
  4. 24 Jul, 2023 8 commits
  5. 23 Jul, 2023 13 commits
    • Linus Torvalds's avatar
      Linux 6.5-rc3 · 6eaae198
      Linus Torvalds authored
      6eaae198
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 3b4e48b8
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Swapping the ring buffer for snapshotting (for things like irqsoff)
         can crash if the ring buffer is being resized. Disable swapping when
         this happens. The missed swap will be reported to the tracer
      
       - Report error if the histogram fails to be created due to an error in
         adding a histogram variable, in event_hist_trigger_parse()
      
       - Remove unused declaration of tracing_map_set_field_descr()
      
      * tag 'trace-v6.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tracing/histograms: Return an error if we fail to add histogram to hist_vars list
        ring-buffer: Do not swap cpu_buffer during resize process
        tracing: Remove unused extern declaration tracing_map_set_field_descr()
      3b4e48b8
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v6.5' of... · 12a5336c
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - Fix stale help text in gconfig
      
       - Support *.S files in compile_commands.json
      
       - Flatten KBUILD_CFLAGS
      
       - Fix external module builds with Rust so that temporary files are
         created in the modules directories instead of the kernel tree
      
      * tag 'kbuild-fixes-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kbuild: rust: avoid creating temporary files
        kbuild: flatten KBUILD_CFLAGS
        gen_compile_commands: add assembly files to compilation database
        kconfig: gconfig: correct program name in help text
        kconfig: gconfig: drop the Show Debug Info help text
      12a5336c
    • Miguel Ojeda's avatar
      kbuild: rust: avoid creating temporary files · df01b7cf
      Miguel Ojeda authored
      `rustc` outputs by default the temporary files (i.e. the ones saved
      by `-Csave-temps`, such as `*.rcgu*` files) in the current working
      directory when `-o` and `--out-dir` are not given (even if
      `--emit=x=path` is given, i.e. it does not use those for temporaries).
      
      Since out-of-tree modules are compiled from the `linux` tree,
      `rustc` then tries to create them there, which may not be accessible.
      
      Thus pass `--out-dir` explicitly, even if it is just for the temporary
      files.
      
      Similarly, do so for Rust host programs too.
      Reported-by: default avatarRaphael Nestler <raphael.nestler@gmail.com>
      Closes: https://github.com/Rust-for-Linux/linux/issues/1015Reported-by: default avatarAndrea Righi <andrea.righi@canonical.com>
      Tested-by: Raphael Nestler <raphael.nestler@gmail.com> # non-hostprogs
      Tested-by: Andrea Righi <andrea.righi@canonical.com> # non-hostprogs
      Fixes: 295d8398 ("kbuild: specify output names separately for each emission type from rustc")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Tested-by: default avatarMartin Rodriguez Reboredo <yakoyoku@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      df01b7cf
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 269f4a4b
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "ARM:
      
         - Avoid pKVM finalization if KVM initialization fails
      
         - Add missing BTI instructions in the hypervisor, fixing an early
           boot failure on BTI systems
      
         - Handle MMU notifiers correctly for non hugepage-aligned memslots
      
         - Work around a bug in the architecture where hypervisor timer
           controls have UNKNOWN behavior under nested virt
      
         - Disable preemption in kvm_arch_hardware_enable(), fixing a kernel
           BUG in cpu hotplug resulting from per-CPU accessor sanity checking
      
         - Make WFI emulation on GICv4 systems robust w.r.t. preemption,
           consistently requesting a doorbell interrupt on vcpu_put()
      
         - Uphold RES0 sysreg behavior when emulating older PMU versions
      
         - Avoid macro expansion when initializing PMU register names,
           ensuring the tracepoints pretty-print the sysreg
      
        s390:
      
         - Two fixes for asynchronous destroy
      
        x86 fixes will come early next week"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: s390: pv: fix index value of replaced ASCE
        KVM: s390: pv: simplify shutdown and fix race
        KVM: arm64: Fix the name of sys_reg_desc related to PMU
        KVM: arm64: Correctly handle RES0 bits PMEVTYPER<n>_EL0.evtCount
        KVM: arm64: vgic-v4: Make the doorbell request robust w.r.t preemption
        KVM: arm64: Add missing BTI instructions
        KVM: arm64: Correctly handle page aging notifiers for unaligned memslot
        KVM: arm64: Disable preemption in kvm_arch_hardware_enable()
        KVM: arm64: Handle kvm_arm_init failure correctly in finalize_pkvm
        KVM: arm64: timers: Use CNTHCTL_EL2 when setting non-CNTKCTL_EL1 bits
      269f4a4b
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus-6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 15b593ba
      Linus Torvalds authored
      Pull ext4 fixes from Ted Ts'o:
       "Bug and regression fixes for 6.5-rc3 for ext4's mballoc and jbd2's
        checkpoint code"
      
      * tag 'ext4_for_linus-6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: fix rbtree traversal bug in ext4_mb_use_preallocated
        ext4: fix off by one issue in ext4_mb_choose_next_group_best_avail()
        ext4: correct inline offset when handling xattrs in inode body
        jbd2: remove __journal_try_to_free_buffer()
        jbd2: fix a race when checking checkpoint buffer busy
        jbd2: Fix wrongly judgement for buffer head removing while doing checkpoint
        jbd2: remove journal_clean_one_cp_list()
        jbd2: remove t_checkpoint_io_list
        jbd2: recheck chechpointing non-dirty buffer
      15b593ba
    • Linus Torvalds's avatar
      Merge tag '6.5-rc2-smb3-client-fixes-ver2' of git://git.samba.org/sfrench/cifs-2.6 · 8266f53b
      Linus Torvalds authored
      Pull smb client fix from Steve French:
       "Add minor debugging improvement.
      
        The change improves ability to read a network trace to debug problems
        on encrypted connections which are very common (e.g. using wireshark
        or tcpdump).
      
        That works today with tools like 'smbinfo keys /mnt/file' but requires
        passing in a filename on the mount (see e.g. [1]), but it often makes
        more sense to just pass in the mount point path (ie a directory not a
        filename).
      
        So this fix was needed to debug some types of problems (an obvious
        example is on an encrypted connection failing operations on an empty
        share or with no files in the root of the directory) - so you can
        simply pass in the 'smbinfo keys <mntpoint>' and get the information
        that wireshark needs"
      
      Link: https://wiki.samba.org/index.php/Wireshark_Decryption [1]
      
      * tag '6.5-rc2-smb3-client-fixes-ver2' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: update internal module version number for cifs.ko
        cifs: allow dumping keys for directories too
      8266f53b
    • Paolo Bonzini's avatar
      Merge tag 'kvm-s390-master-6.5-1' of... · 0c189708
      Paolo Bonzini authored
      Merge tag 'kvm-s390-master-6.5-1' of https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD
      
      Two fixes for asynchronous destroy
      0c189708
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-fixes-6.5-1' of... · 675a15f4
      Paolo Bonzini authored
      Merge tag 'kvmarm-fixes-6.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
      
      KVM/arm64 fixes for 6.5, part #1
      
       - Avoid pKVM finalization if KVM initialization fails
      
       - Add missing BTI instructions in the hypervisor, fixing an early boot
         failure on BTI systems
      
       - Handle MMU notifiers correctly for non hugepage-aligned memslots
      
       - Work around a bug in the architecture where hypervisor timer controls
         have UNKNOWN behavior under nested virt.
      
       - Disable preemption in kvm_arch_hardware_enable(), fixing a kernel BUG
         in cpu hotplug resulting from per-CPU accessor sanity checking.
      
       - Make WFI emulation on GICv4 systems robust w.r.t. preemption,
         consistently requesting a doorbell interrupt on vcpu_put()
      
       - Uphold RES0 sysreg behavior when emulating older PMU versions
      
       - Avoid macro expansion when initializing PMU register names, ensuring
         the tracepoints pretty-print the sysreg.
      675a15f4
    • Namjae Jeon's avatar
      ksmbd: fix out of bounds in init_smb2_rsp_hdr() · 536bb492
      Namjae Jeon authored
      If client send smb2 negotiate request and then send smb1 negotiate
      request, init_smb2_rsp_hdr is called for smb1 negotiate request since
      need_neg is set to false. This patch ignore smb1 packets after ->need_neg
      is set to false.
      
      Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-21541
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      536bb492
    • Namjae Jeon's avatar
      ksmbd: no response from compound read · e202a1e8
      Namjae Jeon authored
      ksmbd doesn't support compound read. If client send read-read in
      compound to ksmbd, there can be memory leak from read buffer.
      Windows and linux clients doesn't send it to server yet. For now,
      No response from compound read. compound read will be supported soon.
      
      Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-21587, ZDI-CAN-21588
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      e202a1e8
    • Namjae Jeon's avatar
      ksmbd: validate session id and tree id in compound request · 3df0411e
      Namjae Jeon authored
      `smb2_get_msg()` in smb2_get_ksmbd_tcon() and smb2_check_user_session()
      will always return the first request smb2 header in a compound request.
      if `SMB2_TREE_CONNECT_HE` is the first command in compound request, will
      return 0, i.e. The tree id check is skipped.
      This patch use ksmbd_req_buf_next() to get current command in compound.
      
      Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-21506
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      3df0411e
    • Namjae Jeon's avatar
      ksmbd: fix out of bounds in smb3_decrypt_req() · dc318846
      Namjae Jeon authored
      smb3_decrypt_req() validate if pdu_length is smaller than
      smb2_transform_hdr size.
      
      Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-21589
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      dc318846