cvs commit: src/lib/libc/rpc svc_vc.c
Marius Strobl
marius at alchemy.franken.de
Thu May 29 08:43:36 PDT 2003
On Wed, May 28, 2003 at 02:16:35AM -0700, Martin Blapp wrote:
> mbr 2003/05/28 02:16:35 PDT
>
> FreeBSD src repository
>
> Modified files:
> lib/libc/rpc svc_vc.c
> Log:
> If AF_LOCAL is used, we need to use __msgread_withcred() instead of
> just read() in non-blocking mode too. The reason is obvious. NetBSD
> uses a complete different way to get the credentials so this patch
> only applies to FreeBSD.
>
static int
read_vc(xprtp, buf, len)
void *xprtp;
void *buf;
int len;
{
SVCXPRT *xprt;
int sock;
int milliseconds = 35 * 1000;
struct pollfd pollfd;
struct sockaddr *sa;
struct cmessage *cm;
struct cf_conn *cfp;
xprt = (SVCXPRT *)xprtp;
assert(xprt != NULL);
sock = xprt->xp_fd;
cfp = (struct cf_conn *)xprt->xp_p1;
if (cfp->nonblock) {
if (sa->sa_family == AF_LOCAL) {
This is bogus, it uses an uninitialized sa which causes problems on at
least sparc64:
Starting rpcbind.
May 29 15:03:01 alchemy rpcbind: cannot create socket for udp6
May 29 15:03:01 alchemy rpcbind: cannot create socket for tcp6
NFS access cache time=2
ELF ldconfig path: /usr/lib /usr/lib/compat /usr/local/lib
Starting mountd.
Starting nfsd.
Starting statd.
rpc.statd: svc_tli_create: could not open connection for udp6
May 29 15:03:03 alchemy kernel: pid 259 (rpcbind), uid 0: exited on signal 11 ()
rpc.statd: svc_tp_create: Could not register prog 100024 vers 1 on udp
rpc.statd: cannot create udp service
Starting lockd.
May 29 15:03:03 alchemy mountd[321]: could not create any services
rpc.lockd: unable to register (NLM_PROG, NLM_SM, udp)
Starting local daemons:
alchemy# gdb53 -c /rpcbind.core /usr/sbin/rpcbind
GNU gdb 5.3 (FreeBSD)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "sparc64-portbld-freebsd5.1"...
Core was generated by `rpcbind'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libwrap.so.3...done.
Loaded symbols for /usr/lib/libwrap.so.3
Reading symbols from /usr/lib/libutil.so.3...done.
Loaded symbols for /usr/lib/libutil.so.3
Reading symbols from /usr/lib/libc.so.5...done.
Loaded symbols for /usr/lib/libc.so.5
Reading symbols from /usr/libexec/ld-elf.so.1...done.
Loaded symbols for /usr/libexec/ld-elf.so.1
#0 read_vc (xprtp=0x21a300, buf=0x21a47c, len=4)
at /usr/src/lib/libc/rpc/svc_vc.c:491
491 if (sa->sa_family == AF_LOCAL) {
(gdb) where
#0 read_vc (xprtp=0x21a300, buf=0x21a47c, len=4)
at /usr/src/lib/libc/rpc/svc_vc.c:491
#1 0x00000000405e5658 in __xdrrec_getrec (xdrs=0x21a400, statp=0x220400,
expectdata=1) at /usr/src/lib/libc/xdr/xdr_rec.c:548
#2 0x00000000405d63d8 in svc_vc_recv (xprt=0x220400, msg=0x7fdffffd880)
at /usr/src/lib/libc/rpc/svc_vc.c:633
#3 0x00000000405d9d30 in svc_getreq_common (fd=32)
at /usr/src/lib/libc/rpc/svc.c:635
#4 0x00000000405d9fd8 in svc_getreq_poll (pfdp=0x7fdffffdb10, pollretval=1)
at /usr/src/lib/libc/rpc/svc.c:728
#5 0x00000000001070a8 in my_svc_run () at rpcb_svc_com.c:1142
#6 0x0000000000103f20 in main (argc=0, argv=0x7fdfffffd88) at rpcbind.c:223
#7 0x0000000000102ca4 in _start ()
But even if sa is initialized before the check for
sa->sa_family == AF_LOCAL the added code causes still problems when
the kernel is compiled without IPv6-support:
Starting rpcbind.
May 29 17:29:55 alchemy rpcbind: cannot create socket for udp6
May 29 17:29:55 alchemy rpcbind: cannot create socket for tcp6
NFS access cache time=2
ELF ldconfig path: /usr/lib /usr/lib/compat /usr/local/lib
Starting mountd.
Starting nfsd.
May 29 17:29:56 alchemy mountd[319]: could not create any services
Starting statd.
rpc.statd: svc_tli_create: could not open connection for udp6
rpc.statd: svc_tp_create: Could not register prog 100024 vers 1 on udp
rpc.statd: cannot create udp service
Starting lockd.
rpc.lockd: unable to register (NLM_PROG, NLM_SM, udp)
Starting local daemons:.
Reverting to revision 1.17 of src/lib/libc/rpc/svc_vc.c fixes it:
Starting rpcbind.
May 29 17:17:47 alchemy rpcbind: cannot create socket for udp6
May 29 17:17:47 alchemy rpcbind: cannot create socket for tcp6
NFS access cache time=2
ELF ldconfig path: /usr/lib /usr/lib/compat /usr/local/lib
Starting mountd.
Starting nfsd.
Starting statd.
rpc.statd: svc_tli_create: could not open connection for udp6
rpc.statd: svc_tli_create: could not open connection for tcp6
Starting lockd.
Starting local daemons:.
More information about the cvs-all
mailing list