In the Linux kernel, the following vulnerability has been resolved:
bpf: Disable preemption in bpfperfevent_output
The nesting protection in bpfperfevent_output relies on disabled preemption, which is guaranteed for kprobes and tracepoints.
However bpfperfeventoutput can be also called from uprobes context through bpfprogrunarray_sleepable function which disables migration, but keeps preemption enabled.
This can cause task to be preempted by another one inside the nesting protection and lead eventually to two tasks using same perfsampledata buffer and cause crashes like:
kernel tried to execute NX-protected page - exploit attempt? (uid: 0) BUG: unable to handle page fault for address: ffffffff82be3eea ... Call Trace: ? _die+0x1f/0x70 ? pagefaultoops+0x176/0x4d0 ? excpagefault+0x132/0x230 ? asmexcpagefault+0x22/0x30 ? perfoutputsample+0x12b/0x910 ? perfeventoutput+0xd0/0x1d0 ? bpfperfeventoutput+0x162/0x1d0 ? bpfprogc6271286d9a4c938krava1+0x76/0x87 ? _uprobeperffunc+0x12b/0x540 ? uprobedispatcher+0x2c4/0x430 ? uprobenotifyresume+0x2da/0xce0 ? atomicnotifiercallchain+0x7b/0x110 ? exittousermodeprepare+0x13e/0x290 ? irqentryexittousermode+0x5/0x30 ? asmexc_int3+0x35/0x40
Fixing this by disabling preemption in bpfperfevent_output.
{
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/54xxx/CVE-2023-54303.json"
}