Bug 1220431 (CVE-2023-52468) - VUL-0: CVE-2023-52468: kernel-source,kernel-source-azure,kernel-source-rt: class: use-after-free in class_register() when lockdep is enabled
Summary: VUL-0: CVE-2023-52468: kernel-source,kernel-source-azure,kernel-source-rt: cl...
Status: RESOLVED FIXED
Alias: CVE-2023-52468
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P5 - None : Normal
Target Milestone: ---
Assignee: Kernel Bugs
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/395132/
Whiteboard: CVSSv3.1:SUSE:CVE-2023-52468:7.0:(AV:...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-27 11:25 UTC by SMASH SMASH
Modified: 2024-06-25 18:13 UTC (History)
1 user (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SMASH SMASH 2024-02-27 11:25:29 UTC
In the Linux kernel, the following vulnerability has been resolved:

class: fix use-after-free in class_register()

The lock_class_key is still registered and can be found in
lock_keys_hash hlist after subsys_private is freed in error
handler path.A task who iterate over the lock_keys_hash
later may cause use-after-free.So fix that up and unregister
the lock_class_key before kfree(cp).

On our platform, a driver fails to kset_register because of
creating duplicate filename '/class/xxx'.With Kasan enabled,
it prints a invalid-access bug report.

KASAN bug report:

BUG: KASAN: invalid-access in lockdep_register_key+0x19c/0x1bc
Write of size 8 at addr 15ffff808b8c0368 by task modprobe/252
Pointer tag: [15], memory tag: [fe]

CPU: 7 PID: 252 Comm: modprobe Tainted: G        W
 6.6.0-mainline-maybe-dirty #1

Call trace:
dump_backtrace+0x1b0/0x1e4
show_stack+0x2c/0x40
dump_stack_lvl+0xac/0xe0
print_report+0x18c/0x4d8
kasan_report+0xe8/0x148
__hwasan_store8_noabort+0x88/0x98
lockdep_register_key+0x19c/0x1bc
class_register+0x94/0x1ec
init_module+0xbc/0xf48 [rfkill]
do_one_initcall+0x17c/0x72c
do_init_module+0x19c/0x3f8
...
Memory state around the buggy address:
ffffff808b8c0100: 8a 8a 8a 8a 8a 8a 8a 8a 8a 8a 8a 8a 8a 8a 8a 8a
ffffff808b8c0200: 8a 8a 8a 8a 8a 8a 8a 8a fe fe fe fe fe fe fe fe
>ffffff808b8c0300: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
                                     ^
ffffff808b8c0400: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03

As CONFIG_KASAN_GENERIC is not set, Kasan reports invalid-access
not use-after-free here.In this case, modprobe is manipulating
the corrupted lock_keys_hash hlish where lock_class_key is already
freed before.

It's worth noting that this only can happen if lockdep is enabled,
which is not true for normal system.

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2023-52468
https://www.cve.org/CVERecord?id=CVE-2023-52468
https://git.kernel.org/stable/c/0f1486dafca3398c4c46b9f6e6452fa27e73b559
https://git.kernel.org/stable/c/93ec4a3b76404bce01bd5c9032bef5df6feb1d62
https://git.kernel.org/stable/c/b57196a5ec5e4c0ffecde8348b085b778c7dce04
Comment 1 Carlos López 2024-02-27 11:27:29 UTC
We don't enable lockdep by default in our kernels, so this does not really affect us. Anyhow, the fix is already present everywhere that could have the bug with the appropriate build configuration (SLE15-SP6, stable and master). Closing.