Re: [PATCH v12 02/14] unwind_user: Add frame pointer support

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
2025-07-01 02:10:30
Also in
bpf, lkml
Reply to
Steven Rostedt, 2025-07-01
On Mon, 30 Jun 2025 at 17:54, Steven Rostedt [off-list ref] wrote:
quoted hunk ↗ jump to hunk

+       /* stack going in wrong direction? */
+       if (cfa <= state->sp)
+               goto done;
I suspect this should do a lot more testing.
quoted hunk ↗ jump to hunk
+       /* Find the Return Address (RA) */
+       if (get_user(ra, (unsigned long *)(cfa + frame->ra_off)))
+               goto done;
+
+       if (frame->fp_off && get_user(fp, (unsigned long __user *)(cfa + frame->fp_off)))
+               goto done;
.. and this should check the frame for validity too.  At a minimum it
should be properly aligned, but things like "it had better be above
the current frame" to avoid having some loop would seem to be a good
idea.

Maybe even check that it's the same vma?

             Linus
Thread (51 messages) 51 messages, 6 authors, last reply 2025-07-07
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help