JDK-8308350 : Increase buffer size for jspawnhelper arguments
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 11,20,21
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux,os_x
  • Submitted: 2023-05-18
  • Updated: 2024-02-09
  • Resolved: 2023-05-18
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 21
21 b24Fixed
Related Reports
Relates :  
Description
jspawnhelper gets handed several file descriptors as arguments. The buffer size for this string is too small (7 chars per fd) to print out every conceivable int. This will overun the buffer if we happen to have fds larger than (printed size) 7 characters. This could lead to crashes or malfunctions if the parent VM has opened a large amount of file descriptors.

Note that on Linux, this can normally not happen since the kernel limits the number of open file descriptors per process to 1M, and these fds are still printable within the limits of this buffer. It is possible to get more fds per process, but only via kernel patch. But we still should not rely on that. And there is also still MacOS using the same mechanism.

Comments
Note: In 17.0.11, this was implicitly handled by JDK-8307990 backport: https://github.com/openjdk/jdk17u-dev/commit/16f319a338930b708105f9189a5174b9aed7d569#diff-ffbcab6325b2ae4b57a81e39c51c155cb2dab372bc915060dfc47159c345797fR493
09-02-2024

Changeset: 808dc1b0 Author: Thomas Stuefe <stuefe@openjdk.org> Date: 2023-05-18 14:01:08 +0000 URL: https://git.openjdk.org/jdk/commit/808dc1b047c5a67b7397d47e38495efde022317d
18-05-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14045 Date: 2023-05-18 07:08:57 +0000
18-05-2023