NetBSD-Bugs archive

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

port-vax/59308: kernel longjmp(9) fails to make setjmp(9) return 1



>Number:         59308
>Category:       port-vax
>Synopsis:       kernel longjmp(9) fails to make setjmp(9) return 1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-vax-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 17 05:30:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
set vax jump, jump vax jump
>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 vax code does this:

    276 _C_LABEL(longjmp):.word	0
    277 	movl	4(%ap), %r1
    278 	movl	8(%ap), %r0
    279 	movl	(%r1), %ap
    280 	movl	4(%r1), %fp
    281 	movl	12(%r1), %sp
    282 	jmp	*8(%r1)

https://nxr.netbsd.org/xref/src/sys/arch/vax/vax/subr.S?r=1.43#276

That is, it takes 8(%ap), which would hold the second argument if there were two arguments, and returns it.  Since there are not two arguments, it just returns stack garbage -- which might be zero.
>How-To-Repeat:
code inspection
mess with ddb, probably
>Fix:
Change

movl  8(%ap), %r0

to however you spell `load immediate 1 into %r0' in vaxlish.



Home | Main Index | Thread Index | Old Index