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)
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
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
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")
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)
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
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
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
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")
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
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
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
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
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
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
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")
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")