CVE-2024-26902

Source
https://nvd.nist.gov/vuln/detail/CVE-2024-26902
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-26902.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2024-26902
Downstream
Published
2024-04-17T10:27:51Z
Modified
2025-10-15T09:35:53.720249Z
Summary
perf: RISCV: Fix panic on pmu overflow handler
Details

In the Linux kernel, the following vulnerability has been resolved:

perf: RISCV: Fix panic on pmu overflow handler

(1 << idx) of int is not desired when setting bits in unsigned long overflowed_ctrs, use BIT() instead. This panic happens when running 'perf record -e branches' on sophgo sg2042.

[ 273.311852] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000098 [ 273.320851] Oops [#1] [ 273.323179] Modules linked in: [ 273.326303] CPU: 0 PID: 1475 Comm: perf Not tainted 6.6.0-rc3+ #9 [ 273.332521] Hardware name: Sophgo Mango (DT) [ 273.336878] epc : riscvpmuctrgetwidthmask+0x8/0x62 [ 273.342291] ra : pmusbiovfhandler+0x2e0/0x34e [ 273.347091] epc : ffffffff80aecd98 ra : ffffffff80aee056 sp : fffffff6e36928b0 [ 273.354454] gp : ffffffff821f82d0 tp : ffffffd90c353200 t0 : 0000002ade4f9978 [ 273.361815] t1 : 0000000000504d55 t2 : ffffffff8016cd8c s0 : fffffff6e3692a70 [ 273.369180] s1 : 0000000000000020 a0 : 0000000000000000 a1 : 00001a8e81800000 [ 273.376540] a2 : 0000003c00070198 a3 : 0000003c00db75a4 a4 : 0000000000000015 [ 273.383901] a5 : ffffffd7ff8804b0 a6 : 0000000000000015 a7 : 000000000000002a [ 273.391327] s2 : 000000000000ffff s3 : 0000000000000000 s4 : ffffffd7ff8803b0 [ 273.398773] s5 : 0000000000504d55 s6 : ffffffd905069800 s7 : ffffffff821fe210 [ 273.406139] s8 : 000000007fffffff s9 : ffffffd7ff8803b0 s10: ffffffd903f29098 [ 273.413660] s11: 0000000080000000 t3 : 0000000000000003 t4 : ffffffff8017a0ca [ 273.421022] t5 : ffffffff8023cfc2 t6 : ffffffd9040780e8 [ 273.426437] status: 0000000200000100 badaddr: 0000000000000098 cause: 000000000000000d [ 273.434512] [<ffffffff80aecd98>] riscvpmuctrgetwidthmask+0x8/0x62 [ 273.441169] [<ffffffff80076bd8>] handlepercpudevidirq+0x98/0x1ee [ 273.447562] [<ffffffff80071158>] generichandledomainirq+0x28/0x36 [ 273.454151] [<ffffffff8047a99a>] riscvintcirq+0x36/0x4e [ 273.459659] [<ffffffff80c944de>] handleriscvirq+0x4a/0x74 [ 273.465442] [<ffffffff80c94c48>] doirq+0x62/0x92 [ 273.470360] Code: 0420 60a2 6402 5529 0141 8082 0013 0000 0013 0000 (6d5c) b783 [ 273.477921] ---[ end trace 0000000000000000 ]--- [ 273.482630] Kernel panic - not syncing: Fatal exception in interrupt

References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
4905ec2fb7e6421c14c9fb7276f5aa92f60f2b98
Fixed
3ede8e94de6b834b48b0643385e66363e7a04be9
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
4905ec2fb7e6421c14c9fb7276f5aa92f60f2b98
Fixed
9f599ba3b9cc4bdb8ec1e3f0feddd41bf9d296d6
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
4905ec2fb7e6421c14c9fb7276f5aa92f60f2b98
Fixed
34b567868777e9fd39ec5333969728a7f0cf179c

Affected versions

v5.*

v5.17
v5.17-rc2
v5.17-rc3
v5.17-rc4
v5.17-rc5
v5.17-rc6
v5.17-rc7
v5.17-rc8
v5.18
v5.18-rc1
v5.18-rc2
v5.18-rc3
v5.18-rc4
v5.18-rc5
v5.18-rc6
v5.18-rc7
v5.19
v5.19-rc1
v5.19-rc2
v5.19-rc3
v5.19-rc4
v5.19-rc5
v5.19-rc6
v5.19-rc7
v5.19-rc8

v6.*

v6.0
v6.0-rc1
v6.0-rc2
v6.0-rc3
v6.0-rc4
v6.0-rc5
v6.0-rc6
v6.0-rc7
v6.1
v6.1-rc1
v6.1-rc2
v6.1-rc3
v6.1-rc4
v6.1-rc5
v6.1-rc6
v6.1-rc7
v6.1-rc8
v6.2
v6.2-rc1
v6.2-rc2
v6.2-rc3
v6.2-rc4
v6.2-rc5
v6.2-rc6
v6.2-rc7
v6.2-rc8
v6.3
v6.3-rc1
v6.3-rc2
v6.3-rc3
v6.3-rc4
v6.3-rc5
v6.3-rc6
v6.3-rc7
v6.4
v6.4-rc1
v6.4-rc2
v6.4-rc3
v6.4-rc4
v6.4-rc5
v6.4-rc6
v6.4-rc7
v6.5
v6.5-rc1
v6.5-rc2
v6.5-rc3
v6.5-rc4
v6.5-rc5
v6.5-rc6
v6.5-rc7
v6.6
v6.6-rc1
v6.6-rc2
v6.6-rc3
v6.6-rc4
v6.6-rc5
v6.6-rc6
v6.6-rc7
v6.6.1
v6.6.10
v6.6.11
v6.6.12
v6.6.13
v6.6.14
v6.6.15
v6.6.16
v6.6.17
v6.6.18
v6.6.19
v6.6.2
v6.6.20
v6.6.21
v6.6.22
v6.6.3
v6.6.4
v6.6.5
v6.6.6
v6.6.7
v6.6.8
v6.6.9
v6.7
v6.7-rc1
v6.7-rc2
v6.7-rc3
v6.7-rc4
v6.7-rc5
v6.7-rc6
v6.7-rc7
v6.7-rc8
v6.7.1
v6.7.10
v6.7.2
v6.7.3
v6.7.4
v6.7.5
v6.7.6
v6.7.7
v6.7.8
v6.7.9
v6.8-rc1

Database specific

{
    "vanir_signatures": [
        {
            "signature_version": "v1",
            "target": {
                "function": "pmu_sbi_set_scounteren",
                "file": "drivers/perf/riscv_pmu_sbi.c"
            },
            "signature_type": "Function",
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3ede8e94de6b834b48b0643385e66363e7a04be9",
            "deprecated": false,
            "digest": {
                "length": 195.0,
                "function_hash": "33797758023298167862507483114105802274"
            },
            "id": "CVE-2024-26902-2b5bd229"
        },
        {
            "signature_version": "v1",
            "target": {
                "function": "pmu_sbi_reset_scounteren",
                "file": "drivers/perf/riscv_pmu_sbi.c"
            },
            "signature_type": "Function",
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3ede8e94de6b834b48b0643385e66363e7a04be9",
            "deprecated": false,
            "digest": {
                "length": 197.0,
                "function_hash": "158536362296807871348563222997604363791"
            },
            "id": "CVE-2024-26902-527f801c"
        },
        {
            "signature_version": "v1",
            "target": {
                "file": "drivers/perf/riscv_pmu_sbi.c"
            },
            "signature_type": "Line",
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3ede8e94de6b834b48b0643385e66363e7a04be9",
            "deprecated": false,
            "digest": {
                "line_hashes": [
                    "244303151422398996546333893177568386259",
                    "193608019266075450533611790990839103877",
                    "87943071804806344402581769306436683861",
                    "87498914703647555335208284322139150521",
                    "293649706800803930175347131487408036723",
                    "26739023411835737662774368888739639644",
                    "176603476296542847997268337196548297079",
                    "271455398436242045839318760967414647185",
                    "314055611012140682326870371043040202180",
                    "225140571309277167177497758193985697847",
                    "164851473857484212196652596446993270812",
                    "281645177053907115066784520369425863845",
                    "197699375182531600480989728766217179201",
                    "118187701066259011390499784140789641218"
                ],
                "threshold": 0.9
            },
            "id": "CVE-2024-26902-63eaa916"
        },
        {
            "signature_version": "v1",
            "target": {
                "file": "drivers/perf/riscv_pmu_sbi.c"
            },
            "signature_type": "Line",
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9f599ba3b9cc4bdb8ec1e3f0feddd41bf9d296d6",
            "deprecated": false,
            "digest": {
                "line_hashes": [
                    "244303151422398996546333893177568386259",
                    "193608019266075450533611790990839103877",
                    "87943071804806344402581769306436683861",
                    "87498914703647555335208284322139150521",
                    "293649706800803930175347131487408036723",
                    "26739023411835737662774368888739639644",
                    "176603476296542847997268337196548297079",
                    "271455398436242045839318760967414647185",
                    "314055611012140682326870371043040202180",
                    "225140571309277167177497758193985697847",
                    "164851473857484212196652596446993270812",
                    "281645177053907115066784520369425863845",
                    "197699375182531600480989728766217179201",
                    "118187701066259011390499784140789641218"
                ],
                "threshold": 0.9
            },
            "id": "CVE-2024-26902-80b6ecee"
        },
        {
            "signature_version": "v1",
            "target": {
                "function": "pmu_sbi_ovf_handler",
                "file": "drivers/perf/riscv_pmu_sbi.c"
            },
            "signature_type": "Function",
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3ede8e94de6b834b48b0643385e66363e7a04be9",
            "deprecated": false,
            "digest": {
                "length": 1341.0,
                "function_hash": "165606617755440569732911833669309191602"
            },
            "id": "CVE-2024-26902-a7bebdba"
        },
        {
            "signature_version": "v1",
            "target": {
                "function": "pmu_sbi_set_scounteren",
                "file": "drivers/perf/riscv_pmu_sbi.c"
            },
            "signature_type": "Function",
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9f599ba3b9cc4bdb8ec1e3f0feddd41bf9d296d6",
            "deprecated": false,
            "digest": {
                "length": 195.0,
                "function_hash": "33797758023298167862507483114105802274"
            },
            "id": "CVE-2024-26902-bbb2d4cd"
        },
        {
            "signature_version": "v1",
            "target": {
                "function": "pmu_sbi_ovf_handler",
                "file": "drivers/perf/riscv_pmu_sbi.c"
            },
            "signature_type": "Function",
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9f599ba3b9cc4bdb8ec1e3f0feddd41bf9d296d6",
            "deprecated": false,
            "digest": {
                "length": 1341.0,
                "function_hash": "165606617755440569732911833669309191602"
            },
            "id": "CVE-2024-26902-cc360746"
        },
        {
            "signature_version": "v1",
            "target": {
                "function": "pmu_sbi_reset_scounteren",
                "file": "drivers/perf/riscv_pmu_sbi.c"
            },
            "signature_type": "Function",
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9f599ba3b9cc4bdb8ec1e3f0feddd41bf9d296d6",
            "deprecated": false,
            "digest": {
                "length": 197.0,
                "function_hash": "158536362296807871348563222997604363791"
            },
            "id": "CVE-2024-26902-d6d693ea"
        }
    ]
}

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
5.18.0
Fixed
6.6.23
Type
ECOSYSTEM
Events
Introduced
6.7.0
Fixed
6.7.11