Commit Graph

283032 Commits

Author SHA1 Message Date
Christos Margiolis
75081b9ed8 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
2023-04-20 13:35:57 -04:00
Christos Margiolis
080e56a6c9 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
2023-04-20 13:35:57 -04:00
Christos Margiolis
1a149d65ba 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
2023-04-20 13:35:56 -04:00
Hans Petter Selasky
bb8e8e230d 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 a7469c9c0a.
This reverts commit 7d65a450cd.
This reverts commit 8dcf3a82c5.
2023-04-20 19:16:14 +02:00
Simon J. Gerraty
8fe4f8f7a7 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
2023-04-20 10:05:43 -07:00
Dmitry Chagin
de4da6cd04 x86: Move i386 timerreg.h to x86
Reviewed by:		emaste, jhb
Differential Revision:	https://reviews.freebsd.org/D39656
MFC after:		1 month
2023-04-20 19:42:59 +03:00
Dmitry Chagin
d1f4c44aa8 x86: Move i386 ppireg.h to x86
Differential Revision:	https://reviews.freebsd.org/D39655
MFC after:		1 month
2023-04-20 19:42:59 +03:00
Simon J. Gerraty
0df4d8ad7a 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
2023-04-20 09:40:39 -07:00
Ed Maste
dd9059b3e9 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
2023-04-20 12:20:56 -04:00
Mark Johnston
5fd1a67e88 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
2023-04-20 12:13:06 -04:00
Mark Johnston
7b92493ab1 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 220d892129 ("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
2023-04-20 12:13:06 -04:00
Mark Johnston
3e98dcb3d5 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
2023-04-20 12:13:06 -04:00
Mark Johnston
fdb987bebd 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
2023-04-20 12:13:06 -04:00
Bjoern A. Zeeb
35f7fa4ac1 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
2023-04-20 16:07:50 +00:00
Bjoern A. Zeeb
7db7bfe1a7 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
2023-04-20 16:07:05 +00:00
Bjoern A. Zeeb
de1dde5dfe 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
2023-04-20 14:30:42 +00:00
Mateusz Piotrowski
607bc91d90 vmrun.sh: Fix a typo in usage()
MFC after:	3 days
Sponsored by:	Klara Inc.
2023-04-20 14:45:13 +02:00
Bjoern A. Zeeb
74e908b3c6 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
2023-04-20 11:51:22 +00:00
Alexander V. Chernikov
56d4550c4d 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
2023-04-20 10:23:37 +00:00
Gordon Bergling
66095010d1 stand: Remove a double word in a source code comment
- s/value value/value/

MFC after:	3 days
2023-04-20 11:11:18 +02:00
Mateusz Guzik
9c4e270822 zfs: fix up EINVAL from getdirentries on .zfs
PR:	270909
2023-04-20 08:38:28 +00:00
Mateusz Guzik
7ff3143809 zfs: add missing vn state transition for .zfs
Reported by:	des
2023-04-20 08:09:59 +00:00
Simon J. Gerraty
061e8e6ba6 Makefile.xtras: fix show-valid-targets
Use ALL_MACHINE_LIST and leverage .MAKE.DEPENDFILE_PREFERENCE
2023-04-19 18:59:53 -07:00
Stephen J. Kiernan
64a67b7266 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
2023-04-19 21:40:29 -04:00
Ed Maste
43c6b7a60a 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
2023-04-19 21:17:59 -04:00
Bjoern A. Zeeb
f369f10dd8 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
2023-04-19 21:49:17 +00:00
Bjoern A. Zeeb
b2dcb84868 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
2023-04-19 21:49:00 +00:00
Dimitry Andric
87f55ab0b4 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
2023-04-19 22:25:50 +02:00
Hans Petter Selasky
a7469c9c0a 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
2023-04-19 22:12:04 +02:00
Igor Ostapenko
0e0c47ecd6 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]
2023-04-19 18:47:38 +00:00
Randall Stewart
4e8a20a764 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
2023-04-19 14:02:12 -04:00
Stephen J. Kiernan
a50d73d578 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
2023-04-19 13:58:53 -04:00
John Baldwin
010795fc82 libz: Move NO_WDEPRECATED_NON_PROTOTYPE below include of bsd.lib.mk.
Also add it to CWARNFLAGS rather than CFLAGS.
2023-04-19 10:53:02 -07:00
John Baldwin
45f591e6ed libmilter: Silence -Wdeprecated-non-prototype warnings.
Missed this one when tagging other sendmail libraries.

Fixes:		525438ea71 sendmail: Silence -Wdeprecated-non-prototype warnings.
2023-04-19 10:52:51 -07:00
Randall Stewart
7a842346c3 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
2023-04-19 13:17:04 -04:00
Randall Stewart
303246dcdf 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
2023-04-19 12:54:25 -04:00
Navdeep Parhar
7adf138ba9 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
2023-04-19 09:38:14 -07:00
Brooks Davis
8cee0c9ae9 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
2023-04-19 16:58:54 +01:00
Brooks Davis
b4373ce309 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
2023-04-19 16:58:46 +01:00
Brooks Davis
260b2c51b2 Cirrus-CI: Add blank lines between scripts
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39679
2023-04-19 16:58:39 +01:00
Brooks Davis
1a2249ff0b 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
2023-04-19 16:58:06 +01:00
Justin Hibbits
12e99b63d2 ofed: Fix a logic inversion from IfAPI conversion
Reported by:	bartosz.sobczak_intel.com
Fixes:		3e142e0767 ("ofed: Mechanically convert to IfAPI")
Sponsored by:	Juniper Networks, Inc.
2023-04-19 11:56:25 -04:00
Antoine Brodin
437f058850 ObsoleteFiles.inc: add more obsolete files 2023-04-19 15:51:19 +00:00
Dmitry Salychev
4cd9661428
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
2023-04-19 17:39:05 +02:00
Hans Petter Selasky
ecb2ce3a51 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
2023-04-19 17:17:33 +02:00
Gordon Bergling
409731e7d7 unionfs.5: Use '.An -nosplit' in the AUTHORS section
Use '.An -nosplit' in the AUTHORS section to prevent line breaks.

MFC after:	3 days
2023-04-19 17:11:41 +02:00
QWERTIOX
5e2ba9cb6b Cirrus update to new freebsd instance version
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/718
2023-04-19 08:34:28 -06:00
Hans Petter Selasky
27bb0d337c 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
2023-04-19 15:35:14 +02:00
Hans Petter Selasky
7d65a450cd bsort.3: Fix warnings as reported by mandoc -W warning
Reported by:	Yuri <yuri@aetern.org>
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-04-19 15:34:00 +02:00
Bjoern A. Zeeb
f621b087c0 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
2023-04-19 12:21:40 +00:00