FreeBSD/src 0009c4e. UPDATING, sys/sys param.h

UPDATING: add note that API/ABI for RPC services for the kernel has changed
DeltaFile
+8-0UPDATING
+1-1sys/sys/param.h
+9-12 files

FreeBSD/src c62ae12include/rpc svc.h, lib/libc/rpc svc_nl.c

rpc: limited multithread support for svc_nl

The rpc(3) itself was not designed with multithreading in mind, but we can
actually achieve some parallelism without modifying the library and the
framework.  This transport will allow to process RPCs in threads, with
some hacks on the application side (documented in code).  We make
reentrable only one method - SVC_REPLY().  Reading and parsing of incoming
calls is still done synchronously.  But the actual processing of the calls
can be offloaded to a thread, and once finished the thread can safely
execute svc_sendreply() and the reply would be sent with the correct xid.

Differential Revision:  https://reviews.freebsd.org/D48569
DeltaFile
+86-14lib/libc/rpc/svc_nl.c
+7-0include/rpc/svc.h
+93-142 files

FreeBSD/src 765ad4fsys/kern syscalls.master, sys/rpc rpcsec_tls.h

rpcsec_tls: cleanup the rpctls_syscall()

With all the recent changes we don't need extra argument that specifies
what exactly the syscalls does, neither we need a copyout-able pointer,
just a pointer sized integer.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48649
DeltaFile
+48-46sys/rpc/rpcsec_tls/rpctls_impl.c
+2-6sys/rpc/rpcsec_tls.h
+1-2sys/kern/syscalls.master
+1-1usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c
+1-1usr.sbin/rpc.tlsservd/rpc.tlsservd.c
+53-565 files

FreeBSD/src 8e5f80dsys/rpc rpcsec_tls.h, usr.sbin/rpc.tlsservd rpc.tlsservd.c rpc.tlsservd.8

rpc.tlsservd: provide parallelism with help of pthread(3)

At normal NFS server runtime there is not much RPC traffic from kernel to
rpc.tlsservd.  But as Rick rmacklem@ explained, the notion of multiple
workers exists to handle a situation when a server reboots and it has
several hundred or thousands of TLS/TCP connections from clients.  Once it
comes back up, all the clients make TCP connections and do TLS handshakes.

So cleanup the remnants of the workers, that left after the conversion of
RPC over netlink(4) transport and restore desired parallelism with help of
pthread(3).

We are processing the TLS handshakes in separate threads, one per
handshake.  Number of concurrent threads is capped by hw.ncpu / 2, but this
can be overriden with -N.

Differential Revision:  https://reviews.freebsd.org/D48570
DeltaFile
+153-116usr.sbin/rpc.tlsservd/rpc.tlsservd.c
+10-9usr.sbin/rpc.tlsservd/rpc.tlsservd.8
+0-3sys/rpc/rpcsec_tls.h
+1-1usr.sbin/rpc.tlsservd/Makefile
+164-1294 files

FreeBSD/src 99e5a70lib/libsys _libsys.h, sys/compat/freebsd32 freebsd32_systrace_args.c

sysent: regen for deletion of gssd_syscall and new ABI for rpctls_syscall
DeltaFile
+3-29sys/kern/systrace_args.c
+3-29sys/compat/freebsd32/freebsd32_systrace_args.c
+1-7sys/sys/sysproto.h
+2-2lib/libsys/_libsys.h
+1-1sys/kern/init_sysent.c
+1-1sys/kern/syscalls.c
+11-695 files not shown
+15-7411 files

FreeBSD/src 75a884fsys/rpc/rpcsec_tls rpctls_impl.c

rpcsec_tls: merge RPC failure for rpctls_connect() and rpctls_server()

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48677
DeltaFile
+46-54sys/rpc/rpcsec_tls/rpctls_impl.c
+46-541 files

FreeBSD/src 550e8e3usr.sbin/rpc.tlsclntd rpc.tlsclntd.c, usr.sbin/rpc.tlsservd rpc.tlsservd.c rpc.tlscommon.h

rpc.tlsservd/rpc.tlsclntd: rename 'refno' field to 'cookie'

Since in the kernel and in the API this is now called socket cookie.
No functional change.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48777
DeltaFile
+3-3usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c
+3-3usr.sbin/rpc.tlsservd/rpc.tlsservd.c
+2-2usr.sbin/rpc.tlsservd/rpc.tlscommon.h
+8-83 files

FreeBSD/src 4df8df9usr.sbin/rpc.tlsservd rpc.tlsservd.c

rpc.tlsservd: followup of API refactoring in the previous commit

Userland counterpart of the previous commit.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48567
DeltaFile
+14-40usr.sbin/rpc.tlsservd/rpc.tlsservd.c
+14-401 files

FreeBSD/src e3e36e1sys/rpc clnt_vc.c

krpc: assert that we don't support kernel RPC over unix(4)

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48563
DeltaFile
+3-0sys/rpc/clnt_vc.c
+3-01 files

FreeBSD/src d3d6c9busr.sbin/rpc.tlsservd rpc.tlsservd.c

rpc.tlsservd: run netlink(4) service and use new API to get sockets

Userland counterpart of the previous commit.

Note: this change intentionally ignores aspect of multiple workers of
rpc.tlsservd(8).  This also will be addressed in a future commit.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48562
DeltaFile
+4-68usr.sbin/rpc.tlsservd/rpc.tlsservd.c
+4-681 files

FreeBSD/src af80525sys/rpc svc_vc.c rpcsec_tls.h, sys/rpc/rpcsec_tls rpctls_impl.c rpctlssd.x

rpcsec_tls/server: API refactoring between kernel and rpc.tlsservd(8)

Now that the conversion of rpcsec_tls/client + rpc.tlsclntd(8) to the
netlink(4) socket as RPC transport started using kernel socket pointer as
a reliable cookie, we can shave off quite a lot of complexity.  We will
utilize the same kernel-generated cookie in all RPCs.  And the need for
the daemon generated cookie in the form of timestamp+sequence vanishes.

We also stop passing notion of 'process position' from userland to
kernel.  The TLS handshake parallelism to be reimplemented in the daemon
without any awareness about that in the kernel.

This time bump the RPC version.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48566
DeltaFile
+16-33sys/rpc/rpcsec_tls/rpctls_impl.c
+3-10sys/rpc/rpcsec_tls/rpctlssd.x
+2-6sys/rpc/svc_vc.c
+2-4sys/rpc/rpcsec_tls.h
+0-4sys/rpc/svc.h
+23-575 files

FreeBSD/src e1b723dusr.sbin/rpc.tlsclntd rpc.tlsclntd.c

rpc.tlsclntd: followup of API refactoring in the previous commit

Userland counterpart of the previous commit.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48565
DeltaFile
+16-46usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c
+16-461 files

FreeBSD/src 42eec52sys/rpc rpcsec_tls.h, sys/rpc/rpcsec_tls rpctls_impl.c rpctlssd.x

rpcsec_tls/server: use netlink RPC client to talk to rpc.tlsservd(8)

The server part just repeats what had been done to the client.  We trust
the parallelism of clnt_nl and we pass socket cookie to the daemon, which
we then expect to see in the rpctls_syscall(RPCTLS_SYSC_SRVSOCKET) to find
the corresponding socket+xprt.  We reuse the same database that is used
for clients.

Note 1: this will be optimized further in a separate commit.  This one is
made intentionally minimal, to ease the review process.

Note 2: this change intentionally ignores aspect of multiple workers of
rpc.tlsservd(8).  This also will be addressed in a future commit.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48561
DeltaFile
+95-299sys/rpc/rpcsec_tls/rpctls_impl.c
+4-1sys/rpc/rpcsec_tls/rpctlssd.x
+0-3sys/rpc/rpcsec_tls.h
+99-3033 files

FreeBSD/src 56a96c5sys/rpc clnt_vc.c rpcsec_tls.h, sys/rpc/rpcsec_tls rpctls_impl.c rpctlscd.x

rpcsec_tls/client: API refactoring between kernel and rpc.tlsclntd(8)

Now that the conversion of rpcsec_tls/client + rpc.tlsclntd(8) to the
netlink(4) socket as RPC transport started using kernel socket pointer as
a reliable cookie, we can shave off quite a lot of complexity.  We will
utilize the same kernel-generated cookie in all RPCs.  And the need for
the daemon generated cookie in the form of timestamp+sequence vanishes.

In the clnt_vc.c we no longer need to store the userland cookie, but we
still need to observe the TLS life cycle of the client.  We observe
RPCTLS_INHANDSHAKE state, that lives for a short time when the socket had
already been fetched by the daemon with the syscall, but the RPC call is
still waiting for the reply from daemon.

This time bump the RPC version.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48564
DeltaFile
+32-39sys/rpc/clnt_vc.c
+19-37sys/rpc/rpcsec_tls/rpctls_impl.c
+3-10sys/rpc/rpcsec_tls/rpctlscd.x
+3-8sys/rpc/rpcsec_tls.h
+5-4sys/rpc/clnt_rc.c
+5-3sys/rpc/krpc.h
+67-1016 files

FreeBSD/src 88b0afeusr.sbin/rpc.tlsclntd rpc.tlsclntd.c

rpc.tlsclntd: run netlink(4) service and use new API to get sockets

Userland counterpart of the previous commit.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48560
DeltaFile
+3-55usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c
+3-551 files

FreeBSD/src b837f10sys/fs/nfsclient nfs_clvfsops.c

nfs: set vnet(9) context in mountnfs()

This seems to be the right place to set it once and for all, without
setting it deep in kgssapi/rpctls/etc leaf functions.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48558
DeltaFile
+5-0sys/fs/nfsclient/nfs_clvfsops.c
+5-01 files

FreeBSD/src 030c028lib/libsys _libsys.h syscalls.map, sys/kern syscalls.master

kgssapi: remove the gssd_syscall

Reviewed by:            brooks
Differential Revision:  https://reviews.freebsd.org/D48554
DeltaFile
+1-6sys/kern/syscalls.master
+0-2lib/libsys/_libsys.h
+0-2lib/libsys/syscalls.map
+0-1lib/libsys/Symbol.sys.map
+1-114 files

FreeBSD/src a3a6dc2sys/rpc rpcsec_tls.h, sys/rpc/rpcsec_tls rpctls_impl.c rpctlscd.x

rpcsec_tls/client: use netlink RPC client to talk to rpc.tlsclntd(8)

In addition to using netlink(4) socket instead of unix(4) to pass
rpctlscd_* RPC commands to rpc.tlsclntd(8), the logic of passing file
descriptor is also changed.  Since clnt_nl provides us all needed
parallelism and waits on individual RPC xids, we don't need to store
socket in a global variable and serialize all communication to the daemon.
Instead, we will augment rpctlscd_connect arguments with a cookie that is
basically a pointer to socket, that we keep for the daemon.  While
sleeping on the request, we will store a database of all sockets
associated with rpctlscd_connect RPCs that we have sent to userland.  The
daemon then will send us back the cookie in the
rpctls_syscall(RPCTLS_SYSC_CLSOCKET) argument and we will find and return
the socket for this upcall.

This will be optimized further in a separate commit, that will also touch
clnt_vc.c and other krpc files.  This commit is intentionally made minimal,
so that it is easier to understand what changes with netlink(4) transport.


    [2 lines not shown]
DeltaFile
+95-162sys/rpc/rpcsec_tls/rpctls_impl.c
+0-2sys/rpc/rpcsec_tls.h
+1-0sys/rpc/rpcsec_tls/rpctlscd.x
+96-1643 files

FreeBSD/src 59f9d8csys/nlm nlm_prot_impl.c

nlm: set vnet(9) context in the NLM syscall

With the kernel RPC binding moving to Netlink transport all clients need
to have proper vnet(9) context set.  This change will unlikely make NLM
properly virtualized, but at least it will not panic on the default VNET
when kernel is compiled with VIMAGE.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48555
DeltaFile
+6-1sys/nlm/nlm_prot_impl.c
+6-11 files

FreeBSD/src 54a567asys/rpc rpcb_clnt.c

krpc: let the kernel talk to the rpcbind(8) service via netlink(4)

At the moment the only kernel service that wants to register RPC binding
in the rpcbind(8) is kernel NLM.

Kernel counterpart of the previous commit.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48557
DeltaFile
+10-63sys/rpc/rpcb_clnt.c
+10-631 files

FreeBSD/src d50fc4busr.sbin/rpcbind rpcbind.c security.c

rpcbind: run netlink(4) service

To register RPC bindings coming from the kernel.  At the moment, we expect
such bindings only from the kernel NLM service.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48556
DeltaFile
+42-27usr.sbin/rpcbind/rpcbind.c
+1-0usr.sbin/rpcbind/security.c
+43-272 files

FreeBSD/src a8f6169usr.sbin/gssd gssd.c

gssd: use netlink(4) RPC service to talk to kernel GSS

Userland counterpart of the previous commit.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48553
DeltaFile
+5-64usr.sbin/gssd/gssd.c
+5-641 files

FreeBSD/src e1ebda4sys/ufs/ffs ffs_subr.c ffs_alloc.c

ffs: fix build with GEOM_LABEL and without FFS, e.g. MINIMAL

The root of vfs.ffs sysctl tree was declared in ffs_alloc.c.  The
1111a44301da started to use the root in ffs_subr.c.  However, ffs_subr.c
may be included in kernels that do not have FFS in their config.  Such
kernel won't link after 1111a44301da.

Fixes:  1111a44301da39d7b7459c784230e1405e8980f8
DeltaFile
+3-1sys/ufs/ffs/ffs_subr.c
+1-2sys/ufs/ffs/ffs_alloc.c
+4-32 files

FreeBSD/src c5d671binclude/rpc svc.h, lib/libc/rpc svc_nl.c Symbol.map

libc/rpc: add userland side RPC server over netlink(4)

To be used by NFS related daemons that provide RPC services to the kernel.
Some implementation details inside the new svc_nl.c.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48550
DeltaFile
+300-0lib/libc/rpc/svc_nl.c
+6-0include/rpc/svc.h
+4-0lib/libc/rpc/Symbol.map
+2-1lib/libc/rpc/rpc_generic.c
+1-1lib/libc/rpc/Makefile.inc
+313-25 files

FreeBSD/src 66612e6sys/rpc xdr.h auth_none.c, sys/rpc/rpcsec_gss rpcsec_gss.c

xdr: provide x_putmbuf method for kernel XDR

Get it implemented for mbuf based XDR.  Right now all existing consumers
use only mbuf based XDR.  However, future changes will require appending
data stored in an mbuf to memory buffer based XDR.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48547
DeltaFile
+10-6sys/xdr/xdr_mbuf.c
+9-2sys/rpc/xdr.h
+3-6sys/rpc/rpcsec_gss/rpcsec_gss.c
+1-3sys/rpc/auth_none.c
+1-3sys/rpc/auth_unix.c
+1-3sys/rpc/rpcsec_tls/auth_tls.c
+25-232 files not shown
+28-268 files

FreeBSD/src 033b4c1sys/kgssapi gss_impl.c

kgssapi: use netlink RPC client to talk to gssd(8)

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48552
DeltaFile
+28-80sys/kgssapi/gss_impl.c
+28-801 files

FreeBSD/src fa1b961include/rpc Makefile, sys/rpc clnt_nl.c clnt_nl.h

krpc: add kernel side client over netlink(4)

This shall be the official transport to connect kernel side RPC clients
to userland side RPC servers.  All current kernel side clients that
hijack unix(4) sockets will be converted to it.  Some implementation
details are available inside new clnt_nl.c.

The complementary RPC server over netlink(4) coming in next commit.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48549
DeltaFile
+510-0sys/rpc/clnt_nl.c
+42-0sys/rpc/clnt_nl.h
+11-0sys/rpc/clnt.h
+6-0include/rpc/Makefile
+2-1sys/rpc/rpc_generic.c
+2-0sys/rpc/krpc.h
+573-12 files not shown
+575-18 files

FreeBSD/src 88cd1e1usr.bin/genl parser_rpc.c genl.c

genl: add RPC parser that dumps what sys/rpc/clnt_nl.c sends

Use a separate file for the RPC parser.  Potentially it may get bigger.
Also to avoid include RPC header pollution of the genl.c.

Reviewed by:            rmacklem
Differential Revision:  https://reviews.freebsd.org/D48551
DeltaFile
+161-0usr.bin/genl/parser_rpc.c
+23-10usr.bin/genl/genl.c
+31-0usr.bin/genl/genl.h
+1-0usr.bin/genl/Makefile
+216-104 files

FreeBSD/src 5418b1esys/xdr xdr_mem.c

xdr: provide x_putmbuf method for xdrmem

It has slightly different semantic than same method for xdrmbuf.  The
mbuf data is copied and caller is responsible to keep or free the
original mbuf.

Reviewed by:            rmacklem, markj
Differential Revision:  https://reviews.freebsd.org/D48548
DeltaFile
+25-0sys/xdr/xdr_mem.c
+25-01 files

FreeBSD/src d9753f8. Makefile.inc1, etc Makefile

mtree: TESTSBASE directory always starts with a /

Remove the extra forward slash ("/"), otherwise the mtree specification
file will have the double slash and will not be parsed by makefs when
attempting to build NanoBSD with NO_ROOT privileges.

Fixes:  07670b30fa43 ("Create /usr/tests *.debug file directory hierarchy")
Reviewed by:    emaste
Approved by:    emaste (mentor)
Differential Revision:  https://reviews.freebsd.org/D47722

(cherry picked from commit 01ff67f4bdf5959a719a6511a855f6a60c0e3a93)
DeltaFile
+1-1Makefile.inc1
+1-1etc/Makefile
+2-22 files