RFR: 8293044: C1: Missing access check on non-accessible class

Tobias Hartmann thartmann at openjdk.org
Fri Sep 9 09:54:03 UTC 2022


On Thu, 8 Sep 2022 17:12:36 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

> C1 erroneously omits some access checks on symbolically referenced classes.
> 
> Proposed fix relies on code patching to throw proper resolution error when required.
> 
> Also, to avoid repeated recompilations on platforms which don't support code
> patching, the nmethod is not marked as non-entrant when corresponding constant
> pool entry is in error state.
> 
> Testing: hs-tier1 - hs-tier4

Looks good to me otherwise.

src/hotspot/share/ci/ciStreams.cpp line 194:

> 192:   return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder);
> 193: }
> 194: // ciBytecodeStream::get_klass

Suggestion:

}

// ciBytecodeStream::get_klass

test/hotspot/jtreg/compiler/c1/KlassAccessCheckTest.java line 31:

> 29:  * @compile KlassAccessCheck.jasm
> 30:  * @run main/othervm -Xbatch -XX:TieredStopAtLevel=1
> 31:  *                   -XX:+PrintCompilation -XX:CompileCommand=dontinline,KlassAccessCheck.test*

I think the CompileCommand misses the package name. It should be `-XX:CompileCommand=dontinline,compiler.c1.KlassAccessCheck.test*`

Also, you may want to remove the `-XX:+PrintCompilation`.

-------------

Marked as reviewed by thartmann (Reviewer).

PR: https://git.openjdk.org/jdk/pull/10222


More information about the hotspot-compiler-dev mailing list