CVE-2022-48892: sched/core: Fix use-after-free bug in dup_user_cpus_ptr()
In the Linux kernel, the following vulnerability has been resolved:
sched/core: Fix use-after-free bug in dupusercpusptr()
Since commit 07ec77a1d4e8 ("sched: Allow task CPU affinity to be restricted on asymmetric systems"), the setting and clearing of usercpusptr are done under pilock for arm64 architecture. However, dupusercpusptr() accesses usercpusptr without any lock protection. Since schedsetaffinity() can be invoked from another process, the process being modified may be undergoing fork() at the same time. When racing with the clearing of usercpusptr in setcpusallowedptrlocked(), it can lead to user-after-free and possibly double-free in arm64 kernel.
Commit 8f9ea86fdf99 ("sched: Always preserve the user requested cpumask") fixes this problem as usercpusptr, once set, will never be cleared in a task's lifetime. However, this bug was re-introduced in commit 851a723e45d1 ("sched: Always clear usercpusptr in dosetcpusallowed()") which allows the clearing of usercpusptr in dosetcpusallowed(). This time, it will affect all arches.
Fix this bug by always clearing the usercpusptr of the newly cloned/forked task before the copying process starts and check the usercpusptr state of the source task under pilock.
Note to stable, this patch won't be applicable to stable releases. Just copy the new dupusercpusptr() function over.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.7-1 - Compensating control
Fix dup_user_cpus_ptr() by always clearing user_cpus_ptr of the newly cloned/forked task before copying, checking the source task's user_cpus_ptr under pi_lock, and ensuring accesses are lock-protected.
Event History
Frequently Asked Questions
What is the severity of CVE-2022-48892?
CVE-2022-48892 has a moderate severity rating due to the potential for a use-after-free vulnerability in the Linux kernel.
How do I fix CVE-2022-48892?
To fix CVE-2022-48892, users should upgrade their Linux kernel to a version beyond 5.15.89 or between 5.16 and 6.1.7.
Which versions of Linux are affected by CVE-2022-48892?
CVE-2022-48892 affects Linux kernel versions from 5.15 to 5.15.89 and from 5.16 to 6.1.7.
What type of vulnerability is CVE-2022-48892?
CVE-2022-48892 is a use-after-free vulnerability related to task CPU affinity handling in the Linux kernel.
What impact could CVE-2022-48892 have on systems?
CVE-2022-48892 could potentially lead to system instability or exploitation if an attacker takes advantage of the vulnerability.