Skip to content

Commit 264ed6c

Browse files
committed
unix: Add some small documentation of sanitizers.
Signed-off-by: Jeff Epler <jepler@gmail.com>
1 parent 34c547f commit 264ed6c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

ports/unix/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,13 @@ The default compiler optimisation level is -Os, or -Og if `DEBUG=1` is set.
155155
Setting the variable `COPT` will explicitly set the optimisation level. For
156156
example `make [other arguments] COPT=-O0 DEBUG=1` will build a binary with no
157157
optimisations, assertions enabled, and debug symbols.
158+
159+
### Sanitizers
160+
161+
Sanitizers are extra runtime checks supported by gcc and clang.
162+
The CI process supports building with the "undefined behavior" (UBSan) or "address" (ASan) sanitizers.
163+
The script `tools/ci.sh` is the source of truth about how to build & run in these modes.
164+
165+
Several classes of checks are disabled via compiler flags:
166+
* In the undefined behavior sanitizer, checks based on the presence of the `non_null` attribute are disabled because we make technically incorrect calls like `memset(NULL, 0, 0)`. A future C standard is likely to permit such calls.
167+
* In the address sanitizer, `detect_stack_use_after_return` is disabled. This check is intended to make sure locals in a "returned from" stack frame are not used. However, this mode interferes with various assumptions that MicroPython's stack checking, NLR, and GC rely on.

0 commit comments

Comments
 (0)