Commit Graph

292876 Commits

Author SHA1 Message Date
Konrad Witaszczyk
bb8fa2ef83 sbin/nos-tun: correct SIOCDIFADDR calls to use ifreq
The SIOCDIFADDR ioctl takes an ifreq structure object, not an ifaliasreq
structure object, as its argument.

Reviewed by:	brooks, jhb, oshogbo
Approved by:	oshogbo (mentor)
Obtained from:	CheriBSD
Differential Revision: https://reviews.freebsd.org/D46017
2024-07-22 09:58:37 +00:00
Konrad Witaszczyk
5688843dc9 sys: Index netlink/ files with the cscope target
Reviewed by:	oshogbo
Approved by:	oshogbo (mentor)
Differential Revision: https://reviews.freebsd.org/D45934
2024-07-22 09:50:43 +00:00
Kristof Provost
9ae91f59c5 pf: convert DIOCGETADDR to netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-07-22 09:11:49 +02:00
Kristof Provost
644b7b5a2e pf: convert DIOCGETADDRS to netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-07-22 09:11:49 +02:00
Navdeep Parhar
f1c4ed1503 cxgbe/iw_cxgbe: Add a placeholder uld_restart.
MFC after:	1 month
Sponsored by:	Chelsio Communications
2024-07-21 22:25:08 -07:00
Navdeep Parhar
c1c524852f cxgbe/t4_tom: Implement uld_stop and uld_restart for ULD_TOM.
This allows the adapter to be suspended or reset even when stateful TOE is
active, in some limited configurations.

The LLD has already stopped the adapter hardware and all its queues by the time
these ULD routines get called.  The general approach in t4_tom is to purge the
lookup tables immediately so that they are ready for operation by the time the
adapter resumes, and park all the resources left hanging by the stopped hardware
into separate "stranded" queues that can be dealt with at leisure.

Outstanding active opens, live connections, and synq entries (for connections in
the middle of the 3-way handshake) are all treated as if the hardware had
reported an abrupt error for the tid.  The servers/listeners are a bit different
in that no error is reported.  They're just noted as non-functional when the
hardware stops and are recreated by the driver during restart.

MFC after:	1 month
Sponsored by:	Chelsio Communications
2024-07-21 22:20:21 -07:00
Navdeep Parhar
283333c0e3 cxgbe/t4_tom: Track all synq entries in a per-adapter list.
Live tid entries in tid_tab are either full fledged connections or synq
entries.  toep_list tracks the connections already and this change adds
a synqe_list to track the synq entries.  These two lists can be used to
enumerate and iterate over all live tids.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-07-21 21:02:34 -07:00
Navdeep Parhar
cd93fdee5c cxgbe(4): Stop and restart the L2T allocator with the LLD.
L2T entries are used by both filters and TOE and the L2T is shared
between the base driver (LLD) and the TOM ULD.  Add a flag to indicate
that the L2T is stopped, which means:
* t4_alloc_l2e and t4_l2t_alloc_switching will not allocate new entries.
* t4_tom will ignore all ARP/NDP updates from the kernel.
* Previously allocated L2T entries can still be freed.

MFC after:      1 month
Sponsored by:   Chelsio Communications
2024-07-21 20:29:26 -07:00
Navdeep Parhar
fd3aca5b41 cxgbe(4): Stop and restart the atid allocator with the LLD.
atids are used by both filters and TOE and the atid table is in the base
driver (LLD).  New atids cannot be allocated when the allocator is
stopped but existing ones can still be freed.  It is expected that the
owners of outstanding atids will release them in their own stop
processing, before the adapter is restarted.

MFC after:	1 month
Sponsored by:	Chelsio Communications
2024-07-21 20:26:42 -07:00
Navdeep Parhar
5241b210a4 cxgbe(4): Basic infrastructure for ULDs to participate in adapter reset.
The suspend/resume/reset implementation in the base driver (LLD)
currently works when only stateless features are in use.  This commit
adds basic infrastructure for stateful upper layer drivers (ULDs) to
participate in suspend/resume/reset.

* Add a uld_restart to indicate that the adapter has been restarted
  after a stop and the ULD should resume operations.
* Move the existing functionality in t4_suspend/t4_resume to stop_lld and
  restart_lld.  Use these and the new uld restart routines everywhere the
  adapter has to be stopped abruptly and restarted, namely:
  1. PCIE bus suspend/resume/reset methods invoked by the kernel.
  2. Manual internal-reset using driver sysctl.
  3. Automatic internal-reset on a fatal error.
* Implement an alternate internal-reset for use in VMs and for testing.

Typical reset sequence is:
stop_adapter(sc);
stop_lld(sc);
stop_all_uld(sc);
set_adapter_hwstatus(sc, false);

/* hw reset takes place here. */

restart_adapter(sc);
restart_lld(sc);
  set_adapter_hwstatus(sc, true);
restart_all_uld(sc);

MFC after:	1 month
Sponsored by:	Chelsio Communications
2024-07-21 20:24:03 -07:00
Michael Tuexen
e0b080f850 tcp: mark TCP stacks which can serve as a default stack
Allow a TCP function block (tfb) to become the default stack only if
tfb->tfb_flags has the TCP_FUNC_DEFAULT_OK flags set. This allows a
TCP function block, that is not suitable as a default function block
to ensure that it is not set as the default via sysctl. In this case
sysctl would return EINVAL.

Reviewed by:		gallatin, Peter Lei
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D45419
2024-07-21 15:06:10 +02:00
Rick Macklem
026cdaa3b3 nfscl: Scan readdir reply filenames for invalid characters
The NFS RFCs are pretty loose with respect to what characters
can be in a filename returned by a Readdir.  However, FreeBSD,
as a POSIX system will not handle imbedded '/' or nul characters
in file names.  Also, for NFSv4, the file names "." and ".."
are handcrafted on the client and should not be returned by a
NFSv4 server.

This patch scans for the above in filenames returned by Readdir and
ignores any entry returned by Readdir which has them in it.
Because an imbedded nul would be a string terminator, it was
not possible to code this check efficiently using string(3)
functions.

Reported by:	Apple Security Engineering and Architecture (SEAR)
MFC after:	1 week
2024-07-21 15:56:16 -07:00
Dimitry Andric
397c2693fa Fix llvm register allocator for native/cross build differences
Work around an issue in LLVM's register allocator, which can cause
slightly different i386 object files, when produced by a native or cross
build of clang.

This adds another volatile qualifier to a float variable declaration in
the weightCalcHelper() function, which otherwise produces slightly
different float results on amd64 and i386 hosts. In turn, this can lead
to different (but equivalent) register choices, and thus non-identical
assembly code.

See https://github.com/llvm/llvm-project/issues/99396 for more details.

Note this is a temporary fix, meant to merge in time for 13.4. As soon
as upstream has a permanent solution we will import that.

PR:		276961
Reported by:	cperciva
MFC after:	3 days
2024-07-21 22:37:27 +02:00
Michael Tuexen
baee801c92 tcp: simplify endpoint creation at the passive side
Use the intended TCP stack when creating a TCP endpoint instead of
creating it the endpoint the default stack first and after that
switching it to use the intended TCP stack.
Reviewed by:		Peter Lei, rrs and jtl (older version)
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D45411
2024-07-21 11:49:37 +02:00
Michael Tuexen
646c28ea80 tcp: improve SEG.ACK validation
Implement the improved SEG.ACK validation described in RFC 5961.
In addition to that, also detect ghost ACKs, which are ACKs for data
that has never been sent.
The additional checks are enabled by default, but can be disabled
by setting the sysctl-variable net.inet.tcp.insecure_ack to a
non-zero value.

PR:			250357
Reviewed by:		Peter Lei, rscheff (older version)
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D45894
2024-07-21 11:37:35 +02:00
Bojan Novković
1cbd613f33 db_pprint: Properly handle complex pointer types
The existing pretty-printing code fails to properly print complex
pointer types. This commit fixes this behaviour by traversing the
chain of CTF types until a base type is encountered.

Approved by: markj (mentor)
Fixes: c21bc6f3c2
2024-07-21 19:31:59 +02:00
Bojan Novković
82f5dfc121 db_pprint: Fix offset calculation for struct members
The struct pretty-printing code uses the ctm_offset field in
struct ctf_member_v3 to calculate the address of a struct member.
However, the code treats this as a byte offset rather than the
offset in bits, leading to wrong values being printed.
Fix this by diving with ctm_offset by NBBY.

Approved by: markj (mentor)
Fixes: c21bc6f3c2
2024-07-21 19:31:48 +02:00
Vladimir Kondratyev
24388fccd5 Bump __FreeBSD_version after LinuxKPI changes.
Sponsored by:   Serenity Cyber Security, LLC
2024-07-21 16:17:37 +03:00
Vladimir Kondratyev
14fc33ea3a LinuxKPI: Fix resource leak on pci_iounmap-ing of PCI BAR
If the resource was allocated with want_iomap_res flag set.

Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, bz
Differential Revision:	https://reviews.freebsd.org/D45905
2024-07-21 16:10:44 +03:00
Vladimir Kondratyev
fcc350c375 LinuxKPI: Add pci_iomap_range function
pci_iomap_range creates a virtual mapping cookie for a PCI BAR.
As compared with pci_iomap it got extra offset parameter.

Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, bz
Differential Revision:	https://reviews.freebsd.org/D45904
2024-07-21 16:10:25 +03:00
Vladimir Kondratyev
d42136e361 LinuxKPI: Remove vmas argument from get_user_pages on KBI layer
To chase Linux kernel 6.5

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45850
2024-07-21 16:10:14 +03:00
Vladimir Kondratyev
1fe7cd0243 LinuxKPI: Remove owner argument from class_create function on KBI layer
To chase Linux 6.4

Sponsored by:   Serenity Cyber Security, LLC
Differential Revision:	https://reviews.freebsd.org/D45849
2024-07-21 16:09:58 +03:00
Vladimir Kondratyev
7774e08adf LinuxKPI: Add linux/eventfd.h and linux/memremap.h dummy headers
Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45848
2024-07-21 16:09:48 +03:00
Vladimir Kondratyev
3e90716331 LinuxKPI: Add acpi_dev_get_first_match_dev and acpi_device_handle
acpi_dev_get_first_match_dev returns the first match of ACPI device
and acpi_device_handle returns its ACPI handle.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45847
2024-07-21 16:09:37 +03:00
Vladimir Kondratyev
5b1171a0b7 LinuxKPI: Add pci_match_id to linux/pci.h
It finds out if a given PCI device matches a given pci_id table.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45846
2024-07-21 16:09:27 +03:00
Vladimir Kondratyev
a1181662d3 LinuxKPI: Add devm_device_add_group to linux/device.h
devm_device_add_group creates a managed attribute group for a device.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45845
2024-07-21 16:09:12 +03:00
Vladimir Kondratyev
80aa295a52 LinuxKPI: Add page_to_virt function
Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45843
2024-07-21 16:09:01 +03:00
Vladimir Kondratyev
742088d9fb LinuxKPI: Add __diag macros
__diag macros turn individual warnings and errors on and off locally,
depending on version of compiler. Add dummy implementation as drm-kmod
set warnings separately for each file.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu, emaste
Differential Revision:	https://reviews.freebsd.org/D45842
2024-07-21 16:08:48 +03:00
Vladimir Kondratyev
ab1a5d8e2a LinuxKPI: Add kmalloc_size_roundup function
kmalloc_size_roundup reports allocation bucket size for the given size.

Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, emaste
Differential Revision:	https://reviews.freebsd.org/D45841
2024-07-21 16:08:37 +03:00
Vladimir Kondratyev
ab6e116790 LinuxKPI: Add kvrealloc to linux/slab.h
Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45616
2024-07-21 16:08:28 +03:00
Vladimir Kondratyev
5d20075f8b LinuxKPI: Automatically enable drm support for devices named "drmn"
This allows replace linux_pci_(un)register_drm_driver calls with driver
renaming to FreeBSD name.

Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, bz
Differential Revision:	https://reviews.freebsd.org/D45906
2024-07-21 16:02:08 +03:00
Gordon Bergling
619c9488a3 axgbe: Fix two typos in source code comments
- s/specfied/specified/

MFC after:	3 days
2024-07-21 11:06:07 +02:00
Gordon Bergling
c90a206496 ipfilter(4): Fix typos in source code comments
- s/inconsistancy/inconsistency/

MFC after:	3 days
2024-07-21 11:02:31 +02:00
Gordon Bergling
32a9b95a87 stress2: Fix a typo in namecache2.sh
- s/inconsistancy/inconsistency/

MFC after:	3 days
2024-07-21 11:00:58 +02:00
Gordon Bergling
58c99e0750 sctp(4): Fix typos in source code comments
- s/collasped/collapsed/
- s/defininitions/definitions/
- s/optionaly/optionally/

Obtained from:	NetBSD
MFC after:	3 days
2024-07-21 10:57:22 +02:00
Konstantin Belousov
9a7096ff54 ipsec_offload: hide SA/SP offload lifecycle prints under verbose sysctl
Reported and reviewed by:	kp
Discussed with:	np
Sponsored by:	NVIDIA networking
Differential revision:	https://reviews.freebsd.org/D46045
2024-07-21 11:53:19 +03:00
Konstantin Belousov
6023bd1d52 netipsec: move declaration of the sysctl net.inet{,6}.ipsec nodes to header
Reviewed by:	kp
Sponsored by:	NVIDIA networking
Differential revision:	https://reviews.freebsd.org/D46045
2024-07-21 11:53:19 +03:00
Konstantin Belousov
eb0fdc7753 netinet/ipsec.h: remove unneeded "extern"s
Reviewed by:	kp
Sponsored by:	NVIDIA networking
Differential revision:	https://reviews.freebsd.org/D46045
2024-07-21 11:53:19 +03:00
Konstantin Belousov
35f4984343 sockstat(1): tolerate situation where file info cannot be fetched
Either due to a race, or to the privilege restrictions, it is not
guaranteed that kern.files returned file information for all pcbs
read from net.inet.<proto>.pcblist.  In this case the file rbtree does
not return the matching file by data address, and code must avoid
dereferencing NULL.

PR:	279875
Reviewed by:	asomers
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46050
2024-07-21 11:51:42 +03:00
Kyle Evans
9a3f7fb46c include: ssp: fix last bare inline
This was missed in b8730c11a3 ("include: ssp: fix the build [...]"),
but <ssp/wchar.h> also had a bare `inline` in use.  Swap it over to
__ssp_inline as well.

Reported by:	netchild
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
2024-07-20 23:17:55 -05:00
Cy Schubert
04b4dcf04f leap-seconds: Update to leap-seconds 3960057600 obtained from IERS
IERS is the canonical source of leap-seconds. IANA, NIST and USNO obtain
their leap-second updates from IERS.

This resolves an issue for IPv6-only hosts as IERS is not accessible
via IPv6, requiring IPv6-only host to rely on some other source,
above.

From this point forward we should fetch the file from IERS, the
organization responsible for deciding when to insert leap-seconds.

PR:		279413
Obtained from:	https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list
Discussed with:	imp
MFC after:	1 day
2024-07-20 18:55:41 -07:00
Warner Losh
d3795c1d72 cam/iosched: Use better malloc idiom
Allocate to a simple poiter, use that everywhere, then return it at the
end. The code looks cleaner.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D46043
2024-07-20 13:59:18 -06:00
Simon J. Gerraty
226192822c Merge bmake-20240711
Merge commit '84691af93185c692058ba55fa81a04103f5bf71b'
2024-07-20 12:45:48 -07:00
Simon J. Gerraty
84691af931 Import bmake-20240711
Intersting/relevant changes since bmake-20240625

ChangeLog since bmake-20240625

2024-07-13  Simon J Gerraty  <sjg@beast.crufty.net>

	* cleanup redundant differences from NetBSD make
	o parse.c: no longer uses mmap
	o var.c: check __STDC_VERSION__ not __STDC__

2024-07-12  Simon J Gerraty  <sjg@beast.crufty.net>

	* Apply some patches from NetBSD pkgsrc to reduce divergence
	o meta.c: requires sys/select.h if available
	o var.c: ensure SIZE_MAX has a value
	o util.c: ensure SA_RESTART is defined

	* configure.in: use *ksh* rather than just *ksh to match
	ksh shell specification.

	* unit-tests/Makefile: expand BROKEN_TESTS for ksh and
	mksh in particular

2024-07-11  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240711
	Merge with NetBSD make, pick up
	o compat.c: allow Compat_RunCommand to also handle very long
	commands by writing to a temp file when needed.
	o main.c: extract the temp file logic recently added to Cmd_Exec
	to Cmd_Argv so it can be leveraged by Compat_RunCommand.

2024-07-09  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240709
	Merge with NetBSD make, pick up
	o error out on parse/evaluation errors in shell commands
	o var.c: error out on syntax errors in ':M' and ':N' modifiers

2024-07-07  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240707
	Merge with NetBSD make, pick up
	o only generate code for cleanup functions in CLEANUP mode
	o hash.c: don't track hash table chain lengths during lookup
	unless debugging
	o main.c: move initialization of variable scopes to targ.c
	o var.c: remove Var_End as it is now unnecessary

2024-07-06  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240706
	Merge with NetBSD make, pick up
	o reduce lint comments about ARGSUSED
	o cond.c: error out on conditions containing the operators '&' and '|'
	o str.c: error out on a matching malformed matching pattern '[['
	o var.c: in error messages, distinguish parsing from evaluating
	in error messages for anonymous variables, log the value
	error out on unclosed expressions during parse time

2024-07-04  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240704
	Merge with NetBSD make, pick up
	o add more context information to error messages
	o main.c: on error, print the targets to be made
	add detailed exit status to message for failed sub-commands
	o var.c: error out on the "Bad modifier" error message

2024-07-01  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240701
	Merge with NetBSD make, pick up
	o var.c: add :tt for Title case

2024-06-30  Simon J Gerraty  <sjg@beast.crufty.net>

	* configure.in: 20240630 further refine check for whether
	TZ=Europe/Berlin works

	* VERSION (_MAKE_VERSION): 20240630
	Merge with NetBSD make, pick up
	o job.c: reduce use of UNCONST
	o main.c: add detailed exit status to message for failed sub-commands
	o var.c: error out on some more syntax errors
	add more context to "returned non-zero status" message
2024-07-20 12:41:55 -07:00
Ryan Libby
90818083d7 ipf: correct size limit in snprintf
Reported by:	GCC -Wsizeof-pointer-memaccess
Reviewed by:	zlei
Differential Revision:	https://reviews.freebsd.org/D45899
2024-07-20 09:14:57 -07:00
Warner Losh
eaa3d34b62 cdefs.9: Update for C++ environments
We support all the C++ standards to some degree. However, pre C++11
standard support has been disappearing upstream, so also add a note
about -pedantic-errors might not work for earlier standards. Add note
about __cplusplus values.

Sponsored by:		Netflix
2024-07-20 09:50:38 -06:00
Peter Holm
00266393cc stress2: Fix tests after the new default for newfs(8) is "SU" 2024-07-20 10:52:29 +02:00
Warner Losh
403cc016c0 cam/iosched: Fix build
I was testing this in several trees, and this chunk was in the tree I
tested. I didn't detect the mismerge before the commit...

Fixes: 6f1dd6071a
Sponsored by: Netflix
2024-07-19 22:16:59 -06:00
Warner Losh
123e29068e nvme: widen nvme_qpair_manual_complete_request for better errors
Make nvme_qpair_manual_complete_request take dnr as well as a
print_on_error action. Make the status word computation common between
it and nvme_qpair_manual_complete_tracker. And print the error when
we are cancelling the I/O on failure, but not when we're filtering
the I/O after we've failed. Make it private again to nvme_qpair.c.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D46049
2024-07-19 20:56:04 -06:00
Warner Losh
9229b3105d nvme: Fail passthrough commands right away in failed state.
When the drive is failed, we can't send passthrough commands to the
card, so fail them right away. Rearrange the comments to reflect the
current failure paths in the driver.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D46048
2024-07-19 20:55:52 -06:00