diff options
author | Ian Rogers <[email protected]> | 2022-10-24 11:19:08 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2022-11-03 09:35:44 -0300 |
commit | 7f3374299f9762ba7946138bf0d5cfbd50da111b (patch) | |
tree | df068168d2958949fe0c58ec48115b112a94523d | |
parent | 8ed28c2b56b78442989ef1afee2b968e9d51a65c (diff) |
perf daemon: 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 <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Alexey Bayduraev <[email protected]>
Cc: German Gomez <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/builtin-daemon.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c index 3ce0c960ccc9..7036ec92d47d 100644 --- a/tools/perf/builtin-daemon.c +++ b/tools/perf/builtin-daemon.c @@ -105,7 +105,7 @@ static const char * const daemon_usage[] = { NULL }; -static bool done; +static volatile sig_atomic_t done; static void sig_handler(int sig __maybe_unused) { |