FreeBSD/src 8d93877include Makefile, sys/sys stdarg.h

Add sys/stdarg.h

While the type of va_list and implementation of va_*() psuedo functions
varies (sometimes greatly) by architecture, they will always be defined
by the compiler in a consistant way that does not require machine
dependent handling.

MFC after:      1 week

Reviewed by:    imp
Exp-run by:     antoine (PR 286274)
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1595

(cherry picked from commit 2d92a5abefc9cf6aa81fb7d23f8fcca4f1d6026d)
DeltaFile
+6-0sys/sys/stdarg.h
+2-2include/Makefile
+8-22 files

FreeBSD/src 604d34csys/net if_ethersubr.c

net: ether_gen_addr: fix address generation

Some errors in ether_gen_addr() caused us to generate MAC addresses out
of range, and the ones that were within range had other errors causing
the pool of addresses that we might actually generate to shrink.

Fix both prblems by using only two bytes of the digest and then OR'ing
against the mask, which has the appropriate byte set for the fourth
octet of the range already; essentially, our digest is only contributing
the last two octets.

Change is the author, but any blame for the commit message goes to
kevans.

PR:             256850
Relnotes:       yes
DeltaFile
+1-3sys/net/if_ethersubr.c
+1-31 files

FreeBSD/src b2f02b0sys/net if_ethersubr.c

if_ethersubr: preserve entropy of MAC addresses

Ethernet MAC addresses are currently generated by concatenating the
first bytes of a SHA1 digest. However the digest buffer is defined as a
signed char buffer, which means that any digest digit greater than 0x80
will be promoted to a negative int before the concatenation.

As a result, any digest digit greater than 0x80 will overwrite the
previous ones throught the application of the bitwise-or with its 0xFF
higher bytes, effectively reducing the entropy of addresses generated
and significantly increasing the risk of conflict.

Defining the digest buffer as unsigned ensures there will be no unwanted
consequences during integer promotion and the concatenation will work as
expected.

Signed-off-by: Quentin Thébault <quentin.thebault at defenso.fr>
Closes: https://github.com/freebsd/freebsd-src/pull/1750
DeltaFile
+1-1sys/net/if_ethersubr.c
+1-11 files

FreeBSD/src 79dea0csys/kern link_elf_obj.c

linker: Fix the ifunc symbol value calculation for ET_REL files

Reported by:    cy
Fixes:          aefae931820f ("linker: Improve handling of ifuncs when fetching symbol metadata")
DeltaFile
+1-3sys/kern/link_elf_obj.c
+1-31 files

FreeBSD/src f821595contrib/llvm-project FREEBSD-Xlist, contrib/llvm-project/clang/tools/clang-scan-deps ClangScanDeps.cpp Opts.td

contrib/llvm-project: re-add clang/tools/clang-scan-deps

This is in preparation for adding it as an optional tool in base.

MFC after:      1 week

(cherry picked from commit 7ed1628066eaf55b86f35af86efe804508201cc8)
DeltaFile
+1,055-0contrib/llvm-project/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+42-0contrib/llvm-project/clang/tools/clang-scan-deps/Opts.td
+1-2contrib/llvm-project/FREEBSD-Xlist
+1,098-23 files

FreeBSD/src 257b9d0contrib/llvm-project FREEBSD-Xlist, contrib/llvm-project/clang/tools/clang-scan-deps ClangScanDeps.cpp Opts.td

contrib/llvm-project: re-add clang/tools/clang-scan-deps

This is in preparation for adding it as an optional tool in base.

MFC after:      1 week

(cherry picked from commit 7ed1628066eaf55b86f35af86efe804508201cc8)
DeltaFile
+1,055-0contrib/llvm-project/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+42-0contrib/llvm-project/clang/tools/clang-scan-deps/Opts.td
+1-2contrib/llvm-project/FREEBSD-Xlist
+1,098-23 files

FreeBSD/src 1b06e0b. Makefile

Revert "src/Makefile: log real/user/system time for build targets"

This broke `make makeman` by unconditionally adding output to all top
level targets.  Lacking an obvious and trivial workaround, it makes
sense to back it out and rethink.

This reverts commit afa70490ee779646fa0e936801cb28795580bf01.

PR:             287274

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D51119
DeltaFile
+1-10Makefile
+1-101 files

FreeBSD/src 3e041fasbin/savecore/tests Makefile

savecore/tests: Serialize the livedump test

It assumes that the output of kldstat doesn't change over the course of
the test, but this isn't true with parallel tests enabled.

MFC after:      2 weeks
DeltaFile
+3-0sbin/savecore/tests/Makefile
+3-01 files

FreeBSD/src e910221sys/dev/md md.c

md(4): move type-specific data under union

This way it is clear which type uses which members.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D51127
DeltaFile
+153-106sys/dev/md/md.c
+153-1061 files

FreeBSD/src 3f6ba5csys/conf files, sys/fs/nfsclient nfs_clport.c

files: Fix builds without "options UFS_ACL"

Commit 50e733f19b37 broke kernel builds without "options UFS_ACL".

This patch fixes it.

Reviewed by:    kib, markj
Differential Revision:  https://reviews.freebsd.org/D51131
Fixes:  50e733f19b37 ("nfscl: Use delegation ACE when mounted with nocto")
DeltaFile
+1-1sys/conf/files
+1-0sys/fs/nfsclient/nfs_clport.c
+2-12 files

FreeBSD/src 3d4a61atools/tools/git git-arc.sh

git-arc: Try harder to get the author name and email out of phab

When patching, we use the querydiffs endpoint to get a name and email
for the revision's author.  It's possible that this info isn't recorded,
in which case the results after post-processing are just "null".
However, if the diff has multiple revisions, the endpoint returns an
entry for each one, some of which may contain author info, others not.
So, the deleted code which tries to filter out "null" isn't sufficient,
since the value in question might be something like "<valid
name>\nnull".

Try to make this filtering a bit smarter to avoid generating incorrect
author info.

Reviewed by:    jlduran
Reported by:    des
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D51065
DeltaFile
+4-11tools/tools/git/git-arc.sh
+4-111 files

FreeBSD/src aefae93sys/kern link_elf.c link_elf_obj.c

linker: Improve handling of ifuncs when fetching symbol metadata

When looking up symbol values, we map ifunc symbols to the value
returned by the resolver.  However, the returned symbol size is still
that of the resolver.  Be consistent and provide the size of the
implementation symbol as well.

This fixes an inconsistency in dtrace's FBT provider, which enumerates
all function symbols and disassembles their values, using the symbol
size as the bound for the disassembly loop.  In particular, for ifuncs,
we were not creating return probes.

Reviewed by:    kib
MFC after:      2 weeks
Sponsored by:   Innovate UK
Differential Revision:  https://reviews.freebsd.org/D50683
DeltaFile
+34-4sys/kern/link_elf.c
+29-2sys/kern/link_elf_obj.c
+63-62 files

FreeBSD/src c9fcfffbin/cp/tests cp_test.sh

cp: Fix typo in test case.

Fixes:          eb439266b433
Sponsored by:   Klara, Inc.
DeltaFile
+1-1bin/cp/tests/cp_test.sh
+1-11 files

FreeBSD/src bc624c9lib/libc/gen fts.3

fts: Clarify what FTS_DNR is used for.

Sponsored by:   Klara, Inc.
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D51097
DeltaFile
+7-1lib/libc/gen/fts.3
+7-11 files

FreeBSD/src 5e96f40lib/libc/gen opendir2.c

opendir: Simplify is_unionstack().

Sponsored by:   Klara, Inc.
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D51118
DeltaFile
+7-9lib/libc/gen/opendir2.c
+7-91 files

FreeBSD/src 8d02b71lib/libc/tests/gen fts_options_test.c fts_test.h

fts: Add test cases for unreadable directories.

Sponsored by:   Klara, Inc.
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D51098
DeltaFile
+12-72lib/libc/tests/gen/fts_options_test.c
+81-0lib/libc/tests/gen/fts_test.h
+78-0lib/libc/tests/gen/fts_misc_test.c
+9-0lib/libc/tests/gen/Makefile
+180-724 files

FreeBSD/src eb43926bin/cp cp.c, bin/cp/tests cp_test.sh

cp: Don't rely on FTS_DP to keep track of depth.

In normal operation, we get an FTS_D entry when we enter a directory
and a matching FTS_DP entry when we leave it.  However, if an error
occurs either changing to or reading a directory, we may get an FTS_D
entry followed by FTS_DNR or even FTS_ERR instead.  Since FTS_ERR can
also occur for non-directory entries, the only reliable way to keep
track of when we leave a directory is to compare fts_level to our own
depth counter.

This fixes a rare assertion when attempting to recursively copy a
directory tree containing a directory which is either not readable or
not searchable.

While here, also add a test case for directory loops.

Fixes:          82fc0d09e8625
Sponsored by:   Klara, Inc.
Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D51096
DeltaFile
+73-0bin/cp/tests/cp_test.sh
+31-23bin/cp/cp.c
+104-232 files

FreeBSD/src 0e05767sys/arm64/arm64 locore.S

arm64: Only set HCR_EL2.E2H when VHE is supported

When VHE isn't implemented then the HCR_EL2.E2H field should be 0. Move
setting it to the VHE path of the early boot code so it is only set
when supported.

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D51103
DeltaFile
+3-2sys/arm64/arm64/locore.S
+3-21 files

FreeBSD/src eba3850sys/arm64/arm64 locore.S

arm64: Use CHECK_CPU_FEAT to check for VHE

Now we have a macro to check if a feature is supported in an ID
register we can use it to see if VHE is supported.

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D51102
DeltaFile
+2-3sys/arm64/arm64/locore.S
+2-31 files

FreeBSD/src e80cb22sys/arm64/arm64 identcpu.c

arm64: Export the pointer auth ID fields

Set the pointer authentication ID fields and HWCAPs for userspace when
it is present.

Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D50982
DeltaFile
+6-6sys/arm64/arm64/identcpu.c
+6-61 files

FreeBSD/src 51da2ddsys/arm64/arm64 ptrauth.c

arm64: Fix a typo

Sponsored by:   Arm Ltd
DeltaFile
+1-1sys/arm64/arm64/ptrauth.c
+1-11 files

FreeBSD/src 5c9b1c7sbin/pfctl pfctl.c

pfctl: Allocate path only when needed, use __func__

Obtained from:  OpenBSD, kn <kn at openbsd.org>, e56235b48a
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+3-2sbin/pfctl/pfctl.c
+3-21 files

FreeBSD/src 080e8casbin/pfctl pf_print_state.c

pfctl: Make print_hostname() less AF-specific

Reduce differences address families and replace strlcpy() with simpler
if/else logic as done in print_addr_str().

OK sashan

Obtained from:  OpenBSD, kn <kn at openbsd.org>, 7fdc021ee4
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+20-26sbin/pfctl/pf_print_state.c
+20-261 files

FreeBSD/src fb48e6dsbin/pfctl pfctl_optimize.c pfctl_parser.c

pfctl: Remove unused af argument from unmask()

This has been unused for years.

While here, zap the duplicate function signature from pfctl.h (already
present in pfctl_parser.h); spotted by sashan, thanks.

OK sashan

Obtained from:  OpenBSD, kn <kn at openbsd.org>, f0bb6ca5dd
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+5-5sbin/pfctl/pfctl_optimize.c
+4-4sbin/pfctl/pfctl_parser.c
+3-3sbin/pfctl/parse.y
+2-2sbin/pfctl/pf_print_state.c
+1-1sbin/pfctl/pfctl_parser.h
+0-1sbin/pfctl/pfctl.h
+15-166 files

FreeBSD/src dd2d7basbin/pfctl pfctl.c pfctl_parser.c

pfctl: Fix function name in error messages by using __func__

Obtained from:  OpenBSD, kn <kn at openbsd.org>, 91a155f4b6
Obtained from:  OpenBSD, kn <kn at openbsd.org>, f79f34e142
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+11-11sbin/pfctl/pfctl.c
+3-3sbin/pfctl/pfctl_parser.c
+14-142 files

FreeBSD/src 35f70f6sbin/pfctl pfctl_parser.c

pfctl: Remove wildcard address on loopack remnants

henning@ removed this functionality years ago, see the share/man/man4/lo.4
revision 1.27.

OK jca claudio

Obtained from:  OpenBSD, kn <kn at openbsd.org>, 436479f1d8
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+2-9sbin/pfctl/pfctl_parser.c
+2-91 files

FreeBSD/src 725e655sbin/pfctl pfctl.c

pfctl: Error out early on bad anchor usage

`pfctl -a foo' would do nothing with the non-existent anchor and exit 0.
This implements behaviour as documented in pfctl(8):

        -a anchor
            Apply flags -f, -F, and -s only to the rules in the specified
            anchor.

While here, hoist a duplicate "_" check by using the more mnemonic `mode'.

OK henning sashan

Obtained from:  OpenBSD, kn <kn at openbsd.org>, 574cdb686a
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+9-7sbin/pfctl/pfctl.c
+9-71 files

FreeBSD/src f0cf958sbin/pfctl pf_print_state.c

pfctl: Fill netmask AF-independently in print_host()

Instead of masking the host address in two different ways, just fill it
no matter the address family. In case of AF_INET, setting the extra 96 bit
does not hurt.

While here, stop resetting `af' for no reason and move up the variable
declaration.

OK benno sashan

Obtained from:  OpenBSD, kn <kn at openbsd.org>, 53f568abff
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+3-8sbin/pfctl/pf_print_state.c
+3-81 files

FreeBSD/src 2ea99b8. UPDATING, sys/conf newvers.sh

Add UPDATING entries and bump version.

Approved by:    so
DeltaFile
+5-0UPDATING
+1-1sys/conf/newvers.sh
+6-12 files

FreeBSD/src d935270. UPDATING, sys/conf newvers.sh

Add UPDATING entries and bump version.

Approved by:    so
DeltaFile
+14-0UPDATING
+1-1sys/conf/newvers.sh
+15-12 files