Commit Graph

294433 Commits

Author SHA1 Message Date
Kyle Evans e7a629c851 libmd, kern, stand: consolidate md5 implementations (NFC)
Reduce the number of md5c.c between the three of these from two to one
by just reaching into the kernel build for both userland builds.  The
precedent for this already exists for sha2 in both cases.

_libmd_ symbol privatization bits have been moved to sys/md5.h and
md5.h remains to #include <sys/md5.h> for compatibility.

This stops exporting MD5Pad() in the process because the kernel stopped
exporting it in 502a35d60f.  soversion is bumped accordingly.

This also renames the libc version of stack_protector.c; it previously
only worked by coincidence because .PATH ordering worked out such that
we got the right one, but this is not the case anymore.  Remove the
landmine.

PR:		280784 (exp-run)
Reviewed by:	allanjude, delphij
Differential Revision:	https://reviews.freebsd.org/D34497
2024-09-29 22:34:18 -05:00
Navdeep Parhar 9ba8670a8b cxgbe(4): Allow t4_tom to be unloaded safely.
* Disable IFCAP_TOE automatically on all ifnets on all adapters during
  unload.  This is user-friendly and avoids panics due to stale ifnet
  state after t4_tom is unloaded.
* Do not allow unload if tids are in use by the TOE on any adapter.

Reported by:	Bimal Abraham @ Chelsio
MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-09-29 17:38:11 -07:00
Navdeep Parhar cc110bbec6 cxgbe/t4_tom: Remove duplicate unlock in t4_tom_deactivate.
Fixes:	c1c524852f cxgbe/t4_tom: Implement uld_stop and uld_restart for ULD_TOM.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-09-29 17:38:11 -07:00
Joyu Liao f321956d98 nfsd.c: Synchronize error handling
Synchronize the error handling in nfsd. If you check other error
handlings in those same condition blocks, it uses nfsd_exit instead,
which will call killchildren() and call the rpcbind service to do
the service un-mapping.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D46442
2024-09-29 13:11:54 -07:00
Doug Moore 52b3514052 swap_pager: examine swblks with pctrie iterators
Replace calls to pctrie lookup and remove functions, which always
begin with a search from the pctrie root, with the use of pctrie
iterators to traverse and remove items from the pctrie of swapblks
without duplicating searches.  Take care to reset iterators after
reacquiring an object lock, since with the lock released they could be
invalidated.

Reviewed by:	alc, markj, kib
Tested by:	pho (previous versions)
Differential Revision:	https://reviews.freebsd.org/D46620
2024-09-29 11:38:53 -05:00
Kevin Bowling 33ed9bdca3 igc: Add NVM/firmware prints and sysctl
This chipset suffered an (un)usual number of bugs and iterations. Let's
add our NVM/firmware code from e1000 and the similar igc_nvm function
from DPDK to keep track of issues.

MFC after:	1 week
Sponsored by:	BBOX.io
2024-09-29 03:06:03 -07:00
Gleb Popov 1df198cf93 usr.sbin/jail/jail.8: Make a reference more accurate
The zfs-jail(8) link is also used in the other place within this man

Approved By: imp
Differential Revision: https://reviews.freebsd.org/D46832
2024-09-29 11:33:14 +03:00
Kevin Bowling a40ecb6f74 igc: Remove non-existent legacy absolute and packet timers
igc, derived from igb, does not use these registers. All interrupt
timing is governed by EITR or LLI and driven by write-back.

MFC after:	1 week
Sponsored by:	BBOX.io
2024-09-28 21:57:37 -07:00
Kevin Bowling 1e3b1870ad ixgbe: Switch if_sriov read/write back to ixgbe_mbx APIs
These are more succinct than jumping through the function pointers
directly and add some additional error handling.

MFC after:	1 week
2024-09-28 21:17:21 -07:00
Rick Macklem 6df05714da Revert "nfscl: Enable support for the Lookup+Open RPC"
This reverts commit 9792c7d3eb.

The email thread "panic: nfsv4root ref cnt cpuid=1"
on freebsd-fs@freebsd.org descibes
crashes that occurred for a NFSv4.1 client mount
using "oneopenown" where the same file is re-opened
many times by different processes.

The crashes appear to have been caused by the use
of the Lookup+Open RPC (which only happens for
mounts using the "oneopenown" option).
There appears to be a race between closure of the
open and the open acquired by the Lookup+Open RPC.

Since Lookup+Open RPCs are only an optimization
and can only be done for "oneopenown" at this time,
this patch reverts enabling of them.

It may be possible to fix the code so that
Lookup+Open works reliably, so the code is left
in place (although it will never be executed) for now.

Reported by:	J David <j.david.lists@gmail.com>
MFC after:	2 weeks
2024-09-28 15:01:36 -07:00
Doug Moore 76c60597fa swap_pager: use vm_page_iterators for lookup
Replace the use of page lookups and page next pointers in swap_pager.c
with vm_page iterators.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D46704
2024-09-28 16:46:40 -05:00
Doug Moore 5a5da24fc8 mlx5: optimize ilog2 calculation
Rather than compute ilog2(roundup_pow_of_two(x)), which invokes ilog2
twice, just use order_base_2 once.  And employ that optimization
twice.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46838
2024-09-28 16:24:44 -05:00
Doug Moore 3873b9a8b3 mlx4: use is_power_of_2
It's faster to use is_power_of_2 than it is to compute
roundup_power_of_two and then compare.  So do that.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46838
2024-09-28 16:23:17 -05:00
Doug Moore 65c4ec887e gdma: use ispower2
It's faster to use ispower2(n) than it is to compute
roundup_pow_of_two and do a comparison.  So do the former.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46838
2024-09-28 16:17:03 -05:00
Michael Tuexen cbc9438f05 tcp: improve ref count handling when processing SYN
Don't leak a reference count for so->so_cred when processing an
incoming SYN segment with an on-stack syncache entry and the
sysctl variable net.inet.tcp.syncache.see_other is false.

Reviewed by:		cc, markj, rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Pull Request:		https://reviews.freebsd.org/D46793
2024-09-28 22:06:41 +02:00
Kajetan Staszkiewicz 37881f65ea pf: pf_clear_srcnodes() is always called with NULL
The functions pf_clear_srcnodes() is only used to perform a removal of
all source nodes, never of a given one. Remove the code allowing for
removal of a given source node.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46819
2024-09-28 21:23:14 +02:00
Doug Moore c44fbfdb56 roundup_pow_of_two: don't take the log of it
Based on the definitions, ilog2(roundup_pow_of_two(x)) ==
order_base_2(x). Replace the former with the latter in a few places to
save a few calculations.

Reviewed by:	bz, kib
Differential Revision:	https://reviews.freebsd.org/D46827
2024-09-28 12:00:06 -05:00
Kajetan Staszkiewicz 6ffd4aeba5 pf tests: add a test for max-src-conn
Switch tests using pft_ping.py to inetd. Netcat can only accept a single
connection, we need multiple parallel connections to test max-src-conn. Use the
discard service and modify pft_ping.py to use proper port number.

Implement functionality of 3-way handshake test in pft_ping.py. Make send_params
accessible to sniffer, because answers to SYN+ACK packets should be send with
the same parameters as the original SYN packet.

Finally add a test for max-src-conn and overload.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46798
2024-09-28 18:54:50 +02:00
Enji Cooper c284f45dc7 lib/libexpat: update build config for 2.6.3
MFC after:	1 week
MFC with:	ffd294a1f4
Differential Revision:	https://reviews.freebsd.org/D46830
2024-09-28 07:23:32 -07:00
Enji Cooper ffd294a1f4 MFV: expat 2.6.3
The 2.6.1 - 2.6.3 releases address several security issues with the
library.

The release notes for the 2.6.1-2.6.3 releases can be found at
https://github.com/libexpat/libexpat/blob/R_2_6_3/expat/Changes .

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D46829

Merge commit '8e1eae2319cd3a651941c88b46d95e8ee8507c6c'
2024-09-28 07:19:59 -07:00
Kevin Bowling 911b3c3aa6 Revert "e1000: Remove redundant EITR shift from igb"
Turns out this is necessary

This reverts commit 26439b5787.
2024-09-28 02:11:55 -07:00
Michael Osipov 38c63b5283 dhclient: Ignore vendor-identifying DHCP options defined in RFC 3925
Ignore DHCP options 124 and 125 to shut up the warning messages.
These options are defined in the RFC 3925.

PR:		281361
Reviewed by:	jrm (mentor), otis (mentor), thj
Tested by:	jlduran@gmail.com
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D46760
2024-09-28 10:49:02 +02:00
Kevin Bowling 26439b5787 e1000: Remove redundant EITR shift from igb
The E1000_EITR() macro is already multiplying by 0x4 which is the same
as this shift, so we were shifting more than expected.

MFC after:	6 days
Sponsored by:	BBOX.io
2024-09-27 20:36:00 -07:00
Enji Cooper 8e1eae2319 vendor/expat: import 2.6.3
The 2.6.1 - 2.6.3 releases address security issues.

The release notes for the 2.6.3 release can be found at
https://github.com/libexpat/libexpat/blob/R_2_6_3/expat/Changes .
2024-09-27 20:21:31 -07:00
Doug Moore b7cbf741d5 libkern: avoid local var in order_base_2()
order_base_2(n) is implemented with a variable, which keeps it from
being used at file scope. Implement it instead as ilog2(2*n-1), which
produces a different result when 2*n overflows, which appears unlikely
in practice.

Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D46826
2024-09-27 18:43:07 -05:00
Kristof Provost 86fc6f838e pf: make pf_setup_pdesc() a static function
We only ever call it from pf_test(), and implement it in the same source file.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46706
2024-09-27 22:13:23 +02:00
Kristof Provost f8e9942963 pf: remove ip(6) header argument from pf_reassemble(6)()
Instead of passing the ip header and mbuf to pf_reassemble(), lookup
the header address in the mbuf.
ok henning@

Reviewed by:	zlei
Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 074ee1f915
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46652
2024-09-27 22:13:23 +02:00
Kristof Provost 39f615e90c pf: rename the pf_pdesc field rh_cnt to badopts
It is also used for IPv4 options now.
ok mcbride@ henning@

Reviewed by:	zlei
Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 4fe6abd45f
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46650
2024-09-27 22:13:23 +02:00
Kristof Provost 27f54be50b pf: merge pf_test() and pf_test6()
Bye bye pf_test6(). Only one pf_test function for both IPv4 and v6.
The functions were 95% identical anyway.
OK bluhm@ mcbride@ and most probably henning@ as well

Obtained from:	OpenBSD, claudio <claudio@openbsd.org>, c8bc4f6e29
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46649
2024-09-27 22:13:22 +02:00
Brooks Davis 1235d276b7 lib{c,sys}: stop exposing errno symbol
Officially since C11 (and in reality FreeBSD since 3.0 with commit
1b46cb523d) errno has been defined to be a macro.  Rename the symbol
to __libsys_errno and move it to FBSDprivate_1.0 and confine it entierly
to libsys for use by libthr.  Add a FBSD_1.0 compat symbol for existing
binaries that were incorrectly linked to the errno symbol during
libc.so.7's lifetime.

This deliberately breaks linking software that directly links to errno.
Such software is broken and will fail in surprising ways if it becomes
threaded (e.g., if it triggers loading of a pam or nss module that
uses threads.)

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46780
2024-09-27 20:27:46 +01:00
Bjoern A. Zeeb 0b325167f6 LinuxKPI: 802.11: move functions between header files
Move some ieee8022_{is,has,get}_... functions working on header fields
from mac80211.h to ieee80211.h to avoid problems with #includes.

No functional changes.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-09-27 17:54:16 +00:00
Konstantin Belousov 3848dc4fe6 dmar: on unmap, postpone freeing page table pages after the invalidation is done
IOMMU is free to access page tables until we invalidate them

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-09-27 20:34:23 +03:00
Konstantin Belousov f713ed6694 iommu: extend iommu_map_entry to store the list of associated freed page table pages
The pages are inserted into the added slist if the entry parameter is
passed to iommu_pgfree().  For now it is nop.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-09-27 20:34:23 +03:00
Konstantin Belousov 1784fb4449 vm_page_free_pages_toq(): return the count of freed pages
Reviewed by:	bnovkov
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46820
2024-09-27 20:34:23 +03:00
Konstantin Belousov bdd5eb33ca iommu: change iommu_domain_map_ops to take iommu_map_entry
instead of base/size.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-09-27 20:34:23 +03:00
Konstantin Belousov d50403a691 iommu: add per-unit sysctls reporting the state of DMA and interrupt remapping
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-09-27 20:34:23 +03:00
Konstantin Belousov 10ebd230f4 intel_idpgtbl.c: rename domain_* functions to dmar_*
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-09-27 20:34:23 +03:00
Colin Percival fc2efd283b RELNOTES: RSA host keys for SSH are deprecated
Ficticious hash since there's no actual code change; but the release
notes for FreeBSD 15 should say that RSA host keys for SSH will no
longer be generated by default in FreeBSD 16.

Discussed on:	freebsd-arch
Sponsored by:	Amazon
2024-09-27 09:28:44 -07:00
Konstantin Belousov 5ac9320ddf procstat(1): add rlimitusage subcommand
Reviewed by:	markj, olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46747
2024-09-27 18:02:34 +03:00
Konstantin Belousov 6126f4ea64 libprocstat: add procstat_getrlimitusage()
Reviewed by:	markj, olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46747
2024-09-27 18:02:29 +03:00
Konstantin Belousov c85d3064c4 sysctl: add KERN_PROC_RLIMIT_USAGE
Reviewed by:	markj, olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46747
2024-09-27 18:02:23 +03:00
Konstantin Belousov 927f379180 Regen 2024-09-27 18:02:23 +03:00
Konstantin Belousov 9b29fc89ae Userspace enablement for getrlimitusage(2)
Reviewed by:	markj, olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46747
2024-09-27 18:02:09 +03:00
Konstantin Belousov f028f44ef3 Add getrlimitusage(2)
Reviewed by:	markj, olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46747
2024-09-27 18:02:04 +03:00
Konstantin Belousov 9c3e516ad0 Add proc_nfiles(9)
which returns a snapshot of the count of the opened files in the
process.

Reviewed by:	markj, olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46747
2024-09-27 18:01:56 +03:00
Pierre Pronchery 869d760cb9 bhyve: avoid TOCTOU on iov_len in virtio_vq_recordon()
Avoid a race condition when accessing guest memory, by reading memory
contents only once.

This has also been applied to _vq_record() in
sys/dev/beri/virtio/virtio.c, as per markj@'s suggestion.

Reported by:	Synacktiv
Reviewed by:	markj
Security:	HYP-10
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45735
2024-09-27 10:20:53 -04:00
Pierre Pronchery 94693ec7c8 bhyve: initialize register value
In case of an error in a code pattern like

```
uint64_t val;
error = memread(vcpu, gpa, &val, 1, arg);
error = vie_update_register(vcpu, reg, val, size);
```

uninitialized stack data would be used.

Reported by:    Synacktiv
Reviewed by:	markj
Security:       HYP-21
Sponsored by:   The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46107
2024-09-27 08:59:36 -04:00
Kajetan Staszkiewicz 7fe42038b2 pf: fix max-src-conn when rules are added via netlink
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46797
2024-09-27 14:29:20 +02:00
Kristof Provost e8ff5e565c pf: fix incorrect parsing of state export filter
We saved the af parameter to the proto field.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-09-27 11:50:00 +02:00
Kevin Bowling 9bf9164fc8 e1000: Clean up ITR/EITR in preparation for AIM
Provide macros to derive the various needed values and make it a bit
more clear the differences between em and igb.

The igb default EITR was not landing at the right offset.

Respect the 'max_interrupt_rate' tunable.

MFC after:	1 week
Sponsored by:	BBOX.io
2024-09-27 01:30:05 -07:00