openssh-unix-dev August 2011 archive
Main Archive Page > Month Archives  > openssh-unix-dev archives
openssh-unix-dev: Re: Call for testing: OpenSSH-5.9

Re: Call for testing: OpenSSH-5.9

From: Darren Tucker <dtucker_at_nospam>
Date: Mon Aug 29 2011 - 04:48:11 GMT
To: Morty Abzug <morty@frakir.org>

On Sun, Aug 28, 2011 at 9:18 PM, Darren Tucker <dtucker@zip.com.au> wrote:
 [...]
> I trussed an sshd (on Solaris 10 x86) and the failure seems to be polling FDs:

confirmed: it's poll. Still not sure what to do about it, it's used
in atomicio.

$ cat polltest.c
#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>
#include <poll.h>
#include <errno.h>

int main(int argc, char **argv)
{
        struct rlimit rl_zero;
        struct pollfd pfd;
        int fd, r, enforce_limit = 0;

        if (argc == 2 && strcmp(argv[1], "limit") == 0)
                enforce_limit = 1;

        fd = open("/dev/null", "r");
        if (enforce_limit) {
                rl_zero.rlim_cur = rl_zero.rlim_max = 0;
                setrlimit(RLIMIT_FSIZE, &rl_zero);
                setrlimit(RLIMIT_NOFILE, &rl_zero);
        }

        pfd.fd = fd;
        pfd.events = POLLOUT;
        r = poll(&pfd, 1, -1);
        printf("poll = %d, error: %s\n", r, strerror(errno));
}

$ gcc polltest.c && ./a.out
poll = 1, error: Error 0
$ ./a.out limit
poll = -1, error: Invalid argument

-- Darren Tucker (dtucker at zip.com.au) GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69 Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement. _______________________________________________ openssh-unix-dev mailing list openssh-unix-dev@mindrot.org https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev