In the Linux kernel, the following vulnerability has been resolved:
rcu: Fix buffer overflow in printcpustall_info()
The rcuc-starvation output from printcpustall_info() might overflow the buffer if there is a huge difference in jiffies difference. The situation might seem improbable, but computers sometimes get very confused about time, which can result in full-sized integers, and, in this case, buffer overflow.
Also, the unsigned jiffies difference is printed using %ld, which is normally for signed integers. This is intentional for debugging purposes, but it is not obvious from the code.
This commit therefore changes sprintf() to snprintf() and adds a clarifying comment about intention of %ld format.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
[
{
"id": "CVE-2024-38576-017f0b7b",
"target": {
"file": "kernel/rcu/tree_stall.h",
"function": "print_cpu_stall_info"
},
"digest": {
"length": 1274.0,
"function_hash": "119821266695481345082631164336231796645"
},
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@afb39909bfb5c08111f99e21bf5be7505f59ff1c",
"signature_version": "v1"
},
{
"id": "CVE-2024-38576-5c8a18a3",
"target": {
"file": "kernel/rcu/tree_stall.h"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"289249538689078478749354187795664293538",
"60555036253696276911116079937550659046",
"241791305694372706640840807971502196139",
"328703334787751180961120273306966121524"
]
},
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@afb39909bfb5c08111f99e21bf5be7505f59ff1c",
"signature_version": "v1"
}
]