Go to file
Tetsuo Handa e8da19a3a9 mm: mmap_lock: replace get_memcg_path_buf() with on-stack buffer
commit 7d6be67cfd upstream.

Commit 2b5067a814 ("mm: mmap_lock: add tracepoints around lock
acquisition") introduced TRACE_MMAP_LOCK_EVENT() macro using
preempt_disable() in order to let get_mm_memcg_path() return a percpu
buffer exclusively used by normal, softirq, irq and NMI contexts
respectively.

Commit 832b507253 ("mm: mmap_lock: use local locks instead of disabling
preemption") replaced preempt_disable() with local_lock(&memcg_paths.lock)
based on an argument that preempt_disable() has to be avoided because
get_mm_memcg_path() might sleep if PREEMPT_RT=y.

But syzbot started reporting

  inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.

and

  inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.

messages, for local_lock() does not disable IRQ.

We could replace local_lock() with local_lock_irqsave() in order to
suppress these messages.  But this patch instead replaces percpu buffers
with on-stack buffer, for the size of each buffer returned by
get_memcg_path_buf() is only 256 bytes which is tolerable for allocating
from current thread's kernel stack memory.

Link: https://lkml.kernel.org/r/ef22d289-eadb-4ed9-863b-fbc922b33d8d@I-love.SAKURA.ne.jp
Reported-by: syzbot <syzbot+40905bca570ae6784745@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=40905bca570ae6784745
Fixes: 832b507253 ("mm: mmap_lock: use local locks instead of disabling preemption")
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: Axel Rasmussen <axelrasmussen@google.com>
Cc: Nicolas Saenz Julienne <nsaenzju@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 0038abf9ddec90c0fe23d753650b4585ba2fd882)
2024-12-10 20:39:57 +08:00
.github/workflows CI: Add patch check by using build kernel loong64 2024-12-10 20:39:14 +08:00
Documentation scsi: sr: Fix unintentional arithmetic wraparound 2024-12-10 20:39:26 +08:00
LICENSES LICENSES: Add the copyleft-next-0.3.1 license 2022-11-08 15:44:01 +01:00
arch LoongArch: Check TIF_LOAD_WATCH to enable user space watchpoint 2024-12-10 20:39:56 +08:00
block block/mq-deadline: Fix the tag reservation code 2024-12-10 20:39:36 +08:00
certs certs: Reference revocation list for all keyrings 2023-08-17 20:12:41 +00:00
crypto crypto: aead,cipher - zeroize key buffer after use 2024-12-10 20:38:59 +08:00
drivers s390/dasd: fix error checks in dasd_copy_pair_store() 2024-12-10 20:39:56 +08:00
fs fs/ntfs3: Keep runs for $MFT::$ATTR_DATA and $MFT::$ATTR_BITMAP 2024-12-10 20:39:56 +08:00
include mm/hugetlb: fix possible recursive locking detected warning 2024-12-10 20:39:57 +08:00
init smp: Provide 'setup_max_cpus' definition on UP too 2024-12-10 20:26:32 +08:00
io_uring io_uring/rsrc: fix incorrect assignment of iter->nr_segs in io_import_fixed 2024-12-10 20:29:01 +08:00
ipc Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
kernel bpf: Eliminate remaining "make W=1" warnings in kernel/bpf/btf.o 2024-12-10 20:39:45 +08:00
lib sbitmap: fix io hung due to race on sbitmap_word::cleared 2024-12-10 20:39:56 +08:00
mm mm: mmap_lock: replace get_memcg_path_buf() with on-stack buffer 2024-12-10 20:39:57 +08:00
net ipv4: Fix incorrect TOS in fibmatch route get reply 2024-12-10 20:39:54 +08:00
rust rust: kernel: require `Send` for `Module` implementations 2024-12-10 20:19:38 +08:00
samples work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
scripts x86/kconfig: Add as-instr64 macro to properly evaluate AS_WRUSS 2024-12-10 20:39:35 +08:00
security landlock: Don't lose track of restrictions on cred_transfer 2024-12-10 20:39:57 +08:00
sound ASoC: amd: Adjust error handling in case of absent codec device 2024-12-10 20:39:52 +08:00
tools ipv4: Fix incorrect TOS in fibmatch route get reply 2024-12-10 20:39:54 +08:00
usr initramfs: Encode dependency on KBUILD_BUILD_TIMESTAMP 2023-06-06 17:54:49 +09:00
virt KVM: Fix a data race on last_boosted_vcpu in kvm_vcpu_on_spin() 2024-12-10 20:29:02 +08:00
.clang-format iommu: Add for_each_group_device() 2023-05-23 08:15:51 +02:00
.cocciconfig
.get_maintainer.ignore get_maintainer: add Alan to .get_maintainer.ignore 2022-08-20 15:17:44 -07:00
.gitattributes .gitattributes: set diff driver for Rust source code files 2023-05-31 17:48:25 +02:00
.gitignore kbuild: rpm-pkg: rename binkernel.spec to kernel.spec 2023-07-25 00:59:33 +09:00
.mailmap 20 hotfixes. 12 are cc:stable and the remainder address post-6.5 issues 2023-10-24 09:52:16 -10:00
.rustfmt.toml rust: add `.rustfmt.toml` 2022-09-28 09:02:20 +02:00
COPYING COPYING: state that all contributions really are covered by this file 2020-02-10 13:32:20 -08:00
CREDITS fs: Remove NTFS classic 2024-12-10 20:39:15 +08:00
Kbuild Kbuild updates for v6.1 2022-10-10 12:00:45 -07:00
Kconfig kbuild: ensure full rebuild when the compiler is updated 2020-05-12 13:28:33 +09:00
MAINTAINERS fs: Remove NTFS classic 2024-12-10 20:39:15 +08:00
Makefile Linux 6.6.43 2024-12-10 20:39:35 +08:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.