diff options
author | Jonathan Corbet <corbet@lwn.net> | 2016-08-07 17:35:42 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2016-08-18 19:41:51 -0400 |
commit | 1ead009cd622bc4c3c2cf1036d8e71d7f063838e (patch) | |
tree | 140ef5dfe5d551362f67de82028bad67d7937871 | |
parent | 2757aafad9ee7b8740042e5540b59422337344ab (diff) |
docs: sphinxify ubsan.txt and move it to dev-tools
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rw-r--r-- | Documentation/dev-tools/tools.rst | 1 | ||||
-rw-r--r-- | Documentation/dev-tools/ubsan.rst (renamed from Documentation/ubsan.txt) | 42 |
2 files changed, 24 insertions, 19 deletions
diff --git a/Documentation/dev-tools/tools.rst b/Documentation/dev-tools/tools.rst index 0500e6500255..2d1129789753 100644 --- a/Documentation/dev-tools/tools.rst +++ b/Documentation/dev-tools/tools.rst | |||
@@ -19,3 +19,4 @@ whole; patches welcome! | |||
19 | kcov | 19 | kcov |
20 | gcov | 20 | gcov |
21 | kasan | 21 | kasan |
22 | ubsan | ||
diff --git a/Documentation/ubsan.txt b/Documentation/dev-tools/ubsan.rst index f58215ef5797..655e6b63c227 100644 --- a/Documentation/ubsan.txt +++ b/Documentation/dev-tools/ubsan.rst | |||
@@ -1,7 +1,5 @@ | |||
1 | Undefined Behavior Sanitizer - UBSAN | 1 | The Undefined Behavior Sanitizer - UBSAN |
2 | 2 | ======================================== | |
3 | Overview | ||
4 | -------- | ||
5 | 3 | ||
6 | UBSAN is a runtime undefined behaviour checker. | 4 | UBSAN is a runtime undefined behaviour checker. |
7 | 5 | ||
@@ -10,11 +8,13 @@ Compiler inserts code that perform certain kinds of checks before operations | |||
10 | that may cause UB. If check fails (i.e. UB detected) __ubsan_handle_* | 8 | that may cause UB. If check fails (i.e. UB detected) __ubsan_handle_* |
11 | function called to print error message. | 9 | function called to print error message. |
12 | 10 | ||
13 | GCC has that feature since 4.9.x [1] (see -fsanitize=undefined option and | 11 | GCC has that feature since 4.9.x [1_] (see ``-fsanitize=undefined`` option and |
14 | its suboptions). GCC 5.x has more checkers implemented [2]. | 12 | its suboptions). GCC 5.x has more checkers implemented [2_]. |
15 | 13 | ||
16 | Report example | 14 | Report example |
17 | --------------- | 15 | -------------- |
16 | |||
17 | :: | ||
18 | 18 | ||
19 | ================================================================================ | 19 | ================================================================================ |
20 | UBSAN: Undefined behaviour in ../include/linux/bitops.h:110:33 | 20 | UBSAN: Undefined behaviour in ../include/linux/bitops.h:110:33 |
@@ -47,29 +47,33 @@ Report example | |||
47 | Usage | 47 | Usage |
48 | ----- | 48 | ----- |
49 | 49 | ||
50 | To enable UBSAN configure kernel with: | 50 | To enable UBSAN configure kernel with:: |
51 | 51 | ||
52 | CONFIG_UBSAN=y | 52 | CONFIG_UBSAN=y |
53 | 53 | ||
54 | and to check the entire kernel: | 54 | and to check the entire kernel:: |
55 | 55 | ||
56 | CONFIG_UBSAN_SANITIZE_ALL=y | 56 | CONFIG_UBSAN_SANITIZE_ALL=y |
57 | 57 | ||
58 | To enable instrumentation for specific files or directories, add a line | 58 | To enable instrumentation for specific files or directories, add a line |
59 | similar to the following to the respective kernel Makefile: | 59 | similar to the following to the respective kernel Makefile: |
60 | 60 | ||
61 | For a single file (e.g. main.o): | 61 | - For a single file (e.g. main.o):: |
62 | UBSAN_SANITIZE_main.o := y | 62 | |
63 | UBSAN_SANITIZE_main.o := y | ||
63 | 64 | ||
64 | For all files in one directory: | 65 | - For all files in one directory:: |
65 | UBSAN_SANITIZE := y | 66 | |
67 | UBSAN_SANITIZE := y | ||
66 | 68 | ||
67 | To exclude files from being instrumented even if | 69 | To exclude files from being instrumented even if |
68 | CONFIG_UBSAN_SANITIZE_ALL=y, use: | 70 | ``CONFIG_UBSAN_SANITIZE_ALL=y``, use:: |
71 | |||
72 | UBSAN_SANITIZE_main.o := n | ||
73 | |||
74 | and:: | ||
69 | 75 | ||
70 | UBSAN_SANITIZE_main.o := n | 76 | UBSAN_SANITIZE := n |
71 | and: | ||
72 | UBSAN_SANITIZE := n | ||
73 | 77 | ||
74 | Detection of unaligned accesses controlled through the separate option - | 78 | Detection of unaligned accesses controlled through the separate option - |
75 | CONFIG_UBSAN_ALIGNMENT. It's off by default on architectures that support | 79 | CONFIG_UBSAN_ALIGNMENT. It's off by default on architectures that support |
@@ -80,5 +84,5 @@ reports. | |||
80 | References | 84 | References |
81 | ---------- | 85 | ---------- |
82 | 86 | ||
83 | [1] - https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html | 87 | .. _1: https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html |
84 | [2] - https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html | 88 | .. _2: https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html |