CVE-2024-57885 Information
Description
In the Linux kernel the following vulnerability has been resolved:
mm/kmemleak: fix sleeping function called from invalid context at print message
Address a bug in the kernel that triggers a \sleeping function called from invalid context\ warning when /sys/kernel/debug/kmemleak is printed under specific conditions:
- CONFIG_PREEMPT_RT=y
- Set SELinux as the LSM for the system
- Set kptr_restrict to 1
- kmemleak buffer contains at least one item
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
in_atomic(): 1 irqs_disabled(): 1 non_block: 0 pid: 136 name: cat
preempt_count: 1 expected: 0
RCU nest depth: 2 expected: 2
6 locks held by cat/136:
0: ffff32e64bcbf950 (&p->lock)+.+.-3:3 at: seq_read_iter+0xb8/0xe30
1: ffffafe6aaa9dea0 (scan_mutex)+.+.-3:3 at: kmemleak_seq_start+0x34/0x128
3: ffff32e6546b1cd0 (&object->lock)….-2:2 at: kmemleak_seq_show+0x3c/0x1e0
4: ffffafe6aa8d8560 (rcu_read_lock)….-1:2 at: has_ns_capability_noaudit+0x8/0x1b0
5: ffffafe6aabbc0f8 (notif_lock)+.+.-2:2 at: avc_compute_av+0xc4/0x3d0
irq event stamp: 136660
hardirqs last enabled at (136659): [
%pS and %pK in the same back trace line are redundant and %pS can void %pK service in certain contexts.
%pS alone already provides the necessary information and if it cannot resolve the symbol it falls back to printing the raw address voiding the original intent behind the %pK.
Additionally %pK requires a privilege check CAP_SYSLOG enforced through the LSM which can trigger a \sleeping function called from invalid context\ warning under RT_PREEMPT kernels when the check occurs in an atomic context. This issue may also affect other LSMs.
This change avoids the unnecessary privilege check and resolves the sleeping function warning without any loss of information.
Reference
https://git.kernel.org/stable/c/64b2d32f22597b2a1dc83ac600b2426588851a97 https://git.kernel.org/stable/c/86d946f3f9992aaa12abcfd09f925446c2cd42a2 https://git.kernel.org/stable/c/cddc76b165161a02ff14c4d84d0f5266d9d32b9e
Share on: