RFR: 8307478: Implementation of Prepare to Restrict The Dynamic Loading of Agents [v6]

Alan Bateman alanb at openjdk.org
Thu Jun 1 12:37:21 UTC 2023


On Thu, 1 Jun 2023 05:55:43 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> src/hotspot/share/prims/jvmtiAgentList.cpp line 231:
>> 
>>> 229:        if (agent->is_static_lib() && agent->is_loaded()) {
>>> 230:          return true;
>>> 231:        }
>> 
>> This doesn't make sense to me. If  you pass in `null` for `os_lib`, then we return true if any loaded static lib is found. Is this an attempt to limit the warning to just the first static lib that is loaded? Also, why would `null` ever be passed in if there wasn't at least one static lib. Some clarify comments would be useful.
>
> load_agent_from_executable has a comment to explain how statically linked agents are started, that's why it needs to use agent->is_static_lib().&& agent->is_loaded() here. There isn't currently a way to test this but there is other work going to support static builds so it might be possible to write some automated tests at that point.

I've updated this so that is_loaded is split into one function to test if a statically linked agent is already loaded and another for agent libraries. That might be clearer to understand.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13899#discussion_r1213080073


More information about the hotspot-runtime-dev mailing list