Re: [RFC PATCH v1 11/25] unwind_user/eh_frame: Wire up unwind_user to eh_frame
Jens Remus <[email protected]>
| Newsgroups | dev.linux.lists.sashiko-reviews,org.kernel.vger.linux-s390,org.kernel.vger.linux-trace-kernel |
|---|---|
| Organization | IBM Deutschland Research & Development GmbH |
| Message-ID | <[email protected]> |
On 8/18/2026 5:09 PM, [email protected] wrote: > Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: > - [High] The unwinder fails to adjust the return address before looking up the FDE for non-topmost frames, leading to unwinding failures or incorrect CFI state at function boundaries. Valid. See below. > - [High] Child processes created via fork() do not inherit the .eh_frame tracking structures, silently breaking user stack unwinding for all child processes. This is resolved by subsequent patch "unwind_user/eh_frame: Duplicate registered .eh_frame[_hdr] section data on clone/fork". >> diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c >> +static int unwind_user_next_eh_frame(struct unwind_user_state *state) >> +{ >> + struct unwind_user_frame frame; >> + >> + /* eh_frame expects the frame to be local storage */ >> + if (eh_frame_find(state->ip, &frame)) > > [Severity: High] > Does the lookup need to adjust the instruction pointer for non-topmost frames? > > When state->ip holds the return address (for non-topmost frames), it points to > the instruction after the call. If a function call is the last instruction of > an FDE block, passing the unmodified state->ip could cause the lookup to fall > outside the FDE or into the next function's FDE. > > Could this lead to incorrect unwinding state or unwinding failures at function > boundaries? I do have a patch to adjust the return address for non-topmost frames in the common unwind user code. It resolves a few unwind issues in Glibc on s390. The question is whether it should be adjusted only internally on lookup (as suggested by Sashiko AI above) or whether it should be adjusted so that the adjustment becomes visible in the recorded callchain: state->ip = ra - (!state->topmost); Thoughts? > >> + return -ENOENT; >> + return unwind_user_next_common(state, &frame); >> +} Thanks and regards, Jens -- Jens Remus Linux on Z Development (D3303) [email protected] / [email protected] IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294 IBM Data Privacy Statement: https://www.ibm.com/privacy/