]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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 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

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

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

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.

2 years agorc.conf(5): Add _limits, _login_class, and _oomprotect
Daniel Ebdrup Jensen [Tue, 18 May 2021 12:46:41 +0000 (14:46 +0200)]
rc.conf(5): Add _limits, _login_class, and _oomprotect

Add a few very useful variables that might easily be overlooked, since
they're only documented in rc.subr(8) which might not be the first place
that people look.

At least _oomprotect has existed since 11.0-RELEASE, and doesn't appear
to be very well-known. While the others aren't as new, in my estimation,
a lot more people would use them if they knew about them.

While here, also add a reference to rc.subr(8) and login.conf(5), and
sort the variables alphabetically.

Reported by:  Daniel Dettlaff <dmilith at gmail.com>
Reviewed by: ceri, gbe, 0mp, ygy, a.wolk, pauamma

2 years agosyscalls: regen
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: regen

2 years agosyscalls: mprotect does not take a const
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: mprotect does not take a const

The mprotect syscall decleration is not const.  I added this one
incorrectly in a944d28d0edf7ceb1bef4d789dfa4e8e18331658.

Reported by: kib
Reviewed by: kib, imp

2 years agosyscalls: regen
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: regen

2 years agosyscalls: make syscall and __syscall SYSMUX
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: make syscall and __syscall SYSMUX

Rather than combining the declearation of nosys with the registration
of SYS_syscall, declare syscall(2) and __syscall(2) with the new
SYSMUX type in syscalls.master and declare nosys directly.  This
eliminates the last use of syscall aliases in the tree.

Reviewed by: kib, imp

2 years agomakesyscalls: add a new SYSMUX type
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
makesyscalls: add a new SYSMUX type

This type is for system call multiplexers (syscall(2), __syscall(2))
that don't have a normal handler and instead are handled in the
machine-dependent syscall code.

Reviewed by: kib, imp

2 years agosyscalls: regen
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: regen

2 years agosyscalls: normalize exit
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: normalize exit

Declare the exit system call normally.  This results in the
implementation being named sys_exit rather than sys_sys_exit and
being decalred as returning an int.  Infact it does not return
at all because exit1 does not, so add an __unreachable() to let the
compiler know that.

Reviewed by: kib, imp

2 years agosyscalls: regen
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: regen

2 years agosyscalls: normalize (get|set)rlimit
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
syscalls: normalize (get|set)rlimit

Declare normal <foo>_args structs rather than going out of the way
to declare __<foo>_args.

Reviewed by: kib, imp

2 years agosyscalls: regen
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
syscalls: regen

2 years agosyscalls: normalize orecvfrom and ogetsockname
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
syscalls: normalize orecvfrom and ogetsockname

Declare o<foo>_args rather than reusing the equivalent <foo>_args
structs.  Avoiding the addition of a new type isn't worth the
gratutious differences.

Reviewed by: kib, imp

2 years agouipc: rework recvfrom, getsockname, getpeername
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
uipc: rework recvfrom, getsockname, getpeername

Stop using <foo>_args structs as part of internal kernel APIs.  Add
a kern_recvfrom and adjust getsockname and getpeername's equivalent
functions to take individual arguments rather than a uap pointer.

Adopt a convention from CheriBSD that a function interacting with
userspace pointers and sitting between the sys_<foo> syscall and
kern_<foo> implementation is named user_<foo>.

Reviewed by: kib, imp

2 years agosyscalls: correct a couple style issues
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
syscalls: correct a couple style issues

Reviewed by: kib, imp

2 years agosyscalls: add missing SAL annotations
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
syscalls: add missing SAL annotations

freebsd7_shmctl was missing an annotation

Reviewed by: kib, imp

2 years agoelf.5: Document compressed section headers
Mark Johnston [Mon, 29 Nov 2021 18:51:50 +0000 (13:51 -0500)]
elf.5: Document compressed section headers

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

2 years agolibelf: Link gelf_getchdr.3 to the build
Mark Johnston [Mon, 29 Nov 2021 18:51:38 +0000 (13:51 -0500)]
libelf: Link gelf_getchdr.3 to the build

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agomii/dp83822phy: Remove a declaration for a non-existent function
Mark Johnston [Mon, 29 Nov 2021 18:51:05 +0000 (13:51 -0500)]
mii/dp83822phy: Remove a declaration for a non-existent function

Fixes: 0c9156faeccb ("Introduce DP83822 PHY driver")

2 years agodummynet: Fix socket option length validation for IP_DUMMYNET3
Mark Johnston [Mon, 29 Nov 2021 18:50:30 +0000 (13:50 -0500)]
dummynet: Fix socket option length validation for IP_DUMMYNET3

The socket option handler tries to ensure that the option length is no
larger than some reasonable maximum, and no smaller than sizeof(struct
dn_id).  But the loaded option length is stored in an int, which is
converted to an unsigned integer for the comparison with a size_t, so
negative values are not caught and instead get passed to malloc().

Change the code to use a size_t for the buffer size.

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

2 years agodummynet: Avoid an out-of-bounds read in do_config()
Mark Johnston [Mon, 29 Nov 2021 18:50:21 +0000 (13:50 -0500)]
dummynet: Avoid an out-of-bounds read in do_config()

do_config() processes a buffer of variable-length dummynet commands.
The loop which processes this buffer loads the fixed-length header
before checking whether there are any bytes left to read, so it performs
a 4-byte read past the end of the buffer before terminating.

Restructure the loop to avoid this.

Reported by: Jenkins (KASAN job)
Reviewed by: kp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33132

2 years agoext2: Check for e2fs_first_dblock in ext2_compute_sb_data()
Neel Chauhan [Tue, 16 Nov 2021 22:59:26 +0000 (14:59 -0800)]
ext2: Check for e2fs_first_dblock in ext2_compute_sb_data()

This prevents a kernel panic on a damaged ext2 superblock.

PR: 259107
Reported by: Robert Morris <rtm@lcs.mit.edu>
Differential Revision: https://reviews.freebsd.org/D33029

2 years agoUSB: add CYUSB330x to usbdevs
Bjoern A. Zeeb [Fri, 15 Oct 2021 10:46:58 +0000 (10:46 +0000)]
USB: add CYUSB330x to usbdevs

Add the Cypress dual USB3/2 HUB CYUSB330x as found in SolidRun's
HoneyComb to usbdevs.

2 years agolinux(4): Fix "set but not used" warnings
Edward Tomasz Napierala [Mon, 29 Nov 2021 16:44:40 +0000 (16:44 +0000)]
linux(4): Fix "set but not used" warnings

No functional changes.

Sponsored By: EPSRC

2 years agocfiscsi(4): Fix "set but not used" warning
Edward Tomasz Napierala [Mon, 29 Nov 2021 16:44:12 +0000 (16:44 +0000)]
cfiscsi(4): Fix "set but not used" warning

No functional changes.

Sponsored By: EPSRC

2 years agocdceem(4): Fix "set but not used" warnings
Edward Tomasz Napierala [Mon, 29 Nov 2021 16:42:59 +0000 (16:42 +0000)]
cdceem(4): Fix "set but not used" warnings

No functional changes.

Sponsored By: EPSRC

2 years agoshutdown: unmount filesystems after swapoff
Konstantin Belousov [Sun, 28 Nov 2021 01:52:46 +0000 (03:52 +0200)]
shutdown: unmount filesystems after swapoff

Swap on file requires operational underlying mount, otherwise
swapoff_all() is guaranteed to panic due to the default strategy VOP for
reclaimed vnodes.

Reported and tested by: peterj
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33147

2 years agoswapoff_one(): only check free pages count manually turning swap off
Konstantin Belousov [Fri, 26 Nov 2021 23:22:27 +0000 (01:22 +0200)]
swapoff_one(): only check free pages count manually turning swap off

When swap is turned off due to system shutdown or reboot, ignore the
check.  Problem is that the check is not accurate by any means, free
page count can legitimately be low while system still able to page in
everything from the swap.  Then, we turn swap off if swapping on
real file or some non-standard geom provider, and typically panic
when system appears to actually need to unavailable page.

For syscall, it is better to be safe than sorry.

Reported and tested by: peterj
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33147

2 years agommc: Fix HS200/HS400 capability check
Kornel Duleba [Sun, 28 Nov 2021 11:24:07 +0000 (12:24 +0100)]
mmc: Fix HS200/HS400 capability check

HS200 and HS400 speeds can be enabled either with 1.2, or 1.8V signaling voltage.
Because of that we have four cabability flags: MMC_CAP_MMC_HS200_120,
MMC_CAP_MMC_HS200_180, MMC_CAP_MMC_HS400_120, MMC_CAP_MMC_HS400_180.

MMC logic only enables HS200/HS400 mode if both flags are set for the corresponding speed.
Fix that by being more permissive in host timing cap check.

Reviewed by: manu, mw
MFC after: 2 weeks
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D33130

2 years agocitrus_prop.c: do not ignore sign
Konstantin Belousov [Sun, 28 Nov 2021 03:03:49 +0000 (05:03 +0200)]
citrus_prop.c: do not ignore sign

In _citrus_prop_read_TYPE_func_ generated functions, do not ignore parsed
'-' sign, negate the value as appropriate.

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

2 years agolibc/tests/stdlib/dynthr_mod/dynthr_mod.c: mark dummy as used
Konstantin Belousov [Sun, 28 Nov 2021 03:25:28 +0000 (05:25 +0200)]
libc/tests/stdlib/dynthr_mod/dynthr_mod.c: mark dummy as used

It receives the malloc() result, and we do not want the malloc() call
to be optimized out, which is allowed for hosted compiler.  Use dummy
for actual write though.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agonetbsd h_raw.c test: fake use of sum to avoid warning
Konstantin Belousov [Sun, 28 Nov 2021 03:35:45 +0000 (05:35 +0200)]
netbsd h_raw.c test: fake use of sum to avoid warning

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agot_mlock.c: Remove null_errno, it is write-only
Konstantin Belousov [Sun, 28 Nov 2021 03:28:29 +0000 (05:28 +0200)]
t_mlock.c: Remove null_errno, it is write-only

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/stdio/vfwscanf.c::convert_wstring(): wcp0 is write-only
Konstantin Belousov [Sun, 28 Nov 2021 03:16:08 +0000 (05:16 +0200)]
libc/stdio/vfwscanf.c::convert_wstring(): wcp0 is write-only