]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agorun(4): add support for ASUS USB-N14 wireless adaptor.
Dmitry Chagin [Sat, 22 May 2021 10:52:12 +0000 (13:52 +0300)]
run(4): add support for ASUS USB-N14 wireless adaptor.

PR: 255759
Submitted by: john.lmurdoch at gmail.com
MFC After: 1 week

3 years agonullfs: dirty v_object must imply the need for inactivation
Konstantin Belousov [Fri, 21 May 2021 07:30:19 +0000 (10:30 +0300)]
nullfs: dirty v_object must imply the need for inactivation

Otherwise pages are cleaned some time later when the lower fs decides
that it is time to do it.  This mostly manifests itself as delayed
mtime update, e.g. breaking make-like programs.

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

3 years agovn_need_pageq_flush(): simplify
Konstantin Belousov [Fri, 21 May 2021 07:34:27 +0000 (10:34 +0300)]
vn_need_pageq_flush(): simplify

There is no need to own vnode interlock, since v_object is type stable
and can only change to/from NULL, and no other checks in the function
access fields protected by the interlock.  Remove the need variable, the
result of the test is directly usable as return value.

Tested by: mav, pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoRefactor core dumping code a bit
Edward Tomasz Napierala [Sat, 22 May 2021 08:58:35 +0000 (09:58 +0100)]
Refactor core dumping code a bit

This makes it possible to use core_write(), core_output(),
and sbuf_drain_core_output(), in Linux coredump code.  Moving
them out of imgact_elf.c is necessary because of the weird way
it's being built.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30369

3 years agocxgbe(4): Fix build warnings with NOINET kernels.
Navdeep Parhar [Sat, 22 May 2021 03:42:04 +0000 (20:42 -0700)]
cxgbe(4): Fix build warnings with NOINET kernels.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26334

3 years agopkt-gen: Allow limiting received packets
Allan Jude [Mon, 17 May 2021 23:04:08 +0000 (23:04 +0000)]
pkt-gen: Allow limiting received packets

Makes pkg-gen quit after having received N packets, the same way it
already supports doing for sent packets.

Reviewed by: vmaffione
Sponsored by: Klara Inc.
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D30266

3 years agoNetmap: fix documentation for NR_REG_NIC_SW mode
Allan Jude [Mon, 17 May 2021 23:07:53 +0000 (23:07 +0000)]
Netmap: fix documentation for NR_REG_NIC_SW mode

The correct character to add to the intername name is *, not +

Reviewed by: vmaffione, bcr
Sponsored By: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D30324

3 years agorack: honor prior socket buffer lock when doing the upcall
Richard Scheffenegger [Fri, 21 May 2021 22:08:56 +0000 (00:08 +0200)]
rack: honor prior socket buffer lock when doing the upcall

While partially reverting D24237 with D29690, due to introducing some
unintended effects for in-kernel TCP consumers, the preexisting lock
on the socket send buffer was not considered properly.

Found by: markj
MFC after: 2 weeks
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D30390

3 years agoFix handling of errors from pru_send(PRUS_NOTREADY)
Mark Johnston [Fri, 21 May 2021 21:44:46 +0000 (17:44 -0400)]
Fix handling of errors from pru_send(PRUS_NOTREADY)

PRUS_NOTREADY indicates that the caller has not yet populated the chain
with data, and so it is not ready for transmission.  This is used by
sendfile (for async I/O) and KTLS (for encryption).  In particular, if
pru_send returns an error, the caller is responsible for freeing the
chain since other implicit references to the data buffers exist.

For async sendfile, it happens that an error will only be returned if
the connection was dropped, in which case tcp_usr_ready() will handle
freeing the chain.  But since KTLS can be used in conjunction with the
regular socket I/O system calls, many more error cases - which do not
result in the connection being dropped - are reachable.  In these cases,
KTLS was effectively assuming success.

So:
- Change sosend_generic() to free the mbuf chain if
  pru_send(PRUS_NOTREADY) fails.  Nothing else owns a reference to the
  chain at that point.
- Similarly, in vn_sendfile() change the !async I/O && KTLS case to free
  the chain.
- If async I/O is still outstanding when pru_send fails in
  vn_sendfile(), set an error in the sfio structure so that the
  connection is aborted and the mbuf chain is freed.

Reviewed by: gallatin, tuexen
Discussed with: jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30349

3 years agotcp: Make error handling in tcp_usr_send() more consistent
Mark Johnston [Fri, 21 May 2021 21:44:40 +0000 (17:44 -0400)]
tcp: Make error handling in tcp_usr_send() more consistent

- Free the input mbuf in a single place instead of in every error path.
- Handle PRUS_NOTREADY consistently.
- Flush the socket's send buffer if an implicit connect fails.  At that
  point the mbuf has already been enqueued but we don't want to keep it
  in the send buffer.

Reviewed by: gallatin, tuexen
Discussed with: jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30349

3 years agoimport nvi 2.2.0-3bbdfe4
Baptiste Daroussin [Fri, 21 May 2021 20:50:50 +0000 (22:50 +0200)]
import nvi 2.2.0-3bbdfe4

3 years agoFix fsck_ufs segfaults with gjournal (SU+J)
Kirk McKusick [Fri, 21 May 2021 20:41:40 +0000 (13:41 -0700)]
Fix fsck_ufs segfaults with gjournal (SU+J)

The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.c)
while attempting to traverse the buffer cache to flush dirty buffers.
The tail queue used for the buffer cache was not initialized before
dropping into gjournal_check(). Move the buffer initialization earlier
so that it has been done before calling gjournal_check().

Reported by:  crypt47, nvass
Fix by:       Robert Wing
Tested by:    Robert Wing
PR:           255030
PR:           255979
MFC after:    3 days
Sponsored by: Netflix

3 years agobhyve/snapshot: split up mutex/cond initialization from socket creation
Robert Wing [Sat, 15 May 2021 19:58:21 +0000 (11:58 -0800)]
bhyve/snapshot: split up mutex/cond initialization from socket creation

Move initialization of the mutex/condition variables required by the
save/restore feature to their own function.

The unix domain socket that facilitates communication between bhyvectl
and bhyve doesn't rely on these variables in order to be functional.

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D30281

3 years agommc: Only build mmc_fdt_helper and mmc_pwrseq for arch that uses ext_resources
Emmanuel Vadot [Fri, 21 May 2021 17:35:20 +0000 (19:35 +0200)]
mmc: Only build mmc_fdt_helper and mmc_pwrseq for arch that uses ext_resources

This is now a needed requirement and fixes powerpc* build

3 years agoldconfig(8): update manpage to reality
Konstantin Belousov [Sat, 15 May 2021 05:12:35 +0000 (08:12 +0300)]
ldconfig(8): update manpage to reality

ELF ldconfig only maintains the search list, there is no hints

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

3 years agodwmmc: Add bus_generic_add_child in the methods
Emmanuel Vadot [Sun, 16 May 2021 15:07:50 +0000 (17:07 +0200)]
dwmmc: Add bus_generic_add_child in the methods

Otherwise sdiob cannot add it's children.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30295

3 years agoarm: allwinner: aw_mmc: Check regulators status before enabling/disabling them
Emmanuel Vadot [Sun, 16 May 2021 14:24:31 +0000 (16:24 +0200)]
arm: allwinner: aw_mmc: Check regulators status before enabling/disabling them

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30294

3 years agoextres: regulator: Fix regulator_status for already enable regulators
Emmanuel Vadot [Sun, 16 May 2021 14:21:43 +0000 (16:21 +0200)]
extres: regulator: Fix regulator_status for already enable regulators

If a regulator hasn't been enable by a driver but is enabled in hardware
(most likely enabled by U-Boot), regulator_status will returns that it
is enabled and so any call to regulator_disable will panic as it wasn't
enabled by one of our drivers.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30293

3 years agommc: dwmmc: Call mmc_fdt_set_power
Emmanuel Vadot [Sun, 16 May 2021 14:20:42 +0000 (16:20 +0200)]
mmc: dwmmc: Call mmc_fdt_set_power

This allow us to powerup/down the card and enabling/disabling the
regulators if any.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30292

3 years agommc_fdt_helper: Add mmc_fdt_set_power
Emmanuel Vadot [Sun, 16 May 2021 14:18:46 +0000 (16:18 +0200)]
mmc_fdt_helper: Add mmc_fdt_set_power

This helper can be used to enable/disable the regulator and starting
the power sequence of sd/sdio/eMMC cards.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30291

3 years agoarm64: allwinner: axp81x: Add support for regnode_status
Emmanuel Vadot [Sun, 16 May 2021 14:14:47 +0000 (16:14 +0200)]
arm64: allwinner: axp81x: Add support for regnode_status

This method is used to know if a regulator is enabled or not.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30290

3 years agommc_fdt_helpers: Parse the optional pwrseq element.
Emmanuel Vadot [Sun, 16 May 2021 12:50:10 +0000 (14:50 +0200)]
mmc_fdt_helpers: Parse the optional pwrseq element.

If a sd/emmc node have a pwrseq property parse it and get the corresponding
driver.
This can later be used to powerup/powerdown the SDIO card or eMMC.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30289

3 years agommc: Add mmc-pwrseq driver
Emmanuel Vadot [Sun, 16 May 2021 12:48:56 +0000 (14:48 +0200)]
mmc: Add mmc-pwrseq driver

This driver is used to power up sdio card or eMMC.
It handle the reset-gpio, clocks and needed delays for powerup/powerdown.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30288

3 years agoarm64: rockchip: gpio: Give friendlier name to gpio
Emmanuel Vadot [Sun, 16 May 2021 12:47:16 +0000 (14:47 +0200)]
arm64: rockchip: gpio: Give friendlier name to gpio

By default name the gpio P<bank><bankpin>
This make it easier to find the gpio when reading schematics or DTS.

Sponsored by: Diablotin Systems
Differential Revision: https://reviews.freebsd.org/D30287

3 years agommccam: Add two new XPT for MMC and use them in mmc_sim and sdhci
Emmanuel Vadot [Thu, 29 Apr 2021 15:48:49 +0000 (17:48 +0200)]
mmccam: Add two new XPT for MMC and use them in mmc_sim and sdhci

For the discovery phase of SD/eMMC we need to do some transaction in a async
way.
The classic CAM XPT_{GET,SET}_TRAN_SETTING cannot be used in a async way.
This also allow us to split the discovery phase into a more complete state
machine and we don't mtx_sleep with a random number to wait for completion
of the tasks.
For mmc_sim we now do the SET_TRAN_SETTING in a taskqueue so we can call
the needed function for regulators/clocks without the cam lock(s). This part is
still needed to be done for sdhci.
We also now save the host OCR in the discovery phase as it wasn't done before and
only worked because the same ccb was reused.

Reviewed by: imp, kibab, bz
Differential Revision: https://reviews.freebsd.org/D30038

3 years agoscsi(4): fix "NMVe" typo
Mitchell Horne [Fri, 21 May 2021 14:50:15 +0000 (11:50 -0300)]
scsi(4): fix "NMVe" typo

3 years agoDisable stack gap for ntpd during build.
Marcin Wojtas [Fri, 21 May 2021 09:29:22 +0000 (11:29 +0200)]
Disable stack gap for ntpd during build.

When starting, ntpd calls setrlimit(2) to limit maximum size of its
stack. The stack limit chosen by ntpd is 200K, so when stack gap
is enabled, the stack gap is larger than this limit, which results
in ntpd crashing.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: cy, imp
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D29553

3 years agoAdd elfctl to toolchain.
Marcin Wojtas [Fri, 21 May 2021 09:27:27 +0000 (11:27 +0200)]
Add elfctl to toolchain.

Add elfctl program to toolchain to allow modifying ELF feature flags
during system build.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D29552

3 years agoAdd afterbuild target to bsd.prog.mk.
Marcin Wojtas [Fri, 21 May 2021 09:23:42 +0000 (11:23 +0200)]
Add afterbuild target to bsd.prog.mk.

Afterbuild target allows to perform operations on fully built binary.
This is needed to allow for ELF feature flags modification during
world build.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: imp
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D29551

3 years agousr.bin/elfctl: Allow for cross-endian operations.
Marcin Wojtas [Fri, 21 May 2021 09:19:31 +0000 (11:19 +0200)]
usr.bin/elfctl: Allow for cross-endian operations.

Detect if host endian is different than target endian and swap
byte order of ELF note fields instead of failing.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: imp
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D29550

3 years agoFix for use-after-free by if_ioctl() calls from user-space in USB drivers by
Hans Petter Selasky [Tue, 12 Jan 2021 17:51:09 +0000 (18:51 +0100)]
Fix for use-after-free by if_ioctl() calls from user-space in USB drivers by
detaching the ifnet before the miibus.

PR: 252608
Suggested by: jhb@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoThere is a window where threads are removed from the process list and where
Hans Petter Selasky [Fri, 21 May 2021 11:17:42 +0000 (13:17 +0200)]
There is a window where threads are removed from the process list and where
the thread destructor is invoked. Catch that window by waiting for all
task_struct allocations to be returned before freeing the UMA zone in the
LinuxKPI. Else UMA may fail to release the zone due to concurrent access
and panic:

panic() - Bad link element prev->next != elm
zone_release()
bucket_drain()
bucket_free()
zone_dtor()
zone_free_item()
uma_zdestroy()
linux_current_uninit()

This failure can be triggered by loading and unloading the LinuxKPI module
in a loop:

while true
do
kldload linuxkpi
kldunload linuxkpi
done

Discussed with: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agotest/libalias: Tests for outgoing NAT
Lutz Donnerhacke [Mon, 17 May 2021 21:49:31 +0000 (23:49 +0200)]
test/libalias: Tests for outgoing NAT

Testing LibAliasOut functionality. This concentrates the typical use
case of initiating data transfers from the inside.  Provide a
exhaustive test for the data structure in order to check for
performance improvements.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30335

3 years agoAccessing the epoch structure should happen after the INIT_CHECK().
Hans Petter Selasky [Fri, 21 May 2021 09:06:27 +0000 (11:06 +0200)]
Accessing the epoch structure should happen after the INIT_CHECK().
Else the epoch pointer may be NULL.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoProperly define EPOCH(9) function macro.
Hans Petter Selasky [Fri, 21 May 2021 08:22:13 +0000 (10:22 +0200)]
Properly define EPOCH(9) function macro.

No functional change intended.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoRework for-loop in EPOCH(9) to reduce indentation level.
Hans Petter Selasky [Fri, 21 May 2021 08:20:34 +0000 (10:20 +0200)]
Rework for-loop in EPOCH(9) to reduce indentation level.

No functional change intended.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMake sure all tasklets are drained before unloading the LinuxKPI.
Hans Petter Selasky [Fri, 21 May 2021 06:52:59 +0000 (08:52 +0200)]
Make sure all tasklets are drained before unloading the LinuxKPI.
Else use-after-free may happen.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years ago[tcp] Keep socket buffer locked until upcall
Richard Scheffenegger [Fri, 21 May 2021 09:00:53 +0000 (11:00 +0200)]
[tcp] Keep socket buffer locked until upcall

r367492 would unlock the socket buffer before eventually calling the upcall.
This leads to problematic interaction with NFS kernel server/client components
(MP threads) accessing the socket buffer with potentially not correctly updated
state.

Reported by: rmacklem
Reviewed By: tuexen, #transport
Tested by: rmacklem, otis
MFC after: 2 weeks
Sponsored By: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29690

3 years agotcp: Fix sending of TCP segments with IP level options
Michael Tuexen [Fri, 21 May 2021 07:45:00 +0000 (09:45 +0200)]
tcp: Fix sending of TCP segments with IP level options

When bringing in TCP over UDP support in
https://cgit.FreeBSD.org/src/commit/?id=9e644c23000c2f5028b235f6263d17ffb24d3605,
the length of IP level options was considered when locating the
transport header. This was incorrect and is fixed by this patch.

X-MFC with: https://cgit.FreeBSD.org/src/commit/?id=9e644c23000c2f5028b235f6263d17ffb24d3605
MFC after: 3 days
Reviewed by: markj, rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D30358

3 years agocam: clear on-stack CCBs in last few drivers
Edward Tomasz Napierala [Fri, 21 May 2021 07:48:27 +0000 (08:48 +0100)]
cam: clear on-stack CCBs in last few drivers

This changes ahc(4), ahd(4), hptiop(4), hptnr(4), hptrr(4),
and ps3cdrom(4).

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30305

3 years agoarcmsr: clear CCB allocated on the stack
Edward Tomasz Napierala [Fri, 21 May 2021 07:21:45 +0000 (08:21 +0100)]
arcmsr: clear CCB allocated on the stack

Reviewed By: delphij, imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30304

3 years agoisci: clear CCBs allocated on the stack
Edward Tomasz Napierala [Fri, 21 May 2021 07:10:15 +0000 (08:10 +0100)]
isci: clear CCBs allocated on the stack

Reviewed By: gallatin, imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30303

3 years agompt: clear CCBs allocated on the stack
Edward Tomasz Napierala [Fri, 21 May 2021 06:58:49 +0000 (07:58 +0100)]
mpt: clear CCBs allocated on the stack

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30302

3 years agompr, mps: clear CCBs allocated on the stack
Edward Tomasz Napierala [Fri, 21 May 2021 06:42:08 +0000 (07:42 +0100)]
mpr, mps: clear CCBs allocated on the stack

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30301

3 years agopms(4): clear CCBs allocated on the stack
Edward Tomasz Napierala [Fri, 21 May 2021 06:28:46 +0000 (07:28 +0100)]
pms(4): clear CCBs allocated on the stack

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30300

3 years agolinux: refactor bsd_to_linux_regset() out of linux_ptrace.c
Edward Tomasz Napierala [Fri, 21 May 2021 06:22:25 +0000 (07:22 +0100)]
linux: refactor bsd_to_linux_regset() out of linux_ptrace.c

This will be used for Linux coredump support.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30365

3 years agoip_mroute: remove unused declarations
Wojciech Macek [Fri, 21 May 2021 06:01:26 +0000 (08:01 +0200)]
ip_mroute: remove unused declarations

fix build for non-x86 targets

3 years agoip_mroute: refactor bw_meter API
Wojciech Macek [Wed, 5 May 2021 03:28:56 +0000 (05:28 +0200)]
ip_mroute: refactor bw_meter API

API should work as following:
- periodicaly report Lower-or-EQual bandwidth (LEQ) connections
  over kernel socket, if user application registered for such
  per-flow notifications
- report Grater-or-EQual (GEQ) bandwidth as soon as it reaches
  specified value in configured time window

Custom implementation of callouts was removed. There is no
point of doing calout-wheel here as generic callouts are
doing exactly the same. The performance is not critical
for such reporting, so the biggest concern should be
to have a code which can be easily maintained.

This is ia preparation for locking rework which is highly inefficient.

Approved by:    mw
Sponsored by:   Stormshield
Obtained from:  Semihalf
Differential Revision:  https://reviews.freebsd.org/D30210

3 years agonfsd: Add support for CLAIM_DELEG_PREV_FH to the NFSv4.1/4.2 Open
Rick Macklem [Fri, 21 May 2021 01:37:40 +0000 (18:37 -0700)]
nfsd: Add support for CLAIM_DELEG_PREV_FH to the NFSv4.1/4.2 Open

Commit b3d4c70dc60f added support for CLAIM_DELEG_CUR_FH to Open.
While doing this, I noticed that CLAIM_DELEG_PREV_FH support
could be added the same way.  Although I am not aware of any extant
NFSv4.1/4.2 client that uses this claim type, it seems prudent to add
support for this variant of Open to the NFSv4.1/4.2 server.

This patch does not affect mounts from extant NFSv4.1/4.2 clients,
as far as I know.

MFC after: 2 weeks

3 years agokldxref: do not error out if specified path is not directory, for -d mode
Konstantin Belousov [Thu, 20 May 2021 19:12:11 +0000 (22:12 +0300)]
kldxref: do not error out if specified path is not directory, for -d mode

kldxref(8) is the only tool that can dump FreeBSD kernel module
metadata, with the -d option. But the command line requirements for that
are inconvenient, since parser requires that argv[1] is a directory
containing whole set of modules to generate xref file.

For -d, allow argv[0] to be a regular file, now it is possible to do e.g.
   $ kldxref -d /boot/kernel/ufs.ko
to see only ufs.ko metadata.

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

3 years agohda: correct comment about Asus laptop digital mics
Philippe Michaud-Boudreault [Wed, 19 May 2021 14:32:25 +0000 (10:32 -0400)]
hda: correct comment about Asus laptop digital mics

Reported in review D30333

MFC after: 1 week

3 years agomd5: portability fix -- include stdbool.h explicitly
Warner Losh [Thu, 20 May 2021 17:26:46 +0000 (11:26 -0600)]
md5: portability fix -- include stdbool.h explicitly

stdbool.h needs to be included to use type bool variables. Due to
namespace pollution, this gets brought in on FreeBSD, but not on
other systems. Include it explicilty.

Noticed by: arichards@
Sponsored by: Netflix

3 years agoiscsi: Move the maximum data segment limits into 'struct icl_conn'.
John Baldwin [Thu, 20 May 2021 16:59:11 +0000 (09:59 -0700)]
iscsi: Move the maximum data segment limits into 'struct icl_conn'.

This fixes a few bugs in iSCSI backends where the backends were using
the limits they advertised initially during the login phase as the
final values instead of the values negotiated with the other end.

Reported by: Jithesh Arakkan @ Chelsio
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D30271

3 years agoiscsi: Always free a cdw before its associated ctl_io.
John Baldwin [Thu, 20 May 2021 16:58:59 +0000 (09:58 -0700)]
iscsi: Always free a cdw before its associated ctl_io.

cxgbei stores state about a target transfer in the ctl_private[] array
of a ctl_io that is freed when a target transfer (represented by the
cdw) is freed.  As such, freeing a ctl_io before a cdw that references
it can result in a use after free in cxgbei.  Two of the four places
freed the cdw first, and the other two freed the ctl_io first.  Fix
the latter two places to free the cdw first.

Reported by: Jithesh Arakkan @ Chelsio
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D30270

3 years agoufs: Avoid M_WAITOK allocations when building a dirhash
Don Morris [Thu, 20 May 2021 14:54:38 +0000 (10:54 -0400)]
ufs: Avoid M_WAITOK allocations when building a dirhash

At this point the directory's vnode lock is held, so blocking while
waiting for free pages makes the system more susceptible to deadlock in
low memory conditions.  This is particularly problematic on NUMA systems
as UMA currently implements a strict first-touch policy.

ufsdirhash_build() already uses M_NOWAIT for other allocations and
already handled failures for the block array allocation, so just convert
to M_NOWAIT.

PR: 253992
Reviewed by: markj, mckusick, vangyzen
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29045

3 years agopfctl tests: Test fairq configuration
Kristof Provost [Wed, 19 May 2021 07:52:50 +0000 (09:52 +0200)]
pfctl tests: Test fairq configuration

We used to have a bug where pfctl could crash setting fairq queues. Test
this case and ensure it does not crash pfctl.

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

3 years agopfctl: Ensure parent queue is configured for FAIRQ
Kristof Provost [Tue, 18 May 2021 16:22:13 +0000 (18:22 +0200)]
pfctl: Ensure parent queue is configured for FAIRQ

We failed to account for the FAIRQ scheduler in expand_altq(), which led
it to be set up without its parent queue.

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

3 years agopfctl: Fix crash on ALTQ configuration
Kristof Provost [Tue, 18 May 2021 13:03:01 +0000 (15:03 +0200)]
pfctl: Fix crash on ALTQ configuration

The following config could crash pfctl:
altq on igb0 fairq bandwidth 1Gb queue { qLink }
queue qLink fairq(default)

That happens because when we're parsing the parent queue (on igb0) it
doesn't have a parent, and the check in eval_pfqueue_fairq() checks
pa->parent rather than parent.

This was changed in eval_pfqueue_hfsc() in
1d34c9dac8624c5c315ae39ad3ae8e5879b23256, but not for fairq.

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

3 years agopf tests: Test the ability to kill floating states by interface
Kristof Provost [Thu, 13 May 2021 08:04:20 +0000 (10:04 +0200)]
pf tests: Test the ability to kill floating states by interface

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

3 years agopf: Support killing floating states by interface
Kristof Provost [Thu, 13 May 2021 07:51:28 +0000 (09:51 +0200)]
pf: Support killing floating states by interface

Floating states get assigned to interface 'all' (V_pfi_all), so when we
try to flush all states for an interface states originally created
through this interface are not flushed. Only if-bound states can be
flushed in this way.

Given that we track the original interface we can check if the state's
interface is 'all', and if so compare to the orig_if instead.

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

3 years agopf: Track the original kif for floating states
Kristof Provost [Wed, 12 May 2021 11:24:57 +0000 (13:24 +0200)]
pf: Track the original kif for floating states

Track (and display) the interface that created a state, even if it's a
floating state (and thus uses virtual interface 'all').

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

3 years agopfctl: Use DIOCGETSTATESNV
Kristof Provost [Mon, 10 May 2021 14:51:38 +0000 (16:51 +0200)]
pfctl: Use DIOCGETSTATESNV

Migrate to using the new nvlist-based DIOCGETSTATESNV call to obtain the
states list.

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

3 years agopf: Add DIOCGETSTATESNV
Kristof Provost [Wed, 5 May 2021 19:00:16 +0000 (21:00 +0200)]
pf: Add DIOCGETSTATESNV

Add DIOCGETSTATESNV, an nvlist-based alternative to DIOCGETSTATES.

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

3 years agopf: Add DIOCGETSTATENV
Kristof Provost [Wed, 5 May 2021 12:33:55 +0000 (14:33 +0200)]
pf: Add DIOCGETSTATENV

Add DIOCGETSTATENV, an nvlist-based alternative to DIOCGETSTATE.

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

3 years agoRevert "ip_mroute: refactor bw_meter API"
Wojciech Macek [Thu, 20 May 2021 10:14:58 +0000 (12:14 +0200)]
Revert "ip_mroute: refactor bw_meter API"

This reverts commit d1cd99b147411b331a9bff659533780ef297ef58.

3 years agoRename ofwpci.c to ofw_pcib.c
Marcin Wojtas [Wed, 19 May 2021 15:27:42 +0000 (17:27 +0200)]
Rename ofwpci.c to ofw_pcib.c

It's a class0 driver that implements some pcib methods and creates
a pci bus as its children.
The "ofw_pci" name will be used by a new driver that will be a subclass
of the pci bus.
No functional changes intended.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: andrew
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30226

3 years agosdhci_fsl_fdt: Skip vccq reconfiguration without regulator
Marcin Wojtas [Thu, 20 May 2021 09:16:40 +0000 (11:16 +0200)]
sdhci_fsl_fdt: Skip vccq reconfiguration without regulator

There is no need to preform any voltage reconfiguration
in case the vccq regulator is not physically attached to the
slot.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30355

3 years agosys/*/conf/*, docs: fix links to handbook
Ceri Davies [Thu, 20 May 2021 08:26:02 +0000 (09:26 +0100)]
sys/*/conf/*, docs: fix links to handbook

While here, fix all links to older en_US.ISO8859-1 documentation
in the src/ tree.

PR:             255026
Reported by:    Michael Büker <freebsd@michael-bueker.de>
Reviewed by:    dbaio
Approved by:    blackend (mentor), re (gjb)
MFC after:      10 days
Differential Revision: https://reviews.freebsd.org/D30265

3 years agoip_mroute: refactor bw_meter API
Wojciech Macek [Wed, 5 May 2021 03:28:56 +0000 (05:28 +0200)]
ip_mroute: refactor bw_meter API

API should work as following:
- periodicaly report Lower-or-EQual bandwidth (LEQ) connections
  over kernel socket, if user application registered for such
  per-flow notifications
- report Grater-or-EQual (GEQ) bandwidth as soon as it reaches
  specified value in configured time window

Custom implementation of callouts was removed. There is no
point of doing calout-wheel here as generic callouts are
doing exactly the same. The performance is not critical
for such reporting, so the biggest concern should be
to have a code which can be easily maintained.

This is ia preparation for locking rework which is highly inefficient.

Approved by:    mw
Sponsored by:   Stormshield
Obtained from:  Semihalf
Differential Revision:  https://reviews.freebsd.org/D30210

3 years agorc.d: connect sysctl_lastload
Eugene Grosbein [Thu, 20 May 2021 04:51:31 +0000 (11:51 +0700)]
rc.d: connect sysctl_lastload

Add recently added sysctl_lastload.

3 years agocxgbei: Add tunable sysctls for the FirstBurstLength and MaxBurstLength.
John Baldwin [Wed, 19 May 2021 22:56:54 +0000 (15:56 -0700)]
cxgbei: Add tunable sysctls for the FirstBurstLength and MaxBurstLength.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D30269

3 years agocxgbei: Remove unused sysctls.
John Baldwin [Wed, 19 May 2021 22:56:45 +0000 (15:56 -0700)]
cxgbei: Remove unused sysctls.

These were seemingly copied over from icl_soft.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D30268

3 years agocxgbe: Fix some merge-o's for the per-rxq iSCSI counters.
John Baldwin [Wed, 19 May 2021 22:56:31 +0000 (15:56 -0700)]
cxgbe: Fix some merge-o's for the per-rxq iSCSI counters.

I botched a few of the changes when rebasing the changes in
4b6ed0758dc6fad17081d7bd791cb0edbddbddb8 across the changes in
43bbae19483fbde0a91e61acad8a6e71e334c8b8.

- Move the counter allocations into alloc_ofld_rxq().

- Free the counters freeing an ofld rxq.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D30267

3 years agoalc(4): add support for Mikrotik 10/25G NIC
Konstantin Belousov [Wed, 19 May 2021 22:14:18 +0000 (01:14 +0300)]
alc(4): add support for Mikrotik 10/25G NIC

The new Mikrotik 10/25G NIC is mostly compatible with AR8151 hardware,
with few exceptions:

* card supports only 32bit DMA operations
* card does not support write-one-to-clear semantics for interrupt status
  register
* MDIO operations can take longer to complete

This patch adds support for Mikrotik 10/25G NIC to the alc driver
while maintaining support for all earlier HW.

The patch was tested with FreeBSD main branch as of commit
f4b38c360e63a6e66245efedbd6c070f9c0aee55

This was tested on Intel i7-4790K system with Mikrotik 10/25G NIC.
This was tested on Intel i7-4790K system with RB44Ge (AR8151 based 4-port NIC)
to verify backwards compatibility.

PR: 256000
Submitted by:  Gatis Peisenieks  <gatis@mikrotik.com>
MFC after: 1 week

3 years agocam_sim: add doxygen to cam_sim_alloc_dev
Warner Losh [Sun, 16 May 2021 15:37:26 +0000 (09:37 -0600)]
cam_sim: add doxygen to cam_sim_alloc_dev

cam_sim_alloc_dev was overlooked when cam_sim_alloc was documented.
Add doxygen docs for it, pointing at cam_sim_alloc.

Sponsored by: Netflix

3 years agonfscl: Fix NFSv4.1/4.2 mount recovery from an expired lease
Rick Macklem [Wed, 19 May 2021 21:52:56 +0000 (14:52 -0700)]
nfscl: Fix NFSv4.1/4.2 mount recovery from an expired lease

The most difficult NFSv4 client recovery case happens when the
lease has expired on the server.  For NFSv4.0, the client will
receive a NFSERR_EXPIRED reply from the server to indicate this
has happened.
For NFSv4.1/4.2, most RPCs have a Sequence operation and, as such,
the client will receive a NFSERR_BADSESSION reply when the lease
has expired for these RPCs.  The client will then call nfscl_recover()
to handle the NFSERR_BADSESSION reply.  However, for the expired lease
case, the first reclaim Open will fail with NFSERR_NOGRACE.

This patch recognizes this case and calls nfscl_expireclient()
to handle the recovery from an expired lease.

This patch only affects NFSv4.1/4.2 mounts when the lease
expires on the server, due to a network partitioning that
exceeds the lease duration or similar.

MFC after: 2 weeks

3 years agoFix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode".
Kirk McKusick [Wed, 19 May 2021 21:38:21 +0000 (14:38 -0700)]
Fix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode".

Pass 1b of fsck_ffs runs only when Pass 1 has found duplicate blocks.
Pass 1 only knows that a block is duplicate when it finds the second
instance of its use. The role of Pass 1b is to find the first use
of all the duplicate blocks. It makes a pass over the cylinder groups
looking for these blocks. When moving to the next cylinder group,
Pass 1b failed to properly calculate the starting inode number for
the cylinder group resulting in the above error message when it
tried to read the first inode in the cylinder group.

Reported by:  Px
Tested by:    Px
PR:           255979
MFC after:    3 days
Sponsored by: Netflix

3 years agobsd-family-tree: Add NetBSD 9.2
Warner Losh [Wed, 19 May 2021 21:29:11 +0000 (15:29 -0600)]
bsd-family-tree: Add NetBSD 9.2

NetBSD 9.2 was released on May 12, 2021

Submitted by: Martin Husemann
Sponsored by: Netflix

3 years agotcsh: update to version 6.22.04.
Dmitry Chagin [Wed, 19 May 2021 21:12:27 +0000 (00:12 +0300)]
tcsh: update to version 6.22.04.

Merge commit '174d8b60324d7e8754709f7155e13ca95220b48c' into main.

MFC After: 2 weeks

3 years agotcsh: cleanup source tree to reduce diff size.
Dmitry Chagin [Wed, 19 May 2021 21:08:25 +0000 (00:08 +0300)]
tcsh: cleanup source tree to reduce diff size.

Remove makefiles, configure files and unused at build time files
to reduce the diff size. Otherwise the diff contains a lot of
unnecessary lines what makes reviewing and merging proccess so hard,
especially for re@.

MFC after: 2 weeks

3 years agoi2c(8): Add interpreted mode for batch/scripted i2c operations
Poul-Henning Kamp [Wed, 19 May 2021 18:56:59 +0000 (18:56 +0000)]
i2c(8): Add interpreted mode for batch/scripted i2c operations

3 years agoi2c(8): Change default mode to "transfer", which should work everywhere¹
Poul-Henning Kamp [Wed, 19 May 2021 18:48:28 +0000 (18:48 +0000)]
i2c(8): Change default mode to "transfer", which should work everywhere¹

¹ According to @ian

3 years agoi2c(8): Polish: sort switches, dont confuse address & offset
Poul-Henning Kamp [Wed, 19 May 2021 18:47:32 +0000 (18:47 +0000)]
i2c(8): Polish: sort switches, dont confuse address & offset

3 years agofdescfs: allow shared locking of root vnode
Mateusz Guzik [Wed, 19 May 2021 15:59:20 +0000 (17:59 +0200)]
fdescfs: allow shared locking of root vnode

Eliminates fdescfs from lock profile when running poudriere.

3 years agopseudofs: use vget_prep + vget_finish instead of vget + the interlock
Mateusz Guzik [Wed, 19 May 2021 14:20:23 +0000 (14:20 +0000)]
pseudofs: use vget_prep + vget_finish instead of vget + the interlock

3 years agomd5: Create md5sum, etc compatible programs
Warner Losh [Wed, 19 May 2021 17:26:20 +0000 (11:26 -0600)]
md5: Create md5sum, etc compatible programs

On Linux, there's a similar set of programs to ours, but that end in the
letters 'sum'. These act basically like FreeBSD versions run with the -r
option. Add code so that when the program ends in 'sum' you get the
linux -r behavior. This is enough to make most things that use sha*sum
work correctly (the -c / --check options, as well as the long args are
not implemented). When running with the -sum programs, ignore -t instead
of running internal speed tests and make -c an error.

Reviewed by: sef, and kp and allanjude (earlier version)
Relnotes: yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30309

3 years agoFix packet cbs/ebs conversion.
Alexander Motin [Wed, 19 May 2021 15:00:21 +0000 (11:00 -0400)]
Fix packet cbs/ebs conversion.

Each packet is counted as 128 bytes by the code, not 125.  Not sure
what I was thinking about here 14 years ago.  May be just a typo.

Reported by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

3 years agorc.d: unbreak sysctl lastload
Eugene Grosbein [Wed, 19 May 2021 13:02:31 +0000 (20:02 +0700)]
rc.d: unbreak sysctl lastload

/etc/rc.d/securelevel is supposed to run /etc/rc.d/sysctl lastload
late at boot time to apply /etc/sysctl.conf settings that fail
to apply early. However, this does not work in default configuration
because of kern_securelevel_enable="NO" by default.

Add new script /etc/rc.d/sysctl lastload that starts unconditionally.

Reported by: Marek Zarychta
MFC after: 1 month

3 years agoarm64: rockchip, implement the two rk805/808 clocks
Bjoern A. Zeeb [Thu, 6 May 2021 14:25:52 +0000 (14:25 +0000)]
arm64: rockchip, implement the two rk805/808 clocks

While the xin32k clk was implemented in rk3399_cru as a fixed rate
clock, migrate it to rk805 as we will also need the 2nd clock
'rtc_clko_wifi' for SDIO and BT.
Both clocks remain fixed rate, and while the 1st one is always on
(though that is not expressed in the clk framework), the 2nd one
we can toggle on/off.

Reviewed-by: manu
Tested-by: manu
MFC-after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26870

3 years agoimport nvi 2.2.0-3bbdfe4
Baptiste Daroussin [Wed, 19 May 2021 11:35:56 +0000 (13:35 +0200)]
import nvi 2.2.0-3bbdfe4

3 years agostress2: Added a new "mdconfig -o force" test scenario
Peter Holm [Wed, 19 May 2021 06:22:09 +0000 (08:22 +0200)]
stress2: Added a new "mdconfig -o force" test scenario

3 years agocxgbe(4): Remove some dead code.
Navdeep Parhar [Wed, 19 May 2021 06:16:03 +0000 (23:16 -0700)]
cxgbe(4): Remove some dead code.

MFC after: 3 days

3 years agonfsd: Reduce the callback timeout to 800msec
Rick Macklem [Tue, 18 May 2021 23:17:58 +0000 (16:17 -0700)]
nfsd: Reduce the callback timeout to 800msec

Recent discussion on the nfsv4@ietf.org mailing list confirmed
that an NFSv4 server should reply to an RPC in less than 1second.
If an NFSv4 RPC requires a delegation be recalled,
the server will attempt a CB_RECALL callback.
If the client is not responsive, the RPC reply will be delayed
until the callback times out.
Without this patch, the timeout is set to 4 seconds (set in
ticks, but used as seconds), resulting in the RPC reply taking over 4sec.
This patch redefines the constant as being in milliseconds and it
implements that for a value of 800msec, to ensure the RPC
reply is sent in less than 1second.

This patch only affects mounts from clients when delegations
are enabled on the server and the client is unresponsive to callbacks.

MFC after: 2 weeks

3 years agonfsd: Add support for CLAIM_DELEG_CUR_FH to the NFSv4.1/4.2 Open
Rick Macklem [Tue, 18 May 2021 22:53:54 +0000 (15:53 -0700)]
nfsd: Add support for CLAIM_DELEG_CUR_FH to the NFSv4.1/4.2 Open

The Linux NFSv4.1/4.2 client now uses the CLAIM_DELEG_CUR_FH
variant of the Open operation when delegations are recalled and
the client has a local open of the file.  This patch adds
support for this variant of Open to the NFSv4.1/4.2 server.

This patch only affects mounts from Linux clients when delegations
are enabled on the server.

MFC after: 2 weeks

3 years agoDo not forward datagrams originated by link-local addresses
Zhenlei Huang [Tue, 18 May 2021 20:51:37 +0000 (22:51 +0200)]
Do not forward datagrams originated by link-local addresses

The current implement of ip_input() reject packets destined for
169.254.0.0/16, but not those original from 169.254.0.0/16 link-local
addresses.

Fix to fully respect RFC 3927 section 2.7.

PR: 255388
Reviewed by: donner, rgrimes, karels
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29968

3 years agong_parse: IP address parsing in netgraph eating too many characters
Markus Stoff [Tue, 18 May 2021 20:35:33 +0000 (22:35 +0200)]
ng_parse: IP address parsing in netgraph eating too many characters

Once the final component of the IP address has been parsed, the offset
on the input must not be advanced, as this would remove an unparsed
character from the input.

Submitted by: Markus Stoff
Reviewed by: donner
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D26489

3 years agotest/libalias: Tests for instantiation
Lutz Donnerhacke [Sun, 16 May 2021 21:37:37 +0000 (23:37 +0200)]
test/libalias: Tests for instantiation

In order to modify libalias for performance, the existing
functionality must not change.  Enforce this.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30307

3 years agosocket: Release cred reference later in sodealloc()
Lv Yunlong [Tue, 18 May 2021 19:23:15 +0000 (15:23 -0400)]
socket: Release cred reference later in sodealloc()

We dereference so->so_cred to update the per-uid socket buffer
accounting, so the crfree() call must be deferred until after that
point.

PR: 255869
MFC after: 1 week

3 years agodummynet: Fix mbuf tag allocation failure handling
Mark Johnston [Tue, 18 May 2021 19:22:21 +0000 (15:22 -0400)]
dummynet: Fix mbuf tag allocation failure handling

PR: 255875, 255878, 255879, 255880
Reviewed by: donner, kp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30318

3 years agottydev_write: prevent stops while terminal is busied
Konstantin Belousov [Thu, 13 May 2021 01:35:06 +0000 (04:35 +0300)]
ttydev_write: prevent stops while terminal is busied

Since busy state is checked by all blocked writes, stopping a process
which waits in ttydisc_write() causes cascade.  Utilize sigdeferstop()
to avoid the issue.

Submitted by: Jakub Piecuch <j.piecuch96@gmail.com>
PR: 255816
MFC after: 1 week