8194990: 3 Null pointer dereference defect groups related to CodeCache::find_blob_unsafe()

Reviewed-by: kvn
This commit is contained in:
Dean Long 2018-01-31 16:10:23 -08:00
parent 672ddf57fc
commit ce205655fe
2 changed files with 5 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2018, Oracle and/or its affiliates. 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
@ -417,7 +417,7 @@ void CompiledIC::set_to_monomorphic(CompiledICInfo& info) {
bool static_bound = info.is_optimized() || (info.cached_metadata() == NULL); bool static_bound = info.is_optimized() || (info.cached_metadata() == NULL);
#ifdef ASSERT #ifdef ASSERT
CodeBlob* cb = CodeCache::find_blob_unsafe(info.entry()); CodeBlob* cb = CodeCache::find_blob_unsafe(info.entry());
assert (cb->is_compiled(), "must be compiled!"); assert (cb != NULL && cb->is_compiled(), "must be compiled!");
#endif /* ASSERT */ #endif /* ASSERT */
// This is MT safe if we come from a clean-cache and go through a // This is MT safe if we come from a clean-cache and go through a

View file

@ -955,6 +955,7 @@ void nmethod::verify_clean_inline_caches() {
CompiledIC *ic = CompiledIC_at(&iter); CompiledIC *ic = CompiledIC_at(&iter);
// Ok, to lookup references to zombies here // Ok, to lookup references to zombies here
CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination()); CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination());
assert(cb != NULL, "destination not in CodeBlob?");
nmethod* nm = cb->as_nmethod_or_null(); nmethod* nm = cb->as_nmethod_or_null();
if( nm != NULL ) { if( nm != NULL ) {
// Verify that inline caches pointing to both zombie and not_entrant methods are clean // Verify that inline caches pointing to both zombie and not_entrant methods are clean
@ -967,6 +968,7 @@ void nmethod::verify_clean_inline_caches() {
case relocInfo::static_call_type: { case relocInfo::static_call_type: {
CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc()); CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc());
CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination()); CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination());
assert(cb != NULL, "destination not in CodeBlob?");
nmethod* nm = cb->as_nmethod_or_null(); nmethod* nm = cb->as_nmethod_or_null();
if( nm != NULL ) { if( nm != NULL ) {
// Verify that inline caches pointing to both zombie and not_entrant methods are clean // Verify that inline caches pointing to both zombie and not_entrant methods are clean
@ -2732,7 +2734,7 @@ public:
virtual void verify_resolve_call(address dest) const { virtual void verify_resolve_call(address dest) const {
CodeBlob* db = CodeCache::find_blob_unsafe(dest); CodeBlob* db = CodeCache::find_blob_unsafe(dest);
assert(!db->is_adapter_blob(), "must use stub!"); assert(db != NULL && !db->is_adapter_blob(), "must use stub!");
} }
virtual bool is_call_to_interpreted(address dest) const { virtual bool is_call_to_interpreted(address dest) const {