RFR: 8334169: Long arguments of attach operation are silently truncated on Windows [v3]

Alex Menkov amenkov at openjdk.org
Mon Jul 15 20:11:52 UTC 2024


On Sat, 13 Jul 2024 06:21:45 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> Currently Attach operations have restriction for argument size, so setFlag() is expected to fail for long values.
>> This fix adds AttachOperationFailedException for the case on windows, linux/bsd/aix implementations throw generic IOException.
>> (There is [JDK-8334168](https://bugs.openjdk.org/browse/JDK-8334168) to throw AttachOperationFailedException instead of IOException if an argument is too long on other platforms)
>
> Not sure, you've answered my question. Let me ask it differently.
> Here I do not care about other exceptions on other platforms.
> The `setFlag()` can catch an `IOException` at the line 126 and return false in that case. The `run()` method at the line 94 is swallowing the `false` value as there is no `else` statement. So, we just ignore the `IOException` and do not test anything.
> My question is: Why don't we throw a `RuntimeException` in the case the `setFlag()` returned `false`?

Because `vm.setFlag` may (and should) throw exception if bad argument is specified.
This is what the issue about - on Windows `vm.setFlag` with long argument did not throw exception, but truncated the argument, and successfully executed the command with truncated argument value.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19780#discussion_r1678334111


More information about the serviceability-dev mailing list