NetBSD-Bugs archive

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

port-evbarm/55200: COMPAT_NETBSD32 sigaction/sigaltstack support is broken



>Number:         55200
>Category:       port-evbarm
>Synopsis:       COMPAT_NETBSD32 sigaction/sigaltstack support is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-evbarm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 23 15:55:00 +0000 2020
>Originator:     Tobias Nygren
>Release:        9.99.57
>Organization:
>Environment:
>Description:
The kernel does not correctly switch to the user defined signal stack when running 32-bit binaries on an aarch64 kernel.
>How-To-Repeat:
/* SS_ONSTACK assertion should not fail, but does. */

#include <signal.h>
#include <unistd.h>
#include <assert.h>
#include <stdio.h>

char mystack[SIGSTKSZ];

void handler(int signum) {
        uint8_t a;
        stack_t oss;
        if (sigaltstack(NULL, &oss) < 0)
                perror("sigaltstack");
        assert(oss.ss_flags & SS_ONSTACK);
}

int main(void) {
        stack_t s = (stack_t){.ss_sp = mystack, .ss_size = sizeof(mystack), .ss_flags = 0 };
        struct sigaction act = (struct sigaction){ .sa_handler = handler, .sa_flags = SA_ONSTACK };
        sigemptyset(&act.sa_mask);
        if (sigaltstack(&s, 0) < 0)
                perror("sigaltstack");
        if (sigaction(SIGUSR1, &act, NULL) < 0)
                perror("sigaction");
        kill(getpid(), SIGUSR1);
        sleep(1);
        return 0;
}

>Fix:
Something wrong in netbsd32_sendsig_siginfo?



Home | Main Index | Thread Index | Old Index