summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2016-08-07 17:35:42 -0400
committerJonathan Corbet <corbet@lwn.net>2016-08-18 19:41:51 -0400
commit1ead009cd622bc4c3c2cf1036d8e71d7f063838e (patch)
tree140ef5dfe5d551362f67de82028bad67d7937871
parent2757aafad9ee7b8740042e5540b59422337344ab (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.rst1
-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 @@
1Undefined Behavior Sanitizer - UBSAN 1The Undefined Behavior Sanitizer - UBSAN
2 2========================================
3Overview
4--------
5 3
6UBSAN is a runtime undefined behaviour checker. 4UBSAN is a runtime undefined behaviour checker.
7 5
@@ -10,11 +8,13 @@ Compiler inserts code that perform certain kinds of checks before operations
10that may cause UB. If check fails (i.e. UB detected) __ubsan_handle_* 8that may cause UB. If check fails (i.e. UB detected) __ubsan_handle_*
11function called to print error message. 9function called to print error message.
12 10
13GCC has that feature since 4.9.x [1] (see -fsanitize=undefined option and 11GCC has that feature since 4.9.x [1_] (see ``-fsanitize=undefined`` option and
14its suboptions). GCC 5.x has more checkers implemented [2]. 12its suboptions). GCC 5.x has more checkers implemented [2_].
15 13
16Report example 14Report 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
47Usage 47Usage
48----- 48-----
49 49
50To enable UBSAN configure kernel with: 50To enable UBSAN configure kernel with::
51 51
52 CONFIG_UBSAN=y 52 CONFIG_UBSAN=y
53 53
54and to check the entire kernel: 54and to check the entire kernel::
55 55
56 CONFIG_UBSAN_SANITIZE_ALL=y 56 CONFIG_UBSAN_SANITIZE_ALL=y
57 57
58To enable instrumentation for specific files or directories, add a line 58To enable instrumentation for specific files or directories, add a line
59similar to the following to the respective kernel Makefile: 59similar 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
67To exclude files from being instrumented even if 69To exclude files from being instrumented even if
68CONFIG_UBSAN_SANITIZE_ALL=y, use: 70``CONFIG_UBSAN_SANITIZE_ALL=y``, use::
71
72 UBSAN_SANITIZE_main.o := n
73
74and::
69 75
70 UBSAN_SANITIZE_main.o := n 76 UBSAN_SANITIZE := n
71 and:
72 UBSAN_SANITIZE := n
73 77
74Detection of unaligned accesses controlled through the separate option - 78Detection of unaligned accesses controlled through the separate option -
75CONFIG_UBSAN_ALIGNMENT. It's off by default on architectures that support 79CONFIG_UBSAN_ALIGNMENT. It's off by default on architectures that support
@@ -80,5 +84,5 @@ reports.
80References 84References
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