{
  "threat_severity" : "Moderate",
  "public_date" : "2025-09-16T00:00:00Z",
  "bugzilla" : {
    "description" : "kernel: perf: Avoid undefined behavior from stopping/starting inactive events",
    "id" : "2395793",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2395793"
  },
  "cvss3" : {
    "cvss3_base_score" : "5.3",
    "cvss3_scoring_vector" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:H",
    "status" : "draft"
  },
  "cwe" : "CWE-1335",
  "details" : [ "In the Linux kernel, the following vulnerability has been resolved:\nperf: Avoid undefined behavior from stopping/starting inactive events\nCalling pmu->start()/stop() on perf events in PERF_EVENT_STATE_OFF can\nleave event->hw.idx at -1. When PMU drivers later attempt to use this\nnegative index as a shift exponent in bitwise operations, it leads to UBSAN\nshift-out-of-bounds reports.\nThe issue is a logical flaw in how event groups handle throttling when some\nmembers are intentionally disabled. Based on the analysis and the\nreproducer provided by Mark Rutland (this issue on both arm64 and x86-64).\nThe scenario unfolds as follows:\n1. A group leader event is configured with a very aggressive sampling\nperiod (e.g., sample_period = 1). This causes frequent interrupts and\ntriggers the throttling mechanism.\n2. A child event in the same group is created in a disabled state\n(.disabled = 1). This event remains in PERF_EVENT_STATE_OFF.\nSince it hasn't been scheduled onto the PMU, its event->hw.idx remains\ninitialized at -1.\n3. When throttling occurs, perf_event_throttle_group() and later\nperf_event_unthrottle_group() iterate through all siblings, including\nthe disabled child event.\n4. perf_event_throttle()/unthrottle() are called on this inactive child\nevent, which then call event->pmu->start()/stop().\n5. The PMU driver receives the event with hw.idx == -1 and attempts to\nuse it as a shift exponent. e.g., in macros like PMCNTENSET(idx),\nleading to the UBSAN report.\nThe throttling mechanism attempts to start/stop events that are not\nactively scheduled on the hardware.\nMove the state check into perf_event_throttle()/perf_event_unthrottle() so\nthat inactive events are skipped entirely. This ensures only active events\nwith a valid hw.idx are processed, preventing undefined behavior and\nsilencing UBSAN warnings. The corrected check ensures true before\nproceeding with PMU operations.\nThe problem can be reproduced with the syzkaller reproducer:" ],
  "package_state" : [ {
    "product_name" : "Red Hat Enterprise Linux 10",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:10"
  }, {
    "product_name" : "Red Hat Enterprise Linux 6",
    "fix_state" : "Out of support scope",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:6"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7",
    "fix_state" : "Not affected",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:8"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8",
    "fix_state" : "Not affected",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:8"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:9"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "fix_state" : "Not affected",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:9"
  } ],
  "references" : [ "https://www.cve.org/CVERecord?id=CVE-2025-39821\nhttps://nvd.nist.gov/vuln/detail/CVE-2025-39821\nhttps://lore.kernel.org/linux-cve-announce/2025091616-CVE-2025-39821-3812@gregkh/T" ],
  "name" : "CVE-2025-39821",
  "csaw" : false
}