Re: [PATCH v5 8/8] unwind: arm64: Use sframe to unwind interrupt frames
Dylan Hatch <[email protected]> Mon, 18 May 2026 23:29:34 -0700
| Newsgroups | org.kernel.vger.linux-toolchains,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.live-patching |
|---|---|
| Message-ID | <CADBMgpxZ+Lh7uvPXT63XvKfxe_OpcqGN2EZAQ3PZiWvLiv3Cjg@mail.gmail.com> |
Hi Mark, I'm sending a v6 shortly that should address all/most of your feedback, but I wanted to circle back on a question you had: On Fri, May 1, 2026 at 9:46=E2=80=AFAM Mark Rutland <[email protected]> = wrote: > > + /* > > + * Consume RA and FP from the stack. The frame record puts FP at = a lower > > + * address than RA, so we always read FP first. > > + */ > > + if (frame.fp.rule & UNWIND_RULE_DEREF && > > + !get_word(&state->common, &fp)) > > + return -EINVAL; > > Why is this get_word() rather than get_consume_word()? I use get_word() here because get_consume_word(), in calling unwind_consume_stack() under the hood, consumes the stack up to the given address+size such that another unwind step cannot consume it again. If the subsequent call to get_consume_word() fails, the stack needs to be in a state such that we can fall back on a frame pointer unwind. But if we were to use get_consume_word() here, the fallback call to kunwind_next_frame_record() would not be able to consume the FP from the stack because it would already have been consumed by the failed call to unwind_next_frame_sframe(). By only calling get_consume_word() on the RA at the end, we defer making any changes to the underlying unwind state stack until we are sure the SFrame unwind step will succeed. > > > + > > + if (frame.ra.rule & UNWIND_RULE_DEREF && > > + get_consume_word(&state->common, &ra)) > > + return -EINVAL; > > + > > + state->common.pc =3D ra; > > + state->common.sp =3D cfa; Please let me know if this reasoning seems sound. Thanks, Dylan