In the Linux kernel, the following vulnerability has been resolved:
net/sched: Fix mirred deadlock on device recursion
When the mirred action is used on a classful egress qdisc and a packet is mirrored or redirected to self we hit a qdisc lock deadlock. See trace below.
[..... other info removed for brevity....] [ 82.890906] [ 82.890906] ============================================ [ 82.890906] WARNING: possible recursive locking detected [ 82.890906] 6.8.0-05205-g77fadd89fe2d-dirty #213 Tainted: G W [ 82.890906] -------------------------------------------- [ 82.890906] ping/418 is trying to acquire lock: [ 82.890906] ffff888006994110 (&sch->q.lock){+.-.}-{3:3}, at: _devqueuexmit+0x1778/0x3550 [ 82.890906] [ 82.890906] but task is already holding lock: [ 82.890906] ffff888006994110 (&sch->q.lock){+.-.}-{3:3}, at: _devqueuexmit+0x1778/0x3550 [ 82.890906] [ 82.890906] other info that might help us debug this: [ 82.890906] Possible unsafe locking scenario: [ 82.890906] [ 82.890906] CPU0 [ 82.890906] ---- [ 82.890906] lock(&sch->q.lock); [ 82.890906] lock(&sch->q.lock); [ 82.890906] [ 82.890906] * DEADLOCK * [ 82.890906] [..... other info removed for brevity....]
Example setup (eth0->eth0) to recreate tc qdisc add dev eth0 root handle 1: htb default 30 tc filter add dev eth0 handle 1: protocol ip prio 2 matchall \ action mirred egress redirect dev eth0
Another example(eth0->eth1->eth0) to recreate tc qdisc add dev eth0 root handle 1: htb default 30 tc filter add dev eth0 handle 1: protocol ip prio 2 matchall \ action mirred egress redirect dev eth1
tc qdisc add dev eth1 root handle 1: htb default 30 tc filter add dev eth1 handle 1: protocol ip prio 2 matchall \ action mirred egress redirect dev eth0
We fix this by adding an owner field (CPU id) to struct Qdisc set after root qdisc is entered. When the softirq enters it a second time, if the qdisc owner is the same CPU, the packet is dropped to break the loop.
[
{
"deprecated": false,
"target": {
"file": "net/core/dev.c",
"function": "__dev_xmit_skb"
},
"digest": {
"length": 1864.0,
"function_hash": "315744530365695781642129625138015551872"
},
"id": "CVE-2024-27010-0605c907",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e6b90468da4dae2281a6e381107f411efb48b0ef",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "net/sched/sch_generic.c",
"function": "qdisc_alloc"
},
"digest": {
"length": 1412.0,
"function_hash": "281759684481034378545486730015134335196"
},
"id": "CVE-2024-27010-3e70b1a2",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0f022d32c3eca477fbf79a205243a6123ed0fe11",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "net/core/dev.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"53298560351014202099411594189678347566",
"184891801393182576858353012778763796436",
"328942525527325642159282736362970707712",
"292303773815440850038985657017866483001",
"207777653581622644935454574263284681535",
"238373890031548314820233717369776491069",
"33506854628087820398082003183209842231",
"85318898541509326955690772481528013866"
]
},
"id": "CVE-2024-27010-3f0db0b1",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e6b90468da4dae2281a6e381107f411efb48b0ef",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "net/core/dev.c",
"function": "__dev_xmit_skb"
},
"digest": {
"length": 1864.0,
"function_hash": "315744530365695781642129625138015551872"
},
"id": "CVE-2024-27010-62c461a1",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0f022d32c3eca477fbf79a205243a6123ed0fe11",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "include/net/sch_generic.h"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"299970557524825245572375081236063373106",
"92593349113273579724988938586459598901",
"283767042139692648418329395062870847112",
"50534455358958207701204585841855766449"
]
},
"id": "CVE-2024-27010-6a0ca61c",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0f022d32c3eca477fbf79a205243a6123ed0fe11",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "include/net/sch_generic.h"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"299970557524825245572375081236063373106",
"92593349113273579724988938586459598901",
"283767042139692648418329395062870847112",
"50534455358958207701204585841855766449"
]
},
"id": "CVE-2024-27010-928a23b4",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e6b90468da4dae2281a6e381107f411efb48b0ef",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "net/sched/sch_generic.c",
"function": "qdisc_alloc"
},
"digest": {
"length": 1412.0,
"function_hash": "281759684481034378545486730015134335196"
},
"id": "CVE-2024-27010-995da9b5",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e6b90468da4dae2281a6e381107f411efb48b0ef",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "net/core/dev.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"53298560351014202099411594189678347566",
"184891801393182576858353012778763796436",
"328942525527325642159282736362970707712",
"292303773815440850038985657017866483001",
"207777653581622644935454574263284681535",
"238373890031548314820233717369776491069",
"33506854628087820398082003183209842231",
"85318898541509326955690772481528013866"
]
},
"id": "CVE-2024-27010-cad48ebe",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0f022d32c3eca477fbf79a205243a6123ed0fe11",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "net/sched/sch_generic.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"204775788981766623941531065637563920508",
"267507467991638448482262099305671544228",
"320253107906805258821730962739085286474",
"279206105712833574460981402327093733954"
]
},
"id": "CVE-2024-27010-dce10b28",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e6b90468da4dae2281a6e381107f411efb48b0ef",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "net/sched/sch_generic.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"204775788981766623941531065637563920508",
"267507467991638448482262099305671544228",
"320253107906805258821730962739085286474",
"279206105712833574460981402327093733954"
]
},
"id": "CVE-2024-27010-f33d327d",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0f022d32c3eca477fbf79a205243a6123ed0fe11",
"signature_version": "v1"
}
]