NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/59750: yppush aborts _svc_run: select failed: Bad file descriptor



>Number:         59750
>Category:       bin
>Synopsis:       yppush aborts _svc_run: select failed: Bad file descriptor
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 07 02:45:00 +0000 2025
>Originator:     sergio lenzi
>Release:        10.1_STABLE
>Organization:
k12.su
>Environment:
NetBSD desktop2.lenzicasa 10.1_STABLE NetBSD 10.1_STABLE (LZT) #11: Sat Aug 30 14:14:22 -03 2025  NetBSD@nvme.lenzicasa:/home/NetBSD/BUILD/10/amd64/OBJ/sys/arch/amd64/compile/GENERIC amd64
>Description:
setup of a nis (yp) master => slave ... when updated some server db the system tries to yppush to slace, it aborts with:
yppush -h sip -v passwd.byname
pushing passwd.byname [order=1762482473] in domain lenzicasa
pushing map passwd.byname in lenzicasa: order=1762482473, owner=fserver.lenzicasa
pushing to sip
asking host sip to transfer map (xid=4441)
yppush: _svc_run: select failed: Bad file descriptor
>How-To-Repeat:
command:
yppush  -h <slave addr>  -passwd.byname

or... update master.passwd via vipw.....

cd /var/yp
make


I have made a patch for yppush with the help of chat-gpt... seems to work...
>Fix:
Index: usr/src/usr.sbin/ypserv/yppush/yppush.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/ypserv/yppush/yppush.c,v
retrieving revision 1.25
diff -u -r1.25 yppush.c
--- usr/src/usr.sbin/ypserv/yppush/yppush.c	24 Jul 2021 21:31:39 -0000	1.25
+++ usr/src/usr.sbin/ypserv/yppush/yppush.c	7 Nov 2025 01:29:49 -0000
@@ -53,6 +53,8 @@
 #include <rpcsvc/yp_prot.h>
 #include <rpcsvc/ypclnt.h>
 
+
+static int yppush_cbfd = -1;
 #include "ypdb.h"
 #include "ypdef.h"
 #include "yplib_host.h"
@@ -347,6 +349,9 @@
 			break;
 	}
 	if (prog >= 0x5fffffff) {
+		/* failed to register a callback program; bail out gracefully */
+		/* (don't enter the svc loop with a bogus fdset) */
+		yppush_cbfd = -1;
 		warnx("unable to register callback");
 		goto error;
 	}
@@ -355,6 +360,9 @@
          * now fork off a server to catch our reply
          */
 	pid = fork();
+	/* remember the UDP transport fd for the child select() loop */
+	if (pid >= 0)
+		yppush_cbfd = transp->xp_fd;
 	if (pid == -1) {
 		svc_unregister(prog, 1);	/* drop our mapping with
 						 * portmap */
@@ -429,10 +437,12 @@
 	struct timeval tv;
 	int     rv, nfds;
 
-	nfds = sysconf(_SC_OPEN_MAX);
+	nfds = (yppush_cbfd >= 0) ? (yppush_cbfd + 1) : sysconf(_SC_OPEN_MAX);
 	while (1) {
 
-		readfds = svc_fdset;	/* structure copy from global var */
+		FD_ZERO(&readfds);
+		if (yppush_cbfd >= 0)
+			FD_SET(yppush_cbfd, &readfds);
 		tv.tv_sec = 60;
 		tv.tv_usec = 0;



Home | Main Index | Thread Index | Old Index