In the Linux kernel, the following vulnerability has been resolved:
drivers/perf: hisi_pcie: Fix out-of-bound access when valid event group
The perf tool allows users to create event groups through following cmd [1], but the driver does not check whether the array index is out of bounds when writing data to the eventgroup array. If the number of events in an eventgroup is greater than HISIPCIEMAXCOUNTERS, the memory write overflow of eventgroup array occurs.
Add array index check to fix the possible array out of bounds violation, and return directly when write new events are written to array bounds.
There are 9 different events in an event_group. [1] perf stat -e '{pmu/event1/, ... ,pmu/event9/}'
[
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"227848542426135749650059761419217658061",
"241324790879641159092631064639513558297",
"116144901254487423409589766524126546231",
"299860202588907271818357786470410168125",
"10021205858642777610170721767435047371",
"45416000029387775944833504941744670893",
"225788687972160165138220468356608605289",
"221042629228312926485690279249348484165",
"80332491575553506061076373424452180186",
"37782493573063526947293929880384972756",
"326313488413293077100183056866268131816"
]
},
"signature_type": "Line",
"target": {
"file": "drivers/perf/hisilicon/hisi_pcie_pmu.c"
},
"deprecated": false,
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@567d34626c22b36579ec0abfdf5eda2949044220",
"id": "CVE-2024-38569-4815e83e"
},
{
"digest": {
"length": 640.0,
"function_hash": "172953269257478087091394206137057280485"
},
"signature_type": "Function",
"target": {
"function": "hisi_pcie_pmu_validate_event_group",
"file": "drivers/perf/hisilicon/hisi_pcie_pmu.c"
},
"deprecated": false,
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@77fce82678ea5fd51442e62febec2004f79e041b",
"id": "CVE-2024-38569-4ca58dce"
},
{
"digest": {
"length": 640.0,
"function_hash": "172953269257478087091394206137057280485"
},
"signature_type": "Function",
"target": {
"function": "hisi_pcie_pmu_validate_event_group",
"file": "drivers/perf/hisilicon/hisi_pcie_pmu.c"
},
"deprecated": false,
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@567d34626c22b36579ec0abfdf5eda2949044220",
"id": "CVE-2024-38569-6eb0d664"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"227848542426135749650059761419217658061",
"241324790879641159092631064639513558297",
"116144901254487423409589766524126546231",
"299860202588907271818357786470410168125",
"10021205858642777610170721767435047371",
"45416000029387775944833504941744670893",
"225788687972160165138220468356608605289",
"221042629228312926485690279249348484165",
"80332491575553506061076373424452180186",
"37782493573063526947293929880384972756",
"326313488413293077100183056866268131816"
]
},
"signature_type": "Line",
"target": {
"file": "drivers/perf/hisilicon/hisi_pcie_pmu.c"
},
"deprecated": false,
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@8e9aab2492178f25372f1820bfd9289fbd74efd0",
"id": "CVE-2024-38569-7ecfc460"
},
{
"digest": {
"length": 640.0,
"function_hash": "172953269257478087091394206137057280485"
},
"signature_type": "Function",
"target": {
"function": "hisi_pcie_pmu_validate_event_group",
"file": "drivers/perf/hisilicon/hisi_pcie_pmu.c"
},
"deprecated": false,
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3d1face00ebb7996842aee4214d7d0fb0c77b1e9",
"id": "CVE-2024-38569-9bfe03d2"
},
{
"digest": {
"length": 640.0,
"function_hash": "172953269257478087091394206137057280485"
},
"signature_type": "Function",
"target": {
"function": "hisi_pcie_pmu_validate_event_group",
"file": "drivers/perf/hisilicon/hisi_pcie_pmu.c"
},
"deprecated": false,
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@8e9aab2492178f25372f1820bfd9289fbd74efd0",
"id": "CVE-2024-38569-9c355278"
},
{
"digest": {
"length": 640.0,
"function_hash": "172953269257478087091394206137057280485"
},
"signature_type": "Function",
"target": {
"function": "hisi_pcie_pmu_validate_event_group",
"file": "drivers/perf/hisilicon/hisi_pcie_pmu.c"
},
"deprecated": false,
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ff48247144d13a3a0817127703724256008efa78",
"id": "CVE-2024-38569-a12187af"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"227848542426135749650059761419217658061",
"241324790879641159092631064639513558297",
"116144901254487423409589766524126546231",
"299860202588907271818357786470410168125",
"10021205858642777610170721767435047371",
"45416000029387775944833504941744670893",
"225788687972160165138220468356608605289",
"221042629228312926485690279249348484165",
"80332491575553506061076373424452180186",
"37782493573063526947293929880384972756",
"326313488413293077100183056866268131816"
]
},
"signature_type": "Line",
"target": {
"file": "drivers/perf/hisilicon/hisi_pcie_pmu.c"
},
"deprecated": false,
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ff48247144d13a3a0817127703724256008efa78",
"id": "CVE-2024-38569-b4c78b70"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"227848542426135749650059761419217658061",
"241324790879641159092631064639513558297",
"116144901254487423409589766524126546231",
"299860202588907271818357786470410168125",
"10021205858642777610170721767435047371",
"45416000029387775944833504941744670893",
"225788687972160165138220468356608605289",
"221042629228312926485690279249348484165",
"80332491575553506061076373424452180186",
"37782493573063526947293929880384972756",
"326313488413293077100183056866268131816"
]
},
"signature_type": "Line",
"target": {
"file": "drivers/perf/hisilicon/hisi_pcie_pmu.c"
},
"deprecated": false,
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3d1face00ebb7996842aee4214d7d0fb0c77b1e9",
"id": "CVE-2024-38569-d4588659"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"227848542426135749650059761419217658061",
"241324790879641159092631064639513558297",
"116144901254487423409589766524126546231",
"299860202588907271818357786470410168125",
"10021205858642777610170721767435047371",
"45416000029387775944833504941744670893",
"225788687972160165138220468356608605289",
"221042629228312926485690279249348484165",
"80332491575553506061076373424452180186",
"37782493573063526947293929880384972756",
"326313488413293077100183056866268131816"
]
},
"signature_type": "Line",
"target": {
"file": "drivers/perf/hisilicon/hisi_pcie_pmu.c"
},
"deprecated": false,
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@77fce82678ea5fd51442e62febec2004f79e041b",
"id": "CVE-2024-38569-e9c2df65"
}
]