opnsense-src/lib/libc
Kyle Evans 9da2fe96ff kern: fix setgroups(2) and getgroups(2) to match other platforms
On most other platforms observed, including OpenBSD, NetBSD, and Linux,
these system calls have long since been converted to only touching the
supplementary groups of the process.  This poses both portability and
security concerns in porting software to and from FreeBSD, as this
subtle difference is a landmine waiting to happen.  Bugs have been
discovered even in FreeBSD-local sources, since this behavior is
somewhat unintuitive (see, e.g., fix 48fd05999b for chroot(8)).

Now that the egid is tracked outside of cr_groups in our ucred, convert
the syscalls to deal with only supplementary groups.  Some remaining
stragglers in base that had baked in assumptions about these syscalls
are fixed in the process to avoid heartburn in conversion.

For relnotes: application developers should audit their use of both
setgroups(2) and getgroups(2) for signs that they had assumed the
previous FreeBSD behavior of using the first element for the egid.  Any
calls to setgroups() to clear groups that used a single array of the
now or soon-to-be egid can be converted to setgroups(0, NULL) calls to
clear the supplementary groups entirely on all FreeBSD versions.

Co-authored-by:	olce (but bugs are likely mine)
Relnotes:	yes (see last paragraph)
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D51648
2025-08-14 23:06:09 -05:00
..
aarch64
amd64 libc/amd64: rewrite memrchr() scalar impl. to read the string from the back 2025-08-09 22:13:27 +02:00
arm
capability
compat-43
csu
db
gdtoa
gen libc: gen: refactor execvPe() for readability 2025-08-02 23:15:03 -05:00
gmon
i386
iconv
include kern: fix setgroups(2) and getgroups(2) to match other platforms 2025-08-14 23:06:09 -05:00
inet
isc
locale
md
nameser
net
nls
posix1e
powerpc
powerpc64
powerpcspe
quad
regex libregex: fix our mapping for \w 2025-08-08 13:27:26 -05:00
resolv
riscv
rpc Remove Secure RPC DES authentication 2025-08-10 16:36:40 +01:00
secure
softfloat
stdio stdio: Fix bug in integer-parsing FSM 2025-08-09 00:46:03 +02:00
stdlib
stdtime
string
sys libc: stop trying to create __<syscall> symbols 2025-08-06 12:31:24 +01:00
tests stdio: Fix bug in integer-parsing FSM 2025-08-09 00:46:03 +02:00
uuid
x86/gen
xdr
yp
libc.ldscript
libc_nossp.ldscript
Makefile
Makefile.depend
Makefile.depend.options
Versions.def