]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
10 months agotime.h: Fix visibility check for C11 and C23 features.
Dag-Erling Smørgrav [Wed, 6 Sep 2023 01:37:43 +0000 (03:37 +0200)]
time.h: Fix visibility check for C11 and C23 features.

__BSD_VISIBLE is always defined; we need to check if it's true.

Fixes: d02489d11aed 9b5d724cad10
MFC after: 3 days
Reviewed by: brooks, imp
Differential Revision: https://reviews.freebsd.org/D41733

10 months agotimerfd: Relocate 32-bit compat code
Jake Freeland [Tue, 5 Sep 2023 22:13:23 +0000 (16:13 -0600)]
timerfd: Relocate 32-bit compat code

32-bit compatibility code is conventionally stored in
sys/compat/freebsd32. Move freebsd32_timerfd_gettime() and
freebsd32_timerfd_settime() from sys/kern/sys_timerfd.c to
sys/compat/freebsd32/freebsd32_misc.c.

MFC After: 3 days
Reviewed by: imp, markj
Differential Revision; https://reviews.freebsd.org/D41640

10 months agotimerfd: Namespace pollution adjustments
Jake Freeland [Tue, 5 Sep 2023 22:11:50 +0000 (16:11 -0600)]
timerfd: Namespace pollution adjustments

    Do not pollute userspace with <sys/proc.h>, instead declare struct thread
    when _KERNEL is defined.

    Include <sys/time.h> instead of <sys/timespec.h>. This causes intentional
    namespace pollution that mimics Linux. g/musl libcs include <time.h> in
    their <sys/timerfd.h>, exposing clock gettime, settime functions and
    CLOCK_ macro constants. Ports like Chromium expect this namespace
    pollution and fail without it.

MFC After: 3 days
Reviewed by: imp, markj
Differential Revision: https://reviews.freebsd.org/D41641

10 months agotimerfd: Define a locking regime
Jake Freeland [Tue, 5 Sep 2023 22:10:44 +0000 (16:10 -0600)]
timerfd: Define a locking regime

    Define a locking regime for the members of struct timerfd and document
    it so future code can follow the standard. The lock legend can be found
    in a comment above struct timerfd.

    Additionally,
    * Add assertions based on locking regime.
    * Fill kn_data with the expiration count when EVFILT_READ is triggered.
    * Report st_ctim for stat(2).
    * Check if file has f_type == DTYPE_TIMERFD before assigning timerfd
      pointer to f_data.

MFC After: 3 days
Reviewed by: imp, kib, markj
Differential Revision: https://reviews.freebsd.org/D41600

10 months agocxgbe(4): Avoid hang on kldunload on netlink enabled kernels.
Navdeep Parhar [Tue, 5 Sep 2023 18:21:03 +0000 (11:21 -0700)]
cxgbe(4): Avoid hang on kldunload on netlink enabled kernels.

netlink(4) calls back into the driver during detach and it attempts to
start an internal synchronized op recursively, causing an interruptible
hang.  Fix it by failing the ioctl if the VI has been marked as DOOMED
by cxgbe_detach.

Here's the stack for the hang for reference.
 #6  begin_synchronized_op
 #7  cxgbe_media_status
 #8  ifmedia_ioctl
 #9  cxgbe_ioctl
 #10 if_ioctl
 #11 get_operstate_ether
 #12 get_operstate
 #13 dump_iface
 #14 rtnl_handle_ifevent
 #15 rtnl_handle_ifnet_event
 #16 rt_ifmsg
 #17 if_unroute
 #18 if_down
 #19 if_detach_internal
 #20 if_detach
 #21 ether_ifdetach
 #22 cxgbe_vi_detach
 #23 cxgbe_detach
 #24 DEVICE_DETACH

MFC after: 3 days
Sponsored by: Chelsio Communications

10 months agomsun: LIBCSRCDIR is too fragile, use ${SRCTOP}/lib/libc instead
Warner Losh [Tue, 5 Sep 2023 20:58:06 +0000 (14:58 -0600)]
msun: LIBCSRCDIR is too fragile, use ${SRCTOP}/lib/libc instead

LIBCSRCDIR is defined in bsd.libnames.mk, which is read in later in the
Makefile than the line:

.if exists(${LIBCSRCDIR}/${MACHINE_ARCH})

so we test to see if /${MARCHIN_ARCH} exists which it usually doesn't
(but did for me since I mounted 13.2R SD image there).  Move to defining
our own LIBC_SRCTOP in terms of SRCTOP to treat these uniformily.

Sponsored by: Netflix
Reviewed by: sjg
Differential Revision: https://reviews.freebsd.org/D41661

10 months agoiwlwifi/LinuxKPI: 802.11: update ieee80211_request_smps()
Bjoern A. Zeeb [Tue, 5 Sep 2023 18:02:02 +0000 (18:02 +0000)]
iwlwifi/LinuxKPI: 802.11: update ieee80211_request_smps()

Update ieee80211_request_smps() to the new number of arguments in
LinuxKPI (which was already prepared) and update the one call in the
older iwlwifi driver version.
This will allow iwlwifi as-is now and rtw88 to compile in case someone
else wants to work on the latter in parallel to predominant efforts on
the former.

Sponsored by: The FreeBSD Foundation
MFC after: 20 days

10 months agortw88: update driver from upstream
Bjoern A. Zeeb [Tue, 16 May 2023 23:19:34 +0000 (23:19 +0000)]
rtw88: update driver from upstream

This is a combined version of updates of the rtw88 driver based
on wireless-testing
(wt-2023-05-11) 711dca0ca3d77414f8f346e564e9c8640147f40d (after v6.4-rc1),
(wt-2023-06-09) 7bd20e011626ccc3ad53e57873452b1716fcfaaa (after v6.4-rc5),
(wt-2023-07-24) 62e409149b62a285e89018e49b2e115757fb9022 (after v6.5-rc3),
(wt-2023-08-06) 2a220a15be657a24868368892e3e2caba2115283 (after v6.5-rc4).

This update follows other currently disconnected LinuxKPI based wireless
drivers to lift them all to a same version in case someone else wants to
work on this driver in parallel to predominant iwlwifi efforts.

MFC after: 20 days

10 months agortw88: temporary disconnect from build
Bjoern A. Zeeb [Tue, 5 Sep 2023 17:34:35 +0000 (17:34 +0000)]
rtw88: temporary disconnect from build

As announced on freebsd-wireless [1] disconnect rtw88 from the build.
Add a note to the man page about the current state but leave the man
page in place for now as this is supposed to be temporary.

[1] https://lists.freebsd.org/archives/freebsd-wireless/2023-September/001377.html

MFC after: 20 days
X-MFC: will see about 14/13

10 months agortw88/rtw89: remove local firmware.
Bjoern A. Zeeb [Thu, 8 Jun 2023 21:35:09 +0000 (21:35 +0000)]
rtw88/rtw89: remove local firmware.

Remove firmware from src/ in favor of the ports/packages and fwget(8).
This will allow us to shrink the size of src (and installed modules).
Update the rtw88 man page to reflect the change.

MFC after: 20 days
X-MFC: will see about 14/13

10 months agortw88: detach firmware from build
Bjoern A. Zeeb [Thu, 8 Jun 2023 21:24:44 +0000 (21:24 +0000)]
rtw88: detach firmware from build

Firmware is kept in ports now and fwget will find the right one to
install.

MFC after: 20 days
X-MFC: will see about 14/13

10 months agojail.conf(5): Fix and expand description of ".include".
Jamie Gritton [Tue, 5 Sep 2023 20:35:54 +0000 (13:35 -0700)]
jail.conf(5): Fix and expand description of ".include".

Escape a period that caused a line not to be includesd.  Also mention
that glob(3) patterns may be included, and a consequence of that.

PR: 273561
Reported by: crest@rlwinm.de
Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41723

10 months agolocaledef: add newlines to error messages
Kyle Evans [Sat, 2 Sep 2023 06:24:34 +0000 (01:24 -0500)]
localedef: add newlines to error messages

These won't be added elsewhere, so add a little bit of room to make
these messages a little easier to read.  The existing set is a mixed
bag, there are somewhere in the ballpark of 45, 46 printfs to stderr and
19 of those had newlines.

Reviewed by: yuripv
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D41693

10 months agolocaledef: expand the default charmap
Kyle Evans [Sat, 2 Sep 2023 06:13:02 +0000 (01:13 -0500)]
localedef: expand the default charmap

POSIX defines a number of other control characters as well as
alternative aliases for some that should be provided in the default set,
so let's go ahead and add those.

Reviewed by: bapt, yuripv
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D41692

10 months agolinux(4): Validate exec_setregs on arm64
Dmitry Chagin [Tue, 5 Sep 2023 18:19:08 +0000 (21:19 +0300)]
linux(4): Validate exec_setregs on arm64

The lr register is cleared at the beginning of the _dl_start and _start,
so there is no need to initialize it.
Gnu libc _start takes an rtld_fini pointer in x0 which is set by ld.so
for __libc_start_main, the kernel does not register any atexit pointers.

While here fix whitespaces.

MFC after: 1 week

10 months agolinux(4): Deduplicate mmap2
Dmitry Chagin [Tue, 5 Sep 2023 18:16:39 +0000 (21:16 +0300)]
linux(4): Deduplicate mmap2

To help porting the Linux emulation layer to a new platforms start using
Linux names for conditional builds instead of architecture-specific ifdefs.

MFC after: 1 week

10 months agolinux(4): Deduplicate mprotect, madvise
Dmitry Chagin [Tue, 5 Sep 2023 18:15:52 +0000 (21:15 +0300)]
linux(4): Deduplicate mprotect, madvise

MFC after: 1 week

10 months agokthread_add(): do not allow to attach the thread to a dead or dying process
Konstantin Belousov [Tue, 5 Sep 2023 10:54:36 +0000 (13:54 +0300)]
kthread_add(): do not allow to attach the thread to a dead or dying process

Reported by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

10 months agoriscv: Don't print zero offsets for register addresses
John Baldwin [Tue, 5 Sep 2023 16:12:27 +0000 (09:12 -0700)]
riscv: Don't print zero offsets for register addresses

This matches the behavior of db_printsym.

Reviewed by: mhorne, markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41702

10 months agoObsoleteFiles.inc: Add libclang_rt libraries for riscv64 for LLVM 14/15.
John Baldwin [Tue, 5 Sep 2023 16:12:12 +0000 (09:12 -0700)]
ObsoleteFiles.inc: Add libclang_rt libraries for riscv64 for LLVM 14/15.

Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D41701

10 months agoriscv: Save gp in the trapframe in both modes
John Baldwin [Tue, 5 Sep 2023 16:04:54 +0000 (09:04 -0700)]
riscv: Save gp in the trapframe in both modes

Similar to d95fbf4e1a12565908b04b442263fe60c9e890b4, always save gp in
the trapframe even though it is only restored when returning to user
mode.  This is mostly a debugging aid so that dump_regs() doesn't
print out random stack garbage as the value of gp for kernel faults
(e.g. sysctl debug.kdb.trap=1) as well as keeping kgdb's trapframe
unwinder from reporting bogus values of $gp for lower frames.

Reviewed by: mhorne, jrtc27, markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41699

10 months agovirtio_random: Pipeline fetching the data
John-Mark Gurney [Tue, 5 Sep 2023 15:59:43 +0000 (08:59 -0700)]
virtio_random: Pipeline fetching the data

Queue an initial fetch of data during attach and after every read
rather than synchronously fetching data and polling for completion.

If data has not been returned from an previous fetch during read,
just return EAGAIN rather than blocking.

Co-authored-by: John Baldwin <jhb@FreeBSD.org>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41656

10 months agogetdirentries.2: Reference dir(5)
Mateusz Piotrowski [Tue, 5 Sep 2023 13:48:57 +0000 (15:48 +0200)]
getdirentries.2: Reference dir(5)

As a note, parts of manual pages getdirentries(2) and dir(5) should
probably be consolidated.

MFC after: 3 days

10 months agogetdirentries.2: Improve readability of dirent members
Mateusz Piotrowski [Tue, 5 Sep 2023 13:41:47 +0000 (15:41 +0200)]
getdirentries.2: Improve readability of dirent members

MFC after: 3 days

10 months ago*/string.3,arch.7,environ.7: add cross-references to simd(7)
Robert Clausecker [Sat, 2 Sep 2023 14:27:23 +0000 (14:27 +0000)]
*/string.3,arch.7,environ.7: add cross-references to simd(7)

With the new simd-dispatch framework documented in simd(7),
add cross-references to the new man pages to appropriate places.

Sponsored by: The FreeBSD Foundation
Approved by: emaste
MFC to: stable/14
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41697

10 months agoextattr.9: Improve the fragment about jail(8)
Mateusz Piotrowski [Tue, 5 Sep 2023 09:59:35 +0000 (11:59 +0200)]
extattr.9: Improve the fragment about jail(8)

Fixes: 315d7bbbb4e4 extattr(9): Mention system namespace restrictions
MFC after: 1 week

10 months agogetdirentries.2: Reference directory(3)
Mateusz Piotrowski [Tue, 5 Sep 2023 09:37:14 +0000 (11:37 +0200)]
getdirentries.2: Reference directory(3)

MFC after: 3 days

10 months agolinux(4): Convert flags in timerfd_create
Vico Chen [Tue, 5 Sep 2023 08:53:02 +0000 (11:53 +0300)]
linux(4): Convert flags in timerfd_create

The timerfd is introduced in FreeBSD 14, and the Linux ABI timerfd is
also moved to FreeBSD native timerfd, but it can't work well as Linux
TFD_CLOEXEC and TFD_NONBLOCK haven't been converted to FreeBSD
TFD_CLOEXEC and TFD_NONBLOCK.

Reviewed by: dchagin, jfree
Differential revision: https://reviews.freebsd.org/D41708
MFC after: 1 week

10 months agolinux(4): Return ENOTSUP from listxattr instead of EPERM
Dmitry Chagin [Tue, 5 Sep 2023 08:52:27 +0000 (11:52 +0300)]
linux(4): Return ENOTSUP from listxattr instead of EPERM

FreeBSD does not permits manipulating extended attributes in the system
namespace by unprivileged accounts, even if account has appropriate
privileges to access filesystem object.
In Linux the system namespace is used to preserve posix acls. Some Gnu
coreutils binaries uses posix acls, eg, install, ls, cp.  And fails if
we unexpectedly return EPERM error from xattr system calls.

In the other hands, in Linux read and write access to the system
namespace depend on the policy implemented for each filesystem, so we'll
mimics we're a filesystem that prohibits this for unpriveleged accounts.

Reported by: zirias
Tested by: zirias
MFC after: 1 week

10 months agolinux(4): Fix listxattr for the case when the size is 0
Dmitry Chagin [Tue, 5 Sep 2023 08:51:46 +0000 (11:51 +0300)]
linux(4): Fix listxattr for the case when the size is 0

If size is specified as zero, these calls return the current size
of the list of extended attribute names (and leave list unchanged).

Tested by: zirias
MFC after: 1 week

10 months agoMFV: zlib: examples: define functions as static ones. (PR #855)
Xin LI [Tue, 5 Sep 2023 03:14:31 +0000 (20:14 -0700)]
MFV: zlib: examples: define functions as static ones. (PR #855)

MFC after: 3 days

10 months agoexamples: define functions as static ones.
Xin LI [Sun, 3 Sep 2023 20:10:10 +0000 (13:10 -0700)]
examples: define functions as static ones.

This fixes warnings when building with -Wmissing-prototypes.

Upstreamed at https://github.com/madler/zlib/pull/855 .

10 months agostand: lua: module names should permit more
Kyle Evans [Tue, 5 Sep 2023 02:21:34 +0000 (21:21 -0500)]
stand: lua: module names should permit more

The module entries should generally allow whatever is allowed as an
env_var in the pattern table.  Notably, we're missing periods which
would allow proper entries for .dtb files in loader.conf that don't need
to specify a module_name entry for it.

%d in this expression is actually redundant as %w is actually
"all alphanumerics," but I've included it for now to match the env_var
entry.  We should really remove it from both.

Reported by: "aribi" on the forums via allanjude@
MFC after: 1 week

10 months agoif_vlan: Always default to 802.1q.
Dag-Erling Smørgrav [Mon, 4 Sep 2023 23:26:07 +0000 (23:26 +0000)]
if_vlan: Always default to 802.1q.

There is no reason for this fallback to be conditional on COMPAT_FREEBSD12.

PR: 273539
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: melifaro, allanjude
Differential Revision: https://reviews.freebsd.org/D41717

10 months agouefi(8): Refer to a related manual page
Tom Hukins [Thu, 31 Aug 2023 09:21:40 +0000 (10:21 +0100)]
uefi(8): Refer to a related manual page

PR: 265834
Reviewed by: mhorne
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39577

10 months agomana: fix tso parameters and set hwassist bits
Wei Hu [Mon, 4 Sep 2023 14:53:10 +0000 (14:53 +0000)]
mana: fix tso parameters and set hwassist bits

The parameters for tso on mana were not set correctly. Also the
hwassist bits were not set. These two cause tso on mana not work.
Fixed the issues and make tso working on mana.

Tested by: whu
MFC after: 3 days
Sponsored by: Microsoft

10 months agoahci: add AMD device id in RAID mode
Andrey V. Elsukov [Mon, 4 Sep 2023 12:33:49 +0000 (15:33 +0300)]
ahci: add AMD device id in RAID mode

Found on Asus ROX Strix X570-F Gaming.

MFC after: 1 week

10 months agoHyper-V: hn: use VF's capabilities when it is attached
Wei Hu [Mon, 4 Sep 2023 10:15:06 +0000 (10:15 +0000)]
Hyper-V: hn: use VF's capabilities when it is attached

Current code in hn/netvsc tries to merge  (logical AND) VF and
its own capability bits when a VF is attached. This results in
losing some key VF features, especially in tx path. For example,
the VF's txcsum, rxcsum or tso bits could be lost if any of
these are not in hn/netvsc's own capablility field.

Actually when VF is attached, hn just needs to use VF's caps
as all the tx packets would be forwarded to the VF interface.
Fix this problem by doing so.

Reported by: whu
Tested by: whu
MFC after: 3 days
Sponsored by: Microsoft

10 months agocommitters-doc.dot: move grahamperrin to alumni
Graham Perrin [Sat, 26 Aug 2023 02:47:46 +0000 (03:47 +0100)]
committers-doc.dot: move grahamperrin to alumni

Pull Request: https://github.com/freebsd/freebsd-src/pull/828

10 months agoarcmsr(4): Fix typo: rebulid -> rebuild
Mustafa Ateş Uzun [Thu, 17 Aug 2023 13:45:14 +0000 (16:45 +0300)]
arcmsr(4): Fix typo: rebulid -> rebuild

MFC after: 3 days
Pull Request: https://github.com/freebsd/freebsd-src/pull/819

10 months agoMerge commit 4bb2416d42eb from llvm-project (by Jessica Clarke):
Jessica Clarke [Mon, 4 Sep 2023 08:33:27 +0000 (09:33 +0100)]
Merge commit 4bb2416d42eb from llvm-project (by Jessica Clarke):

  [builtins][AArch64] Implement _sync out-of-line atomics

  Whilst Clang does not use these, recent GCC does, and so on systems such
  as FreeBSD that wish to use compiler-rt as the system runtime library
  but also wish to support building programs with GCC these interfaces are
  needed.

  This is a light adaptation of the code committed to GCC by Sebastian Pop
  <spop@amazon.com>, relicensed with permission for use in compiler-rt.

  Fixes https://github.com/llvm/llvm-project/issues/63483

  Reviewed By: sebpop, MaskRay

  Differential Revision: https://reviews.llvm.org/D158536

Reviewed by: dim
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41716

10 months agopmc: better distinguish pmu-events allocation path
Mitchell Horne [Tue, 6 Jun 2023 17:26:46 +0000 (14:26 -0300)]
pmc: better distinguish pmu-events allocation path

Background:

The pm_ev field of struct pmc_op_pmcallocate and struct pmc
traditionally contains the index of the chosen event, corresponding to
the __PMC_EVENTS array in pmc_events.h. This is a static list of events,
maintained by FreeBSD.

In the usual case, libpmc translates the user supplied event name
(string) into the pm_ev index, which is passed as an argument to the
allocation syscall. On the kernel side, the allocation method for the
relevant hwpmc class translates the given index into the event code that
will be written to an event selection register.

In 2018, a new source of performance event definitions was introduced:
the pmu-events json files, which are maintained by the Linux kernel. The
result was better coverage for newer Intel processors with a reduced
maintenance burden for libpmc/hwpmc. Intel and AMD CPUs were
unconditionally switched to allocate events from pmu-events instead of
the traditional scheme (959826ca1bb0a81eb4dcf9e0d).

Under the pmu-events scheme, the pm_ev field contains an index
corresponding to the selected event from the pmu-events table, something
which the kernel has no knowledge of. The configuration for the
performance counting registers is instead passed via class-dependent
fields (struct pmc_md_op_pmcallocate).

In 2021 I changed the allocation logic so that it would attempt to
pull from the pmu-events table first, and fall-back to the traditional
method (dfb4fb41166bc3). Later, pmu-events support for arm64 and power8
CPUs was added (28dd6730a5d6 and b48a2770d48b).

The problem that remains is that the pm_ev field is overloaded, without
a definitive way to determine whether the event allocation came from the
pmu-events table or FreeBSD's statically-defined PMC events. This
resulted in a recent fix, 21f7397a61f7.

Change:

To disambiguate these two supported but separate use-cases, add a new
flag, PMC_F_EV_PMU, to be set as part of the allocation, indicating that
the event index came from pmu-events.

This is useful in two ways:
 1. On the kernel side, we can validate the syscall arguments better.
    Some classes support only the traditional event scheme (e.g.
    hwpmc_armv7), while others support only the pmu-events method (e.g.
    hwpmc_core for Intel). We can now check for this. The hwpmc_arm64
    class supports both methods, so the new flag supersedes the existing
    MD flag, PM_MD_EVENT_RAW.

 2. The flag will be tracked in struct pmc for the duration of its
    lifetime, meaning it is communicated back to userspace. This allows
    libpmc to perform the reverse index-to-event-name translation
    without speculating about the meaning of the index value.

Adding the flag is a backwards-incompatible ABI change. We recently
bumped the major version of the hwpmc module, so this breakage is
acceptable.

Reviewed by: jkoshy
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40753

10 months agolibpmc: make pmc_pmu_pmcallocate() machine-independent
Mitchell Horne [Mon, 19 Jun 2023 22:32:22 +0000 (19:32 -0300)]
libpmc: make pmc_pmu_pmcallocate() machine-independent

Have it call the platform-dependent version. For better layering, move
the reset logic inside the new function. This is mainly to facilitate an
upcoming change.

Reviewed by: jkoshy
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40752

10 months agokern_kthread: fork1() does not handle locked Giant
Konstantin Belousov [Sat, 2 Sep 2023 07:16:48 +0000 (10:16 +0300)]
kern_kthread: fork1() does not handle locked Giant

fork1() does not behave if called under Giant.  For instance, it might
need to call thread_suspend_check() which explicitly verifies that Giant
is not locked.  On the other hand, the kthread KPI is often called from
SYSINIT() which is still Giant-locked.

Correct this by dropping Giant in kthread_add() and kproc_create().

Reported by: pho
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41694

10 months agokern_kthread.c: some style
Konstantin Belousov [Sat, 2 Sep 2023 07:05:49 +0000 (10:05 +0300)]
kern_kthread.c: some style

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41694

10 months agodtsec(4): Restore IFCAP_JUMBO_MTU lost in IfAPI conversion
Justin Hibbits [Sat, 2 Sep 2023 20:52:30 +0000 (16:52 -0400)]
dtsec(4): Restore IFCAP_JUMBO_MTU lost in IfAPI conversion

Also add IFCAP_VLAN_MTU, since it's supported.

Fixes: 0083fc5c7 ("Mechanically convert dtsec(4) to IfAPI")
MFC after: 1 week

10 months agotcp: Initialize the maximum number of entries in a client cookie cache bucket
Zhenlei Huang [Sat, 2 Sep 2023 20:34:07 +0000 (04:34 +0800)]
tcp: Initialize the maximum number of entries in a client cookie cache bucket

This vnet loader tunable is defined with SYSCTL_PROC, thus will not be
initialized by kernel on vnet creating and will always have the default
value TCP_FASTOPEN_CCACHE_BUCKET_LIMIT_DEFAULT.

Fix by fetching the value from the corresponding kernel environment during
vnet constructing.

PR: 273509
Reviewed by: #transport, tuexen
Fixes: c560df6f12f1 This is an implementation of the client side of TCP Fast Open (TFO) [RFC7413]
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41691

10 months agotests: Skip all tests that require mdconfig when /dev/mdctl missing
Warner Losh [Sat, 2 Sep 2023 19:12:31 +0000 (13:12 -0600)]
tests: Skip all tests that require mdconfig when /dev/mdctl missing

When run in a jail, /dev/mdctl is missing. So skip any tests that use
mdconfig or mdmfs with md in this case: they can't possibly work. This
is in line with other tests that test for presence of required features
and skip if they aren't present. I did this instead of checking for
jails so they can still run in jails that allow creation of md devices.

Sponsored by: Netflix

10 months agovfs cache: fix a hang when bumping vnode limit too high
Mateusz Guzik [Sat, 2 Sep 2023 14:27:33 +0000 (14:27 +0000)]
vfs cache: fix a hang when bumping vnode limit too high

Overflow in cache_changesize would make the value flip to 0 and stay
there as 0 << 1 does not do anything.

Note callers limit the outcome to something below u_int.

Also note there entire vnode handling thing both in vfs layer as a whole
and this file can't decide whether to long, u_long or u_int.

10 months agozfs: merge openzfs/zfs@95f71c019
Martin Matuska [Sat, 2 Sep 2023 10:32:48 +0000 (12:32 +0200)]
zfs: merge openzfs/zfs@95f71c019

Notable upstream pull request merges:
  #15018 Increase limit of redaction list by using spill block
  #15161 Make zoned/jailed zfsprops(7) make more sense
  #15216 Relax error reporting in zpool import and zpool split
  #15218 Selectable block allocators
  #15227 ZIL: Tune some assertions
  #15228 ZIL: Revert zl_lock scope reduction
  #15233 ZIL: Change ZIOs issue order

Obtained from: OpenZFS
OpenZFS commit: 95f71c019d7c3e3b728a9b05e2117ce6b09f1b87

10 months agotimerfd: convert timerfd_list_lock from sx to mtx
Mateusz Guzik [Sat, 2 Sep 2023 09:55:50 +0000 (09:55 +0000)]
timerfd: convert timerfd_list_lock from sx to mtx

There was no good reason to use the former. This should prevent some
head-scratching by an interested and qualified reader.

10 months agolocaledef: correct definition of right-parenthesis in default charmap
Kyle Evans [Sat, 2 Sep 2023 05:56:31 +0000 (00:56 -0500)]
localedef: correct definition of right-parenthesis in default charmap

It turns out that right parentheses do exist and are different than
left parentheses, so let's switch to that.

Sponsored by: Klara, Inc.

10 months agoSelectable block allocators
ednadolski-ix [Sat, 2 Sep 2023 01:00:30 +0000 (19:00 -0600)]
Selectable block allocators

ZFS historically has had several space allocators that were
dynamically selectable.  While these have been retained in
OpenZFS, only a single allocator has been statically compiled
in. This patch compiles all allocators for OpenZFS and provides
a module parameter to allow for manual selection between them.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Edmund Nadolski <edmund.nadolski@ixsystems.com>
Closes #15218

10 months agoRelax error reporting in zpool import and zpool split
Umer Saleem [Sat, 2 Sep 2023 00:25:11 +0000 (05:25 +0500)]
Relax error reporting in zpool import and zpool split

For zpool import and zpool split, zpool_enable_datasets is called
to mount and share all datasets in a pool. If there is an error
while mounting or sharing any dataset in the pool, the status of
import or split is reported as failure. However, the changes do
show up in zpool list.

This commit updates the error reporting in zpool import and zpool
split path. More descriptive messages are shown to user in case
there is an error during mount or share. Errors in mount or share
do not effect the overall status of zpool import and zpool split.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes #15216

10 months agoLinux 6.5 compat: safe cleanup in spl_proc_fini()
Andrea Righi [Sat, 2 Sep 2023 00:21:40 +0000 (02:21 +0200)]
Linux 6.5 compat: safe cleanup in spl_proc_fini()

If we fail to create a proc entry in spl_proc_init() we may end up
calling unregister_sysctl_table() twice: one in the failure path of
spl_proc_init() and another time during spl_proc_fini().

Avoid the double call to unregister_sysctl_table() and while at it
refactor the code a bit to reduce code duplication.

This was accidentally introduced when the spl code was
updated for Linux 6.5 compatibility.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Closes #15234
Closes #15235

10 months agoZIL: Change ZIOs issue order.
Alexander Motin [Sat, 2 Sep 2023 00:14:50 +0000 (20:14 -0400)]
ZIL: Change ZIOs issue order.

In zil_lwb_write_issue(), after issuing lwb_root_zio/lwb_write_zio,
we have no right to access lwb->lwb_child_zio. If it was not there,
the first two ZIOs may have already completed and freed the lwb.
ZIOs issue in opposite order from children to parent should keep
the lwb valid till the end, since the lwb can be freed only after
lwb_root_zio completion callback.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15233

10 months agoZIL: Revert zl_lock scope reduction.
Alexander Motin [Sat, 2 Sep 2023 00:13:52 +0000 (20:13 -0400)]
ZIL: Revert zl_lock scope reduction.

While I have no reports of it, I suspect possible use-after-free
scenario when zil_commit_waiter() tries to dereference zcw_lwb
for lwb already freed by zil_sync(), while zcw_done is not set.
Extension of zl_lock scope as it was originally should block
zil_sync() from freeing the lwb, closing this race.

This reverts #14959 and couple chunks of #14841.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15228

10 months agoZIL: Tune some assertions.
Alexander Motin [Sat, 2 Sep 2023 00:13:22 +0000 (20:13 -0400)]
ZIL: Tune some assertions.

In zil_free_lwb() we should first assert lwb_state or the rest of
assertions can be misleading if it is false.

Add lwb_state assertions in zil_lwb_add_block() to make sure we are
not trying to add elements to lwb_vdev_tree after it was processed.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15227

10 months agoamd64 db_trace: Reject unaligned frame pointers
John Baldwin [Fri, 1 Sep 2023 22:55:05 +0000 (15:55 -0700)]
amd64 db_trace: Reject unaligned frame pointers

Switch to using db_addr_t to hold frame pointer values until they are
verified to be suitably aligned.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D41532

10 months agolibc: Further nit in fopen(3) man page.
Dag-Erling Smørgrav [Fri, 1 Sep 2023 22:53:27 +0000 (22:53 +0000)]
libc: Further nit in fopen(3) man page.

Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D41687

10 months agopci_iov: Refuse to create VFs which require ARI if ARI is not available
John Baldwin [Fri, 1 Sep 2023 21:18:30 +0000 (14:18 -0700)]
pci_iov: Refuse to create VFs which require ARI if ARI is not available

If a parent downstream port doesn't support ARI, the code would try to
create VFs anyway but then all PCI config space access to those VFs
would fail.

Tested by: np
Sponsored by: Chelsio Communications

10 months agoscandir.3: Fix several typos
Trond Endrestøl [Fri, 1 Sep 2023 20:48:16 +0000 (16:48 -0400)]
scandir.3: Fix several typos

PR: 273480
Reviewed by: markj
MFC after: 1 week

10 months agolibc: Fix fmemopen(3) prototype in fopen(3) man page.
Dag-Erling Smørgrav [Fri, 1 Sep 2023 20:56:17 +0000 (20:56 +0000)]
libc: Fix fmemopen(3) prototype in fopen(3) man page.

While here, also update a mention of ANSI C.

Sponsored by: Klara, Inc.
Reviewed by: kevans, markj
Differential Revision: https://reviews.freebsd.org/D41686

10 months agopf: retire pf_krule_to_rule and pf_kpool_to_pool
Mateusz Guzik [Fri, 1 Sep 2023 18:12:41 +0000 (18:12 +0000)]
pf: retire pf_krule_to_rule and pf_kpool_to_pool

Discussed with: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

10 months agosrc.conf.5: regen
Brooks Davis [Fri, 1 Sep 2023 17:23:14 +0000 (18:23 +0100)]
src.conf.5: regen

10 months agoLIBC_MALLOC: description typo fix
Brooks Davis [Fri, 1 Sep 2023 17:19:25 +0000 (18:19 +0100)]
LIBC_MALLOC: description typo fix

Fixes: 09e32b2fddf5f673f76e2fffa415a73d99a6f309
Reported by: jrtc27

10 months agoUPDATING: typo fox
Brooks Davis [Fri, 1 Sep 2023 17:19:06 +0000 (18:19 +0100)]
UPDATING: typo fox

Fixes: 2befa269b869c810b4436b7b5fe922ac3278ee5e
Reported by: jrtc27

10 months agosrc.conf.5: regen
Brooks Davis [Fri, 1 Sep 2023 16:47:11 +0000 (17:47 +0100)]
src.conf.5: regen

10 months agoAdd INIT_ALL build option
Brooks Davis [Fri, 1 Sep 2023 16:42:52 +0000 (17:42 +0100)]
Add INIT_ALL build option

This option replaces WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO with
INIT_ALL=pattern and INIT_ALL=zero respectively.  As these are
relatively rarely used options no backwards compatibility is
implemented.

Reviewed by: emaste
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D41675

10 months agolibc: add LIBC_MALLOC option
Brooks Davis [Fri, 1 Sep 2023 16:42:39 +0000 (17:42 +0100)]
libc: add LIBC_MALLOC option

This will enable alternative mallocs to be included in the tree and
selected by setting LIBC_MALLOC.  As there is only one today (jemalloc)
this option does nothing, but we expect to add other implementations
in the future.  This will also reduce diffs to CheriBSD.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D41660

10 months agoTeach make showconfig about group options
Brooks Davis [Fri, 1 Sep 2023 16:42:27 +0000 (17:42 +0100)]
Teach make showconfig about group options

Output OPT_ variables in addition to MK_ variables.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D41682

10 months agomakeman: add minimal support for group options
Brooks Davis [Fri, 1 Sep 2023 16:41:59 +0000 (17:41 +0100)]
makeman: add minimal support for group options

Ignore OPT_* values in showconfig out in exising code paths and add
a new path to include descriptions for each. For now, hardcode the
description contents rather than attempting to generate it.  This runs
the risk of docs getting out of date, limits the amount of new shell
code added today while a lua rewrite is nearly ready to land.

This change requires a followup commit to enable OPT_* values in
"make showconfig" in order to actually find group options.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D41681

10 months agoshare/mk: support for "single" group options
Brooks Davis [Fri, 1 Sep 2023 16:41:07 +0000 (17:41 +0100)]
share/mk: support for "single" group options

Support group options where 1 of n values will be selected (or a default
value will be used).  After processing, an OPT_FOO will be set to one
value from __FOO_OPTIONS for each FOO in __SINGLE_OPTIONS.  If the user
sets FOO that value will be used, otherwise __FOO_DEFAULT will be used.

Options that don't work an a particular system can be remapped to an
alternative using BROKEN_SINGLE_OPTIONS which can be set to a list of
3-tuples of the form:
OPTION broken_value replacement_value

This is somewhat inspired by OPTIONS_SINGLE from ports, but the
structure is quite different with a per-option variable in the style of
MK_FOO={yes,no}.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41659

10 months agoarmv8_crypto: fix recursive fpu_kern_enter call
Zachary Leaf [Thu, 31 Aug 2023 13:11:53 +0000 (14:11 +0100)]
armv8_crypto: fix recursive fpu_kern_enter call

Now armv8_crypto is using FPU_KERN_NOCTX, this results in a kernel panic
in armv8_crypto.c:armv8_crypto_cipher_setup:

    panic: recursive fpu_kern_enter while in PCB_FP_NOSAVE state

This is because in armv8_crypto.c:armv8_crypto_cipher_process,
directly after calling fpu_kern_enter() a call is made to
armv8_crypto_cipher_setup(), resulting in nested calls to
fpu_kern_enter() without the required fpu_kern_leave() in between.

Move fpu_kern_enter() in armv8_crypto_cipher_process() after the
call to armv8_crypto_cipher_setup() to resolve this.

Reviewed by: markj, andrew
Fixes: 6485286f536f ("armv8_crypto: Switch to using FPU_KERN_NOCTX")
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41671

10 months agogicv3: Add logging for when its_device_alloc fails
Andrew Turner [Wed, 23 Aug 2023 17:44:38 +0000 (18:44 +0100)]
gicv3: Add logging for when its_device_alloc fails

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41566

10 months agogicv3: Support indirect ITS tables
Andrew Turner [Tue, 22 Aug 2023 16:01:21 +0000 (17:01 +0100)]
gicv3: Support indirect ITS tables

The GICv3 ITS device supports two options for device tables. Currently
we support a single table to hold all device IDs, however when the
device ID space grows large this can be too large for the GITS_BASER
register to describe.

To handle this case, and to reduce the memory needed when this space
is sparse support the second option, the indirect table. The indirect
table is a 2 level table where the first level contains the physical
address of the second with a valid bit. The second level is an ITS
page sized table where each entry is the original entry size.

As we don't need to allocate a second level table for devices IDs that
don't exist this can reduce the allocation size.

Reviewed by: gallatin
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41555

10 months agoarm: Add a userspace physical timer check
Andrew Turner [Wed, 23 Aug 2023 12:34:09 +0000 (13:34 +0100)]
arm: Add a userspace physical timer check

We currently use the same Arm generic time in both userspace and the
kernel. As we always enable userspace access to the virtual timer we
can tell userspace to use it.

Reviewed by: imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41565

10 months agojail(8): Fix mandoc warnings
Dmitry Chagin [Fri, 1 Sep 2023 08:13:46 +0000 (11:13 +0300)]
jail(8): Fix mandoc warnings

Reviewed by: gbe
Differential Revision: https://reviews.freebsd.org/D41680
MFC after: 1 week

10 months agoextattr(9): Remove a reference to a non-existent VFS_EXTATTRCTL(9)
Dmitry Chagin [Fri, 1 Sep 2023 08:13:22 +0000 (11:13 +0300)]
extattr(9): Remove a reference to a non-existent VFS_EXTATTRCTL(9)

Reviewed by: gbe
Differential Revision: https://reviews.freebsd.org/D41678
MFC after: 1 week

10 months agoextattr(9): Mention system namespace restrictions in a jail
Dmitry Chagin [Fri, 1 Sep 2023 08:12:51 +0000 (11:12 +0300)]
extattr(9): Mention system namespace restrictions in a jail

Reported by: netchild
Reviewed by: gbe
Differential revision: https://reviews.freebsd.org/D41676
MFC after: 1 week

10 months agojail: Add the ability to access system-level filesystem extended attributes
Shawn Webb [Fri, 1 Sep 2023 08:11:33 +0000 (11:11 +0300)]
jail: Add the ability to access system-level filesystem extended attributes

Prior to this commit privileged accounts in a jail could not access to the
filesystem extended attributes in the system namespace. To control access to
the system namespace in a per-jail basis add a new configuration parameter
allow.extattr which is off by default.

Reported by: zirias
Tested by: zirias
Obtained from: HardenedBSD
Reviewed by: kevans, jamie
Differential revision: https://reviews.freebsd.org/D41643
MFC after: 1 week
Relnotes: yes

10 months agolinux(4): Return ENOTSUP from xattr syscalls instead of EPERM
Dmitry Chagin [Fri, 1 Sep 2023 08:11:02 +0000 (11:11 +0300)]
linux(4): Return ENOTSUP from xattr syscalls instead of EPERM

FreeBSD does not permits manipulating extended attributes in the system
namespace by unprivileged accounts, even if account has appropriate
privileges to access filesystem object.
In Linux the system namespace is used to preserve posix acls. Some Gnu
coreutils binaries uses posix acls, eg, install, ls.  And fails if we
unexpectedly return EPERM error from xattr system calls.

In the other hands, in Linux read and write access to the system
namespace depend on the policy implemented for each filesystem, so we'll
mimics we're a filesystem that prohibits this for unpriveleged accounts.

Reported by: zirias
Tested by: zirias
MFC after: 1 week

10 months agolinux(4): Merge removexattr for future error recode
Dmitry Chagin [Fri, 1 Sep 2023 08:10:44 +0000 (11:10 +0300)]
linux(4): Merge removexattr for future error recode

Tested by: zirias
MFC after: 1 week

10 months agolinux(4): Return ENODATA from getxattr syscalls instead of EPERM
Dmitry Chagin [Fri, 1 Sep 2023 08:10:12 +0000 (11:10 +0300)]
linux(4): Return ENODATA from getxattr syscalls instead of EPERM

On Linux ENODATA mean the named attribute does not exist, or the
process has no access to this attribute.

Reported by: zirias
Tested by: zirias
MFC after: 1 week

10 months agolinux(4): Merge getxattr for future error recode
Dmitry Chagin [Fri, 1 Sep 2023 08:09:49 +0000 (11:09 +0300)]
linux(4): Merge getxattr for future error recode

Tested by: zirias
MFC after: 1 week

10 months agoarm64: initialize pcb in the TBI/PAC/etc. fault case
Kyle Evans [Fri, 1 Sep 2023 02:10:38 +0000 (21:10 -0500)]
arm64: initialize pcb in the TBI/PAC/etc. fault case

After 2c10be9e06d, we may jump to the bad_far label without `pcb` being
set, resulting in a follow-up fault as we may dereference it immediately
after the jump if td_intr_nesting_level == 0.  In this branch, it should
be safe to dereference `td` as we're not handling the special case
mentioned below of accessing it during promotion/demotion.

This seems to fix a null ptr deref I hit during my most recent pkgbase
build attempt on the Windows DevKit, though that was admittedly
encountered while we were on the way to a panic from an apparent
use-after-free in ZFS bits.

Reviewed by: andrew, markj
Fixes: 2c10be9e06d ("arm64: Handle translation faults for thread [..]")
Differential Revision: https://reviews.freebsd.org/D41677

10 months agodmu_buf_will_clone: change assertion to fix 32-bit compiler warning
Dimitry Andric [Fri, 1 Sep 2023 01:17:12 +0000 (03:17 +0200)]
dmu_buf_will_clone: change assertion to fix 32-bit compiler warning

Building module/zfs/dbuf.c for 32-bit targets can result in a warning:

In file included from
/usr/src/sys/contrib/openzfs/include/sys/zfs_context.h:97,
                 from /usr/src/sys/contrib/openzfs/module/zfs/dbuf.c:32:
/usr/src/sys/contrib/openzfs/module/zfs/dbuf.c: In function
'dmu_buf_will_clone':
/usr/src/sys/contrib/openzfs/lib/libspl/include/assert.h:116:33: error:
cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
  116 |         const uint64_t __left = (uint64_t)(LEFT);
  \
      |                                 ^
/usr/src/sys/contrib/openzfs/lib/libspl/include/assert.h:148:25: note:
in expansion of macro 'VERIFY0'
  148 | #define ASSERT0         VERIFY0
      |                         ^~~~~~~
/usr/src/sys/contrib/openzfs/module/zfs/dbuf.c:2704:9: note: in
expansion of macro 'ASSERT0'
 2704 |         ASSERT0(dbuf_find_dirty_eq(db, tx->tx_txg));
      |         ^~~~~~~

This is because dbuf_find_dirty_eq() returns a pointer, which if
pointers are 32-bit results in a warning about the cast to uint64_t.

Instead, use the ASSERT3P() macro, with == and NULL as second and third
arguments, which should work regardless of the target's bitness.

Reviewed-by: Kay Pedersen <mail@mkwg.de>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Dimitry Andric <dimitry@andric.com>
Closes #15224

10 months agosrc.conf.5: regen
Brooks Davis [Fri, 1 Sep 2023 00:02:20 +0000 (01:02 +0100)]
src.conf.5: regen

10 months agomakeman: clarify scope of ignored option values
Brooks Davis [Thu, 31 Aug 2023 23:58:39 +0000 (00:58 +0100)]
makeman: clarify scope of ignored option values

The values of WITH_ and WITHOUT_ options are ignored, but group options
are not.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41683

10 months agorelease: remove arm/armv6 RPI-B configuration file
Glen Barber [Thu, 31 Aug 2023 23:24:38 +0000 (19:24 -0400)]
release: remove arm/armv6 RPI-B configuration file

The arm/armv6 RPI-B images are deprecated in 15 and 14.
An MFC to stable/14 will follow.

MFC after: 3 days
Sponsored by: GoFundMe https://www.gofundme.com/f/gjbbsd
Sponsored by: PayPal https://paypal.me/gjbbsd

10 months agoRe-remove $FreeBSD$ inadvertantly put back into jail.8
Jamie Gritton [Thu, 31 Aug 2023 22:35:00 +0000 (15:35 -0700)]
Re-remove $FreeBSD$ inadvertantly put back into jail.8

10 months agolibipf: fix parser error message.
Dag-Erling Smørgrav [Thu, 31 Aug 2023 20:15:54 +0000 (22:15 +0200)]
libipf: fix parser error message.

MFC after: 1 week
Reviewed by: cy
Differential Revision: https://reviews.freebsd.org/D41652

10 months agolibc: fix history for strverscmp(3) and versionsort(3)
Mina Galić [Thu, 31 Aug 2023 11:50:17 +0000 (11:50 +0000)]
libc: fix history for strverscmp(3) and versionsort(3)

strverscmp(3) and versionsort(3) where first released in 13.2

PR: 273401
Reviewed by: kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41617

10 months agomcast: fix memory leak in imf_purge()
Kristof Provost [Tue, 29 Aug 2023 09:33:17 +0000 (11:33 +0200)]
mcast: fix memory leak in imf_purge()

The IGMP code buffers packets in the imf_inm->inm_scq mbufq, but does
not clear this queue when struct in_mfilter is freed by imf_purge().
This can cause memory leaks if IGMPv3 is used.

Purge the mbufq on imf_purge().

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41629

10 months agopf: remove DIOCGETRULE and DIOCGETSTATUS
Kristof Provost [Tue, 29 Aug 2023 15:17:24 +0000 (17:17 +0200)]
pf: remove DIOCGETRULE and DIOCGETSTATUS

These calls have nvlist variants that completely supersede them.
Remove the old code.

Reviewed by: mjg
MFC after: never
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41651

10 months agosnmp_pf: use libpfctl's pfctl_get_status() rather than DIOCGETSTATUS
Kristof Provost [Tue, 29 Aug 2023 15:16:19 +0000 (17:16 +0200)]
snmp_pf: use libpfctl's pfctl_get_status() rather than DIOCGETSTATUS

Prefer libpfctl functions over direct access to the ioctl whenever
possible. This will allow subsequent removal of DIOCGETSTATUS (in 15) as
there already is an nvlist-based alternative.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41650

10 months agolibpfctl: implement status counter accessor functions
Kristof Provost [Tue, 29 Aug 2023 15:04:17 +0000 (17:04 +0200)]
libpfctl: implement status counter accessor functions

The new nvlist-based status call allows us to easily add new counters.
However, the libpfctl interface defines a TAILQ, so it's not quite
trivial to find the counter consumers are interested in.

Provide convenience functions to access the counters.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41649

10 months agolibpfctl: allow pfctl_free_status(NULL)
Kristof Provost [Tue, 29 Aug 2023 15:02:34 +0000 (17:02 +0200)]
libpfctl: allow pfctl_free_status(NULL)

Mimic free() and friends, and allow free()ing of NULL.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41648

10 months agopf (t)ftp-proxy: use libpfctl instead of DIOCGETSTATUS
Kristof Provost [Tue, 29 Aug 2023 15:00:44 +0000 (17:00 +0200)]
pf (t)ftp-proxy: use libpfctl instead of DIOCGETSTATUS

Prefer libpfctl functions over direct access to the ioctl whenever
possible. This will allow subsequent removal of DIOCGETSTATUS (in 15) as
there already is an nvlist-based alternative.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D41647

10 months agovmxnet3: do restart on VLAN changes
Kristof Provost [Thu, 31 Aug 2023 07:32:54 +0000 (09:32 +0200)]
vmxnet3: do restart on VLAN changes

At least one user reports issues with vmx interfaces after 725e4008ef,
where we default to not resetting the interface on VLAN changes. This
was on an ESXi 7.0.3 setup.

Reported by: Marcos Mendoza <mmendoza@netgate.com>
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")