8266742: Check W^X state on possible safepoint
Reviewed-by: dholmes, gziemski
This commit is contained in:
parent
79b39445f6
commit
3b11d811a2
@ -28,13 +28,17 @@
|
||||
//
|
||||
// Declare Bsd specific flags. They are not available on other platforms.
|
||||
//
|
||||
#define RUNTIME_OS_FLAGS(develop, \
|
||||
develop_pd, \
|
||||
product, \
|
||||
product_pd, \
|
||||
notproduct, \
|
||||
range, \
|
||||
constraint)
|
||||
#define RUNTIME_OS_FLAGS(develop, \
|
||||
develop_pd, \
|
||||
product, \
|
||||
product_pd, \
|
||||
notproduct, \
|
||||
range, \
|
||||
constraint) \
|
||||
\
|
||||
AARCH64_ONLY(develop(bool, AssertWXAtThreadSync, false, \
|
||||
"Conservatively check W^X thread state at possible safepoint" \
|
||||
"or handshake"))
|
||||
|
||||
// end of RUNTIME_OS_FLAGS
|
||||
|
||||
|
@ -65,6 +65,16 @@ bool SafepointMechanism::should_process(JavaThread* thread) {
|
||||
}
|
||||
|
||||
void SafepointMechanism::process_if_requested(JavaThread* thread) {
|
||||
|
||||
// Macos/aarch64 should be in the right state for safepoint (e.g.
|
||||
// deoptimization needs WXWrite). Crashes caused by the wrong state rarely
|
||||
// happens in practice, making such issues hard to find and reproduce.
|
||||
#if defined(ASSERT) && defined(__APPLE__) && defined(AARCH64)
|
||||
if (AssertWXAtThreadSync) {
|
||||
thread->assert_wx_state(WXWrite);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (local_poll_armed(thread)) {
|
||||
process_if_requested_slow(thread);
|
||||
}
|
||||
|
@ -649,6 +649,10 @@ protected:
|
||||
public:
|
||||
void init_wx();
|
||||
WXMode enable_wx(WXMode new_state);
|
||||
|
||||
void assert_wx_state(WXMode expected) {
|
||||
assert(_wx_state == expected, "wrong state");
|
||||
}
|
||||
#endif // __APPLE__ && AARCH64
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user