RFR: 8325567: jspawnhelper without args fails with segfault

Elif Aslan duke at openjdk.org
Mon Mar 4 21:24:00 UTC 2024


This change is intended to address the segmentation fault issue that occurs when jspawnhelper is called without arguments, and it includes an updated test to verify the behavior in such cases.

Existing tests passes since it does not check behavior without args.
After test update the test fails without 

   if (argc != 2) {
        shutItDown();
    }

code block

> Test results: failed: 1
> Report written to /home/ec2-user/moe/ws/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-results/jtreg_test_jdk_java_lang_ProcessBuilder_JspawnhelperProtocol_java/html/report.html
> Results written to /home/ec2-user/moe/ws/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_jdk_java_lang_ProcessBuilder_JspawnhelperProtocol_java
> Error: Some tests failed or other problems occurred.
> Finished running test 'jtreg:test/jdk/java/lang/ProcessBuilder/JspawnhelperProtocol.java'
> Test report is stored in build/linux-x86_64-server-fastdebug/test-results/jtreg_test_jdk_java_lang_ProcessBuilder_JspawnhelperProtocol_java
>  
> ==============================
> Test summary
> ==============================
>    TEST                                              TOTAL  PASS  FAIL ERROR   
>    jtreg:test/jdk/java/lang/ProcessBuilder/JspawnhelperProtocol.java
> >>                                                       1     0     1     0 <<
> ==============================
> TEST FAILURE



after added the code block back 

   if (argc != 2) {
        shutItDown();
    }


updated test passes


lang/ProcessBuilder/JspawnhelperProtocol.d:/home/ec2-user/moe/ws/openjdk/jdk/test/jdk/java/lang/ProcessBuilder:/home/ec2-user/moe/ws/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_jdk_java_lang_ProcessBuilder_JspawnhelperProtocol_java/classes/0/test/lib \\
        -Xmx768m \\
        -XX:MaxRAMPercentage=1.04167 \\
        -Dtest.boot.jdk=/home/ec2-user/moe/soft/jdk/jdk-21 \\
        -Djava.io.tmpdir=/home/ec2-user/moe/ws/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_jdk_java_lang_ProcessBuilder_JspawnhelperProtocol_java/tmp \\
        -ea \\
        -esa \\
        -Djava.library.path=/home/ec2-user/moe/ws/openjdk/jdk/build/linux-x86_64-server-fastdebug/images/test/jdk/jtreg/native \\
        com.sun.javatest.regtest.agent.MainWrapper /home/ec2-user/moe/ws/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_jdk_java_lang_ProcessBuilder_JspawnhelperProtocol_java/java/lang/ProcessBuilder/JspawnhelperProtocol.d/main.0.jta
result: Passed. Execution successful
 
 
test result: Passed. Execution successful

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

Commit messages:
 - Add Robust arg check
 - Remove usage text and add test
 - 8325567:jspawnhelper without args fails with segfault

Changes: https://git.openjdk.org/jdk/pull/18112/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18112&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8325567
  Stats: 45 lines in 2 files changed: 43 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/18112.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18112/head:pull/18112

PR: https://git.openjdk.org/jdk/pull/18112


More information about the core-libs-dev mailing list