RFR: JDK-8296906: VMError::controlled_crash crashes with wrong code and address
David Holmes
dholmes at openjdk.org
Mon Nov 14 03:00:41 UTC 2022
On Sun, 13 Nov 2022 09:01:09 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> We have VMError::controlled_crash() in debug builds, whose job is to trigger clearly defined faults to test VM error reporting. VMError::controlled_crash(14) (the numbers don't mean anything and probably should be replaced with clear enums) is to crash with a SIGSEGV + SEGV_MAPERR mapping error at a well-known crash address. But this does not work on Linux, where it generates a SIGSEGV with SI_KERNEL instead. We never noticed since it had not been used in tests so far.
>
> The reason for SI_KERNEL was that the crash address we use (0xABC0000000000ABC) was outside the user-space address range on Linux. This patch redefines the crash address to a value that really generates a SIGSEGV + SEGV_MAPERR on all our platforms. That's one line; the rest is a new regression test that checks that signal info is printed correctly in hs-err files.
This seems okay in principle but some issues with the test I think.
Comments below.
Thanks.
test/hotspot/jtreg/runtime/ErrorHandling/HsErrFileUtils.java line 1:
> 1: import jdk.test.lib.process.OutputAnalyzer;
We need a copyright and license header here please.
test/hotspot/jtreg/runtime/ErrorHandling/HsErrFileUtils.java line 15:
> 13:
> 14: // extract hs-err file
> 15: String hs_err_file = output.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
I'm not sure this is going to be useful in the way you are trying to use it. This will show the original path to the hs_err file at the time it is created. But jtreg can move things around in the final test result output and place the hs_err file somewhere else.
test/hotspot/jtreg/runtime/ErrorHandling/TestSigInfoInHsErrFile.java line 2:
> 1: /*
> 2: * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
New file should only have 2022 copyright year.
test/hotspot/jtreg/runtime/ErrorHandling/TestSigInfoInHsErrFile.java line 54:
> 52: import java.io.File;
> 53: import java.io.FileInputStream;
> 54: import java.io.InputStreamReader;
Some of these includes seem unnecessary with the utility class you added.
test/hotspot/jtreg/runtime/ErrorHandling/TestSigInfoInHsErrFile.java line 130:
> 128: patterns.add(Pattern.compile("siginfo: si_signo: \\d+ \\(SIGSEGV\\), si_code: \\d+ \\(SEGV_MAPERR\\), si_addr: 0x0*400"));
> 129: } else {
> 130: patterns.add(Pattern.compile("siginfo: si_signo: \\d+ \\(SIGSEGV\\).*"));
Why not use the AIX 5K address here?
-------------
Changes requested by dholmes (Reviewer).
PR: https://git.openjdk.org/jdk/pull/11122
More information about the hotspot-dev
mailing list