JBR-3323 Exclude parts of VM code from sanitizer checks

Exclude VM error-reporting code that treats memory as a raw sequence of
bytes from address sanitizer checks. This is needed to only get true
reports when running tests against the --enable-asan build.

(cherry picked from commit 4c2085b5f7)
This commit is contained in:
Maxim Kartashev
2021-04-16 15:42:51 +07:00
committed by jbrbot
parent 4319138084
commit 2c8660ffc4
3 changed files with 8 additions and 0 deletions

View File

@@ -1007,6 +1007,7 @@ static void print_hex_location(outputStream* st, const_address p, int unitsize,
}
}
ATTRIBUTE_NO_SANITIZE_ADDRESS("Memory is read raw here without any regard for objects' boundaries")
void os::print_hex_dump(outputStream* st, const_address start, const_address end, int unitsize,
bool print_ascii, int bytes_per_line, const_address logical_start, const_address highlight_address) {
constexpr int max_bytes_per_line = 64;

View File

@@ -107,4 +107,10 @@
#define ALLOW_C_FUNCTION(name, ...) __VA_ARGS__
#endif
#if defined(__clang__) || defined (__GNUC__)
# define ATTRIBUTE_NO_SANITIZE_ADDRESS(reason_for_exclusion) __attribute__((no_sanitize_address))
#else
# define ATTRIBUTE_NO_SANITIZE_ADDRESS(reason_for_exclusion)
#endif
#endif // SHARE_UTILITIES_COMPILERWARNINGS_HPP

View File

@@ -606,6 +606,7 @@ void VMError::clear_step_start_time() {
// could be nested report_and_die() calls on stack (see above). Only one
// thread can report error, so large buffers are statically allocated in data
// segment.
ATTRIBUTE_NO_SANITIZE_ADDRESS("Memory is read raw here without any regard for objects' boundaries")
void VMError::report(outputStream* st, bool _verbose) {
// Used by reattempt step logic
static int continuation = 0;