1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/utils
Mitch Phillips 5c6e533e01 [HWASan] Save + print registers when tag mismatch occurs in AArch64.
Summary:
This change change the instrumentation to allow users to view the registers at the point at which tag mismatch occured. Most of the heavy lifting is done in the runtime library, where we save the registers to the stack and emit unwind information. This allows us to reduce the overhead, as very little additional work needs to be done in each __hwasan_check instance.

In this implementation, the fast path of __hwasan_check is unmodified. There are an additional 4 instructions (16B) emitted in the slow path in every __hwasan_check instance. This may increase binary size somewhat, but as most of the work is done in the runtime library, it's manageable.

The failure trace now contains a list of registers at the point of which the failure occured, in a format similar to that of Android's tombstones. It currently has the following format:

Registers where the failure occurred (pc 0x0055555561b4):
    x0  0000000000000014  x1  0000007ffffff6c0  x2  1100007ffffff6d0  x3  12000056ffffe025
    x4  0000007fff800000  x5  0000000000000014  x6  0000007fff800000  x7  0000000000000001
    x8  12000056ffffe020  x9  0200007700000000  x10 0200007700000000  x11 0000000000000000
    x12 0000007fffffdde0  x13 0000000000000000  x14 02b65b01f7a97490  x15 0000000000000000
    x16 0000007fb77376b8  x17 0000000000000012  x18 0000007fb7ed6000  x19 0000005555556078
    x20 0000007ffffff768  x21 0000007ffffff778  x22 0000000000000001  x23 0000000000000000
    x24 0000000000000000  x25 0000000000000000  x26 0000000000000000  x27 0000000000000000
    x28 0000000000000000  x29 0000007ffffff6f0  x30 00000055555561b4

... and prints after the dump of memory tags around the buggy address.

Every register is saved exactly as it was at the point where the tag mismatch occurs, with the exception of x16/x17. These registers are used in the tag mismatch calculation as scratch registers during __hwasan_check, and cannot be saved without affecting the fast path. As these registers are designated as scratch registers for linking, there should be no important information in them that could aid in debugging.

Reviewers: pcc, eugenis

Reviewed By: pcc, eugenis

Subscribers: srhines, kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, hiraditya, jdoerfert, llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D58857

llvm-svn: 355738
2019-03-08 21:22:35 +00:00
..
benchmark Silence CMP0048 warning in the benchmark utility library 2018-12-14 00:17:12 +00:00
bugpoint
count Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
crosstool
docker [build] Rename clang-headers to clang-resource-headers 2019-03-04 21:19:53 +00:00
emacs Add fneg instruction to syntax highlighting lists 2018-11-13 19:50:38 +00:00
FileCheck Recommit: Detect incorrect FileCheck variable CLI definition 2019-02-05 14:17:28 +00:00
fpcmp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
gdb-scripts Python compat - iterator protocol 2019-01-03 15:43:14 +00:00
git
git-svn Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
gn [HWASan] Save + print registers when tag mismatch occurs in AArch64. 2019-03-08 21:22:35 +00:00
jedit
kate Add fneg instruction to syntax highlighting lists 2018-11-13 19:50:38 +00:00
KillTheDoctor Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
lint Python compat - print statement 2019-01-03 14:11:33 +00:00
lit Add Support for Creating and Deleting Unicode Files and Directories in Lit 2019-02-28 19:16:17 +00:00
llvm-build Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
llvm-lit [lit] llvm-lit.in: specify file encoding to UTF-8 2019-01-14 20:02:11 +00:00
LLVMVisualizers Fix visualization of intrusive reference counted objects in MSVC. 2019-01-09 18:59:56 +00:00
Misc
not Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
PerfectShuffle Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
release test-release.sh: Add option to use ninja 2019-02-11 10:30:22 +00:00
Reviewing Python compat - iteritems() vs. items() 2019-01-03 14:12:23 +00:00
sanitizers Add a ubsan blacklist entry for libstdc++ 8.0.1. 2018-11-21 23:04:39 +00:00
TableGen Revert r355224 "[TableGen][SelectionDAG][X86] Add specific isel matchers for immAllZerosV/immAllOnesV. Remove bitcasts from X86 patterns that are no longer necessary." 2019-03-05 19:18:16 +00:00
Target/ARM Python compat - print statement 2019-01-03 14:11:33 +00:00
testgen
textmate
unittest Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UpdateTestChecks [ARM] Add armv8a triple to test check updaters 2019-03-01 09:26:21 +00:00
valgrind
vim vim: swiftself is an attribute 2019-02-27 00:12:11 +00:00
vscode
yaml-bench Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
abtest.py
bisect
bisect-skip-count
bugpoint_gisel_reducer.py
check-each-file
clang-parse-diagnostics-file
codegen-diff
collect_and_build_with_pgo.py [utils] collect_and_build_with_pgo.py: revert part already fixed in rL345461 2018-10-27 23:10:09 +00:00
countloc.sh Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
create_ladder_graph.py Pythran compat - range vs. xrange 2019-01-03 14:11:58 +00:00
demangle_tree.py Python compat - print statement 2019-01-03 14:11:33 +00:00
DSAclean.py Python compat - print statement 2019-01-03 14:11:33 +00:00
DSAextract.py Python compat - print statement 2019-01-03 14:11:33 +00:00
extract_symbols.py
extract_vplan.py Python compat - print statement 2019-01-03 14:11:33 +00:00
findmisopt
findoptdiff
findsym.pl
GenLibDeps.pl
GetRepositoryPath
GetSourceVersion
getsrcs.sh Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
indirect_calls.py Python compat - print statement 2019-01-03 14:11:33 +00:00
lldbDataFormatters.py [utils] Update SmallVector lldb formatter for r337514 2018-11-06 18:52:30 +00:00
llvm-compilers-check Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
llvm-gisel-cov.py Python compat - print statement 2019-01-03 14:11:33 +00:00
llvm-native-gxx
llvm.grm
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
llvmdo Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
llvmgrep Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
prepare-code-coverage-artifact.py
schedcover.py Python compat - map/filter 2019-01-03 14:12:30 +00:00
shuffle_fuzz.py Pythran compat - range vs. xrange 2019-01-03 14:11:58 +00:00
shuffle_select_fuzz_tester.py Python compat - print statement 2019-01-03 14:11:33 +00:00
sort_includes.py
unicode-case-fold.py Python compat - urllib 2019-01-03 14:12:44 +00:00
update_analyze_test_checks.py Add wildcard support to all update_*_test_checks.py scripts (PR37500) 2019-03-05 10:44:37 +00:00
update_cc_test_checks.py
update_llc_test_checks.py Add wildcard support to all update_*_test_checks.py scripts (PR37500) 2019-03-05 10:44:37 +00:00
update_mca_test_checks.py [utils] Fix update scripts output when run on python3. 2019-01-30 16:15:59 +00:00
update_mir_test_checks.py Add wildcard support to all update_*_test_checks.py scripts (PR37500) 2019-03-05 10:44:37 +00:00
update_test_checks.py Add wildcard support to all update_*_test_checks.py scripts (PR37500) 2019-03-05 10:44:37 +00:00
UpdateCMakeLists.pl
wciia.py Python compat - print statement 2019-01-03 14:11:33 +00:00