[PATCH] D77219: UBSan ␇ runtime

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 1 07:52:52 PDT 2020


jfb created this revision.
Herald added subscribers: Sanitizers, cfe-commits, ributzka, dexonsmith, jkorous, cryptoad, mgorny.
Herald added projects: clang, Sanitizers.
jfb edited the summary of this revision.

Yes, this is April 1st and the patch isn't particularly serious.

There is a ␇ UBSan runtime available. It is named in honor of Bell Labs (who
gave us the C programming language and Undefined Behavior), the ASCII "bell"
character (value `07`), and famed violinist Joshua Bell. It is not related to
the city of Bell in California. This runtime will emit sound, most traditionally
the terminal's bell sound, when undefined behavior occurs.

To use the minimal runtime, add `-fsanitize-bel-runtime` to the clang command
line options. For example, if you're used to compiling with
`-fsanitize=undefined`, you could enable the minimal runtime with
`-fsanitize=undefined -fsanitize-bel-runtime`.

When combined with `-fsanitize-recover=undefined`, the ␇ runtime will simply
chime on Undefined Behavior without killing the program for each chime. To avoid
Pavlovian effects, the ␇ runtime uses Advanced Compiler Techniques called
"heuristics" to avoid chiming too often at the same location.

On macOS, the ␇ runtime will helpfully announce what specific undefined behavior
you've encountered, and then taunt you.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77219

Files:
  clang/docs/UndefinedBehaviorSanitizer.rst
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/include/clang/Driver/SanitizerArgs.h
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/Driver/SanitizerArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/unsigned-overflow-bel.c
  clang/test/Driver/fsanitize.c
  clang/test/Driver/sanitizer-ld.c
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/lib/ubsan_bel/CMakeLists.txt
  compiler-rt/lib/ubsan_bel/ubsan.syms.extra
  compiler-rt/lib/ubsan_bel/ubsan_bel_handlers.cpp
  compiler-rt/test/ubsan_bel/CMakeLists.txt
  compiler-rt/test/ubsan_bel/TestCases/alignment-assumption.c
  compiler-rt/test/ubsan_bel/TestCases/implicit-integer-sign-change.c
  compiler-rt/test/ubsan_bel/TestCases/implicit-signed-integer-truncation-or-sign-change.c
  compiler-rt/test/ubsan_bel/TestCases/implicit-signed-integer-truncation.c
  compiler-rt/test/ubsan_bel/TestCases/implicit-unsigned-integer-truncation.c
  compiler-rt/test/ubsan_bel/TestCases/nullptr-and-nonzero-offset.c
  compiler-rt/test/ubsan_bel/TestCases/recover-dedup-limit.cpp
  compiler-rt/test/ubsan_bel/TestCases/recover-dedup.cpp
  compiler-rt/test/ubsan_bel/TestCases/test-darwin-interface.c
  compiler-rt/test/ubsan_bel/TestCases/uadd-overflow.cpp
  compiler-rt/test/ubsan_bel/lit.common.cfg.py
  compiler-rt/test/ubsan_bel/lit.site.cfg.py.in

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77219.254199.patch
Type: text/x-patch
Size: 42001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200401/2ddc0d7a/attachment-0001.bin>


More information about the cfe-commits mailing list