JDK-8247732 : validate user-input intrinsic_ids in ControlIntrinsic
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-06-17
  • Updated: 2025-01-13
  • Resolved: 2020-12-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b03Fixed
Related Reports
Relates :  
Description
Control/DisableIntrinsic are both compound option. we'd better validate user inputs before execution. 

quote Nils
 I am missing strict name checking. (I want to see an error on startup if the user has specified unknown intrinsic names.) 
quote end. 

https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2020-June/038592.html

Comments
Changeset: 83be8a90 Author: Xin Liu <xliu@openjdk.org> Committer: Tobias Hartmann <thartmann@openjdk.org> Date: 2020-12-17 10:05:09 +0000 URL: https://git.openjdk.java.net/jdk/commit/83be8a90
17-12-2020

$java -XX:CompileCommand=ControlIntrinsic,*.*,_help -version the intrinsic id _help doesn't exists, but it works on all matched compilation. here the pattern is *.*, which means match all. As a result, it dump a lot of warnings OpenJDK 64-Bit Server VM warning: failed to parse _help. must start with +/-! ideally, we should distinct two scenarios where we use ControlIntrinsicIter
08-12-2020

thank Nils for further explanation. here is the spec we need to verify. | ControlIntrinsics | valid | invalid | | | |-------------------------------------------------|-------|----------------------------------|---|---| | vmflag | ok | print error and don't start | | | | CompilerOracle: -XX:CompileCommand= | ok | print error and continue | | | | CompilerDirectives: -XX:CompilerDirectivesFile= | ok | print error and don't start | | | | CompilerDirectives via jcmd | ok | print error, VM continues to run | | |
13-08-2020

1. use constraint to check ControlIntrinsic/DisableIntrinsic $ java -XX:+UnlockDiagnosticVMOptions -XX:ControlIntrinsic=+_dtan,+_hello,+_max -version An unrecognized intrinsic is detected in ControlIntrinsic: _hello Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. 2. ControlIntrinsic/DisableIntrinsic in compiler directives are more complex. The matched directive is only parsed when hotspot attempts to compile the corresponding method. It will crash if it violates the guarantee() statement. $java -XX:CompileCommand=option,java.util.HashMap::putVal,ccstrlist,DisableIntrinsic,_hello -version CompileCommand: option java/util/HashMap.putVal const char* DisableIntrinsic = '_hello' # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (compilerDirectives.cpp:367), pid=8481, tid=8482 # guarantee(validator.is_valid()) failed: An unrecognized intrinsic is detected in the directive of DisableIntrinsic java.util.HashMap::putVal : _hello # # JRE version: OpenJDK Runtime Environment (16.0) (build 16-internal+0-adhoc.ubuntu.jdk) # Java VM: OpenJDK 64-Bit Server VM (16-internal+0-adhoc.ubuntu.jdk, mixed mode, tiered, compressed oops, g1 gc, linux-amd64) # Problematic frame: # V [libjvm.so+0x55132d] DirectiveSet::compilecommand_compatibility_init(methodHandle const&) [clone .part.27]+0xead # # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /backup/jdk/core.8481) # # An error report file with more information is saved as: # /backup/jdk/hs_err_pid8481.log # # If you would like to submit a bug report, please visit: # https://bugreport.java.com/bugreport/crash.jsp # Aborted (core dumped)
26-06-2020