In the Linux kernel, the following vulnerability has been resolved:
list: fix a data-race around ep->rdllist
eppoll() first calls epeventsavailable() with no lock held and checks if ep->rdllist is empty by listempty_careful(), which reads rdllist->prev. Thus all accesses to it need some protection to avoid store/load-tearing.
Note INITLISTHEAD_RCU() already has the annotation for both prev and next.
Commit bf3b9f6372c4 ("epoll: Add busy poll support to epoll with socket fds.") added the first lockless epeventsavailable(), and commit c5a282e9635e ("fs/epoll: reduce the scope of wq lock in epollwait()") made some epeventsavailable() calls lockless and added single call under a lock, finally commit e59d3c64cba6 ("epoll: eliminate unnecessary lock for zero timeout") made the last epevents_available() lockless.
BUG: KCSAN: data-race in doepollwait / doepollwait
write to 0xffff88810480c7d8 of 8 bytes by task 1802 on cpu 0: INITLISTHEAD include/linux/list.h:38 [inline] listspliceinit include/linux/list.h:492 [inline] epstartscan fs/eventpoll.c:622 [inline] epsendevents fs/eventpoll.c:1656 [inline] eppoll fs/eventpoll.c:1806 [inline] doepollwait+0x4eb/0xf40 fs/eventpoll.c:2234 doepollpwait fs/eventpoll.c:2268 [inline] _dosysepollpwait fs/eventpoll.c:2281 [inline] _sesysepollpwait+0x12b/0x240 fs/eventpoll.c:2275 _x64sysepollpwait+0x74/0x80 fs/eventpoll.c:2275 dosyscallx64 arch/x86/entry/common.c:50 [inline] dosyscall64+0x44/0xd0 arch/x86/entry/common.c:80 entrySYSCALL64after_hwframe+0x44/0xae
read to 0xffff88810480c7d8 of 8 bytes by task 1799 on cpu 1: listemptycareful include/linux/list.h:329 [inline] epeventsavailable fs/eventpoll.c:381 [inline] eppoll fs/eventpoll.c:1797 [inline] doepollwait+0x279/0xf40 fs/eventpoll.c:2234 doepollpwait fs/eventpoll.c:2268 [inline] _dosysepollpwait fs/eventpoll.c:2281 [inline] _sesysepollpwait+0x12b/0x240 fs/eventpoll.c:2275 _x64sysepollpwait+0x74/0x80 fs/eventpoll.c:2275 dosyscallx64 arch/x86/entry/common.c:50 [inline] dosyscall64+0x44/0xd0 arch/x86/entry/common.c:80 entrySYSCALL64after_hwframe+0x44/0xae
value changed: 0xffff88810480c7d0 -> 0xffff888103c15098
Reported by Kernel Concurrency Sanitizer on: CPU: 1 PID: 1799 Comm: syz-fuzzer Tainted: G W 5.17.0-rc7-syzkaller-dirty #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
[
{
"id": "CVE-2022-49443-1b26fb61",
"target": {
"function": "list_empty_careful",
"file": "include/linux/list.h"
},
"digest": {
"length": 162.0,
"function_hash": "152860699403428949403386120242651819017"
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5d5d993f16be15d124be7b8ec71b28ef7b7dc3af"
},
{
"id": "CVE-2022-49443-3d06c1b7",
"target": {
"file": "include/linux/list.h"
},
"digest": {
"line_hashes": [
"285301667123253482815107094900067298954",
"304198888918349581137534831089931129589",
"105184339883396649180809366020490080637",
"235233568318878774450355331048407094196",
"93011027666388756805119376497584812597",
"209734376473135665878044984539904734177",
"154572271384158592778798180663376145631",
"87966637453555184629760135993640003231",
"117158207064014378342880418254362250918",
"87004208210816761005227126626703318127",
"100687842352233457404485521777622616899",
"93888019351054795736417620173980640828"
],
"threshold": 0.9
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cb3e48f7a35033deb9455abe3932e63cb500b9eb"
},
{
"id": "CVE-2022-49443-5a5930e4",
"target": {
"function": "list_empty_careful",
"file": "include/linux/list.h"
},
"digest": {
"length": 162.0,
"function_hash": "152860699403428949403386120242651819017"
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d679ae94fdd5d3ab00c35078f5af5f37e068b03d"
},
{
"id": "CVE-2022-49443-b09d60f0",
"target": {
"function": "list_del_init_careful",
"file": "include/linux/list.h"
},
"digest": {
"length": 134.0,
"function_hash": "140704830252444946137652906567989860521"
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cb3e48f7a35033deb9455abe3932e63cb500b9eb"
},
{
"id": "CVE-2022-49443-b86eaeb7",
"target": {
"file": "include/linux/list.h"
},
"digest": {
"line_hashes": [
"285301667123253482815107094900067298954",
"304198888918349581137534831089931129589",
"105184339883396649180809366020490080637",
"235233568318878774450355331048407094196",
"93011027666388756805119376497584812597",
"209734376473135665878044984539904734177",
"154572271384158592778798180663376145631",
"87966637453555184629760135993640003231",
"117158207064014378342880418254362250918",
"87004208210816761005227126626703318127",
"100687842352233457404485521777622616899",
"93888019351054795736417620173980640828"
],
"threshold": 0.9
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5d5d993f16be15d124be7b8ec71b28ef7b7dc3af"
},
{
"id": "CVE-2022-49443-c486a845",
"target": {
"function": "list_del_init_careful",
"file": "include/linux/list.h"
},
"digest": {
"length": 134.0,
"function_hash": "140704830252444946137652906567989860521"
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5d5d993f16be15d124be7b8ec71b28ef7b7dc3af"
},
{
"id": "CVE-2022-49443-cf2239a0",
"target": {
"function": "list_del_init_careful",
"file": "include/linux/list.h"
},
"digest": {
"length": 134.0,
"function_hash": "140704830252444946137652906567989860521"
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d679ae94fdd5d3ab00c35078f5af5f37e068b03d"
},
{
"id": "CVE-2022-49443-da22d9a7",
"target": {
"function": "list_empty_careful",
"file": "include/linux/list.h"
},
"digest": {
"length": 162.0,
"function_hash": "152860699403428949403386120242651819017"
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e039c0b5985999b150594126225e1ee51df7b4c9"
},
{
"id": "CVE-2022-49443-dbcd2719",
"target": {
"file": "include/linux/list.h"
},
"digest": {
"line_hashes": [
"285301667123253482815107094900067298954",
"304198888918349581137534831089931129589",
"105184339883396649180809366020490080637",
"235233568318878774450355331048407094196",
"93011027666388756805119376497584812597",
"209734376473135665878044984539904734177",
"154572271384158592778798180663376145631",
"87966637453555184629760135993640003231",
"117158207064014378342880418254362250918",
"87004208210816761005227126626703318127",
"100687842352233457404485521777622616899",
"93888019351054795736417620173980640828"
],
"threshold": 0.9
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d679ae94fdd5d3ab00c35078f5af5f37e068b03d"
},
{
"id": "CVE-2022-49443-e9caaf60",
"target": {
"function": "list_empty_careful",
"file": "include/linux/list.h"
},
"digest": {
"length": 162.0,
"function_hash": "152860699403428949403386120242651819017"
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cb3e48f7a35033deb9455abe3932e63cb500b9eb"
},
{
"id": "CVE-2022-49443-fc6260b2",
"target": {
"file": "include/linux/list.h"
},
"digest": {
"line_hashes": [
"285301667123253482815107094900067298954",
"304198888918349581137534831089931129589",
"105184339883396649180809366020490080637",
"235233568318878774450355331048407094196",
"93011027666388756805119376497584812597",
"209734376473135665878044984539904734177",
"154572271384158592778798180663376145631",
"87966637453555184629760135993640003231",
"117158207064014378342880418254362250918",
"87004208210816761005227126626703318127",
"100687842352233457404485521777622616899",
"93888019351054795736417620173980640828"
],
"threshold": 0.9
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e039c0b5985999b150594126225e1ee51df7b4c9"
},
{
"id": "CVE-2022-49443-fef725ad",
"target": {
"function": "list_del_init_careful",
"file": "include/linux/list.h"
},
"digest": {
"length": 134.0,
"function_hash": "140704830252444946137652906567989860521"
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e039c0b5985999b150594126225e1ee51df7b4c9"
}
]