Skip to content
  1. Aug 04, 2023
    • James Morse's avatar
      module: Expose module_init_layout_section() · 2abcc4b5
      James Morse authored
      
      
      module_init_layout_section() choses whether the core module loader
      considers a section as init or not. This affects the placement of the
      exit section when module unloading is disabled. This code will never run,
      so it can be free()d once the module has been initialised.
      
      arm and arm64 need to count the number of PLTs they need before applying
      relocations based on the section name. The init PLTs are stored separately
      so they can be free()d. arm and arm64 both use within_module_init() to
      decide which list of PLTs to use when applying the relocation.
      
      Because within_module_init()'s behaviour changes when module unloading
      is disabled, both architecture would need to take this into account when
      counting the PLTs.
      
      Today neither architecture does this, meaning when module unloading is
      disabled there are insufficient PLTs in the init section to load some
      modules, resulting in warnings:
      | WARNING: CPU: 2 PID: 51 at arch/arm64/kernel/module-plts.c:99 module_emit_plt_entry+0x184/0x1cc
      | Modules linked in: crct10dif_common
      | CPU: 2 PID: 51 Comm: modprobe Not tainted 6.5.0-rc4-yocto-standard-dirty #15208
      | Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
      | pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      | pc : module_emit_plt_entry+0x184/0x1cc
      | lr : module_emit_plt_entry+0x94/0x1cc
      | sp : ffffffc0803bba60
      [...]
      | Call trace:
      |  module_emit_plt_entry+0x184/0x1cc
      |  apply_relocate_add+0x2bc/0x8e4
      |  load_module+0xe34/0x1bd4
      |  init_module_from_file+0x84/0xc0
      |  __arm64_sys_finit_module+0x1b8/0x27c
      |  invoke_syscall.constprop.0+0x5c/0x104
      |  do_el0_svc+0x58/0x160
      |  el0_svc+0x38/0x110
      |  el0t_64_sync_handler+0xc0/0xc4
      |  el0t_64_sync+0x190/0x194
      
      Instead of duplicating module_init_layout_section()s logic, expose it.
      
      Reported-by: default avatarAdam Johnston <adam.johnston@arm.com>
      Fixes: 055f23b7
      
       ("module: check for exit sections in layout_sections() instead of module_init_section()")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      2abcc4b5
  2. Aug 03, 2023
  3. Jul 27, 2023
  4. Jul 26, 2023
    • Arnd Bergmann's avatar
      samples/hw_breakpoint: fix building without module unloading · b9080468
      Arnd Bergmann authored
      __symbol_put() is really meant as an internal helper and is not available
      when module unloading is disabled, unlike the previously used symbol_put():
      
      samples/hw_breakpoint/data_breakpoint.c: In function 'hw_break_module_exit':
      samples/hw_breakpoint/data_breakpoint.c:73:9: error: implicit declaration of function '__symbol_put'; did you mean '__symbol_get'? [-Werror=implicit-function-declaration]
      
      The hw_break_module_exit() function is not actually used when module
      unloading is disabled, but it still causes the build failure for an
      undefined identifier. Enclose this one call in an appropriate #ifdef to
      clarify what the requirement is. Leaving out the entire exit function
      would also work but feels less clar in this case.
      
      Fixes: 910e230d ("samples/hw_breakpoint: Fix kernel BUG 'invalid opcode: 0000'")
      Fixes: d8a84d33
      
       ("samples/hw_breakpoint: drop use of kallsyms_lookup_name()")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      b9080468
  5. Jul 25, 2023
    • Rong Tao's avatar
      samples/hw_breakpoint: Fix kernel BUG 'invalid opcode: 0000' · 910e230d
      Rong Tao authored
      
      
      Macro symbol_put() is defined as __symbol_put(__stringify(x))
      
          ksym_name = "jiffies"
          symbol_put(ksym_name)
      
      will be resolved as
      
          __symbol_put("ksym_name")
      
      which is clearly wrong. So symbol_put must be replaced with __symbol_put.
      
      When we uninstall hw_breakpoint.ko (rmmod), a kernel bug occurs with the
      following error:
      
      [11381.854152] kernel BUG at kernel/module/main.c:779!
      [11381.854159] invalid opcode: 0000 [#2] PREEMPT SMP PTI
      [11381.854163] CPU: 8 PID: 59623 Comm: rmmod Tainted: G      D    OE      6.2.9-200.fc37.x86_64 #1
      [11381.854167] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./B360M-HDV, BIOS P3.20 10/23/2018
      [11381.854169] RIP: 0010:__symbol_put+0xa2/0xb0
      [11381.854175] Code: 00 e8 92 d2 f7 ff 65 8b 05 c3 2f e6 78 85 c0 74 1b 48 8b 44 24 30 65 48 2b 04 25 28 00 00 00 75 12 48 83 c4 38 c3 cc cc cc cc <0f> 0b 0f 1f 44 00 00 eb de e8 c0 df d8 00 90 90 90 90 90 90 90 90
      [11381.854178] RSP: 0018:ffffad8ec6ae7dd0 EFLAGS: 00010246
      [11381.854181] RAX: 0000000000000000 RBX: ffffffffc1fd1240 RCX: 000000000000000c
      [11381.854184] RDX: 000000000000006b RSI: ffffffffc02bf7c7 RDI: ffffffffc1fd001c
      [11381.854186] RBP: 000055a38b76e7c8 R08: ffffffff871ccfe0 R09: 0000000000000000
      [11381.854188] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
      [11381.854190] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
      [11381.854192] FS:  00007fbf7c62c740(0000) GS:ffff8c5badc00000(0000) knlGS:0000000000000000
      [11381.854195] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [11381.854197] CR2: 000055a38b7793f8 CR3: 0000000363e1e001 CR4: 00000000003726e0
      [11381.854200] DR0: ffffffffb3407980 DR1: 0000000000000000 DR2: 0000000000000000
      [11381.854202] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [11381.854204] Call Trace:
      [11381.854207]  <TASK>
      [11381.854212]  s_module_exit+0xc/0xff0 [symbol_getput]
      [11381.854219]  __do_sys_delete_module.constprop.0+0x198/0x2f0
      [11381.854225]  do_syscall_64+0x58/0x80
      [11381.854231]  ? exit_to_user_mode_prepare+0x180/0x1f0
      [11381.854237]  ? syscall_exit_to_user_mode+0x17/0x40
      [11381.854241]  ? do_syscall_64+0x67/0x80
      [11381.854245]  ? syscall_exit_to_user_mode+0x17/0x40
      [11381.854248]  ? do_syscall_64+0x67/0x80
      [11381.854252]  ? exc_page_fault+0x70/0x170
      [11381.854256]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      Signed-off-by: default avatarRong Tao <rongtao@cestc.cn>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      910e230d
    • Palmer Dabbelt's avatar
      modpost, kallsyms: Treat add '$'-prefixed symbols as mapping symbols · ff09f6fd
      Palmer Dabbelt authored
      Trying to restrict the '$'-prefix change to RISC-V caused some fallout,
      so let's just treat all those symbols as special.
      
      Fixes: c05780ef ("module: Ignore RISC-V mapping symbols too")
      Link: https://lore.kernel.org/all/20230712015747.77263-1-wangkefeng.wang@huawei.com/
      
      
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Reviewed-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      ff09f6fd
  6. Jul 11, 2023
  7. Jul 10, 2023
  8. Jul 09, 2023
    • Hugh Dickins's avatar
      mm: lock newly mapped VMA with corrected ordering · 1c7873e3
      Hugh Dickins authored
      Lockdep is certainly right to complain about
      
        (&vma->vm_lock->lock){++++}-{3:3}, at: vma_start_write+0x2d/0x3f
                       but task is already holding lock:
        (&mapping->i_mmap_rwsem){+.+.}-{3:3}, at: mmap_region+0x4dc/0x6db
      
      Invert those to the usual ordering.
      
      Fixes: 33313a74
      
       ("mm: lock newly mapped VMA which can be modified after it becomes visible")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Tested-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1c7873e3
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2023-07-08-10-43' of... · 946c6b59
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2023-07-08-10-43' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull hotfixes from Andrew Morton:
       "16 hotfixes. Six are cc:stable and the remainder address post-6.4
        issues"
      
      The merge undoes the disabling of the CONFIG_PER_VMA_LOCK feature, since
      it was all hopefully fixed in mainline.
      
      * tag 'mm-hotfixes-stable-2023-07-08-10-43' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        lib: dhry: fix sleeping allocations inside non-preemptable section
        kasan, slub: fix HW_TAGS zeroing with slub_debug
        kasan: fix type cast in memory_is_poisoned_n
        mailmap: add entries for Heiko Stuebner
        mailmap: update manpage link
        bootmem: remove the vmemmap pages from kmemleak in free_bootmem_page
        MAINTAINERS: add linux-next info
        mailmap: add Markus Schneider-Pargmann
        writeback: account the number of pages written back
        mm: call arch_swap_restore() from do_swap_page()
        squashfs: fix cache race with migration
        mm/hugetlb.c: fix a bug within a BUG(): inconsistent pte comparison
        docs: update ocfs2-devel mailing list address
        MAINTAINERS: update ocfs2-devel mailing list address
        mm: disable CONFIG_PER_VMA_LOCK until its fixed
        fork: lock VMAs of the parent process when forking
      946c6b59
    • Suren Baghdasaryan's avatar
      fork: lock VMAs of the parent process when forking · fb49c455
      Suren Baghdasaryan authored
      
      
      When forking a child process, the parent write-protects anonymous pages
      and COW-shares them with the child being forked using copy_present_pte().
      
      We must not take any concurrent page faults on the source vma's as they
      are being processed, as we expect both the vma and the pte's behind it
      to be stable.  For example, the anon_vma_fork() expects the parents
      vma->anon_vma to not change during the vma copy.
      
      A concurrent page fault on a page newly marked read-only by the page
      copy might trigger wp_page_copy() and a anon_vma_prepare(vma) on the
      source vma, defeating the anon_vma_clone() that wasn't done because the
      parent vma originally didn't have an anon_vma, but we now might end up
      copying a pte entry for a page that has one.
      
      Before the per-vma lock based changes, the mmap_lock guaranteed
      exclusion with concurrent page faults.  But now we need to do a
      vma_start_write() to make sure no concurrent faults happen on this vma
      while it is being processed.
      
      This fix can potentially regress some fork-heavy workloads.  Kernel
      build time did not show noticeable regression on a 56-core machine while
      a stress test mapping 10000 VMAs and forking 5000 times in a tight loop
      shows ~5% regression.  If such fork time regression is unacceptable,
      disabling CONFIG_PER_VMA_LOCK should restore its performance.  Further
      optimizations are possible if this regression proves to be problematic.
      
      Suggested-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reported-by: default avatarJiri Slaby <jirislaby@kernel.org>
      Closes: https://lore.kernel.org/all/dbdef34c-3a07-5951-e1ae-e9c6e3cdf51b@kernel.org/
      
      
      Reported-by: default avatarHolger Hoffstätte <holger@applied-asynchrony.com>
      Closes: https://lore.kernel.org/all/b198d649-f4bf-b971-31d0-e8433ec2a34c@applied-asynchrony.com/
      
      
      Reported-by: default avatarJacob Young <jacobly.alt@gmail.com>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217624
      Fixes: 0bff0aae
      
       ("x86/mm: try VMA lock-based page fault handling first")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fb49c455
    • Suren Baghdasaryan's avatar
      mm: lock newly mapped VMA which can be modified after it becomes visible · 33313a74
      Suren Baghdasaryan authored
      
      
      mmap_region adds a newly created VMA into VMA tree and might modify it
      afterwards before dropping the mmap_lock.  This poses a problem for page
      faults handled under per-VMA locks because they don't take the mmap_lock
      and can stumble on this VMA while it's still being modified.  Currently
      this does not pose a problem since post-addition modifications are done
      only for file-backed VMAs, which are not handled under per-VMA lock.
      However, once support for handling file-backed page faults with per-VMA
      locks is added, this will become a race.
      
      Fix this by write-locking the VMA before inserting it into the VMA tree.
      Other places where a new VMA is added into VMA tree do not modify it
      after the insertion, so do not need the same locking.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      33313a74
    • Suren Baghdasaryan's avatar
      mm: lock a vma before stack expansion · c137381f
      Suren Baghdasaryan authored
      
      
      With recent changes necessitating mmap_lock to be held for write while
      expanding a stack, per-VMA locks should follow the same rules and be
      write-locked to prevent page faults into the VMA being expanded. Add
      the necessary locking.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c137381f
    • Linus Torvalds's avatar
      Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 7fcd473a
      Linus Torvalds authored
      Pull more SCSI updates from James Bottomley:
       "A few late arriving patches that missed the initial pull request. It's
        mostly bug fixes (the dt-bindings is a fix for the initial pull)"
      
      * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: ufs: core: Remove unused function declaration
        scsi: target: docs: Remove tcm_mod_builder.py
        scsi: target: iblock: Quiet bool conversion warning with pr_preempt use
        scsi: dt-bindings: ufs: qcom: Fix ICE phandle
        scsi: core: Simplify scsi_cdl_check_cmd()
        scsi: isci: Fix comment typo
        scsi: smartpqi: Replace one-element arrays with flexible-array members
        scsi: target: tcmu: Replace strlcpy() with strscpy()
        scsi: ncr53c8xx: Replace strlcpy() with strscpy()
        scsi: lpfc: Fix lpfc_name struct packing
      7fcd473a
    • Linus Torvalds's avatar
      Merge tag 'i2c-for-6.5-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 84dc5aa3
      Linus Torvalds authored
      Pull more i2c updates from Wolfram Sang:
      
       - xiic patch should have been in the original pull but slipped through
      
       - mpc patch fixes a build regression
      
       - nomadik cleanup
      
      * tag 'i2c-for-6.5-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: mpc: Drop unused variable
        i2c: nomadik: Remove a useless call in the remove function
        i2c: xiic: Don't try to handle more interrupt events after error
      84dc5aa3
    • Linus Torvalds's avatar
      Merge tag 'hardening-v6.5-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 8fc3b8f0
      Linus Torvalds authored
      Pull hardening fixes from Kees Cook:
      
       - Check for NULL bdev in LoadPin (Matthias Kaehlcke)
      
       - Revert unwanted KUnit FORTIFY build default
      
       - Fix 1-element array causing boot warnings with xhci-hub
      
      * tag 'hardening-v6.5-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        usb: ch9: Replace bmSublinkSpeedAttr 1-element array with flexible array
        Revert "fortify: Allow KUnit test to build without FORTIFY"
        dm: verity-loadpin: Add NULL pointer check for 'bdev' parameter
      8fc3b8f0
    • Anup Sharma's avatar
      ntb: hw: amd: Fix debugfs_create_dir error checking · bff6efc5
      Anup Sharma authored
      
      
      The debugfs_create_dir function returns ERR_PTR in case of error, and the
      only correct way to check if an error occurred is 'IS_ERR' inline function.
      This patch will replace the null-comparison with IS_ERR.
      
      Signed-off-by: default avatarAnup Sharma <anupnewsmail@gmail.com>
      Suggested-by: default avatarIvan Orlov <ivan.orlov0322@gmail.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      bff6efc5
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-for-v6.5-2-2023-07-06' of... · c206353d
      Linus Torvalds authored
      Merge tag 'perf-tools-for-v6.5-2-2023-07-06' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next
      
      Pull more perf tools updates from Namhyung Kim:
       "These are remaining changes and fixes for this cycle.
      
        Build:
      
         - Allow generating vmlinux.h from BTF using `make GEN_VMLINUX_H=1`
           and skip if the vmlinux has no BTF.
      
         - Replace deprecated clang -target xxx option by --target=xxx.
      
        perf record:
      
         - Print event attributes with well known type and config symbols in
           the debug output like below:
      
             # perf record -e cycles,cpu-clock -C0 -vv true
             <SNIP>
             ------------------------------------------------------------
             perf_event_attr:
               type                             0 (PERF_TYPE_HARDWARE)
               size                             136
               config                           0 (PERF_COUNT_HW_CPU_CYCLES)
               { sample_period, sample_freq }   4000
               sample_type                      IP|TID|TIME|CPU|PERIOD|IDENTIFIER
               read_format                      ID
               disabled                         1
               inherit                          1
               freq                             1
               sample_id_all                    1
               exclude_guest                    1
             ------------------------------------------------------------
             sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8 = 5
             ------------------------------------------------------------
             perf_event_attr:
               type                             1 (PERF_TYPE_SOFTWARE)
               size                             136
               config                           0 (PERF_COUNT_SW_CPU_CLOCK)
               { sample_period, sample_freq }   4000
               sample_type                      IP|TID|TIME|CPU|PERIOD|IDENTIFIER
               read_format                      ID
               disabled                         1
               inherit                          1
               freq                             1
               sample_id_all                    1
               exclude_guest                    1
      
         - Update AMD IBS event error message since it now support per-process
           profiling but no priviledge filters.
      
             $ sudo perf record -e ibs_op//k -C 0
             Error:
             AMD IBS doesn't support privilege filtering. Try again without
             the privilege modifiers (like 'k') at the end.
      
        perf lock contention:
      
         - Support CSV style output using -x option
      
             $ sudo perf lock con -ab -x, sleep 1
             # output: contended, total wait, max wait, avg wait, type, caller
             19, 194232, 21415, 10222, spinlock, process_one_work+0x1f0
             15, 162748, 23843, 10849, rwsem:R, do_user_addr_fault+0x40e
             4, 86740, 23415, 21685, rwlock:R, ep_poll_callback+0x2d
             1, 84281, 84281, 84281, mutex, iwl_mvm_async_handlers_wk+0x135
             8, 67608, 27404, 8451, spinlock, __queue_work+0x174
             3, 58616, 31125, 19538, rwsem:W, do_mprotect_pkey+0xff
             3, 52953, 21172, 17651, rwlock:W, do_epoll_wait+0x248
             2, 30324, 19704, 15162, rwsem:R, do_madvise+0x3ad
             1, 24619, 24619, 24619, spinlock, rcu_core+0xd4
      
         - Add --output option to save the data to a file not to be interfered
           by other debug messages.
      
        Test:
      
         - Fix event parsing test on ARM where there's no raw PMU nor supports
           PERF_PMU_CAP_EXTENDED_HW_TYPE.
      
         - Update the lock contention test case for CSV output.
      
         - Fix a segfault in the daemon command test.
      
        Vendor events (JSON):
      
         - Add has_event() to check if the given event is available on system
           at runtime. On Intel machines, some transaction events may not be
           present when TSC extensions are disabled.
      
         - Update Intel event metrics.
      
        Misc:
      
         - Sort symbols by name using an external array of pointers instead of
           a rbtree node in the symbol. This will save 16-bytes or 24-bytes
           per symbol whether the sorting is actually requested or not.
      
         - Fix unwinding DWARF callstacks using libdw when --symfs option is
           used"
      
      * tag 'perf-tools-for-v6.5-2-2023-07-06' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next: (38 commits)
        perf test: Fix event parsing test when PERF_PMU_CAP_EXTENDED_HW_TYPE isn't supported.
        perf test: Fix event parsing test on Arm
        perf evsel amd: Fix IBS error message
        perf: unwind: Fix symfs with libdw
        perf symbol: Fix uninitialized return value in symbols__find_by_name()
        perf test: Test perf lock contention CSV output
        perf lock contention: Add --output option
        perf lock contention: Add -x option for CSV style output
        perf lock: Remove stale comments
        perf vendor events intel: Update tigerlake to 1.13
        perf vendor events intel: Update skylakex to 1.31
        perf vendor events intel: Update skylake to 57
        perf vendor events intel: Update sapphirerapids to 1.14
        perf vendor events intel: Update icelakex to 1.21
        perf vendor events intel: Update icelake to 1.19
        perf vendor events intel: Update cascadelakex to 1.19
        perf vendor events intel: Update meteorlake to 1.03
        perf vendor events intel: Add rocketlake events/metrics
        perf vendor metrics intel: Make transaction metrics conditional
        perf jevents: Support for has_event function
        ...
      c206353d
    • Linus Torvalds's avatar
      Merge tag 'bitmap-6.5-rc1' of https://github.com/norov/linux · ad8258e8
      Linus Torvalds authored
      Pull bitmap updates from Yury Norov:
       "Fixes for different bitmap pieces:
      
         - lib/test_bitmap: increment failure counter properly
      
           The tests that don't use expect_eq() macro to determine that a test
           is failured must increment failed_tests explicitly.
      
         - lib/bitmap: drop optimization of bitmap_{from,to}_arr64
      
           bitmap_{from,to}_arr64() optimization is overly optimistic
           on 32-bit LE architectures when it's wired to
           bitmap_copy_clear_tail().
      
         - nodemask: Drop duplicate check in for_each_node_mask()
      
           As the return value type of first_node() became unsigned, the node
           >= 0 became unnecessary.
      
         - cpumask: fix function description kernel-doc notation
      
         - MAINTAINERS: Add bits.h and bitfield.h to the BITMAP API record
      
           Add linux/bits.h and linux/bitfield.h for visibility"
      
      * tag 'bitmap-6.5-rc1' of https://github.com/norov/linux:
        MAINTAINERS: Add bitfield.h to the BITMAP API record
        MAINTAINERS: Add bits.h to the BITMAP API record
        cpumask: fix function description kernel-doc notation
        nodemask: Drop duplicate check in for_each_node_mask()
        lib/bitmap: drop optimization of bitmap_{from,to}_arr64
        lib/test_bitmap: increment failure counter properly
      ad8258e8
    • Geert Uytterhoeven's avatar
      lib: dhry: fix sleeping allocations inside non-preemptable section · 8ba388c0
      Geert Uytterhoeven authored
      The Smatch static checker reports the following warnings:
      
          lib/dhry_run.c:38 dhry_benchmark() warn: sleeping in atomic context
          lib/dhry_run.c:43 dhry_benchmark() warn: sleeping in atomic context
      
      Indeed, dhry() does sleeping allocations inside the non-preemptable
      section delimited by get_cpu()/put_cpu().
      
      Fix this by using atomic allocations instead.
      Add error handling, as atomic these allocations may fail.
      
      Link: https://lkml.kernel.org/r/bac6d517818a7cd8efe217c1ad649fffab9cc371.1688568764.git.geert+renesas@glider.be
      Fixes: 13684e96
      
       ("lib: dhry: fix unstable smp_processor_id(_) usage")
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Closes: https://lore.kernel.org/r/0469eb3a-02eb-4b41-b189-de20b931fa56@moroto.mountain
      
      
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      8ba388c0
    • Andrey Konovalov's avatar
      kasan, slub: fix HW_TAGS zeroing with slub_debug · fdb54d96
      Andrey Konovalov authored
      Commit 946fa0db ("mm/slub: extend redzone check to extra allocated
      kmalloc space than requested") added precise kmalloc redzone poisoning to
      the slub_debug functionality.
      
      However, this commit didn't account for HW_TAGS KASAN fully initializing
      the object via its built-in memory initialization feature.  Even though
      HW_TAGS KASAN memory initialization contains special memory initialization
      handling for when slub_debug is enabled, it does not account for in-object
      slub_debug redzones.  As a result, HW_TAGS KASAN can overwrite these
      redzones and cause false-positive slub_debug reports.
      
      To fix the issue, avoid HW_TAGS KASAN memory initialization when
      slub_debug is enabled altogether.  Implement this by moving the
      __slub_debug_enabled check to slab_post_alloc_hook.  Common slab code
      seems like a more appropriate place for a slub_debug check anyway.
      
      Link: https://lkml.kernel.org/r/678ac92ab790dba9198f9ca14f405651b97c8502.1688561016.git.andreyknvl@google.com
      Fixes: 946fa0db
      
       ("mm/slub: extend redzone check to extra allocated kmalloc space than requested")
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reported-by: default avatarWill Deacon <will@kernel.org>
      Acked-by: default avatarMarco Elver <elver@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: kasan-dev@googlegroups.com
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Peter Collingbourne <pcc@google.com>
      Cc: Roman Gushchin <roman.gushchin@linux.dev>
      Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      fdb54d96
    • Andrey Konovalov's avatar
      kasan: fix type cast in memory_is_poisoned_n · 05c56e7b
      Andrey Konovalov authored
      Commit bb6e04a1 ("kasan: use internal prototypes matching gcc-13
      builtins") introduced a bug into the memory_is_poisoned_n implementation:
      it effectively removed the cast to a signed integer type after applying
      KASAN_GRANULE_MASK.
      
      As a result, KASAN started failing to properly check memset, memcpy, and
      other similar functions.
      
      Fix the bug by adding the cast back (through an additional signed integer
      variable to make the code more readable).
      
      Link: https://lkml.kernel.org/r/8c9e0251c2b8b81016255709d4ec42942dcaf018.1688431866.git.andreyknvl@google.com
      Fixes: bb6e04a1
      
       ("kasan: use internal prototypes matching gcc-13 builtins")
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Marco Elver <elver@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      05c56e7b
    • Heiko Stuebner's avatar
      mailmap: add entries for Heiko Stuebner · d3a808ec
      Heiko Stuebner authored
      I am going to lose my vrull.eu address at the end of july, and while
      adding it to mailmap I also realised that there are more old addresses
      from me dangling, so update .mailmap for all of them.
      
      Link: https://lkml.kernel.org/r/20230704163919.1136784-3-heiko@sntech.de
      
      
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarHeiko Stuebner <heiko.stuebner@vrull.eu>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      d3a808ec
    • Heiko Stuebner's avatar
      mailmap: update manpage link · ddcd91f4
      Heiko Stuebner authored
      Patch series "Update .mailmap for my work address and fix manpage".
      
      While updating mailmap for the going-away address, I also found that on
      current systems the manpage linked from the header comment changed.
      
      And in fact it looks like the git mailmap feature got its own manpage.
      
      
      This patch (of 2):
      
      On recent systems the git-shortlog manpage only tells people to
          See gitmailmap(5)
      
      So instead of sending people on a scavenger hunt, put that info into the
      header directly.  Though keep the old reference around for older systems.
      
      Link: https://lkml.kernel.org/r/20230704163919.1136784-1-heiko@sntech.de
      Link: https://lkml.kernel.org/r/20230704163919.1136784-2-heiko@sntech.de
      
      
      Signed-off-by: default avatarHeiko Stuebner <heiko.stuebner@vrull.eu>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      ddcd91f4
    • Liu Shixin's avatar
      bootmem: remove the vmemmap pages from kmemleak in free_bootmem_page · 028725e7
      Liu Shixin authored
      commit dd0ff4d1 ("bootmem: remove the vmemmap pages from kmemleak in
      put_page_bootmem") fix an overlaps existing problem of kmemleak.  But the
      problem still existed when HAVE_BOOTMEM_INFO_NODE is disabled, because in
      this case, free_bootmem_page() will call free_reserved_page() directly.
      
      Fix the problem by adding kmemleak_free_part() in free_bootmem_page() when
      HAVE_BOOTMEM_INFO_NODE is disabled.
      
      Link: https://lkml.kernel.org/r/20230704101942.2819426-1-liushixin2@huawei.com
      Fixes: f41f2ed4
      
       ("mm: hugetlb: free the vmemmap pages associated with each HugeTLB page")
      Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
      Acked-by: default avatarMuchun Song <songmuchun@bytedance.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      028725e7
    • Randy Dunlap's avatar
      MAINTAINERS: add linux-next info · 0d707cde
      Randy Dunlap authored
      Add linux-next info to MAINTAINERS for ease of finding this data.
      
      Link: https://lkml.kernel.org/r/20230704054410.12527-1-rdunlap@infradead.org
      
      
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Acked-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      0d707cde