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.
This commit is contained in:
Maxim Kartashev
2021-04-16 15:42:51 +07:00
committed by jbrbot
parent a057b26a74
commit d7dcf0d013
3 changed files with 8 additions and 0 deletions

View File

@@ -990,6 +990,7 @@ static void print_hex_location(outputStream* st, 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, address start, address end, int unitsize,
int bytes_per_line, address logical_start) {
assert(unitsize == 1 || unitsize == 2 || unitsize == 4 || unitsize == 8, "just checking");

View File

@@ -103,4 +103,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

@@ -660,6 +660,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;