]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agounbount: Vendor import 1.14.0rc1
Cy Schubert [Fri, 3 Dec 2021 06:11:04 +0000 (22:11 -0800)]
unbount: Vendor import 1.14.0rc1

This vendor import was requested by glebius@ as it should fix unbound
crashes.

Reported by: glebius
MFC after: 1 week

2 years agounbound: Vendor import 1.14.0rc1
Cy Schubert [Fri, 3 Dec 2021 05:35:06 +0000 (21:35 -0800)]
unbound: Vendor import 1.14.0rc1

This vendor import was requested by glebius@ as it should fix unbound
crashes.

Reported by: glebius

2 years agotcp_drain(): initialize the inpcb iterator when curvnet is set
Gleb Smirnoff [Fri, 3 Dec 2021 05:08:30 +0000 (21:08 -0800)]
tcp_drain(): initialize the inpcb iterator when curvnet is set

Reported by: cy
Pointy hat to: glebius
Fixes: de2d47842e88

2 years agoudp_detach(): fix set but not used warning
Gleb Smirnoff [Fri, 3 Dec 2021 04:12:40 +0000 (20:12 -0800)]
udp_detach(): fix set but not used warning

2 years agoudp_multi_input(): the UDP header is only needed for probes
Gleb Smirnoff [Fri, 3 Dec 2021 04:12:40 +0000 (20:12 -0800)]
udp_multi_input(): the UDP header is only needed for probes

Reported by: kib
Fixes: de2d47842e88

2 years agoxhci: add PCI IDs for USB controllers found on Supermicro M12SWA-TF
Gleb Smirnoff [Fri, 3 Dec 2021 04:12:33 +0000 (20:12 -0800)]
xhci: add PCI IDs for USB controllers found on Supermicro M12SWA-TF

2 years agofusefs: better debugging for FUSE_RENAME in the tests
Alan Somers [Fri, 3 Dec 2021 03:26:27 +0000 (20:26 -0700)]
fusefs: better debugging for FUSE_RENAME in the tests

MFC after: 2 weeks

2 years agoOnly use OLD_LIBS with shared libraries.
John Baldwin [Fri, 3 Dec 2021 01:30:00 +0000 (17:30 -0800)]
Only use OLD_LIBS with shared libraries.

Use OLD_FILES for a few symbolic links and static libraries previously
included in OLD_LIBS.

Add a missing shared library major number to an old libroken entry.

2 years agostyle.mdoc: Prefer Ql to Dq Li for literal display
Mateusz Piotrowski [Thu, 2 Dec 2021 11:39:45 +0000 (12:39 +0100)]
style.mdoc: Prefer Ql to Dq Li for literal display

The Li macros has been deprecated by mdoc some time ago. Recommend the
use of Ql instead.

Reviewed by: debdrup
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33232

2 years agoOptionalObsoleteFiles.inc: Add rc.d/zfskeys
Herbert J. Skuhra [Fri, 3 Dec 2021 00:44:55 +0000 (01:44 +0100)]
OptionalObsoleteFiles.inc: Add rc.d/zfskeys

While here, sort the etc/rc.d entries.

PR: 256483
Reviewed by: allanjude
Approved by: allanjude (src)
MFC after: 3 days
Sponsored by: Modirum MDPay
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D33238

2 years agowpa: Redo import wpa_supplicant/hostapd commit 14ab4a816
Cy Schubert [Thu, 2 Dec 2021 23:00:32 +0000 (15:00 -0800)]
wpa: Redo import wpa_supplicant/hostapd commit 14ab4a816

This is the November update to vendor/wpa committed upstream 2021-11-26.

MFC after: 1 month

2 years agoAPEI: Improve multiple error sources handling.
Alexander Motin [Thu, 2 Dec 2021 23:01:02 +0000 (18:01 -0500)]
APEI: Improve multiple error sources handling.

Some AMD systems I have report 8 NMI and 3591 polled error sources.
Previous code could handle only one NMI source and used separate
callout for each polled source.  New code can handle multiple NMIs
and groups polled sources by power of 2 of the polling period.

MFC after: 2 weeks

2 years agoprocstat_getfiles_sysctl: do not require non-null ki_fd
Konstantin Belousov [Thu, 2 Dec 2021 18:03:01 +0000 (20:03 +0200)]
procstat_getfiles_sysctl: do not require non-null ki_fd

ki_fd is legitimately NULL when 32bit process requests process data
from 64bit host kernel.  The field is not used by the code for sysctl
case;  procstat_getfiles_kvm() checks ki_fd.

PR: 260174
Reported by: Damjan Jovanovic <damjan.jov@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoStyle
Konstantin Belousov [Thu, 2 Dec 2021 18:02:26 +0000 (20:02 +0200)]
Style

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoRevert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816"
Cy Schubert [Thu, 2 Dec 2021 22:45:04 +0000 (14:45 -0800)]
Revert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816"

This reverts commit 266f97b5e9a7958e365e78288616a459b40d924a, reversing
changes made to a10253cffea84c0c980a36ba6776b00ed96c3e3b.

A mismerge of a merge to catch up to main resulted in files being
committed which should not have been.

2 years agowpa: Import wpa_supplicant/hostapd commit 14ab4a816
Cy Schubert [Thu, 2 Dec 2021 21:35:14 +0000 (13:35 -0800)]
wpa: Import wpa_supplicant/hostapd commit 14ab4a816

This is the November update to vendor/wpa committed upstream 2021-11-26.

MFC after:      1 month

2 years agomps(4): Fix unmatched devq release.
Warner Losh [Thu, 2 Dec 2021 20:53:44 +0000 (13:53 -0700)]
mps(4): Fix unmatched devq release.

Port 9781c28c6d63 and a8837c77efd0 to the mps driver.  Before this
change devq was frozen only if some command was sent to the target after
reset started, but release was called always.  This change freezes the
devq immediately, leaving mprsas_action_scsiio() check only to cover
race condition due to different lock devq use.

This should also avoid unnecessary requeue of the commands, creating
additional log noise and confusing some broken apps. It also avoids a
'busy' requeue of I/Os failing when we're doing recovery that takes
longer than the normal busy timeout. These I/Os failing can lead to
filesystems being unmounted in the force unmount case for I/O errors.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D33228

2 years agoip_input: remove pointless check in INP_RECVIF handling
Gleb Smirnoff [Thu, 2 Dec 2021 19:15:04 +0000 (11:15 -0800)]
ip_input: remove pointless check in INP_RECVIF handling

An mbuf rcvif pointer is supposed to be valid and doesn't
need extra checks.  The code appeared in d314ad7b73639.

2 years agorc: Hook zfskeys to the build
Mateusz Piotrowski [Mon, 29 Nov 2021 15:13:09 +0000 (16:13 +0100)]
rc: Hook zfskeys to the build

Reviewed by: allanjude
Approved by: allanjude (src)
MFC after: 3 days
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D33230

2 years agoepoch: with EPOCH_TRACE add epoch_where_report()
Gleb Smirnoff [Thu, 2 Dec 2021 18:59:43 +0000 (10:59 -0800)]
epoch: with EPOCH_TRACE add epoch_where_report()
which will report where the epoch was entered and also
mark the tracker, so that exit will also be reported.

Helps to understand epoch entrance/exit scenarios in
complex cases, like network stack.  As everything else
under EPOCH_TRACE it is a developer only tool.

2 years agoifnet: enable & fix if_debug build
Gleb Smirnoff [Thu, 2 Dec 2021 18:59:43 +0000 (10:59 -0800)]
ifnet: enable & fix if_debug build

Fixes: ce40632a316c5

2 years agotcp_hpts: rewrite inpcb synchronization
Gleb Smirnoff [Thu, 2 Dec 2021 18:48:49 +0000 (10:48 -0800)]
tcp_hpts: rewrite inpcb synchronization

Just trust the pcb database, that if we did in_pcbref(), no way
an inpcb can go away.  And if we never put a dropped inpcb on
our queue, and tcp_discardcb() always removes an inpcb to be
dropped from the queue, then any inpcb on the queue is valid.

Now, to solve LOR between inpcb lock and HPTS queue lock do the
following trick.  When we are about to process a certain time
slot, take the full queue of the head list into on stack list,
drop the HPTS lock and work on our queue.  This of course opens
a race when an inpcb is being removed from the on stack queue,
which was already mentioned in comments.  To address this race
introduce generation count into queues.  If we want to remove
an inpcb with generation count mismatch, we can't do that, we
can only mark it with desired new time slot or -1 for remove.

Reviewed by: rrs
Differential revision: https://reviews.freebsd.org/D33026

2 years agotcp_hpts: rename input queue to drop queue and trim dead code
Gleb Smirnoff [Thu, 2 Dec 2021 18:48:48 +0000 (10:48 -0800)]
tcp_hpts: rename input queue to drop queue and trim dead code

The HPTS input queue is in reality used only for "delayed drops".
When a TCP stack decides to drop a connection on the output path
it can't do that due to locking protocol between main tcp_output()
and stacks.  So, rack/bbr utilize HPTS to drop the connection in
a different context.

In the past the queue could also process input packets in context
of HPTS thread, but now no stack uses this, so remove this
functionality.

Reviewed by: rrs
Differential revision: https://reviews.freebsd.org/D33025

2 years agotcp_hpts: make struct tcp_hpts_entry private to the module.
Gleb Smirnoff [Thu, 2 Dec 2021 18:48:48 +0000 (10:48 -0800)]
tcp_hpts: make struct tcp_hpts_entry private to the module.

Also, make some of the functions also private to the module. Remove
unused functions discovered after that.

Reviewed by: rrs
Differential revision: https://reviews.freebsd.org/D33024

2 years agotcp_hpts: provide tcp_in_hpts().
Gleb Smirnoff [Thu, 2 Dec 2021 18:48:48 +0000 (10:48 -0800)]
tcp_hpts: provide tcp_in_hpts().

It will hide some internal HPTS knowledge from the consumers.

Reviewed by: rrs
Differential revision: https://reviews.freebsd.org/D33023

2 years agoSMR protection for inpcbs
Gleb Smirnoff [Thu, 2 Dec 2021 18:48:48 +0000 (10:48 -0800)]
SMR protection for inpcbs

With introduction of epoch(9) synchronization to network stack the
inpcb database became protected by the network epoch together with
static network data (interfaces, addresses, etc).  However, inpcb
aren't static in nature, they are created and destroyed all the
time, which creates some traffic on the epoch(9) garbage collector.

Fairly new feature of uma(9) - Safe Memory Reclamation allows to
safely free memory in page-sized batches, with virtually zero
overhead compared to uma_zfree().  However, unlike epoch(9), it
puts stricter requirement on the access to the protected memory,
needing the critical(9) section to access it.  Details:

- The database is already build on CK lists, thanks to epoch(9).
- For write access nothing is changed.
- For a lookup in the database SMR section is now required.
  Once the desired inpcb is found we need to transition from SMR
  section to r/w lock on the inpcb itself, with a check that inpcb
  isn't yet freed.  This requires some compexity, since SMR section
  itself is a critical(9) section.  The complexity is hidden from
  KPI users in inp_smr_lock().
- For a inpcb list traversal (a pcblist sysctl, or broadcast
  notification) also a new KPI is provided, that hides internals of
  the database - inp_next(struct inp_iterator *).

Reviewed by: rrs
Differential revision: https://reviews.freebsd.org/D33022

2 years agoinpcb: reduce some aliased functions after removal of PCBGROUP.
Gleb Smirnoff [Thu, 2 Dec 2021 18:48:48 +0000 (10:48 -0800)]
inpcb: reduce some aliased functions after removal of PCBGROUP.

Reviewed by: rrs
Differential revision: https://reviews.freebsd.org/D33021

2 years agoRemove "options PCBGROUP"
Gleb Smirnoff [Thu, 2 Dec 2021 18:48:48 +0000 (10:48 -0800)]
Remove "options PCBGROUP"

With upcoming changes to the inpcb synchronisation it is going to be
broken. Even its current status after the move of PCB synchronization
to the network epoch is very questionable.

This experimental feature was sponsored by Juniper but ended never to
be used in Juniper and doesn't exist in their source tree [sjg@, stevek@,
jtl@]. In the past (AFAIK, pre-epoch times) it was tried out at Netflix
[gallatin@, rrs@] with no positive result and at Yandex [ae@, melifaro@].

I'm up to resurrecting it back if there is any interest from anybody.

Reviewed by: rrs
Differential revision: https://reviews.freebsd.org/D33020

2 years agoAllow to compile RSS without PCBGROUP.
Gleb Smirnoff [Thu, 2 Dec 2021 18:48:48 +0000 (10:48 -0800)]
Allow to compile RSS without PCBGROUP.

Reviewed by: rrs
Differential revision: https://reviews.freebsd.org/D33019

2 years agohyperv: Flag hn and storvsc statistics with CTLFLAG_STATS.
Don Morris [Fri, 30 Apr 2021 18:33:00 +0000 (11:33 -0700)]
hyperv: Flag hn and storvsc statistics with CTLFLAG_STATS.

Reviewed by:    vangyzen, whu, bdrewery
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D30060

2 years agosrc.conf.5: regen after WITHOUT_CXX description update
Ed Maste [Thu, 2 Dec 2021 16:34:24 +0000 (11:34 -0500)]
src.conf.5: regen after WITHOUT_CXX description update

2 years agoWITH_/WITHOUT_CXX: update description
Ed Maste [Thu, 2 Dec 2021 16:24:08 +0000 (11:24 -0500)]
WITH_/WITHOUT_CXX: update description

Contrary to the previous description WITHOUT_CXX does not disable
/usr/bin/c++, which is just a link to Clang.  We also no longer have
gperf.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agobce(4): Fix a typo in a sysctl description
Gordon Bergling [Thu, 2 Dec 2021 15:12:34 +0000 (16:12 +0100)]
bce(4): Fix a typo in a sysctl description

- s/duirng/during/

MFC after: 3 days

2 years agogit hooks: Remove MFH
Mateusz Piotrowski [Tue, 20 Apr 2021 10:30:42 +0000 (12:30 +0200)]
git hooks: Remove MFH

The ports tree now has its own prepare-commit-msg Git hook, so there is
not need to keep ports-specific metadata fields around in the src tree.

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

2 years agotcp: unloading a module that is set to default should error.
Randall Stewart [Thu, 2 Dec 2021 11:12:16 +0000 (06:12 -0500)]
tcp: unloading a module that is set to default should error.

I just discovered that the return of the EBUSY error was incorrectly
rigged so that you could unload a CC module that was set to default.
Its supposed to be an EBUSY error. Make it so.

Reviewed by: Michael Tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D33229

2 years agokern: Correct a typo in a sysctl description
Gordon Bergling [Thu, 2 Dec 2021 09:54:15 +0000 (10:54 +0100)]
kern: Correct a typo in a sysctl description

- s/osbolete/obsolete/

MFC after: 3 days

2 years agomlx5: Correct a typo in a sysctl description
Gordon Bergling [Thu, 2 Dec 2021 09:51:18 +0000 (10:51 +0100)]
mlx5: Correct a typo in a sysctl description

- s/parameteres/parameters/

MFC after: 3 days

2 years agoTMP461: Add thermal sensor driver
Hubert Mazur [Fri, 26 Nov 2021 09:26:06 +0000 (10:26 +0100)]
TMP461: Add thermal sensor driver

Add driver for TMP461 thermal sensor. Register new sysctl node
of integer type for device. Read register and fill sysctl with
valid temperature.

Reviewed by:
Sponsored by: Alstom
Obtained from: Semihalf
Differential revision: https://reviews.freebsd.org/D32818

2 years agosys/libkern.h: Add type conversion helpers
Hubert Mazur [Fri, 26 Nov 2021 09:20:04 +0000 (10:20 +0100)]
sys/libkern.h: Add type conversion helpers

Add helper functions for 32 and 64 bit unsigned to signed integers
conversions.

Reviewed by:
Sponsored by: Alstom
Obtained from: Semihalf
Differential revision: https://reviews.freebsd.org/D33162

2 years agoOptionalObsoleteFiles.inc: remove MK_CXX rule for usr/bin/c++
Ed Maste [Wed, 1 Dec 2021 21:49:16 +0000 (16:49 -0500)]
OptionalObsoleteFiles.inc: remove MK_CXX rule for usr/bin/c++

In fact MK_CXX does not control whether /usr/bin/c++ is built -- it is
installed as a link to Clang (which is always a C/C++ compiler), and it
already exists in OptionalObsoleteFiles under MK_TOOLCHAIN.

Sponsored by: The FreeBSD Foundation

2 years agoAdd lib32 entries for WITHOUT_PROFILE.
John Baldwin [Wed, 1 Dec 2021 22:25:37 +0000 (14:25 -0800)]
Add lib32 entries for WITHOUT_PROFILE.

Reported by: Mark Millard

2 years agoTrim a couple of duplicate entries from WITHOUT_PROFILE.
John Baldwin [Wed, 1 Dec 2021 22:23:31 +0000 (14:23 -0800)]
Trim a couple of duplicate entries from WITHOUT_PROFILE.

2 years agoAdd various profiled libraries missing from the WITHOUT_PROFILE list.
John Baldwin [Wed, 1 Dec 2021 22:22:29 +0000 (14:22 -0800)]
Add various profiled libraries missing from the WITHOUT_PROFILE list.

Reported by: Mark Millard

2 years agoRemove sparc64 lastcomm/sa tests.
John Baldwin [Wed, 1 Dec 2021 22:14:58 +0000 (14:14 -0800)]
Remove sparc64 lastcomm/sa tests.

Reported by: Mark Millard
Fixes: d6dffbae9662 lastcomm/sa: Remove sparc64 tests, they aren't needed.

2 years agoPrune leftovers from cloudabi(4), ng_h4(4), and sppp(4) removals.
John Baldwin [Wed, 1 Dec 2021 22:14:58 +0000 (14:14 -0800)]
Prune leftovers from cloudabi(4), ng_h4(4), and sppp(4) removals.

Reported by: Mark Millard

2 years agonfsd: Sanity check the ACL attribute
Rick Macklem [Wed, 1 Dec 2021 21:55:17 +0000 (13:55 -0800)]
nfsd: Sanity check the ACL attribute

When an ACL is presented to the NFSv4 server in
Setattr or Verify, parsing of the ACL assumed a
sane acecnt and sane sizes for the "who" strings.
This patch adds sanity checks for these.

The patch also fixes handling of an error
return from nfsrv_dissectacl() for one broken
case.

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 260111
MFC after: 2 weeks

2 years agonfsd: Do not try to cache a reply for NFSERR_BADSLOT
Rick Macklem [Wed, 1 Dec 2021 21:46:41 +0000 (13:46 -0800)]
nfsd: Do not try to cache a reply for NFSERR_BADSLOT

When nfsrv_checksequence() replies NFSERR_BADSLOT,
the value of nd_slotid is not valid.  As such, the
reply cannot be cached in the session.
Do not set ND_HASSEQUENCE for this case.

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 260076
MFC after: 2 weeks

2 years agoOptionalObsoleteFiles: move /usr/bin/CC to MK_TOOLCHAIN section
Ed Maste [Wed, 1 Dec 2021 21:38:10 +0000 (16:38 -0500)]
OptionalObsoleteFiles: move /usr/bin/CC to MK_TOOLCHAIN section

/usr/bin/CC is installed by usr.bin/clang/clang/Makefile, as with
/usr/bin/cc, /usr/bin/cpp, etc., and is not controlled by MK_CXX.
Move it to the same section as those tools.

(It may be that these should all be under
MK_TOOLCHAIN == no || MK_CLANG_IS_CC == no, but that seems like
unnecessary complexity.)

Sponsored by: The FreeBSD Foundation

2 years agoem: skip rxcsum offload processing when disabled
Vincenzo Maffione [Wed, 1 Dec 2021 21:10:46 +0000 (21:10 +0000)]
em: skip rxcsum offload processing when disabled

Similarly to the other Intel drivers, don't try to process
RX checksum offloads when this feature (IFCAP_RXCSUM) is
disabled.

Reviewed by: gallatin, kbowling, erj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D33155

2 years agoe1000: remove unused ifp backpointer
Vincenzo Maffione [Mon, 29 Nov 2021 21:28:26 +0000 (21:28 +0000)]
e1000: remove unused ifp backpointer

The ifp (struct ifnet) backpointer in the e1000 private ifnet
data is not used anymore since the iflib transition.
Remove it so that developers are not tempted to use it and
get a NULL pointer dereference.

Reviewed by: markj, kbowling, erj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D33157

2 years agolibc sctp: improve conformance of sctp_getpaddrs()
Michael Tuexen [Wed, 1 Dec 2021 18:47:50 +0000 (19:47 +0100)]
libc sctp: improve conformance of sctp_getpaddrs()

When there is no association, don't return -1 and indicate ENOENT,
but return 0 instead. This is specified in RFC 6458.

PR: 260117
MFC after: 1 week

2 years agoamdtemp: Revert related part of "Make CPU children" commit.
Alexander Motin [Wed, 1 Dec 2021 18:00:17 +0000 (13:00 -0500)]
amdtemp: Revert related part of "Make CPU children" commit.

While it still looks like previous code worked by coincidence, this
change broke things even more instead of fixing.

Reported by: avg@
MFC after: 1 week

2 years agowpa: Import wpa_supplicant/hostapd commit 14ab4a816
Cy Schubert [Wed, 1 Dec 2021 16:06:47 +0000 (08:06 -0800)]
wpa: Import wpa_supplicant/hostapd commit 14ab4a816

This is the November update to vendor/wpa committed upstream 2021-11-26.

2 years agolibc sctp: fix sctp_getladdrs() when reporting no addresses
Michael Tuexen [Wed, 1 Dec 2021 15:20:17 +0000 (16:20 +0100)]
libc sctp: fix sctp_getladdrs() when reporting no addresses

Section 9.5 of RFC 6458 (SCTP Socket API) requires that
sctp_getladdrs() returns 0 in case the socket is unbound. This
is the cause of reporting 0 addresses. So don't indicate an
error, just report this case as required.

PR: 260117
MFC after: 1 week

2 years agoAdd an arm64 sha512 feature check
Andrew Turner [Mon, 29 Nov 2021 17:21:31 +0000 (17:21 +0000)]
Add an arm64 sha512 feature check

This is only available in recent toolchains. Check for it so we can
use it in libmd.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33166

2 years agoif_epair: Also mark the flag of pair b with IFF_KNOWSEPOCH
Zhenlei Huang [Wed, 1 Dec 2021 14:54:23 +0000 (15:54 +0100)]
if_epair: Also mark the flag of pair b with IFF_KNOWSEPOCH

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

2 years agosctp: improve handling of assoc ids in socket options
Michael Tuexen [Wed, 1 Dec 2021 13:54:55 +0000 (14:54 +0100)]
sctp: improve handling of assoc ids in socket options

For socket options related to local and remote addresses providing
generic association ids does not make sense. Report EINVAL in this
case.

MFC after: 1 week

2 years agolibc sctp: improve error reporting of sctp_getladdrs()
Michael Tuexen [Wed, 1 Dec 2021 10:14:36 +0000 (11:14 +0100)]
libc sctp: improve error reporting of sctp_getladdrs()

Do not hide errno from getsockopt() called internally.

MFC after: 1 week

2 years agolibc sctp: fix sctp_getladdrs() for 64-bit BE platforms
Michael Tuexen [Wed, 1 Dec 2021 09:13:20 +0000 (10:13 +0100)]
libc sctp: fix sctp_getladdrs() for 64-bit BE platforms

When calling getsockopt() with SCTP_GET_LOCAL_ADDR_SIZE, use a
pointer to a 32-bit variable, since this is what the kernel
expects.
While there, do some cleanups.

MFC after: 1 week

2 years agosctp: cleanup, no functional change intended.
Michael Tuexen [Wed, 1 Dec 2021 08:19:40 +0000 (09:19 +0100)]
sctp: cleanup, no functional change intended.

MFC after: 1 week

2 years agoRemove DS_BUSY case
Warner Losh [Tue, 30 Nov 2021 23:35:48 +0000 (16:35 -0700)]
Remove DS_BUSY case

DS_BUSY is no longer a device state. Remove it from here.

Sponsored by: Netflix

2 years agoMake device_busy/unbusy work w/o Giant held
Warner Losh [Tue, 30 Nov 2021 22:03:26 +0000 (15:03 -0700)]
Make device_busy/unbusy work w/o Giant held

The vast majority of the busy/unbusy users in the tree don't acquire
Giant before calling device_busy/unbusy. However, if multiple threads
are opening a file, say, that causes the device to busy/unbusy, then we
can race to the root marking things busy. Move to using a reference
count to keep track of how many times a device_t has been made busy. Use
that count to make the same decisions that we'd make with the old device
state.

Note: gpiopps.c uses D_TRACKCLOSE. Others do as well. However, there's a
known race with closes that will be corrected for all the drivers that
do this in a future commit.

Sponsored by: Netflix
Reviewed by: hselasky, jhb
Differential Revision: https://reviews.freebsd.org/D26284

2 years agoRevert "Make device_busy/unbusy work w/o Giant held"
Warner Losh [Tue, 30 Nov 2021 22:12:22 +0000 (15:12 -0700)]
Revert "Make device_busy/unbusy work w/o Giant held"

This reverts commit 08e781915363f98f4318a864b3b5a52bd99424c6.

Commit message was for a very old version of the patch. Will re-commit
with the right one since it's so bad. There's no locked versions of
it...that code was reworked to use refcnt APIs.

Noticed by: jhb, jtrc27
Sponsored by: Netflix

2 years agoMake device_busy/unbusy work w/o Giant held
Warner Losh [Tue, 30 Nov 2021 22:03:26 +0000 (15:03 -0700)]
Make device_busy/unbusy work w/o Giant held

The vast majority of the busy/unbusy users in the tree don't acquire Giant
before calling device_busy/unbusy. However, if multiple threads are opening a
file, say, that causes the device to busy/unbusy, then we can race to the root
marking things busy. Create a new device_busy_locked and device_unbusy_locked
that are the current implemntations of device_busy and device_unbusy. Make
device_busy and unbusy acquire Giant before calling the _locked versrions. Since
we never sleep in the busy/unbusy path, Giant's single threaded semantics
suffice to keep this safe.

Sponsored by: Netflix
Reviewed by: hselasky, jhb
Differential Revision: https://reviews.freebsd.org/D26284

2 years agobhyve blockif: fix blockif_candelete with Capsicum
Chuck Tuffli [Wed, 1 Dec 2021 05:07:32 +0000 (21:07 -0800)]
bhyve blockif: fix blockif_candelete with Capsicum

NVMe conformance tests for the Format command failed if the
backing-storage for the bhyve device was a file instead of a Zvol. The
tests (and the specification) expect a Format to destroy all previously
written data. The bhyve NVMe emulation implements this by trimming /
deallocating all data from the backing-storage.

The blockif_candelete() function indicated the file did not support
deallocation (i.e. fpathconf(..., _PC_DEALLOC_PRESENT) returned FALSE)
even though the kernel supported file hole punching. This occurs on
builds with Capsicum enabled because blockif did not allow the
fpathconf(2) right.

Fix is to add CAP_FPATHCONF to the cap_rights_init(3) call.

PR: 260081
Reviewed by: allanjude, markj, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33203

2 years agocam: Initialize wired to false
Warner Losh [Tue, 30 Nov 2021 21:14:55 +0000 (14:14 -0700)]
cam: Initialize wired to false

As part of converting the code to a while loop, the unconditional
initialization of wired to false was lost.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33163

2 years agoiichid(4): Perform acknowledgement of I2C device interrupt after RESET command
Vladimir Kondratyev [Tue, 30 Nov 2021 21:29:50 +0000 (00:29 +0300)]
iichid(4): Perform acknowledgement of I2C device interrupt after RESET command

in sampling mode to workaround firmware bug.

This fixes reboot or poweroff on frame.work laptops after first touch.

Reported by: many
PR: 259230
MFC after: 1 week
Tested by: kevans, markj

2 years agoxen/dev: remove write-only variable
Elliott Mitchell [Fri, 8 Oct 2021 21:43:26 +0000 (14:43 -0700)]
xen/dev: remove write-only variable

This was found while looking for driver_filter_t functions which got the
trap frame from the argument.  This particular instance it isn't even
used, so remove now lest someone else get to it first.

Reviewed by: mhorne

2 years agoOptionalObsoleteFiles: remove GCC remnants
Ed Maste [Tue, 30 Nov 2021 18:39:21 +0000 (13:39 -0500)]
OptionalObsoleteFiles: remove GCC remnants

g++ and cc1plus were GCC components that are already removed
unconditionally in ObsoleteFiles.inc.

Reported by: jhb (in review D33108)
Fixes: 57f804675e65 ("remove GCC 4.2.1 build infrastructure")
Sponsored by: The FreeBSD Foundation

2 years agoRevert "libc: Some enhancements to syslog(3)"
Alan Somers [Tue, 30 Nov 2021 17:06:25 +0000 (10:06 -0700)]
Revert "libc: Some enhancements to syslog(3)"

This reverts commit 2886c93d1bca231260ebc01d4205743ca781f3c7.
The original commit has two problems:

* It sets SO_SNDBUF to be as large as MAXLINE.  But for unix domain
  sockets, the send buffer is bypassed.  Packets go directly to the
  peer's receive buffer, so setting and querying SO_SNDBUF is
  ineffective.  To ensure that the socket can accept messages of a
  certain size, it would be necessary to add a SO_PEERRCVBUF socket
  option that could query the connected peer's receive buffer size.

* It sets MAXLINE to 8 kB, which is larger than the default sockbuf size
  of 4 kB.  That's ok for the builtin syslogd, which sets its recvbuf
  to 80 kB, but not ok for alternative sysloggers, like rsyslogd, which
  use the default size.

As a consequence, writing messages of more than 4 kB with syslog() as a
non-root user while running rsyslogd would cause the logging application
to spin indefinitely within syslog().

PR: 260126
MFC: 2 weeks
Sponsored by: Axcient
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D33199

2 years agocontrib/bc: merge version 5.2.1 from vendor branch
Stefan Eßer [Tue, 30 Nov 2021 17:40:32 +0000 (18:40 +0100)]
contrib/bc: merge version 5.2.1 from vendor branch

Merge commit 'e63540eed295749528548c2e3a90f5a6e57275c8'

2 years agovendor/bc: import release 5.2.1
Stefan Eßer [Tue, 30 Nov 2021 17:33:40 +0000 (18:33 +0100)]
vendor/bc: import release 5.2.1

This release fixes two parse bugs when in POSIX standard mode. One of
these bugs was due to a quirk of the POSIX grammar, and the other was
because bc was too strict.

2 years agovendor/bc: import release 5.2.0
Stefan Eßer [Tue, 30 Nov 2021 17:26:22 +0000 (18:26 +0100)]
vendor/bc: import release 5.2.0

This version is imported only for documentary purposes since it does
not contain any changes that are relevant for the FreeBSD base system.

2 years agoif_stf: KASAN fix
Kristof Provost [Tue, 30 Nov 2021 15:30:22 +0000 (16:30 +0100)]
if_stf: KASAN fix

In in_stf_input() we grabbed a pointer to the IPv4 header and later did
an m_pullup() before we look at the IPv6 header. However, m_pullup()
could rearrange the mbuf chain and potentially invalidate the pointer to
the IPv4 header.

Avoid this issue by copying the IP header rather than getting a pointer
to it.

Reported by: markj, Jenkins (KASAN job)
Reviewed by: markj
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33192

2 years agoImplement GET_STACK_USAGE on remaining archs
Mitchell Horne [Thu, 25 Nov 2021 16:01:11 +0000 (12:01 -0400)]
Implement GET_STACK_USAGE on remaining archs

This definition enables callers to estimate remaining space on the
kstack, and take action on it. Notably, it enables optimizations in the
GEOM and netgraph subsystems to directly dispatch work items when there
is sufficient stack space, rather than queuing them for a worker thread.

Implement it for riscv, arm, and mips. Remove the #ifdefs, so it will
not go unimplemented elsewhere.

PR: 259157
Reviewed by: mav, kib, markj (previous version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32580

2 years agoarm64, powerpc: fix calculation of 'used' in GET_STACK_USAGE
Mitchell Horne [Tue, 30 Nov 2021 15:15:44 +0000 (11:15 -0400)]
arm64, powerpc: fix calculation of 'used' in GET_STACK_USAGE

We do not consider the space reserved for the pcb to be part of the
total kstack size, so it should not be included in the calculation of
the used stack size.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoi386: take pcb and fpu area into account in GET_STACK_USAGE
Mitchell Horne [Thu, 25 Nov 2021 15:54:33 +0000 (11:54 -0400)]
i386: take pcb and fpu area into account in GET_STACK_USAGE

On this platform, the pcb and FPU save area are allocated from the top
of each kernel stack, so they should be excluded from the calculation of
the total and used stack sizes.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32581

2 years agofw_stub: fix -Wunused-but-set-variable for firmware files
Bjoern A. Zeeb [Tue, 30 Nov 2021 14:23:18 +0000 (14:23 +0000)]
fw_stub: fix -Wunused-but-set-variable for firmware files

In case we are only embedding a single firmware image the variable
"parent" gets set but never used.  Add checks for the number of files
for it and only print it out if we are exceeding the single file count.
This fixes -Wunused-but-set-variable warnings for the majority of
firmware files in the tree.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

2 years agokern_tc: unify timecounter to bintime delta conversion
Andriy Gapon [Tue, 30 Nov 2021 13:23:23 +0000 (15:23 +0200)]
kern_tc: unify timecounter to bintime delta conversion

There are two places where we convert from a timecounter delta to
a bintime delta: tc_windup and bintime_off.
Both functions use the same calculations when the timecounter delta is
small.  But for a large delta (greater than approximately an equivalent
of 1 second) the calculations were different.  Both functions use
approximate calculations based on th_scale that avoid division.  Both
produce values slightly greater than a true value, calculated with
division by tc_frequency, would be.  tc_windup is slightly more
accurate, so its result is closer to the true value and, thus, smaller
than bintime_off result.

As a consequence there can be a jump back in time when time hands are
switched after a long period of time (a large delta).  Just before the
switch the time would be calculated with a large delta from
th_offset_count in bintime_off.  tc_windup does the switch using its own
calculations of a new th_offset using the large delta.  As explained
earlier, the new th_offset may end up being less than the previously
produced binuptime.  So, for a period of time new binuptime values may
be "back in time" comparing to values just before the switch.

Such a jump must never happen.  All the code assumes that the uptime is
monotonically nondecreasing and some code works incorrectly when that
assumption is broken.  For example, we have observed sleepq_timeout()
ignoring a timeout when the sbinuptime value obtained by the callout
code was greater than the expiration value, but the sbinuptime obtained
in sleepq_timeout() was less than it.  In that case the target thread
would never get woken up.

The unified calculations should ensure the monotonic property of the
uptime.

The problem is quite rare as normally tc_windup should be called HZ
times per second (typically 1000 or 100).  But it may happen in VMs on
very busy hypervisors where a VM's virtual CPU may not get an execution
time slot for a second or more.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Panzura LLC

2 years agomips: Fix a typo in a source code comment
Gordon Bergling [Tue, 30 Nov 2021 09:41:46 +0000 (10:41 +0100)]
mips: Fix a typo in a source code comment

- s/segement/segment/

MFC after: 3 days

2 years agompr(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 30 Nov 2021 09:40:50 +0000 (10:40 +0100)]
mpr(4): Fix a typo in a source code comment

- s/segement/segment/

MFC after: 3 days

2 years agoxen(4): Fix two typos in source code comments
Gordon Bergling [Tue, 30 Nov 2021 09:39:42 +0000 (10:39 +0100)]
xen(4): Fix two typos in source code comments

- s/segement/segment/

MFC after: 3 days

2 years agoelf(3): Fix a typo in a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 09:38:34 +0000 (10:38 +0100)]
elf(3): Fix a typo in a sysctl description

- s/segement/segment/

MFC after: 3 days

2 years agonetinet: Fix a common typo in source code comments
Gordon Bergling [Tue, 30 Nov 2021 09:37:20 +0000 (10:37 +0100)]
netinet: Fix a common typo in source code comments

- s/segement/segment/

MFC after: 3 days

2 years agoficl: Fix a typo in a comment
Gordon Bergling [Tue, 30 Nov 2021 09:36:29 +0000 (10:36 +0100)]
ficl: Fix a typo in a comment

- s/segement/segment/

MFC after: 3 days

2 years agoif_hn: Fix a few typos in comments and a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 09:35:14 +0000 (10:35 +0100)]
if_hn: Fix a few typos in comments and a sysctl description

- s/segement/segment/

MFC after: 3 days

2 years agonvme(4): Correct a typo in a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 09:26:25 +0000 (10:26 +0100)]
nvme(4): Correct a typo in a sysctl description

- s/printting/printing/

MFC after: 3 days

2 years agoinet(3): Fix two typos in sysctl descriptions
Gordon Bergling [Tue, 30 Nov 2021 09:21:47 +0000 (10:21 +0100)]
inet(3): Fix two typos in sysctl descriptions

- s/sequental/sequential/

MFC after: 3 days

2 years agoMakefile.inc1: Silence an error in make packages
Juraj Lutter [Sun, 28 Nov 2021 20:44:13 +0000 (21:44 +0100)]
Makefile.inc1: Silence an error in make packages

Silence an error in "packages" target, like:

eval: /usr/src: Permission denied

on systems without subversion present.

Reviewed by: emaste
Approved by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33153

2 years agovfs: Fix a typo in a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 06:28:40 +0000 (07:28 +0100)]
vfs: Fix a typo in a sysctl description

- s/dependecies/dependencies/

MFC after: 3 days

2 years agonetinet6: Fix a typo in a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 06:24:44 +0000 (07:24 +0100)]
netinet6: Fix a typo in a sysctl description

- remove a double 'a'

MFC after: 3 days

2 years agotcp(4): Fix a typo in a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 06:17:30 +0000 (07:17 +0100)]
tcp(4): Fix a typo in a sysctl description

- s/entires/entries/

MFC after: 3 days

2 years agoflex_spi: Support for FlexSPI Flash controller.
Wojciech Macek [Thu, 25 Nov 2021 09:36:55 +0000 (10:36 +0100)]
flex_spi: Support for FlexSPI Flash controller.

NXP FlexSPI is a complex SPI controller which provides
full offload for accessing NOR Flash.
Create a Flash driver which attaches to existing FreeBSD
infrastructure and exports generic READ and WRITE disk commands.
The Flash has to be identified first to configure controller
internals. For now, only one NOR Flash chip is supported.
Future commits shall either increase number of known chips
or implement SFDP mechanism which can be used by other Flash
drivers.

Sponsored by: Alstom
Obtained from: Semihalf
Differential revision: https://reviews.freebsd.org/D33117

2 years agoAdd tests for posix_spawn_file_actions_add{chdir,fchdir}_np(3)
Konstantin Belousov [Sun, 28 Nov 2021 00:55:26 +0000 (02:55 +0200)]
Add tests for posix_spawn_file_actions_add{chdir,fchdir}_np(3)

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoDocument posix_spawn_file_actions_addclosefrom_np(3)
Konstantin Belousov [Sun, 28 Nov 2021 00:23:55 +0000 (02:23 +0200)]
Document posix_spawn_file_actions_addclosefrom_np(3)

Reviewed by:    kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoposix_spawn: add closefrom non-portable action
Konstantin Belousov [Sat, 27 Nov 2021 22:54:16 +0000 (00:54 +0200)]
posix_spawn: add closefrom non-portable action

Namely posix_spawn_file_actions_addclosefrom_np, in the form it is
provided by glibc.

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoDocument posix_spawn_file_actions_addchdir_np(3)
Konstantin Belousov [Sun, 28 Nov 2021 00:11:21 +0000 (02:11 +0200)]
Document posix_spawn_file_actions_addchdir_np(3)

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoposix_spawn: add chdir-related non-portable actions
Konstantin Belousov [Sat, 27 Nov 2021 22:49:03 +0000 (00:49 +0200)]
posix_spawn: add chdir-related non-portable actions

Namely posix_spawn_file_actions_addchdir_np and
posix_spawn_file_actions_addfchdir_np.

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoposix_spawn(3), posix_spawn_file_actions_addopen(3): use .Fo/.Fc
Konstantin Belousov [Sun, 28 Nov 2021 00:16:26 +0000 (02:16 +0200)]
posix_spawn(3), posix_spawn_file_actions_addopen(3): use .Fo/.Fc

to wrap too long lines with function prototypes.

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoposix_spawn: style, use return ()
Konstantin Belousov [Sat, 27 Nov 2021 22:45:12 +0000 (00:45 +0200)]
posix_spawn: style, use return ()

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143