Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150819113406.00161e8f@ncopa-desktop.alpinelinux.org>
Date: Wed, 19 Aug 2015 11:34:06 +0200
From: Natanael Copa <ncopa@...inelinux.org>
To: Szabolcs Nagy <nsz@...t70.net>
Cc: musl@...ts.openwall.com, Tastky <tastky@...il.com>
Subject: Re: nfs-utils broken with musl: "select: Bad file
 descriptor"

On Tue, 18 Aug 2015 21:18:10 +0200
Szabolcs Nagy <nsz@...t70.net> wrote:

> * Felix Janda <felix.janda@...teo.de> [2015-08-18 20:20:14 +0200]:
> 
> > Rich Felker wrote:
> > > On Tue, Aug 18, 2015 at 06:50:54PM +0200, Tastky wrote:
> > > > Just checked with said include and everything recompiled.
> > > > Unfortunately the same error persists.
> > > > 
> > > > Running OpenWrt's command
> > > > /usr/sbin/rpc.statd -p 32778 -o 32779 -F
> > > > manually (following the script's prior steps, ofc) results in a loop of:
> > > > 
> > > > sm-notify: Version 1.3.2 starting
> > > > sm-notify: Already notifying clients; Exiting
> > > > 
> > > > With strace: http://pastebin.com/raw.php?i=9ypUbmsp
> > > 
> > > From the strace, I see that a nonsensical fd #105 is in the fd_set
> > > readfds that comes from SVC_FDSET. I don't know where the latter is
> > > defined or modified.
> > 
> > It is defined in system.h (now hopefully) to be svc_fdset, which seems
> > to be defined as a global variable by the rpc headers.
> > 
> 
> i think this call goes wrong:
> 
> http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=blob;f=utils/statd/rmtcall.c;hb=HEAD#l56
> 
> it loops for 100 iterations and if all ports are used
> according to getservbyport then it FD_SET(sockfd, &SVC_FDSET);
> with some random high sockfd (eg. 105) that is closed.


Yeah. Alpine Linux works around it this way:
http://git.alpinelinux.org/cgit/aports/plain/main/nfs-utils/musl-getservbyport.patch

Musl will always return something with getservbyport so we cannot skip
ports that returns non-null.

diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c
index fd576d9..d72a0bf 100644
--- a/utils/statd/rmtcall.c
+++ b/utils/statd/rmtcall.c
@@ -90,8 +90,10 @@ statd_get_socket(void)
 					__func__);
 			break;
 		}
+#if 0
 		se = getservbyport(sin.sin_port, "udp");
 		if (se == NULL)
+#endif
 			break;
 		/* rather not use that port, try again */


-nc

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.