public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/10352] New: no protection against using fd_set with fd>1024
@ 2009-06-30 20:06 kees at outflux dot net
  2009-10-30  6:31 ` [Bug libc/10352] " drepper at redhat dot com
  0 siblings, 1 reply; 9+ messages in thread
From: kees at outflux dot net @ 2009-06-30 20:06 UTC (permalink / raw)
  To: glibc-bugs

When a program using select() starts tracking file descriptors above 1024,
the fd_set vector (128 bytes) will overflow, writing to whatever is
beyond the vector, leading to stack/heap corruption.

This is a known, old, issue.  Examples:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-1500
http://marc.info/?l=bugtraq&m=110660879328901

It is perfectly valid to use select() on a user-allocated vector that IS large
enough to handle the the fds being tracked, but it seems that glibc should take
some proactive measures to help applications that are not checking FD_SETSIZE.

It was pointed out that SSH, e.g. uses this to work around the issue:
fdset = (fd_set *)xcalloc(howmany(maxfd + 1, NFDBITS)

Some ideas could be to flag FD_ZERO as dangerous?  Or to check sizeof(...) on
select() inputs?

I would love to see a reasonable approach to protecting applications that aren't
prepared for RLIMIT_NOFILE to be >1024.  :)

Also being tracked here: https://bugs.launchpad.net/bugs/386558
Thanks!

-- 
           Summary: no protection against using fd_set with fd>1024
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: kees at outflux dot net
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=10352

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-07-28  4:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-10352-131@http.sourceware.org/bugzilla/>
2011-05-02 15:20 ` [Bug libc/10352] no protection against using fd_set with fd>1024 bressers at redhat dot com
2011-05-03  0:32 ` drepper.fsp at gmail dot com
2011-05-03 20:05 ` bugdal at aerifal dot cx
2014-06-13 11:02 ` fweimer at redhat dot com
2014-06-13 11:02 ` fweimer at redhat dot com
2014-06-13 18:19 ` kees at outflux dot net
2014-10-01  0:05 ` djm at djm dot net.au
2020-07-28  4:45 ` meave390 at gmail dot com
2009-06-30 20:06 [Bug libc/10352] New: " kees at outflux dot net
2009-10-30  6:31 ` [Bug libc/10352] " drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).