Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Inner DRAP frames fail to unwind due to `state->topmost` restriction on `UNWIND_USER_RULE_REG_OFFSET_DEREF`. --
--- Patch [22]: [RFC PATCH v1 22/25] unwind_user/eh_frame/x86: Handle DRAP expressions --- commit a2eefb14435ba994b91a768aaf44090977190c84 Author: Jens Remus <[email protected]> unwind_user/eh_frame/x86: Handle DRAP expressions GCC uses DRAP (Dynamic Realign Argument Pointer) when the stack needs to be dynamically realigned. This patch adds x86-specific handling for the CFA and FP DWARF expressions patterns used to describe how to unwind through such frames. > diff --git a/kernel/unwind/eh_frame.c b/kernel/unwind/eh_frame.c > index 19e2bc96ddbc2..49e8a3e8d794a 100644 > --- a/kernel/unwind/eh_frame.c > +++ b/kernel/unwind/eh_frame.c [ ... ] > @@ -1206,6 +1231,16 @@ static __always_inline int __find_frame_row(struct > eh_frame_section *sec, > frame->fp.regnum = ctx.state.reg_regnum[FP_IDX]; > frame->fp.offset = 0; > break; > + case REG_REGISTER_OFFSET_DEREF: > + if (ctx.state.reg_regnum[FP_IDX] > UINT_MAX) > + return -EINVAL; > + if (ctx.state.reg_offset[FP_IDX] < INT_MIN || > + ctx.state.reg_offset[FP_IDX] > INT_MAX) > + return -EOPNOTSUPP; > + frame->fp.rule = UNWIND_USER_RULE_REG_OFFSET_DEREF; [Severity: High] Will this rule cause unwinding to fail for inner stack frames? When an inner stack frame requires DRAP evaluation, the unwinder evaluates UNWIND_USER_RULE_REG_OFFSET_DEREF in kernel/unwind/user.c:unwind_user_next_common() like this: if (!state->topmost || unwind_user_get_reg(&fp, frame->fp.regnum)) return -EINVAL; Since inner frames are not topmost, this check will return -EINVAL and abort the unwinding process. Could this truncate backtraces that pass through dynamically realigned stack frames? > + frame->fp.regnum = ctx.state.reg_regnum[FP_IDX]; > + frame->fp.offset = ctx.state.reg_offset[FP_IDX]; > + break; -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=22
