Commit 8ed28c2b authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf record: Use sig_atomic_t for signal handlers

This removes undefined behavior as described in:

  https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlersSuggested-by: default avatarLeo Yan <leo.yan@linaro.org>
Signed-off-by: default avatarIan 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: 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-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f3c9bd4e
...@@ -646,10 +646,10 @@ static int record__pushfn(struct mmap *map, void *to, void *bf, size_t size) ...@@ -646,10 +646,10 @@ static int record__pushfn(struct mmap *map, void *to, void *bf, size_t size)
return record__write(rec, map, bf, size); return record__write(rec, map, bf, size);
} }
static volatile int signr = -1; static volatile sig_atomic_t signr = -1;
static volatile int child_finished; static volatile sig_atomic_t child_finished;
#ifdef HAVE_EVENTFD_SUPPORT #ifdef HAVE_EVENTFD_SUPPORT
static volatile int done_fd = -1; static volatile sig_atomic_t done_fd = -1;
#endif #endif
static void sig_handler(int sig) static void sig_handler(int sig)
...@@ -1926,7 +1926,7 @@ static void record__read_lost_samples(struct record *rec) ...@@ -1926,7 +1926,7 @@ static void record__read_lost_samples(struct record *rec)
} }
static volatile int workload_exec_errno; static volatile sig_atomic_t workload_exec_errno;
/* /*
* evlist__prepare_workload will send a SIGUSR1 * evlist__prepare_workload will send a SIGUSR1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment