Integrated: 8284273: Early crashes in os::print_context on AArch64
Gerard Ziemski
gziemski at openjdk.java.net
Thu May 19 16:23:56 UTC 2022
On Mon, 16 May 2022 21:58:56 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
> Our error reporting mechanism can crash again, while reporting the original crash, because we try to access a possibly bogus memory location, for example while printing a location of memory referred by a CPU register. In such case, we skip over the already reported section (including the one where the secondary crash has occurred).
>
> This is possible, because we section the error reporting code into sections, called "steps", with a state that retains the information about the last attempted step.
>
> Here, we are concerned with two particular steps: "printing register info" and "printing registers, top of stack, instructions near pc". In those two steps we report 4 distinct chunks of info:
>
> 1. registers' raw values (safe)
> 2. registers' decoded content (risky)
> 3. memory around the "sp" (risky)
> 4. memory around the "pc" (risky)
>
> The issue here is that on some platforms (Linux aarch64) a single "step" contains 2, 3 and 4, all "risky" sections, so if we crash early in the step, we skip the rest of it and end up never reporting the later sections, ex:
>
>
> STEP("printing register info")
> print_register_info
> 1. registers' raw values (safe)
>
> STEP("printing registers, top of stack, instructions near pc")
> print_context
> 2. registers' decoded content (risky)
> 3. memory around the "sp" (risky)
> 4. memory around the "pc" (risky)
>
>
> Other platforms (Linux x64) have a single "step" containing 1, 3 and 4, and another one containing just 2, so that we always get to report section 3, ex:
>
>
> STEP("printing register info")
> print_register_info
> 2. registers' decoded content (risky)
>
> STEP("printing registers, top of stack, instructions near pc")
> print_context
> 1. registers' raw values (safe)
> 3. memory around the "sp" (risky)
> 4. memory around the "pc" (risky)
>
>
> This fix proposes to rearrange the STEPS, so that the less risky sections come first and to split the STEP with 3 sections into 2 STEPS, like so:
>
>
> STEP("printing registers")
> print_context
> 1. registers' raw values (safe)
>
> STEP("printing register info")
> print_register_info
> 2. registers' decoded content (risky)
>
> STEP("printing top of stack, instructions near pc")
> print_tos_pc
> 3. memory around the "sp" (risky)
> 4. memory around the "pc" (risky)
This pull request has now been integrated.
Changeset: 83cec4b6
Author: Gerard Ziemski <gziemski at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/83cec4b6cc25b9b0db751bbe873444259cdcb21c
Stats: 124 lines in 15 files changed: 95 ins; 11 del; 18 mod
8284273: Early crashes in os::print_context on AArch64
Reviewed-by: stefank, stuefe
-------------
PR: https://git.openjdk.java.net/jdk/pull/8736
More information about the hotspot-dev
mailing list