mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
Unsafe.copy*Memory access failures are handled gracefully. Co-authored-by: Harold Seigel <harold.seigel@oracle.com> Reviewed-by: kvn, dcubed, thartmann, coleenp, aph
This commit is contained in:
parent
4a7e2b57ea
commit
aedbb75803
26 changed files with 1827 additions and 1242 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -435,8 +435,12 @@ JVM_handle_linux_signal(int sig,
|
|||
// Do not crash the VM in such a case.
|
||||
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
|
||||
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
|
||||
if (nm != NULL && nm->has_unsafe_access()) {
|
||||
bool is_unsafe_arraycopy = thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc);
|
||||
if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
|
||||
address next_pc = Assembler::locate_next_instruction(pc);
|
||||
if (is_unsafe_arraycopy) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
}
|
||||
|
@ -483,10 +487,14 @@ JVM_handle_linux_signal(int sig,
|
|||
// Determination of interpreter/vtable stub/compiled code null exception
|
||||
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
|
||||
}
|
||||
} else if (thread->thread_state() == _thread_in_vm &&
|
||||
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
|
||||
thread->doing_unsafe_access()) {
|
||||
} else if ((thread->thread_state() == _thread_in_vm ||
|
||||
thread->thread_state() == _thread_in_native) &&
|
||||
(sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
|
||||
thread->doing_unsafe_access())) {
|
||||
address next_pc = Assembler::locate_next_instruction(pc);
|
||||
if (UnsafeCopyMemory::contains_pc(pc)) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue