Eliminate unnecessary memory allocation in sys_getgroups and its ibcs2 counterpart.
Merge remote-tracking branch 'upstream/master' into hardened/current/master
filedesc: cleanup setugidsafety a little

Rename it to fdsetugidsafety for consistency with other functions.

There is no need to take filedesc lock if not closing any files.

The loop has to verify each file and we are guaranteed fdtable has space
for at least 20 fds. As such there is no need to check fd_lastfile.

While here tidy up is_unsafe.
Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/master
GCC for PowerPC does not align  .note sections to 4 bytes.  When
running ctfmerge on its objects, libelf asserts as it expects
.note sections to be 4-byte aligned.  Change that expectation.

Approved by:	jkoshy@
Obtained from:	Juniper Networks, Inc.
Fix the conversion macro for .note sections, broken in the case
the ELF file's byte order is not the native byte order.  The
bug is that the variables holding the name and description size
are used (natively) after having been byte-swapped.  The fix is
to calculate sz from them just prior to byte-swapping.

Approved by:	jkoshy@
Obtained from:	Juniper Networks, Inc.
Avoid crdup when possible in kern_accessat.

While here tidy up a little.
Add defines for various FIRST PARTY DMA SEND subcommands.
Virtual machines can easily have more than 16 option ROMs and
when that happens, we happily access our resource array out of
bounds. Make sure we stay within the MAX_ROMS limit.
While here, bump MAX_ROMS from 16 to 32 to minimize the chance
of leaving option ROMs unaccounted for.

Obtained from:	Juniper Networks, Inc.
Reduce nesting in vn_access.

No functional changes.
Fix the kernel panic in hostap mode.
rvp->beacon_mbuf was NULL in run_update_beacon().

PR:	189405
Submitted by:	Gabor Simon <gabor.simon75 at gmail.com>
MFC after:	3 days
My previous commit exposed an issue as it fixed a different
issue. lib/atf isn't a prereq_lib, since it isn't required for other
libraries to build. Remove it. The old kludge of always building it
had effectively been retired. Since we don't want to build the
libraries with the tests when we're bootstrapping, invent
MK_TESTS_SUPPORT which normally defaults to the current MK_TESTS
value, except when explicitly defined. Make lib/atf depend on it being
yes. When building the libraries set MK_TESTS to no, and
MK_TESTS_SUPPORT to the current value of MK_TESTS so that later stages
of the build work correctly. This should fix (and does for me)
people's issues with parallel builds racing between lib/atf and
libexec/atf. Since lib/atf is built during the libraries phase, the
race disappears.
Merge remote-tracking branch 'freebsd/master' into hardened/current/master
Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/hardening