Skip to content

Update to C11, fix signal undefined behavior

Ian Rogers linux-perf-users lkml 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest8 patches 1 replyIn review
  2. v18 patches 6 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8perf build: Update to C standard to gnu11tools/perf/Makefile.config+1 -10 replies
2/8perf record: Use sig_atomic_t for signal handlerstools/perf/builtin-record.c+4 -40 replies
3/8perf daemon: Use sig_atomic_t to avoid UBtools/perf/builtin-daemon.c+1 -10 replies
4/8perf ftrace: Use sig_atomic_t to avoid UBtools/perf/builtin-ftrace.c+2 -20 replies
5/8perf session: Change type to avoid UBtools/perf/util/session.c+2 -10 replies
6/8perf stat: Use sig_atomic_t to avoid UBtools/perf/builtin-stat.c+4 -40 replies
7/8perf top: Use sig_atomic_t to avoid UBtools/perf/builtin-top.c+2 -20 replies
8/8perf trace: Use sig_atomic_t to avoid UBtools/perf/builtin-trace.c+2 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/8] Update to C11, fix signal undefined behavior

The use of C11 is mainstream in the kernel [1]. There was some confusion on volatile and signal handlers in [2] for which atomics (present in C11) make things clearer. Switch to using volatile sig_atomic_t as per [3]. Thanks to Leo Yan <[email protected]> for the suggestions.

[1] https://lore.kernel.org/lkml/CAHk-=whWbENRz-vLY6vpESDLj6kGUTKO3khGtVfipHqwewh2HQ@mail.gmail.com/
[2] https://lore.kernel.org/lkml/[email protected]/
[3] https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlers

v2. Remove unneeded stdatomic.h includes for sig_atomic_t as it is
declared in signal.h.

Ian Rogers (8):
perf build: Update to C standard to gnu11 perf record: Use sig_atomic_t for signal handlers perf daemon: Use sig_atomic_t to avoid UB perf ftrace: Use sig_atomic_t to avoid UB perf session: Change type to avoid UB perf stat: Use sig_atomic_t to avoid UB perf top: Use sig_atomic_t to avoid UB perf trace: Use sig_atomic_t to avoid UB

 tools/perf/Makefile.config  | 2 +-
 tools/perf/builtin-daemon.c | 2 +-
 tools/perf/builtin-ftrace.c | 4 ++--
 tools/perf/builtin-record.c | 8 ++++----
 tools/perf/builtin-stat.c   | 8 ++++----
 tools/perf/builtin-top.c    | 4 ++--
 tools/perf/builtin-trace.c  | 4 ++--
 tools/perf/util/session.c   | 3 ++-
 8 files changed, 18 insertions(+), 17 deletions(-)
Signature · 1 line
2.38.0.135.g90850a2211-goog