Date: Thu, 4 Jun 1998 18:20:04 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: dk+@ua.net Cc: barry@Lustig.COM, freebsd-hackers@FreeBSD.ORG, serge@yahoo.com Subject: Re: Code Logic Question in 2.2 RELENG Message-ID: <199806041820.LAA02386@usr05.primenet.com> In-Reply-To: <199806040614.XAA11387@dog.farm.org> from "Dmitry Kohmanyuk" at Jun 3, 98 11:14:29 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> > switch (select(_rpc_dtablesize(), &readfds, NULL, NULL, > > (struct timeval *)0)) { This code is wrong. You are not permitted to pass an initial value to select which is larger than sizeof(readfds). This is the same coding error that LDAP and ACAP had, except that they were explicitly calling getdtablesize(2) or using the sysconf return for _SC_OPEN_MAX. Both of these are, of course, bogus as hell, and will result in you accessing memory off the stack (unless you define FD_SETSIZE very large before including sys/types.h). Some of this memory will have non-zero bits in it, and some of those bits will, when dereferenced into kernel address space, appear to have data pending and/or will appear to be attempts to select on bad file descriptors. > what bothers me here is how come that select() returns -1 and yet > errno != EINTR. According to man page, it should be then one of > EBADF or EINVAL, none of which can occur... One thing that would help is if you were to tell us what *is* returned, rather than what is *not*. 8-). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806041820.LAA02386>