1. 25 Aug, 2023 2 commits
    • Yonghong Song's avatar
      kallsyms: Change func signature for cleanup_symbol_name() · 76903a96
      Yonghong Song authored
      All users of cleanup_symbol_name() do not use the return value.
      So let us change the return value of cleanup_symbol_name() to
      'void' to reflect its usage pattern.
      Suggested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarYonghong Song <yonghong.song@linux.dev>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarSong Liu <song@kernel.org>
      Link: https://lore.kernel.org/r/20230825202036.441212-1-yonghong.song@linux.devSigned-off-by: default avatarKees Cook <keescook@chromium.org>
      76903a96
    • Yonghong Song's avatar
      kallsyms: Fix kallsyms_selftest failure · 33f0467f
      Yonghong Song authored
      Kernel test robot reported a kallsyms_test failure when clang lto is
      enabled (thin or full) and CONFIG_KALLSYMS_SELFTEST is also enabled.
      I can reproduce in my local environment with the following error message
      with thin lto:
        [    1.877897] kallsyms_selftest: Test for 1750th symbol failed: (tsc_cs_mark_unstable) addr=ffffffff81038090
        [    1.877901] kallsyms_selftest: abort
      
      It appears that commit 8cc32a9b ("kallsyms: strip LTO-only suffixes
      from promoted global functions") caused the failure. Commit 8cc32a9b
      changed cleanup_symbol_name() based on ".llvm." instead of '.' where
      ".llvm." is appended to a before-lto-optimization local symbol name.
      We need to propagate such knowledge in kallsyms_selftest.c as well.
      
      Further more, compare_symbol_name() in kallsyms.c needs change as well.
      In scripts/kallsyms.c, kallsyms_names and kallsyms_seqs_of_names are used
      to record symbol names themselves and index to symbol names respectively.
      For example:
        kallsyms_names:
          ...
          __amd_smn_rw._entry       <== seq 1000
          __amd_smn_rw._entry.5     <== seq 1001
          __amd_smn_rw.llvm.<hash>  <== seq 1002
          ...
      
      kallsyms_seqs_of_names are sorted based on cleanup_symbol_name() through, so
      the order in kallsyms_seqs_of_names actually has
      
        index 1000:   seq 1002   <== __amd_smn_rw.llvm.<hash> (actual symbol comparison using '__amd_smn_rw')
        index 1001:   seq 1000   <== __amd_smn_rw._entry
        index 1002:   seq 1001   <== __amd_smn_rw._entry.5
      
      Let us say at a particular point, at index 1000, symbol '__amd_smn_rw.llvm.<hash>'
      is comparing to '__amd_smn_rw._entry' where '__amd_smn_rw._entry' is the one to
      search e.g., with function kallsyms_on_each_match_symbol(). The current implementation
      will find out '__amd_smn_rw._entry' is less than '__amd_smn_rw.llvm.<hash>' and
      then continue to search e.g., index 999 and never found a match although the actual
      index 1001 is a match.
      
      To fix this issue, let us do cleanup_symbol_name() first and then do comparison.
      In the above case, comparing '__amd_smn_rw' vs '__amd_smn_rw._entry' and
      '__amd_smn_rw._entry' being greater than '__amd_smn_rw', the next comparison will
      be > index 1000 and eventually index 1001 will be hit an a match is found.
      
      For any symbols not having '.llvm.' substr, there is no functionality change
      for compare_symbol_name().
      
      Fixes: 8cc32a9b ("kallsyms: strip LTO-only suffixes from promoted global functions")
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Closes: https://lore.kernel.org/oe-lkp/202308232200.1c932a90-oliver.sang@intel.comSigned-off-by: default avatarYonghong Song <yonghong.song@linux.dev>
      Reviewed-by: default avatarSong Liu <song@kernel.org>
      Reviewed-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
      Link: https://lore.kernel.org/r/20230825034659.1037627-1-yonghong.song@linux.dev
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      33f0467f
  2. 21 Aug, 2023 1 commit
    • Elena Reshetova's avatar
      nsproxy: Convert nsproxy.count to refcount_t · 2ddd3cac
      Elena Reshetova authored
      atomic_t variables are currently used to implement reference counters
      with the following properties:
       - counter is initialized to 1 using atomic_set()
       - a resource is freed upon counter reaching zero
       - once counter reaches zero, its further
         increments aren't allowed
       - counter schema uses basic atomic operations
         (set, inc, inc_not_zero, dec_and_test, etc.)
      
      Such atomic variables should be converted to a newly provided
      refcount_t type and API that prevents accidental counter overflows and
      underflows. This is important since overflows and underflows can lead
      to use-after-free situation and be exploitable.
      
      The variable nsproxy.count is used as pure reference counter. Convert it
      to refcount_t and fix up the operations.
      
      **Important note for maintainers:
      
      Some functions from refcount_t API defined in refcount.h have different
      memory ordering guarantees than their atomic counterparts. Please check
      Documentation/core-api/refcount-vs-atomic.rst for more information.
      
      Normally the differences should not matter since refcount_t provides
      enough guarantees to satisfy the refcounting use cases, but in some
      rare cases it might matter. Please double check that you don't have
      some undocumented memory guarantees for this variable usage.
      
      For the nsproxy.count it might make a difference in following places:
       - put_nsproxy() and switch_task_namespaces(): decrement in
         refcount_dec_and_test() only provides RELEASE ordering and ACQUIRE
         ordering on success vs. fully ordered atomic counterpart
      Suggested-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarElena Reshetova <elena.reshetova@intel.com>
      Reviewed-by: default avatarDavid Windsor <dwindsor@gmail.com>
      Reviewed-by: default avatarHans Liljestrand <ishkamiel@gmail.com>
      Reviewed-by: default avatarChristian Brauner <brauner@kernel.org>
      Link: https://lore.kernel.org/r/20230818041327.gonna.210-kees@kernel.orgSigned-off-by: default avatarKees Cook <keescook@chromium.org>
      2ddd3cac
  3. 18 Aug, 2023 1 commit
  4. 17 Aug, 2023 2 commits
  5. 16 Aug, 2023 2 commits
  6. 15 Aug, 2023 5 commits
  7. 11 Aug, 2023 2 commits
  8. 03 Aug, 2023 1 commit
  9. 27 Jul, 2023 4 commits
  10. 17 Jul, 2023 2 commits
  11. 16 Jul, 2023 10 commits
    • Linus Torvalds's avatar
      Linux 6.5-rc2 · fdf0eaf1
      Linus Torvalds authored
      fdf0eaf1
    • Linus Torvalds's avatar
      Merge tag 'xtensa-20230716' of https://github.com/jcmvbkbc/linux-xtensa · 5b8d6e85
      Linus Torvalds authored
      Pull xtensa fixes from Max Filippov:
      
       - fix interaction between unaligned exception handler and load/store
         exception handler
      
       - fix parsing ISS network interface specification string
      
       - add comment about etherdev freeing to ISS network driver
      
      * tag 'xtensa-20230716' of https://github.com/jcmvbkbc/linux-xtensa:
        xtensa: fix unaligned and load/store configuration interaction
        xtensa: ISS: fix call to split_if_spec
        xtensa: ISS: add comment about etherdev freeing
      5b8d6e85
    • Linus Torvalds's avatar
      Merge tag 'perf_urgent_for_v6.5_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1667e630
      Linus Torvalds authored
      Pull perf fix from Borislav Petkov:
      
       - Fix a lockdep warning when the event given is the first one, no event
         group exists yet but the code still goes and iterates over event
         siblings
      
      * tag 'perf_urgent_for_v6.5_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/x86: Fix lockdep warning in for_each_sibling_event() on SPR
      1667e630
    • Linus Torvalds's avatar
      Merge tag 'objtool_urgent_for_v6.5_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8a3e4a64
      Linus Torvalds authored
      Pull objtool fixes from Borislav Petkov:
      
       - Mark copy_iovec_from_user() __noclone in order to prevent gcc from
         doing an inter-procedural optimization and confuse objtool
      
       - Initialize struct elf fully to avoid build failures
      
      * tag 'objtool_urgent_for_v6.5_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        iov_iter: Mark copy_iovec_from_user() noclone
        objtool: initialize all of struct elf
      8a3e4a64
    • Linus Torvalds's avatar
      Merge tag 'sched_urgent_for_v6.5_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f61a89ca
      Linus Torvalds authored
      Pull scheduler fixes from Borislav Petkov:
      
       - Remove a cgroup from under a polling process properly
      
       - Fix the idle sibling selection
      
      * tag 'sched_urgent_for_v6.5_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/psi: use kernfs polling functions for PSI trigger polling
        sched/fair: Use recent_used_cpu to test p->cpus_ptr
      f61a89ca
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v6.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · ede950b0
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
       "I'm mostly on vacation but what would vacation be without a few
        critical fixes so people can use their gaming laptops when hiding away
        from the sun (or rain)?
      
         - Fix a really annoying interrupt storm in the AMD driver affecting
           Asus TUF gaming notebooks
      
         - Fix device tree parsing in the Renesas driver"
      
      * tag 'pinctrl-v6.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: amd: Unify debounce handling into amd_pinconf_set()
        pinctrl: amd: Drop pull up select configuration
        pinctrl: amd: Use amd_pinconf_set() for all config options
        pinctrl: amd: Only use special debounce behavior for GPIO 0
        pinctrl: renesas: rzg2l: Handle non-unique subnode names
        pinctrl: renesas: rzv2m: Handle non-unique subnode names
      ede950b0
    • Linus Torvalds's avatar
      Merge tag '6.5-rc1-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · fe756ad0
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
      
       - Two reconnect fixes: important fix to address inFlight count to leak
         (which can leak credits), and fix for better handling a deleted share
      
       - DFS fix
      
       - SMB1 cleanup fix
      
       - deferred close fix
      
      * tag '6.5-rc1-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: fix mid leak during reconnection after timeout threshold
        cifs: is_network_name_deleted should return a bool
        smb: client: fix missed ses refcounting
        smb: client: Fix -Wstringop-overflow issues
        cifs: if deferred close is disabled then close files immediately
      fe756ad0
    • Linus Torvalds's avatar
      Merge tag 'powerpc-6.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 20edcec2
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Fix Speculation_Store_Bypass reporting in /proc/self/status on
         Power10
      
       - Fix HPT with 4K pages since recent changes by implementing pmd_same()
      
       - Fix 64-bit native_hpte_remove() to be irq-safe
      
      Thanks to Aneesh Kumar K.V, Nageswara R Sastry, and Russell Currey.
      
      * tag 'powerpc-6.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/mm/book3s64/hash/4k: Add pmd_same callback for 4K page size
        powerpc/64e: Fix obtool warnings in exceptions-64e.S
        powerpc/security: Fix Speculation_Store_Bypass reporting on Power10
        powerpc/64s: Fix native_hpte_remove() to be irq-safe
      20edcec2
    • Linus Torvalds's avatar
      Merge tag 'hardening-v6.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 6eede068
      Linus Torvalds authored
      Pull hardening fixes from Kees Cook:
      
       - Remove LTO-only suffixes from promoted global function symbols
         (Yonghong Song)
      
       - Remove unused .text..refcount section from vmlinux.lds.h (Petr Pavlu)
      
       - Add missing __always_inline to sparc __arch_xchg() (Arnd Bergmann)
      
       - Claim maintainership of string routines
      
      * tag 'hardening-v6.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        sparc: mark __arch_xchg() as __always_inline
        MAINTAINERS: Foolishly claim maintainership of string routines
        kallsyms: strip LTO-only suffixes from promoted global functions
        vmlinux.lds.h: Remove a reference to no longer used sections .text..refcount
      6eede068
    • Linus Torvalds's avatar
      Merge tag 'probes-fixes-v6.5-rc1-2' of... · 4b4eef57
      Linus Torvalds authored
      Merge tag 'probes-fixes-v6.5-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
      
      Pull probe fixes from Masami Hiramatsu:
      
       - fprobe: Add a comment why fprobe will be skipped if another kprobe is
         running in fprobe_kprobe_handler().
      
       - probe-events: Fix some issues related to fetch-arguments:
      
          - Fix double counting of the string length for user-string and
            symstr. This will require longer buffer in the array case.
      
          - Fix not to count error code (minus value) for the total used
            length in array argument. This makes the total used length
            shorter.
      
          - Fix to update dynamic used data size counter only if fetcharg uses
            the dynamic size data. This may mis-count the used dynamic data
            size and corrupt data.
      
          - Revert "tracing: Add "(fault)" name injection to kernel probes"
            because that did not work correctly with a bug, and we agreed the
            current '(fault)' output (instead of '"(fault)"' like a string)
            explains what happened more clearly.
      
          - Fix to record 0-length (means fault access) data_loc data in fetch
            function itself, instead of store_trace_args(). If we record an
            array of string, this will fix to save fault access data on each
            entry of the array correctly.
      
      * tag 'probes-fixes-v6.5-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tracing/probes: Fix to record 0-length data_loc in fetch_store_string*() if fails
        Revert "tracing: Add "(fault)" name injection to kernel probes"
        tracing/probes: Fix to update dynamic data counter if fetcharg uses it
        tracing/probes: Fix not to count error code to total length
        tracing/probes: Fix to avoid double count of the string length on the array
        fprobes: Add a comment why fprobe_kprobe_handler exits if kprobe is running
      4b4eef57
  12. 15 Jul, 2023 7 commits
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · 831fe284
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A couple of fairly minor driver specific fixes here, plus a bunch of
        maintainership and admin updates. Nothing too remarkable"
      
      * tag 'spi-fix-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        mailmap: add entry for Jonas Gorski
        MAINTAINERS: add myself for spi-bcm63xx
        spi: s3c64xx: clear loopback bit after loopback test
        spi: bcm63xx: fix max prepend length
        MAINTAINERS: Add myself as a maintainer for Microchip SPI
      831fe284
    • Linus Torvalds's avatar
      Merge tag 'regmap-fix-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap · 393ea781
      Linus Torvalds authored
      Pull regmap fix from Mark Brown:
       "One fix for an out of bounds access in the interupt code here"
      
      * tag 'regmap-fix-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
        regmap-irq: Fix out-of-bounds access when allocating config buffers
      393ea781
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 82678ab2
      Linus Torvalds authored
      Pull iommu fixes from Joerg Roedel:
      
       - Fix a regression causing a crash on sysfs access of iommu-group
         specific files
      
       - Fix signedness bug in SVA code
      
      * tag 'iommu-fixes-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/sva: Fix signedness bug in iommu_sva_alloc_pasid()
        iommu: Fix crash during syfs iommu_groups/N/type
      82678ab2
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_6.5_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · b6e6cc1f
      Linus Torvalds authored
      Pull x86 CFI fixes from Peter Zijlstra:
       "Fix kCFI/FineIBT weaknesses
      
        The primary bug Alyssa noticed was that with FineIBT enabled function
        prologues have a spurious ENDBR instruction:
      
          __cfi_foo:
      	endbr64
      	subl	$hash, %r10d
      	jz	1f
      	ud2
      	nop
          1:
          foo:
      	endbr64 <--- *sadface*
      
        This means that any indirect call that fails to target the __cfi
        symbol and instead targets (the regular old) foo+0, will succeed due
        to that second ENDBR.
      
        Fixing this led to the discovery of a single indirect call that was
        still doing this: ret_from_fork(). Since that's an assembly stub the
        compiler would not generate the proper kCFI indirect call magic and it
        would not get patched.
      
        Brian came up with the most comprehensive fix -- convert the thing to
        C with only a very thin asm wrapper. This ensures the kernel thread
        boostrap is a proper kCFI call.
      
        While discussing all this, Kees noted that kCFI hashes could/should be
        poisoned to seal all functions whose address is never taken, further
        limiting the valid kCFI targets -- much like we already do for IBT.
      
        So what was a 'simple' observation and fix cascaded into a bunch of
        inter-related CFI infrastructure fixes"
      
      * tag 'x86_urgent_for_6.5_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cfi: Only define poison_cfi() if CONFIG_X86_KERNEL_IBT=y
        x86/fineibt: Poison ENDBR at +0
        x86: Rewrite ret_from_fork() in C
        x86/32: Remove schedule_tail_wrapper()
        x86/cfi: Extend ENDBR sealing to kCFI
        x86/alternative: Rename apply_ibt_endbr()
        x86/cfi: Extend {JMP,CAKK}_NOSPEC comment
      b6e6cc1f
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · be522ac7
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "This is a bunch of small driver fixes and a larger rework of zone disk
        handling (which reaches into blk and nvme).
      
        The aacraid array-bounds fix is now critical since the security people
        turned on -Werror for some build tests, which now fail without it"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: storvsc: Handle SRB status value 0x30
        scsi: block: Improve checks in blk_revalidate_disk_zones()
        scsi: block: virtio_blk: Set zone limits before revalidating zones
        scsi: block: nullblk: Set zone limits before revalidating zones
        scsi: nvme: zns: Set zone limits before revalidating zones
        scsi: sd_zbc: Set zone limits before revalidating zones
        scsi: ufs: core: Add support for qTimestamp attribute
        scsi: aacraid: Avoid -Warray-bounds warning
        scsi: ufs: ufs-mediatek: Add dependency for RESET_CONTROLLER
        scsi: ufs: core: Update contact email for monitor sysfs nodes
        scsi: scsi_debug: Remove dead code
        scsi: qla2xxx: Use vmalloc_array() and vcalloc()
        scsi: fnic: Use vmalloc_array() and vcalloc()
        scsi: qla2xxx: Fix error code in qla2x00_start_sp()
        scsi: qla2xxx: Silence a static checker warning
        scsi: lpfc: Fix a possible data race in lpfc_unregister_fcf_rescan()
      be522ac7
    • Linus Torvalds's avatar
      Merge tag 'block-6.5-2023-07-14' of git://git.kernel.dk/linux · b3bd86a0
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - NVMe pull request via Keith:
            - Don't require quirk to use duplicate namespace identifiers
              (Christoph, Sagi)
            - One more BOGUS_NID quirk (Pankaj)
            - IO timeout and error hanlding fixes for PCI (Keith)
            - Enhanced metadata format mask fix (Ankit)
            - Association race condition fix for fibre channel (Michael)
            - Correct debugfs error checks (Minjie)
            - Use PAGE_SECTORS_SHIFT where needed (Damien)
            - Reduce kernel logs for legacy nguid attribute (Keith)
            - Use correct dma direction when unmapping metadata (Ming)
      
       - Fix for a flush handling regression in this release (Christoph)
      
       - Fix for batched request time stamping (Chengming)
      
       - Fix for a regression in the mq-deadline position calculation (Bart)
      
       - Lockdep fix for blk-crypto (Eric)
      
       - Fix for a regression in the Amiga partition handling changes
         (Michael)
      
      * tag 'block-6.5-2023-07-14' of git://git.kernel.dk/linux:
        block: queue data commands from the flush state machine at the head
        blk-mq: fix start_time_ns and alloc_time_ns for pre-allocated rq
        nvme-pci: fix DMA direction of unmapping integrity data
        nvme: don't reject probe due to duplicate IDs for single-ported PCIe devices
        block/mq-deadline: Fix a bug in deadline_from_pos()
        nvme: ensure disabling pairs with unquiesce
        nvme-fc: fix race between error recovery and creating association
        nvme-fc: return non-zero status code when fails to create association
        nvme: fix parameter check in nvme_fault_inject_init()
        nvme: warn only once for legacy uuid attribute
        block: remove dead struc request->completion_data field
        nvme: fix the NVME_ID_NS_NVM_STS_MASK definition
        nvmet: use PAGE_SECTORS_SHIFT
        nvme: add BOGUS_NID quirk for Samsung SM953
        blk-crypto: use dynamic lock class for blk_crypto_profile::lock
        block/partition: fix signedness issue for Amiga partitions
      b3bd86a0
    • Linus Torvalds's avatar
      Merge tag 'io_uring-6.5-2023-07-14' of git://git.kernel.dk/linux · ec17f164
      Linus Torvalds authored
      Pull io_uring fix from Jens Axboe:
       "Just a single tweak for the wait logic in io_uring"
      
      * tag 'io_uring-6.5-2023-07-14' of git://git.kernel.dk/linux:
        io_uring: Use io_schedule* in cqring wait
      ec17f164
  13. 14 Jul, 2023 1 commit