opnsense-src/sys/rpc
Kyle Evans be1f7435ef kern: start tracking cr_gid outside of cr_groups[]
This is the (mostly) kernel side of de-conflating cr_gid and the
supplemental groups.  The pre-existing behavior for getgroups() and
setgroups() is retained to keep the user <-> kernel boundary
functionally the same while we audit use of these syscalls, but we can
remove a lot of the internal special-casing just by reorganizing ucred
like this.

struct xucred has been altered because the cr_gid macro becomes
problematic if ucred has a real cr_gid member but xucred does not.  Most
notably, they both also have cr_groups[] members, so the definition
means that we could easily have situations where we end up using the
first supplemental group as the egid in some places.  We really can't
change the ABI of xucred, so instead we alias the first member to the
`cr_gid` name and maintain the status quo.

This also fixes the Linux setgroups(2)/getgroups(2) implementation to
more cleanly preserve the group set, now that we don't need to special
case cr_groups[0].

__FreeBSD_version bumped for the `struct ucred` ABI break.

For relnotes: downstreams and out-of-tree modules absolutely must fix
any references to cr_groups[0] in their code.  These are almost
exclusively incorrect in the new world, and cr_gid should be used
instead.  There is a cr_gid macro available in earlier FreeBSD versions
that can be used to avoid having version-dependant conditionals to refer
to the effective group id.  Surrounding code may need adjusted if it
peels off the first element of cr_groups and uses the others as the
supplemental groups, since the supplemental groups start at cr_groups[0]
now if &cr_groups[0] != &cr_gid.

Relnotes:	yes (see last paragraph)
Co-authored-by:	olce
Differential Revision:	https://reviews.freebsd.org/D51489
2025-07-30 23:44:11 -05:00
..
rpcsec_gss rpcsec_gss.c: Avoid panics in clnt_nl_call() 2025-07-19 07:51:40 -07:00
rpcsec_tls rpctls_impl.c: Fix handling of hung rpc tls daemon 2025-07-18 11:27:50 -07:00
auth.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
auth_none.c xdr: provide x_putmbuf method for kernel XDR 2025-02-01 01:00:25 -08:00
auth_unix.c xdr: provide x_putmbuf method for kernel XDR 2025-02-01 01:00:25 -08:00
authunix_prot.c kern: start tracking cr_gid outside of cr_groups[] 2025-07-30 23:44:11 -05:00
clnt.h krpc: add kernel side client over netlink(4) 2025-02-01 01:00:25 -08:00
clnt_bck.c rpc: use new macros to lock socket buffers 2024-04-09 09:17:19 -07:00
clnt_dg.c rpc: use new macros to lock socket buffers 2024-04-09 09:17:19 -07:00
clnt_nl.c krpc/clnt_nl: unregister the netlink group, when client is destroyed 2025-02-05 10:09:06 -08:00
clnt_nl.h krpc: add kernel side client over netlink(4) 2025-02-01 01:00:25 -08:00
clnt_rc.c clnt_rc.c: Fix the case where a TLS handshake fails 2025-07-18 17:39:08 -07:00
clnt_stat.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
clnt_vc.c rpcsec_tls/client: API refactoring between kernel and rpc.tlsclntd(8) 2025-02-01 01:00:27 -08:00
getnetconfig.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
krpc.h krpc/clnt_nl: filter RPC replies on vnet 2025-02-01 11:27:22 -08:00
netconfig.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
nettype.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
pmap_prot.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
replay.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
replay.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
rpc.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
rpc_callmsg.c sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
rpc_com.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
rpc_generic.c krpc: add kernel side client over netlink(4) 2025-02-01 01:00:25 -08:00
rpc_msg.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
rpc_prot.c sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
rpcb_clnt.c krpc: let the kernel talk to the rpcbind(8) service via netlink(4) 2025-02-01 01:00:26 -08:00
rpcb_clnt.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
rpcb_prot.c sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
rpcb_prot.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
rpcm_subs.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
rpcsec_gss.h nfscl/kgssapi: Fix Kerberized NFS mounts to pNFS servers 2023-10-23 13:21:14 -07:00
rpcsec_tls.h rpcsec_tls: cleanup the rpctls_syscall() 2025-02-01 01:00:28 -08:00
svc.c svc.c: Check for a non-NULL xp_socket 2024-05-27 19:22:04 -07:00
svc.h rpcsec_tls/server: API refactoring between kernel and rpc.tlsservd(8) 2025-02-01 01:00:27 -08:00
svc_auth.c kern: start tracking cr_gid outside of cr_groups[] 2025-07-30 23:44:11 -05:00
svc_auth.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
svc_auth_unix.c kern: start tracking cr_gid outside of cr_groups[] 2025-07-30 23:44:11 -05:00
svc_dg.c xdr: provide x_putmbuf method for kernel XDR 2025-02-01 01:00:25 -08:00
svc_generic.c rpc: remove svc_create(), it is not used 2025-01-08 20:00:12 -08:00
svc_vc.c rpcsec_tls/server: API refactoring between kernel and rpc.tlsservd(8) 2025-02-01 01:00:27 -08:00
types.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
xdr.h xdr: provide x_putmbuf method for kernel XDR 2025-02-01 01:00:25 -08:00