This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/1548] New: glibc sunrpc svc_getreqset is broken
- From: "jlan at engr dot sgi dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 25 Oct 2005 21:10:12 -0000
- Subject: [Bug libc/1548] New: glibc sunrpc svc_getreqset is broken
- Reply-to: sourceware-bugzilla at sourceware dot org
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.