Mono Gateway (NXP LS1046A) fork of OPNsense src: DPAA/LS1046A kernel support, rebased on upstream release tags
Find a file
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
.cirrus-ci
.github .github: Use make.py's --cross-toolchain option on macOS 2025-08-06 16:14:37 -04:00
bin freebsd-version.8: Add back freebsd-update paragraph 2025-08-06 12:32:39 -04:00
cddl zfs: install zhack(1) manual page 2025-08-14 16:08:45 -07:00
contrib Merge bmake-20250804 2025-08-05 15:57:12 -07:00
crypto krb5: Update MIT KRB5 from 1.21 to 1.22 2025-08-09 22:29:02 -07:00
etc etc: add missing mtree entry for certctl tests 2025-08-13 19:27:30 -05:00
gnu build: remove the last vestiges of lint support 2025-06-06 00:55:34 +01:00
include Remove Secure RPC DES authentication 2025-08-10 16:36:40 +01:00
kerberos5 build: remove the last vestiges of lint support 2025-06-06 00:55:34 +01:00
krb5 krb5 ksu: Enable prompt for password 2025-08-11 15:12:09 -07:00
lib kern: fix setgroups(2) and getgroups(2) to match other platforms 2025-08-14 23:06:09 -05:00
libexec rtld: require MAP_GUARD support 2025-08-11 12:18:51 +01:00
release libutil++: Move to clibs 2025-08-08 16:14:07 +01:00
rescue nvmf: Switch several ioctls to using nvlists 2024-12-30 13:52:21 -05:00
sbin kern: fix setgroups(2) and getgroups(2) to match other platforms 2025-08-14 23:06:09 -05:00
secure openssl: Import version 3.5.1 2025-08-07 15:54:34 +02:00
share src.opts.mk: Style nits, remove obsolete comment 2025-08-14 22:29:11 +02:00
stand libsa: ip fragment reassembly is buggy 2025-08-08 10:10:08 +03:00
sys kern: fix setgroups(2) and getgroups(2) to match other platforms 2025-08-14 23:06:09 -05:00
targets zfsboot: Remove zfsboot(8) program used to boot ZFS from MBR + BIOS 2025-07-28 10:58:02 -04:00
tests tests/ci: Add missing kmods and pkgs to unskip tests 2025-08-14 05:05:09 +08:00
tools depend-cleanup: Handle tcopy moving from C to C++ 2025-08-14 16:46:01 -04:00
usr.bin kern: fix setgroups(2) and getgroups(2) to match other platforms 2025-08-14 23:06:09 -05:00
usr.sbin kern: fix setgroups(2) and getgroups(2) to match other platforms 2025-08-14 23:06:09 -05:00
.arcconfig
.arclint
.cirrus.yml .cirrus.yml: Switch to manual mode for internal CI 2025-07-06 14:40:24 +02:00
.clang-format clang-format: Minor tweaks 2024-04-30 17:33:43 -04:00
.git-blame-ignore-revs Fix: replace incorrect commit hash in .git-blame-ignore-revs 2025-08-07 12:01:17 -04:00
.gitattributes Remove SVN related Git attributes 2023-12-26 10:28:28 -07:00
.gitignore lyaml: vendor import lyaml bindings for libyaml version 6.2.8 2025-06-26 09:09:58 +02:00
.mailmap mailmap: Add Joyu Liao 2025-06-26 14:13:21 +02:00
CONTRIBUTING.md CONTRIBUTING: Tweak the language 2025-08-08 11:16:13 -06:00
COPYRIGHT copyright: Happy New Year 2025 2025-01-01 00:04:28 +00:00
LOCKS Update LOCKS for Git 2023-12-26 10:28:25 -07:00
MAINTAINERS man filesystems: fix more xrefs after move to s4 2024-06-27 18:32:05 -06:00
Makefile powerpc: Disconnect 32-bit powerpc from make universe 2025-07-14 11:01:09 -04:00
Makefile.inc1 certctl: Reimplement in C 2025-08-14 00:25:27 +02:00
Makefile.libcompat Makefile: Hook MIT KRB5 into the build 2025-06-15 19:49:37 -07:00
Makefile.sys.inc Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
ObsoleteFiles.inc ObsoleteFiles: Remove bogus manlink 2025-08-12 15:50:30 +02:00
README.md lyaml: vendor import lyaml bindings for libyaml version 6.2.8 2025-06-26 09:09:58 +02:00
RELNOTES RELNOTES: Make an entry for cce64f2e68 2025-08-13 12:58:21 -07:00
UPDATING UPDATING: Make an entry for cce64f2e68 2025-08-13 12:52:09 -07:00

FreeBSD Source:

This is the top level of the FreeBSD source directory.

FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms. A large community has continually developed it for more than thirty years. Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices.

For copyright information, please see the file COPYRIGHT in this directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information.

The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. See build(7), config(8), FreeBSD handbook on building userland, and Handbook for kernels for more information, including setting make(1) variables.

For information on the CPU architectures and platforms supported by FreeBSD, see the FreeBSD website's Platforms page.

For official FreeBSD bootable images, see the release page.

Source Roadmap:

Directory Description
bin System/user commands.
cddl Various commands and libraries under the Common Development and Distribution License.
contrib Packages contributed by 3rd parties.
crypto Cryptography stuff (see crypto/README).
etc Template files for /etc.
gnu Commands and libraries under the GNU General Public License (GPL) or Lesser General Public License (LGPL). Please see gnu/COPYING and gnu/COPYING.LIB for more information.
include System include files.
kerberos5 Kerberos5 (Heimdal) package.
lib System libraries.
libexec System daemons.
release Release building Makefile & associated tools.
rescue Build system for statically linked /rescue utilities.
sbin System commands.
secure Cryptographic libraries and commands.
share Shared resources.
stand Boot loader sources.
sys Kernel sources (see sys/README.md).
targets Support for experimental DIRDEPS_BUILD
tests Regression tests which can be run by Kyua. See tests/README for additional information.
tools Utilities for regression testing and miscellaneous tasks.
usr.bin User commands.
usr.sbin System administration commands.

For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see FreeBSD Handbook.