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