Skip to content

Commit 302ee14

Browse files
mkartashevjbrbot
authored and
jbrbot
committed
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 4c2085b)
1 parent 38abc61 commit 302ee14

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/hotspot/share/runtime/os.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,7 @@ static void print_hex_location(outputStream* st, const_address p, int unitsize,
10091009
}
10101010
}
10111011

1012+
ATTRIBUTE_NO_SANITIZE_ADDRESS("Memory is read raw here without any regard for objects' boundaries")
10121013
void os::print_hex_dump(outputStream* st, const_address start, const_address end, int unitsize,
10131014
bool print_ascii, int bytes_per_line, const_address logical_start, const_address highlight_address) {
10141015
constexpr int max_bytes_per_line = 64;

src/hotspot/share/utilities/compilerWarnings.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,10 @@
145145
#define END_ALLOW_FORBIDDEN_FUNCTIONS \
146146
PRAGMA_DIAG_POP
147147

148+
#if defined(__clang__) || defined (__GNUC__)
149+
# define ATTRIBUTE_NO_SANITIZE_ADDRESS(reason_for_exclusion) __attribute__((no_sanitize_address))
150+
#else
151+
# define ATTRIBUTE_NO_SANITIZE_ADDRESS(reason_for_exclusion)
152+
#endif
153+
148154
#endif // SHARE_UTILITIES_COMPILERWARNINGS_HPP

src/hotspot/share/utilities/vmError.cpp

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

0 commit comments

Comments
 (0)