lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cfd18e0f0901131443l3a3203c7le2cbbe9b45c0cc38@mail.gmail.com>
Date:	Wed, 14 Jan 2009 11:43:05 +1300
From:	"Michael Kerrisk" <mtk.manpages@...glemail.com>
To:	"Roland McGrath" <roland@...hat.com>
Cc:	"kernel list" <linux-kernel@...r.kernel.org>,
	"Ulrich Drepper" <drepper@...hat.com>,
	"Vegard Nossum" <vegard.nossum@...il.com>,
	"linux-man@...r.kernel.org" <linux-man@...r.kernel.org>
Subject: Re: waitid() return value strangeness when infop is NULL

Test program below.  Two test runs, of which the second shows the
behavior I'm reporting.

$ ./a.out
Created child with PID 7727
infop = 0xbfe608e0
waitid() returned 0
$ ./a.out n
Created child with PID 7729
infop = (nil)
waitid() returned 7729

===

#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>

int
main(int argc, char *argv[])
{
    siginfo_t info, *infop;
    int options, idtype;
    long s;
    pid_t child;

    child = fork();
    if (child == 0)
        exit(0);
    printf("Created child with PID %ld\n", (long) child);

    idtype = P_PID;
    options = WEXITED;
    infop = (argc > 1 && strchr(argv[1], 'n') != NULL) ? NULL : &info;

    printf("infop = %p\n", infop);

    s = syscall(SYS_waitid, idtype, child, infop, options, NULL);
    if (s == -1) {
        perror("waitid");
        exit(EXIT_FAILURE);
    }

    printf("waitid() returned %ld\n", s);

    exit(EXIT_SUCCESS);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ