We find the root cause of this OOB is that arm does not clear stale stack
poison in the case of cpuidle.
This patch refer to arch/arm64/kernel/sleep.S to resolve this issue.
From cited commit [1] that explain the problem
Functions which the compiler has instrumented for KASAN place poison on
the stack shadow upon entry and remove this poison prior to returning.
In the case of cpuidle, CPUs exit the kernel a number of levels deep in
C code. Any instrumented functions on this critical path will leave
portions of the stack shadow poisoned.
If CPUs lose context and return to the kernel via a cold path, we
restore a prior context saved in __cpu_suspend_enter are forgotten, and
we never remove the poison they placed in the stack shadow area by
functions calls between this and the actual exit of the kernel.
Thus, (depending on stackframe layout) subsequent calls to instrumented
functions may hit this stale poison, resulting in (spurious) KASAN
splats to the console.
To avoid this, clear any stale poison from the idle thread for a CPU
prior to bringing a CPU online.
From cited commit [2]
Extend to check for CONFIG_KASAN_STACK
[1] commit 0d97e6d8024c (“arm64: kasan: clear stale stack poison”)
[2] commit d56a9ef84bd0 (“kasan, arm64: unpoison stack only with
CONFIG_KASAN_STACK”)
OS | Version | Architecture | Package | Version | Filename |
---|---|---|---|---|---|
ubuntu | 18.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 20.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 22.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 23.10 | noarch | linux | < any | UNKNOWN |
ubuntu | 24.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 14.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 16.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 18.04 | noarch | linux-aws | < any | UNKNOWN |
ubuntu | 20.04 | noarch | linux-aws | < any | UNKNOWN |
ubuntu | 22.04 | noarch | linux-aws | < any | UNKNOWN |
git.kernel.org/linus/c4238686f9093b98bd6245a348bcf059cdce23af (6.9)
git.kernel.org/stable/c/20ac71bee028ffbae4fc14ed679b23b4d3e95726
git.kernel.org/stable/c/ad702338fe423cb1e79745787090317256a98dab
git.kernel.org/stable/c/b26f353786d365e658cebc9a9ace88e04fc2325e
git.kernel.org/stable/c/c4238686f9093b98bd6245a348bcf059cdce23af
git.kernel.org/stable/c/ee0ce7573e5083031960faf602c9db693ab5b477
launchpad.net/bugs/cve/CVE-2024-36906
nvd.nist.gov/vuln/detail/CVE-2024-36906
security-tracker.debian.org/tracker/CVE-2024-36906
www.cve.org/CVERecord?id=CVE-2024-36906