aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/intel-pt-events.py
diff options
context:
space:
mode:
authorHangliang Lai <[email protected]>2023-04-11 09:32:24 +0800
committerArnaldo Carvalho de Melo <[email protected]>2023-04-12 10:36:14 -0300
commiteab5051788f6111adb88268a784af0c981616579 (patch)
tree8b340c7a1a117c8bac17f69112e560d076ff59b1 /tools/perf/scripts/python/intel-pt-events.py
parented4da0d3de1e1781f8fbdc9cf1028b39cc658c7f (diff)
perf top: Expand the range of multithreaded phase
In __cmd_top(), perf_set_multithreaded() is used to enable pthread_rwlock, thus down_read() and down_write () are not nops, handling concurrency problems Then 'perf top' uses perf_set_singlethreaded(), switching to the single threaded phase, assuming that no thread concurrency will happen later. However, a use after free problem could occur in the single threaded phase, the concurrent procedure is this: display_thread process_thread -------------- -------------- thread__comm_len -> thread__comm_str -> __thread__comm_str(thread) thread__delete -> comm__free -> comm_str__put -> zfree(&cs->str) -> thread->comm_len = strlen(comm); Since in single thread phase, perf_singlethreaded is true, down_read() and down_write() do nothing to avoid concurrency problems. This patch moves the perf_set_singlethreaded() call to the function tail to expand the multithreaded phase range, making display_thread() and process_thread() concurrency safe. Reviewed-by: Yunfeng Ye <[email protected]> Signed-off-by: Hangliang Lai <[email protected]> Co-developed-by: Wenyu Liu <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Feilong Lin <[email protected]> Cc: Hewenliang <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/intel-pt-events.py')
0 files changed, 0 insertions, 0 deletions