summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-ftrace.c
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2022-10-24 11:19:09 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-11-03 09:36:09 -0300
commit853596fb71f7c2f7ff0de7b13f09d6598d4d56cd (patch)
treeb758f20e034ce623b724387b589b7e1e836d5eaf /tools/perf/builtin-ftrace.c
parent7f3374299f9762ba7946138bf0d5cfbd50da111b (diff)
perf ftrace: Use sig_atomic_t to avoid UB
Use sig_atomic_t for a variable written to in a signal handler and read elsewhere. This is undefined behavior as per: https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlers Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Cc: German Gomez <german.gomez@arm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: https://lore.kernel.org/r/20221024181913.630986-5-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-ftrace.c')
-rw-r--r--tools/perf/builtin-ftrace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 7de07bb16d23..d7fe00f66b83 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -36,8 +36,8 @@
#define DEFAULT_TRACER "function_graph"
-static volatile int workload_exec_errno;
-static bool done;
+static volatile sig_atomic_t workload_exec_errno;
+static volatile sig_atomic_t done;
static void sig_handler(int sig __maybe_unused)
{