mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8215879: AArch64: ReservedStackAccess may leave stack guard in inconsistent state
Reviewed-by: aph, dholmes
This commit is contained in:
parent
0e2172c7ba
commit
9d20ad22c8
2 changed files with 5 additions and 6 deletions
|
@ -370,7 +370,6 @@ JVM_handle_linux_signal(int sig,
|
||||||
if (thread->on_local_stack(addr)) {
|
if (thread->on_local_stack(addr)) {
|
||||||
// stack overflow
|
// stack overflow
|
||||||
if (thread->in_stack_yellow_reserved_zone(addr)) {
|
if (thread->in_stack_yellow_reserved_zone(addr)) {
|
||||||
thread->disable_stack_yellow_reserved_zone();
|
|
||||||
if (thread->thread_state() == _thread_in_Java) {
|
if (thread->thread_state() == _thread_in_Java) {
|
||||||
if (thread->in_stack_reserved_zone(addr)) {
|
if (thread->in_stack_reserved_zone(addr)) {
|
||||||
frame fr;
|
frame fr;
|
||||||
|
@ -392,9 +391,11 @@ JVM_handle_linux_signal(int sig,
|
||||||
}
|
}
|
||||||
// Throw a stack overflow exception. Guard pages will be reenabled
|
// Throw a stack overflow exception. Guard pages will be reenabled
|
||||||
// while unwinding the stack.
|
// while unwinding the stack.
|
||||||
|
thread->disable_stack_yellow_reserved_zone();
|
||||||
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW);
|
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW);
|
||||||
} else {
|
} else {
|
||||||
// Thread was in the vm or native code. Return and try to finish.
|
// Thread was in the vm or native code. Return and try to finish.
|
||||||
|
thread->disable_stack_yellow_reserved_zone();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if (thread->in_stack_red_zone(addr)) {
|
} else if (thread->in_stack_red_zone(addr)) {
|
||||||
|
|
|
@ -2603,8 +2603,7 @@ void JavaThread::remove_stack_guard_pages() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void JavaThread::enable_stack_reserved_zone() {
|
void JavaThread::enable_stack_reserved_zone() {
|
||||||
assert(_stack_guard_state != stack_guard_unused, "must be using guard pages.");
|
assert(_stack_guard_state == stack_guard_reserved_disabled, "inconsistent state");
|
||||||
assert(_stack_guard_state != stack_guard_enabled, "already enabled");
|
|
||||||
|
|
||||||
// The base notation is from the stack's point of view, growing downward.
|
// The base notation is from the stack's point of view, growing downward.
|
||||||
// We need to adjust it to work correctly with guard_memory()
|
// We need to adjust it to work correctly with guard_memory()
|
||||||
|
@ -2622,11 +2621,10 @@ void JavaThread::enable_stack_reserved_zone() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void JavaThread::disable_stack_reserved_zone() {
|
void JavaThread::disable_stack_reserved_zone() {
|
||||||
assert(_stack_guard_state != stack_guard_unused, "must be using guard pages.");
|
assert(_stack_guard_state == stack_guard_enabled, "inconsistent state");
|
||||||
assert(_stack_guard_state != stack_guard_reserved_disabled, "already disabled");
|
|
||||||
|
|
||||||
// Simply return if called for a thread that does not use guard pages.
|
// Simply return if called for a thread that does not use guard pages.
|
||||||
if (_stack_guard_state == stack_guard_unused) return;
|
if (_stack_guard_state != stack_guard_enabled) return;
|
||||||
|
|
||||||
// The base notation is from the stack's point of view, growing downward.
|
// The base notation is from the stack's point of view, growing downward.
|
||||||
// We need to adjust it to work correctly with guard_memory()
|
// We need to adjust it to work correctly with guard_memory()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue