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 AM 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 = ra; > > + state->common.sp = cfa; Please let me know if this reasoning seems sound. Thanks, Dylan

