In the Linux kernel, the following vulnerability has been resolved:
xsk: check IFF_UP earlier in Tx path
Xsk Tx can be triggered via either sendmsg() or poll() syscalls. These two paths share a call to common function xsk_xmit() which has two sanity checks within. A pseudo code example to show the two paths:
_xsksendmsg() : xskpoll(): if (unlikely(!xskisbound(xs))) if (unlikely(!xskisbound(xs))) return -ENXIO; return mask; if (unlikely(needwait)) (...) return -EOPNOTSUPP; xskxmit() mark napi id (...) xskxmit()
xskxmit(): if (unlikely(!(xs->dev->flags & IFFUP))) return -ENETDOWN; if (unlikely(!xs->tx)) return -ENOBUFS;
As it can be observed above, in sendmsg() napi id can be marked on interface that was not brought up and this causes a NULL ptr dereference:
[31757.505631] BUG: kernel NULL pointer dereference, address: 0000000000000018 [31757.512710] #PF: supervisor read access in kernel mode [31757.517936] #PF: errorcode(0x0000) - not-present page [31757.523149] PGD 0 P4D 0 [31757.525726] Oops: 0000 [#1] PREEMPT SMP NOPTI [31757.530154] CPU: 26 PID: 95641 Comm: xdpsock Not tainted 6.2.0-rc5+ #40 [31757.536871] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0008.031920191559 03/19/2019 [31757.547457] RIP: 0010:xsksendmsg+0xde/0x180 [31757.551799] Code: 00 75 a2 48 8b 00 a8 04 75 9b 84 d2 74 69 8b 85 14 01 00 00 85 c0 75 1b 48 8b 85 28 03 00 00 48 8b 80 98 00 00 00 48 8b 40 20 <8b> 40 18 89 85 14 01 00 00 8b bd 14 01 00 00 81 ff 00 01 00 00 0f [31757.570840] RSP: 0018:ffffc90034f27dc0 EFLAGS: 00010246 [31757.576143] RAX: 0000000000000000 RBX: ffffc90034f27e18 RCX: 0000000000000000 [31757.583389] RDX: 0000000000000001 RSI: ffffc90034f27e18 RDI: ffff88984cf3c100 [31757.590631] RBP: ffff88984714a800 R08: ffff88984714a800 R09: 0000000000000000 [31757.597877] R10: 0000000000000001 R11: 0000000000000000 R12: 00000000fffffffa [31757.605123] R13: 0000000000000000 R14: 0000000000000003 R15: 0000000000000000 [31757.612364] FS: 00007fb4c5931180(0000) GS:ffff88afdfa00000(0000) knlGS:0000000000000000 [31757.620571] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [31757.626406] CR2: 0000000000000018 CR3: 000000184b41c003 CR4: 00000000007706e0 [31757.633648] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [31757.640894] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [31757.648139] PKRU: 55555554 [31757.650894] Call Trace: [31757.653385] <TASK> [31757.655524] socksendmsg+0x8f/0xa0 [31757.659077] ? sockfdlookuplight+0x12/0x70 [31757.663416] _syssendto+0xfc/0x170 [31757.667051] ? doschedsetscheduler+0xdb/0x1b0 [31757.671658] _x64syssendto+0x20/0x30 [31757.675557] dosyscall64+0x38/0x90 [31757.679197] entrySYSCALL64afterhwframe+0x72/0xdc [31757.687969] Code: 8e f6 ff 44 8b 4c 24 2c 4c 8b 44 24 20 41 89 c4 44 8b 54 24 28 48 8b 54 24 18 b8 2c 00 00 00 48 8b 74 24 10 8b 7c 24 08 0f 05 <48> 3d 00 f0 ff ff 77 3a 44 89 e7 48 89 44 24 08 e8 b5 8e f6 ff 48 [31757.707007] RSP: 002b:00007ffd49c73c70 EFLAGS: 00000293 ORIG_RAX: 000000000000002c [31757.714694] RAX: ffffffffffffffda RBX: 000055a996565380 RCX: 00007fb4c5727c16 [31757.721939] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 [31757.729184] RBP: 0000000000000040 R08: 0000000000000000 R09: 0000000000000000 [31757.736429] R10: 0000000000000040 R11: 0000000000000293 R12: 0000000000000000 [31757.743673] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [31757.754940] </TASK>
To fix this, let's make xskxmit a function that will be responsible for generic Tx, where RCU is handled accordingly and pull out sanity checks and xs->zc handling. Populate sanity checks to _xsksendmsg() and xskpoll().
{
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/53xxx/CVE-2023-53240.json",
"cna_assigner": "Linux"
}[
{
"id": "CVE-2023-53240-008e119d",
"signature_version": "v1",
"digest": {
"function_hash": "338097554307889192564694645834755799175",
"length": 345.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cecc68559cd57fffb2be50685f262b9af2318e16",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "xsk_xmit"
}
},
{
"id": "CVE-2023-53240-0d63920c",
"signature_version": "v1",
"digest": {
"function_hash": "189898682744280498680519576340491163237",
"length": 571.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cecc68559cd57fffb2be50685f262b9af2318e16",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "__xsk_sendmsg"
}
},
{
"id": "CVE-2023-53240-0d7a8c4f",
"signature_version": "v1",
"digest": {
"function_hash": "189898682744280498680519576340491163237",
"length": 571.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1596dae2f17ec5c6e8c8f0e3fec78c5ae55c1e0b",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "__xsk_sendmsg"
}
},
{
"id": "CVE-2023-53240-1dcb9346",
"signature_version": "v1",
"digest": {
"function_hash": "331721668429979804219747218813378203771",
"length": 607.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ffe19750e68d0bb21e8110b398346eef20b156a7",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "xsk_poll"
}
},
{
"id": "CVE-2023-53240-387dda52",
"signature_version": "v1",
"digest": {
"function_hash": "110840305076758634940643404192669220858",
"length": 623.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cecc68559cd57fffb2be50685f262b9af2318e16",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "__xsk_recvmsg"
}
},
{
"id": "CVE-2023-53240-5732c981",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"158068896958899874160130976732899864390",
"326593956399562926442722103411996197024",
"138400911512888549965551049540310447404",
"318392465562308258445198206711273133149",
"249736410452171563192238878453357278041",
"151698425500030906708659218026544355897",
"223850057349141769564989074233874531603",
"251883646872575222768587449341669693800",
"231555903440790708798505881139039209546",
"311041383564176263999189110051228190685",
"204725510581281870792152962191661376528",
"74534758906563389590829538694173915205",
"322074469160203911130349776275482430054",
"105940862327357024774899623156877257422",
"273546164335891259314466394781673363976",
"260083229372268385176008576119837211913",
"56886166079798415368435904796207401631",
"77107605456023964646212402371829401933",
"306599819290899179359415475389709237004",
"75589388149890463956994189950552442700",
"339360029632988180064330952146724232162",
"44073357574919714043102704106856817010",
"114833049156971927367434220161626524428",
"252760942279891943897099575031390125440",
"165414193902410334324577143885767080516",
"229209415707644473263631011065263410479",
"177709782426374520810712631390176473571",
"132350262197124904238443145379395525417",
"17808326288338620033892615869485481600",
"168490110043283452165409174129932938022",
"248243866851635773846021987179008069526",
"186948363042206793636141706792667951969",
"84155178969763083753502663540385955447",
"237303318767245611038280634548914702120",
"17968788732860505262218563229537895555",
"23107264253046684170720354703489525127",
"184805175088938475396650629098761451305",
"4492166024088926452680360779807477079",
"331511719437132223181099271247874689710",
"293194106277095311328200511802899935225",
"100394557724893015988515772928425298790",
"102136385361195534222150827751643463102",
"191476796828523792367193067894380115096",
"138196261860336816261618104076651955660",
"94880708129658167323303906860214076026",
"68589567720737441225507227676167987183",
"155406899540853444115547058296941673051",
"226878441654823031594394618013814837999",
"331786916379588787801640736519983823703",
"152794047665822362412693190473842225271",
"327002533125153329100666056082547664180",
"270791574603375315284438661032580604857",
"163009848630906947137281158096395272484",
"54587988016693148823875367968694603404",
"2972765404881170100145741934176559537",
"278678870792065003261428309383552723766",
"333250360430434649612237246079552197764",
"3121687228943110237250538705006249147",
"340163454370897367430091515431088053328"
]
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ffe19750e68d0bb21e8110b398346eef20b156a7",
"signature_type": "Line",
"target": {
"file": "net/xdp/xsk.c"
}
},
{
"id": "CVE-2023-53240-6a297d48",
"signature_version": "v1",
"digest": {
"function_hash": "331721668429979804219747218813378203771",
"length": 607.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cecc68559cd57fffb2be50685f262b9af2318e16",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "xsk_poll"
}
},
{
"id": "CVE-2023-53240-71a28a96",
"signature_version": "v1",
"digest": {
"function_hash": "110840305076758634940643404192669220858",
"length": 623.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1596dae2f17ec5c6e8c8f0e3fec78c5ae55c1e0b",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "__xsk_recvmsg"
}
},
{
"id": "CVE-2023-53240-84097e24",
"signature_version": "v1",
"digest": {
"function_hash": "338097554307889192564694645834755799175",
"length": 345.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1596dae2f17ec5c6e8c8f0e3fec78c5ae55c1e0b",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "xsk_xmit"
}
},
{
"id": "CVE-2023-53240-a921847e",
"signature_version": "v1",
"digest": {
"function_hash": "189898682744280498680519576340491163237",
"length": 571.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ffe19750e68d0bb21e8110b398346eef20b156a7",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "__xsk_sendmsg"
}
},
{
"id": "CVE-2023-53240-ab271341",
"signature_version": "v1",
"digest": {
"function_hash": "110840305076758634940643404192669220858",
"length": 623.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ffe19750e68d0bb21e8110b398346eef20b156a7",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "__xsk_recvmsg"
}
},
{
"id": "CVE-2023-53240-ab5bffa7",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"158068896958899874160130976732899864390",
"326593956399562926442722103411996197024",
"138400911512888549965551049540310447404",
"318392465562308258445198206711273133149",
"249736410452171563192238878453357278041",
"151698425500030906708659218026544355897",
"223850057349141769564989074233874531603",
"251883646872575222768587449341669693800",
"231555903440790708798505881139039209546",
"311041383564176263999189110051228190685",
"204725510581281870792152962191661376528",
"74534758906563389590829538694173915205",
"322074469160203911130349776275482430054",
"105940862327357024774899623156877257422",
"273546164335891259314466394781673363976",
"260083229372268385176008576119837211913",
"56886166079798415368435904796207401631",
"77107605456023964646212402371829401933",
"306599819290899179359415475389709237004",
"75589388149890463956994189950552442700",
"339360029632988180064330952146724232162",
"44073357574919714043102704106856817010",
"114833049156971927367434220161626524428",
"252760942279891943897099575031390125440",
"165414193902410334324577143885767080516",
"229209415707644473263631011065263410479",
"177709782426374520810712631390176473571",
"132350262197124904238443145379395525417",
"17808326288338620033892615869485481600",
"168490110043283452165409174129932938022",
"248243866851635773846021987179008069526",
"186948363042206793636141706792667951969",
"84155178969763083753502663540385955447",
"237303318767245611038280634548914702120",
"17968788732860505262218563229537895555",
"23107264253046684170720354703489525127",
"184805175088938475396650629098761451305",
"4492166024088926452680360779807477079",
"331511719437132223181099271247874689710",
"293194106277095311328200511802899935225",
"100394557724893015988515772928425298790",
"102136385361195534222150827751643463102",
"191476796828523792367193067894380115096",
"138196261860336816261618104076651955660",
"94880708129658167323303906860214076026",
"68589567720737441225507227676167987183",
"155406899540853444115547058296941673051",
"226878441654823031594394618013814837999",
"331786916379588787801640736519983823703",
"152794047665822362412693190473842225271",
"327002533125153329100666056082547664180",
"270791574603375315284438661032580604857",
"163009848630906947137281158096395272484",
"54587988016693148823875367968694603404",
"2972765404881170100145741934176559537",
"278678870792065003261428309383552723766",
"333250360430434649612237246079552197764",
"3121687228943110237250538705006249147",
"340163454370897367430091515431088053328"
]
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cecc68559cd57fffb2be50685f262b9af2318e16",
"signature_type": "Line",
"target": {
"file": "net/xdp/xsk.c"
}
},
{
"id": "CVE-2023-53240-bb00945e",
"signature_version": "v1",
"digest": {
"function_hash": "338097554307889192564694645834755799175",
"length": 345.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ffe19750e68d0bb21e8110b398346eef20b156a7",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "xsk_xmit"
}
},
{
"id": "CVE-2023-53240-dea6f2c4",
"signature_version": "v1",
"digest": {
"function_hash": "331721668429979804219747218813378203771",
"length": 607.0
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1596dae2f17ec5c6e8c8f0e3fec78c5ae55c1e0b",
"signature_type": "Function",
"target": {
"file": "net/xdp/xsk.c",
"function": "xsk_poll"
}
},
{
"id": "CVE-2023-53240-e9a9faf3",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"158068896958899874160130976732899864390",
"326593956399562926442722103411996197024",
"138400911512888549965551049540310447404",
"318392465562308258445198206711273133149",
"249736410452171563192238878453357278041",
"151698425500030906708659218026544355897",
"223850057349141769564989074233874531603",
"251883646872575222768587449341669693800",
"231555903440790708798505881139039209546",
"311041383564176263999189110051228190685",
"204725510581281870792152962191661376528",
"74534758906563389590829538694173915205",
"322074469160203911130349776275482430054",
"105940862327357024774899623156877257422",
"273546164335891259314466394781673363976",
"260083229372268385176008576119837211913",
"56886166079798415368435904796207401631",
"77107605456023964646212402371829401933",
"306599819290899179359415475389709237004",
"75589388149890463956994189950552442700",
"339360029632988180064330952146724232162",
"44073357574919714043102704106856817010",
"114833049156971927367434220161626524428",
"252760942279891943897099575031390125440",
"165414193902410334324577143885767080516",
"229209415707644473263631011065263410479",
"177709782426374520810712631390176473571",
"132350262197124904238443145379395525417",
"17808326288338620033892615869485481600",
"168490110043283452165409174129932938022",
"248243866851635773846021987179008069526",
"186948363042206793636141706792667951969",
"84155178969763083753502663540385955447",
"237303318767245611038280634548914702120",
"17968788732860505262218563229537895555",
"23107264253046684170720354703489525127",
"184805175088938475396650629098761451305",
"4492166024088926452680360779807477079",
"331511719437132223181099271247874689710",
"293194106277095311328200511802899935225",
"100394557724893015988515772928425298790",
"102136385361195534222150827751643463102",
"191476796828523792367193067894380115096",
"138196261860336816261618104076651955660",
"94880708129658167323303906860214076026",
"68589567720737441225507227676167987183",
"155406899540853444115547058296941673051",
"226878441654823031594394618013814837999",
"331786916379588787801640736519983823703",
"152794047665822362412693190473842225271",
"327002533125153329100666056082547664180",
"270791574603375315284438661032580604857",
"163009848630906947137281158096395272484",
"54587988016693148823875367968694603404",
"2972765404881170100145741934176559537",
"278678870792065003261428309383552723766",
"333250360430434649612237246079552197764",
"3121687228943110237250538705006249147",
"340163454370897367430091515431088053328"
]
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1596dae2f17ec5c6e8c8f0e3fec78c5ae55c1e0b",
"signature_type": "Line",
"target": {
"file": "net/xdp/xsk.c"
}
}
]
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-53240.json"