Lucene search

K
cvelistLinuxCVELIST:CVE-2024-27010
HistoryMay 01, 2024 - 5:29 a.m.

CVE-2024-27010 net/sched: Fix mirred deadlock on device recursion

2024-05-0105:29:23
Linux
www.cve.org
1
linux kernel
net/sched
vulnerability
deadlock
mirred action
qdisc
recursion

7.6 High

AI Score

Confidence

High

0.0004 Low

EPSS

Percentile

9.2%

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:
__dev_queue_xmit+0x1778/0x3550
[ 82.890906]
[ 82.890906] but task is already holding lock:
[ 82.890906] ffff888006994110 (&sch->q.lock){+.-.}-{3:3}, at:
__dev_queue_xmit+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.

CNA Affected

[
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "unaffected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "include/net/sch_generic.h",
      "net/core/dev.c",
      "net/sched/sch_generic.c"
    ],
    "versions": [
      {
        "version": "e578d9c02587",
        "lessThan": "e6b90468da4d",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "e578d9c02587",
        "lessThan": "0f022d32c3ec",
        "status": "affected",
        "versionType": "git"
      }
    ]
  },
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "affected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "include/net/sch_generic.h",
      "net/core/dev.c",
      "net/sched/sch_generic.c"
    ],
    "versions": [
      {
        "version": "4.2",
        "status": "affected"
      },
      {
        "version": "0",
        "lessThan": "4.2",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.8.8",
        "lessThanOrEqual": "6.8.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.9",
        "lessThanOrEqual": "*",
        "status": "unaffected",
        "versionType": "original_commit_for_fix"
      }
    ]
  }
]

7.6 High

AI Score

Confidence

High

0.0004 Low

EPSS

Percentile

9.2%