8256258: some missing NULL checks or asserts after CodeCache::find_blob_unsafe
Reviewed-by: shade
This commit is contained in:
parent
1228517261
commit
4553fa0b98
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012, 2019 SAP SE. All rights reserved.
|
* Copyright (c) 2012, 2020 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -177,6 +177,7 @@ void NativeFarCall::verify() {
|
|||||||
address NativeMovConstReg::next_instruction_address() const {
|
address NativeMovConstReg::next_instruction_address() const {
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
CodeBlob* nm = CodeCache::find_blob(instruction_address());
|
CodeBlob* nm = CodeCache::find_blob(instruction_address());
|
||||||
|
assert(nm != NULL, "Could not find code blob");
|
||||||
assert(!MacroAssembler::is_set_narrow_oop(addr_at(0), nm->content_begin()), "Should not patch narrow oop here");
|
assert(!MacroAssembler::is_set_narrow_oop(addr_at(0), nm->content_begin()), "Should not patch narrow oop here");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -195,6 +196,7 @@ intptr_t NativeMovConstReg::data() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CodeBlob* cb = CodeCache::find_blob_unsafe(addr);
|
CodeBlob* cb = CodeCache::find_blob_unsafe(addr);
|
||||||
|
assert(cb != NULL, "Could not find code blob");
|
||||||
if (MacroAssembler::is_set_narrow_oop(addr, cb->content_begin())) {
|
if (MacroAssembler::is_set_narrow_oop(addr, cb->content_begin())) {
|
||||||
narrowOop no = MacroAssembler::get_narrow_oop(addr, cb->content_begin());
|
narrowOop no = MacroAssembler::get_narrow_oop(addr, cb->content_begin());
|
||||||
// We can reach here during GC with 'no' pointing to new object location
|
// We can reach here during GC with 'no' pointing to new object location
|
||||||
@ -297,6 +299,7 @@ void NativeMovConstReg::set_data(intptr_t data) {
|
|||||||
void NativeMovConstReg::set_narrow_oop(narrowOop data, CodeBlob *code /* = NULL */) {
|
void NativeMovConstReg::set_narrow_oop(narrowOop data, CodeBlob *code /* = NULL */) {
|
||||||
address inst2_addr = addr_at(0);
|
address inst2_addr = addr_at(0);
|
||||||
CodeBlob* cb = (code) ? code : CodeCache::find_blob(instruction_address());
|
CodeBlob* cb = (code) ? code : CodeCache::find_blob(instruction_address());
|
||||||
|
assert(cb != NULL, "Could not find code blob");
|
||||||
if (MacroAssembler::get_narrow_oop(inst2_addr, cb->content_begin()) == data) {
|
if (MacroAssembler::get_narrow_oop(inst2_addr, cb->content_begin()) == data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -403,6 +406,7 @@ address NativeCallTrampolineStub::encoded_destination_addr() const {
|
|||||||
|
|
||||||
address NativeCallTrampolineStub::destination(nmethod *nm) const {
|
address NativeCallTrampolineStub::destination(nmethod *nm) const {
|
||||||
CodeBlob* cb = nm ? nm : CodeCache::find_blob_unsafe(addr_at(0));
|
CodeBlob* cb = nm ? nm : CodeCache::find_blob_unsafe(addr_at(0));
|
||||||
|
assert(cb != NULL, "Could not find code blob");
|
||||||
address ctable = cb->content_begin();
|
address ctable = cb->content_begin();
|
||||||
|
|
||||||
return *(address*)(ctable + destination_toc_offset());
|
return *(address*)(ctable + destination_toc_offset());
|
||||||
@ -414,6 +418,7 @@ int NativeCallTrampolineStub::destination_toc_offset() const {
|
|||||||
|
|
||||||
void NativeCallTrampolineStub::set_destination(address new_destination) {
|
void NativeCallTrampolineStub::set_destination(address new_destination) {
|
||||||
CodeBlob* cb = CodeCache::find_blob(addr_at(0));
|
CodeBlob* cb = CodeCache::find_blob(addr_at(0));
|
||||||
|
assert(cb != NULL, "Could not find code blob");
|
||||||
address ctable = cb->content_begin();
|
address ctable = cb->content_begin();
|
||||||
|
|
||||||
*(address*)(ctable + destination_toc_offset()) = new_destination;
|
*(address*)(ctable + destination_toc_offset()) = new_destination;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
|
* Copyright (c) 2012, 2020 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -345,7 +345,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
|||||||
// BugId 4454115: A read from a MappedByteBuffer can fault here if the
|
// BugId 4454115: A read from a MappedByteBuffer can fault here if the
|
||||||
// underlying file has been truncated. Do not crash the VM in such a case.
|
// underlying file has been truncated. Do not crash the VM in such a case.
|
||||||
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
|
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
|
||||||
CompiledMethod* nm = cb->as_compiled_method_or_null();
|
CompiledMethod* nm = cb ? cb->as_compiled_method_or_null() : NULL;
|
||||||
bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
|
bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
|
||||||
if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
|
if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
|
||||||
address next_pc = pc + 4;
|
address next_pc = pc + 4;
|
||||||
|
Loading…
Reference in New Issue
Block a user