diff options
| author | Kurt Kanzenbach <kurt@linutronix.de> | 2019-02-28 11:10:23 +0100 |
|---|---|---|
| committer | John Ogness <john.ogness@linutronix.de> | 2019-02-28 12:04:44 +0106 |
| commit | fd7e64b0a1ee69ddf608ed0f5ad4867f0f5277d8 (patch) | |
| tree | e6fda6b5b9ff209d49ce5093754949d66a010a92 | |
| parent | fa7ce3371a9415561ff9020e3a143cd0d80e7048 (diff) | |
app/debugging: add address sanitizer example
The address sanitizer is a useful tool for debugging lots of memory related bugs
such as heap/stack overflows, user after frees and much more.
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
| -rw-r--r-- | application-devel/debugging-tools/pres_debugging-tools_en.tex | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/application-devel/debugging-tools/pres_debugging-tools_en.tex b/application-devel/debugging-tools/pres_debugging-tools_en.tex index 7fc8501..ed34c3b 100644 --- a/application-devel/debugging-tools/pres_debugging-tools_en.tex +++ b/application-devel/debugging-tools/pres_debugging-tools_en.tex @@ -615,4 +615,26 @@ $ valgrind --leak-check=full ./array_access \end{verbatim} \end{frame} +\begin{frame}[fragile]{AddressSanitizer} +\begin{verbatim} +$ gcc -o array_access -fsanitize=address array_access.c +$ ./array_access +================================================================= +==5623==ERROR: AddressSanitizer: heap-buffer-overflow +READ of size 4 at 0x60400000dff8 thread T0 + #0 0x56525f56eabf in main + #1 0x7fa413d042e0 in __libc_start_main + #2 0x56525f56e949 in _start + +0x60400000dff8 is located 0 bytes to the right of 40-byte region +allocated by thread T0 here: + #0 0x7fa414144ed0 in calloc + #1 0x56525f56ea66 in main + #2 0x7fa413d042e0 in __libc_start_main + +SUMMARY: AddressSanitizer: heap-buffer-overflow in main +[...] +\end{verbatim} +\end{frame} + \input{tailpres} |
