Thread (19 messages) 19 messages, 3 authors, 2025-12-08

Re: [RFC PATCH v2 03/15] x86/unwind_user: Guard unwind_user_word_size() by UNWIND_USER

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2025-12-05 17:24:13
Also in: bpf, linux-s390, lkml

 Random nit...

On Fri, 5 Dec 2025 at 09:15, Jens Remus [off-list ref] wrote:
+static inline int unwind_user_word_size(struct pt_regs *regs)
+{
+       /* We can't unwind VM86 stacks */
+       if (regs->flags & X86_VM_MASK)
+               return 0;
+#ifdef CONFIG_X86_64
+       if (!user_64bit_mode(regs))
+               return sizeof(int);
+#endif
+       return sizeof(long);
+}
I realize you just moved this around, but since I see it in the patch,
the #ifdef annoys me.

That user_64bit_mode() should work equally well on 32-bit, and this
can be written as

        return user_64bit_mode(regs) ? 8 : 4;

which avoids the #ifdef, and makes a lot more sense ("sizeof(long)"
together with "user_64bit_mode()"? It's literally testing 32 vs 64
bitness, not "int vs long").

              Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help