In the Linux kernel, the following vulnerability has been resolved:
bpf: Use rawspinlockt in ringbuf
The function _bpfringbufreserve is invoked from a tracepoint, which disables preemption. Using spinlockt in this context can lead to a "sleep in atomic" warning in the RT variant. This issue is illustrated in the example below:
BUG: sleeping function called from invalid context at kernel/locking/spinlockrt.c:48 inatomic(): 1, irqsdisabled(): 0, nonblock: 0, pid: 556208, name: testprogs preemptcount: 1, expected: 0 RCU nest depth: 1, expected: 1 INFO: lockdep is turned off. Preemption disabled at: [<ffffd33a5c88ea44>] migrateenable+0xc0/0x39c CPU: 7 PID: 556208 Comm: testprogs Tainted: G Hardware name: Qualcomm SA8775P Ride (DT) Call trace: dumpbacktrace+0xac/0x130 showstack+0x1c/0x30 dumpstacklvl+0xac/0xe8 dump_stack+0x18/0x30 __mightresched+0x3bc/0x4fc rtspin_lock+0x8c/0x1a4 _bpfringbufreserve+0xc4/0x254 bpfringbufreservedynptr+0x5c/0xdc bpfprogac3d15160d62622atestreadwrite+0x104/0x238 tracecallbpf+0x238/0x774 perfcallbpfenter.isra.0+0x104/0x194 perfsyscallenter+0x2f8/0x510 tracesysenter+0x39c/0x564 syscalltraceenter+0x220/0x3c0 doel0svc+0x138/0x1dc el0svc+0x54/0x130 el0t64synchandler+0x134/0x150 el0t64sync+0x17c/0x180
Switch the spinlock to rawspinlockt to avoid this error.
{
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/50xxx/CVE-2024-50138.json"
}[
{
"signature_type": "Line",
"deprecated": false,
"id": "CVE-2024-50138-b0748a1a",
"target": {
"file": "kernel/bpf/ringbuf.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"110971926769710618607206207480141607243",
"81742014481775971058750344589842730899",
"180893998676737854177769405182933446275",
"76861468353564851881343629766064594467",
"240543974487711540159081598995185657239",
"184592243018158739095830805092730928111",
"333845301393801503020325161415524197999",
"210522059909751175783240285667728803912",
"18351029423768788552085190087383196721",
"246228400615336630259703246306235974536",
"189976016867545394465556365610142114772",
"210720111592500354031966608087255000563",
"330351171613665790807901061747120089012",
"125270849315828524952068838190892972970",
"135026850737313277922610970621617844545",
"1163024717632734138553137360322805786",
"44964058686114299824178531865135002816",
"74683805406728249738314959907106097167",
"85627574014173316667409690913993557466",
"215161937844188811038362268532038488172",
"196738212189344798000516959418614913863",
"171510206926904955006450167421180576246",
"300875598934032006761658886767878627283"
]
},
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@8b62645b09f870d70c7910e7550289d444239a46"
}
]
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-50138.json"