Commit Graph

279814 Commits

Author SHA1 Message Date
Cy Schubert
d24b272832 heimdal: Add additional checks for bad kadmind input
Check return codes for bad input.

MFC after:	3 days
2022-12-01 06:24:12 -08:00
Jean-Sébastien Pédron
e101c1c2c9 linuxkpi: Introduce module_param() of type bint
In Linux, this limits the accepted value to -1, 0 and 1.
In FreeBSD, this remains a signed integer with no specific constraints.

This change is a requirement to update our DRM drivers to Linux 5.12.

Differential Revision:	https://reviews.freebsd.org/D37364
2022-12-01 15:03:00 +01:00
Jean-Sébastien Pédron
0adc02a979 linuxkpi: Add PCIE_SPEED_{32,64}_0GT PCI-E bus speed constants
This change is a requirement to update our DRM drivers to Linux 5.12.

Differential Revision:	https://reviews.freebsd.org/D37363
2022-12-01 15:02:27 +01:00
Jean-Sébastien Pédron
e79a57d4ec linuxkpi: Add cmpxchg64() in <asm/atomic.h>
Differential Revision:	https://reviews.freebsd.org/D36966
2022-12-01 14:59:16 +01:00
Jean-Sébastien Pédron
18e4112337 linuxkpi: Add seqcount_mutex_t support in <linux/seqlock.h>
To achieve that, the header uses the C11 type generic selection keyboard
_Generic() because the macros are supposed to work with seqcount_t
and seqcount_mutex_t.

Differential Revision:	https://reviews.freebsd.org/D36965
2022-12-01 14:58:27 +01:00
Alexander V. Chernikov
984b27d879 net: add if_allocdescr() to permit updating iface description from the kernel
Reviewed by:	kp,zlei
Differential Revision: https://reviews.freebsd.org/D37566
MFC after:	2 weeks
2022-12-01 11:31:36 +00:00
Kornel Dulęba
6f9c622690 rx8803: Improve probing logic
Add a PNP macro in order to load this driver automatically.
While here check if the device is enabled in DT before probing it.

Reviewed by:	wma
Sponsored by:	Alstom
Obtained from:	Semihalf
Differential Revision: https://reviews.freebsd.org/D37579
2022-12-01 10:14:58 +01:00
Jakub Kolodziej
da35578998 lm75: Refactor code to fix io error
Use correct resolution by compat table. If dtb is not defined use default 9 bit mode.
11 bit detection is called if 9 bit mode is used.
Sysctl resolution variable is added to change resolution in case.
Some sensors didn't pull ACK while reading from nonexistent registers and it caused I2C
read error and detect failure, so now detect failure does not cause driver break.

Obtained from:		Semihalf
Sponsored by:		Alstom
Differential revision:	https://reviews.freebsd.org/D37497
2022-12-01 09:12:39 +01:00
Daniel Dowse
e442917ee4 killall(1): allow sending signals to processes with control terminal on pts(4)
PR:	268093
Reviewed by:	kib
MFC after:	1 week
2022-12-01 04:42:35 +02:00
Justin Hibbits
d1f3abc892 powerpc/mpc85xx: Add compat strings for P5040 PCIe
Submitted by:	widelec (widelec@morphos.pl)
MFC after:	1 week
2022-11-30 19:45:10 -05:00
Ed Maste
dba226d43d googletest: remove unused auto_ptr warning suppression
lib/googletest used -Wno-deprecated-declarations to silence warnings
about usage of deprecated std::auto_ptr, but auto_ptr is not (now) used
anywhere in googletest.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37561
2022-11-30 19:34:52 -05:00
Warner Losh
0dfc8a7c1c arm64/machdep: Reserve memory when we find Linux EFI reserved memory table
When Linux loads a new kernel via kexec, somtiems it must reserve memory
for devices that are still active (and typically can't be reset or
shutdown). When present, this table is a linked list of ranges that are
still in use that the OS must avoid using.

Mark these areas as reserved.

This is part of the GICv3 workaround code where we must use the PA
addresses already programmed into the GICv3 when we take over. This part
ensure we don't allocate the mmeory for anything else.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37440
2022-11-30 16:31:14 -07:00
Warner Losh
6849950da7 arm64/machdep: Add parameter to the EFI table walking code
It would be nice to be able to pass an arbitrary pointer to the callback
code. Add one, and pass NULL in all the places that we do that today.
As noted by andrew@, we should likely refactor this into MI code and use
it here and amd64, but for the future.

Sponsored by:		Netflix
Reviewed by:		rpokala
Differential Revision:	https://reviews.freebsd.org/D37439
2022-11-30 16:31:14 -07:00
John Baldwin
442295c1fe Silence GCC warnings when using libc++ headers.
GCC 12 raises warnings about literal operator suffixes not preceded by
'_' in libc++ headers such as <string_view> as it doesn't recognize
libc++ headers being an implementation of the standard.

GCC 12 also warns about clang-specific pragmas in <locale>.

Disabling these warnings globally for all C++ code is not ideal, but
is a better option than patching libc++ headers to ignore these
warnings.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D37530
2022-11-30 14:53:29 -08:00
John Baldwin
d00c20882f udp[6]_multi_input: Don't unlock freed inp.
If udp[6]_append() returns non-zero, it is because the inp has gone
away (inpcbrele_rlocked returned 1 after running the tunnel function).

Reviewed by:	ae
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D37511
2022-11-30 14:38:51 -08:00
John Baldwin
79b6799423 ether_demux: Defer stripping the Ethernet header.
This avoids having to undo it before invoking NetGraph's orphan input
hook.

Reviewed by:	ae, melifaro
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D37510
2022-11-30 14:38:51 -08:00
Warner Losh
f9ce8da864 stand/ofw: Refactor ofw parsedev
Both ofw_disk and ofw_net use the same parsedev routine, except for the
string passed in to match the ofw device node's type. Create a routine
to do that and connect these two users up to that.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37560
2022-11-30 15:30:34 -07:00
Warner Losh
854001759e stand/ofw: Use devparse
Retire the custom parsedev routine and use the standard devparse.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37559
2022-11-30 15:30:33 -07:00
Warner Losh
88a8c68298 ofw/disk: Add parsedev support
Add a parsedev support for OpenFirmware disks. We must look at
characteristics of the OFW node to know if we match this device (so
supply a match routine) or not. Add a parsing routine to allocate
devdesc for OpenFirmware disks as well.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37558
2022-11-30 15:30:33 -07:00
Warner Losh
b8ff248f65 stand/ofw: Subclass devnet to cope with ofw's unique needs
We need to match devices in a slightly special way: We have to look up
the path and see if the device is a 'network' device in order to use it.

Sponsored by:		Netflix
Tested by:		grehan@ (with tweaks to my original patch)
Differential Revision:	https://reviews.freebsd.org/D37557
2022-11-30 15:30:33 -07:00
Warner Losh
ed3cc2f248 stand/ofw: Add ofw_path_to_handle
ofw_path_to_handle converts a path string to a phandle_t. It searches
down the path for the first device whose type matches the passed-in
string.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37556
2022-11-30 15:30:33 -07:00
Warner Losh
40d340acb9 stand: Implement ofw disk print routine
Have lsdev show openfirmware devices.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37555
2022-11-30 15:30:33 -07:00
Warner Losh
a07cef5a73 stand: Add dv_match
On OpenFirmware, and possibly kboot, we use full path names for the
objects that are the 'device'. kboot uses a hack of knowing that all
disk device nodes start with '/dev', but this generalizes it for
OpenFirmware where both 'block' and 'network' devices live in the same
namespace and one must ask the OF node its type to know if this device
type matches.

For drivers that don't specify, the current convention of using
strncmp() is retained. This is done only in devparse(), but everything
uses it directly (or will soon).

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37554
2022-11-30 15:30:33 -07:00
Warner Losh
33bbe5ddcb stand: parsedev API change: devspec now points to start of full device name
To support more flexible device matching, we now pass in the full
devspec to the parsedev routines. For everything execpt uboot, this is
just a drop in (since everything except uboot and openfirmware always
uses disk...: and/or zfs:, but openfirmware isn't really affected).

uboot we kludge around it by subtracting 4 from where the rest of the
device name starts. This is unforunate, and can compute the address one
before the string. But we never dereference that address. uboot needs
more work, and this is an acceptable UB until that other work happens.

OFW doesn't really use the parsedev routines these days (since none of
the supported device uses this... yet). It too needs more work, but it
needs device matching support first.

Sponsored by:		Netflix
Reviewed by:		delphij
Differential Revision:	https://reviews.freebsd.org/D37553
2022-11-30 15:30:33 -07:00
Warner Losh
66012c8fc4 stand: create devinit
devinit() marches through all the devices, calling the inint routines if
any exist. Replace all the identical copies of this code.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37349
2022-11-30 15:30:33 -07:00
Warner Losh
daaf594e84 stand/ofw: ofw_disk isn't really a disk
The rest of the code in the tree assumes that a DEVT_DISK uses a
disk_devdesc to represent the device. However ofw_disk diesn't, so we
can't use disk_fmtdev, nor disk_parsedev. ofw needs to have a
dv_match-like routine to use devpasrse, though, since we have two
drivers (net and block) that claim the same sort of devices (eg
/path/to/ofw-dev) based on the device-type property. In the interim, we
can't use devmatch and ofw_disk's and the default net driver's parsing
is offloaded ofw_parsedev.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37347
2022-11-30 15:30:33 -07:00
Warner Losh
bb9f61da17 zfs: Remove devicename_stubs
We no longer need the zfs stubs since we're no longer referencing these
functions outside of zfs.c.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37345
2022-11-30 15:30:32 -07:00
Warner Losh
90412431fe stand: make zfs_parsedev static
It's now unreferenced outside of zfs.c.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37344
2022-11-30 15:30:32 -07:00
Warner Losh
d16083815c stand/ofw: Access the parsing routine more directly
We don't need to check if something is a ZFS device. Instead, if the
found device has a parse routine, call it. Otherwise, just copy the
path.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37343
2022-11-30 15:30:32 -07:00
Warner Losh
910de60a7e stand/userboot: Move to using common devparse()
We no longer need to have to hand-code this for each boot loader since
devparse() handles them all with dv_parsedev().

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37342
2022-11-30 15:30:32 -07:00
Warner Losh
641a0617e8 stand/i386: Move to using common devparse()
We no longer need to have to hand-code this for each boot loader since
devparse() handles them all with dv_parsedev().

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37341
2022-11-30 15:30:32 -07:00
Warner Losh
77378d79f1 stand/efi: Move to using common devparse()
We no longer need to have to hand-code this for each boot loader since
devparse() handles them all with dv_parsedev().

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37340
2022-11-30 15:30:32 -07:00
Warner Losh
8337ab69ba stand: For all disk drivers, connect dv_parsedev to disk_parsedev
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37339
2022-11-30 15:30:32 -07:00
Warner Losh
ca0654bad6 stand/zfs: Connect dv_parsedev to zfs_parsedev
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37348
2022-11-30 15:30:32 -07:00
Warner Losh
781ca0afcd stand: Introduce devparse to parse device / path strings
devparse is now the preferred interface to use to parse device
strings or device:/path strings. It parses the passed in string,
mallocs the device's particular devdesc string and returns the
'remainder' of the device:/path for further processing.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37338
2022-11-30 15:30:31 -07:00
Warner Losh
a0aad69f95 stand: Introduce new dv_parsedev routine
Allow device classes to define a parsing routine. Most device classes
already have these routines, but there's much duplication in their
use. Define an interface for a common routine to parse an individual
device. By convetion, files have the form "[device:]/path/to/file"
where device is optional (filled in to be the value of currdev)
and it starts with the dv_name field of the device, with the rest
of the name up to the device (typically a unit number, but disks
add partition inforation, and other devices may do artibtrary
otehr things).

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37337
2022-11-30 15:30:31 -07:00
Warner Losh
ba11bc368e stand: Change zfs_parsedev() API
Change the first argument to zfs_parsedev() to be a pointer to a struct
devdesc *. This now gets filled in with a malloc'd structure that's
returned to the caller that the caller is repsonsible for freeing. Most
nplaces in the tree passed in a malloc'd pointer anyway, and this moves
knowledge of zfs_devdesc more firmly into the zfs.c code.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37336
2022-11-30 15:30:31 -07:00
Warner Losh
17276525fa stand: Change disk_parsedev() API
Change the first argument to disk_parsedev() to be a pointer to a struct
devdesc *. This now gets filled in with a malloc'd structure that's
returned to the caller that the caller is repsonsible for freeing. Most
places in the tree passed in a malloc'd pointer anyway, and this moves
knowledge of disk_devdesc more firmly into the disk.[ch] code.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37335
2022-11-30 15:30:31 -07:00
Alan Somers
34120c0c52 [skip ci] document first appearance of fhlink et al
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D37575
2022-11-30 14:57:56 -07:00
John Baldwin
1f6db5d6b5 vmm: Remove stale comment for vm_rendezvous.
Support for rendezvous outside of a vcpu context (vcpuid of -1) was
removed in commit 949f0f47a4, and the vm, vcpuid argument pair was
replaced by a single struct vcpu pointer in commit d8be3d523d.

Reported by:	andrew
2022-11-30 13:06:46 -08:00
Ed Maste
a8f92d247e Enable -Wdate-time warning
This produces an "expansion of date or time macro is not reproducible"
warning or error upon use of __DATE__ or __TIME__.

Provide NO_WDATE_TIME for ports or 3rd party software to opt out.

This is a recommit of 489d7a8528, which was reverted (by baf8cbcd97)
due to ports build failures.

PR:		267902 [exp-run]
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29580
2022-11-30 13:59:57 -05:00
Warner Losh
983a18021d stand/zlib: Zlib still uses K&R function definitions
So add ${NO_WDEPRECATED_NON_PROTOTYPE} to the CFLAGS of those
files. This can be removed when we import a zlib that's free of this
anachronism.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D37516
2022-11-30 11:08:44 -07:00
Warner Losh
0ecb616196 clang: Define NO_WDEPRECATED_NON_PROTOTYPE for clang 15
Clang 15 enforces function definitions using the C89 form rather than
the K&R form. While not strictly a prototype (which is only for a
declaration), use the name that mirror's clang's warning name. Much code
in contrib still uses K&R function definitions, so invent this for
compiling there.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D37515
2022-11-30 11:08:44 -07:00
Alexander V. Chernikov
f4d3aa7490 netlink: suppress sending NLMSG_ERROR if NLMSG_DONE is already sent
Netlink has a confirmation/error reporting mechanism for the sent
messages. Kernel explicitly acks each messages if requested (NLM_F_ACK)
 or if message processing results in an error.
Similarly, for multipart messages - typically dumps, where each message
 represents a single object like an interface or a route - another
 message, NLMSG_DONE is used to indicate the end of dump and the
 resulting status.
As a result, successfull dump ends with both NLMSG_DONE and NLMSG_ERROR
 messages.
RFC 3549 does not say anything specific about such case.
Linux adopted an optimisation which suppresses NLMSG_ERROR message
 when NLMSG_DONE is already sent. Certain libraries/applications like
 libnl depends on such behavior.

Suppress sending NLMSG_ERROR if NLMSG_DONE is already sent, by
 setting newly-added 'suppress_ack' flag in the writer and checking
 this flag when generating ack.

This change restores libnl compatibility.

Before:
```
~ nl-link-list
Error: Unable to allocate link cache: Message sequence number mismatch
````

After:
```
~ nl-link-list
vtnet0 ether 52:54:00:14:e3:19 <broadcast,multicast,up,running>
lo0 ieee1394 <loopback,multicast,up,running>
```

Reviewed by:	bapt,pauamma
Tested by:	bapt
Differential Revision: https://reviews.freebsd.org/D37565
2022-11-30 13:24:38 +00:00
Philip Paeps
821549a9df OptionalObsoleteFiles.inc: add zoneinfo/America/Ciudad_Juarez
tzdata 2022g and later split America/Ciudad_Juarez from America/Ojinaga.
Ensure this file is removed in builds WITHOUT_ZONEINFO.

MFC after:	1 day
2022-11-30 09:50:26 +08:00
Philip Paeps
cf1ad53510 contrib/tzdata: import tzdata 2022g
Changes: https://github.com/eggert/tz/blob/2022g/NEWS

MFC after:	1 day
2022-11-30 09:36:28 +08:00
Philip Paeps
9f36c6bf1e Import tzdata 2022g 2022-11-30 09:31:56 +08:00
Tom Jones
46d7b45a26 ping: Fix handling of IP packet sizes
Ping reads raw IP packets to parse ICMP responses. When reading the
IP Header Len (IHL) ping was was taking the value from the provided
packet without any validation. This could lead to remotely triggerable
stack corruption.

Validate the IHL against expected and recieved data sizes when reading
from the received packet and when reading any quoted packets from within
the ICMP response.

Approved by:	so
Reviewed by:	markj, asomers
Security:	FreeBSD-SA-22:15.ping
Security:	CVE-2022-23093
Sponsored by:   NetApp, Inc.
Sponsored by:   Klara, Inc.
X-NetApp-PR:    #77
Differential Revision: https://reviews.freebsd.org/D37195
2022-11-29 14:51:50 -08:00
Guilherme Janczak
a6d40b0ad2 libc: remove unneeded sys/types.h include from several synopses
PR:	268028
Reviewed by:	kib
Discussed with:	imp
MFC after:	1 week
2022-11-30 00:45:07 +02:00
Warner Losh
4c4563e32d ofw_net: Use c99 initializers
Update to use c99 initializers, although there's no plans to change
anything that this would make easier...

Sponsored by:		Netflix
Reviewed by:		zlei
Differential Revision:	https://reviews.freebsd.org/D37442
2022-11-29 14:49:06 -07:00