Arnaldo Carvalho de Melo
00607f23af
perf python: Check if there is space to copy all the event
...
[ Upstream commit 89aaeaf84231157288035b366cb6300c1c6cac64 ]
The pyrf_event__new() method copies the event obtained from the perf
ring buffer to a structure that will then be turned into a python object
for further consumption, so it copies perf_event.header.size bytes to
its 'event' member:
$ pahole -C pyrf_event /tmp/build/perf-tools-next/python/perf.cpython-312-x86_64-linux-gnu.so
struct pyrf_event {
PyObject ob_base; /* 0 16 */
struct evsel * evsel; /* 16 8 */
struct perf_sample sample; /* 24 312 */
/* XXX last struct has 7 bytes of padding, 2 holes */
/* --- cacheline 5 boundary (320 bytes) was 16 bytes ago --- */
union perf_event event; /* 336 4168 */
/* size: 4504, cachelines: 71, members: 4 */
/* member types with holes: 1, total: 2 */
/* paddings: 1, sum paddings: 7 */
/* last cacheline: 24 bytes */
};
$
It was doing so without checking if the event just obtained has more
than that space, fix it.
This isn't a proper, final solution, as we need to support larger
events, but for the time being we at least bounds check and document it.
Fixes: 877108e42b ("perf tools: Initial python binding")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Reviewed-by: Ian Rogers <irogers@google.com >
Link: https://lore.kernel.org/r/20250312203141.285263-7-acme@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
Signed-off-by: Ulrich Hecht <uli@kernel.org >
2025-05-08 11:55:42 +02:00
..
2018-06-25 11:59:37 -03:00
2020-12-30 11:25:49 +01:00
2017-11-02 11:10:55 +01:00
2023-08-11 11:45:20 +02:00
2017-11-02 11:10:55 +01:00
2020-11-18 19:18:52 +01:00
2019-11-06 13:05:44 +01:00
2018-08-30 15:51:54 -03:00
2018-01-17 10:23:31 -03:00
2018-01-17 10:23:31 -03:00
2018-01-17 10:23:31 -03:00
2018-01-17 10:23:31 -03:00
2023-05-17 11:13:21 +02:00
2019-03-23 20:10:11 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-08-08 15:55:58 -03:00
2018-08-08 15:55:58 -03:00
2018-06-15 18:10:01 -03:00
2017-11-02 11:10:55 +01:00
2017-07-18 23:14:40 -03:00
2017-07-25 22:46:35 -03:00
2021-03-24 11:07:32 +01:00
2019-04-20 09:15:57 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-02-20 10:25:39 +01:00
2019-02-20 10:25:39 +01:00
2018-06-04 10:28:50 -03:00
2018-03-07 10:22:26 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-07-24 14:54:03 -03:00
2017-11-02 11:10:55 +01:00
2018-08-20 08:54:59 -03:00
2019-04-20 09:15:57 +02:00
2018-05-16 16:11:09 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-10-01 13:14:39 +02:00
2017-11-02 11:10:55 +01:00
2020-12-30 11:25:49 +01:00
2020-12-30 11:25:49 +01:00
2017-11-02 11:10:55 +01:00
2019-06-22 08:15:18 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-01-23 09:48:20 -03:00
2017-11-07 10:30:18 +01:00
2018-04-27 10:47:06 -03:00
2018-03-16 16:39:02 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-04-19 13:01:51 -03:00
2021-07-28 11:13:47 +02:00
2020-06-22 09:05:30 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2023-08-11 11:45:09 +02:00
2019-12-31 16:36:37 +01:00
2017-11-02 11:10:55 +01:00
2023-02-06 07:49:41 +01:00
2018-05-22 10:52:49 -03:00
2021-03-04 09:39:46 +01:00
2018-05-23 10:26:39 -03:00
2019-01-26 09:32:41 +01:00
2018-05-21 14:40:54 -03:00
2017-11-07 10:30:18 +01:00
2024-03-26 18:22:38 -04:00
2018-08-08 15:55:47 -03:00
2017-11-02 11:10:55 +01:00
2021-03-24 11:07:32 +01:00
2017-11-02 11:10:55 +01:00
2017-06-19 15:27:07 -03:00
2024-01-25 14:33:38 -08:00
2022-09-28 11:02:57 +02:00
2018-04-12 10:33:31 -03:00
2021-03-24 11:07:32 +01:00
2017-11-02 11:10:55 +01:00
2019-10-11 18:21:28 +02:00
2018-07-30 13:15:03 -03:00
2017-11-02 11:10:55 +01:00
2019-11-12 19:20:37 +01:00
2021-12-08 08:50:12 +01:00
2018-11-21 09:19:19 +01:00
2022-10-26 13:19:42 +02:00
2017-11-02 11:10:55 +01:00
2017-11-07 10:30:18 +01:00
2019-10-17 13:45:15 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2023-03-11 16:31:42 +01:00
2018-08-20 08:54:58 -03:00
2021-07-28 11:13:47 +02:00
2021-09-22 11:48:11 +02:00
2019-08-16 10:12:41 +02:00
2021-08-04 12:23:47 +02:00
2018-08-08 15:56:00 -03:00
2020-10-01 13:14:43 +02:00
2018-03-16 13:52:37 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-10-01 13:14:46 +02:00
2018-07-24 14:49:37 -03:00
2018-08-20 08:54:59 -03:00
2018-08-20 08:54:59 -03:00
2018-12-17 09:24:33 +01:00
2018-12-17 09:24:33 +01:00
2017-11-17 12:14:09 -03:00
2017-11-17 12:14:09 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-10-01 13:14:49 +02:00
2018-05-30 10:40:44 -03:00
2018-06-06 12:52:04 -03:00
2021-03-24 11:07:32 +01:00
2020-12-30 11:26:05 +01:00
2017-11-02 11:10:55 +01:00
2017-12-27 12:15:48 -03:00
2017-12-27 12:15:48 -03:00
2017-11-02 11:10:55 +01:00
2020-01-04 19:13:14 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-09-23 12:11:00 +02:00
2020-09-23 12:11:00 +02:00
2020-11-05 11:08:52 +01:00
2017-11-07 10:30:18 +01:00
2022-02-16 12:51:45 +01:00
2017-11-02 11:10:55 +01:00
2021-07-28 11:13:47 +02:00
2017-11-02 11:10:55 +01:00
2024-12-05 10:59:35 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-27 12:15:56 -03:00
2025-05-08 11:55:42 +02:00
2017-11-07 10:30:18 +01:00
2017-12-05 10:24:31 -03:00
2017-12-05 10:24:31 -03:00
2018-03-05 11:52:41 -03:00
2017-09-21 13:28:06 -03:00
2017-09-21 13:28:06 -03:00
2018-08-08 15:26:48 -03:00
2019-04-05 22:33:07 +02:00
2018-08-03 10:34:18 -03:00
2017-11-02 11:10:55 +01:00
2021-06-16 11:55:01 +02:00
2017-11-18 08:59:27 +01:00
2017-07-18 23:14:08 -03:00
2018-10-05 11:11:55 -03:00
2017-08-22 12:09:04 -03:00
2017-08-22 12:09:04 -03:00
2024-08-19 05:31:59 +02:00
2018-08-10 15:29:35 -03:00
2020-07-22 09:31:58 +02:00
2018-01-08 11:11:57 -03:00
2020-03-05 16:42:22 +01:00
2020-07-22 09:32:06 +02:00
2019-10-11 18:21:29 +02:00
2020-01-04 19:13:24 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-27 12:15:55 -03:00
2017-12-27 12:15:55 -03:00
2017-04-24 13:43:33 -03:00
2017-11-02 11:10:55 +01:00
2019-01-26 09:32:40 +01:00
2017-11-02 11:10:55 +01:00
2021-05-22 10:59:34 +02:00
2023-05-17 11:13:25 +02:00
2018-04-27 10:47:06 -03:00
2022-03-23 09:10:45 +01:00
2019-08-16 10:12:41 +02:00
2018-07-24 14:53:01 -03:00
2017-11-02 11:10:55 +01:00
2017-12-27 12:15:47 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2024-03-26 18:22:39 -04:00
2018-02-27 11:29:21 -03:00
2018-11-21 09:19:19 +01:00
2018-11-21 09:19:19 +01:00
2019-08-16 10:12:41 +02:00
2019-01-09 17:38:42 +01:00
2024-11-08 16:19:07 +01:00
2018-01-17 10:23:36 -03:00
2018-01-10 12:00:55 -03:00
2018-06-04 10:28:52 -03:00
2018-11-13 11:08:22 -08:00
2018-11-13 11:08:22 -08:00
2021-03-17 16:43:44 +01:00
2018-08-10 15:29:35 -03:00
2018-08-13 15:22:18 -03:00
2018-08-13 15:21:43 -03:00
2018-03-06 11:31:14 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2025-05-08 11:55:42 +02:00
2017-11-02 11:10:55 +01:00
2018-11-27 16:12:59 +01:00
2017-11-02 11:10:55 +01:00
2018-07-24 14:53:11 -03:00
2017-12-27 12:15:52 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-05-17 16:31:32 -03:00
2021-03-24 11:07:32 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-04-26 13:47:15 -03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-10-05 13:09:47 +02:00
2018-08-20 08:54:59 -03:00