NetBSD-Bugs archive

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

port-amd64/51700: exect(NULL,NULL,NULL) generates 15859 times SIGTRAP on amd64



>Number:         51700
>Category:       port-amd64
>Synopsis:       exect(NULL,NULL,NULL) generates 15859 times SIGTRAP on amd64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 09 06:40:00 +0000 2016
>Originator:     Kamil Rytarowski
>Release:        NetBSD 7.99.42 amd64
>Organization:
TNF
>Environment:
NetBSD chieftec 7.99.42 NetBSD 7.99.42 (GENERIC) #4: Sun Nov 27 14:13:23 CET 2016  root@chieftec:/public/netbsd-tmp-root/sys/arch/amd64/compile/GENERIC amd64
>Description:
exect(2) generates 15859 (in reality any big random number) times SIGTRAP while the same program generates single SIGTRAP.

Other ports are untested.
>How-To-Repeat:
$ cat exect.c                                                                                                                
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <signal.h>

#define ATF_REQUIRE(a) assert(a)
#define ATF_REQUIRE_EQ(a,b) assert(a == b)
#define ATF_REQUIRE_ERRNO(a,b) do{assert(errno==a); assert(b);}while(0)

static sig_atomic_t caught = 0;

static void
sigtrap_handler(int sig, siginfo_t *info, void *ctx)
{       
        assert(sig == SIGTRAP);
        ATF_REQUIRE_EQ(info->si_code, TRAP_TRACE);

        ++caught;
}

int
main(int argc, char **argv)
{
        int error;
        struct sigaction act;

        ATF_REQUIRE(sigemptyset(&act.sa_mask) == 0);
        act.sa_sigaction = sigtrap_handler;
        act.sa_flags = SA_SIGINFO;
 
        ATF_REQUIRE(sigaction(SIGTRAP, &act, 0) == 0);

        error = exect(NULL, NULL, NULL) == -1;
        printf("error=%d errno=%d\n", error, errno);

        printf("caught=%d\n", caught);
        
        return 0;
}

>Fix:
N/A



Home | Main Index | Thread Index | Old Index