Arnaldo Carvalho de Melo
769a0f187b
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 >
2025-04-10 14:37:34 +02:00
..
2023-06-21 08:53:31 -06:00
2024-04-27 17:11:34 +02:00
2023-06-12 18:18:13 -03:00
2024-06-12 11:12:23 +02:00
2023-08-16 08:48:06 -03:00
2023-08-16 08:46:45 -03:00
2023-08-03 17:01:28 -03:00
2023-06-12 15:57:53 -03:00
2023-06-12 15:57:53 -03:00
2023-08-23 08:41:52 -03:00
2024-10-04 16:29:24 +02:00
2024-10-04 16:29:24 +02:00
2025-04-10 14:37:33 +02:00
2024-06-21 14:38:39 +02:00
2023-02-17 11:02:44 -03:00
2024-10-04 16:29:24 +02:00
2024-10-04 16:29:24 +02:00
2023-04-04 09:39:56 -03:00
2023-04-11 09:22:25 -03:00
2023-04-06 22:10:17 -03:00
2023-11-20 11:59:25 +01:00
2025-02-08 09:52:05 +01:00
2024-01-25 15:35:54 -08:00
2023-08-15 16:41:48 -03:00
2023-03-15 11:08:36 -03:00
2023-03-15 11:08:36 -03:00
2023-08-03 17:01:24 -03:00
2023-08-16 08:37:52 -03:00
2023-08-25 10:24:10 -03:00
2023-05-28 10:24:14 -03:00
2023-02-16 09:33:45 -03:00
2024-08-11 12:47:18 +02:00
2023-06-12 15:57:54 -03:00
2023-03-14 08:29:46 -03:00
2023-08-15 16:41:48 -03:00
2023-05-27 09:38:25 -03:00
2023-05-27 09:38:25 -03:00
2023-05-27 09:42:38 -03:00
2023-02-19 08:03:12 -03:00
2023-04-04 09:39:56 -03:00
2024-12-09 10:32:23 +01:00
2023-06-12 18:18:13 -03:00
2023-06-12 15:57:53 -03:00
2024-03-26 18:19:43 -04:00
2024-01-25 15:35:55 -08:00
2023-03-20 12:49:58 -03:00
2023-03-14 08:29:46 -03:00
2023-09-29 23:55:05 -07:00
2023-06-23 21:47:20 -07:00
2023-06-23 21:47:20 -07:00
2023-04-17 18:47:55 -03:00
2023-07-11 11:41:07 -03:00
2023-05-01 17:19:59 +08:00
2025-02-08 09:52:05 +01:00
2025-02-08 09:52:05 +01:00
2024-06-12 11:12:15 +02:00
2023-07-28 19:01:16 -03:00
2025-04-10 14:37:33 +02:00
2024-12-09 10:32:24 +01:00
2023-06-12 15:57:54 -03:00
2023-05-12 15:21:49 -03:00
2024-03-26 18:19:44 -04:00
2023-07-01 17:57:43 -07:00
2025-02-08 09:52:05 +01:00
2023-08-17 14:12:14 -03:00
2023-08-17 14:12:14 -03:00
2023-08-17 14:12:14 -03:00
2023-03-13 14:52:14 -03:00
2023-06-20 22:18:58 -07:00
2024-01-25 15:35:52 -08:00
2023-05-01 17:19:59 +08:00
2023-09-11 10:31:02 -03:00
2025-02-08 09:52:05 +01:00
2023-05-23 12:20:14 -03:00
2023-06-12 18:18:14 -03:00
2024-01-25 15:35:52 -08:00
2024-10-10 11:58:09 +02:00
2024-10-04 16:29:24 +02:00
2023-06-12 15:57:53 -03:00
2024-06-12 11:12:23 +02:00
2023-06-12 15:57:54 -03:00
2023-03-21 10:06:05 -03:00
2023-04-06 21:52:37 -03:00
2023-08-22 16:53:32 -03:00
2025-02-08 09:52:07 +01:00
2023-06-23 21:47:20 -07:00
2023-06-23 21:47:20 -07:00
2024-06-12 11:12:29 +02:00
2024-06-12 11:12:29 +02:00
2024-01-25 15:35:51 -08:00
2023-08-25 10:22:16 -03:00
2023-12-13 18:45:34 +01:00
2023-06-16 09:56:36 -03:00
2025-02-08 09:52:07 +01:00
2025-02-08 09:52:07 +01:00
2023-04-06 21:41:00 -03:00
2023-09-02 08:12:15 -03:00
2023-09-02 08:12:15 -03:00
2023-08-31 16:24:55 -03:00
2023-11-20 11:59:28 +01:00
2023-05-28 10:24:14 -03:00
2024-06-12 11:12:32 +02:00
2023-08-16 08:49:10 -03:00
2023-08-16 08:52:45 -03:00
2024-12-09 10:32:28 +01:00
2025-04-10 14:37:32 +02:00
2025-04-10 14:37:32 +02:00
2023-04-06 21:40:28 -03:00
2023-08-24 10:38:04 -03:00
2025-04-10 14:37:32 +02:00
2023-08-29 14:16:14 -03:00
2024-03-26 18:19:51 -04:00
2023-08-29 14:16:14 -03:00
2024-06-12 11:12:13 +02:00
2023-08-07 16:40:29 -03:00
2024-12-09 10:32:25 +01:00
2024-12-09 10:32:25 +01:00
2023-08-16 08:37:52 -03:00
2025-04-10 14:37:34 +02:00
2023-03-13 14:52:14 -03:00
2023-08-29 14:16:14 -03:00
2023-03-20 19:27:00 -03:00
2024-10-04 16:29:23 +02:00
2024-10-10 11:58:09 +02:00
2023-06-20 17:03:43 -07:00
2023-06-20 17:03:43 -07:00
2023-02-19 08:03:12 -03:00
2023-02-19 08:03:12 -03:00
2024-10-04 16:29:23 +02:00
2023-03-20 19:28:21 -03:00
2024-03-26 18:19:47 -04:00
2023-06-14 18:19:06 -03:00
2024-10-04 16:29:24 +02:00
2025-04-10 14:37:32 +02:00
2023-07-24 18:23:18 -03:00
2023-06-16 10:17:45 -03:00
2023-04-06 21:41:00 -03:00
2024-06-12 11:13:02 +02:00
2024-06-12 11:13:02 +02:00
2023-08-29 14:13:48 -03:00
2024-06-12 11:12:16 +02:00
2023-06-23 21:47:20 -07:00
2023-08-11 11:27:50 -03:00
2024-06-12 11:12:29 +02:00
2024-06-12 11:12:29 +02:00
2023-08-29 14:16:14 -03:00
2023-06-05 11:36:17 -03:00
2023-05-27 09:38:59 -03:00
2024-03-26 18:19:46 -04:00
2023-08-14 11:46:51 +02:00
2024-10-10 12:49:09 +02:00
2024-10-10 12:49:09 +02:00
2024-10-04 16:29:24 +02:00
2024-10-04 16:29:23 +02:00
2023-04-10 19:22:05 -03:00
2024-06-12 11:12:16 +02:00
2023-02-19 08:07:24 -03:00
2023-02-19 08:07:24 -03:00
2023-06-23 22:30:16 -07:00
2023-03-15 10:27:07 -03:00
2023-06-23 22:30:16 -07:00
2023-05-02 08:36:14 -03:00
2025-04-10 14:37:33 +02:00
2024-01-25 15:35:53 -08:00
2024-01-25 15:35:53 -08:00
2023-06-12 15:57:53 -03:00
2023-08-16 08:48:06 -03:00
2023-04-10 19:20:53 -03:00
2023-04-10 19:21:31 -03:00
2023-04-10 19:22:05 -03:00
2023-06-12 15:57:53 -03:00