]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agolibradius: fix no SSL build
Cy Schubert [Wed, 2 Jun 2021 18:31:00 +0000 (11:31 -0700)]
libradius: fix no SSL build

int alen is only used with SSL.

(cherry picked from commit 48b11217bf7e605e1c386e316cd6e935aceb4927)

libradius: fix WITHOUT_OPENSSL build

int alen is used only with SSL.

Reported by: Michael Dexter, Build Option Survey
MFC after: 3 days
Fixes: 8d5c7813061d ("libradius: Fix input validation bugs")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit a901f2af587f9cb068e2fca6b62f324bdde471d8)

2 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

(cherry picked from commit 4a27bf128b108d90412190c06a54ebac36a8ca2e)

2 years agonet tests: fix if_stf:6to4
Kristof Provost [Wed, 10 Nov 2021 11:02:34 +0000 (12:02 +0100)]
net tests: fix if_stf:6to4

This test needs to have the loopback interface enabled, or route lookups
for our own IP addresses will fail.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33041

(cherry picked from commit 67573b7a39b19e39536a68563fed0d940604e573)

2 years agoif_pflog: fix packet length
Kristof Provost [Thu, 2 Dec 2021 07:22:34 +0000 (08:22 +0100)]
if_pflog: fix packet length

There were two issues with the new pflog packet length.
The first is that the length is expected to be a multiple of
sizeof(long), but we'd assumed it had to be a multiple of
sizeof(uint32_t).

The second is that there's some broken software out there (such as
Wireshark) that makes incorrect assumptions about the amount of padding.
That is, Wireshark assumes there's always three bytes of padding, rather
than however much is needed to get to a multiple of sizeof(long).

Fix this by adding extra padding, and a fake field to maintain
Wireshark's assumption.

Reported by: Ozkan KIRIK <ozkan.kirik@gmail.com>
Tested by: Ozkan KIRIK <ozkan.kirik@gmail.com>
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33236

(cherry picked from commit 6d4baa0d011cb3e78b4b08415568e71c0aab00fe)

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

(cherry picked from commit 73d41cc730858aa1fe273c36f3653afd16791091)

2 years agoxhci: Add PCI IDs from recent Intel CPUs.
Alexander Motin [Sat, 27 Nov 2021 01:35:12 +0000 (20:35 -0500)]
xhci: Add PCI IDs from recent Intel CPUs.

MFC after: 2 weeks

(cherry picked from commit 83d7b2f335b4e21e6b63a86864ac5e76f4c8efd3)

2 years agonfscl: Sanity check the Sequence slotid in reply
Rick Macklem [Sat, 27 Nov 2021 23:02:04 +0000 (15:02 -0800)]
nfscl: Sanity check the Sequence slotid in reply

The slotid in the Sequence reply must be the same as
in the request.  Check that it is the same and log
a console message if it is not, plus set it to the
correct value.

PR: 260071

(cherry picked from commit 1c15c8c0e935f3f7def7b03e9546f7d6790f465e)

2 years agonfsd: Sanity check the len argument for ListXattr
Rick Macklem [Fri, 26 Nov 2021 23:56:29 +0000 (15:56 -0800)]
nfsd: Sanity check the len argument for ListXattr

The check for the original len being >= retlen needs to
be done before the "if (nd->nd_repstat == 0)" code, so
that it can be reported as too small.

PR: 260046

(cherry picked from commit 5b430a132330bd4a4ea37780807947f3800d009e)

2 years agoEC2: Turn off IPv6 DAD
Colin Percival [Tue, 23 Nov 2021 04:16:34 +0000 (20:16 -0800)]
EC2: Turn off IPv6 DAD

Disable Duplicate Address Detection in EC2 instances.  The networking
configuration in EC2, with IPv6 addresses assigned by DHCPv6 and
host egress filtering, makes "duplicate addresses" impossible.

This speeds up the boot process in EC2 by 2 seconds.

Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D33091

(cherry picked from commit 81075203a057c9ba3467a7f90ea1e9469d7f7723)

2 years agoMove _p.a profiling archives under MK_INSTALLLIB
Ed Maste [Thu, 2 Dec 2021 15:27:12 +0000 (10:27 -0500)]
Move _p.a profiling archives under MK_INSTALLLIB

_p.a are just a special case of .a archives, and should not be installed
if WITHOUT_INSTALLLIB is set.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit fc073e6743a989c9d0b8f619ce0f903271c0db2e)

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

(cherry picked from commit 5e077e08ef87126765b5a818def6cb99314ab192)

2 years agoApply fix for clang crashing on invalid -Wa,-march= values
Dimitry Andric [Sun, 5 Dec 2021 17:54:13 +0000 (18:54 +0100)]
Apply fix for clang crashing on invalid -Wa,-march= values

Merge commit df08b2fe8b35 from llvm git (by Dimitry Andric):

  [AArch64] Avoid crashing on invalid -Wa,-march= values

  As reported in https://bugs.freebsd.org/260078, the gnutls Makefiles
  pass -Wa,-march=all to compile a number of assembly files. Clang does
  not support this -march value, but because of a mistake in handling
  the arguments, an unitialized Arg pointer is dereferenced, which can
  cause a segfault.

  Work around this by adding a check if the local WaMArch variable is
  initialized, and if so, using its value in the diagnostic message.

  Reviewed By: tschuett

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

PR: 260078
Reported by: bz
MFC after: 3 days

(cherry picked from commit a9cd5c30d64e213c537c76c2a261f7a222f348bf)

2 years agoRemove references to sio(4) from NOTES
Mitchell Horne [Mon, 6 Dec 2021 19:14:43 +0000 (15:14 -0400)]
Remove references to sio(4) from NOTES

Also zs(4) and sab(4), which have similarly been removed.

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

(cherry picked from commit 339ef8277350884079d7b8c46f21b5bdb63afac0)

2 years agoucom: s/sio/ucom/
Mitchell Horne [Mon, 6 Dec 2021 14:09:54 +0000 (10:09 -0400)]
ucom: s/sio/ucom/

Seems like a copy-paste error, or at least this made more sense when the
sio(4) driver still existed. This modifies the debug port name displayed
at boot, but otherwise has no functional change.

Reviewed by: hselasky
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D33278

(cherry picked from commit e43d081f352c97c0cd1c2395f3780601cec09abf)

2 years agox86: remove unused T_USER flag
Mitchell Horne [Sun, 5 Dec 2021 15:11:55 +0000 (11:11 -0400)]
x86: remove unused T_USER flag

It stopped being used in 3c256f5395aa, when trap() was reorganized to
have separate switch statements for user and kernel traps. Remove the
two leftover references and the flag itself.

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

(cherry picked from commit 03b3d7bbec99742910e2d0d5e7c23754eca9b2c4)

2 years agokernel: partially revert e9efb1125a15, default inet mask
Mike Karels [Wed, 10 Nov 2021 21:35:33 +0000 (15:35 -0600)]
kernel: partially revert e9efb1125a15, default inet mask

When no mask is supplied to the ioctl adding an Internet interface
address, revert to using the historical class mask rather than a
single default.  Similarly for the NFS bootp code.

(cherry picked from commit 2f35e7d9fa03f27543f347cd6277af5bfc6a7e95)

2 years agosystat: clean up code assuming network classes
Mike Karels [Thu, 28 Oct 2021 23:39:43 +0000 (18:39 -0500)]
systat: clean up code assuming network classes

Similar to netstat, clean up code that uses inet_lnaof() to check for
binding to "host 0" (lowest host on network) as a "network" bind.
Such things don't happen, and current networks are seldom if ever
found in /etc/networks.

(cherry picked from commit a2e7dfca86497e535039a42cfc44cfc48209abf5)

2 years agosockstat: change check for wildcard sockets to avoid historical classes
Mike Karels [Wed, 27 Oct 2021 03:12:24 +0000 (22:12 -0500)]
sockstat: change check for wildcard sockets to avoid historical classes

sockstat was checking whether a bound address was "host 0", the lowest
host on a network, using inet_lnaof().  This only works for class A/B/C.
However, it isn't useful to bind such an address unless it is really
the unspecified address INADDR_ANY.  Change the check to to use that.

(cherry picked from commit 64acb29b7d9699c301a55a5431d94374391e4f30)

2 years agonetstat: reduce use of historical Internet classes
Mike Karels [Wed, 27 Oct 2021 03:39:10 +0000 (22:39 -0500)]
netstat: reduce use of historical Internet classes

When attempting to characterize bound addresses, netstat was checking
for host 0 on a (historical) net using inet_lnaof().  Such addresses
are not normally bound, as they would not work, with the exception
of the unspecified address, INADDR_ANY.  Check for that explicitly.
Similarly, don't check bound addresses for a match to a network name.

(cherry picked from commit bd27c71c4573e14916ccd27e545a69606f0a8192)

2 years agomountd: deprecate exports to a network without mask
Mike Karels [Wed, 27 Oct 2021 03:48:23 +0000 (22:48 -0500)]
mountd: deprecate exports to a network without mask

The exports file format allows export to a network using an explicit
mask or prefix length (CIDR).  It also allows a network with just
a dotted address, in which case the historical mask was used.
Deprecate this usage, and warn when it is used.  Document that this
is deprecated.

(cherry picked from commit 92aebdeaff57091c77398912accb4c758c6a0fcb)

2 years agores_init: remove unused inet_makeaddr with IN_LOOPBACKNET
Mike Karels [Wed, 27 Oct 2021 03:33:36 +0000 (22:33 -0500)]
res_init: remove unused inet_makeaddr with IN_LOOPBACKNET

Remove code that is ifdefed out on USELOOPBACK, which uses historical
class.  No functional change intended.

(cherry picked from commit 0bf7f99b2a1f50fa68e167269a633b4b5451fa35)

2 years agoman pages: deprecate Internet Class A/B/C
Mike Karels [Wed, 27 Oct 2021 03:25:09 +0000 (22:25 -0500)]
man pages: deprecate Internet Class A/B/C

Mark functions inet_netof(), inet_lnaof(), and inet_makeaddr() as
deprecated, as they assume Class A/B/C.  inet_makeaddr() mostly works
when networks are a multiple of 8 bits, but warn for anything other
than historical classes.  Reduce other mentions of network classes.

(cherry picked from commit 12bd931d8c64ad2d5e78c7ab917efbff326152ca)

2 years agoifconfig: warn if setting an Internet address without mask
Mike Karels [Thu, 28 Oct 2021 14:32:31 +0000 (09:32 -0500)]
ifconfig: warn if setting an Internet address without mask

Add a postproc function for af_inet, and add interface flags as a
parameter.  Check there if setting an address without a mask unless
the interface is loopback or point-to-point, where mask is not really
meaningful; warn if so.  This will hopefully be an error in the future.

(cherry picked from commit d8237b95552807e937fc389c7e2237679ef0c984)

2 years agokernel: deprecate Internet Class A/B/C
Mike Karels [Wed, 27 Oct 2021 03:01:09 +0000 (22:01 -0500)]
kernel: deprecate Internet Class A/B/C

Hide historical Class A/B/C macros unless IN_HISTORICAL_NETS is defined;
define it for user level.  Define IN_MULTICAST separately from IN_CLASSD,
and use it in pf instead of IN_CLASSD.  Stop using class for setting
default masks when not specified; instead, define new default mask
(24 bits).  Warn when an Internet address is set without a mask.

(cherry picked from commit 20d59403961d531467cfab22163f49c131cc8b55)

2 years agoiflib_stop: drain rx tasks to prevent any data races
Andriy Gapon [Fri, 19 Nov 2021 07:56:30 +0000 (09:56 +0200)]
iflib_stop: drain rx tasks to prevent any data races

iflib_stop modifies iflib data structures that are used by _task_fn_rx,
most prominently the free lists.  So, iflib_stop has to ensure that the
rx task threads are not active.

This should help to fix a crash seen when iflib_if_ioctl (e.g.,
SIOCSIFCAP) is called while there is already traffic flowing.

The crash has been seen on VMWare guests with vmxnet3 driver.

My guess is that on physical hardware the couple of 1ms delays that
iflib_stop has after disabling interrupts are enough for the queued work
to be completed before any iflib state is touched.

But on busy hypervisors the guests might not get enough CPU time to
complete the work, thus there can be a race between the taskqueue
threads and the work done to handle an ioctl, specifically in iflib_stop
and iflib_init_locked.

PR: 259458

(cherry picked from commit 1bfdb812c786ac2607a82633f9c84a5d16f54079)

2 years agotwsi: unify error handling, explicitly handle more conditions
Andriy Gapon [Fri, 26 Nov 2021 07:44:30 +0000 (09:44 +0200)]
twsi: unify error handling, explicitly handle more conditions

twsi_error() is a new function that stops the current transfer and sets
up softc when an error condition is detected.
TWSI_STATUS_DATA_WR_NACK, TWSI_STATUS_BUS_ERROR and
TWSI_STATUS_ARBITRATION_LOST are now handled explicitly rather than
via the catch-all unknown status.

Also, twsi_intr() now calls wakeup() in a single place when the
transfer is finished.

(cherry picked from commit a4fe8922085dfc1e5e6a6bac73ccc738e373165f)

2 years agotwsi: improve a handful of debug messages
Andriy Gapon [Fri, 26 Nov 2021 07:34:28 +0000 (09:34 +0200)]
twsi: improve a handful of debug messages

- use 0x prefix for hex values
- print indexes and counts as decimals
- break too long lines

(cherry picked from commit 578707ed4efda4ec1c91ab1a8f1bace6b1eb714a)

2 years agotwsi: do not attempt transfer if bus is not idle
Andriy Gapon [Fri, 26 Nov 2021 07:30:38 +0000 (09:30 +0200)]
twsi: do not attempt transfer if bus is not idle

(cherry picked from commit cb167e1ae95473d836393a07456d8dbcfbb7f758)

2 years agotwsi: remove redundant enabling of the controller
Andriy Gapon [Fri, 26 Nov 2021 07:28:18 +0000 (09:28 +0200)]
twsi: remove redundant enabling of the controller

(cherry picked from commit bc02583c4dd65275da89838a723bd3514cb316cf)

2 years agotwsi: protect interaction between twsi_transfer and twsi_intr
Andriy Gapon [Fri, 26 Nov 2021 07:25:01 +0000 (09:25 +0200)]
twsi: protect interaction between twsi_transfer and twsi_intr

All accesses to softc are now done under a mutex to prevent data races
between the open context and the interrupt handler.
Additionally, the wait time in twsi_transfer is bounded now.
Previously we could get stuck there forever if an interrupt got lost.

(cherry picked from commit 69cfa60ddd4df814b507699f9bb7253ece054f40)

2 years agoHyper-V: hn: Enter network epoch when required
Michael Tuexen [Thu, 26 Aug 2021 17:27:04 +0000 (19:27 +0200)]
Hyper-V: hn: Enter network epoch when required

PR: 254695
(cherry picked from commit 26d79d40a74fc804c76acd88a1f8f10f9827a2b3)

2 years agotcpdrop: tweak comments
Michael Tuexen [Sat, 4 Dec 2021 14:08:01 +0000 (15:08 +0100)]
tcpdrop: tweak comments

Sponsored by: Netflix, Inc.

(cherry picked from commit c2b53b107e0ee1da69921df106a37fffa44bebc5)

2 years agotcpdrop: explicitly choose TCP as the transport protocol
Michael Tuexen [Sat, 4 Dec 2021 14:03:29 +0000 (15:03 +0100)]
tcpdrop: explicitly choose TCP as the transport protocol

Sponsored by: Netflix, Inc.

(cherry picked from commit 8ea363c8c648fd6b9c353bd37551ebb9d25cdd83)

2 years agotcpdrop: allow TCP connections to be filtered by cc-algo
Michael Tuexen [Sat, 4 Dec 2021 14:00:05 +0000 (15:00 +0100)]
tcpdrop: allow TCP connections to be filtered by cc-algo

In addition to filtering by stack and state, allow filtering
by the congestion control module used.  Choose the command line
options to be consistent with the ones of sockstat.

Sponsored by: Netflix, Inc.

(cherry picked from commit 31537ea583c0965fe22498d52831ced4b4f4fc5e)

2 years agotcpdrop: update man page, since the fastack stack has been removed
Michael Tuexen [Sat, 4 Dec 2021 13:27:46 +0000 (14:27 +0100)]
tcpdrop: update man page, since the fastack stack has been removed

Sponsored by: Netflix, Inc.

(cherry picked from commit 7ef45bd3cfa490b0e7b4503ea121d2b2d809cf3a)

2 years agotcpdrop: use a better name of a variable.
Michael Tuexen [Sat, 4 Dec 2021 12:46:43 +0000 (13:46 +0100)]
tcpdrop: use a better name of a variable.

No functional change intended.

Sponsored by: Netflix, Inc.

(cherry picked from commit 300914a0ffb8b18ace16e6d40fc41270e6039b2e)

2 years agosctp: unbreak NOINET6 builds.
Michael Tuexen [Sat, 4 Dec 2021 18:13:28 +0000 (19:13 +0100)]
sctp: unbreak NOINET6 builds.

PR: 260119
Reported by: kostikbel
MFC after: 1 week

(cherry picked from commit 54912d47b629807cefaed5b65a8f4e6d9bbbdbcf)

2 years agosctp: inherit IP level socket options from listening socket
Michael Tuexen [Fri, 3 Dec 2021 21:40:52 +0000 (22:40 +0100)]
sctp: inherit IP level socket options from listening socket

Ensure that TTL and TOS values set on a listener get inheritet
to the accepted sockets.

PR: 260119
MFC after: 1 week

(cherry picked from commit d79676fb1368f5acac5fd182363ea3f46fb3bd93)

2 years agosctp: use the correct traffic class when sending SCTP/IPv6 packets
Michael Tuexen [Fri, 3 Dec 2021 20:28:47 +0000 (21:28 +0100)]
sctp: use the correct traffic class when sending SCTP/IPv6 packets

When sending packets the stcb was used to access the inp and then
access the endpoint specific IPv6 level options. This fails when
there exists an inp, but no stcb yet. This is the case for sending
an INIT-ACK in response to an INIT when no association already
exists. Fix this by just providing the inp instead of the stcb.

PR: 260120
MFC after: 1 week

(cherry picked from commit f32357be53d07622603049f9855be2d66ca6dc2b)

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

(cherry picked from commit 83a103ec429a6dd862a73857ebeeff863a41a34d)

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

(cherry picked from commit 071966e874ed472bdac031b7e89d08bacf8bbbc4)

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

(cherry picked from commit 13c196a41e2604e6f9a4484b997279b82173dc40)

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

(cherry picked from commit 6e9309bd3b04501b69593900a14e01114c7f2404)

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

(cherry picked from commit dabd8bf9145a0a7255473a482e2ccf31919c3089)

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

(cherry picked from commit a01b8859cbde9f2ded7b58a024d8fb46ada596bb)

2 years agoswap_pager.c: Remove MPSAFE and ARGSUSED annotations
Konstantin Belousov [Fri, 3 Dec 2021 08:45:42 +0000 (10:45 +0200)]
swap_pager.c: Remove MPSAFE and ARGSUSED annotations

(cherry picked from commit 6df359449f39cdf01a86e29abf982fa04e888350)

2 years agoimgact_aout.c: some style
Konstantin Belousov [Fri, 3 Dec 2021 10:32:35 +0000 (12:32 +0200)]
imgact_aout.c: some style

(cherry picked from commit 290e05dde058b50aec48464d7116a55c7417575e)

2 years agoimgact_aout.c: We do not expect the aout support to be ported
Konstantin Belousov [Sat, 4 Dec 2021 04:14:38 +0000 (06:14 +0200)]
imgact_aout.c: We do not expect the aout support to be ported

(cherry picked from commit 9da5257e1c045220c01979dcdceadcf2867d20f0)

2 years agonfsd: Add checks for layout errors in LayoutReturn
Rick Macklem [Fri, 26 Nov 2021 23:42:32 +0000 (15:42 -0800)]
nfsd: Add checks for layout errors in LayoutReturn

For a LayoutReturn when using the Flexible File Layout,
error reports may be provided in the request.
Sanity check the size of these error reports and
check that they exist before calling nfsrv_flexlayouterr().

PR: 260012

(cherry picked from commit bdd57cbb1bdafcf2ebffa73c52f0fffc9410ea7b)

2 years agonfscl: Sanity check irdcnt in nfsrpc_createsession
Rick Macklem [Fri, 26 Nov 2021 23:28:40 +0000 (15:28 -0800)]
nfscl: Sanity check irdcnt in nfsrpc_createsession

PR: 259996

(cherry picked from commit 22f7bcb523e7138248832fb304559c8f23276e08)

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

(cherry picked from commit 24e365220007c415f495cf8dcb228ece6002b8b7)

2 years agounbound: Vendor import 1.13.2
Cy Schubert [Tue, 17 Aug 2021 09:32:56 +0000 (02:32 -0700)]
unbound: Vendor import 1.13.2

Merge commit '625f1c1312fb7defbd148c8ba121a0cf058707ef'

(cherry picked from commit 5469a9953005a9a4d4aad7be88545d441622e9a0)

2 years agoipfilter: Avoid more null if-then-else blocks
Cy Schubert [Wed, 20 Oct 2021 03:11:40 +0000 (20:11 -0700)]
ipfilter: Avoid more null if-then-else blocks

As in 73db3b64f167, when WITHOUT_INET6 is selected, null if-then-else
blocks are generated because #if statements are incorrectly placed.
Moving the #if statements reduces unnecessary runtime comparisons or
compiler optimizations.

(cherry picked from commit 130df64793d7d3c680c0f7177a707867a8a19665)

2 years agoipfilter: Correct a comment and add notation
Cy Schubert [Wed, 20 Oct 2021 02:33:02 +0000 (19:33 -0700)]
ipfilter: Correct a comment and add notation

Correct a comment to accurately reflect what is being done. While
we're at it document the next step in the process.

(cherry picked from commit 1ca73c39a54750a4a2f584efd7c57f453bf7dbbe)

2 years agoipfilter: Correct function description
Cy Schubert [Tue, 19 Oct 2021 00:14:43 +0000 (17:14 -0700)]
ipfilter: Correct function description

As of 874b1a35486b, ip_proxy_check() return codes have been simplified.
The original comment was also incorrect in the first place.

(cherry picked from commit 06b96a4bd606999538a1ca2f408342bf8540acb4)

2 years agoipfilter: Add DTrace SDT probe
Cy Schubert [Tue, 5 Oct 2021 04:26:58 +0000 (21:26 -0700)]
ipfilter: Add DTrace SDT probe

Add an SDT probe, using the newly created DT5 macro, in similar vein
to DEBUG_PARSE printf for when FTP junk is anticipated and ok. This
will assist in debugging port (active) FTP proxy issues.

(cherry picked from commit 106f42596e4b61c26425735a3999bd51d39dd82c)

2 years agoipfilter: New DT5 DTrace macro
Cy Schubert [Tue, 5 Oct 2021 04:18:42 +0000 (21:18 -0700)]
ipfilter: New DT5 DTrace macro

Define a new DT5 DTrace macro used to call DTRACE_PROBE5, for use with
SDT probes with five arguments.

(cherry picked from commit ca8bf28e1ee6ff213338c2a111069f5e639ea03a)

2 years agoipfilter: Whitespace cleanup
Cy Schubert [Tue, 5 Oct 2021 04:16:16 +0000 (21:16 -0700)]
ipfilter: Whitespace cleanup

Clean up whitespace from compaction of DTn macro definitions.

(cherry picked from commit fca9c3871dddb75d62e06386f750363f549cb069)

2 years agoipfilter: Compat and simplify DTrace macro definitions
Cy Schubert [Tue, 5 Oct 2021 04:13:47 +0000 (21:13 -0700)]
ipfilter: Compat and simplify DTrace macro definitions

Use a compound #if to simplify and compact DTn DTRACE_PROBEn macros
used by ipfilter.

(cherry picked from commit 2d74fed5be523370345af10fdccd0b4fc8baa53e)

2 years agoipfilter: Save a word of stack space
Cy Schubert [Mon, 4 Oct 2021 18:36:15 +0000 (11:36 -0700)]
ipfilter: Save a word of stack space

Rather than save the return code into an intermediate variable, which BTW
is optimized out anyway, explicitly remove the return code from the stack.

(cherry picked from commit b7f127b6e5f9febff895da9230c3269dfcd971c2)

2 years agoinetd.8: Lint the file
Mateusz Piotrowski [Mon, 6 Dec 2021 20:45:26 +0000 (21:45 +0100)]
inetd.8: Lint the file

Remove Tn macros and fix other style warnings.

MFC after: 3 days

(cherry picked from commit aab6fe0c2c3195c1b9ee967796b7c8c6c82d94ec)

2 years agoinetd.8: Sort options
Mateusz Piotrowski [Mon, 6 Dec 2021 20:56:42 +0000 (21:56 +0100)]
inetd.8: Sort options

While here:

- Cluster flags without arguments together.
- Simplify the synopsis of the -a flag. There is no need to distinguish
  between address and hostname there.
- Add a missing argument to the -a flag in the description section.
- Fix some typos.

MFC after: 3 days

(cherry picked from commit 593ad024e4ed04e4c875446e5277d82e3111848f)

2 years agosrc.conf.5: regen after WITH_/WITHOUT_CXX description update
Ed Maste [Thu, 9 Dec 2021 01:52:33 +0000 (20:52 -0500)]
src.conf.5: regen after WITH_/WITHOUT_CXX description update

Sponsored by: The FreeBSD Foundation

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

(cherry picked from commit 145a574fa1a9fa6732a7917778ed3185e990d1dd)

2 years agoig4: Add PCI IDs for Intel Alder Lake I2C controller.
Alexander Motin [Thu, 25 Nov 2021 01:13:38 +0000 (20:13 -0500)]
ig4: Add PCI IDs for Intel Alder Lake I2C controller.

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

(cherry picked from commit e8e8d2290ee68ddf8753ea345d4424f959bdb69d)

2 years agoAPEI: Fix Generic Error Data Entry revision 3.0 handling.
Alexander Motin [Thu, 25 Nov 2021 04:03:20 +0000 (23:03 -0500)]
APEI: Fix Generic Error Data Entry revision 3.0 handling.

Since revision 3.0 this structure grown another field, breaking access
to the following data structures.  This change fixes the PCIe errors
decoding on newer systems.

MFC after: 2 weeks

(cherry picked from commit ba83762a623033576bab5942312365d2d738f437)

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

PR: 260174

(cherry picked from commit 7a9423d6f360e3758ca67fbb25d309140ea93670)

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

(cherry picked from commit 0ea3e4a27bc0d1b0fdf876c3ef89d790e29ad5b1)

2 years agovm_fault: Factor out per-object operations into vm_fault_object()
Mark Johnston [Wed, 24 Nov 2021 18:43:38 +0000 (13:43 -0500)]
vm_fault: Factor out per-object operations into vm_fault_object()

No functional change intended.

Obtained from: jeff (object_concurrency patches)
Reviewed by: kib

(cherry picked from commit d47d3a94bb2d873b1c3a5cdfe9cc00e4619f649b)

2 years agovm_fault: Introduce a fault_status enum for internal return types
Mark Johnston [Wed, 24 Nov 2021 18:43:26 +0000 (13:43 -0500)]
vm_fault: Introduce a fault_status enum for internal return types

Rather than overloading the meanings of the Mach statuses, introduce a
new set for use internally in the fault code.  This makes the control
flow easier to follow and provides some extra error checking when a
fault status variable is used in a switch statement.

vm_fault_lookup() and vm_fault_relookup() continue to use Mach statuses
for now, as there isn't much benefit to converting them and they
effectively pass through a status from vm_map_lookup().

Obtained from: jeff (object_concurrency patches)
Reviewed by: kib

(cherry picked from commit f1b642c255a2931fd793219d11562310a2ce49c8)

2 years agovm_fault: Move nera into faultstate
Mark Johnston [Wed, 24 Nov 2021 18:42:32 +0000 (13:42 -0500)]
vm_fault: Move nera into faultstate

This makes it easier to factor out pieces of vm_fault().  No functional
change intended.

Obtained from: jeff (object_concurrency patches)
Reviewed by: kib

(cherry picked from commit 45c09a74d681cfcad0a556b753cd56f6084ace46)

2 years agoichsmb: Add PCI IDs for Intel Alder Lake SMBus controller
Alexander Motin [Wed, 24 Nov 2021 18:06:52 +0000 (13:06 -0500)]
ichsmb: Add PCI IDs for Intel Alder Lake SMBus controller

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

(cherry picked from commit f29f6b2e1fc93ea68171f6c974ffe654232d09ca)

2 years agompsutil: Fix data truncation by too short buffers.
Alexander Motin [Tue, 30 Nov 2021 01:14:13 +0000 (20:14 -0500)]
mpsutil: Fix data truncation by too short buffers.

Length of some string buffers was insufficient for cases of more that
99 targets per HBA or slots per enclosure.  Some others are tuned just
for better alignment.  While there also fix output formatting issues.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

(cherry picked from commit f5b0083302edcf421265530cc01dd87c06b23af1)

2 years agoGEOM: Switch g_io_deliver() locking from cp to pp.
Alexander Motin [Sun, 21 Nov 2021 23:50:59 +0000 (18:50 -0500)]
GEOM: Switch g_io_deliver() locking from cp to pp.

Single provider may have multiple consumers, and locking one of consumers
is not sufficient to protect the provider.  Though the only part of the
provider this locking protects now is its statistics.

Reported by: Arka Sharma <arka.sw1988@gmail.com>
MFC after: 2 weeks

(cherry picked from commit 06bd74e1e39cb33b18b19a748a80b5e1d70fda17)

2 years agonet80211(4): Fix a typo in a sysctl description
Gordon Bergling [Sat, 4 Dec 2021 11:09:17 +0000 (12:09 +0100)]
net80211(4): Fix a typo in a sysctl description

- s/travelse/traversal/

(cherry picked from commit a9beea051171e19f3ea36febc84df55b3cd78d6b)

2 years agoipfilter(4): Fix a typo in an error message
Gordon Bergling [Sat, 4 Dec 2021 11:10:39 +0000 (12:10 +0100)]
ipfilter(4): Fix a typo in an error message

- s/addresss/address/

This is a direct commit to contrib since the upstream is
no longer active.

(cherry picked from commit e10ac086319df82b7bdc93aa9af61620a33eda2f)

2 years agoomap4: Fix a few typos in source code comments
Gordon Bergling [Sat, 4 Dec 2021 11:13:27 +0000 (12:13 +0100)]
omap4: Fix a few typos in source code comments

- s/addresss/address/

(cherry picked from commit b86066a15edb85c035d7d1dc9cf661d727bfb951)

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

(cherry picked from commit 0d2224733e970aaa67a4e1af7b340044adda92f6)

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

(cherry picked from commit b02908b051c897117ebbc3dcb55848383b17c435)

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

(cherry picked from commit 8bc792b3845ecf64145fda7964a7b5cc54dea777)

2 years agopf: remove unused variables
Kristof Provost [Mon, 22 Nov 2021 19:30:22 +0000 (20:30 +0100)]
pf: remove unused variables

No functional change intended.

Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33085

(cherry picked from commit c36f90417b734e56ef938cc2d19601001c709f40)

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

(cherry picked from commit aaa4cd7f3c933950582dfb4f0eac23a200dafe53)

2 years agofusefs: Fix a bug during VOP_STRATEGY when the server changes file size
Alan Somers [Sun, 3 Oct 2021 17:51:14 +0000 (11:51 -0600)]
fusefs: Fix a bug during VOP_STRATEGY when the server changes file size

If the FUSE server tells the kernel that a file's size has changed, then
the kernel must invalidate any portion of that file in cache.  But the
kernel can't do that during VOP_STRATEGY, because the file's buffers are
already locked.  Instead, proceed with the write.

PR: 256937
Reported by: Agata <chogata@moosefs.pro>
Tested by: Agata <chogata@moosefs.pro>
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D32332

(cherry picked from commit 032a5bd55b3a003d3560435422a95f27f91685fe)

2 years agofusefs: fix a recurse-on-non-recursive lockmgr panic
Alan Somers [Sat, 2 Oct 2021 18:17:36 +0000 (12:17 -0600)]
fusefs: fix a recurse-on-non-recursive lockmgr panic

fuse_vnop_bmap needs to know the file's size in order to calculate the
optimum amount of readahead.  If the file's size is unknown, it must ask
the FUSE server.  But if the file's data was previously cached and the
server reports that its size has shrunk, fusefs must invalidate the
cached data.  That's not possible during VOP_BMAP because the buffer
object is already locked.

Fix the panic by not querying the FUSE server for the file's size during
VOP_BMAP if we don't need it.  That's also a a slight performance
optimization.

PR: 256937
Reported by: Agata <chogata@moosefs.pro>
Tested by: Agata <chogata@moosefs.pro>

(cherry picked from commit 7430017b9978cae054ed99e5160f739e5ca021d5)

2 years agofusefs: quiet some cache-related warnings
Alan Somers [Sun, 3 Oct 2021 16:59:04 +0000 (10:59 -0600)]
fusefs: quiet some cache-related warnings

If the FUSE server does something that would make our cache incoherent,
we should print a warning to the user.  However, we previously warned in
some situations when we shouldn't, such as if the file's size changed on
the server _after_ our own attribute cache had expired.  This change
suppresses the warning in cases like that.  It also moves the warning
logic to a single place within the code.

PR: 256936
Reported by: Agata <chogata@moosefs.pro>
Tested by: Agata <chogata@moosefs.pro>, jSML4ThWwBID69YC@protonmail.com

(cherry picked from commit 5d94aaacb5180798b2f698e33937f068386004eb)

2 years agofusefs: implement FUSE_NO_OPEN_SUPPORT and FUSE_NO_OPENDIR_SUPPORT
Alan Somers [Sat, 25 Sep 2021 03:53:28 +0000 (21:53 -0600)]
fusefs: implement FUSE_NO_OPEN_SUPPORT and FUSE_NO_OPENDIR_SUPPORT

For file systems that allow it, fusefs will skip FUSE_OPEN,
FUSE_RELEASE, FUSE_OPENDIR, and FUSE_RELEASEDIR operations, a minor
optimization.

Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D32141

(cherry picked from commit 7124d2bc3a3bd58f6d3803a0579f2e0fa853b56d)

2 years agofusefs: diff reduction in fuse_kernel.h
Alan Somers [Sat, 25 Sep 2021 14:23:54 +0000 (08:23 -0600)]
fusefs: diff reduction in fuse_kernel.h

Synchronize formatting and documentation in fuse_kernel.h with upstream
sources.

Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D32141

(cherry picked from commit a3a1ce3794e85fe27cb5af5e9f48a490a9ef70c2)

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)

(cherry picked from commit f16ec9c6e36f1d481468e7301d6f3b857db17561)

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)

(cherry picked from commit 78963d796d5cd8b4f6f0e810eaae7a5f02706b02)

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

(cherry picked from commit a18ddf775744f31a844fd01fbe90207f7c5e706d)

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)

(cherry picked from commit bd44dce5b3176c19a9435a5e7e125fc06182fbc9)

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

(cherry picked from commit 25cda42a498101612687b32005856cd8b14f2f7a)

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

(cherry picked from commit 8ed1e4a5c1a9d0550f1a81e80e22c4012dadec64)

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 ()

(cherry picked from commit b239cc204a57de4fea7c9477169591ed2df36fc8)

2 years agoposix_spawn.c: format fae_action anon enum more stylish
Konstantin Belousov [Sat, 27 Nov 2021 22:36:19 +0000 (00:36 +0200)]
posix_spawn.c: format fae_action anon enum more stylish

(cherry picked from commit adbaf1b443c68c70911aeb62c9963dd583ec9b45)

2 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

(cherry picked from commit c6081dea597a475e4bbcc8588ece03ae78b58978)

2 years agoBelatedly update contrib/llvm-project/FREEBSD-Xlist for llvm 13
Dimitry Andric [Sat, 20 Nov 2021 17:06:36 +0000 (18:06 +0100)]
Belatedly update contrib/llvm-project/FREEBSD-Xlist for llvm 13

(cherry picked from commit 3adc9c8c73a5225a841e663822b329b8bb8e64b6)

2 years agomips: Fix build of kernel.tramp.bin after upstream merge
Jessica Clarke [Thu, 11 Nov 2021 18:28:24 +0000 (19:28 +0100)]
mips: Fix build of kernel.tramp.bin after upstream merge

Since the upstream merge we end up with the compiler generating calls to
memcpy (and it appears upstream LLVM does too, so this will probably
also be a problem upstream when the LLVM 13 import is finished). Like
the kernel we should just compile this file with -ffreestanding to avoid
such surprises.

Note that elf_trampoline.c does actually provide a memcpy, but it's
static. That's a bit weird, and means by the time the memcpy calls are
generated by the compiler the explicit ones have already been inlined
and the function itself GC'ed, but since using -ffreestanding is the
right thing to do for this kind of code anyway, that doesn't actually
matter.

Obtained from: https://github.com/CTSRD-CHERI/cheribsd/commit/219ddb6293c

(cherry picked from commit a2fa290024e73107a214e37c257ce93a3f131a41)

2 years agoApply fix for LLVM PR51957 (Miscompilation in Botan's SHA3)
Dimitry Andric [Wed, 10 Nov 2021 18:38:23 +0000 (19:38 +0100)]
Apply fix for LLVM PR51957 (Miscompilation in Botan's SHA3)

Merge commit e27a6db5298f from llvm git (by Jameson Nash):

  Bad SLPVectorization shufflevector replacement, resulting in write to wrong memory location

  We see that it might otherwise do:

    %10 = getelementptr {}**, <2 x {}***> %9, <2 x i32> <i32 10, i32 4>
    %11 = bitcast <2 x {}***> %10 to <2 x i64*>
  ...
    %27 = extractelement <2 x i64*> %11, i32 0
    %28 = bitcast i64* %27 to <2 x i64>*
    store <2 x i64> %22, <2 x i64>* %28, align 4, !tbaa !2

  Which is an out-of-bounds store (the extractelement got offset 10
  instead of offset 4 as intended). With the fix, we correctly generate
  extractelement for i32 1 and generate correct code.

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

(cherry picked from commit 397a8ba05313cc3815d219c9d1b2de1372fcb561)

2 years agoFix assertion when building devel/glog with new pass manager
Dimitry Andric [Tue, 2 Nov 2021 10:17:37 +0000 (11:17 +0100)]
Fix assertion when building devel/glog with new pass manager

Merge commit 029f1a534489 from llvm git (by Arthur Eubanks):

  [LazyCallGraph] Skip blockaddresses

  blockaddresses do not participate in the call graph since the only
  instructions that use them must all return to someplace within the
  current function. And passes cannot retrieve a function address from a
  blockaddress.

  This was suggested by efriedma in D58260.

  Fixes PR50881.

  Reviewed By: nickdesaulniers

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

(cherry picked from commit a18c6161efc903f636c41b8e521e917a5b315ce8)