]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
15 months agovfs: vn_dir_next_dirent(): Simplify interface and harden
Olivier Certner [Mon, 24 Apr 2023 08:25:15 +0000 (10:25 +0200)]
vfs: vn_dir_next_dirent(): Simplify interface and harden

Simplify the old interface (one less argument, simpler termination test)
and add documentation about it. Add more sanity checks (mostly under
INVARIANTS, but also in the general case to prevent infinite
loops). Drop the explicit test on minimum directory entry size (without
INVARIANTS).

Deal with the impacts in callers (dirent_exists() and vop_stdvptocnp()).
dirent_exists() has been simplified a bit, preserving the exact same
semantics but for the return code whose meaning has been reversed (0 now
means the entry exists, ENOENT that it doesn't and other values are
genuine errors). While here, suppress gratuitous casts of malloc return
values.

vn_dir_next_dirent() has been tested by a 'make -j4 buildkernel' with a
temporary modification to the VFS cache causing vn_vptocnp() to always
call VOP_VPTOCNP() and finally vop_stdvptocnp() (observed with temporary
debug counters).

Export new _GENERIC_MINDIRSIZ and _GENERIC_MAXDIRSIZ on __BSD_VISIBLE,
and GENERIC_MINDIRSIZ and GENERIC_MAXDIRSIZ on _KERNEL.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39764

15 months agovfs: Export get_next_dirent() as vn_dir_next_dirent()
Olivier Certner [Sun, 23 Apr 2023 07:47:58 +0000 (09:47 +0200)]
vfs: Export get_next_dirent() as vn_dir_next_dirent()

Move internal-to-'vfs_default.c' get_next_dirent() to 'vfs_vnops.c' and
export it for use by other parts of the VFS. This is a preparatory
change for using it in vfs_emptydir().

No functional change.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39755

15 months agoCONTRIBUTING: add intro describing the ways we accept contributions
Ed Maste [Thu, 27 Apr 2023 16:13:04 +0000 (12:13 -0400)]
CONTRIBUTING: add intro describing the ways we accept contributions

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39854

15 months agoAdditions to targets/pseudo/host-tools
Simon J. Gerraty [Thu, 27 Apr 2023 21:16:49 +0000 (14:16 -0700)]
Additions to targets/pseudo/host-tools

More tools needed to be built for Linux.
These are the ones that "just work".

15 months agojobs.mk report JOB_ARGS log and JOB_LOG_START
Simon J. Gerraty [Thu, 27 Apr 2023 20:40:44 +0000 (13:40 -0700)]
jobs.mk report JOB_ARGS log and JOB_LOG_START

At the start of a job include info such as JOB_ARGS the log location
and anything in JOB_LOG_START (eg TARGET_SPEC=${TARGET_SPEC})

15 months agotzsetup: appease checkstyle9
Yuri Pankov [Thu, 27 Apr 2023 18:26:16 +0000 (20:26 +0200)]
tzsetup: appease checkstyle9

15 months agotzsetup: adopt zone1970.tab changes
Yuri Pankov [Thu, 27 Apr 2023 17:31:48 +0000 (19:31 +0200)]
tzsetup: adopt zone1970.tab changes

- assumption that single-zone countries do not have description
  is no longer correct; do not try to optimize this case as it's
  only going to make the code more confusing and we now have menus
  with a single zone selection because of this
- remove the single-country continent short cut, it also only serves
  to confuse users as we now have such a continent
- instead add a single-zone contry short cut (see above), now all
  single-zone countries fall here
- use the #@ continent overrides that zone1970.tab introduces (this is
  visible at least fixing Iceland being currently listed under Africa)
- add Arctic Ocean "continent" coming only from the overrides at the
  moment
- update baseline with the changes

Reviewed by: bapt, philip
Differential Revision: https://reviews.freebsd.org/D39606

15 months agosockbuf: Add KMSAN checks to sbappend*()
Mark Johnston [Thu, 27 Apr 2023 16:58:56 +0000 (12:58 -0400)]
sockbuf: Add KMSAN checks to sbappend*()

Otherwise KMSAN only detects uninitialized memory when the contents of
the buffer are copied out to userspace or transmitted to a network
interface.  At that point the KMSAN violation will be far removed from
its origin, so let's try to make debugging such problems a bit easier.

Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38101

15 months agologger(1): fix timestamps in case of long run
Eugene Grosbein [Thu, 27 Apr 2023 16:43:16 +0000 (23:43 +0700)]
logger(1): fix timestamps in case of long run

An example:

( echo test; sleep 2; echo test2 ) | logger -h /var/run/log

Before fix, logger assigned same timestamp to both records.

Fixes: 65547fb33db901a9f352aacb0ed45ce68b0bd275
Reported by: Vadim Goncharov
MFC after: 1 week

15 months agocap_net tests: Skip tests if there is no connectivity
Mark Johnston [Thu, 27 Apr 2023 13:42:36 +0000 (09:42 -0400)]
cap_net tests: Skip tests if there is no connectivity

When testing cap_connect() and name/addr lookup functions, skip tests if
we fail and the error is not ENOTCAPABLE.  This makes the tests amenable
to running in CI without Internet connectivity.

Reviewed by: oshogbo
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39242

15 months agobhyve: Add DEBUG_HDA_FILE define to specify location of debug output
Guido Falsi [Thu, 27 Apr 2023 07:49:01 +0000 (09:49 +0200)]
bhyve: Add DEBUG_HDA_FILE define to specify location of debug output

Reviewed by: corvink
Approved by: corvink
Differential Revision: https://reviews.freebsd.org/D39826

15 months agobhyve: Disable bhyve HDA debug by default.
Guido Falsi [Mon, 3 Apr 2023 10:45:11 +0000 (12:45 +0200)]
bhyve: Disable bhyve HDA debug by default.

Adapt hda_print_cmd_ctl_data() to not generate compiler warnings
when DEBUG_HDA is off.

Reviewed by: corvink
Approved by: corvink
Differential Revision: https://reviews.freebsd.org/D39826

15 months agoopenzfs: re-enable FPU usage on aarch64
Kyle Evans [Thu, 27 Apr 2023 00:47:14 +0000 (19:47 -0500)]
openzfs: re-enable FPU usage on aarch64

The BLAKE3 generated assembly files have now been updated to avoid
clobbering x18, we can safely re-enable FPU usage on aarch64.

15 months agoFix BLAKE3 aarch64 assembly for FreeBSD and macOS
Tino Reichardt [Wed, 26 Apr 2023 19:40:26 +0000 (21:40 +0200)]
Fix BLAKE3 aarch64 assembly for FreeBSD and macOS

The x18 register isn't useable within FreeBSD kernel space, so we
have to fix the BLAKE3 aarch64 assembly for not using it.

The source files are here: https://github.com/mcmilk/BLAKE3-tests

Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes #14728

15 months agosiftr: remove barely used hash generation per record
Cheng Cui [Wed, 26 Apr 2023 11:18:01 +0000 (07:18 -0400)]
siftr: remove barely used hash generation per record

Reviewers: rscheff, tuexen
Approved by: rscheff, tuexen
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D39835

15 months agonetmap: pkt-gen: sync with upstream
Vincenzo Maffione [Wed, 26 Apr 2023 20:32:24 +0000 (20:32 +0000)]
netmap: pkt-gen: sync with upstream

Keep in sync with the recent upstream changes:

Fix compilation on 32-bit architectures
Update IP length, UDP length/checksum when size changes
Man page fixes

Submitted by: jlduran@gmail.com
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D39760

15 months agoarp/ndp: Use valid prototypes for function declarations with no arguments.
John Baldwin [Wed, 26 Apr 2023 20:18:53 +0000 (13:18 -0700)]
arp/ndp: Use valid prototypes for function declarations with no arguments.

15 months agoarm: remove passing trapframe to intr_ipi_dispatch()
Elliott Mitchell [Wed, 14 Dec 2022 21:59:17 +0000 (13:59 -0800)]
arm: remove passing trapframe to intr_ipi_dispatch()

This was needed before INTRNG was in place and handling the push of
curthread->td_intr_frame.  Since INTRNG now handles this, there is no
longer and need for playing around with the frame inside IPI interrupts.

15 months agoarm: remove interrupt nesting by ipi_preempt()/ipi_hardclock()
Elliott Mitchell [Wed, 14 Dec 2022 20:36:47 +0000 (12:36 -0800)]
arm: remove interrupt nesting by ipi_preempt()/ipi_hardclock()

This was needed when intr_ipi_dispatch() was called by hardware-specific
IPI interrupt routines which didn't save the trap frame.  Now all ARM
interrupts pass through INTRNG which will have already saved the trap
frame and disabled preemption.

Remove the conditional trapframe/argument passing to the handlers.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D37938

15 months agozfs: Fix positive ABD size assertion in abd_verify().
Mateusz Guzik [Wed, 26 Apr 2023 17:59:24 +0000 (17:59 +0000)]
zfs: Fix positive ABD size assertion in abd_verify().

This cherry-picks upstream:
commit bba7cbf0a481ab16f9a9a4874b7dbd5682e4d3a4
Author: Alexander Motin <mav@FreeBSD.org>
Date:   Wed Apr 26 12:20:43 2023 -0400

    Fix positive ABD size assertion in abd_verify().

    Gang ABDs without childred are legal, and they do have zero size.
    For other ABD types zero size doesn't have much sense and likely
    not working correctly now.

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

Sponsored by: Rubicon Communications, LLC ("Netgate")

15 months agoipv6: disable RFC 4620 nodeinfo by default
Ed Maste [Mon, 24 Apr 2023 19:41:45 +0000 (15:41 -0400)]
ipv6: disable RFC 4620 nodeinfo by default

RFC 4620 is an experimental RFC that can be used to request information
about a host, including:

- the fully-qualified or single-component name
- some set of the Responder's IPv6 unicast addresses
- some set of the Responder's IPv4 unicast addresses

This is not something that should be made available by default.

PR: 257709
Submitted by: ruben@verweg.com
Reviewed by: melifaro
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39778

15 months agoopenzfs: arm64: implement kfpu_begin/kfpu_end
Kyle Evans [Wed, 26 Apr 2023 17:23:48 +0000 (12:23 -0500)]
openzfs: arm64: implement kfpu_begin/kfpu_end

This is part one of a fix for booting with ZFS on arm64 using
accelerated checksum implementations.  Checksum benchmarking will
attempt to use the FPU, so we currently panic quickly on boot.  BLAKE3
is still broken, as it clobbers x18 and we promptly discover that fact
as soon as we attempt to fetch curthread in kfpu_end().

Note that _STANDALONE is special-cased here, but ideally we wouldn't be
building the code that uses kfpu_begin()/kfpu_end() at all in the loader
environment.

Discussed with: imp (a bit)
Differential Revision: https://reviews.freebsd.org/D39448

15 months agocallout: Remove an unneeded MTX_NEW
Mark Johnston [Wed, 26 Apr 2023 15:15:56 +0000 (11:15 -0400)]
callout: Remove an unneeded MTX_NEW

Reported by: hselasky
Fixes: 78cfa762ebf2 ("callout: Move per-CPU callout state into the dpcpu region")

15 months agopf: clear PF_TAG_ROUTE_TO for dummynet fast path
Kristof Provost [Wed, 26 Apr 2023 13:12:30 +0000 (15:12 +0200)]
pf: clear PF_TAG_ROUTE_TO for dummynet fast path

Similar to the PF_TAG_DUMMYNET we must also clear the route tag if
dummynet didn't keep the packet. In that case we'd continue immediately
and there'd be no need for the route tag. Keeping it could lead to
unexpected routing of traffic.

See also: 27407a6adc793bdfaef8a86ece32fb1b461429f0
See also: https://redmine.pfsense.org/issues/14055
Sponsored by: Rubicon Communications, LLC ("Netgate")

15 months agopfctl: match expand_label_addr() prototype to definition
Kristof Provost [Tue, 25 Apr 2023 14:01:45 +0000 (16:01 +0200)]
pfctl: match expand_label_addr() prototype to definition

Sponsored by: Rubicon Communications, LLC ("Netgate")

15 months agobuf: Dynamically allocate per-CPU buffer queues
Mark Johnston [Wed, 26 Apr 2023 14:09:31 +0000 (10:09 -0400)]
buf: Dynamically allocate per-CPU buffer queues

To reduce static bloat.  No functional change intended.

PR: 269572
Reviewed by: mjg, kib, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39808

15 months agocallout: Move per-CPU callout state into the dpcpu region
Mark Johnston [Wed, 26 Apr 2023 14:09:09 +0000 (10:09 -0400)]
callout: Move per-CPU callout state into the dpcpu region

This eliminates some static bloat in amd64 kernels and reduces the
penalty of increasing MAXCPU.  The structures now also maintain NUMA
affinity.  No functional change intended.

PR: 269572
Reviewed by: mjg, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39807

15 months agovmm: Dynamically allocate a couple of per-CPU state save areas
Mark Johnston [Wed, 26 Apr 2023 14:08:42 +0000 (10:08 -0400)]
vmm: Dynamically allocate a couple of per-CPU state save areas

This avoids bloating the BSS when MAXCPU is large.

No functional change intended.

PR: 269572
Reviewed by: corvink, rew
Tested by: rew
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39805

15 months agolinux(4): Use inlined LINUX_KERNVER for tests to improve readability
Dmitry Chagin [Wed, 26 Apr 2023 13:57:30 +0000 (16:57 +0300)]
linux(4): Use inlined LINUX_KERNVER for tests to improve readability

MFC after: 1 month

15 months agolinux(4): Don't relie on process osreldata when testing features
Dmitry Chagin [Wed, 26 Apr 2023 13:56:41 +0000 (16:56 +0300)]
linux(4): Don't relie on process osreldata when testing features

The ELF note identifyies the operating-system ABI that the executable
was created for. The note data of the Glibc executable contains the
earliest release number of the Linux kernel that supports this ABI.
As of a current 2.37 version of Glibc, it is 3.2.0 for x86, 3.7.0
for Aarch64.
Glibc does not use this release number and the current kernel's
LINUX_VERSION_CODE to detect kernel features, using fallbacks to known
previous way in case of ENOSYS or something else instead.

A dynamically linked Glibc reads the current kernel's LINUX_VERSION_CODE
from the ELF note in the vDSO or fallback to uname syscall if the vDSO
can't be located and parse the release field in struct utsname. Glibc
uses the current kernel's LINUX_VERSION_CODE for "kernel too old" check.

While here use inlined LINUX_KERNVER for tests to improve readability,
as suggested by emaste@.

MFC after: 1 month

15 months agoirdma: Silence an unused function warning
Mark Johnston [Wed, 26 Apr 2023 13:36:31 +0000 (09:36 -0400)]
irdma: Silence an unused function warning

Reviewed by: erj
Fixes: 35105900c65b ("irdma(4): Upgrade the driver to 1.1.11-k")
Differential Revision: https://reviews.freebsd.org/D39719

15 months agopxeboot: bugs in pxe.h
Toomas Soome [Tue, 25 Apr 2023 12:12:07 +0000 (15:12 +0300)]
pxeboot: bugs in pxe.h

SEGDESC_t needs to be PACKED
there is no status in t_PXENV_UNDI_MCAST_ADDRESS

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D39799

15 months agonetlink: fix IPv6 proxy ndp deletion.
Alexander V. Chernikov [Wed, 26 Apr 2023 13:23:39 +0000 (13:23 +0000)]
netlink: fix IPv6 proxy ndp deletion.

* Move LLT_ADDEDPROXY handling into lltable_link_entry() to
 reduct duplication
* Use standard lltable_delete_addr() for entry deletion
* Add (forgotten) call to llt_post_resolved handler after
 adding the entry via netlink.

MFC after: 2 weeks

15 months agoarp: report successful deletion via netlink to mimic rtsock.
Alexander V. Chernikov [Wed, 26 Apr 2023 12:29:43 +0000 (12:29 +0000)]
arp: report successful deletion via netlink to mimic rtsock.

15 months agoAdd vt_simplefb to the arm64 NOTES file
Andrew Turner [Wed, 26 Apr 2023 13:09:00 +0000 (14:09 +0100)]
Add vt_simplefb to the arm64 NOTES file

This will be picked up in the LINT-ACPI and LINT-FDT configs to check
it builds with only one option enabled

Sponsored by: Arm Ltd

15 months agoMark simplefb as depending on fdt
Andrew Turner [Wed, 26 Apr 2023 13:11:31 +0000 (14:11 +0100)]
Mark simplefb as depending on fdt

This file is for a FDT specific device, mark it as such.

Reported by: Zachary Leaf <zachary.leaf@arm.com>
Sponsored by: Arm Ltd

15 months agotzsetup: fix bootstrapping for github CI jobs
Yuri Pankov [Wed, 26 Apr 2023 12:29:08 +0000 (14:29 +0200)]
tzsetup: fix bootstrapping for github CI jobs

Move dump_zonetab() under HAVE_BSDDIALOG as the parsing code
it relies on already is.

15 months agonetlink: fix build without NETLINK in the kernel.
Alexander V. Chernikov [Wed, 26 Apr 2023 11:18:43 +0000 (11:18 +0000)]
netlink: fix build without NETLINK in the kernel.

PR: 271066

15 months agogetconf(1): add DEALLOC_PRESENT
Yuri Pankov [Wed, 26 Apr 2023 11:01:43 +0000 (13:01 +0200)]
getconf(1): add DEALLOC_PRESENT

Allow getconf to query _PC_DEALLOC_PRESENT pathconf(2) variable
added in 0dc332bff200.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39796

15 months agotzcode: Clean up the ctime(3) manual page.
Dag-Erling Smørgrav [Wed, 26 Apr 2023 09:46:41 +0000 (11:46 +0200)]
tzcode: Clean up the ctime(3) manual page.

MFC after: 3 weeks
Sponsored by: Klara, Inc.
Reviewed by: pauamma_gundo.com
Differential Revision: https://reviews.freebsd.org/D39714

15 months agoUpdate tzcode to 2023c.
Dag-Erling Smørgrav [Wed, 26 Apr 2023 09:46:18 +0000 (11:46 +0200)]
Update tzcode to 2023c.

MFC after:      3 weeks
Sponsored by:   Klara, Inc.
Reviewed by:    philip
Differential Revision:  https://reviews.freebsd.org/D39712

15 months agopf: introduce ridentifier and labels to ether rules
Christian McDonald [Mon, 24 Apr 2023 18:55:34 +0000 (14:55 -0400)]
pf: introduce ridentifier and labels to ether rules

Make Ethernet rules more similar to the usual layer 3 rules by also
allowing ridentifier and labels to be set on them.

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

15 months agovmm: fix HLT loop while vcpu has requested virtual interrupts
Vitaliy Gusev [Wed, 26 Apr 2023 08:17:50 +0000 (10:17 +0200)]
vmm: fix HLT loop while vcpu has requested virtual interrupts

This fixes the detection of pending interrupts when pirval is 0 and the
pending bit is set

More information how this situation occurs, can be found here:
https://github.com/freebsd/freebsd-src/blob/c5b5f2d8086f540fefe4826da013dd31d4e45fe8/sys/amd64/vmm/intel/vmx.c#L4016-L4031

Reviewed by: corvink, markj
Fixes: 02cc877968bbcd57695035c67114a67427f54549 ("Recognize a pending virtual interrupt while emulating the halt instruction.")
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D39620

15 months agoprometheus_sysctl_exporter: Replace magic numbers with identifiers.
Peter Jeremy [Wed, 26 Apr 2023 08:29:33 +0000 (18:29 +1000)]
prometheus_sysctl_exporter: Replace magic numbers with identifiers.

Identifiers make it clearer what is going on and makes it easier to
find consumers of sysctl functionality.

No functional change.

MFC after: 3 days
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D39797

15 months agobhyve: pass E820 table to guest
Corvin Köhne [Thu, 9 Sep 2021 09:37:04 +0000 (11:37 +0200)]
bhyve: pass E820 table to guest

E820 table will be used to report valid RAM ranges and reserve special
memory areas like graphics memory for GPU passthrough.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39550

15 months agobhyve: add E820 dump function
Corvin Köhne [Thu, 9 Sep 2021 09:37:03 +0000 (11:37 +0200)]
bhyve: add E820 dump function

For debugging purposes it is helpful to dump the E820 table.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39549

15 months agobhyve: add allocation function to E820
Corvin Köhne [Thu, 9 Sep 2021 09:37:03 +0000 (11:37 +0200)]
bhyve: add allocation function to E820

This function makes it easy to allocate new E820 entries. It will be
used to allocate graphics memory for Intel integrated graphic devices.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39547

15 months agobhyve: add common memory holes to E820 table
Corvin Köhne [Thu, 9 Sep 2021 09:37:03 +0000 (11:37 +0200)]
bhyve: add common memory holes to E820 table

The VGA and the ROM memory ranges can't be used as system memory. For
that reason, remove them from the E820 table.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39546

15 months agobhyve: add basic E820 implementation
Corvin Köhne [Thu, 9 Sep 2021 09:37:03 +0000 (11:37 +0200)]
bhyve: add basic E820 implementation

There are some use cases where bhyve has to prepare some special memory
regions. E.g. GPU passthrough for Intel integrated graphic devices needs
to reserve some memory for the graphic device. So, bhyve has to inform
the guest about those memory regions. This information can be passed by
the qemu fwcfg interface. As qemu creates an E820 table, we can reuse
the existing fwcfg item "etc/e820".

This commit is the first one of a series. It only adds a basic
implementation for the creation of the E820 table. Some subsequent
commits will add more items to the E820 table and register it as fwcfg
item.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39545

15 months agoAdd a simple-framebuffer vt driver
Andrew Turner [Wed, 26 Apr 2023 05:44:10 +0000 (00:44 -0500)]
Add a simple-framebuffer vt driver

This allows us to support this hardware and, in the future, use clocks
so they are enabled past the initial kernel boot process.

Reviewed by: ray
Differential Revision: https://reviews.freebsd.org/D30103

15 months agoNote that static hints no longer break loader hints
Kyle Evans [Wed, 26 Apr 2023 05:38:32 +0000 (00:38 -0500)]
Note that static hints no longer break loader hints

This commentary was carried over from the x86 version of the same code,
but has actually been inaccurate for a while now. As of FreeBSD 12.x,
all environments are used unless they disable each other. See
39d44f7f15c ("kern_environment: use any provided environments [...]")
for details.

Reviewed by: imp
Differentiala Revision: https://reviews.freebsd.org/D35695

15 months agogbde: stop rebuilding sha512 bits
Kyle Evans [Wed, 26 Apr 2023 05:36:33 +0000 (00:36 -0500)]
gbde: stop rebuilding sha512 bits

In the early days of gbde, it linked against libmd.  Shortly after
conception, phk replaced ARC4 with SHA-512, but libmd did not have SHA2
at the time thus he built a copy of sha2.c for gbde.

Fast forward 3 years, cperciva adds SHA2 to libmd -- this makes gbde's
build of sha2.c redundant, but it's (understandably) overlooked.  Let's
simplify the gbde build now and just assume that libmd includes the most
optimal implementation.

Reported by: koobs (weird lto errors?)
Differential Revision: https://reviews.freebsd.org/D34668

15 months agobectl: document the -r flag to bectl
Kyle Evans [Thu, 20 Apr 2023 04:55:07 +0000 (23:55 -0500)]
bectl: document the -r flag to bectl

Independent of all of the commands, bectl itself takes an `-r` flag that
specifies the BE root to use.  This was originally added to facilitate
testing, but it was later discovered to be incredibly useful in other
scenarios; e.g., trying to recover some boot environments in rescue
media.

The "BE root" described here is the parent dataset that holds boot
environments, but I've no idea if that's an accepted definition for that
dataset.

Reviewed by: gallatin, imp, Pau Amma
MFC after: 1 week
Differential Review: https://reviews.freebsd.org/D39710

15 months agoVOP_CLOSE(): MNTK_EXTENDED_SHARED filesystems do not need excl lock
Konstantin Belousov [Mon, 24 Apr 2023 22:43:32 +0000 (01:43 +0300)]
VOP_CLOSE(): MNTK_EXTENDED_SHARED filesystems do not need excl lock

All in-tree implementations of VOP_CLOSE() for filesystems proclaiming
MNTK_EXTENDED_SHARED, are fine with the shared lock for the closed
vnode.  I checked the following implementations:
ffs
ext2
ufs
null
tmpfs
devfs
fdescfs
cd9660
zfs
It seems that initial addition of FWRITE check was due to necessity of
handling the VV_TEXT vnode vflag.  Since VOP_ADD_WRITECOUNT() only
requires shared lock, we can relax the locking requirement there.

Reviewed by: markj, Olivier Certner <olce.freebsd@certner.fr>
Tested by: Olivier Certner
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D39784

15 months agotcp_hpts: add missing "inline"
Gleb Smirnoff [Tue, 25 Apr 2023 22:18:26 +0000 (15:18 -0700)]
tcp_hpts: add missing "inline"

Fixes: c2a69e846fffb95271c0299e0a81e2033382e9c2

15 months agoChange the unit of srtt and rto to usec, inspired by these in struct "tcp_info"....
Cheng Cui [Tue, 25 Apr 2023 11:52:28 +0000 (07:52 -0400)]
Change the unit of srtt and rto to usec, inspired by these in struct "tcp_info". Therefore, no need hz and tcp_rtt_scale in the headline of the log. Update the man page as well.

Summary: Simplify srtt and rto values in siftr log.

Test Plan:
Tested in Emulab testbed:
cc@s1:~ % sudo sysctl net.inet.siftr
net.inet.siftr.port_filter: 0
net.inet.siftr.genhashes: 0
net.inet.siftr.ppl: 1
net.inet.siftr.logfile: /var/log/siftr.log
net.inet.siftr.enabled: 0
cc@s1:~ % sudo sysctl net.inet.siftr.port_filter=5001
net.inet.siftr.port_filter: 0 -> 5001
cc@s1:~ % sudo sysctl net.inet.siftr.enabled=1
net.inet.siftr.enabled: 0 -> 1
cc@s1:~ %
cc@s1:~ % iperf -c r1 -n 1M
------------------------------------------------------------
Client connecting to r1, TCP port 5001
TCP window size: 32.0 KByte (default)
------------------------------------------------------------
[  1] local 10.1.1.2 port 33817 connected with 10.1.1.3 port 5001
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-0.91 sec  1.00 MBytes  9.22 Mbits/sec
cc@s1:~ % sudo sysctl net.inet.siftr.enabled=0
net.inet.siftr.enabled: 1 -> 0

cc@s1:~ % ll /var/log/siftr.log
-rw-r--r--  1 root  wheel    91K Apr 25 09:38 /var/log/siftr.log
cc@s1:~ % cat /var/log/siftr.log
enable_time_secs=1682437111 enable_time_usecs=121115 siftrver=1.3.0 sysname=FreeBSD sysver=1400088 ipmode=4
o,0x00000000,1682437125.907343,10.1.1.2,33817,10.1.1.3,5001,1073725440,1073725440,2,0,0,0,0,2,536,0,1,672,1000000,32768,0,65536,0,0,0,0,0
i,0x00000000,1682437126.106759,10.1.1.2,33817,10.1.1.3,5001,1073725440,1073725440,2,0,0,0,0,2,536,0,1,672,1000000,32768,0,65536,0,1,0,0,0
o,0x00000000,1682437126.106767,10.1.1.2,33817,10.1.1.3,5001,1073725440,14480,2,65535,65700,9,9,4,1460,201000,1,16778209,803000,33580,0,65700,0,0,0,0,0
o,0x00000000,1682437126.107141,10.1.1.2,33817,10.1.1.3,5001,1073725440,14480,2,65535,65700,9,9,4,1460,201000,1,16778208,803000,33580,60,65700,0,0,0,0,0
...
i,0x00000000,1682437127.016754,10.1.1.2,33817,10.1.1.3,5001,1073725440,606109,1030,748544,66048,9,9,9,1460,100812,1,1008,303000,475948,0,65700,0,0,0,0,0
o,0x00000000,1682437127.016759,10.1.1.2,33817,10.1.1.3,5001,1073725440,606109,1030,748544,66048,9,9,10,1460,100812,1,1011,303000,475948,0,65700,0,0,0,0,0
disable_time_secs=1682437131 disable_time_usecs=767582 num_inbound_tcp_pkts=371 num_outbound_tcp_pkts=186 total_tcp_pkts=557 num_inbound_skipped_pkts_malloc=0 num_outbound_skipped_pkts_malloc=0 num_inbound_skipped_pkts_tcpcb=0 num_outbound_skipped_pkts_tcpcb=0 num_inbound_skipped_pkts_inpcb=0 num_outbound_skipped_pkts_inpcb=0 total_skipped_tcp_pkts=0 flow_list=10.1.1.2;33817-10.1.1.3;5001,

Reviewers: rscheff, tuexen
Approved by: rscheff, tuexen
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D39803

15 months agoclang: Enable -Wdeprecated-non-prototype by default.
John Baldwin [Tue, 25 Apr 2023 21:09:21 +0000 (14:09 -0700)]
clang: Enable -Wdeprecated-non-prototype by default.

PR: 270919 (exp-run)
Reviewed by: dim, emaste
Differential Revision: https://reviews.freebsd.org/D39535

15 months agoprintf(9): clarify the description of %b
Mitchell Horne [Tue, 25 Apr 2023 20:26:36 +0000 (17:26 -0300)]
printf(9): clarify the description of %b

The bit values are numbers given in octal representation, not decimal,
as one might assume from the description. Same goes for the base,
although this has an example.

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

15 months agoarm64/disassem.c: Add support str/strb/strh instructions
Mykola Hohsadze [Tue, 18 Apr 2023 15:51:15 +0000 (12:51 -0300)]
arm64/disassem.c: Add support str/strb/strh instructions

Added disassembly support for each type of str/strb/strh instruction
encoding.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39336

15 months agoarm64/disassem.c: Fix typo sxts to sxts and amount for TYPE_02
Mykola Hohsadze [Tue, 18 Apr 2023 15:50:58 +0000 (12:50 -0300)]
arm64/disassem.c: Fix typo sxts to sxts and amount for TYPE_02

The current implementation is wrong, since it unconditionally sets the
amount equal to the <size> field of the instruction. However, when the
<S> bit (scale) is not set, it must be zero.

Also fix a typo, sxts to sxtx, according to the Arm64 documentation.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39334

15 months agoarm64/disassem.c: style and formatting
Mykola Hohsadze [Tue, 18 Apr 2023 15:50:33 +0000 (12:50 -0300)]
arm64/disassem.c: style and formatting

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38899

15 months agotcp: move HPTS/LRO flags out of inpcb to tcpcb
Gleb Smirnoff [Tue, 25 Apr 2023 19:19:48 +0000 (12:19 -0700)]
tcp: move HPTS/LRO flags out of inpcb to tcpcb

These flags are TCP specific.  While here, make also several LRO
internal functions to pass tcpcb pointer instead of inpcb one.

Reviewed by: rrs
Differential Revision: https://reviews.freebsd.org/D39698

15 months agotcp_hpts: move HPTS related fields from inpcb to tcpcb
Gleb Smirnoff [Tue, 25 Apr 2023 19:18:33 +0000 (12:18 -0700)]
tcp_hpts: move HPTS related fields from inpcb to tcpcb

This makes inpcb lighter and allows future cache line optimizations
of tcpcb.  The reason why HPTS originally used inpcb is the compressed
TIME-WAIT state (see 0d7445193ab), that used to free a tcpcb, while the
associated connection is still on the HPTS ring.

Reviewed by: rrs
Differential Revision: https://reviews.freebsd.org/D39697

15 months agotcp: purge the input queue from tcp_discardcb()
Gleb Smirnoff [Tue, 25 Apr 2023 19:18:19 +0000 (12:18 -0700)]
tcp: purge the input queue from tcp_discardcb()

The purge was intentionally removed in a540cdca3183.  My assumption
was that the stacks that use the input queue always call the
tcp_handle_orphaned_packets() in their tfb_tcp_fb_fini method.
However, rack will skip doing that if t_fb_ptr is NULL and there are
scenarios when it is NULL, e.g. close(2) on a socket (but some
special close(2)).  Instead of working out all possible scenarios
let's put this safebelt back.

Reviewed by: rrs
Differential Revision: https://reviews.freebsd.org/D39696

15 months agoal_eth: Finish conversion to IfAPI
Justin Hibbits [Tue, 7 Mar 2023 19:19:44 +0000 (14:19 -0500)]
al_eth: Finish conversion to IfAPI

Reviewed by: zlei
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38955

15 months agoirdma: Convert to IfAPI
Justin Hibbits [Fri, 21 Apr 2023 17:04:00 +0000 (13:04 -0400)]
irdma: Convert to IfAPI

Mostly mechanical changes, with some reworking in irdma_cm for iterating
over interfaces and addresses.  Further rework by Bartosz Sobczak.

Reviewed by: bartosz.sobczak_intel.com
Tested by: mateusz.moga_intel.com
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38960

15 months agox86: whack pmspcv from GENERIC
Mateusz Guzik [Tue, 25 Apr 2023 17:56:10 +0000 (17:56 +0000)]
x86: whack pmspcv from GENERIC

The driver is enormous and rarely used.

      text      data       bss        dec         hex   filename
  23076646   1870505   4415872   29363023   0x1c00b4f   kernel.before
  20017433   1870305   4416000   26303738   0x1915cfa   kernel.after

People using the driver will need to add pmspcv_load="YES" to
their loader.conf.

Reviewed by: jhb
Relnotes: yes
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39816

15 months agoal_eth: make function definitions consistent with declarations
Dimitry Andric [Sat, 22 Apr 2023 11:45:57 +0000 (13:45 +0200)]
al_eth: make function definitions consistent with declarations

The declarations for al_eth_lm_retimer_ds25_signal_detect() and
al_eth_lm_retimer_ds25_cdr_lock() say that these functions return
'al_bool', but the definitions actually return 'boolean_t'.

Make the definitions match the declarations.

Reviewed by: jhb, emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39759

15 months agocd9660.5: Fix the history section
Mateusz Piotrowski [Tue, 25 Apr 2023 17:36:34 +0000 (19:36 +0200)]
cd9660.5: Fix the history section

MFC after: 7 days
Sponsored by: Klara Inc.

15 months agoboolean_t: change to unsigned int to avoid signed bitfield warnings
Dimitry Andric [Tue, 25 Apr 2023 17:52:40 +0000 (19:52 +0200)]
boolean_t: change to unsigned int to avoid signed bitfield warnings

This is the final part, which actually makes boolean_t unsigned. Note
that we do not change its size, nor do we try to change it directly to
bool, since that results in a lot of regressions.

Converting the remaining instances of boolean_t to plain C99 bool can
now be done in a piecemeal fashion, after which boolean_t may hopefully
be retired.

MFC after: 1 week
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D39753

15 months agovm: fix a number of functions to match the expected prototypes
Dimitry Andric [Tue, 25 Apr 2023 17:52:26 +0000 (19:52 +0200)]
vm: fix a number of functions to match the expected prototypes

Noticed while attempting to make boolean_t unsigned: some vm-related
function declarations and defintions were using boolean_t where they
should have used int, and vice versa.

MFC after: 1 week
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D39753

15 months agozfs: make zfs_vfs_held() definition consistent with declaration
Dimitry Andric [Tue, 25 Apr 2023 17:43:48 +0000 (19:43 +0200)]
zfs: make zfs_vfs_held() definition consistent with declaration

Noticed while attempting to change boolean_t into an actual bool: in
include/sys/zfs_ioctl_impl.h, zfs_vfs_held() is declared to return a
boolean_t, but in module/os/freebsd/zfs/zfs_ioctl_os.c it is defined to
return an int. Make the definition match the declaration.

Obtained from: https://github.com/openzfs/zfs/commit/62cc9d4f6
Reviewed by: jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39753

15 months agovmm: Expose some more AVX512 CPUID bits to guests
Mark Johnston [Tue, 25 Apr 2023 17:33:08 +0000 (13:33 -0400)]
vmm: Expose some more AVX512 CPUID bits to guests

This is required to announce support for some accelerated AES
operations.  AVX512BW indicates support for the AVX512-FP16 extension
and AVX512VL indicates support for the use of AVX512 instructions with
vector lengths smaller than 512 bits.

VAES and VPCLMULQDQ extensions indicate that VEX-prefixed AES-NI and
pclmulqdq instructions are supported.

All of these bits are needed for OpenSSL to use VAES to accelerate
AES-GCM transforms.

Reviewed by: corvink, kib, jhb
MFC after: 2 weeks
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D39781

15 months agoUse bool for one-bit wide bit-fields
Dimitry Andric [Tue, 25 Apr 2023 17:18:58 +0000 (19:18 +0200)]
Use bool for one-bit wide bit-fields

A signed one-bit wide bit-field can take only the values 0 and -1. Clang
16 introduced a warning that "implicit truncation from 'int' to a
one-bit wide bit-field changes value from 1 to -1". Fix the warnings by
using C99 bool.

Reported by: Clang 16
Reviewed by: emaste, jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39705

15 months agozfs: Revert "Fix data race between zil_commit() and zil_suspend()"
Mateusz Guzik [Tue, 25 Apr 2023 16:01:22 +0000 (16:01 +0000)]
zfs: Revert "Fix data race between zil_commit() and zil_suspend()"

This reverts commit 4c856fb333ac57d9b4a6ddd44407fd022a702f00.

To quote a pending upstream PR:
This reverts commit 4c856fb to resolve a newly introduced deadlock which
in practice is more disruptive that the issue this commit intended to
address.

Causes deadlocks described in https://github.com/openzfs/zfs/issues/14775

Sponsored by: Rubicon Communications, LLC ("Netgate")

15 months agoAdd support for zpool user properties
Allan Jude [Fri, 21 Apr 2023 17:20:36 +0000 (13:20 -0400)]
Add support for zpool user properties

Usage:

    zpool set org.freebsd:comment="this is my pool" poolname

Tests are based on zfs_set's user property tests.

Also stop truncating property values at MAXNAMELEN, use ZFS_MAXPROPLEN.

Reviewed by: markj
Approved by: markj
Co-authored-by: Mateusz Piotrowski <0mp@FreeBSD.org>
Obtained from: OpenZFS 8eae2d214cfa Add support for zpool user properties
Sponsored by: Beckhoff Automation GmbH & Co. KG.
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D39657

15 months agops: Add libxo to usage message
Mateusz Piotrowski [Tue, 25 Apr 2023 11:55:17 +0000 (13:55 +0200)]
ps: Add libxo to usage message

MFC after: 1 week
Sponsored by: Klara Inc.

15 months agops: Fix synopsis
Mateusz Piotrowski [Tue, 25 Apr 2023 11:38:10 +0000 (13:38 +0200)]
ps: Fix synopsis

In the -L mode, the -L flag is not optional.

MFC after: 3 days
Sponsored by: Klara Inc.

15 months agozfs: fix up bogus checksums with blake3 in face of cpu migration
Mateusz Guzik [Tue, 25 Apr 2023 15:20:19 +0000 (15:20 +0000)]
zfs: fix up bogus checksums with blake3 in face of cpu migration

This is a temporary measure until a better fix is sorted out.

Upstream report: https://github.com/openzfs/zfs/issues/14785
Reported by: Evgeniy Khramtsov
Sponsored by: Rubicon Communications, LLC ("Netgate")

15 months agonetlink: remove now-unused rtnl_iface_find_cloner_locked().
Alexander V. Chernikov [Tue, 25 Apr 2023 15:04:11 +0000 (15:04 +0000)]
netlink: remove now-unused rtnl_iface_find_cloner_locked().

15 months agonetlink: fix powerpc build.
Alexander V. Chernikov [Tue, 25 Apr 2023 14:59:04 +0000 (14:59 +0000)]
netlink: fix powerpc build.

15 months agondp: fix signed/unsigned compariosn in the netlink code.
Alexander V. Chernikov [Tue, 25 Apr 2023 14:55:56 +0000 (14:55 +0000)]
ndp: fix signed/unsigned compariosn in the netlink code.

15 months agodtrace: Sync dis_tables.c with illumos
Mark Johnston [Tue, 21 Mar 2023 13:36:58 +0000 (09:36 -0400)]
dtrace: Sync dis_tables.c with illumos

This brings in the following commits:

    commit 584b574a3b16c6772c8204ec1d1c957c56f22a87
    12174 i86pc: variable may be used uninitialized
    Author: Toomas Soome <tsoome@me.com>
    Reviewed by: John Levon <john.levon@joyent.com>
    Reviewed by: Andrew Stormont <astormont@racktopsystems.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit a25e615d76804404e5fc63897a9196d4f92c3f5e
    12371 dis x86 EVEX prefix mishandled
    12372 dis EVEX encoding SIB mishandled
    12373 dis support for EVEX vaes instructions
    12374 dis support for EVEX vpclmulqdq instructions
    12375 dis support for gfni instructions
    Author: Robert Mustacchi <rm@fingolfin.org>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Approved by: Joshua M. Clulow <josh@sysmgr.org>

    commit c1e9bf00765d7ac9cf1986575e4489dd8710d9b1
    12369 dis WBNOINVD support
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit e4f6ce7088a7dd335b9edf4774325f888692e5fb
    10893 Need support for new Cascade Lake Instructions
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Dan McDonald <danmcd@joyent.com>
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Approved by: Gordon Ross <gwr@nexenta.com>

    commit cff040f3ef42d16ae655969398f5a5e6e700b85e
    10226 Need support for new EPYC ISA extensions
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Jason King <jason.king@joyent.com>
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit d242cdf5288b86d9070d88791c8ee696612becdc
    8492 AVX512 dis - legacy logical instructions
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit 81b505b772ab015c588c56bb116239ee549b6eee
    8384 AVX512 dis - EVEX prefix support
    8385 32-bit avx dis test mishandles EVEX prefix
    8386 32-bit bound dis is incorrect
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit 92381362ae635a3bea638d87b7119f1623b6212e
    8319 dis support for new xsave instructions
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit a4e73d5d60e566669c550027fae2b1d87b4be2b4
    8240 AVX512 dis - opmask instruction support
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Gordon Ross <gordon.w.ross@gmail.com>

    959b2dfd39979fe8a9a315a52741d009eb168822
    7825 want avx dis tests
    7826 PCLMULQDQ psuedo-ops aren't properly described in dis
    7827 dis tests for f16c, movbe, cpuid, msr, tsc, fence instrs
    7828 sysenter and sysexit dis should be allowed in 64-bit x86
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

MFC after: 2 weeks

15 months agocapsicum: Verify that openat("/", "..") fails with ENOTCAPABLE
Mark Johnston [Tue, 25 Apr 2023 13:54:47 +0000 (09:54 -0400)]
capsicum: Verify that openat("/", "..") fails with ENOTCAPABLE

Add a regression test for a718431c30a5 ("lookup(): ensure that
openat("/", "..", O_RESOLVE_BENEATH) fails").

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

15 months agotests: Add ATF_REQUIRE_SYSCTL_BOOL
Mark Johnston [Tue, 25 Apr 2023 13:54:23 +0000 (09:54 -0400)]
tests: Add ATF_REQUIRE_SYSCTL_BOOL

Modify a capability mode test to use it for kern.trap_enotcap, to avoid
false positives.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

15 months agoipfw: add [fw]mark implementation for ipfw
Boris Lytochkin [Tue, 25 Apr 2023 12:38:36 +0000 (12:38 +0000)]
ipfw: add [fw]mark implementation for ipfw

Packet Mark is an analogue to ipfw tags with O(1) lookup from mbuf while
regular tags require a single-linked list traversal.
Mark is a 32-bit number that can be looked up in a table
[with 'number' table-type], matched or compared with a number with optional
mask applied before comparison.
Having generic nature, Mark can be used in a variety of needs.
For example, it could be used as a security group: mark will hold a security
group id and represent a group of packet flows that shares same access
control policy.

Reviewed By: pauamma_gundo.com
Differential Revision: https://reviews.freebsd.org/D39555
MFC after: 1 month

15 months agonetlink: add netlink interfaces to if_clone
Alexander V. Chernikov [Wed, 19 Apr 2023 12:35:02 +0000 (12:35 +0000)]
netlink: add netlink interfaces to if_clone

This change adds netlink create/modify/dump interfaces to the `if_clone.c`.
The previous attempt with storing the logic inside `netlink/route/iface_drivers.c`
 did not quite work, as, for example, dumping interface-specific state
 (like vlan id or vlan parent) required some peeking into the private interfaces.

The new interfaces are added in a compatible way - callers don't have to do anything
unless they are extended with Netlink.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D39032
MFC after: 1 month

15 months agondp: convert ndp(8) to netlink.
Alexander V. Chernikov [Tue, 25 Apr 2023 12:30:39 +0000 (12:30 +0000)]
ndp: convert ndp(8) to netlink.

The change is intended to be fully transparent to the users.
Similarly to route(8) and netstat(8), ndp can be build without
  netlink by defining WITHOUT_NETLINK in make.conf.

 Differential Revision:  https://reviews.freebsd.org/D39720

15 months agoarp: remove forgotten debug message.
Alexander V. Chernikov [Tue, 25 Apr 2023 12:29:34 +0000 (12:29 +0000)]
arp: remove forgotten debug message.

15 months agonetlink: require proper privileges when adding neighbor.
Alexander V. Chernikov [Tue, 25 Apr 2023 12:28:22 +0000 (12:28 +0000)]
netlink: require proper privileges when adding neighbor.

MFC after: 3 days

15 months agonetlink: fix neighbour deleting for IPv6.
Alexander V. Chernikov [Tue, 25 Apr 2023 12:27:02 +0000 (12:27 +0000)]
netlink: fix neighbour deleting for IPv6.

MFC after: 2 weeks

15 months agoarp: convert arp(8) to netlink.
Alexander V. Chernikov [Tue, 25 Apr 2023 11:24:42 +0000 (11:24 +0000)]
arp: convert arp(8) to netlink.

The change is intended to be fully transparent to the users.
Similarly to route(8) and netstat(8), arp can be build without
 netlink by defining WITHOUT_NETLINK in make.conf.

Differential Revision: https://reviews.freebsd.org/D39720

15 months agonetlink: enable extended error reporting in snl(3).
Alexander V. Chernikov [Tue, 25 Apr 2023 11:20:35 +0000 (11:20 +0000)]
netlink: enable extended error reporting in snl(3).

MFC after: 2 weeks

15 months agoipfw.8: improve description for interface matching
Eugene Grosbein [Tue, 25 Apr 2023 11:12:11 +0000 (18:12 +0700)]
ipfw.8: improve description for interface matching

The manual describes "if*" form only while kernel uses fnmatch(3)
and allows use for more versatile shell-like patterns.
Note that explicitly and provide an example.

MFC after: 3 days

15 months agonetlink: add snl(3) support for dumping nexthops and neighbors
Alexander V. Chernikov [Tue, 25 Apr 2023 11:14:12 +0000 (11:14 +0000)]
netlink: add snl(3) support for dumping nexthops and neighbors

MFC after: 2 weeks

15 months agonetlink: add support for dumping kernel nexthops.
Alexander V. Chernikov [Tue, 25 Apr 2023 11:12:18 +0000 (11:12 +0000)]
netlink: add support for dumping kernel nexthops.

MFC after: 2 weeks

15 months agonetlink: allow creation of temporary lle entries.
Alexander V. Chernikov [Tue, 25 Apr 2023 11:08:47 +0000 (11:08 +0000)]
netlink: allow creation of temporary lle entries.

MFC after: 2 weeks

15 months agolltable: properly set expire time to 0 for static IPv4 entries.
Alexander V. Chernikov [Tue, 25 Apr 2023 10:59:50 +0000 (10:59 +0000)]
lltable: properly set expire time to 0 for static IPv4 entries.

MFC after: 2 weeks

15 months agonetlink: fix parameters in snl_attr_get_flag()
Alexander V. Chernikov [Tue, 25 Apr 2023 10:57:59 +0000 (10:57 +0000)]
netlink: fix parameters in snl_attr_get_flag()

MFC after: 2 weeks

15 months agonetlink: add nlattr_get_uint8() function to pack u8 attributes.
Alexander V. Chernikov [Tue, 25 Apr 2023 10:56:42 +0000 (10:56 +0000)]
netlink: add nlattr_get_uint8() function to pack u8 attributes.

MFC after: 2 weeks