]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
15 months agoDEBUG_VFS_LOCKS: restore diagnostic for the witness use case
Konstantin Belousov [Mon, 10 Apr 2023 08:52:43 +0000 (11:52 +0300)]
DEBUG_VFS_LOCKS: restore diagnostic for the witness use case

Reviewed by: jah, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39477

15 months agoAdd witness_is_owned(9)
Konstantin Belousov [Mon, 10 Apr 2023 15:54:58 +0000 (18:54 +0300)]
Add witness_is_owned(9)

which returns an indicator if the current thread owns the specified
lock.

Reviewed by: jah, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39477

15 months agovn_start_write(): consistently set *mpp to NULL on error or after failed sleep
Konstantin Belousov [Wed, 5 Apr 2023 21:00:04 +0000 (00:00 +0300)]
vn_start_write(): consistently set *mpp to NULL on error or after failed sleep

This ensures that *mpp != NULL iff vn_finished_write() should be
called, regardless of the returned error, except for V_NOWAIT.
The only exception that must be maintained is the case where
vn_start_write(V_NOWAIT) is called with the intent of later dropping
other locks and then doing vn_start_write(V_XSLEEP), which needs the mp
value calculated from the non-waitable call above it.

Also note that V_XSLEEP is not supported by vn_start_secondary_write().

Reviewed by: markj, mjg (previous version), rmacklem (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39441

15 months agovn_start_write(): minor style
Konstantin Belousov [Sun, 9 Apr 2023 22:41:12 +0000 (01:41 +0300)]
vn_start_write(): minor style

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39441

15 months agoimgact_binmisc: unbreak module build outside of kernel build environment
Eugene Grosbein [Tue, 11 Apr 2023 10:31:34 +0000 (17:31 +0700)]
imgact_binmisc: unbreak module build outside of kernel build environment

MFC after: 3 days

15 months agotelnet.1: Fix a typo in the manual page
Gordon Bergling [Tue, 11 Apr 2023 08:42:37 +0000 (10:42 +0200)]
telnet.1: Fix a typo in the manual page

- s/addreess/address/

MFC after: 3 days

15 months agobhyve: do not exit if LPC finds no host selector
Corvin Köhne [Wed, 29 Mar 2023 08:07:10 +0000 (10:07 +0200)]
bhyve: do not exit if LPC finds no host selector

The host selector is only required when the user likes to use the same
LPC device IDs as the physical LPC device. This is an uncommon use case.
For that reason, it makes no sense to exit when we don't find the host
selector.

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

15 months agonet80211: fail for unicast traffic without unicast key
domienschepers [Thu, 10 Nov 2022 00:00:00 +0000 (00:00 +0000)]
net80211: fail for unicast traffic without unicast key

Falling back to the multicast key may cause unicast traffic to leak.
Instead fail when no key is found.

For more information see the 'Framing Frames: Bypassing Wi-Fi Encryption
by Manipulating Transmit Queues' paper.

[ I updated the commit message to reference the paper and the code
comment to record historic behaviour as discussed in private email. ]

Security: CVE-2022-47522

15 months agodhclient: add ability to ignore options in offers
Rob Norris [Tue, 14 Mar 2023 22:07:18 +0000 (09:07 +1100)]
dhclient: add ability to ignore options in offers

A machine might exist on multiple networks, all of which offer, say, default
routes or name servers. There's no easy way to indicate in the config
that those options are only valid for a single interface.

Now, we can write:

    interface "lan0" {
      request routers;
      require routers;
    }
    interface "lan1" {
      ignore routers;
    }

And only take action on default routes offered on lan0.

Tested by: Jose Luis Duran <jlduran at gmail dot com>
MFC after: 2 months
Reviewed by: allanjude, imp
Sponsored by: Zenith Electronics LLC
Sponsored by: Klara, Inc.
Pull Request: #693

15 months agomakefs: set the validation entry system type
Ed Maste [Thu, 30 Mar 2023 14:31:45 +0000 (10:31 -0400)]
makefs: set the validation entry system type

Obtained from: NetBSD c3cb4dcc9c43
Sponsored by: The FreeBSD Foundation

15 months agomakefs: use size_t or ssize_t where appropriate
Ed Maste [Thu, 30 Mar 2023 02:04:16 +0000 (22:04 -0400)]
makefs: use size_t or ssize_t where appropriate

Obtained from: NetBSD af7bc97830ac

15 months agobsd-family-tree: add OpenBSD 7.3
Sergey A. Osokin [Mon, 10 Apr 2023 22:12:29 +0000 (18:12 -0400)]
bsd-family-tree: add OpenBSD 7.3

MFC after: 3 days

15 months agotcp: Rack - in the absence of LRO fixed rate pacing (loopback or interfaces with...
Randall Stewart [Mon, 10 Apr 2023 20:33:56 +0000 (16:33 -0400)]
tcp: Rack - in the absence of LRO fixed rate pacing (loopback or interfaces with no LRO) does not work correctly.

Rack is capable of fixed rate or dynamic rate pacing. Both of these can get mixed up when
LRO is not available. This is because LRO will hold off waking up the tcp connection to
processing the inbound packets until the pacing timer is up. Without LRO the pacing only
sort-of works. Sometimes we pace correctly, other times not so much.

This set of changes will make it so pacing works properly in the absence of LRO.

Reviewed by: tuexen
Sponsored by: Netflix Inc
Differential Revision:https://reviews.freebsd.org/D39494

15 months agomail: fix build if TIOCSTI is not defined
Ed Maste [Tue, 21 Mar 2023 01:01:55 +0000 (21:01 -0400)]
mail: fix build if TIOCSTI is not defined

Sponsored by: The FreeBSD Foundation

15 months agorack: mask and tclass are only used for INET6.
John Baldwin [Mon, 10 Apr 2023 19:21:03 +0000 (12:21 -0700)]
rack: mask and tclass are only used for INET6.

This fixes the LINT-NOINET6 build.

15 months agoprocfs: Sync a documentation comment with the code.
Joseph Koshy [Mon, 10 Apr 2023 17:11:16 +0000 (17:11 +0000)]
procfs: Sync a documentation comment with the code.

Approved by: gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D39488

15 months agosys: Enable -Wunused-but-set-variable for GCC.
John Baldwin [Mon, 10 Apr 2023 17:36:33 +0000 (10:36 -0700)]
sys: Enable -Wunused-but-set-variable for GCC.

It has been enabled for clang for a while now.

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

15 months agozfs: Appease set by unused warnings for spl_fstrans_*mark stubs.
John Baldwin [Mon, 10 Apr 2023 17:36:14 +0000 (10:36 -0700)]
zfs: Appease set by unused warnings for spl_fstrans_*mark stubs.

Use a void cast to mark the cookie value as used in spl_fstrans_unmark.

Reported by: GCC
Differential Revision: https://reviews.freebsd.org/D39357

15 months agoif_mos: Remove set but unused variable.
John Baldwin [Mon, 10 Apr 2023 17:35:48 +0000 (10:35 -0700)]
if_mos: Remove set but unused variable.

Reviewed by: hselasky
Reported by: GCC
Differential Revision: https://reviews.freebsd.org/D39356

15 months agolibalias: Mark set but unused variables as unused.
John Baldwin [Mon, 10 Apr 2023 17:35:29 +0000 (10:35 -0700)]
libalias: Mark set but unused variables as unused.

This function is clearly a stub, but it seems better to leave the stub
bits in place than to remove the function entirely.

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

15 months agoudf: Remove set but unused variable from udf_getattr.
John Baldwin [Mon, 10 Apr 2023 17:31:45 +0000 (10:31 -0700)]
udf: Remove set but unused variable from udf_getattr.

Reviewed by: emaste
Reported by: GCC
Differential Revision: https://reviews.freebsd.org/D39354

15 months agortw88: Silence unused but set warnings from GCC for debug.c.
John Baldwin [Mon, 10 Apr 2023 17:31:26 +0000 (10:31 -0700)]
rtw88: Silence unused but set warnings from GCC for debug.c.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D39353

15 months agoiwlwifi: Silence unused but set warnings from GCC for iwl-debug.c.
John Baldwin [Mon, 10 Apr 2023 17:31:07 +0000 (10:31 -0700)]
iwlwifi: Silence unused but set warnings from GCC for iwl-debug.c.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D39352

15 months agoipmi: Remove some dead code for unsupported BMCs.
John Baldwin [Mon, 10 Apr 2023 17:30:54 +0000 (10:30 -0700)]
ipmi: Remove some dead code for unsupported BMCs.

Reviewed by: emaste
Reported by: GCC
Differential Revision: https://reviews.freebsd.org/D39351

15 months agoprocfs: Document the content of /proc/$PID/map.
Joseph Koshy [Mon, 10 Apr 2023 15:14:12 +0000 (15:14 +0000)]
procfs: Document the content of /proc/$PID/map.

Approved by: gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D39484

15 months agoImplement GEOM::rotation_rate for gmirror
Alan Somers [Fri, 7 Apr 2023 16:07:50 +0000 (10:07 -0600)]
Implement GEOM::rotation_rate for gmirror

If all of the mirror's children have the same rotation rate, report
that.  But if they have mixed rotation rates, or if any child has an
unknown rotation rate, report "Unknown".

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D39458

15 months agoofw: fix memory leak in ofwbus_attach()
Christos Margiolis [Mon, 10 Apr 2023 15:31:46 +0000 (15:31 +0000)]
ofw: fix memory leak in ofwbus_attach()

PR: 269509
Reported by: Jaroslaw Pelczar <jarek@jpelczar.com>
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38903

15 months agodtrace: handle NOP instructions in the riscv invop handler
Christos Margiolis [Mon, 10 Apr 2023 15:30:48 +0000 (15:30 +0000)]
dtrace: handle NOP instructions in the riscv invop handler

This will be used by a forthcoming port of the kinst provider.

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

15 months agobridge: Add support for emulated netmap mode
Mark Johnston [Mon, 10 Apr 2023 15:18:25 +0000 (11:18 -0400)]
bridge: Add support for emulated netmap mode

if_bridge receives packets via a special interface, if_bridge_input,
rather than by if_input.  Thus, netmap's usual hooking of ifnet routines
does not work as expected.  Instead, modify bridge_input() to pass
packets directly to netmap when it is enabled.  This applies to both
locally delivered packets and forwarded packets.

When a netmap application transmits a packet by writing it to the host
TX ring, the mbuf chain is passed to if_input, which ordinarily points
to ether_input().  However, when transmitting via if_bridge,
bridge_input() needs to see the packet again in order to decide whether
to deliver or forward.  Thus, introduce a new protocol flag,
M_BRIDGE_INJECT, which 1) causes the packet to be passed to
bridge_input() again after Ethernet processing, and 2) avoids passing
the packet back to netmap.  The source MAC address of the packet is used
to determine the original "receiving" interface.

Reviewed by: vmaffione
MFC after: 2 months
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38066

15 months agomakefs: simplify filename conversion handling
Ed Maste [Fri, 31 Mar 2023 13:05:52 +0000 (09:05 -0400)]
makefs: simplify filename conversion handling

Obtained from: OpenBSD 4095a2e01d18
Sponsored by: The FreeBSD Foundation

15 months agoepair tests: test PCP tagged packets
Kristof Provost [Mon, 10 Apr 2023 10:55:10 +0000 (12:55 +0200)]
epair tests: test PCP tagged packets

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

15 months agoif_epair: also remove vlan metadata from mbufs
Kristof Provost [Mon, 10 Apr 2023 11:02:55 +0000 (13:02 +0200)]
if_epair: also remove vlan metadata from mbufs

We already remove mbuf tags from packets transitting an if_epair, but we
didn't remove vlan metadata.
In certain configurations this could lead to unexpected vlan tags
turning up on the rx side.

PR: 270736
Reviewed by: markj
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39482

15 months agomakefs: remove some unused cd9660 types and defines
Ed Maste [Thu, 30 Mar 2023 23:31:41 +0000 (19:31 -0400)]
makefs: remove some unused cd9660 types and defines

Obtained from: OpenBSD
Sponsored by: The FreeBSD Foundation

15 months agobridge.4: Document the net.link.bridge.log_mac_flap sysctl variable
Zhenlei Huang [Mon, 10 Apr 2023 10:07:04 +0000 (18:07 +0800)]
bridge.4: Document the net.link.bridge.log_mac_flap sysctl variable

It was introduced in 2d3614fb132b (bridge: Log MAC address port flapping).

Reviewed by: gbe (manpages)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39465

15 months agostress2: Update the exclude list
Peter Holm [Mon, 10 Apr 2023 08:03:22 +0000 (10:03 +0200)]
stress2: Update the exclude list

15 months agoDEBUG_VFS_LOCKS: use witness if available
Konstantin Belousov [Sat, 8 Apr 2023 06:15:00 +0000 (09:15 +0300)]
DEBUG_VFS_LOCKS: use witness if available

The assert_vop_locked messages are ignored, and file/line information
is not too useful. Fixing this without changing both witness and VFS
asserts KPIs is not possible.

Reviewed by: markj (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39464

15 months agonetlink: improve source ifa selection algorithm when adding routes.
Alexander V. Chernikov [Sun, 9 Apr 2023 13:30:45 +0000 (13:30 +0000)]
netlink: improve source ifa selection algorithm when adding routes.

Use route destination sockaddr when the gateway is eiter AF_LINK or
 has the different family (IPv4 over IPv6). This change ensures
 the nexthop IFA has the same family as the destination.

Reported by: Dmitriy Smirnov <fox@sage.su>
Tested by: Dmitriy Smirnov <fox@sage.su>
MFC after: 3 days

15 months agoroute: remove always-true expression
Alexander V. Chernikov [Sun, 9 Apr 2023 10:04:56 +0000 (10:04 +0000)]
route: remove always-true expression

15 months agonetlink: set prefix-related flags to the created nexthop.
Alexander V. Chernikov [Sun, 9 Apr 2023 09:26:12 +0000 (09:26 +0000)]
netlink: set prefix-related flags to the created nexthop.

This fixes incorrect flag combinations when adding IPv4/IPv6 host
routes.

MFC after: 3 days

15 months agonetlink: do not print "unknown sa family" warnings at the default debug
Alexander V. Chernikov [Sat, 8 Apr 2023 19:40:32 +0000 (19:40 +0000)]
netlink: do not print "unknown sa family" warnings at the default debug
level.

MFC after: 2 weeks

15 months agonetlink: fix !INET6 warning
Alexander V. Chernikov [Sat, 8 Apr 2023 19:39:37 +0000 (19:39 +0000)]
netlink: fix !INET6 warning

Reported by: Gary Jennejohn <garyj@gmx.de>
MFC after: 2 weeks

15 months agoroute: switch transport protocol to Netlink.
Alexander V. Chernikov [Sat, 8 Apr 2023 18:01:25 +0000 (18:01 +0000)]
route: switch transport protocol to Netlink.

All known bugs have been fixed, try to enable Netlink once again.

15 months agoBump __FreeBSD_version to 1400086 for vn_lock_pair arg change
Mateusz Guzik [Sat, 8 Apr 2023 17:31:01 +0000 (17:31 +0000)]
Bump __FreeBSD_version to 1400086 for vn_lock_pair arg change

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

15 months agousb(4): Separate the fast path and the slow path to avoid races and use-after-free...
Hans Petter Selasky [Fri, 31 Mar 2023 17:14:18 +0000 (19:14 +0200)]
usb(4): Separate the fast path and the slow path to avoid races and use-after-free for the USB FS interface.

Bad behaving user-space USB applicatoins may crash the kernel by issuing
USB FS related ioctl(2)'s out of their expected order. By default
the USB FS ioctl(2) interface is only available to the
administrator, root, and driver applications like webcamd(8) needs
to be hijacked in order for this to happen.

The issue is the fast-path code does not always see updates made
by the slow-path code, and may then work on freed memory.

This is easily fixed by using an EPOCH(9) type of synchronization
mechanism. A SX(9) lock will be used as a substitute for EPOCH(9),
due to the need for sleepability. In addition most calls going into
the fast-path originate from a single user-space process and the
need for multi-thread performance is not present.

Differential Revision: https://reviews.freebsd.org/D39373
Reviewed by: markj@
Reported by: C Turt <ecturt@gmail.com>
admbugs: 994
MFC after: 1 week
Sponsored by: NVIDIA Networking

15 months agousb(4): Code refactoring as a pre-step for adding missing synchronization mechanism.
Hans Petter Selasky [Tue, 4 Apr 2023 15:15:38 +0000 (17:15 +0200)]
usb(4): Code refactoring as a pre-step for adding missing synchronization mechanism.

Move code in switch cases into own functions to make later changes easier to track.

No functional change, except for removing a superfluous break statement when
range checking USB_FS_MAX_FRAMES, in the USB_FS_OPEN case.
It should not have been there at all.

Suggested by: emaste@
MFC after: 1 week
Sponsored by: NVIDIA Networking

15 months agoroute: fix netlink route operations with link-local gw / dst.
Alexander V. Chernikov [Sat, 8 Apr 2023 11:38:05 +0000 (11:38 +0000)]
route: fix netlink route operations with link-local gw / dst.

Extract ifindex from either gw or dst sockaddr and add it as a
 dedicated RTA_OIF attribute.

15 months agostress2: Tune MAXVNODES to avoid excessive run time
Peter Holm [Sat, 8 Apr 2023 07:19:23 +0000 (09:19 +0200)]
stress2: Tune MAXVNODES to avoid excessive run time

15 months agoopenzfs: adopt to the new vn_lock_pair() interface
Konstantin Belousov [Fri, 7 Apr 2023 23:37:20 +0000 (02:37 +0300)]
openzfs: adopt to the new vn_lock_pair() interface

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

15 months agovn_lock_pair(): allow to request shared locking
Konstantin Belousov [Thu, 6 Apr 2023 04:11:08 +0000 (07:11 +0300)]
vn_lock_pair(): allow to request shared locking

If either of vnodes is shared locked, lock must not be recursed.

Requested by: rmacklem
Reviewed by: markj, rmacklem
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39444

15 months agozfs: disable kernel fpu usage on arm and aarc64
Mateusz Guzik [Fri, 7 Apr 2023 21:44:49 +0000 (21:44 +0000)]
zfs: disable kernel fpu usage on arm and aarc64

It is not implemented and causes panics on boot.

This is a temporary measure until someone(tm) sorts it out.

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

15 months agovfs: extend vn_printf with vop vector
Mateusz Guzik [Fri, 7 Apr 2023 20:14:15 +0000 (20:14 +0000)]
vfs: extend vn_printf with vop vector

15 months agovfs: more informative panic for missing fplookup ops
Mateusz Guzik [Fri, 7 Apr 2023 19:48:33 +0000 (19:48 +0000)]
vfs: more informative panic for missing fplookup ops

15 months agoufs: add missing vop_fplookup ops to fifo vectors
Mateusz Guzik [Fri, 7 Apr 2023 20:05:58 +0000 (20:05 +0000)]
ufs: add missing vop_fplookup ops to fifo vectors

Reported-by: syzbot+a324b64ef9a933659c1c@syzkaller.appspotmail.com
15 months agonfscl: Fix support for doing Null RPCs
Rick Macklem [Fri, 7 Apr 2023 19:57:26 +0000 (12:57 -0700)]
nfscl: Fix support for doing Null RPCs

Although the NFS client does not currently perform Null RPCs,
this fix is needed if/when it might do so.
Found during testing of experimental code that uses Null RPCs
to maintain/monitor TCP connections for "nconnect" mounts.

MFC after: 3 months

15 months agonfsd: Add support for the SP4_MACH_CRED case in ExchangeID
Rick Macklem [Fri, 7 Apr 2023 19:49:23 +0000 (12:49 -0700)]
nfsd: Add support for the SP4_MACH_CRED case in ExchangeID

Commit f4179ad46fa4 added support for operation bitmaps for
NFSv4.1/4.2.  This commit uses those to implement the SP4_MACH_CRED
case for the NFSv4.1/4.2 ExchangeID operation since the Linux
NFSv4.1/4.2 client is now using this for Kerberized mounts.
The Linux Kerberized NFSv4.1/4.2 mounts currently work without
support for this because Linux will fall back to SP4_NONE,
but there is no guarantee this fallback will work forever.

This commit only affects Kerberized NFSv4.1/4.2 mounts from
Linux at this time.

MFC after: 3 months

15 months agotcp: pass tcpcb in the tfb_tcp_ctloutput() method instead of inpcb
Gleb Smirnoff [Fri, 7 Apr 2023 19:18:10 +0000 (12:18 -0700)]
tcp: pass tcpcb in the tfb_tcp_ctloutput() method instead of inpcb

Just matches rest of the KPI.

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

15 months agotcp: reduce argument list to functions that pass a segment
Gleb Smirnoff [Fri, 7 Apr 2023 19:18:05 +0000 (12:18 -0700)]
tcp: reduce argument list to functions that pass a segment

The socket argument is superfluous, as a tcpcb always has one and
only one socket.

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

15 months agotcp: retire tfb_tcp_hpts_do_segment()
Gleb Smirnoff [Fri, 7 Apr 2023 19:18:02 +0000 (12:18 -0700)]
tcp: retire tfb_tcp_hpts_do_segment()

Isn't in use anymore.  Correct comments that mention it.

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

15 months agonetinet tests: test carp source MAC address
Kristof Provost [Thu, 6 Apr 2023 16:10:27 +0000 (18:10 +0200)]
netinet tests: test carp source MAC address

Ensure that (multicast) CARP packets are sent with the expected source
MAC address.

Reviewed by: melifaro
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39454

15 months agozfs: try to fallback early if can't do optimized copy
Mateusz Guzik [Wed, 5 Apr 2023 20:42:28 +0000 (20:42 +0000)]
zfs: try to fallback early if can't do optimized copy

Not complete, but already shaves on some locking.

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

15 months agozfs: fix up EXDEV handling for clone_range
Mateusz Guzik [Wed, 5 Apr 2023 20:27:12 +0000 (20:27 +0000)]
zfs: fix up EXDEV handling for clone_range

API contract requires VOPs to handle EXDEV internally, worst case by
falling back to the generic copy routine. This broke with the recent
changes.

While here whack custom loop to lock 2 vnodes with vn_lock_pair, which
provides the same functionality internally. write start/finish around
it plays no role so got eliminated.

One difference is that vn_lock_pair always takes an exclusive lock on
both vnodes. I did not patch around it because current code takes an
exclusive lock on the target vnode. zfs supports shared-locking for
writes, so this serializes different calls to the routine as is, despite
range locking inside. At the same time you may notice the source vnode
can get some traffic if only shared-locked, thus once more this goes
the safer route of exclusive-locking. Note this should be patched to
use shared-locking for both once the feature is considered stable.

Technically the switch to vn_lock_pair should be a separate change, but
it would only introduce churn immediately whacked by the rest of the
patch.

[note: technically the review is still in progress, but so is the
active breakage]

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

15 months agobridge: Log MAC address port flapping
Zhenlei Huang [Fri, 7 Apr 2023 14:25:41 +0000 (22:25 +0800)]
bridge: Log MAC address port flapping

MAC flapping occurs when a bridge receives packets with the same source MAC
address on different member interfaces. The common reasons are:
 - user roams from one bridge port to another
 - user has wrong network setup, bridge loops e.g.
 - someone set duplicated ethernet address on his/her nic
 - some bad guy / virus / trojan send spoofed packets

if_bridge currently updates the bridge routing entry silently hence it is hard
to diagnose.

Emit logs when MAC address port flapping occurs to make it easier to diagnose.

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39375

15 months agoifconfig: Fix configuring if_bridge with additional operating parameters
Zhenlei Huang [Fri, 7 Apr 2023 14:25:41 +0000 (22:25 +0800)]
ifconfig: Fix configuring if_bridge with additional operating parameters

For clone create and rename operations, the interface name get back can be
different from the one passed to ioctl(). Use the interface name we get back
so that ifconfig will not return unexpected ENXIO.

PR: 270618
Reviewed by: kp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39396

15 months agotcp: misc cleanup of options for rack as well as socket option logging.
Randall Stewart [Fri, 7 Apr 2023 14:15:29 +0000 (10:15 -0400)]
tcp: misc cleanup of options for rack as well as socket option logging.

Both BBR and Rack have the ability to log socket options, which is currently disabled. Rack
has an experimental SaD (Sack Attack Detection) algorithm that should be made available. Also
there is a t_maxpeak_rate that needs to be removed (its un-used).

Reviewed by: tuexen, cc
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D39427

15 months agoFix style.
Ganbold Tsagaankhuu [Fri, 7 Apr 2023 03:18:42 +0000 (03:18 +0000)]
Fix style.

15 months agoImprove RK3568 pcie phy handling codes a bit.
Ganbold Tsagaankhuu [Fri, 7 Apr 2023 02:54:13 +0000 (02:54 +0000)]
Improve RK3568 pcie phy handling codes a bit.

Move phy bifurcation code to a separate function
that can be called during the attach phase.
Also initialize both pcie lanes accordingly.

15 months agozfsd: add support for hotplugging spares
Alan Somers [Wed, 5 Apr 2023 20:30:43 +0000 (14:30 -0600)]
zfsd: add support for hotplugging spares

If you remove an unused spare and then reinsert it, zfsd will now online
it in all pools.

Do not MFC without 2a58b312b62 (but it's ok to MFC that one without this
one).

Submitted by: Ameer Hamza <ahamza@ixsystems.com> (zfsd), Me (tests)
MFC after: 2 weeks
MFC with: 2a58b312b62f908ec92311d1bd8536dbaeb8e55b
Sponsored by: iX Systems, Axcient
Pull Request: https://github.com/freebsd/freebsd-src/pull/697

15 months agomakefs: avoid uninitialized memory in root directory date
Ed Maste [Thu, 6 Apr 2023 16:53:00 +0000 (12:53 -0400)]
makefs: avoid uninitialized memory in root directory date

Move date setting into cd9660_populate_iso_dir_record so there is no
path that leaves it unset.

PR: 203531
Reported by: Thomas Schmitt <scdbackup@gmx.net>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39258

15 months agoMark EENTRY as .text
Andrew Turner [Thu, 6 Apr 2023 15:36:15 +0000 (16:36 +0100)]
Mark EENTRY as .text

To allow it to be used before ENTRY we need to ensure the symbol is
in the .text section. It also needs to be aligned correctly.

While here mark the symbol type as a function as in the ENTRY macro.

Reported by: jrtc27
Sponsored by: Arm Ltd

15 months agovfs: validate that a mount point with FPLOOKUP has vop_fplookup ops
Mateusz Guzik [Wed, 5 Apr 2023 23:10:34 +0000 (23:10 +0000)]
vfs: validate that a mount point with FPLOOKUP has vop_fplookup ops

15 months agovfs: only allow doomed vnodes to return EOPNOTSUPP for fplookup vops
Mateusz Guzik [Wed, 3 Nov 2021 21:02:35 +0000 (22:02 +0100)]
vfs: only allow doomed vnodes to return EOPNOTSUPP for fplookup vops

This helps asserting that they are provided by filesystems indicating
they do it.

15 months agovfs: validate that vop vectors provide all or none fplookup vops
Mateusz Guzik [Wed, 3 Nov 2021 20:26:41 +0000 (21:26 +0100)]
vfs: validate that vop vectors provide all or none fplookup vops

In order to prevent later susprises.

15 months agodeadfs: consistently return EOPNOTSUPP for fplookup vops
Mateusz Guzik [Wed, 3 Nov 2021 21:04:16 +0000 (22:04 +0100)]
deadfs: consistently return EOPNOTSUPP for fplookup vops

15 months agovfs: add missing vop_fplookup ops to syncer
Mateusz Guzik [Thu, 6 Apr 2023 13:52:20 +0000 (13:52 +0000)]
vfs: add missing vop_fplookup ops to syncer

15 months agovfs: whack spurious comments from syncer's vop_vector
Mateusz Guzik [Thu, 6 Apr 2023 13:51:16 +0000 (13:51 +0000)]
vfs: whack spurious comments from syncer's vop_vector

15 months agoufs: add missing vop_fplookup ops
Mateusz Guzik [Thu, 6 Apr 2023 13:45:48 +0000 (13:45 +0000)]
ufs: add missing vop_fplookup ops

15 months agozfs: add missing vop_fplookup_vexec assignments
Mateusz Guzik [Wed, 3 Nov 2021 20:25:01 +0000 (21:25 +0100)]
zfs: add missing vop_fplookup_vexec assignments

This happens to be a nop right now.

15 months agowpa_supplicant/hostapd: Fix uninitialized packet pointer on error
Cy Schubert [Thu, 6 Apr 2023 04:07:15 +0000 (21:07 -0700)]
wpa_supplicant/hostapd: Fix uninitialized packet pointer on error

The packet pointer (called packet) will remain uninitialized when
pcap_next_ex() returns an error. This occurs when the wlan
interface is shut down using ifconfig destroy. Adding a NULL
assignment to packet duplicates what pcap_next() does.

The reason we use pcap_next_ex() in this instance is because with
pacp_next() when we receive a null pointer if there was an error
or if no packets were read. With pcap_next_ex() we can differentiate
between an error and legitimately no packets were received.

PR: 270649
Reported by: Robert Morris <rtm@lcs.mit.edu>
Fixes: 6e5d01124fd4
MFC after: 3 days

15 months agollvm-objcopy: link man page as strip.1 when WITH_LLVM_BINUTILS is set
Ed Maste [Wed, 5 Apr 2023 15:07:14 +0000 (11:07 -0400)]
llvm-objcopy: link man page as strip.1 when WITH_LLVM_BINUTILS is set

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39429

15 months agopci_vendors: update to 2023.04.01
Baptiste Daroussin [Thu, 6 Apr 2023 12:58:42 +0000 (14:58 +0200)]
pci_vendors: update to 2023.04.01

15 months agomakefs(8): do not print comma after the last super-block
Christos Margiolis [Wed, 5 Apr 2023 22:25:19 +0000 (18:25 -0400)]
makefs(8): do not print comma after the last super-block

Reviewed by: markj, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39430

15 months agonetmap: Handle packet batches in generic mode
Mark Johnston [Wed, 5 Apr 2023 20:52:41 +0000 (16:52 -0400)]
netmap: Handle packet batches in generic mode

ifnets are allowed to pass batches of multiple packets to if_input,
linked by the m_nextpkt pointer.  iflib_rxeof() sometimes does this, for
example.  Netmap's generic mode did not handle this and would only
deliver the first packet in the batch, leaking the rest.

PR: 270636
Reviewed by: vmaffione
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39426

15 months agopmc: Keep a list sorted.
Joseph Koshy [Wed, 5 Apr 2023 18:36:55 +0000 (19:36 +0100)]
pmc: Keep a list sorted.

Approved by: gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D39439

15 months agomakefs: remove CD9660MAXPATH #define
Ed Maste [Fri, 31 Mar 2023 16:57:15 +0000 (12:57 -0400)]
makefs: remove CD9660MAXPATH #define

It was used only in constructing the host path that contains file
content, which is not related to anything CD9660-specific.  PATH_MAX is
the appropriate limit.  See OpenBSD commit 299d8950f319.

Obtained from: OpenBSD
Sponsored by: The FreeBSD Foundation

15 months agosrc.conf.5: Expand WITH_LLVM_BINUTILS description
Ed Maste [Wed, 5 Apr 2023 15:21:26 +0000 (11:21 -0400)]
src.conf.5: Expand WITH_LLVM_BINUTILS description

List the specific tools that are controlled by WITH_LLVM_BINUTILS, and
mention the tools that are always or never taken from LLVM.  Tools come
from one of three sources (LLVM, ELF Tool Chain, bespoke base system)
and it is useful to be explicit.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39428

15 months agonetmap: Fix queue stalls with generic interfaces
Mark Johnston [Wed, 5 Apr 2023 16:12:30 +0000 (12:12 -0400)]
netmap: Fix queue stalls with generic interfaces

In emulated mode, the FreeBSD netmap port attempts to perform zero-copy
transmission.  This works as follows: the kernel ring is populated with
mbuf headers to which netmap buffers are attached.  When transmitting,
the mbuf refcount is initialized to 2, and when the counter value has
been decremented to 1 netmap infers that the driver has freed the mbuf
and thus transmission is complete.

This scheme does not generalize to the situation where netmap is
attaching to a software interface which may transmit packets among
multiple "queues", as is the case with bridge or lagg interfaces.  In
that case, we would be relying on backing hardware drivers to free
transmitted mbufs promptly, but this isn't guaranteed; a driver may
reasonably defer freeing a small number of transmitted buffers
indefinitely.  If such a buffer ends up at the tail of a netmap transmit
ring, further transmits can end up blocked indefinitely.

Fix the problem by removing the zero-copy scheme (which is also not
implemented in the Linux port of netmap).  Instead, the kernel ring is
populated with regular mbuf clusters into which netmap buffers are
copied by nm_os_generic_xmit_frame().  The refcounting scheme is
preserved, and this lets us avoid allocating a fresh cluster per
transmitted packet in the common case.  If the transmit ring is full, a
callout is used to free the "stuck" mbuf, avoiding the queue deadlock
described above.

Furthermore, when recycling mbuf clusters, be sure to fully reinitialize
the mbuf header instead of simply re-setting M_PKTHDR.  Some software
interfaces, like if_vlan, may set fields in the header which should be
reset before the mbuf is reused.

Reviewed by: vmaffione
MFC after: 1 month
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38065

15 months agomlx5ib(4): Mark driver knows net epoch
Zhenlei Huang [Wed, 5 Apr 2023 16:06:15 +0000 (00:06 +0800)]
mlx5ib(4): Mark driver knows net epoch

This driver has already been EPOCH(9) aware since e48813009c6a.

Reviewed by: hselasky
Tested by: hselasky
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39406

15 months agoinfiniband: Opt-in for net epoch
Zhenlei Huang [Wed, 5 Apr 2023 16:05:02 +0000 (00:05 +0800)]
infiniband: Opt-in for net epoch

This is counterpart to e87c4940156c, which did the same for ethernet.

Suggested by: hselasky
Reviewed by: hselasky, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39405

15 months agonetisr: Remove the now-unused NETISR_EPAIR queue index
Mark Johnston [Wed, 5 Apr 2023 15:40:45 +0000 (11:40 -0400)]
netisr: Remove the now-unused NETISR_EPAIR queue index

No functional change intended.

Fixes: 3dd5760aa5f8 ("if_epair: rework")
MFC after: 1 week
Sponsored by: Klara, Inc.

15 months agosrc.conf.5: regen for WITHOUT_NETLINK_SUPPORT
Ed Maste [Wed, 5 Apr 2023 15:39:32 +0000 (11:39 -0400)]
src.conf.5: regen for WITHOUT_NETLINK_SUPPORT

Commit 64dfea86515e added a description for WITHOUT_NETLINK_SUPPORT.

15 months agobridge: Try to make the GRAB_OUR_PACKETS macro a bit more readable
Mark Johnston [Wed, 5 Apr 2023 14:37:00 +0000 (10:37 -0400)]
bridge: Try to make the GRAB_OUR_PACKETS macro a bit more readable

- Let the compiler use constant folding to eliminate conditionals.
- Fix some inconsistent whitespace.

No functional change intended.

Reviewed by: zlei
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38410

15 months agotcp_hpts: plug a compiler warn
Mateusz Guzik [Wed, 5 Apr 2023 14:32:13 +0000 (14:32 +0000)]
tcp_hpts: plug a compiler warn

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

15 months agozfs: fix null ap->a_fsizetd NULL pointer derefernce
Martin Matuska [Wed, 5 Apr 2023 07:30:15 +0000 (09:30 +0200)]
zfs: fix null ap->a_fsizetd NULL pointer derefernce

Submitted by: rmacklem
Reported by: cy
Tested by: cy, mm
Reviewed by: pjd, mm
Differential revision: https://reviews.freebsd.org/D39418

15 months agobhyve: introduce acpi_device_emul struct
Corvin Köhne [Fri, 22 Jul 2022 08:00:10 +0000 (10:00 +0200)]
bhyve: introduce acpi_device_emul struct

It'll be easier to add new properties to the ACPI device emulation if we
have a struct which holds all device specific properties. In some future
commits the acpi_device_emul struct will be expanded to include some
device specific functions to build ACPI tables.

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

15 months agoChange kqueue1() to be compatible with NetBSD
Konstantin Belousov [Fri, 31 Mar 2023 22:31:41 +0000 (01:31 +0300)]
Change kqueue1() to be compatible with NetBSD

by making it accept some open(2) flags.  More precisely, only
O_CLOEXEC is supported, the flag is translated into the KQUEUE_CLOEXEC flag
for kqueuex(2), and O_NONBLOCK is silently ignored.

Reported and tested by: vishwin
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39377

15 months agorack: fix build on powerpc
Gleb Smirnoff [Tue, 4 Apr 2023 23:35:36 +0000 (16:35 -0700)]
rack: fix build on powerpc

15 months agolinux(4): Implement close_range over native
Dmitry Chagin [Tue, 4 Apr 2023 20:24:04 +0000 (23:24 +0300)]
linux(4): Implement close_range over native

Handling of the CLOSE_RANGE_UNSHARE flag is not implemented due to
difference in fd unsharing mechanism in the Linux and FreeBSD.

Reviewed by: mjg
Differential revision: https://reviews.freebsd.org/D39398
MFC after: 2 weeks

15 months agolinux(4): Regen for close_range syscall
Dmitry Chagin [Tue, 4 Apr 2023 20:23:37 +0000 (23:23 +0300)]
linux(4): Regen for close_range syscall

MFC after: 2 weeks

15 months agolinux(4): Modify close_range syscall to match Linux
Dmitry Chagin [Tue, 4 Apr 2023 20:23:24 +0000 (23:23 +0300)]
linux(4): Modify close_range syscall to match Linux

MFC after: 2 weeks

15 months agoUpdate rack to the latest code used at NF.
Randall Stewart [Tue, 4 Apr 2023 20:05:46 +0000 (16:05 -0400)]
Update rack to the latest code used at NF.

There have been many changes to rack over the last couple of years, including:
     a) Ability when switching stacks to have one stack query another.
     b) Internal use of micro-second timers instead of ticks.
     c) Many changes to pacing in forms of
        1) Improvements to Dynamic Goodput Pacing (DGP)
        2) Improvements to fixed rate paciing
        3) A new feature called hybrid pacing where the requestor can
           get a combination of DGP and fixed rate pacing with deadlines
           for delivery that can dynamically speed things up.
     d) All kinds of bugs found during extensive testing and use of the
        rack stack for streaming video and in fact all data transferred
        by NF

Reviewed by: glebius, gallatin, tuexen
Sponsored By: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D39402