Hi, Cyril!

> What arch is this?

Irrelevant, I think, but x86_64.


> On my system both getfdsetsize() and FD_SETSIZE are set to 1024?

The test uses getdtablesize(), which pulls the OPEN_MAX kernel parameter.
In our kernel, we have OPEN_MAX set to more than FD_SETSIZE.

I first found this problem when this parameter had a typo, adding an order of 
magnitude to OPEN_MAX.
Without the added clause in the loop to restrict it, the test would usually 
core from zero-bit bombardment into related memory. 
Correcting the parameter typo unfortunately did not alter the test binary's 
behavior.

Arguably, this might be a bug with 
/usr/include/x86_64-linux-gnu/bits/typesizes.h and 
/usr/include/linux/posix_types.h
which hard-code __FD_SETSIZE to 1024 instead of checking the OPEN_MAX kernel 
paramenter.
(My knee-jerk reaction is to file this alongside "select() is broken".  :-)


An alternative patch might be to replace the getdtablesize() call by 
getfdsetsize().
This would rely on accept() never returning a value greater than FD_SETSIZE.
I see no indication in accept, select, or poll manpages whether this is the 
case;
I suspect it is so, otherwise select/poll cannot detect activity on some range 
of returned fd.

This would require inspecting the accept() code, though, and adding a test on 
accept() to verify that accept() cannot return a fd greater than FD_SETSIZE.
Maybe accept() in a near-infinite loop to exhaust all fd's ...?
(Beyond my available time right now.)


> What about we set nfds to sfd + 1 and for each child we accept we set nfds to 
> max(nfds, newfd+1)?

When accept() returns the highest-select()-detectable fd, this will clear the 
high-bit just off the end of the fdset, would it not?
It'll hit far less often, but still be out-of-bounds, sadly ....

Thanks!

Joseph
Joseph Beckenbach, senior QA engineer : Automation
Lancope, Inc. -- makers of StealthWatch -- 0-hour detecting 0-day exploits


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to