RFR: JDK-8296906: VMError::controlled_crash crashes with wrong code and address [v3]

Andrey Turbanov aturbanov at openjdk.org
Wed Nov 16 08:18:11 UTC 2022


On Tue, 15 Nov 2022 12:52:57 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.
>
> Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix copyright

test/hotspot/jtreg/runtime/ErrorHandling/HsErrFileUtils.java line 35:

> 33:      * Given the output of a java VM that crashed, extract the name of the hs-err file from the output
> 34:      */
> 35:     static public String extractHsErrFileNameFromOutput(OutputAnalyzer output) {

nit: let's use blessed modifiers order
Suggestion:

    public static String extractHsErrFileNameFromOutput(OutputAnalyzer output) {

test/hotspot/jtreg/runtime/ErrorHandling/HsErrFileUtils.java line 94:

> 92:         if (currentPattern < patterns.length) {
> 93:             throw new RuntimeException("hs-err file incomplete (found " + currentPattern + " matching pattern, " +
> 94:                                        "first missing pattern: " +  patterns[currentPattern] + ")");

nit
Suggestion:

                                       "first missing pattern: " + patterns[currentPattern] + ")");

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

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


More information about the hotspot-dev mailing list