]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agoarm: Use C89 function declaration for db_read_bytes.
John Baldwin [Thu, 20 Apr 2023 18:00:46 +0000 (11:00 -0700)]
arm: Use C89 function declaration for db_read_bytes.

14 months agoperfmon(4): Use a C89 function definition for a SYSINIT.
John Baldwin [Thu, 20 Apr 2023 18:00:46 +0000 (11:00 -0700)]
perfmon(4): Use a C89 function definition for a SYSINIT.

14 months agoRemove a few more references to riscv64sf.
John Baldwin [Thu, 20 Apr 2023 18:00:46 +0000 (11:00 -0700)]
Remove a few more references to riscv64sf.

Fixes: 1ca12bd927d7 Remove the riscv64sf architecture.

14 months agodtrace: add register bindings for RISC-V
Christos Margiolis [Thu, 20 Apr 2023 16:25:37 +0000 (16:25 +0000)]
dtrace: add register bindings for RISC-V

Reviewed by: mhorne, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39611

14 months agodtrace: use dtrace_instr_size() in the riscv dtrace_subr.c
Christos Margiolis [Thu, 20 Apr 2023 16:24:03 +0000 (16:24 +0000)]
dtrace: use dtrace_instr_size() in the riscv dtrace_subr.c

No functional change intended.

Reviewed by: mhorne, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39652

14 months agodtrace: expose dtrace_instr_size() to userland and implement it for riscv
Christos Margiolis [Thu, 20 Apr 2023 16:21:46 +0000 (16:21 +0000)]
dtrace: expose dtrace_instr_size() to userland and implement it for riscv

dtrace_instr_size() is needed by the forthcoming RISC-V port of kinst,
as well as by libdtrace in D38825 for both amd64 and RISC-V.

Reviewed by: markj, mhorne
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39489

14 months agodtrace: get rid of uchar_t types
Christos Margiolis [Thu, 20 Apr 2023 16:19:42 +0000 (16:19 +0000)]
dtrace: get rid of uchar_t types

Callers are specifying uint8_t anyway and this slightly reduces
dependencies on compatibility typedefs.  No functional change intended.

Reviewed by: markj, mhorne
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39490

14 months agoRevert "libc: Implement bsort(3) a bitonic type of sorting algorithm."
Hans Petter Selasky [Thu, 20 Apr 2023 16:50:32 +0000 (18:50 +0200)]
Revert "libc: Implement bsort(3) a bitonic type of sorting algorithm."

Some points for the future:
 - libc is not the right place for sorting algorithms.
   Probably libutil is better suited for this purpose or
   a dedicated libsort. Should move all sorting algorithms
   away from libc eventually.
 - CheriBSD uses capabilities for memory access, and could
   benefit from a standard memswap() function.
 - Do something about qsort() in FreeBSD's libc like:
   - Mark it deprecated on FreeBSD, as a first step,
     due to missing limits on CPU time.
   - Audit the use of qsort() in the FreeBSD base system
     and consider swapping to other existing sorting
     algorithms.

Discussed with: brooks@

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

This reverts commit a7469c9c0a504a5e6e9b89e148cd78df5e67ff7f.
This reverts commit 7d65a450cdcc7cc743f2ecd114ba3428a21c0033.
This reverts commit 8dcf3a82c54cb216df3213a013047907636a01da.

14 months agoFix building host tools for host
Simon J. Gerraty [Thu, 20 Apr 2023 17:05:43 +0000 (10:05 -0700)]
Fix building host tools for host

Several makefile depend on tools built for host.
At least when using DIRDEPS_BUILD we can build these for the
pseudo machine "host" to facilitate building on older host versions.

Ideally we would build these tools in their own directories to avoid
building more than needed.

For now, setting an appropriate default for BTOOLSPATH will suffice

Reviewed by: stevek
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39708

14 months agox86: Move i386 timerreg.h to x86
Dmitry Chagin [Thu, 20 Apr 2023 16:42:59 +0000 (19:42 +0300)]
x86: Move i386 timerreg.h to x86

Reviewed by: emaste, jhb
Differential Revision: https://reviews.freebsd.org/D39656
MFC after: 1 month

14 months agox86: Move i386 ppireg.h to x86
Dmitry Chagin [Thu, 20 Apr 2023 16:42:59 +0000 (19:42 +0300)]
x86: Move i386 ppireg.h to x86

Differential Revision: https://reviews.freebsd.org/D39655
MFC after: 1 month

14 months agoAdd jobs.mk to allow for target-jobs
Simon J. Gerraty [Thu, 20 Apr 2023 16:40:39 +0000 (09:40 -0700)]
Add jobs.mk to allow for target-jobs

jobs.mk automates -j$JOB_MAX and capturing build log based on target.

Compute a default for JOB_MAX in local.sys.mk

Reviewed by: stevek, imp
Differential Revision: https://reviews.freebsd.org/D39683

14 months agomakefs: set cd9660 Rock Ridge timestamps for . and ..
Ed Maste [Tue, 18 Apr 2023 13:57:29 +0000 (09:57 -0400)]
makefs: set cd9660 Rock Ridge timestamps for . and ..

DOT and DOTDOT entries have special handling, and previously only Rock
Ridge PX (POSIX attributes) entries were attached.  Add TF (timestamp)
entries as well.

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

14 months agoinpcb: Release the inpcb cred reference before freeing the structure
Mark Johnston [Thu, 20 Apr 2023 15:48:33 +0000 (11:48 -0400)]
inpcb: Release the inpcb cred reference before freeing the structure

Now that the inp_cred pointer is accessed only while the inpcb lock is
held, we can avoid deferring a crfree() call when freeing an inpcb.

This fixes a problem introduced when inpcb hash tables started being
synchronized with SMR: the credential reference previously could not be
released until all lockless readers have drained, and there is no
mechanism to explicitly purge cached, freed UMA items.  Thus, ucred
references could linger indefinitely, and since ucreds hold a jail
reference, the jail would linger indefinitely as well.  This manifests
as jails getting stuck in the DYING state.

Discussed with: glebius
Tested by: glebius
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D38573

14 months agoinpcb: Avoid inp_cred dereferences in SMR-protected lookup
Mark Johnston [Thu, 20 Apr 2023 15:48:19 +0000 (11:48 -0400)]
inpcb: Avoid inp_cred dereferences in SMR-protected lookup

The SMR-protected inpcb lookup algorithm currently has to check whether
a matching inpcb belongs to a jail, in order to prioritize jailed
bound sockets.  To do this it has to maintain a ucred reference, and for
this to be safe, the reference can't be released until the UMA
destructor is called, and this will not happen within any bounded time
period.

Changing SMR to periodically recycle garbage is not trivial.  Instead,
let's implement SMR-synchronized lookup without needing to dereference
inp_cred.  This will allow the inpcb code to free the inp_cred reference
immediately when a PCB is freed, ensuring that ucred (and thus jail)
references are released promptly.

Commit 220d89212943 ("inpcb: immediately return matching pcb on lookup")
gets us part of the way there.  This patch goes further to handle
lookups of unconnected sockets.  Here, the strategy is to maintain a
well-defined order of items within a hash chain so that a wild lookup
can simply return the first match and preserve existing semantics.  This
makes insertion of listening sockets more complicated in order to make
lookup simpler, which seems like the right tradeoff anyway given that
bind() is already a fairly expensive operation and lookups are more
common.

In particular, when inserting an unconnected socket, in_pcbinhash() now
keeps the following ordering:
- jailed sockets before non-jailed sockets,
- specified local addresses before unspecified local addresses.

Most of the change adds a separate SMR-based lookup path for inpcb hash
lookups.  When a match is found, we try to lock the inpcb and
re-validate its connection info.  In the common case, this works well
and we can simply return the inpcb.  If this fails, typically because
something is concurrently modifying the inpcb, we go to the slow path,
which performs a serialized lookup.

Note, I did not touch lbgroup lookup, since there the credential
reference is formally synchronized by net_epoch, not SMR.  In
particular, lbgroups are rarely allocated or freed.

I think it is possible to simplify in_pcblookup_hash_wild_locked() now,
but I didn't do it in this patch.

Discussed with: glebius
Tested by: glebius
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D38572

14 months agoinpcb: Move inpcb matching logic into separate functions
Mark Johnston [Thu, 20 Apr 2023 15:48:08 +0000 (11:48 -0400)]
inpcb: Move inpcb matching logic into separate functions

These functions will get some additional callers in future revisions.

No functional change intended.

Discussed with: glebius
Tested by: glebius
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38571

14 months agoinpcb: Split PCB hash tables
Mark Johnston [Thu, 20 Apr 2023 15:48:01 +0000 (11:48 -0400)]
inpcb: Split PCB hash tables

Currently we use a single hash table per PCB database for connected and
bound PCBs.  Since we started using net_epoch to synchronize hash table
lookups, there's been a bug, noted in a comment above in_pcbrehash():
connecting a socket can cause an inpcb to move between hash chains, and
this can cause a concurrent lookup to follow the wrong linkage pointers.
I believe this could cause rare, spurious ECONNREFUSED errors in the
worse case.

Address the problem by introducing a second hash table and adding more
linkage pointers to struct inpcb.  Now the database has one table each
for connected and unconnected sockets.

When inserting an inpcb into the hash table, in_pcbinhash() now looks at
the foreign address of the inpcb to figure out which table to use.  This
ensures that queue linkage pointers are stable until the socket is
disconnected, so the problem described above goes away.  There is also a
small benefit in that in_pcblookup_*() can now search just one of the
two possible hash buckets.

I also made the "rehash" parameter of in(6)_pcbconnect() unused.  This
parameter seems confusing and it is simpler to let the inpcb code figure
out what to do using the existing INP_INHASHLIST flag.

UDP sockets pose a special problem since they can be connected and
disconnected multiple times during their lifecycle.  To handle this, the
patch plugs a hole in the inpcb structure and uses it to store an SMR
sequence number.  When an inpcb is disconnected - an operation which
requires the global PCB database hash lock - the write sequence number
is advanced, and in order to reconnect, the connecting thread must wait
for readers to drain before reusing the inpcb's hash chain linkage
pointers.

raw_ip (ab)uses the hash table without using the corresponding
accessors.  Since there are now two hash tables, it arbitrarily uses the
"connected" table for all of its PCBs.  This will be addressed in some
way in the future.

inp interators which specify a hash bucket will only visit connected
PCBs.  This is not really correct, but nothing in the tree uses that
functionality except raw_ip, which as mentioned above places all of its
PCBs in the "connected" table and so is unaffected.

Discussed with: glebius
Tested by: glebius
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D38569

14 months agoLinuxKPI: 802.11: improve assertion and tkip code
Bjoern A. Zeeb [Thu, 20 Apr 2023 16:01:05 +0000 (16:01 +0000)]
LinuxKPI: 802.11: improve assertion and tkip code

Move a KASSERT out of a function and make it a CTASSERT with
appropriate comments.

Skeleton implement two tkip functions, still left TODO, initializing
variables with dummy values to quiten compiler warnings.  It is
unclear to me if we should still ever properly implement TKIP
compat code at this point.  If so the current code gives a good
idea what needs to be done in addition to allocating references
to real state along with keyconf.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

14 months agoiwlwifi: quieten more compiler warnings
Bjoern A. Zeeb [Thu, 20 Apr 2023 15:57:14 +0000 (15:57 +0000)]
iwlwifi: quieten more compiler warnings

Quieten some more (valid) gcc warnings and disable dead code.
There are more warnings, some probably a compiler problem, the
other related to firmware structs which I do not want to adjust
just locally.  Leave a comment to revisit after a next driver
update.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

14 months agonetwork.subr: adjust regex for wlans_xxxxx rc.conf entries
Bjoern A. Zeeb [Tue, 18 Apr 2023 14:40:13 +0000 (14:40 +0000)]
network.subr: adjust regex for wlans_xxxxx rc.conf entries

Drivers like ath1[012]k will not match the current wlans_*-regex as
they have digits followed by letters.  Adjust the regex to allow
this combination in order to be able to configure interfaces with
names like wlans_ath11k0="..."

MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39674

14 months agovmrun.sh: Fix a typo in usage()
Mateusz Piotrowski [Thu, 20 Apr 2023 12:43:57 +0000 (14:43 +0200)]
vmrun.sh: Fix a typo in usage()

MFC after: 3 days
Sponsored by: Klara Inc.

14 months agoLinuxKPI: fix READ_ONCE() -Wcast-equal warnings
Bjoern A. Zeeb [Wed, 19 Apr 2023 21:43:59 +0000 (21:43 +0000)]
LinuxKPI: fix READ_ONCE() -Wcast-equal warnings

Rather than using ACCESS_ONCE() in READ_ONCE() add a missing cast
to const in order to satisfy -Wcast-equal by gcc.
Sadly we cannot do the same to WRITE_ONCE() which still is very
noisy.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D39706

14 months agoifnet: factor out interface renaming into a separate function.
Alexander V. Chernikov [Wed, 19 Apr 2023 14:26:20 +0000 (14:26 +0000)]
ifnet: factor out interface renaming into a separate function.

This change is required to support interface renaming via Netlink.
No functional changes intended.

Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D39692
MFC after: 2 weeks

14 months agostand: Remove a double word in a source code comment
Gordon Bergling [Thu, 20 Apr 2023 09:11:18 +0000 (11:11 +0200)]
stand: Remove a double word in a source code comment

- s/value value/value/

MFC after: 3 days

14 months agozfs: fix up EINVAL from getdirentries on .zfs
Mateusz Guzik [Thu, 20 Apr 2023 08:36:53 +0000 (08:36 +0000)]
zfs: fix up EINVAL from getdirentries on .zfs

PR: 270909

14 months agozfs: add missing vn state transition for .zfs
Mateusz Guzik [Thu, 20 Apr 2023 08:09:59 +0000 (08:09 +0000)]
zfs: add missing vn state transition for .zfs

Reported by: des

14 months agoMakefile.xtras: fix show-valid-targets
Simon J. Gerraty [Thu, 20 Apr 2023 01:59:53 +0000 (18:59 -0700)]
Makefile.xtras: fix show-valid-targets

Use ALL_MACHINE_LIST and leverage .MAKE.DEPENDFILE_PREFERENCE

14 months agometa: remove LDFLAGS setting when cross building
Stephen J. Kiernan [Mon, 17 Apr 2023 23:36:02 +0000 (19:36 -0400)]
meta: remove LDFLAGS setting when cross building

The setting was left over from older clang version and is not
necessary any more (and also causes link issues.)

Reviewed by: sjg

14 months agoopenssh: restore PrintLastLog option
Ed Maste [Thu, 20 Apr 2023 00:09:13 +0000 (20:09 -0400)]
openssh: restore PrintLastLog option

Upstream's autoconf sets DISABLE_LASTLOG if lastlog.ll_line does not
exist, but PrintLastLog also works with utmpx and other mechanisms.

Reported upstream at
https://lists.mindrot.org/pipermail/openssh-unix-dev/2022-May/040242.html

PR: 209441
Sponsored by: The FreeBSD Foundation

14 months agoLinuxKPI: 802.11: fix a -Wenum-compare warning
Bjoern A. Zeeb [Wed, 19 Apr 2023 21:40:18 +0000 (21:40 +0000)]
LinuxKPI: 802.11: fix a -Wenum-compare warning

We are asserting that two values from different enums are the same.
gcc warns about these.  Cast the values to (int) to avoid the warning.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

14 months agoLinuxKPI: skbuff.h: fix -Warray-bounds warnings
Bjoern A. Zeeb [Wed, 19 Apr 2023 21:37:01 +0000 (21:37 +0000)]
LinuxKPI: skbuff.h: fix -Warray-bounds warnings

Harmonize sk_buff_head and sk_buff further and fix -Warray-bounds
warnings reports by gcc.  At the same time simplify some code by
re-using other functions or factoring some code out.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

14 months agoichiic: use bool for one-bit wide bit-fields
Dimitry Andric [Tue, 18 Apr 2023 18:08:28 +0000 (20:08 +0200)]
ichiic: use bool for one-bit wide bit-fields

A one-bit wide bit-field can take only the values 0 and -1. Clang 16
introduced a warning that "implicit truncation from 'int' to a one-bit
wide bit-field changes value from 1 to -1". Fix by using c99 bool.

Reported by: Clang
Reviewed by: emaste, wulf
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39665

14 months agolibc: bsort_s() requires both __BSD_VISIBLE and __EXT1_VISIBLE
Hans Petter Selasky [Wed, 19 Apr 2023 19:37:29 +0000 (21:37 +0200)]
libc: bsort_s() requires both __BSD_VISIBLE and __EXT1_VISIBLE

Fixes build of Python:
/usr/include/stdlib.h:409:1: error: unknown type name 'errno_t'
errno_t  bsort_s(void *, rsize_t, rsize_t,

Reported by: vishwin@
MFC after: 1 week
Sponsored by: NVIDIA Networking
Differential Revision: https://reviews.freebsd.org/D36493

14 months agovfs cache: fix vfs.cache.stats.* name typos
Igor Ostapenko [Wed, 19 Apr 2023 17:12:25 +0000 (20:12 +0300)]
vfs cache: fix vfs.cache.stats.* name typos

Two vfs.cache.stats names are fixed:
- s/.dotdothis/.dotdothits/
- s/.posszaps/.poszaps/

Signed-off-by: Igor Ostapenko <pm@igoro.pro>
[mjg: massaged the header a little bit]

14 months agotcp: rack the request level logging is a bit too noisy when doing point logging.
Randall Stewart [Wed, 19 Apr 2023 18:02:12 +0000 (14:02 -0400)]
tcp: rack the request level logging is a bit too noisy when doing point logging.

When doing request level BB logging the hybrid_bw_log() does not have proper screening to minimize logging
when point level logging is in use. Lets fix it properly so you have to have the proper knobs set to get the
more noisy logging.

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

14 months agoloader: Change version calculation to be more consistent.
Stephen J. Kiernan [Mon, 17 Apr 2023 23:27:54 +0000 (19:27 -0400)]
loader: Change version calculation to be more consistent.

Use 1000 * major + minor when calculating the version number that
gets set in the Ficl environment or lua loader property. This allows
for more room if the minor number needs to go above 9.

Add loader.version property to lua loader.

Reviewed by: imp
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39631

14 months agolibz: Move NO_WDEPRECATED_NON_PROTOTYPE below include of bsd.lib.mk.
John Baldwin [Wed, 19 Apr 2023 17:53:02 +0000 (10:53 -0700)]
libz: Move NO_WDEPRECATED_NON_PROTOTYPE below include of bsd.lib.mk.

Also add it to CWARNFLAGS rather than CFLAGS.

14 months agolibmilter: Silence -Wdeprecated-non-prototype warnings.
John Baldwin [Wed, 19 Apr 2023 17:52:51 +0000 (10:52 -0700)]
libmilter: Silence -Wdeprecated-non-prototype warnings.

Missed this one when tagging other sendmail libraries.

Fixes: 525438ea7147 sendmail: Silence -Wdeprecated-non-prototype warnings.

14 months agotcp: Rack can crash with the new non-TSO fix..
Randall Stewart [Wed, 19 Apr 2023 17:17:04 +0000 (13:17 -0400)]
tcp: Rack can crash with the new non-TSO fix..

Turns out the location of the check to see if we can do output is in the wrong place. We need
to jump off to the compressed acks before handling that case since th is NULL in the
compressed ack case which is handled differently anyway.

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

14 months agoWe have a TCP_LOG_CONNEND log that should come out at the very last log of every...
Randall Stewart [Wed, 19 Apr 2023 16:54:25 +0000 (12:54 -0400)]
We have a TCP_LOG_CONNEND log that should come out at the very last log of every connection. This
holds some nice stats about why/how the connection ended. Though with the current code it does not
come out without accounting due to the placement of the ifdefs. Also we need to make sure the stacks
fini has ran before calling in from tcp_subr so we get all logs the stack may make at its ending.

Reviewed by: rscheff
Sponsored by: Netflix Inc
Differential Revision:https://reviews.freebsd.org/D39693

14 months agocxgbe/iw_cxgbe: debug routines to dump STAG (steering tag) entries.
Navdeep Parhar [Thu, 6 Apr 2023 17:52:15 +0000 (10:52 -0700)]
cxgbe/iw_cxgbe: debug routines to dump STAG (steering tag) entries.

t4_dump_stag to dump hw state for a known STAG.

t4_dump_all_stag to dump hw state for all valid STAGs.  This routine
walks the entire STAG region looking for valid entries and this can take
a while for some configurations.

MFC after: 1 week
Sponsored by: Chelsio Communications

14 months agoCirrus-CI: Run check-ldirs in include/
Brooks Davis [Wed, 19 Apr 2023 15:58:54 +0000 (16:58 +0100)]
Cirrus-CI: Run check-ldirs in include/

Check that LDIRS defined in include/Makefile actually exist.

Reviewed by: emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D39681

14 months agoCirrus-CI: Check that make sysent was run
Brooks Davis [Wed, 19 Apr 2023 15:58:46 +0000 (16:58 +0100)]
Cirrus-CI: Check that make sysent was run

Run the `make sysent` target and verify that the repo isn't modified
afterwards.  This ensures that a pushed branch contains all the
required bits after a change to syscall.master.

Reviewed by: emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D39680

14 months agoCirrus-CI: Add blank lines between scripts
Brooks Davis [Wed, 19 Apr 2023 15:58:39 +0000 (16:58 +0100)]
Cirrus-CI: Add blank lines between scripts

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

14 months agoinclude: add a check-ldirs target
Brooks Davis [Wed, 19 Apr 2023 15:58:06 +0000 (16:58 +0100)]
include: add a check-ldirs target

This target ensures all LDIRS, LSUBDIRS, and LSUBSUBDIRS actually exist.

Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D39006

14 months agoofed: Fix a logic inversion from IfAPI conversion
Justin Hibbits [Wed, 19 Apr 2023 15:21:32 +0000 (11:21 -0400)]
ofed: Fix a logic inversion from IfAPI conversion

Reported by: bartosz.sobczak_intel.com
Fixes: 3e142e07675b ("ofed: Mechanically convert to IfAPI")
Sponsored by: Juniper Networks, Inc.

14 months agoObsoleteFiles.inc: add more obsolete files
Antoine Brodin [Wed, 19 Apr 2023 15:51:19 +0000 (15:51 +0000)]
ObsoleteFiles.inc: add more obsolete files

14 months agodpaa2: Avoid dpaa2_cmd race conditions
Dmitry Salychev [Fri, 7 Apr 2023 18:10:17 +0000 (20:10 +0200)]
dpaa2: Avoid dpaa2_cmd race conditions

struct dpaa2_cmd is no longer malloc'ed, but can be allocated on stack
and initialized with DPAA2_CMD_INIT() on demand. Drivers stopped caching
their DPAA2 command objects (and associated tokens) in the software
contexts in order to avoid using them concurrently.

Reviewed by: bz
Approved by: bz (mentor)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D39509

14 months agolibc: Sorting is not needed when there are less than two elements
Hans Petter Selasky [Wed, 19 Apr 2023 10:18:56 +0000 (12:18 +0200)]
libc: Sorting is not needed when there are less than two elements

If there are less than two elements avoid executing the first
sorting loop. No functional change intended.

Reviewed by: kib@
MFC after: 1 week
Sponsored by: NVIDIA Networking
Differential Revision: https://reviews.freebsd.org/D39691

14 months agounionfs.5: Use '.An -nosplit' in the AUTHORS section
Gordon Bergling [Wed, 19 Apr 2023 15:11:41 +0000 (17:11 +0200)]
unionfs.5: Use '.An -nosplit' in the AUTHORS section

Use '.An -nosplit' in the AUTHORS section to prevent line breaks.

MFC after: 3 days

14 months agoCirrus update to new freebsd instance version
QWERTIOX [Wed, 19 Apr 2023 13:01:15 +0000 (15:01 +0200)]
Cirrus update to new freebsd instance version

MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/718

14 months agolibc: Add missing object size check to qsort_s(3)
Hans Petter Selasky [Wed, 19 Apr 2023 10:22:11 +0000 (12:22 +0200)]
libc: Add missing object size check to qsort_s(3)

When sorting, both the C11 standard (ISO/IEC 9899:2011, K.3.6.3.2) and
the ISO/IEC JTC1 SC22 WG14 N1172 standard, does not define objects of
zero size as undefined behaviour. However Microsoft's cpp-docs does.

Add proper checks for this. Found while working on bsort(3).

Reviewed by: kib@ and emaste@
MFC after: 1 week
Sponsored by: NVIDIA Networking
Differential Revision: https://reviews.freebsd.org/D39687

14 months agobsort.3: Fix warnings as reported by mandoc -W warning
Hans Petter Selasky [Wed, 19 Apr 2023 13:24:35 +0000 (15:24 +0200)]
bsort.3: Fix warnings as reported by mandoc -W warning

Reported by: Yuri <yuri@aetern.org>
MFC after: 1 week
Sponsored by: NVIDIA Networking

14 months agoiwlwifi: rtw88: rtw89: fix gcc warnings
Bjoern A. Zeeb [Tue, 18 Apr 2023 19:51:09 +0000 (19:51 +0000)]
iwlwifi: rtw88: rtw89: fix gcc warnings

Fix -Wno-format and unused variables warnings with gcc by adopting
(to|the) FreeBSD-specific code.

Reported by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D39673

14 months agolibc: Implement bsort(3) a bitonic type of sorting algorithm.
Hans Petter Selasky [Thu, 8 Sep 2022 10:16:43 +0000 (12:16 +0200)]
libc: Implement bsort(3) a bitonic type of sorting algorithm.

The bsort(3) algorithm works by swapping objects, similarly to qsort(3),
and does not require any significant amount of additional memory.

The bsort(3) algorithm doesn't suffer from the processing time issues
known the plague the qsort(3) family of algorithms, and is bounded by
a complexity of O(log2(N) * log2(N) * N), where N is the number of
elements in the sorting array. The additional complexity compared to
mergesort(3) is a fair tradeoff in situations where no memory may
be allocated.

The bsort(3) APIs are identical to those of qsort(3), allowing for
easy drop-in and testing.

The design of the bsort(3) algorithm allows for future parallell CPU
execution when sorting arrays. The current version of the bsort(3)
algorithm is single threaded. This is possible because fixed areas
of the sorting data is compared at a time, and can easily be divided
among different CPU's to sort large arrays faster.

Reviewed by: gbe@, delphij@, pauamma_gundo.com (manpages)
Sponsored by: NVIDIA Networking
Differential Revision: https://reviews.freebsd.org/D36493

14 months agotzsetup(8): update paths to zone tab and tzdata source
Yuri Pankov [Wed, 19 Apr 2023 11:56:58 +0000 (13:56 +0200)]
tzsetup(8): update paths to zone tab and tzdata source

tzsetup now uses zone1970.tab and zoneinfo source is located in
contrib/tzdata, update the man page accordingly.

While here, drop obsolete Tn macros and insert vertical breaks (mostly
before Dl in examples) to improve readability.

Reviewed by: pauamma_gundo.com (manpages)
Differential Revision: https://reviews.freebsd.org/D39643

14 months agotcp: bbr.c is non-capable of doing ECN and sets an INP flag to fend off ECN however...
Randall Stewart [Tue, 18 Apr 2023 16:21:56 +0000 (12:21 -0400)]
tcp: bbr.c is non-capable of doing ECN and sets an INP flag to fend off ECN however our syncache is not aware of that flag.

We need to make the syncache aware of the flag and not do ECN if its set. Note that this
is not 100% full proof but the best we can do (i.e. its still possible that you can get in a
situation where the peer try's to do ecn).

Reviewed by: tuexen, glebius, rscheff
Sponsored by: Netflix Inc
Differential Revision:https://reviews.freebsd.org/D39672

14 months agonetstat: document that PCB information can't be read from corefiles
Michael Tuexen [Wed, 19 Apr 2023 10:15:35 +0000 (12:15 +0200)]
netstat: document that PCB information can't be read from corefiles

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

14 months agopf: change pf_rules_lock and pf_ioctl_lock to per-vnet locks
Kristof Provost [Tue, 18 Apr 2023 14:06:36 +0000 (16:06 +0200)]
pf: change pf_rules_lock and pf_ioctl_lock to per-vnet locks

Both pf_rules_lock and pf_ioctl_lock only ever affect one vnet, so
there's no point in having these locks affect other vnets.
(In fact, the only lock in pf that can affect multiple vnets is
pf_end_lock.)

That's especially important for the rules lock, because taking the write
lock suspends all network traffic until it's released. This will reduce
the impact a vnet running pf can have on other vnets, and improve
concurrency on machines running multiple pf-enabled vnets.

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

14 months agostress2: Added comment of fixed problem. Enable test
Peter Holm [Wed, 19 Apr 2023 07:26:29 +0000 (09:26 +0200)]
stress2: Added comment of fixed problem.  Enable test

14 months agoAvoid breaking crunchgen with meta stats
Simon J. Gerraty [Wed, 19 Apr 2023 03:25:33 +0000 (20:25 -0700)]
Avoid breaking crunchgen with meta stats

When using DIRDEPS_BUILD we normally get stats as each dir finishes.
This upsets crunchen, so keep quiet when _RECURSING_CRUNCH is defined

14 months agoAvoid staging conflict for examples/pf
Simon J. Gerraty [Wed, 19 Apr 2023 03:23:23 +0000 (20:23 -0700)]
Avoid staging conflict for examples/pf

If we are staging, let examples/pf stage its bits.

14 months agoHandle libs that create linker scripts as libs
Simon J. Gerraty [Wed, 19 Apr 2023 03:22:13 +0000 (20:22 -0700)]
Handle libs that create linker scripts as libs

Eg ncurses creates libncursesw.ald
This is the only example so far, but if we are staging
handle it.

Reviewed by: stevek

14 months agoEnsure the stage_* targets we use exist
Simon J. Gerraty [Wed, 19 Apr 2023 03:19:11 +0000 (20:19 -0700)]
Ensure the stage_* targets we use exist

14 months agoJust ensure all target exists
Simon J. Gerraty [Wed, 19 Apr 2023 03:17:22 +0000 (20:17 -0700)]
Just ensure all target exists

14 months agodirdeps.mk guard against inclusion from Makefile.depend.options
Simon J. Gerraty [Wed, 19 Apr 2023 03:15:25 +0000 (20:15 -0700)]
dirdeps.mk guard against inclusion from Makefile.depend.options

A typo in Makefile.depend.options including dirdeps.mk rather than
dirdeps-options.mk can result in infinite recursion - don't let that happen.

Reviewed by: stevek

14 months agoUpdate/fix Makefile.depend for userland
Simon J. Gerraty [Wed, 19 Apr 2023 00:14:23 +0000 (17:14 -0700)]
Update/fix Makefile.depend for userland

14 months agox86: initialize use_xsave once
Konstantin Belousov [Tue, 18 Apr 2023 15:50:26 +0000 (18:50 +0300)]
x86: initialize use_xsave once

The explanation from https://reviews.freebsd.org/D39637 by stevek:
The "use_xsave" variable is a global and that is only supposed to be
initialized early before scheduling gets started. However, with the way
the ifuncs for "fpusave" and "fpurestore" are implemented, the value
could be changed at runtime when scheduling is active if "use_xsave"
was set to 0 by the tunable. This leaves a window of opportunity where
"use_xsave" gets re-initialized to 1 and a context switch could occur
with a thread that was not set up to be able to use xsave functionality.
This can lead to an "privileged instruction fault".

The fix is to protect "use_xsave" from being initialized more than once.

Reported and reviewed by: stevek
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39660

14 months agoumtx: allow to configure minimal timeout (in nanoseconds)
Konstantin Belousov [Sat, 15 Apr 2023 17:46:12 +0000 (20:46 +0300)]
umtx: allow to configure minimal timeout (in nanoseconds)

PR: 270785
Reviewed by: markj, mav
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39584

14 months agosyncer vnode: add VOP_GETWRITEMOUNT() definition explicitly
Konstantin Belousov [Sun, 16 Apr 2023 17:04:53 +0000 (20:04 +0300)]
syncer vnode: add VOP_GETWRITEMOUNT() definition explicitly

Since syncer vnode vector does not provide a fallback to the default
one, its VOP_GETWRITEMOUNT() implementation implicitly returned
EOPNOTSUPP, which means that syncer ignored suspension.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

14 months agosync_vnode(): add assert to check vn_start_write() correctness
Konstantin Belousov [Sat, 15 Apr 2023 19:41:44 +0000 (22:41 +0300)]
sync_vnode(): add assert to check vn_start_write() correctness

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

14 months agoSkip Pass 5 in fsck_ffs(8) when corrupt cylinder groups remain unfixed.
Kirk McKusick [Tue, 18 Apr 2023 23:10:49 +0000 (16:10 -0700)]
Skip Pass 5 in fsck_ffs(8) when corrupt cylinder groups remain unfixed.

Pass 1 of fsck_ffs checks the integrity of all the cylinder groups.
If any are found to have been corrupted it offers to rebuild them.
Pass 5 then makes a second pass over the cylinder groups to validate
their block and inode maps. Pass 5 assumes that the cylinder groups
are not corrupted and can segment fault if they are corrupted. Rather
than rerunning the corruption checks a second time in pass 5, this
fix keeps track whether any corrupt cylinder groups were found but not
fixed in pass 1 either due to running with the -n flag or by explicitly
answering `no' when asked whether to fix a corrupted cylinder group.
If any corrupted cylinder groups remain after pass 1, fsck_ffs will
decline to run pass 5. Instead it marks the filesystem as unclean
so that fsck_ffs will need to be run again before the filesystem can
be mounted.

This patch cleans up and documents the return value from check_cgmagic().
It also renames the variable / parameter "rebuildcg" to "rebuiltcg".
This parameter describes whether the cylinder group has been rebuilt
rather than whether it should be rebuilt.

Reported by: Chuck Silvers
Reviewed by: Chuck Silvers
MFC after:   1 week

14 months agoBug fixes for fsck_ffs(8).
Kirk McKusick [Tue, 18 Apr 2023 06:03:30 +0000 (23:03 -0700)]
Bug fixes for fsck_ffs(8).

Increment a reference count when returning a zero'ed out buffer
after a failed read.

Zero out a structure before using it.

Only dirty a buffer that has been modified.

Submitted by: Chuck Silvers
Sponsored by: Netflix
MFC after:    1 week

14 months agoAdd `chdb' command to fsdb(8) to set direct block numbers.
Kirk McKusick [Tue, 18 Apr 2023 05:42:32 +0000 (22:42 -0700)]
Add `chdb' command to fsdb(8) to set direct block numbers.

Add the ability to set direct blocks numbers in inodes so that manual
corrections can be made. No checking of the values is attempted so
accidental or deliberate bad values can be set.

Submitted by: Chuck Silvers
MFC after:    1 week

14 months agostand: Add a snarky note about the upstream ZFS situation
Warner Losh [Tue, 18 Apr 2023 21:29:45 +0000 (15:29 -0600)]
stand: Add a snarky note about the upstream ZFS situation

The latest import of openzfs broke the hacks that we used to omit the
special registers being used on arm64. Add snarky note documenting this
situation since it's a mess now since the hack was only partially
undone, leaving behind a mess.

Sponsored by: Netflix

14 months agoee: Remove two set but unused variables.
John Baldwin [Tue, 18 Apr 2023 19:53:32 +0000 (12:53 -0700)]
ee: Remove two set but unused variables.

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

14 months agoee: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 19:53:20 +0000 (12:53 -0700)]
ee: Use C89 function definitions.

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

14 months agoee: Remove function prototype for main.
John Baldwin [Tue, 18 Apr 2023 19:53:05 +0000 (12:53 -0700)]
ee: Remove function prototype for main.

14 months agoee: Drop P_() macro used for pre-C89 compatibility.
John Baldwin [Tue, 18 Apr 2023 19:52:44 +0000 (12:52 -0700)]
ee: Drop P_() macro used for pre-C89 compatibility.

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

14 months agomac: Honor order when registering MAC modules.
Steve Kiernan [Sun, 2 Apr 2023 22:17:17 +0000 (15:17 -0700)]
mac: Honor order when registering MAC modules.

Ensure MAC modules are inserted in order that they are registered.

Reviewed by: markj
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39589

14 months agoloader.efi: Fix some arm64 PE metadata
Mark Johnston [Tue, 18 Apr 2023 18:32:04 +0000 (14:32 -0400)]
loader.efi: Fix some arm64 PE metadata

- Mark the file as an executable in the COFF header.
- Provide separate .text and .data sections.
- Provide sane file and section alignment values.  These values are the
  defaults defined in the PE specification.
- Set appropriate characteristics for each of .text and .data.

This is required for the MS devkit to load our UEFI image.

Obtained from: OpenBSD via allanjude
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D37765

14 months agopnpinfo: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:31:13 +0000 (11:31 -0700)]
pnpinfo: Use C89 function definitions.

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

14 months agokeyserv: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:29:27 +0000 (11:29 -0700)]
keyserv: Use C89 function definitions.

Also use more accurate function pointer types, and trim some duplicate
(but incomplete) function prototypes.

Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D39533

14 months agoyp: Use more accurate function pointer types.
John Baldwin [Tue, 18 Apr 2023 18:28:57 +0000 (11:28 -0700)]
yp: Use more accurate function pointer types.

Trim a few duplicate (but incomplete) function prototypes as well.

Reviewed by: zlei, imp
Differential Revision: https://reviews.freebsd.org/D39532

14 months agotraceroute: Use C89 function definition for one straggler.
John Baldwin [Tue, 18 Apr 2023 18:28:41 +0000 (11:28 -0700)]
traceroute: Use C89 function definition for one straggler.

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

14 months agorpc.lockd: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:28:24 +0000 (11:28 -0700)]
rpc.lockd: Use C89 function definitions.

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

14 months agocron: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:28:07 +0000 (11:28 -0700)]
cron: Use C89 function definitions.

Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D39529

14 months agotelnet: Use C89 function definitions for two stragglers.
John Baldwin [Tue, 18 Apr 2023 18:27:47 +0000 (11:27 -0700)]
telnet: Use C89 function definitions for two stragglers.

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

14 months agomail: Use a C89 function pointer type for command functions.
John Baldwin [Tue, 18 Apr 2023 18:27:29 +0000 (11:27 -0700)]
mail: Use a C89 function pointer type for command functions.

The command function is defined to always take a void *.  Functions
which accept a pointer to an array of pointers use a local temporary
'argv' assigned from the void *arg.

Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D39527

14 months agolocate: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:27:08 +0000 (11:27 -0700)]
locate: Use C89 function definitions.

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

14 months agoless: Silence -Wdeprecated-non-prototype warnings.
John Baldwin [Tue, 18 Apr 2023 18:26:08 +0000 (11:26 -0700)]
less: Silence -Wdeprecated-non-prototype warnings.

This has an active upstream so will presumably be fixed upstream at
some point.

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

14 months agoipf: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:22:28 +0000 (11:22 -0700)]
ipf: Use C89 function definitions.

Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D39523

14 months agorbootd: Remove an unnecessary (and incomplete) function prototype.
John Baldwin [Tue, 18 Apr 2023 18:22:08 +0000 (11:22 -0700)]
rbootd: Remove an unnecessary (and incomplete) function prototype.

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

14 months agorpc.rstatd/rwalld: Use more accurate function pointer types.
John Baldwin [Tue, 18 Apr 2023 18:21:50 +0000 (11:21 -0700)]
rpc.rstatd/rwalld: Use more accurate function pointer types.

Reviewed by: zlei, rmacklem
Differential Revision: https://reviews.freebsd.org/D39521

14 months agobootpd: Use C89 function definitions.
John Baldwin [Tue, 18 Apr 2023 18:21:15 +0000 (11:21 -0700)]
bootpd: Use C89 function definitions.

Trim a few duplicate (but incomplete) function prototypes as well.

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

14 months agosmbfs: Use C89 function definition for cf_getopt.
John Baldwin [Tue, 18 Apr 2023 18:20:43 +0000 (11:20 -0700)]
smbfs: Use C89 function definition for cf_getopt.

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

14 months agosendmail: Silence -Wdeprecated-non-prototype warnings.
John Baldwin [Tue, 18 Apr 2023 18:19:48 +0000 (11:19 -0700)]
sendmail: Silence -Wdeprecated-non-prototype warnings.

These will hopefully be fixed upstream eventually, but silence the
warnings until then.

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

14 months agoboot0: Drop the BOOT_BOOT0_ORG option.
John Baldwin [Tue, 18 Apr 2023 18:17:13 +0000 (11:17 -0700)]
boot0: Drop the BOOT_BOOT0_ORG option.

This shouldn't be an option (and I added it in the first place back in
4ae4202e705cf6a12aa3cbb49efb153879a6bc2f and
83f4b92050cbf8913d5c0aac16726c783d8b2d9c).  However, unlike the other
knobs I added back then, this really shouldn't be a knob since it is
hardcoded in the source.

14 months agotmpfs: add missing vop_fplookup ops to tmpfs_fifoop_entries
Mateusz Guzik [Tue, 18 Apr 2023 18:04:16 +0000 (18:04 +0000)]
tmpfs: add missing vop_fplookup ops to tmpfs_fifoop_entries

Reported by: gbe
PR: 270917

14 months agoboot0: Expand the description of BOOT_BOOT0_ORG.
John Baldwin [Tue, 18 Apr 2023 18:02:50 +0000 (11:02 -0700)]
boot0: Expand the description of BOOT_BOOT0_ORG.

This really shouldn't even be an option given it is hardcoded as a
constant named ORIGIN in the assembly.  mbr.S also uses 0x600 and
hardcodes it in both the assembly and the Makefile.