Skip to content

Commit 1eb27e1

Browse files
jeplerdpgeorge
authored andcommitted
unix/README: Add some small documentation about sanitizers.
Signed-off-by: Jeff Epler <jepler@gmail.com>
1 parent 07c3bf2 commit 1eb27e1

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

ports/unix/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,21 @@ 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. The CI process
162+
supports building with the "undefined behavior" (UBSan) or "address" (ASan)
163+
sanitizers. The script `tools/ci.sh` is the source of truth about how to build
164+
and run in these modes.
165+
166+
Several classes of checks are disabled via compiler flags:
167+
168+
* In the undefined behavior sanitizer, checks based on the presence of the
169+
`non_null` attribute are disabled because the code makes technically incorrect
170+
calls like `memset(NULL, 0, 0)`. A future C standard is likely to permit such
171+
calls.
172+
* In the address sanitizer, `detect_stack_use_after_return` is disabled. This
173+
check is intended to make sure locals in a "returned from" stack frame are not
174+
used. However, this mode interferes with various assumptions that
175+
MicroPython's stack checking, NLR, and GC rely on.

0 commit comments

Comments
 (0)