Yang Jihong
ddcf832000
perf/core: Fix perf_output_begin parameter is incorrectly invoked in perf_event_bpf_output
...
[ Upstream commit eb81a2ed4f52be831c9fb879752d89645a312c13 ]
syzkaller reportes a KASAN issue with stack-out-of-bounds.
The call trace is as follows:
dump_stack+0x9c/0xd3
print_address_description.constprop.0+0x19/0x170
__kasan_report.cold+0x6c/0x84
kasan_report+0x3a/0x50
__perf_event_header__init_id+0x34/0x290
perf_event_header__init_id+0x48/0x60
perf_output_begin+0x4a4/0x560
perf_event_bpf_output+0x161/0x1e0
perf_iterate_sb_cpu+0x29e/0x340
perf_iterate_sb+0x4c/0xc0
perf_event_bpf_event+0x194/0x2c0
__bpf_prog_put.constprop.0+0x55/0xf0
__cls_bpf_delete_prog+0xea/0x120 [cls_bpf]
cls_bpf_delete_prog_work+0x1c/0x30 [cls_bpf]
process_one_work+0x3c2/0x730
worker_thread+0x93/0x650
kthread+0x1b8/0x210
ret_from_fork+0x1f/0x30
commit 267fb27352b6 ("perf: Reduce stack usage of perf_output_begin()")
use on-stack struct perf_sample_data of the caller function.
However, perf_event_bpf_output uses incorrect parameter to convert
small-sized data (struct perf_bpf_event) into large-sized data
(struct perf_sample_data), which causes memory overwriting occurs in
__perf_event_header__init_id.
Fixes: 267fb27352b6 ("perf: Reduce stack usage of perf_output_begin()")
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20230314044735.56551-1-yangjihong1@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-05 11:23:29 +02:00
..
2023-03-17 08:45:12 +01:00
2022-12-14 11:31:57 +01:00
2022-05-30 09:33:22 +02:00
2022-10-05 10:38:40 +02:00
2023-01-04 11:39:22 +01:00
2023-04-05 11:23:29 +02:00
2023-01-14 10:15:20 +01:00
2023-01-14 10:16:24 +01:00
2023-03-17 08:45:08 +01:00
2023-02-01 08:23:20 +01:00
2022-10-26 13:25:14 +02:00
2022-08-21 15:15:33 +02:00
2023-03-11 16:39:51 +01:00
2022-04-08 14:40:08 +02:00
2023-03-11 16:39:49 +01:00
2023-03-11 16:39:16 +01:00
2023-03-11 16:39:50 +01:00
2023-03-22 13:30:04 +01:00
2021-05-11 14:47:37 +02:00
2023-01-14 10:16:14 +01:00
2022-02-23 12:01:00 +01:00
2022-08-31 17:15:13 +02:00
2021-09-03 10:09:31 +02:00
2020-12-30 11:54:18 +01:00
2022-02-08 18:30:34 +01:00
2022-04-08 14:40:00 +02:00
2020-08-23 17:36:59 -05:00
2022-04-08 14:40:00 +02:00
2020-10-13 09:17:34 -07:00
2020-08-23 17:36:59 -05:00
2021-09-15 09:50:40 +02:00
2023-01-14 10:15:20 +01:00
2021-06-23 14:42:52 +02:00
2021-09-08 08:49:00 +02:00
2023-02-01 08:23:21 +01:00
2023-03-11 16:40:18 +01:00
2023-03-17 08:45:06 +01:00
2021-04-07 15:00:14 +02:00
2020-10-13 09:17:34 -07:00
2020-11-02 12:14:19 -08:00
2021-07-20 16:05:58 +02:00
2020-10-25 14:51:49 -07:00
2021-01-09 13:46:24 +01:00
2020-08-12 10:58:02 -07:00
2021-02-03 23:28:37 +01:00
2022-07-21 21:20:11 +02:00
2020-10-05 13:37:03 +02:00
2020-08-12 10:58:01 -07:00
2023-03-11 16:39:59 +01:00
2021-09-03 10:09:31 +02:00
2023-01-14 10:15:20 +01:00
2021-03-25 09:04:11 +01:00
2021-03-25 09:04:11 +01:00
2023-02-01 08:23:22 +01:00
2020-09-01 09:58:03 +02:00
2023-01-14 10:15:51 +01:00
2023-02-01 08:23:21 +01:00
2020-10-29 17:22:59 -05:00
2023-03-11 16:39:19 +01:00
2021-01-09 13:46:24 +01:00
2022-08-21 15:16:05 +02:00
2022-06-09 10:20:49 +02:00
2020-10-16 11:11:19 -07:00
2020-11-14 11:26:03 -08:00
2023-01-14 10:15:22 +01:00
2023-03-11 16:40:04 +01:00
2022-04-08 14:40:03 +02:00
2022-06-09 10:21:01 +02:00
2020-08-07 11:33:25 -07:00
2021-08-18 08:59:06 +02:00
2023-01-04 11:39:23 +01:00
2022-04-20 09:23:29 +02:00
2021-07-14 16:55:50 +02:00
2020-09-16 15:18:56 +02:00
2022-02-23 12:01:00 +01:00
2020-09-18 14:24:16 +01:00
2021-09-08 08:49:00 +02:00
2020-10-26 12:12:27 +01:00
2022-08-31 17:15:13 +02:00
2023-01-24 07:19:58 +01:00
2023-02-01 08:23:18 +01:00
2023-01-04 11:39:23 +01:00
2020-10-02 19:11:12 -07:00
2021-09-03 10:09:30 +02:00
2022-01-27 10:54:33 +01:00
2021-09-08 08:49:00 +02:00
2020-10-06 10:31:52 -07:00
2021-05-14 09:50:46 +02:00
2021-09-08 08:49:00 +02:00
2021-03-30 14:32:03 +02:00
2023-03-17 08:45:13 +01:00
2022-08-25 11:38:20 +02:00
2022-09-28 11:10:40 +02:00