]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
16 months agomakesyscalls.lua: Minor fluff removal
Warner Losh [Thu, 20 Apr 2023 22:16:16 +0000 (16:16 -0600)]
makesyscalls.lua: Minor fluff removal

luacheck pointed out two minor issues: line isn't declared as a global,
so declare it local. Also remove an unused parameter.

Suggested by: kevans
Sponsored by: Netflix

16 months agomakesyscalls.lua: Use "sysxxx" consistently
Warner Losh [Thu, 20 Apr 2023 22:16:06 +0000 (16:16 -0600)]
makesyscalls.lua: Use "sysxxx" consistently

Find the few places where we use 'sysxxx' and use "sysxxx" instead to be
more consistent.

Sponsored by: Netflix

16 months agomakesyscalls.lua: Make more luaish
Warner Losh [Thu, 20 Apr 2023 22:15:57 +0000 (16:15 -0600)]
makesyscalls.lua: Make more luaish

x["y"] can be written as x.y, which looks better and is a more typical
lua idiom.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D39709

16 months agoopenssh: Update configure for DISABLE_LASTLOG
Ed Maste [Thu, 20 Apr 2023 00:03:26 +0000 (20:03 -0400)]
openssh: Update configure for DISABLE_LASTLOG

PR: 209441
Sponsored by: The FreeBSD Foundation

16 months agonetstat: cleanup
Michael Tuexen [Thu, 20 Apr 2023 21:52:19 +0000 (23:52 +0200)]
netstat: cleanup

protopr does not support reading from a core anymore.
So don't state that it can.

Reviewed by: glebius, rscheff, rrs
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D39688

16 months agoCirrus-CI: Run makeman script
Brooks Davis [Thu, 20 Apr 2023 21:38:10 +0000 (22:38 +0100)]
Cirrus-CI: Run makeman script

Run makeman and verify that src.conf.5 has been updated if
required and that there are no missing definition files.

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

16 months agoRemove unused NETLINK build option
Brooks Davis [Thu, 20 Apr 2023 21:34:31 +0000 (22:34 +0100)]
Remove unused NETLINK build option

NETLINK was added along side NETLINK_SUPPORT to control building netlink
specific programs, but it has no consumers so remove it for now.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D39678

16 months agosrc.conf.5: regen with WITH_NETLINK_SUPPORT desc
Brooks Davis [Thu, 20 Apr 2023 21:34:27 +0000 (22:34 +0100)]
src.conf.5: regen with WITH_NETLINK_SUPPORT desc

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D39677

16 months agoAdd WITH_NETLINK_SUPPORT description
Brooks Davis [Thu, 20 Apr 2023 21:34:21 +0000 (22:34 +0100)]
Add WITH_NETLINK_SUPPORT description

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D39676

16 months agocxgbe(4): Dump the firmware log before falling back to a minimal config.
Navdeep Parhar [Thu, 20 Apr 2023 19:43:45 +0000 (12:43 -0700)]
cxgbe(4): Dump the firmware log before falling back to a minimal config.

It might have errors that explain why the attempted configuration
failed.

MFC after: 1 week
Sponsored by: Chelsio Communications

16 months agonetstat: fix printing of TCP pcbs with -A
Gleb Smirnoff [Thu, 20 Apr 2023 19:41:03 +0000 (12:41 -0700)]
netstat: fix printing of TCP pcbs with -A

This change touches both kernel and netstat(1), but either of the changes
will fix printing pcb addresses with -A.

The thing is that historically netstat(1) treated TCP differently, and
printed tcpcb address instead of inpcb address.  This is not documented
anywhere!  With e68b3792440 these two addresses became the same.  It is
highly likely they will be the same for a long time, but it might be they
will start to differ again in a far future.  My proposal is to stop
treating TCP differently with netstat(1) and right now is a good opportunity
to do that, since there will be no behavior change at all.  The kernel
change to tcp_inptoxtp() will go into stable/14 to make it compatible with
netstat(1) binary from stable/13.  We can drop it later, probably together
with in_ppcb pointer from inpcb.  The in_ppcb in xinpcb will stay for size
compatibility.

Reviewed by: tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D39736

16 months agokern.mk: clang >= 16 already infers ELFv2 for powerpc64
Dimitry Andric [Thu, 20 Apr 2023 19:27:11 +0000 (21:27 +0200)]
kern.mk: clang >= 16 already infers ELFv2 for powerpc64

There is no need to pass -mabi=elfv2 explicitly anymore, and with clang
16 in fact results in a "unused argument" warning.

MFC after: 3 days

16 months agodpaa2: add console support for FDT based systems
Bjoern A. Zeeb [Tue, 14 Feb 2023 15:53:13 +0000 (15:53 +0000)]
dpaa2: add console support for FDT based systems

Add DPAA2 console support for MC and AIOP (latter untested) for FDT
systems.  ACPI systems are prepared but need some proper bus function
in order to get the address from MC (and likely a file splitup then).
This will come at a later stage once other ACPI/FDT bus parts are
cleared up.
The work was originally done in July 2022 and finally switched to
bus_space[1] lately to be ready for main.

Suggested by: andrew [1]
Reviewed by: dsl
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38592

16 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.

16 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.

16 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.

16 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

16 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

16 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

16 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

16 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.

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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.

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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]

16 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

16 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

16 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.

16 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.

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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.

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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.

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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.

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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