NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-powerpc/59306: kernel longjmp(9) fails to make setjmp(9) return 1



>Number:         59306
>Category:       port-powerpc
>Synopsis:       kernel longjmp(9) fails to make setjmp(9) return 1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-powerpc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 17 05:15:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
i'm out of clever names tonight foundation
>Environment:
>Description:
Kernel longjmp(9) is supposed to make setjmp(9) return 1 -- it doesn't take a second argument for the return value.  But the powerpc code does this:

    103 	mr %r3, %r4
    104 	blr

https://nxr.netbsd.org/xref/src/sys/arch/powerpc/powerpc/setjmp.S?r=1.4

powerpc ABI puts arguments in %r3, %r4, ..., and return value in %r3, so this returns whatever garbage is in the register for the second argument -- garbage because kernel longjmp doesn't take a second argument.
>How-To-Repeat:
code inspection
mess with ddb, probably
>Fix:
Change

mr %r3, %r4

to

li %r3, 1



Home | Main Index | Thread Index | Old Index