Commit Graph

23346 Commits

Author SHA1 Message Date
Brooks Davis
b0bcedef1a ncurses: add SRCHDRS (ncurses_dll.h) to tinfo SRCS
This avoids relying on the `includes` target to generate this header
which must be in .OBJDIR for the ncurses library to find it.

With an upcoming change libcompat build won't build a seperate
sysroot and will instead share with the 64-bit target which means the
`includes` target will not be called.

Sponsored by:	DARPA, AFRL

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D35510
2022-06-17 20:34:58 +01:00
Alexander Motin
f22068d91b amd64: Stop using REP MOVSB for backward memmove()s.
Enhanced REP MOVSB feature of CPUs starting from Ivy Bridge makes
REP MOVSB the fastest way to copy memory in most of cases. However
Intel Optimization Reference Manual says: "setting the DF to force
REP MOVSB to copy bytes from high towards low addresses will expe-
rience significant performance degradation". Measurements on Intel
Cascade Lake and Alder Lake, same as on AMD Zen3 show that it can
drop throughput to as low as 2.5-3.5GB/s, comparing to ~10-30GB/s
of REP MOVSQ or hand-rolled loop, used for non-ERMS CPUs.

This patch keeps ERMS use for forward ordered memory copies, but
removes it for backward overlapped moves where it does not work.

This is just a cosmetic sync with kernel, since libc does not use
ERMS at this time.

Reviewed by:    mjg
MFC after:	2 weeks
2022-06-16 14:51:50 -04:00
Sergey Kandaurov
5dd1f6f144 utimensat(2): Remove description of compatibility code
Commit e0e0323354 removed compat stubs for
kernels that did not have futimens() and utimensat() system calls, but
removed the documentation for them in the manual page only partially.

Remove the rest of the documentation of the compatibility code.

MFC after:	1 week
2022-06-12 22:57:31 +02:00
Dimitry Andric
56f451bb3b Merge llvm-project release/14.x llvmorg-14.0.5-0-gc12386ae247c
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.5-0-gc12386ae247c, aka 14.0.5 release.

PR:		261742
MFC after:	3 days
2022-06-12 20:53:16 +02:00
Dimitry Andric
809922b010 Update rest of llvm-project build glue for 14.0.4
I completely forgot about updating the generated llvm-project config
files, which also contain version numbers, etc. Sorry for the churn.

PR:		261742
Fixes:		ab9d54731f
MFC after:	3 days
2022-06-05 18:39:43 +02:00
Gordon Bergling
9e75b06f93 libgssapi: Fix a common typo in a source code comment
- s/independant/independent/

MFC after:	3 days
2022-06-05 09:53:24 +02:00
Gordon Bergling
565405095b nlist(3): Fix a common typo in a source code comment
- s/independant/independent/

MFC after:	3 days
2022-06-05 09:51:57 +02:00
Gordon Bergling
9b15c51b05 usbhid(3): Fix a typo in the manual page
- s/layed/laid/

MFC after:	3 days
2022-06-04 19:54:25 +02:00
Dimitry Andric
ab9d54731f Bump versions llvm-project release/14.x llvmorg-14.0.4-0-g29f1039a7285
Somehow git rebase made this squashed commit disappear. Restore it.

PR:		261742
MFC after:	3 days
2022-06-04 15:22:44 +02:00
Gordon Bergling
7a33c6bf52 ipsec(4): Fix a typo in a source code comment
- s/formated/formatted/

MFC after:	3 days
2022-06-04 12:28:20 +02:00
Alexander Motin
e144cd92bb libpmc: Prefer fixed counters in Intel event aliases.
It is recommended by Intel to use fixed counters when possible to
leave programmable ones for different events.

This fixes `pmc stat`, which tries to count 6 events same time, while
many Intel CPUs have only 4 programmable counters.

MFC after:	1 month
2022-06-02 15:17:13 -04:00
Ed Maste
49c937e704 getpagesize(3): add .Xr to sysconf(3)
POSIX deprecated getpagesize(3).  The portable way to obtain the page
size is `sysconf(_SC_PAGESIZE)`.

Reviewed by:	cperciva (earlier), imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35352
2022-06-01 12:16:26 -04:00
Dimitry Andric
4b1174e27a llvm MIPS target: add missed source file
Otherwise, linking llvm binaries with this target enabled (which is not
the default) will fail with a number of undefined symbol errors:

  ld: error: undefined symbol: llvm::initializeMipsMulMulBugFixPass(llvm::PassRegistry&)
  ld: error: undefined symbol: llvm::createMipsMulMulBugPass()

MFC after:	3 days
2022-05-31 17:41:51 +02:00
Alexander Motin
037dd0a967 libpmc: Fix INVERT flag mapping for both Intel and AMD.
Looks like somebody's trivial copy/paste bug.

MFC after:	1 month
2022-05-31 00:04:43 -04:00
Alexander Motin
73b7b181e6 libpmc: Disable hardcoding of Intel fixed counters.
Intel json's now have pretty reasonable fixed counters representation
via event=0 and umask.  Hardcoded values create more confusion than fix.

MFC after:	1 month
2022-05-30 20:05:15 -04:00
Alexander Motin
62ff619dcc libpmc: jevents: Sync with the latest Linux kernel.
commit f4df0dbbe62ee8e4405a57b27ccd54393971c773
Date:   Wed May 25 22:04:10 2022 +0800

MFC after:	1 month
2022-05-30 14:10:21 -04:00
Alexander Motin
51f329660f Revert "libpmc: jevents: Partial style(9) pass"
This file is shared with Linux.  Having local style patches does not
help with updating it.

This reverts commit 3ea691c261.
2022-05-30 14:10:21 -04:00
Cy Schubert
efbe2af2ce lib/libgssapi: Trailing whitespace cleanup
Clean up trailing whitespace (trailing spaces and trailing tabs).

MFC after:	1 week
2022-05-30 05:58:48 -07:00
Dimitry Andric
7b6f5ebef6 Add several sanitizer ignore lists under /usr/lib/clang
Some of the sanitizers from compiler-rt can use ignore lists, which are
loosely modeled on valgrind's example. Upstream provides default lists
for AddressSanitizer, CFI, and MemorySanitizer, so install these in the
expected location, /usr/lib/clang/14.0.3/share.

Reviewed by:	emaste
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D35338
2022-05-28 15:46:38 +02:00
Alexander Motin
18054d0220 libpmc: Another update of x86 event definitions.
MFC after:	1 month
2022-05-26 22:07:42 -04:00
Bartosz Sobczak
cdcd52d41e
irdma: Add RDMA driver for Intel(R) Ethernet Controller E810
This is an initial commit for RDMA FreeBSD driver for Intel(R) Ethernet
Controller E810, called irdma.  Supporting both RoCEv2 and iWARP
protocols in per-PF manner, RoCEv2 being the default.

Testing has been done using krping tool, perftest, ucmatose, rping,
ud_pingpong, rc_pingpong and others.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	#manpages (pauamma_gundo.com) [documentation]
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D34690
2022-05-23 16:52:49 -07:00
Yan Ka Chiu
b75e0eed34 pam_exec: fix segfault when authtok is null
According to pam_exec(8), the `expose_authtok` option should be ignored
when the service function is `pam_sm_setcred`. Currently `pam_exec` only
prevent prompt for anth token when `expose_authtok` is set on
`pam_sm_setcred`. This subsequently led to segfault when there isn't an
existing auth token available.

Bug reported on this: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263893

After reading https://reviews.freebsd.org/rS349556 I am not sure if the
default behaviour supposed to be simply not prompt for authentication
token, or is it to ignore the option entirely as stated in the man page.

This patch is therefore only adding an additional NULL check on the item
`pam_get_item` provide, and exit with `PAM_SYSTEM_ERR` when such item is
NULL.

MFC after:	1 week
Reviewed by:	des, khng
Differential Revision:	https://reviews.freebsd.org/D35169
2022-05-22 12:36:48 -04:00
Piotr Kubaj
f5024381ac powerpc: enable supported sanitizers on powerpc64*
1. Merge LLVM's 315d792130258a9b7250494be8d002ebb427b08f, adding support
for FreeBSD/powerpc64*.
2. Add sanitizer list to lib/libclang_rt/Makefile, taken from the list of
libraries that llvm-devel port builds.
3. powerpc64le supports the same sanitizers that powerpc64, but powerpc64le
also supports xray* sanitizers.
4. lib/libclang_rt/xray/Makefile hardcodes amd64-specific files, so that needs
to be conditionalized.
5. Sanitizers are not enabled for powerpc, because powerpc supports only
builtins and profile.

Reviewed by:	dim
Differential Revision: https://reviews.freebsd.org/D35228
Relnotes:	yes
MFC after:	3 days
2022-05-17 21:46:53 +02:00
Piotr Kubaj
c1e0431c22 riscv: also enable includes, stats and stats_client in libclang_rt
Reviewed by:	dim (earlier version)
Differential Revision: https://reviews.freebsd.org/D34735
MFC after:	3 days
2022-05-16 23:56:21 +02:00
Dmitry Chagin
41068268ec libsysdecode: Fix decoding of SCHED_ flags
Use sys/sched.h where SCHED_ flags are defined.

Reviewed by:		emaste
Differential revision:	https://reviews.freebsd.org/D35208
MFC after:		2 weeks
2022-05-16 21:57:48 +03:00
Dmitry Chagin
14c99b43ef kqueue: Fix kqueue(2) man page.
Remove bogus BUGS note about timeout limit to 24 hours, that's not true
since callouting project import.

Reviewed by:		mav
Differential revision:	https://reviews.freebsd.org/D35206
MFC after:		2 weeks
2022-05-14 14:52:51 +03:00
Dimitry Andric
3a9a9c0ca4 Merge llvm-project release/14.x llvmorg-14.0.3-0-g1f9140064dfb
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.3-0-g1f9140064dfb.

PR:		261742
MFC after:	2 weeks
2022-05-14 13:46:42 +02:00
Dimitry Andric
53683b95ef Apply libc++ fix for <ranges> not compiling at all
Merge commit 44cdca37c01a from llvm git (by Arthur O'Dwyer):

  [libc++] Define `namespace views` in its own detail header.

  Discovered in the comments on D118748: we would like this namespace
  to exist anytime Ranges exists, regardless of whether concepts syntax
  is supported. Also, we'd like to fully granularize the <ranges> header,
  which means not putting any loose declarations at the top level.

  Differential Revision: https://reviews.llvm.org/D118809
2022-05-14 13:46:39 +02:00
Dimitry Andric
dbc822f3bc Merge llvm-project release/14.x llvmorg-14.0.0-2-g3f43d803382d
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-2-g3f43d803382d.

PR:		261742
MFC after:	2 weeks
2022-05-14 13:46:31 +02:00
Dimitry Andric
fb03ea46eb Merge llvm-project release/14.x llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a.

PR:		261742
MFC after:	2 weeks
2022-05-14 13:46:23 +02:00
Dimitry Andric
d781ede639 Merge llvm-project release/14.x llvmorg-14.0.0-rc2-12-g09546e1b5103
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc2-12-g09546e1b5103.

PR:		261742
MFC after:	2 weeks
2022-05-14 13:46:11 +02:00
Dimitry Andric
d56accc7c3 Merge llvm-project release/14.x llvmorg-14.0.0-rc1-74-g4dc3cb8e3255
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc1-74-g4dc3cb8e3255.

PR:		261742
MFC after:	2 weeks
2022-05-14 13:45:57 +02:00
Dimitry Andric
1838bd0f48 Merge llvm-project release/14.x llvmorg-14-init-18315-g190be5457c90
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-18315-g190be5457c90.

PR:		261742
MFC after:	2 weeks
2022-05-14 13:45:25 +02:00
Dimitry Andric
1fd87a682a Merge llvm-project main llvmorg-14-init-18294-gdb01b123d012
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-18294-gdb01b123d012, the last commit before
the upstream release/14.x branch was created.

PR:		261742
MFC after:	2 weeks
2022-05-14 13:44:47 +02:00
Dimitry Andric
04eeddc0aa Merge llvm-project main llvmorg-14-init-17616-g024a1fab5c35
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-17616-g024a1fab5c35.

PR:		261742
MFC after:	2 weeks
2022-05-14 13:44:34 +02:00
Dimitry Andric
0eae32dcef Merge llvm-project main llvmorg-14-init-13186-g0c553cc1af2e
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-13186-g0c553cc1af2e.

PR:		261742
MFC after:	2 weeks
2022-05-14 13:44:01 +02:00
Dimitry Andric
4824e7fd18 Merge llvm-project main llvmorg-14-init-11187-g222442ec2d71
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-11187-g222442ec2d71.

PR:		261742
MFC after:	2 weeks
2022-05-14 13:43:49 +02:00
Dimitry Andric
5e801ac66d Merge llvm-project main llvmorg-14-init-10223-g401b76fdf2b3
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-10223-g401b76fdf2b3.

PR:		261742
MFC after:	2 weeks
2022-05-14 13:43:32 +02:00
Justin Hibbits
448c505c33 libm: Add feenableexcept and fedisableexcept to library on powerpc
Summary:
These functions are missing from the library itself, and exist solely in
the header.  This breaks a few ports that expect libm to have the
symbols in the library itself.

Questions on MFC-ability: Can this be MFC'd to 13.2, and how?

Reviewers: imp, emaste, kib

Reviewed By: kib

Differential Revision: https://reviews.freebsd.org/D35204
2022-05-13 20:24:22 -05:00
Dmitry Chagin
3e11d3f61a Fixed the value returned by sched_getaffinity().
On success gnu libc sched_getaffinity() should return 0, unlike underlying
Linux syscall which returns the size of CPU mask copied to user.

PR:		263939
MFC after:	2 weeks
2022-05-12 20:06:13 +03:00
Dmitry Chagin
f35093f8d6 Use Linux semantics for the thread affinity syscalls.
Linux has more tolerant checks of the user supplied cpuset_t's.

Minimum cpuset_t size that the Linux kernel permits in case of
getaffinity() is the maximum CPU id, present in the system / NBBY,
the maximum size is not limited.
For setaffinity(), Linux does not limit the size of the user-provided
cpuset_t, internally using only the meaningful part of the set, where
the upper bound is the maximum CPU id, present in the system, no larger
than the size of the kernel cpuset_t.
Unlike FreeBSD, Linux ignores high bits if set in the setaffinity(),
so clear it in the sched_setaffinity() and Linuxulator itself.

Reviewed by:		Pau Amma (man pages)
In collaboration with:	jhb
Differential revision:	https://reviews.freebsd.org/D34849
MFC after:		2 weeks
2022-05-11 10:36:01 +03:00
Ed Maste
904c148f1c libutil: eliminate one syscall from kinfo_getproc
Previously we invoked the sysctl with a NULL buffer to query the size,
allocated a buffer, then invoked it again to fetch the data.

As we only handle the case where the sysctl provides data of the
expected size we can just allocate a correctly-sized buffer to begin
with.

Reported by:	Thomas Hurst via Twitter
Reviewed by:	kevans
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35140
2022-05-06 20:06:09 -04:00
Gordon Bergling
4b7f35db44 libc: Add HISTORY sections to the manual pages
There are some sections which could be improved
and work to do so is on going. The work will be
covered via 'X-MFC-WITH' commits.

Obtained from:	OpenBSD
MFC after:	1 month
Differential Revision: https://reviews.freebsd.org/D34759
2022-05-05 18:46:32 +02:00
Alfredo Dal'Ava Junior
f9ee415674 build target triple variable from sys/conf/newvers.sh
Retrieve FreeBSD revision number directly from sys/conf/newvers.sh
when building the compiler target triple value, avoiding manual
intervention on other files every new release.

Reviewed by:	imp
MFC after:	2 months
Sponsored by:	Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D34429
2022-05-03 08:09:38 -03:00
Andrew Turner
c7904405a8 Remove PAGE_SIZE from libthr
In libthr we use PAGE_SIZE when allocating memory with mmap and to check
various structs will fit into a single page so we can use this allocator
for them.

Ask the kernel for the page size on init for use by the page allcator
and add a new machine dependent macro to hold the smallest page size
the architecture supports to check the structure is small enough.

This allows us to use the same libthr on arm64 with either 4k or 16k
pages.

Reviewed by:	kib, markj, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34984
2022-05-03 11:04:41 +01:00
Andrew Turner
86c500937c Use the existing page size in libthr
Rather than calling getpagesize() twice use the value saved after the
first call to size a mmap allocation.

Reviewed by:	kib, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34983
2022-05-03 11:04:06 +01:00
Xin LI
f44280bf5f libz: update the upgrade instructions to reflect reality 2022-04-30 16:57:54 -07:00
Dimitry Andric
8e5bcff58b Export _Unwind_Complete and _Unwind_VRS_Pop from arm's libgcc_s
Apparently some ports on arm require these symbols, and while they were
available in llvm's libunwind, they were never exported via the arm
specific Symbol.map. Put them in the same version block as gcc does
(GCC_3.5).

Reported by:	Robert Clausecker <fuz_at_fuz.su>
MFC after:	3 days
2022-04-27 11:04:10 +02:00
Konstantin Belousov
67fc95025c sched_getaffinity(3): more compatibility with Linux
Report EINVAL instead of EDEADLK when impossible cpu mask is set.

Noted by:	dchagin
Reviewed by:	dchagin (previous version), markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D35045
2022-04-25 17:22:09 +03:00
Reid Linnemann
0abcc1d2d3 pf: Add per-rule timestamps for rule and eth_rule
Similar to ipfw rule timestamps, these timestamps internally are
uint32_t snaps of the system time in seconds. The timestamp is CPU local
and updated each time a rule or a state associated with a rule or state
is matched.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34970
2022-04-22 19:53:20 +02:00
Dmitry Chagin
89ecdff2c3 Fix sigtimedwait manpage.
Historically, sigtimedwait() blocks indefinitely if timeout is NULL.

Reviewed by:		jilles, imp
Differential Revision:	https://reviews.freebsd.org/D34985
MFC after:		2 weeks
2022-04-21 10:52:29 +03:00
Alfonso S. Siciliano
b9e5884ef7
bsddialog(3): fix disabled shadow
Fix dialogs building and updating fault with disabled shadow
(conf.shadow=false and implicitly bsddialog --no-shadow).

While here delete WARNS=2: all warnings were fixed in upstream and
imported in 0.2.

Approved by:		bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D34958
2022-04-20 17:52:04 +02:00
Stefan Eßer
ce700f78f7 libfetch: remove a set-but-not-uswed variable 2022-04-20 16:58:33 +02:00
Dmitry Chagin
45a4c44299 Bump Dd in getdirentries.2 after c6487446.
MFC after:	1 week
2022-04-20 17:55:32 +03:00
Kristof Provost
7ed19f5c77 libpfctl: grow request buffer on ENOSPC
When we issue a request to pf and expect a serialised nvlist as a reply
we have to supply a suitable buffer to the kernel.
The required size for this buffer is difficult to predict, and may be
(slightly) different from request to request.
If it's insufficient the kernel will return ENOSPC. Teach libpfctl to
catch this and send the request again with a larger buffer.

MFC after:	2 weeks
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34908
2022-04-20 10:51:39 +02:00
Mark Johnston
081b4452a7 geli: Add a chicken switch for unmapped I/O
We have a report of a panic in GELI that appears to go away when
unmapped I/O is disabled.  Add a tunable to make such investigations
easier in the future.  No functional change intended.

PR:		262894
Reviewed by:	asomers
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34944
2022-04-18 17:55:24 -04:00
Simon J. Gerraty
cc9e659077 Merge bearssl-20220418
Main change is a callback for checking validity period of certificates.

Merge commit 'f6acb9b9f81c96ae7c9592bee1bb89c4357cc3e5'

Add -DHAVE_BR_X509_TIME_CHECK to libsecureboot/Makefile.inc
2022-04-18 14:52:30 -07:00
Simon J. Gerraty
666554111a Update libsecureboot
Preparation for updating bearssl, pull in updates to libsecureboot.

o fix handling of some out-of-memory cases

o allow more control over reporting of Verified/Unverified files.
  this helps boot time when console output is slow

  o recheck verbose/debug level after reading any unverified file

o more debug support for vectx

o hash_string to support fake stat for tftp

o tests/tvo add -v to simply verify signatures

o vets.c allow for HAVE_BR_X509_TIME_CHECK which will greatly simplify
  verification in loader

o report date when certificate fails validity period checks

Reviewed by: stevek
Sponsored by: Juniper Networks, Inc.
2022-04-18 12:54:15 -07:00
Mark Johnston
d0f245d21f libsysdecode: Add regression tests for sysdecode_cap_rights(3)
Reviewed by:	jhb, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34900
2022-04-15 10:23:32 -04:00
Mark Johnston
354efc4c94 libsysdecode: Include required headers in sysdecode.h
Make sysdecode.h self-contained rather than forcing all consumers to
include dependencies.  No functional change intended.

Reviewed by:	pauamma_gundo.com, jhb, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34899
2022-04-15 10:22:29 -04:00
Gordon Bergling
3e0f3678ec time(3): Refine history in the manual page
The time() system call first appeared in Version 1 AT&T UNIX.  Through
the Version 3 AT&T UNIX, it returned 60 Hz ticks since an epoch that
changed occasionally, because it was a 32-bit value that overflowed in a
little over 2 years.

In Version 4 AT&T UNIX the granularity of the return value was reduced to
whole seconds, delaying the aforementioned overflow until 2038.

Version 7 AT&T UNIX introduced the ftime() system call, which returned
time at a millisecond level, though retained the gtime() system call
(exposed as time() in userland).  time() could have been implemented as a
wrapper around ftime(), but that wasn't done.

4.1cBSD implemented a higher-precision time function gettimeofday() to
replace ftime() and reimplemented time() in terms of that.

Since FreeBSD 9 the implementation of time() uses
clock_gettime(CLOCK_SECOND) instead of gettimeofday() for performance
reasons.

With most valuable input from Warner (imp@).

Reviewed by:	0mp, jilles, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34751
2022-04-14 10:04:14 +02:00
Konstantin Belousov
bf13db086b Mostly revert a5970a529c: Make files opened with O_PATH to not block non-forced unmount
Problem is that open(O_PATH) on nullfs -o nocache is broken then,
because there is no reference on the vnode after the open syscall exits.

Reported and tested by:	ambrisko
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-04-14 02:47:04 +03:00
Ed Maste
1323ec5712 ssh: update to OpenSSH v8.9p1
Release notes are available at https://www.openssh.com/txt/release-8.9

Some highlights:

 * ssh(1), sshd(8), ssh-add(1), ssh-agent(1): add a system for
   restricting forwarding and use of keys added to ssh-agent(1)

 * ssh(1), sshd(8): add the sntrup761x25519-sha512@openssh.com hybrid
   ECDH/x25519 + Streamlined NTRU Prime post-quantum KEX to the
   default KEXAlgorithms list (after the ECDH methods but before the
   prime-group DH ones). The next release of OpenSSH is likely to
   make this key exchange the default method.

 * sshd(8), portable OpenSSH only: this release removes in-built
   support for MD5-hashed passwords. If you require these on your
   system then we recommend linking against libxcrypt or similar.

Future deprecation notice
=========================

A near-future release of OpenSSH will switch scp(1) from using the
legacy scp/rcp protocol to using SFTP by default.

Legacy scp/rcp performs wildcard expansion of remote filenames (e.g.
"scp host:* .") through the remote shell. This has the side effect of
requiring double quoting of shell meta-characters in file names
included on scp(1) command-lines, otherwise they could be interpreted
as shell commands on the remote side.

MFC after:	1 month
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2022-04-13 16:00:56 -04:00
Mark Johnston
869199d992 libsysdecode: Fix decoding of Capsicum rights
Capsicum rights are a bit tricky since some of them are subsets of
others, and one can have rights R1 and R2 such that R1 is a subset of
R2, but there is no collection of named rights whose union is R2.  So,
they don't behave like most other flag sets.  sysdecode_cap_rights(3)
does not handle this properly and so can emit misleading decodings.

Try to fix all of these problems:
- Include composite rights in the caprights table.
- Use a constructor to sort the caprights table such that "larger"
  rights appear first and thus are matched first.
- Don't print rights that are a subset of rights already printed, so as
  to minimize the length of the output.
- Print a trailing message if some of the specific rights are not
  matched by the table.

PR:		263165
Reviewed by:	pauamma_gundo.com (doc), jhb, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34874
2022-04-13 10:51:30 -04:00
Fernando Apesteguía
e07b0c12ba [patch][doc] Fix EXAMPLE in kqueue(2)
The error control was not properly implemented. "changelist" is const, hence
event.flags is never changed by the syscall.

PR:	196844
Reported by:	eugen@
Reviewed by:	PauAmma <pauamma@gundo.com>
Approved by:	eugen@
Fixes:	8c231786f0
2022-04-13 08:01:58 +02:00
John Baldwin
56f5947a71 Remove checks for __GNUCLIKE_ASM assuming it is always true.
All supported compilers (modern versions of GCC and clang) support
this.

Many places didn't have an #else so would just silently do the wrong
thing.  Ancient versions of icc (the original motivation for this) are
no longer a compiler FreeBSD supports.

PR:		263102 (exp-run)
Reviewed by:	brooks, imp
Differential Revision:	https://reviews.freebsd.org/D34797
2022-04-12 10:05:45 -07:00
Dmitry Chagin
c6487446d7 getdirentries: return ENOENT for unlinked but still open directory.
To be more compatible to IEEE Std 1003.1-2008 (“POSIX.1”).

Reviewed by:		mjg, Pau Amma (doc)
Differential revision:  https://reviews.freebsd.org/D34680
MFC after:		2 weeks
2022-04-11 23:30:16 +03:00
Konstantin Belousov
50d3c72558 libprocstat: document procstat_getadvlock(3)
Reviewed by:	markj, rmacklem
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34756
2022-04-10 00:47:49 +03:00
Konstantin Belousov
039d1496b0 libprocstat: add procstat_getadvlock(3)
For now, only for sysctl target.  This is not a new situation, for
instance kstacks also work for sysctl only.

Reviewed by:	markj, rmacklem
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34756
2022-04-10 00:47:49 +03:00
Mateusz Guzik
287451fd01 pidfile: add pidfile_signal
Differential Revision:	https://reviews.freebsd.org/D34681
2022-04-09 15:59:43 +00:00
Gordon Bergling
38dd27d21e libipsec: Fix a typo in a source code comment
- s/proccessing/processing/

MFC after:	3 days
2022-04-09 14:08:47 +02:00
Gordon Bergling
8dcf5860b3 getenv(3): Fix two typos in source code comments
- s/peform/perform/

MFC after:	3 days
2022-04-09 11:36:48 +02:00
Gordon Bergling
29fea59e78 math(3): Remove a double word in a source code comment
- s/is is/is/

MFC after:	3 days
2022-04-09 10:13:37 +02:00
Gordon Bergling
b4ce0ff19a resolver(3): Fix a typo in a source code comment
- s/psuedo/pseudo/

MFC after:	3 days
2022-04-09 09:14:29 +02:00
Martin Matuska
7f815d4f12 libarchive: fix zstd compression support
The commit 833a452e9 introduced a change that detached
the zstd compression (not decompression) support from base build.

Reported by:	kevans
MFC after:	3 days
2022-04-08 10:11:25 +02:00
Andrew Turner
748f7c8db7 Have stpncpy tests ask the kernel for the page size
It may be dynamic so we can't rely on PAGE_SIZE being present or
correct.
2022-04-07 16:08:37 +01:00
Gordon Bergling
656d68a711 mt(3): Fix a typo in the manual page
- s/mulitple/multiple/

MFC after:	3 days
2022-04-06 18:41:08 +02:00
Reid Linnemann
4823489ab6 libpfctl: relocate implementations of pfr_add/get/set_addrs
Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34740
2022-04-04 19:14:23 +02:00
Xin LI
a7f127b653 lib/libz: remove ZLIBprivate_1.0 namespace.
These symbols were hidden and no longer exposed, and were never exposed in headers.

MFC after:	3 days
2022-04-03 14:38:31 -07:00
Gordon Bergling
fa556e83be if_indextoname(3): Correct the RFC in a comment
RFC 2533 refers to 'A Syntax for Describing Media Feature Sets',
which is wrong since the correct reference should be
RFC 2553 'Basic Socket Interface Extensions for IPv6'.

Obtained from:	OpenBSD
MFC after:	1 week
2022-04-03 13:50:15 +02:00
Kyle Evans
dadb9c7093 bectl: push space-in-name check down into libbe
This check was previously in `create` only, not applying to renames.  It
should really be applied at the libbe level, so that we can avoid
writing about this restriction over and over again.

While we're here: `bectl rename` always succeeds, even when it doesn't.
Start returning the error.

Reported By:	Christian McDonald <cmcdonald netgate com>
Reviewed by:	rew, jwmaag_gmail.com (earlier version)
Differential Revision:	https://reviews.freebsd.org/D34605
2022-04-02 21:04:31 -05:00
Gordon Bergling
49f2bb3676 libnetbsd: Fix a typo in a source code comment
- s/accomodate/accommodate/

MFC after:	3 days
2022-04-02 14:53:56 +02:00
Gordon Bergling
5c49e1cbea rpc(3): Fix two typos in source code comments
- s/alloctaed/allocated/

Obtained from:	NetBSD
MFC after:	3 days
2022-04-02 09:33:24 +02:00
Mateusz Guzik
c4a08ef2af pf: handle duplicate rules gracefully
Reviewed by:	kp
Reported by:	dch
PR:		262971
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-01 18:01:48 +00:00
Kyle Evans
31190aa02e libbe: pull props for the correct dataset in be_mounted_at()
The props feature to this API was added as a "just in case", with no
planned consumer.  It turns out that it was implemented incorrectly,
tapping out props for the BE root (BE's parent) rather than the BE
itself in all cases.

Fetch properties for the dataset that's actually mounted at the queried
path.

Reported by:	Christian McDonald <cmcdonald netgate com>
MFC after:	3 days
2022-03-31 14:23:57 -05:00
Kyle Evans
d155d8e138 libbe: fix be_mounted_at() with props after bootonce
propinfo.bootonce was filled with garbage, leading to a segfault later
during prop building.  Initialize it to NULL.

MFC after:	3 days
2022-03-31 14:23:57 -05:00
Xin LI
cd8822075a MFV c144cc5479: zlib 1.2.12.
MFC after:	3 days
Relnotes:	yes
2022-03-31 07:25:53 -07:00
Greg Lehey
4044083079 chroot.2: Correct grammar errors.
No functional change.

MFC after:	1 week
2022-03-31 13:05:49 +11:00
Kristof Provost
514039bb90 libpfct: Return errno from pfctl_add_eth_rule()
If the pfctl_add_eth_rule() ioctl fails return the errno, not the error
returned by ioctl(). That will give us slightly more insight into what
went wrong, because ioctl() would always return -1.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-30 10:28:19 +02:00
Kristof Provost
9bb06778f8 pf: support listing ethernet anchors
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-30 10:28:19 +02:00
Gordon Bergling
066e393f8f libc: Fix a typo in a source code comment
- s/compnent/component/

MFC after:	3 days
2022-03-28 19:34:14 +02:00
Gordon Bergling
5c4aa62572 pmc(3): Fix a common typo in json descriptions
- s/from from/from/

MFC after:	3 days
2022-03-28 19:32:21 +02:00
Gordon Bergling
b1c5f60ce8 libefivar(3): Fix a typo in a source code comment
- s/partiton/partition/

MFC after:	3 days
2022-03-28 19:27:58 +02:00
Ganael LAPLANCHE
0cff70ca66 libc: Check for readdir(2) errors in fts(3)
Previously, such errors were not distinguished from the end-of-directory
condition.

With improvements from Mahmoud Abumandour <ma.mandourr@gmail.com>.

Reviewed by:	markj
PR:		262038
MFC after:	2 weeks
2022-03-28 11:23:46 -04:00
Mark Johnston
6e13794fbe libc: Restore fp state upon flush error in fputc
This is akin to commit bafaa70b6f.

Reported by:	Guy Yur <guyyur@gmail.com>
Fixes:		86a16ada1e
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-03-28 11:23:46 -04:00
Xin LI
45916e7c91 Vendor import of expat 2.4.7. 2022-03-27 22:19:28 -07:00
Gordon Bergling
3e5a11d53a libmd: Fix a common typo in the license header
- s/rouines/routines/

Obtained from:	NetBSD
MFC after:	3 days
2022-03-27 19:46:32 +02:00
Martin Matuska
0c9c2eb394 libarchive: merge vendor bugfixes
Bugfixes:
  IS #1672 and OSS-Fuzz #38766:
    (zip reader) fix possible out-of-bounds read in zipx_lzma_alone_init()
  PR #1676: (mtree reader) remove the unused variable "detected_bytes"
  PR #1674: (doc) fix use of At mdoc(7) macro in cpio.5

MFC after:	3 days
2022-03-26 11:11:14 +01:00
Mateusz Guzik
fbc002cb72 amd64: bring back asm bcmp, shared with memcmp
Turns out clang converts "memcmp(foo, bar, len) == 0" and similar to
bcmp calls.

Reviewed by:	emaste (previous version), jhb (previous version)
Differential Revision:	https://reviews.freebsd.org/D34673
2022-03-26 09:10:03 +00:00
Mateusz Guzik
f0f0f2abf3 amd64: remove bcmp.S
Fixes:  5fc3cc2713 ("amd64: make bcmp in libc just call memcmp")
2022-03-25 14:57:51 +00:00
Piotr Kubaj
18f71c9b27 riscv: fix riscv64sf build
The library needs to have sf suffix cut off.

MFC after:	3 days
X-MFC with:	3781e77995
Differential revision:	https://reviews.freebsd.org/D34561
Reviewed by:	dim
2022-03-24 15:25:41 +01:00
Andrew Turner
16d5f9a164 Add an implementation of .mcount on arm64
To support cc -pg on arm64 we need to implement .mcount. As clang and
gcc think it is function like it just needs to load the arguments
to _mcount and call it.

On gcc the first argument is passed in x0, however this is missing on
clang so we need to load it from the stack. As it's the caller return
address this will be at a known location.

PR:		262709
Reviewed by:	emaste (earlier version)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34634
2022-03-23 15:16:59 +00:00
firk
bb53dd56c3 kern_tc.c/cputick2usec() (which is used to calculate cputime from
cpu ticks) has some imprecision and, worse, huge timestep (about
20 minutes on 4GHz CPU) near 53.4 days of elapsed time.

kern_time.c/cputick2timespec() (it is used for clock_gettime() for
querying process or thread consumed cpu time) Uses cputick2usec()
and then needlessly converting usec to nsec, obviously losing
precision even with fixed cputick2usec().

kern_time.c/kern_clock_getres() uses some weird (anyway wrong)
formula for getting cputick resolution.

PR:		262215
Reviewed by:	gnn
Differential Revision:	https://reviews.freebsd.org/D34558
2022-03-21 09:33:46 -04:00
Hans Petter Selasky
bde8460272 mixer.4 and mixer.8: Fix mandoc -Tlint errors.
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34603
Sponsored by:		NVIDIA Networking
2022-03-20 20:21:03 +01:00
Mariusz Zaborski
1e9ce60a6d cap_fileargs: silence warnings of unused variable
We still want to fetch the variable just to verify that the interface
is right.

Reported by:	pstef
2022-03-20 11:22:55 +01:00
Hans Petter Selasky
5c6935a645 mixer.3: Fix spelling
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34378
MFC after:		1 week
Sponsored by:		NVIDIA Networking
2022-03-18 12:10:40 +01:00
Robert Wing
3efc45f34e libvmm: constify vm_get_name()
Allows callers of vm_get_name() to retrieve the vm name without having
to allocate a buffer.

While in the vicinity, do minor cleanup in vm_snapshot_basic_metadata().

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D34290
2022-03-17 21:38:21 -08:00
Mateusz Piotrowski
fd06117525 *: Do not use the no-op -r flag for bsdlabel(8)
The -r flag is ignored by the FreeBSD implementation of bsdlabel(8)
(also called disklabel(8) in the past). Remove its use from examples
and tests in the tree.

This commit does not touch historical documentation under share/doc/smm
and files under contrib/netbsd-tests.

Reviewed by:	imp
MFC after:	2 weeks
Approved by:	imp (src)
Fixes:		57dfbec57b More axe-work:
Differential Revision:	https://reviews.freebsd.org/D34585
2022-03-17 17:28:07 +01:00
Alexander Motin
bd0f3d34fa GEOM: Fix regression after 7f16b501e2.
find_geom() in some classes trim leading "/dev/" from geom names.
Lack of that in geom_gettree_geom() broke some existing scripts.

PR:		262554
MFC after:	2 months
2022-03-16 00:06:49 -04:00
Andrew Turner
f2e36d47e3 Make page size dynamic in libkvm for arm64
To allow for a future 16k or 64k page size we need to tell libkvm which
is being used. Add a flag field in unused space in minidumphdr and use
it to signal between the different options.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34548
2022-03-15 09:52:15 +00:00
Kristof Provost
8a42005d1e pf: support basic L3 filtering in the Ethernet rules
Allow filtering based on the source or destination IP/IPv6 address in
the Ethernet layer rules.

Reviewed by:	pauamma_gundo.com (man), debdrup (man)
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34482
2022-03-14 22:42:37 +01:00
Piotr Kubaj
3781e77995 riscv: actually enable sanitizers
1. Backport b475ce39e8.
2. Enable libclang_rt for riscv.

Previous commit missed it.

MFC after:	3 days
Reviewed by:	dim
Differential Revision: https://reviews.freebsd.org/D34543
2022-03-13 13:06:57 +01:00
Alfonso S. Siciliano
2f8d441841
bsddialog: Import version0.2
This version provides improvements and fixes mainly to use bsddialog
utility in bsdinstall/scripts. The lib API is not broken so the
previous converted utilities (tzsetup, distextract, etc.) are OK.

Approved by:		bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D34458
2022-03-13 02:34:57 +01:00
Alexander Motin
7f16b501e2 GEOM: Introduce partial confxml API
Traditionally the GEOM's primary channel of information from kernel to
user-space was confxml, fetched by libgeom through kern.geom.confxml
sysctl.  It is convenient and informative, representing full state of
GEOM in a single XML document.  But problems start to arise on systems
with hundreds of disks, where the full confxml size reaches many
megabytes, taking significant time to first write it and then parse.

This patch introduces alternative solution, allowing to fetch much
smaller XML document, subset of the full confxml, limited to 64KB and
representing only one specified geom and optionally its parents.  It
uses existing GEOM control interface, extended with new "getxml" verb.
In case of any error, such as the buffer overflow, it just transparently
falls back to traditional full confxml.  This patch uses the new API in
user-space GEOM tools where it is possible.

Reviewed by:	imp
MFC after:	2 month
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D34529
2022-03-12 11:55:52 -05:00
Mateusz Guzik
5fc3cc2713 amd64: make bcmp in libc just call memcmp
Preferably bcmp would just alias memcmp but there is build magic which
makes this problematic.

Reviewed by:	jhb
Differential Revision:		https://reviews.freebsd.org/D28846
2022-03-12 14:59:14 +00:00
John Baldwin
6bb7ba4aa1 arm64 hwpmc: Support restricting counters to user or kernel mode.
Support the "usr" and "os" qualifiers on arm64 events to restrict
event counting to either usermode or the kernel, respectively.  If
neither qualifier is given, events are counted in both.

Reviewed by:	emaste
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34527
2022-03-11 11:29:45 -08:00
Hans Petter Selasky
419822b372 libgeom(3): Use calloc instead of malloc and bzero.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/546
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-03-11 10:38:16 +01:00
John Baldwin
a6db407f15 libpmcstat: Fix a few ARM-specific issues with function symbols.
- Refine the checks for ARM mapping symbols and apply them on arm64 as
  well as 32-bit arm.  In particular, mapping symbols can have
  additional characters and are not strictly limited to just "$a" but
  can append additional characters (e.g. "$a.1").  Add "$x" to the
  list of mapping symbol prefixes.

- Clear the LSB of function symbol addresses.  Thumb function
  addresses set the LSB to enable Thumb mode.  However, the actual
  function starts at the aligned address with LSB clear.  Not clearing
  the LSB can cause pmcannotate to pass misaligned addresses to
  objdump when extracting disassembly.

Reviewed by:	andrew
Obtained from:	CheriBSD
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34416
2022-03-10 15:39:53 -08:00
Corvin Köhne
e47fe3183e bhyve: add ROM emulation
Some PCI devices especially GPUs require a ROM to work properly.
The ROM is executed by boot firmware to initialize the device.
To add a ROM to a device use the new ROM option for passthru device
(e.g. -s passthru,0/2/0,rom=<path>/<to>/<rom>).

It's necessary that the ROM is executed by the boot firmware.
It won't be executed by any OS.
Additionally, the boot firmware should be configured to execute the
ROM file.
For that reason, it's only possible to use a ROM when using
OVMF with enabled bus enumeration.

Differential Revision:	https://reviews.freebsd.org/D33129
Sponsored by:   Beckhoff Automation GmbH & Co. KG
MFC after:      1 month
2022-03-10 12:30:37 +01:00
Dimitry Andric
7ecd99fa42 Build compiler-rt against libunwind, not libcxxrt
Parts of compiler-rt are also built for libgcc_eh and libgcc_s, and
these were already pointing to the libunwind unwind.h. For the sake of
consistency, also build compiler-rt itself against the libunwind
unwind.h, not the libcxxrt one.

MFC after:	3 days
2022-03-09 22:23:35 +01:00
Alexander Motin
5c20bfc787 gpart: Avoid geom_gettree() call in "bootcode -b".
geom_gettree() may be pretty expensive on large systems, and it is
not needed if only -b flag specified, that is processed by kernel.

MFC after:	1 month
2022-03-08 14:01:04 -05:00
Kristof Provost
8c1400b0a1 libpfct: factor out pfctl_get_rules_info()
Introduce pfctl_get_rules_info(), similar to pfctl_get_eth_rules_info()
to retrieve rules information (ticket and total number of rules).

Use the new function in pfctl.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34443
2022-03-08 13:57:45 +01:00
Kristof Provost
f0c334e4de libpfctl: support flushing rules/nat/eth
Move the code to flush regular rules, nat rules and Ethernet rules into
libpfctl for easier re-use.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34442
2022-03-08 13:57:45 +01:00
Alexander Motin
2117cdd4b4 GEOM: Introduce gctl_add_param() API.
Make gctl_add_param() API public, allowing more precise control over
parameter flags.  Previously it was impossible to properly declare
write-only ASCII parameters, used for result reporting, they were
declared as read-write binary instead, that was not nice.

MFC after:	1 month
2022-03-07 11:12:25 -05:00
Konstantin Belousov
bafaa70b6f libc __sfvwrite(): roll back FILE buffer pointer on fflush error
__sfvwrite() advances the pointer before calling fflush.  If fflush()
fails, it is not enough to roll back inside it, because we cannot know
how much was advanced by the caller.

Reported by:	Peter <pmc@citylink.dinoex.sub.org>
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Fixes:	86a16ada1e
2022-03-06 10:29:51 -05:00
Pedro F. Giffuni
455e0b9ba5 /etc/hosts: Wording changes to better match RFC 1918
Summary: No functional change.

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D34391
2022-03-05 16:00:59 -05:00
Alfonso S. Siciliano
d746ab215c
libbsddialog: Add _XOPEN_SOURCE_EXTENDED for widechar form
Add _XOPEN_SOURCE_EXTENDED to use curses' get_wch() and to avoid a
building error after next "bsddialog 0.2" import.

Approved by:		bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D34419
2022-03-05 02:24:37 +01:00
Mateusz Piotrowski
413045a52c time.3: Update ERRORS section
time() is now implemented using clock_gettime(2) instead of
gettimeofday(2).

Reviewed by:	debdrup
Fixes:		358ed16f75 Use clock_gettime(CLOCK_SECOND)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34438
2022-03-04 20:01:33 +01:00
Mateusz Guzik
f3f3e3c44d fd: add close_range(..., CLOSE_RANGE_CLOEXEC)
For compatibility with Linux.

MFC after:	3 days
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D34424
2022-03-03 17:21:58 +00:00
Eric van Gyzen
d1b143ee9a Vendor import of expat 2.4.6
Sponsored by:	Dell EMC Isilon
2022-03-02 14:00:38 -06:00
Kristof Provost
b590f17a11 pf: support masking mac addresses
When filtering Ethernet packets allow rules to specify a mac address
with a mask. This indicates which bits of the specified address are
significant. This allows users to do things like filter based on device
manufacturer.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-02 17:00:08 +01:00
Kristof Provost
c5131afee3 pf: add anchor support for ether rules
Support anchors in ether rules.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32482
2022-03-02 17:00:07 +01:00
Kristof Provost
fb330f3931 pf: support dummynet on L2 rules
Allow packets to be tagged with dummynet information. Note that we do
not apply dummynet shaping on the L2 traffic, but instead mark it for
dummynet processing in the L3 code. This is the same approach as we take
for ALTQ.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32222
2022-03-02 17:00:06 +01:00
Kristof Provost
c696d5c72f pfctl: Don't print (ether) to / from if they're not set
If we're not filtering on a specific MAC address don't print it at all,
rather than showing an all-zero address.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31749
2022-03-02 17:00:05 +01:00
Kristof Provost
2b29ceb86f pfctl: Print Ethernet rules
Extent pfctl to be able to read configured Ethernet filtering rules from
the kernel and print them.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31738
2022-03-02 17:00:03 +01:00
Hans Petter Selasky
d94d94e2c0 libusb(3): Ignore SIGPIPE when initializing the LibUSB v1.0 API.
The LibUSB v1.0 emulation layer uses pipes internally to signal between
threads. When USB devices are reset, as part of loading firmware, SIGPIPE
may happen, and that is expected and should be ignored.

PR:		261891
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-03-02 12:33:40 +01:00
Warner Losh
b01f409ffe libdevctl: Add devctl_getpath
Helper routine to call the kernel to get a path to the named device.
Different path enumeration methods (called locators) can be used
for different path types depending on what the kernel implements.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D32746
2022-03-01 08:06:41 -07:00
Kirk McKusick
c7996ddf80 Create a new GEOM utility, gunion(8).
The gunion(8) utility is used to track changes to a read-only disk on
a writable disk. Logically, a writable disk is placed over a read-only
disk. Write requests are intercepted and stored on the writable
disk. Read requests are first checked to see if they have been
written on the top (writable disk) and if found are returned. If
they have not been written on the top disk, then they are read from
the lower disk.

The gunion(8) utility can be especially useful if you have a large
disk with a corrupted filesystem that you are unsure of how to
repair. You can use gunion(8) to place another disk over the corrupted
disk and then attempt to repair the filesystem. If the repair fails,
you can revert all the changes in the upper disk and be back to the
unchanged state of the lower disk thus allowing you to try another
approach to repairing it. If the repair is successful you can commit
all the writes recorded on the top disk to the lower disk.

Another use of the gunion(8) utility is to try out upgrades to your
system. Place the upper disk over the disk holding your filesystem
that is to be upgraded and then run the upgrade on it. If it works,
commit it; if it fails, revert the upgrade.

Further details can be found in the gunion(8) manual page.

Reviewed by: Chuck Silvers, kib (earlier version)
tested by:   Peter Holm
Differential Revision: https://reviews.freebsd.org/D32697
2022-02-28 16:36:08 -08:00
Jessica Clarke
b58ea3e1f7 Fix hand-rolled METALOG entries for installconfig during distributeworld
During distributeworld we call distribute on subdirectories, which in
turn calls installconfig. However, this recursive installconfig call
appends the distribution name (in these cases, "base") to DESTDIR. For
install(1) this works fine as its -D argument comes from the top-level
Makefile.inc1, which passes the original DESTDIR, thereby resulting in
the METALOG entry having the distribution name as a prefix representing
its true installed path relative to the root, but for the hand-rolled
entries they do not use install(1) and thus do not have access to what
the original DESTDIR was, resulting in the METALOG missing this prefix.

Thus, pass down the name of the distribution via a new variable DISTBASE
(chosen as Makefile.inc1 already uses that to convey this exact same
information to etc's distrib-dirs during distributeworld) and prepend
this to the handful of manually-generated METALOG entries. For the
installworld case this variable will be empty and so this behaves as
before.

Note that we need to be careful to avoid double slashes in the METALOG;
distributeworld uses find | awk to split the single METALOG up into
multiple dist.meta files, and this relies on the paths in the METALOG
having the exact prefix ./dist (or ./dist/usr/lib/debug).

Reviewed by:	brooks, emaste
Differential Revision:	https://reviews.freebsd.org/D33997
2022-02-28 22:36:39 +00:00
Jose Luis Duran
5754f5823b libefivar: Apply uncrustify changes
Apply uncrustify changes to .c/.h files.

Reduce the diffs with EDK2 to aid with future merges.  The
unconventional way we've imported this code makes using a vendor branch
to manage it at the very least tricky. Update FreeBSD-update to reflect
the slight shift in advise.

Reviewed by:	imp
Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Obtained from:	2f88bd3a12
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:45:34 -07:00
Jose Luis Duran
60de142cfc libefivar: Change OPTIONAL keyword usage style
Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params.

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=3760
Obtained from:	d0e2f8232a
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:13:47 -07:00
Jose Luis Duran
11a9ff5bc1 libefivar: Replace BSD License with BSD+Patent License
Replace BSD 2-Clause License with BSD+Patent License.  This change is
based on the following emails:

  https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html
  https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html

RFCs with detailed process for the license change:

  V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html
  V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html
  V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=1373
Obtained from:	9344f09215
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:13:43 -07:00
Jose Luis Duran
e871598ad4 libefivar: Check Length para before use in DevPathToTextUsbWWID
In function DevPathToTextUsbWWID, the Length parameter is used
without check. This patch is to add check before using it.

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=1336
Obtained from:	d8e702693a
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:13:40 -07:00
Jose Luis Duran
c1fa6f4c5d libefivar: Fix incorrect check for DisplayOnly text format in AcpiEx
Text format for AcpiEx device path in UEFI Spec:
AcpiEx(HID,CID,UID,HIDSTR,CIDSTR,UIDSTR)
AcpiEx(HID|HIDSTR,(CID|CIDSTR,UID|UIDSTR))(Display Only)

When convert device path to text for AcpiEx device path,
current code check AllowShortcuts parameter to convert
the device path to DisplayOnly text format(shorter text
representation) by mistake.
It should check DisplayOnly parameter.

This commit is to fix this issue.

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=1312
Obtained from:	e9ab1635a2
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:13:35 -07:00
Jose Luis Duran
492d9953fa libefivar: Handle AcpiExp device path when optional para is not specified
AcpiExp text device path: AcpiExp(HID,CID,UIDSTR)
And according to UEFI spec, the CID parameter is optional
and has a default value of 0. But current implementation
miss to check following cases for the AcpiExp.
FromText: when text device is AcpiExp(HID,,UIDSTR)/AcpiExp(HID,0,UIDSTR)
ToText: when the CID is 0 in the node structure

This commit is to do the enhancement.

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=1243
Obtained from:	a8b5750901
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:13:31 -07:00
Jose Luis Duran
965f85271c libefivar: Handle USBxxx device path when optional para is not specified
According to UEFI spec,
for the Messaging Device Path with USB Class SubType, some paras
are optional in the text device path.
Take UsbClass(VID,PID,Class,SubClass,Protocol) for example,
The VID is an integer between 0 and 65535 and is optional. The
default value is 0xFFFF.
The PID is an integer between 0 and 65535 and is optional. The
default value is 0xFFFF.
The Class is an integer between 0 and 255 and is optional. The
default value is 0xFF.
The SubClass is an integer between 0 and 255 and is optional. The
default value is 0xFF.
The Protocol is an integer between 0 and 255 and is optional. The
default value is 0xFF.
So if any the optional para is not specified in the text device,
we should set related para in the node structure to default value.

This commit is to do the enhancement for USB Class device path
when optional para is not specified.

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=1243
Obtained from:	3874108034
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:13:24 -07:00
Jose Luis Duran
4e83ac7d2e libefivar: Handle Sata device path when optional para is not specified
Sata device path format:Sata(HPN, PMPN, LUN)
According to UEFI Spec, the PMPN is an integer between
0 and 65535 and is optional. If not provided, the default is 0xFFFF.

This commit is to do the enhancement for Sata device path
when optional para is not specified.

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=1243
Obtained from:	6d9b9bbb61
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:13:20 -07:00
Jose Luis Duran
9a62aa9329 libefivar: Use VENDOR_DEVICE_PATH structure for Debug Port device path
When converting DebugPort device path from text,
current code use VENDOR_DEFINED_MESSAGING_DEVICE_PATH structure
for Debug port device node.
typedef struct {
  EFI_DEVICE_PATH_PROTOCOL  Header;
  EFI_GUID                  Guid;
  UINT8                     VendorDefinedData[1];
} VENDOR_DEFINED_MESSAGING_DEVICE_PATH;

And Debugport Device Path is a vendor-defined messaging
device path with no data, only a GUID. So it's better to
use VENDOR_DEVICE_PATH to create the Debug port device node.
typedef struct {
  EFI_DEVICE_PATH_PROTOCOL        Header;
  EFI_GUID                        Guid;
} VENDOR_DEVICE_PATH;

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=1229
Obtained from:	9343d0a1cd
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:13:12 -07:00
Jose Luis Duran
a51ae7212d libefivar: Add PciRoot/PcieRoot text for ACPI Expanded Device Path
According to UEFI spec,for ACPI Expanded Device Path
when HID=PNP0A03 or CID=PNP0A03 and HID != PNP0A08,
the device path node can be displayed as: PciRoot(UID|UIDSTR)
When HID=PNP0A08 or CID=PNP0A08, the device path node can be
displayed as: PcieRoot(UID|UIDSTR). But current code miss the
code logic.

This commit is to do the enhancement.

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=1228
Obtained from:	78af0984b4
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:13:08 -07:00
Jose Luis Duran
ac2b16d3b1 libefivar: Correct condition check for AcpiExp text format
According to UEFI Spec, for ACPI Expanded Device Path,
when HIDSTR=empty, CIDSTR=empty, UID STR!=empty,
the ACPI Expanded Device Path node can be displayed as
AcpiExp(HID,CID,UIDSTR) format.
And if UID is 0 and UIDSTR is empty, then use AcpiEx format.

This patch is to correct the condition check to follow UEFI
Spec when convert the device path node to the AcpiExp text
format.

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=1226
Obtained from:	fb4bea551e
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:13:04 -07:00
Jose Luis Duran
8278071ae1 libefivar: Correct the string order of ACPI Expanded Device Path
According to UEFI Spec, ACPI Expanded Device Path can be display
AcpiEx(HID|HIDSTR,(CID|CIDSTR,UID|UIDSTR)), but current code display
UID|UIDSTR before CID|CIDSTR.
This patch is to fix this issue.

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=1227
Obtained from:	05fe752589
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:13:00 -07:00
Jose Luis Duran
49951297d2 libefivar: Clean up source files
1. Do not use tab characters
2. No trailing white space in one line
3. All files must end with CRLF

Adapted according to FreeBSD-update instructions, with the sole purpose
of reducing the differences with upstream sources.

Obtained from:	9095d37b8f
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:12:55 -07:00
Jose Luis Duran
50668299b3 libefivar: Fix iSCSI.Lun byte order issue
Obtained from:	19f21ed916
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:12:52 -07:00
Jose Luis Duran
acfee0131a libefivar: Fix byte orders of iSCSI.Lun
Per UEFI spec, iSCSI.Lun is a 8-byte array with byte #0 in the left.
It means "0102030405060708" should be converted to:
    UINT8[8] = {01, 02, 03, 04, 05, 06, 07, 08}
or  UINT64 = {0807060504030201}

Today's implementation wrongly uses the reversed order.

Obtained from:	d0196be1e3
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:12:47 -07:00
Jose Luis Duran
76ed5f1b26 libefivar: Fix bug when converting iSCSI node
If protocol string is not specified, default TCP(0) should be used.
Today's implementation wrongly sets to 1 for this case.

Obtained from:	e6c80aea71
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:12:41 -07:00
Jose Luis Duran
d9d1a1e7ab libefivar: Add DevPathFromTextDns and DevPathToTextDns libraries
V3:
* Fix the bug in DevPathFromTextDns()

V2:
* Add no IP instance case check.

Obtained from:	9b9d0655c1
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:12:29 -07:00
Jose Luis Duran
e8fc7f1189 libefivar: Add BluetoothLe device path node support
Obtained from:	ff5623e990
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:12:25 -07:00
Jose Luis Duran
0081638344 libefivar: Reverse the byte order of BD_ADDR for Bluetooth
For the following two functions:
DevPathFromTextBluetooth()
DevPathToTextBluetooth()

The Bluetooth device address "UINT8  Address[6]" is displayed with the
order from Address[5] to Address[0]. This commit reverses the order.

Obtained from:	4fc8277133
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:12:21 -07:00
Jose Luis Duran
7ca6daff6a libefivar: Refine the DevPathFromTextiSCSI protocol parsing
For current iSCSI protocol parsing, UINT16 truncation may be happened. Since
the Spec already have declaimed that 0 is TCP Protocol and 1+ is reserved, the
parsing can be refined as below:

  if (StrCmp (ProtocolStr, L"TCP") == 0) {
    ISCSIDevPath->NetworkProtocol = 0;
  } else {
    //
    // Undefined and reserved.
    //
    ISCSIDevPath->NetworkProtocol = 1;
  }

Obtained from:	7571a1c191
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:12:18 -07:00
Jose Luis Duran
b782b7884c libefivar: Fix FromText bug for multi-instance devicepath
UefiDevicePathLibConvertTextToDevicePath correctly detects when it
has hit a ',' splicing together multiple paths. However, the code
that tries to cope with it:
{code}
if (IsInstanceEnd) {
  DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (
                                   END_DEVICE_PATH_LENGTH);
  ASSERT (DeviceNode != NULL);
  SetDevicePathEndNode (DeviceNode);

  NewDevicePath = AppendDevicePathNode (DevicePath, DeviceNode);
  FreePool (DevicePath);
  FreePool (DeviceNode);
  DevicePath = NewDevicePath;
}
{code}
causes a problem. The END node that's appended it the node for the
entire list. So when the node is appended in AppendDevicePathNode,
it winds up disappearing. This leads to the path
'PciRoot(0x0),PciRoot(0x0)' parsing as if 'PciRoot(0x0)/PciRoot(0x0)'
were specified. These are two very different things.

NOTE:
This fix was already committed.  It has been included with the sole
intention of reducing diffs with upstream.

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=419
Obtained from:	647636e175
Pull Request:	https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:11:59 -07:00
Jose Luis Duran
81a659e364 libefivar: Fix the wrong MAC address length
Network interface type should be checked before the conversion between
text device path node and MAC device path. Otherwise, the MAC text string
can't be converted to the representation of a device node, which leads to
the series failure of network HII configuration(e.g. IP, VLAN, HTTP Boot
configuration in Network Device List).

Obtained from:	2d67f2bae3
Pull Request: https://github.com/freebsd/freebsd-src/pull/581
2022-02-27 09:11:55 -07:00
Richard Scheffenegger
bd6bb49397 iscsi: per-session timeouts and rapid teardown of session on reconnect
Add per-Session configurable ping (SCSI NOP) and login timeouts.

Remove the torn down, old iSCSI session quickly, when performing a reconnect.

Reviewed By: trasz
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34198
2022-02-25 10:35:47 +01:00
Eric van Gyzen
a8fea07c30 sendfile_test: fix copy-paste bug
Require the newly opened file descriptor to be good, instead of
re-requiring the one that was required three lines earlier.
Thankfully, opening /dev/null is really unlikely to fail.

Reported by:	Coverity
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2022-02-24 17:05:12 -06:00
Jose Luis Duran
91a35e5803 libefivar: Correct the string expression of UTF8 vendor device path
According to UEFI spec, the string expression of UTF8 vendor
device node should be displayed as: VenUtf8(). Current code
display it as: VenUft8() by mistake when convert device
path node to text.

This commit is to fix this bug.

Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=1225
Obtained from:	959be180e1
Pull Request:	https://github.com/freebsd/freebsd-src/pull/580
2022-02-23 09:20:26 -07:00
Piotr Kubaj
884ba43116 powerpc: enable initial-exec TLS
Summary:
Use initial-exec, like other architectures.

While here, switch MACHINE_ARCH in lib/libc/Makefile to LIBC_ARCH and consistently use powerpc.

Subscribers: imp, #contributor_reviews_base

Differential Revision: https://reviews.freebsd.org/D34315
Reviewed by:	luporl
MFC after:	2 weeks
2022-02-22 19:34:28 +01:00
Jessica Clarke
9f22e0959b libpmc: Allow specifying explicit EVENT_xxH events on armv7 and arm64
This is useful for processors where we don't have an event table; in
those cases we default to a Cortex A8 (armv7) or Cortex A53 (arm64) in
order to attempt to provide something useful, but you're then limited to
the counters in those tables, some of which may also not be implemented
(e.g. LD/ST_RETIRED are no longer implemented in more recent cores,
replaced by LD/ST_SPEC).

Adding the raw EVENT_xxH event lists to each table ensures that you can
always request the exact events you want, regardless of what has been
detected or is known.

Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33805
2022-02-15 16:10:34 +00:00
John Baldwin
bbf4df1722 libthr: Disable stack unwinding on ARM.
When a thread exits, _Unwind_ForcedUnwind() is used to walk up stack
frames executing pending cleanups pushed by pthread_cleanup_push().
The cleanups are popped by thread_unwind_stop() which is passed as a
callback function to _Unwind_ForcedUnwind().

LLVM's libunwind uses a different function type for the callback on
32-bit ARM relative to all other platforms.  The previous unwind.h
header (as well as the unwind.h from libcxxrt) use the non-ARM type on
all platforms, so this has likely been broken on 32-bit arm since it
switched to using LLVM's libunwind.

For now, just disable stack unwinding on 32-bit arm to unbreak the
build until a proper fix is tested.
2022-02-10 12:47:08 -08:00
John Baldwin
c00d345665 Install unwind.h into /usr/include
Install headers from LLVM's libunwind in place of the headers from
libcxxrt and allow C applications to use the library.

As part of this, remove include/unwind.h and switch libthr over to
using the installed unwind.h.

Reviewed by:	dim, emaste
MFC after:	10 days
Differential Revision: https://reviews.freebsd.org/D34065
2022-02-10 19:00:32 +01:00
Martin Matuska
833a452e9f libarchive: import changes from upstream
Libarchive 3.6.0

New features:
PR #1614: tar: new option "--no-read-sparse"
PR #1503: RAR reader: filter support
PR #1585: RAR5 reader: self-extracting archive support

New features (not used in FreeBSD base):
PR #1567: tar: threads support for zstd (#1567)
PR #1518: ZIP reader: zstd decompression support

Security Fixes:
PR #1491, #1492, #1493, CVE-2021-36976:
   fix invalid memory access and out of bounds read in RAR5 reader
PR #1566, #1618, CVE-2021-31566:
   extended fix for following symlinks when processing the fixup list

Other notable bugfixes and improvements:
PR #1620: tar: respect "--ignore-zeros" in c, r and u modes
PR #1625: reduced size of application binaries

MFC after:	2 weeks
Relnotes:	yes
2022-02-10 00:35:42 +01:00
Stefan Eßer
af7d105379 sysctlbyname(): restore access to user variables
The optimization of sysctlbyname() in commit d05b53e0ba had the
side-effect of not going through the fix-up for the user.* variables
in the previously called sysctl() function.

This lead to 0 or an empty strings being returned by sysctlbyname()
for all user.* variables.

An alternate implementation would store the user variables in the
kernel during system start-up. That would allow to remove the fix-up
code in the C library that is currently required to provide the actual
values.

This update restores the previous code path for the user.* variables
and keeps the performance optimization intact for all other variables.

Approved by:	mjg
Reviewed by:	kaktus
Differential Revision:	https://reviews.freebsd.org/D34171
2022-02-09 23:10:31 +01:00
Dimitry Andric
5f2aca8394 Disable clang 14 warning about bitwise operators in zstd
Parts of zstd, used in openzfs and other places, trigger a new clang 14
-Werror warning:

```
sys/contrib/zstd/lib/decompress/huf_decompress.c:889:25: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
                        (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

While the warning is benign, it should ideally be fixed upstream and
then vendor-imported, but for now silence it selectively.

MFC after:	3 days
2022-02-08 21:46:08 +01:00
Konstantin Belousov
a1f9326607 libc binuptime(): use the right function to get the most significant bit index
Reported and tested by:	Jaroslaw Pelczar <jarek@jpelczar.com>
PR:	261781
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-02-08 21:44:23 +02:00
John Baldwin
6426978617 Extend the VMM stats interface to support a dynamic count of statistics.
- Add a starting index to 'struct vmstats' and change the
  VM_STATS ioctl to fetch the 64 stats starting at that index.
  A compat shim for <= 13 continues to fetch only the first 64
  stats.

- Extend vm_get_stats() in libvmmapi to use a loop and a static
  thread local buffer which grows to hold the stats needed.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D27463
2022-02-07 14:11:10 -08:00
Mateusz Piotrowski
4073917408 strftime.3: Fix a typo and use St for standards
MFC after:	1 week
2022-02-07 15:14:47 +01:00
Stefan Eßer
9535d9f104 libc: add helper furnction to set sysctl() user.* variables
Testing had revealed that trying to retrieve the user.localbase
variable into to small a buffer would return the correct error code,
but would not fill the available buffer space with a partial result.

A partial result is of no use, but this is still a violation of the
documented behavior, which has been fixed in the previous commit to
this function.

I just checked the code for "user.cs_path" and found that it had the
same issue.

Instead of fixing the logic for each user.* sysctl string variable
individually, this commit adds a helper function set_user_str() that
implements the semantics specified in the sysctl() man page.

It is currently only used for "user.cs_path" and "user.localbase",
but it will offer a significant simplification when further such
variables will be added (as I intend to do).

MFC after:	3 days
2022-02-05 13:33:53 +01:00
Stefan Eßer
e11ad014d1 libc: return partial sysctl() result if buffer is too small
Testing of a new feature revealed that calling sysctl() to retrieve
the value of the user.localbase variable passing too low a buffer size
could leave the result buffer unchanged.

The behavior in the normal case of a sufficiently large buffer was
correct.

All known callers pass a sufficiently large buffer and have thus not
been affected by this issue. If a non-default value had been assigned
to this variable, the result was as documented, too.

Fix the function to fill the buffer with a partial result, if the
passed in buffer size is too low to hold the full result.

MFC after:	3 days
2022-02-04 13:44:20 +01:00
Konstantin Belousov
529575be27 lnumeric.c: replace some space*8 by tabs
Reported by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-02-03 20:56:03 +02:00
Konstantin Belousov
ef061a2e29 __ctype_load(): check for calloc() failure
Noted and reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:04:00 +02:00
Konstantin Belousov
87151b60e0 __numeric_load(): check for calloc() failure
Noted and reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:03:52 +02:00
Konstantin Belousov
1aa669c5f9 libc/locale/lnumeric.c: minor style
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:03:44 +02:00
Konstantin Belousov
4d3b84f67c __monetary_load(): check for calloc() failure
Noted and reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:03:35 +02:00
Konstantin Belousov
0fed1e6f18 libc/locale/lmonetary.c: minor style
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:03:29 +02:00
Konstantin Belousov
bc9ce839f9 __messages_load(): check for calloc() failure
Noted and reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:03:24 +02:00
Konstantin Belousov
5b7e92d48f libc/locale/lmessages.c: minor style
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:03:17 +02:00
Konstantin Belousov
b8ad908ad9 __collate_load(): check for calloc failure
Noted and reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:03:07 +02:00
Konstantin Belousov
a8be061167 libc/locale/collate.c: minor style
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:02:59 +02:00
Konstantin Belousov
7bf532c9d4 xlocale.c: only call init_key() when locale was successfully allocated
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:02:59 +02:00
Konstantin Belousov
b68522308d xlocale.c: check for allocation failure
PR:	261679
Reported by:	phil.stone@gmx.com
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:02:58 +02:00
Konstantin Belousov
fcdf9d7de5 xlocale.c:init_key(): do not ignore errors from pthread_key_create()
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:02:58 +02:00
Konstantin Belousov
aaa6fa65a6 libc/locale/xlocale.c: minor style
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34140
2022-02-03 03:02:58 +02:00
Warner Losh
356deeb2e7 kyua/qemu: When running in qemu, don't teset sendfile
qemu's bsd-user doesn't implement sendfile, so just skip those tests
that use it.

Sponsored by:		Netflix
2022-02-02 14:27:51 -07:00
Kristof Provost
6f47a72d8e libpfctl: fix pfctl_kill_states()
735748f30a changed the output of the states so that the creator id
endianness would be consistent. This means that we need to convert the
host endianness creatorid back to big-endian before we give it to the
kernel.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-01-31 19:13:26 +01:00
Mitchell Horne
99830f702d libpmc: remove mips support
Bye bye!

Reviewed by:	imp, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34083
2022-01-28 16:35:32 -04:00
Alfonso Siciliano
02db4a1234 bsddialog: import version 0.1 2022-01-28 09:14:55 +01:00
Konstantin Belousov
72d5dedfa6 stdio: add test for 86a16ada1e: fflush() handling of errors
PR:	76398
Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34044
2022-01-28 01:09:47 +02:00
John Baldwin
3a502289d3 Use uintptr_t for return type of _Unwind_GetCFA.
This matches the type in other unwind headers.

Reviewed by:	dim, emaste
Differential Revision:	https://reviews.freebsd.org/D34050
2022-01-27 10:53:21 -08:00
John Baldwin
b84693501a Use an unsigned 64-bit integer for exception class.
This matches the type in other unwind headers (LLVM libunwind,
libcxxrt, glibc).

NB: include/unwind.h is not installed but is only used by libthr

Reviewed by:	imp, dim, emaste
Differential Revision:	https://reviews.freebsd.org/D34049
2022-01-27 10:34:35 -08:00
Kyle Evans
c9afc7680f tests: fix posix_spawnp_enoexec_fallback_null_argv0
This test was written because execvp was found to improperly handle the
argc == 0 case when it falls back from an ENOEXEC.  We could probably
mostly revert it now, but let's just fix the test for the time being and
circle back later to decide if we want to simplify execvp.  The test
will likely remain either way just to make sure execvp isn't working
around the newly enforced restriction with the fallback.

Fixes:	301cb491ea ("execvp: fix up the ENOEXEC fallback")
Reported by:	jenkins via lwhsu@
2022-01-27 11:22:49 -06:00
Andrew Turner
548a2ec49b Add PT_GETREGSET
This adds the PT_GETREGSET and PT_SETREGSET ptrace types. These can be
used to access all the registers from a specified core dump note type.
The NT_PRSTATUS and NT_FPREGSET notes are initially supported. Other
machine-dependant types are expected to be added in the future.

The ptrace addr points to a struct iovec pointing at memory to hold the
registers along with its length. On success the length in the iovec is
updated to tell userspace the actual length the kernel wrote or, if the
base address is NULL, the length the kernel would have written.

Because the data field is an int the arguments are backwards when
compared to the Linux PTRACE_GETREGSET call.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19831
2022-01-27 11:40:34 +00:00
Kristof Provost
735748f30a libpfctl: fix creatorid endianness
We provide the hostid (which is the state creatorid) to the kernel as a
big endian number (see pfctl/pfctl.c pfctl_set_hostid()), so convert it
back to system endianness when we get it from the kernel.

This avoids a confusing mismatch between the value the user configures
and the value displayed in the state.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33989
2022-01-27 09:07:27 +01:00
Kyle Evans
773fa8cd13 execve: disallow argc == 0
The manpage has contained the following verbiage on the matter for just
under 31 years:

"At least one argument must be present in the array"

Previous to this version, it had been prefaced with the weakening phrase
"By convention."

Carry through and document it the rest of the way.  Allowing argc == 0
has been a source of security issues in the past, and it's hard to
imagine a valid use-case for allowing it.  Toss back EINVAL if we ended
up not copying in any args for *execve().

The manpage change can be considered "Obtained from: OpenBSD"

Reviewed by:	emaste, kib, markj (all previous version)
Differential Revision:	https://reviews.freebsd.org/D34045
2022-01-26 13:40:27 -06:00
Ed Maste
9c296a2105 geom: Add HiFive boot partitions
As documented in the HiFive Unmatched Software Reference Manual.

Reviewed by:	imp, mhorne
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34010
2022-01-26 10:54:45 -05:00
Ed Maste
3524dead81 gpart.8: minor tidying
Reported by:	igor(1)
2022-01-26 10:54:45 -05:00
Piotr Kubaj
0b2d2290fe powerpc: Enable LLDB on all powerpc architectures
While LLDB on powerpc and powerpcspe builds as-is, on powerpc64 and
powerpc64le it requires adding a couple of additional source files
to build.

Differential review:	https://reviews.freebsd.org/D34043
Approved by:	dim, imp, emaste
2022-01-26 15:03:27 +01:00
Andriy Gapon
1abf1e8c6b cam_get_device: resolve path links before parsing device name
The CAM subsystem uses bus:taget:lun tuple to address peripherals.  But
for convenience many userland programs such as camcontrol accept devices
names such as da0.  There is a libcam function, cam_open_device, to
support that.  It first calls cam_get_device() to parse the device name
as a driver name and a unit (and handle some special device name
prefixes) and then uses cam_lookup_pass() to find a matching pass
device.

This change extends cam_get_device() to apply realpath(3) to the device
name before parsing it.  This will allow to use tools such as camcontrol
and smartctl with symbolic links that could be friendlier (more
distinguished) names for devices.

MFC after:	3 weeks
Relnotes:	maybe
2022-01-26 11:25:31 +02:00
John Baldwin
8de1a8131e libthr: Use TLS_TCB_* in _tcb_[cd]tor.
This matches libc and rtld in using the alignment (TLS_TCB_ALIGN) from
machine/tls.h instead of hardcoding 16.

Reviewed by:	kib
Sponsored by:	The University of Cambridge, Google Inc.
Differential Revision:	https://reviews.freebsd.org/D34023
2022-01-25 11:38:34 -08:00
Konstantin Belousov
86a16ada1e __sflush(): on write error, if nothing was written, reset FILE state back
otherwise the data is just dropped.  Check for current position equal to
the buffer base at the entry of the function; if not equal, setvbuf()
was done from the write method and it is not our business to override
the decision.

PR:	76398
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34007
2022-01-25 17:26:05 +02:00
John Baldwin
b943d31594 Include the correct header for pdfork()'s prototype.
Reviewed by:	kib, markj
Obtained from:	CheriBSD
Sponsored by:	The University of Cambridge, Google Inc.
Differential Revision:	https://reviews.freebsd.org/D33988
2022-01-24 09:52:12 -08:00
Martin Matuska
e92ffd9b62 zfs: merge openzfs/zfs@17b2ae0b2 (master) into main
Notable upstream pull request merges:
  #12766 Fix error propagation from lzc_send_redacted
  #12805 Updated the lz4 decompressor
  #12851 FreeBSD: Provide correct file generation number
  #12857 Verify dRAID empty sectors
  #12874 FreeBSD: Update argument types for VOP_READDIR
  #12896 Reduce number of arc_prune threads
  #12934 FreeBSD: Fix zvol_*_open() locking
  #12947 lz4: Cherrypick fix for CVE-2021-3520
  #12961 FreeBSD: Fix leaked strings in libspl mnttab
  #12964 Fix handling of errors from dmu_write_uio_dbuf() on FreeBSD
  #12981 Introduce a flag to skip comparing the local mac when raw sending
  #12985 Avoid memory allocations in the ARC eviction thread

Obtained from:	OpenZFS
OpenZFS commit:	17b2ae0b24
2022-01-22 23:05:15 +01:00
Dimitry Andric
3c3df36600 Sort SRCS in libcxxrt's Makefile, and use += to list sources
No functional change intended.

MFC after:	3 days
2022-01-22 21:08:55 +01:00
Ed Maste
6f6fbfa3a8 Remove quotes around Makefile .error/.warn/.info strings
The text after .error et al is emitted verbatim.

Reviewed by:	sjg
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33904
2022-01-22 14:03:07 -05:00
Konstantin Belousov
a393644ecb ptrace(2): document policies affecting access to the facility
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33986
2022-01-22 19:36:56 +02:00
наб
bc40713a8f
libspl: ASSERT*: !! for sizeof
sizeof(bitfield.member) is invalid, and this shows up in some FreeBSD
build configurations: work around this by !!ing ‒
this makes the sizeof target the ! result type (_Bool), instead

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Fixes: 42aaf0e ("libspl: ASSERT*: mark arguments as used")
Closes #12984
Closes #12986
2022-01-21 10:20:11 -08:00
Konstantin Belousov
7406ec4ea9 kqueue(2): Add note about format of the data for NOTE_EXIT
Noted by:	Dave Baukus <daveb@spectralogic.com>
PR:	261346
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-01-20 00:37:25 +02:00
наб
e1c720de7d
libefi: remove efi_type()
All it is right now is some #if 0ed Solaris code that returns ENOSYS,
and is only applicable for the Solaris blockdev layer.
In the Illumos gate, there's a single user: rmformat(1);
I recommend a read of the manual as a blast from the past, but, well

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Issue #12844
Closes #12969
2022-01-18 14:40:43 -08:00
Xin LI
cc68614da8 MFV f83ac37f1e: libbsdxml (expat) 2.4.3. 2022-01-17 16:34:41 -08:00
Mark Johnston
f75b1ff6e5 Revert "libthr: Use kern.stacktop for thread stack calculation."
The current ASLR stack gap feature will be removed, and with that the
need for this change, and the kern.stactop sysctl, is gone.  Moreover,
the approach taken in this revision does not provide compatibility for
old copies of libthr.so, and the revision should have also updated
__libc_map_stacks_exec().

This reverts commit 78df56ccfc.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33704
2022-01-17 11:41:49 -05:00
Xin LI
f83ac37f1e Vendor import of expat 2.4.3. 2022-01-16 18:55:26 -08:00
Ed Maste
2e9bc9d144 libc: correct SPDX tag on strstr.c
It was obtained from musl, and is MIT licensed.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-01-16 11:56:28 -05:00
Ed Maste
c6750f07b4 libc: fix misleading comment in strstr
Obtained from:	musl c53e9b239418
2022-01-16 11:52:29 -05:00
Stefan Eßer
10af8e45a8 fread.c: fix undefined behavior
A case of undefined behavior in __fread() has been detected by UBSAN
and reported by Mark Millard:

/usr/main-src/lib/libc/stdio/fread.c:133:10: runtime error: applying
zero offset to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior in
/usr/main-src/lib/libc/stdio/fread.c:133:10

While being benign (the NULL pointer is later passed to memcpy() with
a length argument of 0), this issue causes in the order of 600 Kyua
test cases to fail on systems running a world built with WITH_UBSAN
and WITH_ASAN.

The undefined behavior can be prevented by skipping operations that
have no effect for r == 0. Mark Millard has suggested to only skip
this code segment if fp->_p == NULL, but I have verified that for the
case of r == 0 no further argument checking is performed on the
addresses passed to memcpy() and thus no bugs are hidden from the
sanitizers due to the simpler condition chosen.

Reported by:	Mark Millard (marklmi@yahoo.com)
Tested by:	Mark Millard (marklmi@yahoo.com)
Differential Revision:	https://reviews.freebsd.org/D33903
MFC after:	2 weeks
2022-01-16 00:43:56 +01:00
наб
18168da727
module/*.ko: prune .data, global .rodata
Evaluated every variable that lives in .data (and globals in .rodata)
in the kernel modules, and constified/eliminated/localised them
appropriately. This means that all read-only data is now actually
read-only data, and, if possible, at file scope. A lot of previously-
global-symbols became inlinable (and inlined!) constants. Probably
not in a big Wowee Performance Moment, but hey.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12899
2022-01-14 15:37:55 -08:00
Ryan Moeller
69c5e694a1
FreeBSD: Fix leaked strings in libspl mnttab
The FreeBSD implementations of various libspl functions for getting
mounted device information were found to leak several strings which
were being allocated in statfs2mnttab but never freed.

The Solaris getmntany(3C) and related interfaces are expected to return
strings residing in static buffers that need to be copied rather than
freed by the caller.

Use static thread-local storage to stash the mnttab structure strings
from FreeBSD's statfs info rather than strings allocated on the heap by
strdup(3).

While here, remove some stray commented out lines.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #12961
2022-01-14 12:38:32 -08:00
Piotr Kubaj
9fc1314266 riscv64: enable ASAN and UBSAN
Differential review:	https://reviews.freebsd.org/D33875
Approved by:	dim, imp
2022-01-14 01:29:58 +01:00
наб
4737a9eb70
linux: libzfs: mount: fix uninitialised flags
They're later |=d with constants, but never reset

Caught by valgrind while investigating
https://github.com/openzfs/zfs/pull/12928#issuecomment-1007496550

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12954
2022-01-13 11:07:54 -08:00
Stefan Eßer
d106f982a5 qsort.c: prevent undefined behavior
Mark Milliard has detected a case of undefined behavior with the LLVM
UBSAN. The mandoc program called qsort with a==NULL and n==0, which is
allowed by the POSIX standard. The qsort() in FreeBSD did not attempt
to perform any accesses using the passed pointer for n==0, but it did
add an offset to the pointer value, which is undefined behavior in
case of a NULL pointer. This operation has no adverse effects on any
achitecture supported by FreeBSD, but could be caught in more strict
environments.

After some discussion in the freebsd-current mail list, it was
concluded that the case of a==NULL and n!=0 should still be caught by
UBSAN (or cause a program abort due to an illegal access) in order to
not hide errors in programs incorrectly invoking qsort().

Only the the case of a==NULL and n==0 should be fixed to not perform
the undefined operation on a NULL pointer.

This commit makes qsort() exit before reaching the point of
potentially undefined behvior for the case n==0, but does not test
the value of a, since the result will not depend on whether this
pointer is NULL or an actual pointer to an array if n==0.

The issue found by Mark Milliard in the whatis command has been
reported to the upstream (OpenBSD) and has already been patched
there.

MFC after:	1 week
2022-01-13 11:09:38 +01:00
Warner Losh
479ef15dfd libc: Teak comment about mips
Remove mips from the list of machines using TLS variant I and reformat
paragraph. No functional change intended.

Sponsored by:		Netflix
2022-01-10 10:15:15 -07:00
Eugene Grosbein
ba94a95402 gpart(8): add minimal reference to glabel(8) to manual page
MFC after:	1 week
2022-01-10 22:07:23 +07:00
Konstantin Belousov
6d06bc688e libc clnt_com_create: relock rpcsoc_lock earlier when port is obtained from portmapper
Otherwise on mapper failure we goto error handler which expect
rpscoc_lock owned, but we do not.

PR:	261051
Reported by:	RyanCai <ryancaicse@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-01-09 07:36:06 +02:00
Ed Maste
adc88b9c01 Build libclang also if LLDB is enabled
LLDB depends on libclang as it uses Clang as the expression parser.
Previously setting WITHOUT_CLANG but leaving LLDB enabled (as default)
resulted in a build failure.

Users who set WITHOUT_CLANG in order to reduce build time or size
might want to set WITHOUT_LLDB in addition to WITHOUT_CLANG, or use
WITHOUT_TOOLCHAIN instead.

PR:		260993
Reported by:	eugen
Reviewed by:	dim
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-01-07 15:23:55 -05:00
Rich Ercolani
d6c1bbdd65
Updated the lz4 decompressor
As an experiment, I stole the lz4 decompressor from
upstream lz4 (1.9.3), and landed it.

Feedback suggested that keeping the vendor lz4 code isolated and
unlinted was probably reasonable, so I lobbed it into its own file.

It also seemed reasonable to put the mostly-untouched* code into
lz4.c proper, and relegate the integrated and ZFS-specific code to
lz4_zfs.c.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #12805
2022-01-07 10:36:49 -08:00
Jose Luis Duran
f5ccb3a33e file: Fix cross-compilation on Darwin/macOS
Darwin/macOS does not have pipe2(2).

Apply a similar guard as in f3d7ace4b2
after 43a5ec4eb4.

Pull Request: https://github.com/freebsd/freebsd-src/pull/574
2022-01-07 07:52:34 -07:00
Tino Reichardt
a798b485ae Remove sha1 hashing from OpenZFS, it's not used anywhere.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Attila Fülöp <attila@fueloep.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12895
Closes #12902
2022-01-06 16:16:28 -08:00
наб
5c8389a8cb module: icp: rip out the Solaris loadable module architecture
After progressively folding away null cases, it turns out there's
/literally/ nothing there, even if some things are part of the
Solaris SPARC DDI/DKI or the seventeen module types (some doubled for
32-bit userland), or the entire modctl syscall definition.
Nothing.

Initialisation is handled in illumos-crypto.c,
which calls all the initialisers directly

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Attila Fülöp <attila@fueloep.org>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12895
Closes #12902
2022-01-06 16:14:04 -08:00
Paul Dagnelie
399b98198a
Revert "zfs list: Allow more fields in ZFS_ITER_SIMPLE mode"
This reverts commit f6a0dac84a.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #12938
2022-01-06 11:12:53 -08:00
Warner Losh
f3d7ace4b2 file: Turns out we need xlocal.h protection
It turns out that we still need xlocal.h protection for when we're
cross building on Linux. Linux doesn't have this file, but os/x
does. Before, we'd assume we didn't have it, like old FreeBSD, when
cross compiling. After the latest update, all that code was removed so
cross compiling needs to be handled separaetly. Do so by defining
HAVE_XLOCALE_H only when we're not building on linux. This allows us
to build the mkmagic build tool needed to build file(1).

Sponsored by:		Netflix
Reviewed by:		jrtc27
Differential Revision:	https://reviews.freebsd.org/D33741
2022-01-04 14:12:59 -07:00
Mark Johnston
e2576591b9 libsysdecode: Decode sendmsg/recvmsg flags containing an underscore
Otherwise MSG_CMSG_CLOEXEC is not decoded.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-01-04 09:46:23 -05:00
Hans Petter Selasky
fff236e89d mixer(3): Revert: "Fix for header file pollution."
Differential Revision:	https://reviews.freebsd.org/D33732
Submitted by:	christos@
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-01-04 12:35:23 +01:00
Hans Petter Selasky
55224280e2 mixer(3): Fix for header file pollution.
Differential Revision:	https://reviews.freebsd.org/D33732
Submitted by:	christos@
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-01-04 11:43:59 +01:00
Xin LI
43a5ec4eb4 file: upgrade to 5.41.
MFC after:	2 weeks
2022-01-03 22:03:39 -08:00
Konstantin Belousov
d9cacbf4b0 sched_get/setaffinity(): try to be more compatible with Linux
in handling the cpuset sizes different from sizeof(cpuset_t).

For both cases, cpuset size shorter than sizeof(cpuset_t) results
in EINVAL on Linux.

For sched_getaffinity(), be more permissive and accept cpuset size
larger than our cpuset_t, by clipping the syscall argument and zeroing
the rest of the output buffer.  For sched_setaffinity(), we should allow
shorter cpusets than current ABI size, again zeroing the rest of the bits.

With this change, python os.sched_get/setaffinity functions work.

Reported by:	se
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-01-03 04:31:40 +02:00
Xin LI
9026652101 libmagic: Remove support for older FreeBSD where xlocale was not available.
The MINIMUM_SUPPORTED_OSREL is 1002501 (FreeBSD 10.3), and xlocale is
supported there.

While I'm there, explicitly use config.h generated with --disable-bzlib
--disable-xzlib instead of deleting them manually.

MFC after:	2 weeks
2022-01-02 18:05:08 -08:00
наб
1f182103aa libzfs: fix unused, remove argsused
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12844
2021-12-23 09:42:47 -08:00
наб
0cad373e5c libnvpair: fix unused, remove argsused
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12844
2021-12-23 09:42:47 -08:00
наб
9028f99a79 libzutil: import: fix unused, remove argsused
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12844
2021-12-23 09:42:47 -08:00
наб
56050599c9 libzpool: fix unused, remove argsused
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12844
2021-12-23 09:42:47 -08:00
наб
57bff80ebf libshare: nfs: fix unused, remove argsused
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12844
2021-12-23 09:42:47 -08:00
наб
bfc1789703 libzfs_core: fix unused, remove argsused
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12844
2021-12-23 09:42:47 -08:00
наб
7fe47a2386 libefi: efi_type: fix unused, remove argsused
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12844
2021-12-23 09:42:47 -08:00
наб
da5f5ec508 libspl: kmem.h: mark unused kmem_*() macro arguments used
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12844
2021-12-23 09:36:12 -08:00