public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jlan at engr dot sgi dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/1548] New: glibc sunrpc svc_getreqset is broken
Date: Tue, 25 Oct 2005 21:10:00 -0000	[thread overview]
Message-ID: <20051025211011.1548.jlan@engr.sgi.com> (raw)

We ran into problems with a RPC client. File descriptors 32-63, 96-127, 
... are not being handled properly.

The svc_run implementation is calling svc_getreqset.
This function is broken because it is using ffs() to find bits
set in the fd_set * passed to it:

  maskp = readfds->fds_bits;
  for (sock = 0; sock < setsize; sock += NFDBITS)
    for (mask = *maskp++; (bit = ffs (mask)); mask ^= (1 << (bit - 1)))
      INTUSE(svc_getreq_common) (sock + bit - 1);

ffs() requires an int argument, but in .../sys/select.h we find

typedef long int __fd_mask;

The problem was reported in 2.3.3 version, but the problem still exists 
in glibc-2.3.5-10.3.

The problem can be fixed by using ffsl() instead.


--- glibc-2.3/sunrpc/svc.c      2004-02-09 02:47:53 -08:00
+++ glibc-2.3-fix/sunrpc/svc.c  2005-10-24 16:45:50 -07:00
@@ -372,7 +372,7 @@ svc_getreqset (fd_set *readfds)
     setsize = FD_SETSIZE;
   maskp = readfds->fds_bits;
   for (sock = 0; sock < setsize; sock += NFDBITS)
-    for (mask = *maskp++; (bit = ffs (mask)); mask ^= (1 << (bit - 1)))
+    for (mask = *maskp++; (bit = ffsl (mask)); mask ^= (1L << (bit - 1)))
       INTUSE(svc_getreq_common) (sock + bit - 1);
 }
 INTDEF (svc_getreqset)

-- 
           Summary: glibc sunrpc svc_getreqset is broken
           Product: glibc
           Version: 2.3.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: jlan at engr dot sgi dot com
                CC: glibc-bugs at sources dot redhat dot com,tee at sgi dot
                    com


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

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


             reply	other threads:[~2005-10-25 21:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-25 21:10 jlan at engr dot sgi dot com [this message]
2005-11-03 21:39 ` [Bug libc/1548] " cvs-commit at gcc dot gnu dot org
2005-11-03 23:19 ` jlan at engr dot sgi dot com
2005-11-03 23:30 ` cvs-commit at gcc dot gnu dot org
2005-12-23 15:22 ` drepper at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051025211011.1548.jlan@engr.sgi.com \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).