RFR: 7903686: jtreg Agent should use loopback address

Jaikiran Pai jpai at openjdk.org
Wed Mar 6 06:32:18 UTC 2024


On Fri, 1 Mar 2024 12:01:08 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Can I please get a review of this change which proposes to address https://bugs.openjdk.org/browse/CODETOOLS-7903686?
> 
> The jtreg framework when handling "agentvm" mode, creates a `java.net.ServerSocket` in the jtreg process and then launches a JVM with `com.sun.javatest.regtest.agent.AgentServer` as the main class, passing it the port to which the `ServerSocket` is bound to. The `AgentServer` is then responsible for creating a `java.net.Socket` and connecting against the jtreg process' `ServerSocket`. In its current form, the `ServerSocket` is bound to "any address" which means that it can `accept()` a connection from not just the current host on which `jtreg` is running but from any other host on the network from which this host is accessible. If such a connection is established, then such an unexpected connection then interferes with the semantics of jtreg and the AgentServer and leads to test failures. We have noticed such failures in our CI environment, when running the JDK tests.
> 
> The change in this PR proposes to bind the `ServerSocket` to loopback address to reduce the changes of such interference. This doesn't completely rule out interference from unexpected/rogue processes connecting from within the same host to this `ServerSocket`, but given that the processes running on the current host are much more controlled and managed, then that should not be too much of a problem.
> 
> A custom built jtreg was used with these changes and the JDK mainline's tier1, tier2, tier3 testing was done. All tests have passed.

Thank you Jon for the review. I've updated the changelog to include an entry for this change. If that looks OK to you then I'll go ahead and integrate this tomorrow.

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

PR Comment: https://git.openjdk.org/jtreg/pull/185#issuecomment-1980172536


More information about the jtreg-dev mailing list