Commit Graph

282633 Commits

Author SHA1 Message Date
Emmanuel Vadot
f1d7ae31d4 linuxkpi: Add hdmi helpers
This is a direct port of the Linux code as the licence allows it, so
style(9) isn't respected to allow applying directly the upstream commits.
Do not add it to linuxkpi directly but add a new linuxkpi_hdmi module
that drm modules will require later, no need to bloat linuxkpi more.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39122
2023-03-28 09:11:06 +02:00
Richard Scheffenegger
f858eb916f tcp: send SACK rescue retransmission also mid-stream
Previously, SACK rescue retransmissions would only happen
on a loss recovery at the tail end of the send buffer.

This extends the mechanism such that partial ACKs without SACK
mid-stream also trigger a rescue retransmission to try avoid
an otherwise unavoidable retransmission timeout.

Reviewed By:		tuexen, #transport
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D39274
2023-03-28 04:47:01 +02:00
Gleb Smirnoff
78e6c3aacc tcp: update error counter when dropping a packet due to bad source
Use the same counter that ip_input()/ip6_input() use for bad destination
address.  For IPv6 this is already heavily abused ip6s_badscope, which
needs to be split into several separate error counters.

Reviewed by:		markj
Differential Revision:	https://reviews.freebsd.org/D39234
2023-03-27 18:37:15 -07:00
Kristof Provost
ccff2078af carp: fix source MAC
When we're not in unicast mode we need to change the source MAC address.
The check for this was wrong, because IN_MULTICAST() assumes host
endianness and the address in sc_carpaddr is in network endianness.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-28 01:18:18 +02:00
Kristof Provost
27b23cdec9 pf: remove pd_refs from pfsync
It only served to complicate cleanup, and added no value.

While here drop packets in pfsync_defer_tmo() if we don't have a syncif,
rather than just leaving them on the queue.

Reviewed by:	markj
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39248
2023-03-28 01:18:07 +02:00
Kristof Provost
01194da28a pfsync: hold b_mtx for callout_stop(pd_tmo)
The pd_tmo callout has an associated mutex, which we must hold while
calling callout_stop().

Reported by:	markj
Reviewed by:	markj
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39223
2023-03-28 01:17:55 +02:00
Rick Macklem
1512579adc nfscl: Make coverity happy
Coverity does not like code that checks a function's
return value sometimes.  Add "(void)" in front of the
function when the return value does not matter to try
and make it happy.

Reported by:	emaste
MFC after:	3 months
2023-03-27 16:53:30 -07:00
Konstantin Belousov
6a0a634590 Regen 2023-03-28 02:39:26 +03:00
Konstantin Belousov
f2ec444be5 kqueue1(2): document
Reviewed by:	emaste, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39271
2023-03-28 02:39:26 +03:00
Konstantin Belousov
375732cc6e kqueue1(2): export the symbol from libc
Reviewed by:	emaste, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39271
2023-03-28 02:39:26 +03:00
Konstantin Belousov
61194e9852 Add kqueue1() syscall
It takes the flags argument.  Immediate use is to provide the KQUEUE_CLOEXEC
flag for kqueue(2).

Reviewed by:	emaste, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39271
2023-03-28 02:39:26 +03:00
John Baldwin
ac6b2b4344 build: glibc on Linux defines explicit_bzero in <string.h>.
Don't install strings.h on such systems.  The local prototype doesn't
match the native Linux one when built as C++ breaking the build of
config(8) as a bootstrap tool on some Linux systems.  If the missing
prototype becomes a problem in the future,
tools/build/cross-build/include/linux/strings.h can be patched to add
it.

Reviewed by:	imp, emaste
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D39289
2023-03-27 14:27:16 -07:00
Tom Hukins
f59727087b CONTRIBUTING.md: Fix checkstyle9.pl name
Pull request: https://github.com/freebsd/freebsd-src/pull/703
2023-03-27 16:23:13 -04:00
Alan Somers
b37d1deb04 ses: cleanup ses tests
Address mav's feedback RE eea7c61590

See also: https://reviews.freebsd.org/D31809

Reported by:	mav
MFC after:	2 weeks
MFC with:	eea7c61590
Sponsored by:	Axcient
Reviewed by:	mav
Differential Revision: https://reviews.freebsd.org/D33954
2023-03-27 14:06:51 -06:00
Alan Somers
57dc6f5e20 sesutil: fix "fault all" with zoned jbods
Some SAS JBODs support zoning.  This feature allows individual SAS
targets to be accessible by only some initiator ports.  One application
would be connecting two servers to the same JBOD, but they wouldn't be
able to see each other's disks.

A zoned JBOD should also prohibit initiators from accessing SES elements
corresponding to inaccessible SAS targets.  It reports that by setting
the element's status code to 0x8 (No Access Allowed).

The bug is that when doing "sesutil (fault|locate) all ...", sesutil
will attempt a ENCIOC_SETELMSTAT ioctl for every single element, even
the inaccessible ones.  The enclosure will reject the command, the
kernel will return EINVAL, and sesutil will exit.

The solution is to check the element's status, and skip trying to set it
if the status is 0x8.  But if the user actually supplied a ses ID, then
assume that he knows what he's doing and try to set it anyway.

PR:		270093
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	mav, trasz
Differential Revision: https://reviews.freebsd.org/D39017
2023-03-27 13:43:35 -06:00
Rob N
aebd94cc85
config: don't link libudev on FreeBSD
FreeBSD has a libudev shim in libudev-devd. If present, configure would
detect it and produce binaries linked against it, even though nothing
used it. That is surprising and unnecessary, so lets remove it.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #14669
2023-03-27 11:55:54 -07:00
Joseph Mingrone
35af88c963
Import libpcap 1.10.3
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2023-03-27 15:45:17 -03:00
Rich Ercolani
ae0b1f66c7
linux 6.3 compat: add another bdev_io_acct case
Linux 6.3+, and backports from it (6.2.8+), changed the
signatures on bdev_io_{start,end}_acct.  Add a case for it.  

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #14658
Closes #14668
2023-03-27 11:29:19 -07:00
Alexander V. Chernikov
b894193501 netlink: fix linux module build w/ netlink.
Reported by:	Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after:	2 weeks
2023-03-27 18:21:26 +00:00
Ruslan Bukin
27c8d4851c Include Embedded Trace Extensions (ETE) source code to the OpenCSD build.
Sponsored by:	UKRI
2023-03-27 17:10:26 +01:00
Alexander V. Chernikov
d3a49f62a2 netlink: fix 19e43c163c by adding miseed netlinkg_glue.c 2023-03-27 16:09:02 +00:00
Ruslan Bukin
46e6e29097 Import OpenCSD v.1.4.0.
Sponsored by:	UKRI
2023-03-27 17:03:16 +01:00
Ruslan Bukin
974000f192 Update OpenCSD to v1.4.0.
Sponsored by:	UKRI
2023-03-27 16:23:28 +01:00
Alexander V. Chernikov
19e43c163c netlink: add netlink KPI to the kernel by default
This change does the following:

Base Netlink KPIs (ability to register the family, parse and/or
 write a Netlink message) are always present in the kernel. Specifically,
* Implementation of genetlink family/group registration/removal,
  some base accessors (netlink_generic_kpi.c, 260 LoC) are compiled in
  unconditionally.
* Basic TLV parser functions (netlink_message_parser.c, 507 LoC) are
  compiled in unconditionally.
* Glue functions (netlink<>rtsock), malloc/core sysctl definitions
 (netlink_glue.c, 259 LoC) are compiled in unconditionally.
* The rest of the KPI _functions_ are defined in the netlink_glue.c,
 but their implementation calls a pointer to either the stub function
 or the actual function, depending on whether the module is loaded or not.

This approach allows to have only 1k LoC out of ~3.7k LoC (current
 sys/netlink implementation) in the kernel, which will not grow further.
It also allows for the generic netlink kernel customers to load
 successfully without requiring Netlink module and operate correctly
 once Netlink module is loaded.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D39269
2023-03-27 13:55:44 +00:00
Yuri Pankov
21af4e09f4 nvmecontrol(8): fix resv register -i synopsis
-i is "ignore existing key" and does not take argument

Reviewed by:	pauamma (manpages)
Differential Revision:	https://reviews.freebsd.org/D37709
2023-03-27 15:00:33 +02:00
Mark Johnston
68ca8363c7 libc: Use secure_getenv(3) where appropriate
No functional change intended.

Reviewed by:	mjg, imp, kib
Differential Revision:	https://reviews.freebsd.org/D39278
2023-03-27 08:56:22 -04:00
Mark Johnston
ad2f2ee015 arm64: Remove duplicated function prototypes for PAC
No functional change intended.

Sponsored by:	The FreeBSD Foundation
2023-03-27 08:56:22 -04:00
Yuri Pankov
6aa5b10d0c nvme: fix resv commands with nda device
- passing I/O commands through nda requires nsid field to be set (it was
  unused when going through nvme_ns_ioctl())
- ccb's status can be OR'ed with the flags, use CAM_STATUS_MASK

Reviewed by:	imp (cam)
Differential Revision:	https://reviews.freebsd.org/D37696
2023-03-27 14:53:24 +02:00
Yuri Pankov
1249680609 kern.post.mk: fix PORTSDIR handling
Using subshell's PORTSDIR variable (via $${PORTSDIR}}) seems to be
only working if PORTSDIR is specified directly on the make command
line.

Use ${PORTDIR} here instead so that setting the variable in
/etc/{make,src,src-env}.conf would work (also works for variable
being set on command line or in the environment).

PR:		268299
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D37868
2023-03-27 13:57:57 +02:00
Alexander V. Chernikov
eccccd657f netlink: make nlattr_add_in[6]_addr inline
MFC after:	2 weeks
2023-03-27 11:53:34 +00:00
Alexander V. Chernikov
6dc858d84c netlink: remove forgotten debug message in handle_rtm_getroute().
MFC after:	2 weeks
2023-03-27 10:49:40 +00:00
Alexander V. Chernikov
544f1492c0 netlink: ensure genetlink control family always registers under the same ID.
MFC after:	2 weeks
2023-03-27 10:48:24 +00:00
Corvin Köhne
e8988d60d2
pci: expose intel_graphics_stolen as sysctl
The Intel graphics stolen memory is used by the Intel GOP driver on
boot. When using bhyve with GPU passthrough, it's also used by the guest
GOP driver at guest boot. For that reason, bhyve needs to know the
address and size of this region to inform the guest about this region.
Exposing the variables as sysctl allows bhyve to easily read them.
2023-03-27 11:40:49 +02:00
Corvin Köhne
48d70503bc
pci: add tunable hw.pci.enable_mps_tune
If the tunable is set to 0, the tuning of the MPS (maximum payload size)
is disabled and the default MPS values set by the BIOS are used. In this
case the system may use a lower speed or operate in a less optimized
state, but it can resolve issues with stability and compatibility. With
specific devices the tuning of the mps, can lead to a complete freeze of
the system.

Reviewed by:		manu
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38397
2023-03-27 11:28:27 +02:00
Corvin Köhne
f4ceaff56d
bhyve: add config option to modify LPC IDs
The Intel GOP driver checks the LPC IDs to detect the platform it's
running on. The GOP driver only works on the platforms it's written for.
Maybe other Intel driver have the same behaviour. For that reason, we
should use the LPC IDs of the FreeBSD host for GPU passthrough to work
properly.

We don't know if setting different LPC IDs have any side effect.
Therefore, don't use the host LPC IDs by default on Intel system. Give
the user the opportunity to modify the LPC IDs.

Reviewed by:		jhb
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D28280
2023-03-27 10:10:24 +02:00
Corvin Köhne
b72e06b13e
bhyve: make use of helper to read PCI IDs from bhyve config
For compatibilty reasons, the old config values are still supported.

Reviewed by:		jhb
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38403
2023-03-27 10:10:24 +02:00
Corvin Köhne
ffaed739a8
bhyve: add helper to read PCI IDs from bhyve config
Changing the PCI IDs is valuable in some situations. The Intel GOP
driver requires that some PCI IDs of the LPC bridge are aligned with the
physical values of the host LPC bridge. Another use case are oracles
virtio driver. They require different subvendor ID than the default one.
For that reason, create a helper which makes it easy to read PCI IDs
from bhyve config. Additionally, this helper ensures that all emulation
devices are using the same config keys.

Reviewed by:		jhb
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38402
2023-03-27 10:10:24 +02:00
Gordon Bergling
107597fbd4 rarpd(8): Fix a typo in a source code comment
- s/combinataion/combination/

Obtained from:	NetBSD
MFC after:	3 days
2023-03-27 08:45:30 +02:00
Jose Luis Duran
9fc2d858b4 ping tests: Add a regression test
Test regression fixed in 4630a3252a. Add two tests that do not
use the verbose flag, so the code path in question can be reached:

1. Respond with a proper ICMP destination host unreachable packet.
2. Respond with a doctored ICMP destination host unreachable packet,
   that has the ICMP Identifier field modified (+1 bit).

Reviewed by:	cy
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39244
2023-03-26 19:54:29 -07:00
Kyle Evans
ec1bc53002 arm64: cpu_switch: don't zero out pcb_onfault
Previously this would zero out x18 in the pcb, now it's attacking the
innocent pcb_onfault -- drop it entirely.

This technically fixes
e605b87a9e ("Save only callee-saved registers in pcb"), but it's
harmless until the below commit trims down pcb_x.

Reported by:	mmel
Reviewed by:	andrew, mmel
Fixes:	1c1f31a5e5 ("Remove unused registes from the arm pcb")
Differential Revision:	https://reviews.freebsd.org/D39277
2023-03-26 13:48:22 -05:00
Alexander V. Chernikov
3a151e31ac route: fix RTF_HOST & non-empty mask handling in netlink translation. 2023-03-26 18:07:23 +00:00
Mark Johnston
ae2f0b2611 tftp tests: Fix a typo in the makefile
Fixes:	64c2a712d6 ("tftp: Add tests.")
2023-03-26 12:54:59 -04:00
Alexander V. Chernikov
c597432e22 route(8): convert to netlink
This change converts all kernel rtsock interactions in route(8)
 to Netlink.

Based on the WITHOUT_NETLINK_SUPPORT src.conf(5) variable, route(8)
 now fully operates either via Netlink or via rtsock/sysctl.
The default (compile-time) is Netlink.

The output for route delete/add/get/flush is targeted to be exactly
 the same (apart from some error handling cases).
The output for the route monitor has been changed to improve
 readability and support netlink models.

Other behaviour changes:
* exact prefix lookup (route -n get a.b.c.d/e) is not yet supported.
* route monitor does not show the change originator yet.

Differential Revision:	https://reviews.freebsd.org/D39007
2023-03-26 11:06:56 +00:00
Alexander V. Chernikov
a85dcd4ac4 netlink: restrict default userland switch to netlink to i386/amd64. 2023-03-26 11:06:53 +00:00
Alexander V. Chernikov
9a11f3dff9 netlink: add standrard ifaddr/neigh parsers to snl(3).
MFC after:	2 weeks
2023-03-26 09:04:41 +00:00
Alexander V. Chernikov
64dfea8651 netlink: add NETLINK/NETLINK_SUPPORT userland options.
Make userland tools such as netstat, route, arp and ndp use
 either netlink or rtsock interfaces based on the NETLINK_SUPPORT
 options.
Both NETLINK and NETLINK_SUPPORT options are turned on by default.

Reviewed By: eugen
Differential Revision: https://reviews.freebsd.org/D39148
2023-03-26 08:59:58 +00:00
Alexander V. Chernikov
04f75b9802 netlink: allow netlink sockets in non-vnet jails.
This change allow to open Netlink sockets in the non-vnet jails, even for
 unpriviledged processes.
The security model largely follows the existing one. To be more specific:
* by default, every `NETLINK_ROUTE` command is **NOT** allowed in non-VNET
 jail UNLESS `RTNL_F_ALLOW_NONVNET_JAIL` flag is specified in the command
 handler.
* All notifications are **disabled** for non-vnet jails (requests to
 subscribe for the notifications are ignored). This will change to be more
 fine-grained model once the first netlink provider requiring this gets
 committed.
* Listing interfaces (RTM_GETLINK) is **allowed** w/o limits (**including**
 interfaces w/o any addresses attached to the jail). The value of this is
 questionable, but it follows the existing approach.
* Listing ARP/NDP neighbours is **forbidden**. This is a **change** from the
 current approach - currently we list static ARP/ND entries belonging to the
 addresses attached to the jail.
* Listing interface addresses is **allowed**, but the addresses are filtered
 to match only ones attached to the jail.
* Listing routes is **allowed**, but the routes are filtered to provide only
 host routes matching the addresses attached to the jail.
* By default, every `NETLINK_GENERIC` command is **allowed** in non-VNET jail
 (as sub-families may be unrelated to network at all).
 It is the goal of the family author to implement the restriction if
 necessary.

Differential Revision: https://reviews.freebsd.org/D39206
MFC after:	1 month
2023-03-26 08:44:09 +00:00
Alexander V. Chernikov
2cda6a2fb0 routing: add public rt_is_exportable() version to check if
the route can be exported to userland when jailed.

Differential Revision: https://reviews.freebsd.org/D39204
MFC after:	2 weeks
2023-03-26 08:24:27 +00:00
Gordon Bergling
328ebd4680 devd.conf.5: Fix a typo in the manual page
- s/deteted/detected/

MFC after:	5 days
2023-03-26 09:43:58 +02:00
Cy Schubert
1f5c16c4e1 share/misc/committers-*: Document my mentors
Document my ports and src mentors.
2023-03-25 20:29:37 -07:00