Adrian Hunter
70df07838f
perf header: Fix segfault on build_mem_topology() error path
...
Do not increase the node count unless a node has been successfully read,
because it can lead to a segfault if an error occurs.
For example, if perf exceeds the open file limit in memory_node__read(),
which, on a test system, could be made to happen by setting the file limit
to exactly 32:
Before:
$ ulimit -n 32
$ perf mem record --all-user -- sleep 1
[ perf record: Woken up 1 times to write data ]
failed: can't open memory sysfs data
perf: Segmentation fault
Obtained 14 stack frames.
perf(sighandler_dump_stack+0x48) [0x55f4b1f59558]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f4ba1c42520]
/lib/x86_64-linux-gnu/libc.so.6(free+0x1e) [0x7f4ba1ca53fe]
perf(+0x178ff4) [0x55f4b1f48ff4]
perf(+0x179a70) [0x55f4b1f49a70]
perf(+0x17ef5d) [0x55f4b1f4ef5d]
perf(+0x85c0b) [0x55f4b1e55c0b]
perf(cmd_record+0xe1d) [0x55f4b1e5920d]
perf(cmd_mem+0xc96) [0x55f4b1e80e56]
perf(+0x130460) [0x55f4b1f00460]
perf(main+0x689) [0x55f4b1e427d9]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f4ba1c29d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f4ba1c29e40]
perf(_start+0x25) [0x55f4b1e42a25]
Segmentation fault (core dumped)
$
After:
$ ulimit -n 32
$ perf mem record --all-user -- sleep 1
[ perf record: Woken up 1 times to write data ]
failed: can't open memory sysfs data
[ perf record: Captured and wrote 0.005 MB perf.data (11 samples) ]
$
Fixes: f8e502b9d1 ("perf header: Ensure bitmaps are freed")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Ian Rogers <irogers@google.com >
Cc: German Gomez <german.gomez@arm.com >
Cc: Ian Rogers <irogers@google.com >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lore.kernel.org/r/20231123075848.9652-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-11-27 15:38:45 -03:00
..
2023-06-21 08:53:31 -06:00
2023-10-25 10:02:55 -07:00
2023-06-12 18:18:13 -03:00
2022-10-15 10:13:16 -03:00
2022-10-25 17:40:48 -03:00
2023-10-17 12:40:50 -07:00
2023-08-16 08:48:06 -03:00
2023-08-16 08:46:45 -03:00
2023-11-27 10:21:27 -03:00
2023-06-12 15:57:53 -03:00
2023-06-12 15:57:53 -03:00
2022-12-05 09:29:06 -03:00
2019-11-28 08:08:38 -03:00
2023-08-23 08:41:52 -03:00
2023-11-10 09:03:48 -03:00
2023-11-10 09:03:48 -03:00
2022-04-09 12:34:29 -03:00
2022-10-27 16:37:26 -03:00
2023-06-12 15:57:53 -03:00
2023-10-17 12:40:50 -07:00
2023-11-27 10:21:27 -03:00
2023-11-27 10:21:27 -03:00
2023-11-09 13:49:33 -03:00
2020-03-09 21:43:25 -03:00
2023-11-09 13:49:33 -03:00
2023-01-04 10:52:07 -03:00
2023-10-12 10:01:57 -07:00
2023-01-10 10:51:39 -03:00
2022-04-01 16:19:35 -03:00
2023-09-18 15:38:46 -07:00
2022-10-31 11:06:46 -03:00
2023-09-12 17:32:00 -03:00
2022-01-12 17:01:38 -08:00
2022-10-27 16:37:26 -03:00
2023-10-25 13:38:33 -07:00
2023-11-09 13:49:33 -03:00
2022-10-04 08:55:19 -03: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-09-12 17:50:36 -03:00
2022-10-31 11:05:41 -03:00
2022-06-28 12:05:25 -03:00
2021-11-01 18:16:40 -03:00
2023-10-25 13:38:50 -07:00
2023-10-25 13:38:50 -07:00
2023-11-10 09:03:54 -03:00
2023-08-25 10:24:10 -03:00
2022-07-20 11:07:53 -03:00
2023-05-28 10:24:14 -03:00
2019-08-29 17:38:32 -03:00
2023-02-16 09:33:45 -03:00
2019-07-09 10:13:27 -03:00
2021-03-23 17:13:43 -03:00
2023-10-27 19:26:13 -07:00
2023-10-25 13:39:32 -07:00
2019-08-14 10:48:39 -03:00
2020-04-16 12:19:08 -03:00
2023-09-12 17:32:00 -03:00
2023-09-12 17:32:00 -03:00
2020-08-06 09:33:57 -03:00
2020-08-06 09:33:57 -03:00
2023-03-14 08:29:46 -03:00
2019-08-31 22:24:10 -03:00
2019-08-31 22:24:10 -03:00
2019-07-09 10:13:26 -03:00
2023-08-15 16:41:48 -03:00
2022-10-04 08:55:21 -03:00
2019-10-15 12:05:18 -03:00
2019-09-25 09:51:49 -03:00
2022-10-27 16:37:25 -03:00
2022-10-27 16:37:25 -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
2023-11-27 10:21:27 -03:00
2023-10-17 12:40:50 -07:00
2023-01-19 13:26:28 -03:00
2023-06-12 15:57:53 -03:00
2021-04-29 10:30:58 -03:00
2023-10-25 10:02:11 -07:00
2022-07-25 18:10:43 -03:00
2023-06-12 15:57:54 -03:00
2021-05-25 10:07:17 -03:00
2023-01-19 13:26:49 -03:00
2021-08-03 17:03:18 -03:00
2023-11-10 09:03:54 -03:00
2023-11-10 09:03:54 -03:00
2023-03-20 12:49:58 -03:00
2023-03-14 08:29:46 -03:00
2021-03-23 17:13:43 -03:00
2021-03-30 12:45:59 -03:00
2021-02-17 15:15:06 -03:00
2019-09-20 09:19:20 -03:00
2023-10-30 13:46:27 -07:00
2021-08-11 09:35:44 -03:00
2023-10-04 22:28:07 -07:00
2023-10-04 22:28:07 -07:00
2023-04-17 18:47:55 -03:00
2019-11-19 19:12:26 -03:00
2023-11-10 09:04:12 -03:00
2023-11-10 09:04:12 -03:00
2023-05-01 17:19:59 +08:00
2023-11-10 08:31:13 -03:00
2023-11-10 08:31:13 -03:00
2023-11-09 13:49:32 -03:00
2023-07-28 19:01:16 -03:00
2022-10-04 08:55:20 -03:00
2023-09-26 21:43:20 -07:00
2023-09-12 17:31:32 -03:00
2020-05-28 10:03:24 -03:00
2023-06-12 15:57:54 -03:00
2023-05-12 15:21:49 -03:00
2023-11-09 13:47:50 -03:00
2023-11-09 13:47:50 -03:00
2020-11-30 09:48:07 -03:00
2023-01-23 10:00:47 -03:00
2023-09-15 16:46:40 -07:00
2023-08-17 14:12:14 -03:00
2023-08-17 14:12:14 -03:00
2023-09-12 17:46:50 -03:00
2019-11-28 08:08:38 -03:00
2019-11-28 08:08:38 -03:00
2023-03-13 14:52:14 -03:00
2023-06-20 22:18:58 -07:00
2022-10-04 08:55:22 -03:00
2023-05-01 17:19:59 +08:00
2023-01-02 11:51:53 -03:00
2021-08-30 10:06:16 -03:00
2019-07-09 10:13:26 -03:00
2022-11-09 20:45:14 -08:00
2023-09-11 10:31:02 -03:00
2023-11-27 15:38:45 -03:00
2023-05-23 12:20:14 -03:00
2023-06-12 18:18:14 -03:00
2023-10-04 22:28:07 -07:00
2022-10-15 10:13:16 -03:00
2023-10-25 13:39:58 -07:00
2023-03-20 19:28:21 -03:00
2023-06-12 15:57:53 -03:00
2019-06-05 17:36:37 +02:00
2023-09-29 23:59:08 -07:00
2023-10-17 12:40:50 -07:00
2021-02-08 17:02:00 -03:00
2021-02-08 17:02:00 -03:00
2022-11-24 09:40:37 -03:00
2022-11-24 09:40:37 -03:00
2021-02-03 13:10:44 -03:00
2023-10-12 10:01:56 -07:00
2020-05-28 10:03:27 -03:00
2023-03-21 10:06:05 -03:00
2023-09-12 17:31:59 -03:00
2021-03-23 17:13:43 -03:00
2023-09-12 17:32:00 -03:00
2023-08-22 16:53:32 -03:00
2023-11-09 13:49:32 -03:00
2023-10-25 13:38:09 -07:00
2023-10-25 13:39:58 -07:00
2023-10-25 13:39:58 -07:00
2023-06-23 21:47:20 -07:00
2023-06-23 21:47:20 -07:00
2023-06-12 15:57:54 -03:00
2023-06-12 15:57:53 -03:00
2020-11-04 09:42:40 -03:00
2019-08-31 19:10:40 -03:00
2023-10-12 10:01:56 -07:00
2023-08-25 10:22:16 -03:00
2019-09-20 09:19:22 -03:00
2023-09-27 21:01:46 -07:00
2023-06-16 09:56:36 -03:00
2022-12-05 09:29:06 -03:00
2022-10-31 11:07:14 -03:00
2022-10-04 08:55:20 -03:00
2022-10-04 08:55:20 -03:00
2023-04-17 22:22:24 -03:00
2023-04-17 18:51:57 -03:00
2022-06-28 11:45:45 -03:00
2023-04-06 21:41:00 -03:00
2022-07-20 11:07:30 -03:00
2023-11-09 13:47:50 -03:00
2023-11-27 10:21:27 -03:00
2023-09-11 10:26:36 -03:00
2023-10-12 10:01:55 -07:00
2023-10-12 10:01:55 -07:00
2020-12-17 14:36:16 -03:00
2020-08-14 09:15:47 -03:00
2021-08-24 15:01:31 -03:00
2023-05-28 10:24:14 -03:00
2022-04-11 16:39:49 -03:00
2022-08-10 14:30:09 -03:00
2021-06-01 10:32:00 -03:00
2023-11-09 13:47:50 -03:00
2023-08-16 08:49:10 -03:00
2023-08-16 08:52:45 -03:00
2019-09-20 09:19:20 -03:00
2023-01-02 12:34:06 -03:00
2023-09-12 17:32:00 -03:00
2022-11-24 10:04:52 -03:00
2023-11-27 10:21:27 -03:00
2023-11-27 10:21:27 -03:00
2023-04-06 21:40:28 -03:00
2023-09-12 17:47:00 -03:00
2023-09-29 22:50:42 -07:00
2023-08-29 14:16:14 -03:00
2020-10-01 12:10:56 -03:00
2023-09-12 17:32:00 -03:00
2023-08-29 14:16:14 -03:00
2023-08-07 16:40:29 -03:00
2023-08-07 16:40:29 -03:00
2021-07-18 09:27:37 -03:00
2019-11-18 19:08:02 -03:00
2023-11-10 09:04:21 -03:00
2023-11-10 09:03:54 -03:00
2020-05-28 10:03:27 -03:00
2023-10-27 19:23:52 -07:00
2023-10-17 12:40:50 -07:00
2019-06-05 17:37:04 +02:00
2022-12-14 15:28:18 -03:00
2023-03-13 14:52:14 -03:00
2023-10-25 10:02:11 -07:00
2023-10-25 10:02:11 -07:00
2023-10-25 13:35:35 -07:00
2023-10-25 13:35:35 -07:00
2023-11-15 12:51:53 -05:00
2022-10-31 11:06:41 -03:00
2023-11-27 15:38:37 -03:00
2021-09-10 18:15:21 -03:00
2021-09-10 18:15:21 -03:00
2023-11-09 13:47:50 -03:00
2023-11-09 13:49:32 -03:00
2022-12-14 11:16:12 -03:00
2019-07-09 10:13:26 -03:00
2023-08-03 17:01:28 -03:00
2023-06-20 17:03:43 -07:00
2023-06-20 17:03:43 -07:00
2022-04-01 16:19:35 -03:00
2023-02-19 08:03:12 -03:00
2023-02-19 08:03:12 -03:00
2023-11-09 13:49:33 -03:00
2023-03-20 19:28:21 -03:00
2019-10-11 10:57:00 -03:00
2019-10-11 10:57:00 -03:00
2021-06-08 09:36:36 -03:00
2023-06-15 21:54:02 -03:00
2023-06-14 18:19:06 -03:00
2023-08-21 10:54:22 -03:00
2023-06-16 09:57:19 -03:00
2023-07-24 18:23:18 -03:00
2023-06-16 10:17:45 -03:00
2019-08-31 19:10:19 -03:00
2021-03-23 17:13:43 -03:00
2021-07-09 14:04:28 -03:00
2020-10-14 13:34:26 -03:00
2023-04-06 21:41:00 -03:00
2021-03-23 17:13:43 -03:00
2023-09-12 17:32:00 -03:00
2023-09-12 17:32:00 -03:00
2019-07-09 10:13:26 -03:00
2023-10-12 10:01:56 -07:00
2019-08-29 17:38:31 -03:00
2023-11-09 13:49:32 -03:00
2023-06-23 21:47:20 -07:00
2023-10-04 22:28:07 -07:00
2022-12-21 14:52:40 -03:00
2023-10-25 13:39:58 -07:00
2023-06-23 21:47:20 -07:00
2023-02-01 21:51:51 -03:00
2023-08-29 14:16:14 -03:00
2022-08-19 12:26:58 -03:00
2023-06-05 11:36:17 -03:00
2020-05-29 16:50:26 -03:00
2021-01-20 14:25:28 -03:00
2023-05-27 09:38:59 -03:00
2022-11-16 12:17:15 -03:00
2022-11-16 12:17:15 -03:00
2023-08-14 11:46:51 +02:00
2021-03-25 08:59:10 -03:00
2023-07-20 11:22:46 -03:00
2023-11-09 13:49:32 -03:00
2019-10-15 08:36:22 -03:00
2019-10-15 08:36:22 -03:00
2022-06-23 11:54:22 -03:00
2023-04-10 19:22:05 -03:00
2022-10-04 08:55:20 -03:00
2023-02-19 08:07:24 -03:00
2023-02-19 08:07:24 -03:00
2023-10-12 10:01:57 -07:00
2022-12-14 11:16:12 -03:00
2022-12-14 11:16:12 -03:00
2023-03-15 10:27:07 -03:00
2022-12-14 11:16:12 -03:00
2023-06-23 22:30:16 -07:00
2023-05-02 08:36:14 -03:00
2022-08-02 16:32:26 -03:00
2019-08-29 17:38:32 -03:00
2021-04-29 10:31:00 -03:00
2022-07-25 12:28:00 -03:00
2021-03-15 11:36:54 -03:00
2021-03-15 11:36:54 -03:00
2023-08-16 08:48:06 -03:00
2022-04-09 12:34:29 -03:00
2023-08-16 08:48:06 -03: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
2019-08-31 19:10:19 -03:00
2023-06-12 15:57:53 -03:00
2019-09-20 09:19:20 -03:00
2020-09-01 12:15:21 -03:00