1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-23 07:31:31 +00:00
Commit Graph

295831 Commits

Author SHA1 Message Date
Mark Johnston
fdeb273d49 dtrace: Add some more annotations for KMSAN
- Don't allow FBT and kinst to instrument the KMSAN runtime.
- When fetching data from the traced thread's stack, mark it as
  initialized.  It may well be uninitialized, but as dtrace permits
  arbitrary inspection of kernel memory, it isn't very useful to raise
  KMSAN reports.
- Mark data copied in from userspace as initialized, as we do for
  copyin() etc. using interceptors.

MFC after:	2 weeks
2024-11-23 02:36:08 +00:00
Mark Johnston
1905ce3a6b dtrace: Remove an unused typedef
No functional change intended.

MFC after:	1 week
2024-11-23 02:36:08 +00:00
Kristof Provost
e0bf7bc3b2 pf: reduce indentation level in pf_dummynet_route()
Reverse the first if() in pf_dummynet_route() to avoid an unneeded level of
indendation.

No functional change.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-11-23 00:32:04 +01:00
Ed Maste
6643965998 getentropy: restore unistd.h include
It is needed for SSP support.

Reported by: netchild, Shawn Webb
Fixes: 62dab3d016 ("getentropy: Remove fallback code")
Sponsored by: The FreeBSD Foundation
2024-11-22 13:08:41 -05:00
Mark Johnston
07593d13fa efirt: Fix the TDP_EFIRT assertion
Fixes:	a03957a706 ("efirt: mark dynamic region executing the RT code with the TDP_EFIRT flag")
2024-11-22 14:19:37 +00:00
Mark Johnston
5d12db2daf dtrace: Avoid excessive pcpu allocations
We were previously allocating MAXCPU structures for several purposes,
but this is generally unnecessary and is quite excessive, especially
after MAXCPU was bumped to 1024 on amd64 and arm64.  We already are
careful to allocate only as many per-CPU tracing buffers as are needed;
extend this to other allocations.

For example, in a 2-vCPU VM, the size of a consumer state structure
drops from 64KB to 128B.  The size of the per-consumer `dts_buffer` and
`dts_aggbuffer` arrays shrink similarly.  Ditto for pre-allocations of
local and global D variable storage space.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D47667
2024-11-22 14:04:12 +00:00
Mark Johnston
4efe531c9d buf: Add a runningbufclaim() helper
No functional change intended.

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D47696
2024-11-22 14:03:40 +00:00
Mark Johnston
0289db3259 netlink/route: Fix the argument list for rtnl_handle_iflink()
This function is registered as a ifnet_link_event and so should have the
corresponding argument list.

PR:		282870
Reported by:	nakayamakenjiro@gmail.com
MFC after:	1 week
2024-11-22 14:03:40 +00:00
Mark Johnston
cc3da1955c dtrace/amd64: Make invop providers usable with KMSAN enabled
- Use a fresh context when entering dtrace_invop() via a breakpoint
  exception.
- Mark the #BP trapframe as initialized.

MFC after:	2 weeks
2024-11-22 14:03:40 +00:00
Mark Johnston
418d8f0dc2 dtrace: Address KMSAN warnings in dtrace_disx86
wbit was not being initialized in a couple of cases.

Reported by:	asomers
MFC after:	2 weeks
2024-11-22 14:03:40 +00:00
Ed Maste
f85dd3f546 src.conf.5: Regen after MK_PROFILE removal
Fixes: 3750ccefb8 ("Retire MK_PROFILE infrastructure")
Sponsored by: The FreeBSD Foundation
2024-11-22 08:01:11 -05:00
Kristof Provost
6463b6b591 pfctl: clear statistic for specified addresses
The ioctl DIOCRCLRASTATS provides the functionality of clearing stats
not only for the whole table for for addresses stored in that table. The
functionality was missing from pfctl, though. Add it now.

PR:		282877
Obtained from:	OpenBSD, kirill <kirill@openbsd.org>, e496dff3a7
MFC after:	3 weeks
2024-11-22 12:22:16 +01:00
Warner Losh
56043cbfdd gicv3: Use the correct mask
Mask off the bits we'll be setting, rather than retaining only those
bits.

Sponsored by: Netflix
2024-11-21 17:04:00 -07:00
Konstantin Belousov
e6ec41fa86 amd64 efi rt: handle #BP
PR:	282860
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47694
2024-11-22 00:05:28 +02:00
Konstantin Belousov
a03957a706 efirt: mark dynamic region executing the RT code with the TDP_EFIRT flag
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47694
2024-11-22 00:05:28 +02:00
Doug Moore
38e3125d6d device_pager: user iterators to free device pages
Change cdev_mgtdev_page_free_page to take an iterator, rather than an
object and page, so that removing the page from the object radix tree
can take advantage of locality with iterators. Define a
general-purpose function to free all pages, which can be used in
several places.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D47692
2024-11-21 15:49:30 -06:00
Ed Maste
ae4f39464c ng_parse: disallow negative length for malloc
This is an interim robustness improvement; further improvements as
described in the PR and/or Phabricator review are still needed.

PR:		267334
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37229
2024-11-21 15:53:04 -05:00
David Gilbert
169e23d41f hexdump.3: Add missing LIBRARY section
All the other libutil section 3 manpages document this, and although
it's heavily implied by the libutil.h header in the synopsis, we should
still be explicit and consistent.

PR:		280078
Reviewed by:	jrtc27
MFC after:	1 week
2024-11-21 20:23:16 +00:00
Mark Johnston
46f38a6ded netgraph: Exit the net epoch to handle control messages
In general, in the direct dispatch case netgraph only enters the net
epoch to send data messages, but this was inconsistent with the netgraph
thread, which also entered the net epoch to send fn and fn2 messages to
nodes.  Some handlers, e.g., ng_bridge_newhook(), may sleep, and so
cannot be called in epoch context; the netgraph tests occasionally panic
due to this problem.

Make ngthread() consistent with the direct dispatch path.

Discussed with:	afedorov (in D44615)
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
2024-11-21 18:55:35 +00:00
Mark Johnston
30cafaa961 devd tests: Fix client_test
The loop doesn't check for overflow of the event buffer, which can
easily happen if other tests are running in parallel (the bectl tests in
particular trigger devd events).

When that overflow occurs, a funny thing can happen: the loop ends up
trying to read 0 bytes from the socket, succeeds, and then prints its
buffer to stdout.  It does this as fast as possible, eventually timing
out.  Then, because kyua wants to log the test's output, it slurps the
output file into memory so that it can insert it into the test db.  This
output file is quite large, usually around 8GB when I see it happen, and
is large enough to trigger an OOM kill in my test suite runner VM.

Fix the test: use a larger buffer and fail the test if we fill it before
both events are observed.  Also don't print the output buffer on every
loop iteration, since unlike the seqpacket test that will just print the
same output over and over.

Reviewed by:	imp, asomers
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D47625
2024-11-21 18:55:13 +00:00
Mark Johnston
a079f2b52a fibs_test: Run in a jail
These tests assume exclusive use of one or more FIBs and so can't be run
in parallel.  Running them in a VNET jail sidesteps this problem.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
2024-11-21 18:54:59 +00:00
John Baldwin
59f8f51b11 md: Fix linking of embedded filesystem images on aarch64
embedfs.S needs the right aarch64 features for BTI and/or PAC.

Obtained from:	CheriBSD
Fixes:		c2e0d56f5e ("arm64: Support BTI checking in most of the kernel")
Sponsored by:	AFRL, DARPA
2024-11-21 13:36:37 -05:00
Dimitry Andric
415efcecd8 Merge llvm-project release/19.x llvmorg-19.1.4-0-gaadaa00de76e
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/19.x llvmorg-19.1.4-0-gaadaa00de76e,
a.k.a. 19.1.4 release.

PR:		280562
MFC after:	1 month
2024-11-21 18:46:18 +01:00
Augustin Cavalier
7dfaf23856 rtwn: Add device ID for TPLink RTL8192CU 2024-11-21 10:40:11 -05:00
Ed Maste
6b62e00da4 mac_bsdextended: Remove \n from sysctl descriptions
sysctl(8) prints a newline after the description; the description should
not end with one itself.

Sponsored by:	The FreeBSD Foundation
2024-11-21 10:26:40 -05:00
Kajetan Staszkiewicz
7d929a4445 pf: Fix timestamps and connection rate in source node export
When copying struct pf_ksrc_node into a netlink message some fields
change their meaning. In kernel creation and expire fields are storing
number of seconds since boot.

Add conversion to number of seconds relative to moment of exporting the
source node via netlink, as this is what pfctl expects. Add conversion
of connection rate count.

Reviewed by:		kp
Approved by:		kp (mentor)
Sponsored by:		InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D47321
2024-11-21 15:27:32 +01:00
Kajetan Staszkiewicz
e8eb3096d8 pf: Fix missing connection rate for DIOCGETSRCNODES
The function pf_src_node_copy() copies struct pf_ksrc_node to its ioctl
counterpart. It was missing copying of the conn_rate field, even though
the code for adjusting the output for pfctl was in place.

Add copying of conn_rate.

Reviewed by:		kp
Approved by:		kp (mentor)
MFC after:		2 weeks
Sponsored by:		InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D47679
2024-11-21 15:27:28 +01:00
Dimitry Andric
f65bf063bc Vendor import of llvm-project branch release/19.x llvmorg-19.1.4-0-gaadaa00de76e, a.k.a. 19.1.4 release. 2024-11-21 13:55:29 +01:00
Igor Ostapenko
976ab1425d git-arc: Document how a reviewer group can be referenced
Reviewed by:	concussious.bugzilla_runbox.com, markj
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D47669
2024-11-21 10:36:50 +00:00
Colin Percival
e8263ace39 release: Don't break if firmware install fails
On some platforms (e.g. powerpc) we don't have packages, so we can't
install them onto the ISOs.  Proceed with building the images anyway.

Reported by:	Weekly snapshot builds
Fixes:	7e2996c1f5 ("release: install wireless firmware onto disc1 and dvd")
MFC after:	1 minute
2024-11-20 22:13:24 -08:00
K Rin
1f78bbb5c4
newsyslog.conf(5): Accept human unit suffix in the size filed
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1505
2024-11-21 13:39:09 +08:00
Kevin Bowling
ab540d44ba igc: sysctl for TCP flag handling during TSO
Add tso_tcp_flags_mask_first_segment, tso_tcp_flags_mask_middle_segment,
and tso_tcp_flags_mask_last_segment sysctl-variables to control the
handling of TCP flags during TSO.

This allows to change the masks appropriate for classical ECN and to
configure appropriate masks for accurate ECN.

MFC after:	3 days
Sponsored by:	Netflix
2024-11-20 19:38:01 -07:00
Michael Tuexen
90853dfac8 e1000: sysctl for TCP flag handling during TSO
Add tso_tcp_flags_mask_first_segment, tso_tcp_flags_mask_middle_segment,
and tso_tcp_flags_mask_last_segment sysctl-variables to control the
handling of TCP flags during TSO.

This allows to change the masks appropriate for classical ECN and to
configure appropriate masks for accurate ECN.

Reviewed by:	rrs
MFC after:	3 days
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D44259
2024-11-20 19:23:55 -07:00
Adrian Chadd
d99eb8230e rtwn: change the USB TX transfers to only do one pending transfer per endpoint
I found I was getting constant device timeouts when doing anything
more complicated than a single SSH on laptop with RTL8811AU.

After digging into it, i found a variety of fun situations, including
traffic stalls that would recover w/ a shorter (1 second) USB transfer
timeout.  However, the big one is a straight up hang of any TX endpoint
until the NIC was reset.  The RX side kept going just fine; only the
TX endpoints would hang.

Reproducing it was easy - just start up a couple of traffic streams
on different WME AC's - eg a best effort + bulk transfer, like
browsing the web and doing an ssh clone - throw in a ping -i 0.1
to your gateway, and it would very quickly hit device timeouts every
couple of seconds.

I put everything into a single TX EP and the hangs went away.
Well, mostly.

So after some MORE digging, I found that this driver isn't checking
if the transfers are going into the correct EPs for the packet
WME access category / 802.11 TID; and would frequently be able
to schedule multiple transfers into the same endpoint.

Then there's a second problem - there's an array of endpoints
used for setting up the USB device, with .endpoint = UE_ADDR_ANY,
however they're also being setup with the same endpoint configured
in multiple transfer configs.  Eg, a NIC with 3 or 4 bulk TX endpoints
will configure the BK and BE endpoints with the same physical endpoint
ID.  This also leads to timed out transfers.

My /guess/ was that the firmware isn't happy with one or both of the
above, and so I solved both.

* drop the USB transfer timeout to 1 second, not 5 seconds -
  that way we'll either get a 1 second traffic pause and USB transfer
  failure, or a 5 second device timeout.  Having both the TX timeout
  and the USB transfer timeout made recovery from a USB transfer
  timeout (without a NIC reset) almost impossible.

* enforce one transfer per endpoint;
* separate pending/active buffer tracking per endpoint;
* each endpoint now has its own TX callback to make sure the queue /
  end point ID is known;
* and only frames from a given endpoint pending queue is going
  into the active queue and into that endpoint.
* Finally, create a local wme2qid array and populate it with the
  endpoint mapping that ensures unique physical endpoint use.

Locally tested:

* rtl8812AU, 11n STA mode
* rtl8192EU, 11n STA mode (with diffs to fix the channel config / power
  timeouts.)

Differential Revision: https://reviews.freebsd.org/D47522
2024-11-20 17:56:56 -08:00
Michael Tuexen
eea2e089f8 ixgbe: sysctl for TCP flag handling during TSO
Add tso_tcp_flags_mask_first_segment, tso_tcp_flags_mask_middle_segment,
and tso_tcp_flags_mask_last_segment sysctl-variables to control the
handling of TCP flags during TSO.

This allows to fix the masks appropriate for classical ECN and to
configure appropriate masks for accurate ECN.

Michael notes emperically 82599 has an unexpected middle mask:
Chip  First Middle Last
82599 0xFF6 0xFF6  0xF7F

which should be fixed up to 0xF76 (RFC 3168) in a future commit.

Reviewed by:	rrs, rscheff
MFC after:	3 days
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D44258
2024-11-20 18:25:06 -07:00
Gleb Smirnoff
3789810845 tcp: avoid bcopy() in tcp_mss_update() 2024-11-20 16:37:24 -08:00
Gleb Smirnoff
2944a888ea tcp: remove so != NULL check
In the modern FreeBSD network stack a socket outlives its tcpcb.
2024-11-20 16:37:18 -08:00
Gleb Smirnoff
b80c06cc0a tcp: use const argument in the TCP hostcache KPI
The hostcache can't modify tcpcb, inpcb or connection info.
2024-11-20 16:30:42 -08:00
Gleb Smirnoff
09000cc133 tcp: mechanically rename hostcache metrics structure fields
Use hc_ prefix instead of rmx_.  The latter stands for "route metrix" and
is an artifact from the 90-ies, when TCP caching was embedded into the
routing table.  The rename should have happened back in 97d8d152c2.

No functional change. Done with sed(1) command:

s/rmx_(mtu|ssthresh|rtt|rttvar|cwnd|sendpipe|recvpipe|granularity|expire|q|hits|updates)/hc_\1/g
2024-11-20 16:29:00 -08:00
Kevin Bowling
8de007ad19 igc.4: Remove non-existent timer tunables
These were removed in a40ecb6f74 because they do not apply to igc
hardware which uses EITR for interval timing.

MFC after:	3 days
Sponsored by:	BBOX.io
2024-11-20 16:59:23 -07:00
Jose Luis Duran
87e87fecb1
nanobsd: Remove dependency on bsdlabel
The bsdlabel utility is deprecated, gpart should be used instead:

  - Offset the first 16 sectors, just like bsdlabel did (used for
    metadata)
  - Use a freebsd-ufs partition type (regardless bsdlabel creating a
    '!0')

Reviewed by:	emaste, imp
Approved by:	emaste (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D47653
2024-11-20 22:31:56 +00:00
Jose Luis Duran
accf71534c
geom: Allow BSD type '!0' partitions
Allow the creation of '!0' partition types.

Fix it by not considering "0" an invalid partition type.

Reviewed by:	emaste
Approved by:	emaste (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D47652
2024-11-20 22:28:57 +00:00
Warner Losh
459404cbc4 rtsw: Break out as soon as we find we're doing the inversion workaround
Once we set that we're doing the inversion workaround, there's no sense
continuing to search for the inversion workaround.

Sponsored by:		Netflix
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D47686
2024-11-20 14:37:20 -07:00
Warner Losh
4365a13bda cdefs: Document what we do when _XOPEN_SOURCE is an empty string
X/Open originally had _XOPEN_SOURCE defined to signify conformance with
the Single Unix Specification, starting with its third iteration. There
it defined _XOPEN_SOURCE being defined as the same thing as
_POSIC_C_SOURCE=2, though the different versions of the spec had slight
variances as to what's defined and wheter or not _XOPEN_SOURCE_EXTENSION
needed to be defined. Document that we don't do anything in this case.
It turns out that enabling the proper strict environment breaks at least
some old software, so for the moment it's a nop until that can be sorted
out (though that is a very low proprity task).

Sponsored by:		Netflix
2024-11-20 14:35:56 -07:00
Jessica Clarke
7a3af393d8 sys/cdefs.h: Add comments to make #if/#else/#endif triple more obvious
This block has a lot of nesting, not helped by two adjacent nested
blocks involving _POSIX_C_SOURCE, with only the inner one commented,
looking like it's the end of the outer one. Comment the outer one as
well so it's not quite so hard to figure out.

MFC after:	1 week
2024-11-20 20:09:28 +00:00
Warner Losh
780f289297 stand: drop inttypes.h from safe list
Nothing uses it anymore, so drop it from the 'safe' list. Also, move
stand/efi/loader/main.c to using machine/_inttypes.h which is all it
really needs.

Sponsored by:		Netflix
2024-11-20 12:49:48 -07:00
Ed Maste
95b71a659a libc: Note that getentropy is nearly POSIX 2024
Our implementation currently diverges from POSIX 2024 in a couple of
ways, as now noted in the BUGS section.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47589
2024-11-20 14:30:34 -05:00
Doug Moore
18a8f4e586 vm_page: correct page iterator patch
The previous change committed a preliminary version of the change to
use iterators to free page sequences.  This updates to what was
intended to be the final version.

Reviewed by:	markj (previous version)
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D46724
2024-11-20 12:00:57 -06:00
Doug Moore
5b78ff8307 vm_page: remove pages with iterators
Use pctrie iterators for removing some page sequences from radix
trees, to avoid repeated searches from the tree root.

Rename vm_page_object_remove to vm_page_remove_radixdone, and remove
from it the responsibility for removing a page from its radix tree,
and pass that responsibility on to its callers.

For one of those callers, vm_page_rename, pass a pages pctrie_iter,
rather than a page, and use the iterator to remove the page from its
radix tree.

Define functions vm_page_iter_remove() and vm_page_iter_free() that
are like vm_page_remove() and vm_page_free(), respectively, except
that they take an iterator as parameter rather than a page, and use
the iterator to remove the page from the radix tree instead of
searching the radix tree. Function vm_page_iter_free() assumes that
the page is associated with an object, and calls
vm_page_free_object_prep to do the part of vm_page_free_prep that is
object-related.

In functions vm_object_split and vm_object_collapse_scan, use a
pctrie_iter to walk over the pages of the object, and use
vm_page_rename and vm_radix_iter_remove modify the radix tree without
searching for pages.  In vm_object_page_remove and _kmem_unback, use a
pctrie_iter and vm_page_iter_free to remove the page from the radix
tree.

Reviewed by:	markj (prevoius version)
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D46724
2024-11-20 11:54:20 -06:00
Ed Maste
5cc53d7965 memcmp.3: Clarify return value
The return value is not required to be the difference between the
differing bytes, only less than zero, zero, or greater than zero.

Reviewed by:	fuz
Event:		Kitchener-Waterloo Hackathon 202406
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47683
2024-11-20 12:15:11 -05:00