Commit Graph

23750 Commits

Author SHA1 Message Date
Simon J. Gerraty
d1dfe419ac libsecureboot allow site.trust.mk to override settings
The current content of local.trust.mk is mostly for example
purposes.
2023-04-14 17:28:10 -07:00
Simon J. Gerraty
2b8331622f Fix DIRDEPS_BUILD for libgcc_eh 2023-04-14 16:56:30 -07:00
Konstantin Belousov
dcc19c6701 pkru.3: fix markup
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-04-15 02:53:59 +03:00
Kajetan Staszkiewicz
39282ef356 pf: backport OpenBSD syntax of "scrub" option for "match" and "pass" rules
Introduce the OpenBSD syntax of "scrub" option for "match" and "pass"
rules and the "set reassemble" flag. The patch is backward-compatible,
pf.conf can be still written in FreeBSD-style.

Obtained from:	OpenBSD
MFC after:	never
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D38025
2023-04-14 09:04:06 +02:00
John Baldwin
10172ce32c Stop stripping 'sf' suffixes from architecture names.
riscv64sf was the only architecture with an 'sf' suffix.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D39497
2023-04-12 11:11:02 -07:00
Warner Losh
7968a06a69 sysdecode: Add aarch64
FREEBSD32 API is also supported on aarch64. Refer to aarch64 instead of
arm64 because it's about the architecture (powerpc64), not the kernel
interface...

Sponsored by:		Netflix
2023-04-11 22:14:17 -06:00
Joseph Koshy
f401d82ef7
pmc: Keep a list sorted.
Approved by:	gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D39439
2023-04-05 20:09:28 +01:00
Konstantin Belousov
54579376c0 Change kqueue1() to be compatible with NetBSD
by making it accept some open(2) flags.  More precisely, only
O_CLOEXEC is supported, the flag is translated into the KQUEUE_CLOEXEC flag
for kqueuex(2), and O_NONBLOCK is silently ignored.

Reported and tested by:	vishwin
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39377
2023-04-05 06:29:49 +03:00
Eric van Gyzen
179bffddf5 cap_dns, cap_net: fix host and service buffer handling
If a malicious casper process sent a host or service string that was
too long, cap_getnameinfo would overrun the caller's buffer by one byte.

The backends for this function needlessly allocated one extra byte
for these buffers.  This was harmless, but could be confusing to readers.

Reported by:	Coverity (an internal run at Dell)
Reviewed by:	oshogbo, emaste
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D39347
2023-04-04 15:26:12 -05:00
Ed Maste
20c9c3be5a kqueue: add close() calls to man page example
There is no real need to close descriptors before a process exits, but
these close calls demonstrate by example that kqueue descriptors occupy
the same namespace as other file descriptors.

Reviewed by:	fernape, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39376
2023-04-04 09:29:53 -04:00
Konstantin Belousov
dac3102488 Rename kqueue1(2) to kqueuex(2) to avoid compat issues with NetBSD
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39377
2023-04-04 16:19:08 +03:00
Konstantin Belousov
650d6cc122 libipsec: ansify
Sponsored by:	Nvidia networking
MFC after:	1 week
2023-04-03 22:48:48 +03:00
Konstantin Belousov
f14ceae498 ipsec_strerror.c: style, drop redundand return
Sponsored by:	Nvidia networking
MFC after:	1 week
2023-04-03 22:48:48 +03:00
Martin Matuska
2a58b312b6 zfs: merge openzfs/zfs@431083f75
Notable upstream pull request merges:
  #12194 Fix short-lived txg caused by autotrim
  #13368 ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced()
  #13392 Implementation of block cloning for ZFS
  #13741 SHA2 reworking and API for iterating over multiple implementations
  #14282 Sync thread should avoid holding the spa config write lock
         when possible
  #14283 txg_sync should handle write errors in ZIL
  #14359 More adaptive ARC eviction
  #14469 Fix NULL pointer dereference in zio_ready()
  #14479 zfs redact fails when dnodesize=auto
  #14496 improve error message of zfs redact
  #14500 Skip memory allocation when compressing holes
  #14501 FreeBSD: don't verify recycled vnode for zfs control directory
  #14502 partially revert PR 14304 (eee9362a7)
  #14509 Fix per-jail zfs.mount_snapshot setting
  #14514 Fix data race between zil_commit() and zil_suspend()
  #14516 System-wide speculative prefetch limit
  #14517 Use rw_tryupgrade() in dmu_bonus_hold_by_dnode()
  #14519 Do not hold spa_config in ZIL while blocked on IO
  #14523 Move dmu_buf_rele() after dsl_dataset_sync_done()
  #14524 Ignore too large stack in case of dsl_deadlist_merge
  #14526 Use .section .rodata instead of .rodata on FreeBSD
  #14528 ICP: AES-GCM: Refactor gcm_clear_ctx()
  #14529 ICP: AES-GCM: Unify gcm_init_ctx() and gmac_init_ctx()
  #14532 Handle unexpected errors in zil_lwb_commit() without ASSERT()
  #14544 icp: Prevent compilers from optimizing away memset()
         in gcm_clear_ctx()
  #14546 Revert zfeature_active() to static
  #14556 Remove bad kmem_free() oversight from previous zfsdev_state_list
         patch
  #14563 Optimize the is_l2cacheable functions
  #14565 FreeBSD: zfs_znode_alloc: lock the vnode earlier
  #14566 FreeBSD: fix false assert in cache_vop_rmdir when replaying ZIL
  #14567 spl: Add cmn_err_once() to log a message only on the first call
  #14568 Fix incremental receive silently failing for recursive sends
  #14569 Restore ASMABI and other Unify work
  #14576 Fix detection of IBM Power8 machines (ISA 2.07)
  #14577 Better handling for future crypto parameters
  #14600 zcommon: Refactor FPU state handling in fletcher4
  #14603 Fix prefetching of indirect blocks while destroying
  #14633 Fixes in persistent error log
  #14639 FreeBSD: Remove extra arc_reduce_target_size() call
  #14641 Additional limits on hole reporting
  #14649 Drop lying to the compiler in the fletcher4 code
  #14652 panic loop when removing slog device
  #14653 Update vdev state for spare vdev
  #14655 Fix cloning into already dirty dbufs
  #14678 Revert "Do not hold spa_config in ZIL while blocked on IO"

Obtained from:	OpenZFS
OpenZFS commit:	431083f75b
2023-04-03 16:49:30 +02:00
Joseph Mingrone
6f9cba8f8b
libpcap: Update to 1.10.3
Local changes:

- In contrib/libpcap/pcap/bpf.h, do not include pcap/dlt.h.  Our system
  net/dlt.h is pulled in from net/bpf.h.
- sys/net/dlt.h: Incorporate changes from libpcap 1.10.3.
- lib/libpcap/Makefile: Update for libpcap 1.10.3.

Changelog:	https://git.tcpdump.org/libpcap/blob/95691ebe7564afa3faa5c6ba0dbd17e351be455a:/CHANGES
Reviewed by:	emaste
Obtained from:	https://www.tcpdump.org/release/libpcap-1.10.3.tar.gz
Sponsored by:	The FreeBSD Foundation
2023-03-31 16:02:22 -03:00
Ed Maste
d860991a72 kqueue: tidy up indentation in man page example
Fixes: e07b0c12ba ("[patch][doc] Fix EXAMPLE in kqueue(2)")
Sponsored by:	The FreeBSD Foundation
2023-03-31 14:48:39 -04:00
Kristof Provost
28921c4f7d carp: allow commands to use interface name rather than index
Get/set commands can now choose to provide the interface name rather
than the interface index. This allows userspace to avoid a call to
if_nametoindex().

Suggested by:	melifaro
Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39359
2023-03-31 11:29:58 +02:00
Mark Johnston
615bf03e33 cap_dns tests: Convert to ATF, avoid failing when lookups don't resolve
The cap_dns tests require Internet access.  Currently they fail when
that's not available, which for CI purposes is undesirable.  Let's
instead skip the tests if none of the non-casper name/addr lookups
succeed.

To that end:
- Convert the tests to ATF so that skipping is easier to implement.
- Break up the tests into separate test cases.
- If one of the system (i.e., non-casper) lookup functions fails, skip
  the test if all of them failed, otherwise fail the tests, since
  partial failure indicates something is flaky and deserves a closer
  look.

Reviewed by:	oshogbo
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39241
2023-03-30 19:36:00 -04:00
Mark Johnston
5d96ca7a30 cap_sysctl tests: Serialize
These tests fail spuriously when run in parallel, since some of them
write a value to a global sysctl, read it back, and expect to see the
written value.  These tests complete quite quickly in any case.

MFC after:	1 week
2023-03-30 19:35:59 -04:00
Ed Maste
30da840c62 memmem: add a note about other systems which have memmem
memmem started as a GNU extension but is now widely available.

Reviewed by:	mhorne (slightly earlier version)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39337
2023-03-30 12:14:26 -04:00
Hans Petter Selasky
4c6bcffd04 libusb(3): Implement libusb_init_context() and the needed structures and definitions.
Differential Revision:	https://reviews.freebsd.org/D38212
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-03-30 17:26:55 +02:00
John Baldwin
eeedaefab5 Remove LLVM build glue for MIPS as a native architecture.
This does not remove LLVM_TARGET_MIPS.  Note that the only
MACHINE_ARCH values ending in 'hf' were all MIPS architectures, hence
removing the pattern matches for 'hf'.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39331
2023-03-29 15:06:15 -07:00
John Baldwin
f40b617e15 libarchive: Remove MIPS build glue.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39329
2023-03-29 15:05:53 -07:00
John Baldwin
1ab9996fb5 libcompiler_rt/libgcc_s: Remove MIPS build glue.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39328
2023-03-29 15:05:42 -07:00
John Baldwin
7d8e1e8dd9 libcasper: Move helper libraries from /lib/casper to /lib.
These libraries are linked to directly by applications rather than
opened at runtime via dlopen().

Discussed with:	oshogbo
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D39245
2023-03-29 15:04:28 -07:00
Dimitry Andric
4dc3b1fa1b Revert "Ensure .inc files are regenerated when llvm/clang tblgen binaries change"
This reverts commit ab80f0b21f. The intent
of this change was to avoid possible compilation errors when certain
.inc files were not regenerated, but the method turns out to cause way
more rebuilds than anticipated. Another method will have to be found,
and in the mean time, WITH_CLEAN is the solution that always works.

Fixes:		ab80f0b21f
2023-03-29 20:37:02 +02:00
Dimitry Andric
d8ed7fa3d5 Revert "Rework {clang,lldb,llvm}-tblgen invocations to add --write-if-changed"
This reverts commit 8f391d9098. There are
still a bunch of problems, and apparently ${.ALLSRC} does not work as I
expected.

Fixes:          8f391d9098
2023-03-29 20:31:33 +02:00
Dimitry Andric
8f391d9098 Rework {clang,lldb,llvm}-tblgen invocations to add --write-if-changed
This flag ensures that the tblgen tools do not actually touch the
produced .inc file, if there are no changes to the contents. In turn,
this may prevent a number of rebuilds of files that include such .inc
files, saving build time.

While here, ensure that the shell invocations to locate the used tblgen
binary do not show unnecessary error messages.

Reported by:	des
MFC after:	1 week
2023-03-29 19:49:49 +02:00
John Baldwin
96241a568e libproc: Trim a MIPS leftover.
Fixes:	101ba46bb6 libproc: retire now-unused MIPS support
2023-03-29 10:34:32 -07:00
Stefan Eßer
9d33a9d96f Fix typo in statfs man page
There are FAT12 and FAT16 file systems, but FAT13 of was an
unintentional invention of mine ...

Reported by:	Ravi Pokala <rpokala@freebsd.org>
MFC after:	1 month
2023-03-29 10:11:19 +02:00
Stefan Eßer
c33db74b53 fs/msdosfs: add tracking of free root directory entries
This update implements tallying of free directory entries during
create, delete,	or rename operations on FAT12 and FAT16 file systems.

Prior to this change, the total number of root directory entries
was reported as number of inodes, but 0 as the number of free
inodes, causing system health monitoring software to warn about
a suspected disk full issue.

The FAT12 and FAT16 file systems provide a limited number of
root directory entries, e.g. 512 on typical hard disk formats.
The valid range of values is 1 to 65535, but the msdosfs code
will effectively round up "odd" values to the next multiple of 16
(e.g. 513 would allow for 528 root directory entries).

This update implements tracking of directory entries during create,
delete, or rename operations, with initial values determined by
scanning the directory when the file system is mounted.

Total and free directory entries are reported in the f_files and
f_ffree elements of struct statfs, despite differences in semantics
of these values:

- There is no limit on the number of files and directories that can
  be created on a FAT file system. Only the root directory of FAT12
  and FAT16 file systems is limited, any number of files can still be
  created in sub-directories, even when 0 free "inodes" are reported.

- A single file can require 1 to 21 directory entries, depending on
  the character set, structure, and length of the name. The DOS 8.3
  style file name takes up 1 entry, and if the name does not comply
  with the syntax of a DOS 8.3 file name, 1 additional entry is used
  for each 13 characters of the file name. Since all these entries
  have to be contiguous, it is possible that a file or directory with
  a long name can not be created, despite a sufficient total number of
  free directory entries.

- Renaming a file can require more directory entries than currently
  allocated to store its long name, which may prevent an in-place
  update of the name if more entries are needed. This may cause a
  rename operation to fail if no contiguous range of free entries for
  the new name can be found.

- The volume label is stored in a directory entry. An empty FAT file
  system with a volume label will therefore show 1 used "inode" in
  df.

- The perceentage of free inodes shown in df or monitoring tools does
  only represent the state of the root directory of a FAT12 or FAT16
  file system. Neither does a reported value of 0% free inodes does
  prevent files from being created in sub-directories, nor does a
  value of 50% free inodes guarantee that even a single file with
  a "long" name can be created in the root directory (if every other
  directory entry is occupied and there are no 2 contiguous entries).

The statfs(2) and df(1) man pages have been updated with a notice
regarding the possibly different semantics of values reported as
total and free inodes for non-Unix file systems.

PR:		270053
Reported by:	Ben Woods <woodsb02@freebsd.org>
Approved by:	mckusick
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D38987
2023-03-29 08:46:01 +02:00
Yuri Pankov
269dea90d6 libc: use separate collate objects for C, POSIX, and C.UTF-8
Fix newlocale() overwriting the locale name in collate object
when same instance was used for those locales, and querylocale()
reporting unexpected value for LC_COLLATE_MASK.

PR:		255646, 269375
Reviewed by:	markj, bapt (previous version)
Differential Revision:	https://reviews.freebsd.org/D30146
2023-03-28 17:16:30 +02:00
Konstantin Belousov
f2ec444be5 kqueue1(2): document
Reviewed by:	emaste, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39271
2023-03-28 02:39:26 +03:00
Konstantin Belousov
375732cc6e kqueue1(2): export the symbol from libc
Reviewed by:	emaste, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39271
2023-03-28 02:39:26 +03:00
Ruslan Bukin
27c8d4851c Include Embedded Trace Extensions (ETE) source code to the OpenCSD build.
Sponsored by:	UKRI
2023-03-27 17:10:26 +01:00
Mark Johnston
68ca8363c7 libc: Use secure_getenv(3) where appropriate
No functional change intended.

Reviewed by:	mjg, imp, kib
Differential Revision:	https://reviews.freebsd.org/D39278
2023-03-27 08:56:22 -04:00
Tino Reichardt
80f2cdcd67 Add more ANSI colors to libzfs
Reviewed-by: WHR <msl0000023508@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ethan Coe-Renner <coerenner1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes #14621
2023-03-24 10:21:19 -07:00
Warner Losh
d5df268584 secure_getenv: Improve documentation wording
Improve the documentation wording to be more consistent with FreeBSD
manual pages.

Suggested by:		mjg (though reworded)
Sponsored by:		Netflix
2023-03-25 11:06:13 -06:00
Warner Losh
72f501d07a secure_getenv: Add () around return values
Style only change, no functional change intended.

Sponsored by:		Netflix
2023-03-25 11:06:13 -06:00
John Baldwin
0f735657aa bhyve: Remove vmctx member from struct vm_snapshot_meta.
This is a userland-only pointer that isn't relevant to the kernel and
doesn't belong in the ioctl structure shared between userland and the
kernel.  For the kernel, the old structure for the ioctl is still
supported under COMPAT_FREEBSD13.

This changes vm_snapshot_req() in libvmmapi to accept an explicit
vmctx argument.

It also changes vm_snapshot_guest2host_addr to take an explicit vmctx
argument.  As part of this change, move the declaration for this
function and its wrapper macro from vmm_snapshot.h to snapshot.h as it
is a userland-only API.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D38125
2023-03-24 11:49:06 -07:00
John Baldwin
7d9ef309bd libvmmapi: Add a struct vcpu and use it in most APIs.
This replaces the 'struct vm, int vcpuid' tuple passed to most API
calls and is similar to the changes recently made in vmm(4) in the
kernel.

struct vcpu is an opaque type managed by libvmmapi.  For now it stores
a pointer to the VM context and an integer id.

As an immediate effect this removes the divergence between the kernel
and userland for the instruction emulation code introduced by the
recent vmm(4) changes.

Since this is a major change to the vmmapi API, bump VMMAPI_VERSION to
0x200 (2.0) and the shared library major version.

While here (and since the major version is bumped), remove unused
vcpu argument from vm_setup_pptdev_msi*().

Add new functions vm_suspend_all_cpus() and vm_resume_all_cpus() for
use by the debug server.  The underyling ioctl (which uses a vcpuid of
-1) remains unchanged, but the userlevel API now uses separate
functions for global CPU suspend/resume.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D38124
2023-03-24 11:49:06 -07:00
John Baldwin
c6b3f47fed libpmc: Use LIB_CXX instead of explicit LDADD to link a C++ library.
This uses the C++ compiler as the linker instead of the C compiler
letting the compiler driver pick the right libraries.  This is a no-op
on main and stable/13 but matters for stable/12 where the current
logic breaks for external GCC since it tries to use a non-existent
libstdc++.

Reviewed by:	emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39197
2023-03-23 09:31:58 -07:00
John Baldwin
48c519be0e libpfctl: Don't pass stack garbage to free.
GCC 9 on stable/12 reports a -Wmaybe-uninitialized error for the call
to free in _pfctl_clear_states.

Reviewed by:	mjg
Differential Revision:	https://reviews.freebsd.org/D39198
2023-03-22 12:33:59 -07:00
Val Packett
f9c7fb7cae arpa: garbage collect ns_newmsg/ns_rdata decls
These were brought in by the libbind import, but these functions were
never actually implemented anywhere, only header declarations and symbol
map entries were imported.

Fixes: 046c3635cd ("Bring final version of libbind:")
Fixes: e45764721a ("Update our stub resolver to final version of ...")
Reported by:	ld.lld 16 being --no-undefined-version by default
Sponsored by:	https://www.patreon.com/valpackett
Reviewed by:	emaste
Pull request:	https://github.com/freebsd/freebsd-src/pull/700
Differential Revision: https://reviews.freebsd.org/D38407
2023-03-22 14:58:23 -04:00
Mitchell Horne
d55c187738 kern_reboot(9): some updates
- This function no longer disables interrupts
 - MLINK to reboot.9
 - The mentions of autoconfiguration is more about shutdown_nice(),
   coming in the next commit.
 - Describe the RB_* flags relevant to this function
 - Describe behaviour when shutdown hooks fail the reset
 - Describe expected execution contexts
 - Add FF copyright
 - xref panic(9)
 - xref this page in reboot(2)

Reviewed by:	markj
Discussed with:	rpokala, Pau Amma <pauamma@gundo.com>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39133
2023-03-20 17:12:12 -03:00
Kristof Provost
137818006d carp: support unicast
Allow users to configure the address to send carp messages to. This
allows carp to be used in unicast mode, which is useful in certain
virtual configurations (e.g. AWS, VMWare ESXi, ...)

Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D38940
2023-03-20 14:37:09 +01:00
Kristof Provost
40e0435964 carp: add netlink interface
Allow carp configuration information to be supplied and retrieved via
netlink.

Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39048
2023-03-20 10:52:27 +01:00
Xin LI
c917796c04 MFV: xz 5.4.2.
MFC after:	2 weeks
2023-03-19 19:30:08 -07:00
Mateusz Guzik
62a573d953 vfs: retire KERN_VNODE
It got disabled in 2003:

commit acb18acfec
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date:   Sun Feb 23 18:09:05 2003 +0000

    Bracket the kern.vnode sysctl in #ifdef notyet because it results
    in massive locking issues on diskless systems.

    It is also not clear that this sysctl is non-dangerous in its
    requirements for locked down memory on large RAM systems.

There does not seem to be practical use for it and the disabled routine
does not work anyway.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D39127
2023-03-17 16:21:45 +00:00
Mateusz Guzik
58436df347 libipsec: ansify
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-16 19:19:35 +00:00