Commit Graph

279782 Commits

Author SHA1 Message Date
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
Bjoern A. Zeeb
4a8e4d1546 net80211: fix IEEE80211_DEBUG_REFCNT builds
Remove the KPI/KBI changes from ieee80211_node.h and always use the
macros to pass in __func__ and __LINE__ to the functions.
The actual implementations are prefixed by "_" rather than suffixed
by "_debug" as they no longer are "debug"-specific.

Some of the select functions were not actually using the passed in
func, line options; however they are calling other functions which
use them.  Directly call the internal implementation in those cases
passing the arguments on.

Use a file-local __debrefcnt_used define to mark the arguments __unused
in cases when we compile without IEEE80211_DEBUG_REFCNT and hope the
toolchain is intelligent enough to not pass them at all in those cases.

Also _ieee80211_free_node() now has a conflict so make the previous
_ieee80211_free_node() the new __ieee80211_free_node().

Add IEEE80211_DEBUG_REFCNT to the NOTES file on amd64 to keep exercising
the option.

Sponsored by:	The FreeBSD Foundation
X-MFC:		never
Discussed on:	freebsd-wireless
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D37529
2022-11-29 21:20:37 +00:00
Ed Maste
67d2aaf078 csh: install hard link with same mode as target
Previously when using NO_ROOT we recorded METALOG entries for the /.cshrc
hard link with a different file mode than the link target, which is not
permitted.

We cannot just set LINKMODE here as it would also apply to the hard link
for the tcsh binary.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37499
2022-11-29 16:04:05 -05:00
Warner Losh
e59fa9b2e7 newbus: Comment style nit
Sponsored by:		Netflix
2022-11-29 13:11:24 -07:00
Warner Losh
b60164c9f4 stand/ofw: Use strpbrk instead of two strchrs
No need to call strchr twice, when one call to strpbrk will do the
job.. Test booted with qemu-powerpc + mac99 successfully.
Minor style(9) tweaks as well.

Sponsored by:		Netflix
2022-11-29 13:10:16 -07:00
Roger Pau Monné
bc9a5b0497 xen/acpi: only evaluate Processor objects matching online CPUs
Current Xen Processor driver will evaluate any Processor object on the
ACPI tables regardless of whether the processor is online or not.
Avoid doing so for processors that are not online, as evaluating
methods of processors that are not online could lead to accesses to
invalid memory, and in any case the data that the driver fetches from
the Processor ACPI object only makes sense for processors that are
online.

Note the CPU related data fetched from Xen using XENPF_get_cpuinfo
hypercall could be cached, I leave that as a future optimization.

Sponsored by: Citrix Systems R&D
Fixes: b93f47eaee ('xen/acpi: upload Cx and Px data to Xen')
2022-11-29 16:36:34 +01:00
Jessica Clarke
bad602850e bsdinstall: Fix local_unbound option default on revisit
The variable used for the checklist's default value needs to correspond
to the rc.conf variable as that's what's being parsed to determine them.
In the case of local_unbound it's missing the _enable suffix and thus
always defaults to off on revisit.

Fixes:	58eb9abb31 ("Add a line to the post-installation configuration dialog to enable the local_unbound service.")
2022-11-29 03:33:47 +00:00
Jessica Clarke
91985bc5ad bsdinstall: Fix issues parsing rc.conf.services on revisit
There are a few issues here, some of which are hiding others. The first
is that we don't use double quotes around the command substitution so
every word in the conf file is treated as a separate argument to eval,
resulting in spaces being used in place of newlines and thus comments in
the file commenting out the rest of the file, not just to the end of
their line. In particular, we insert one comment just before the dumpdev
entry (the final one in the file) and so we never see dumpdev as set,
and thus set a default value of on for the menu.

The second issue is that, for dumpdev, it takes a value of AUTO not YES
when set, but we don't replace this with on when eval'ing, so then end
up giving AUTO to bsddialog which is interpreted the same as off (which
seems to match GPL dialog). Thus handle AUTO like YES otherwise it will
always appear as unchecked on revisit.

The final issue is that our case-insensitive YES/NO (and now AUTO)
replacements have no word boundaries around them so match the middle of
words too. As it happens this doesn't matter in practice at the moment,
but it could in future; currently the only effect is that it rewrites
moused_nondefault_enable to moused_offndefault_enable, but since this
variable is never read, only written based on moused(_enable) this is
harmless, but we should fix it in case a service comes along in future
that does get affected by it.
2022-11-29 03:33:47 +00:00
Jessica Clarke
1843da3edb bsdinstall: Fix ntpd_sync_on_start service option
This installer option is currently totally useless, as it ends up
creating an ntpd_sync_on_start_enable="YES" entry in rc.conf, not an
ntpd_sync_on_start="YES" entry, as is the correct name. This can also be
noticed by revisiting the services menu, which parses the previously
written rc.conf.services file to set variables governing the default
menu entry values so that selecting OK regenerates the same file, as the
menu entry will use the correct variable name and thus think the entry
was not selected last time, defaulting back to off and losing the
setting.

Thus, add a special case in the loop for this option. The only other
entry that doesn't follow the *_enable pattern is dumpdev (even moused
does, it just also sets a second variable), but that also deviates in
terms of being explicitly set either way and using AUTO rather than YES,
hence why ntpd_sync_on_start follows a different pattern here and is
special-cased rather than introducing a whole new variable that governs
behaviour outside the loop.

Fixes:	c153a35bfd ("bsdinstall: replace ntpdate by ntpd_sync_on_start")
2022-11-29 03:33:47 +00:00
John Baldwin
bc92880072 bhyve: Avoid passing a possible garbage pointer to free().
All of the error paths in pci_vtcon_sock_add free the sock pointer.
However, sock is not initialized until part way through the function.
An early error would pass stack garbage to free().

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37491
2022-11-28 17:10:30 -08:00
John Baldwin
32b21dd271 bhyve: Appease warning about a potentially unaligned pointer.
When initializing the device model for a PCI pass through device that
uses MSI-X, bhyve reads the MSI-X capability from the real device to
save a copy in the emulated PCI config space.  It also saves a copy in
a local struct msixcap on the stack.  Since struct msixcap is packed,
GCC complains that casting a pointer to the struct to a uint32_t
pointer may result in an unaligned pointer.

This path is not performance critical, so to appease the compiler,
simply change the pointer to a char * and use memcpy to copy the 4
bytes read in each iteration of the loop.

Reviewed by:	corvink, bz, markj
Differential Revision:	https://reviews.freebsd.org/D37490
2022-11-28 17:10:07 -08:00
John Baldwin
15cebe3d63 bhyve: Fix sign compare warnings in the NVMe device model.
Reviewed by:	corvink
Differential Revision:	https://reviews.freebsd.org/D37489
2022-11-28 17:09:44 -08:00
John Baldwin
5d805962ca bhyve: Avoid unlikely truncation of the blockif ident strings.
The ident string for NVMe and VirtIO block deivces do not contain the
bus, and the various fields can potentially use up to three characters
when printed as unsigned values (full range of uint8_t) even if not
likely in practice.

Reviewed by:	corvink, chuck
Differential Revision:	https://reviews.freebsd.org/D37488
2022-11-28 17:09:15 -08:00
John Baldwin
47d6116239 bhyve: Clear lid to 0 for internal device errors for NVMe AENs.
Reported by:	GCC
Reviewed by:	corvink, chuck, imp, markj
Differential Revision:	https://reviews.freebsd.org/D37487
2022-11-28 17:08:57 -08:00
John Baldwin
1d9e8a9e60 bhyve: Don't leak uninitialized bits in NVMe completion statuses.
In some cases, some bits in the 16-bit status word were never
initialized.

Reported by:	GCC
Reviewed by:	corvink, chuck, markj
Differential Revision:	https://reviews.freebsd.org/D37486
2022-11-28 17:08:36 -08:00
John Baldwin
e7cd5ffff8 bhyve: Fix sign compare warnings in the e1000 device model.
Adding a bare constant to a uint16_t promotes to a signed int which
triggers these warnings.  Changing the constant to be explicitly
unsigned instead promotes the expression to unsigned int.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37485
2022-11-28 17:08:09 -08:00
John Baldwin
0acf696151 bhyve basl: Use GCC pragmas.
These work with both clang and GCC.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37484
2022-11-28 17:07:39 -08:00
Justin Hibbits
82abe70fe9 dpaa: Don't assume the MDIO is on the same fman as the MAC
The P5040 has the MDIO for FMAN2 on FMAN1 for some reason.  Instead of
trying to manually find the MDIO, use a real xref.
2022-11-28 17:03:15 -05:00
Bjoern A. Zeeb
69cc163001 LinuxKPI: 802.11: minor header updates
- add comments for enum values constantly looked up, and another one to
  a net80211 equivalent (should possibly re-define those in the future?)
- add another nl80211_sta_info flag
- add enum environment_cap used in cfg80211.h in the future.

MFC after:	3 days
2022-11-28 21:21:06 +00:00
Bjoern A. Zeeb
5504bd59a3 LinuxKPI: SKB update
- skb_reset_tail_pointer(): we do not do offsets so do a plain reset
- skb_add_rx_frag(): adjust data_len to keep track of the frag
- based on that implement skb_is_nonlinear() and skb_linearize()
- implement build_skb() and adjust linuxkpi_kfree_skb() and ddb macro.

Sponsored by:	The FreeBSD Foundation (partially)
MFC after:	3 days
2022-11-28 20:54:57 +00:00
Kristof Provost
7a6bcfb44d pf tests: test that reassembly is or is not performed as expected
We can now tell scrub rules to not reassemble packets. Test that this
affects packets being passed or dropped as expected.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-11-28 20:19:12 +01:00
Kristof Provost
88e858e57c pf: drop support for fragment crop|drop-ovl
We removed the code for these modes back in 2015, but converted such
configurations to 'scrub fragment reassemble'. It's been long enough,
drop the backwards compatibility glue too.

Reviewed by:	mjg
MFC after:	never
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D37460
2022-11-28 20:19:12 +01:00
Kristof Provost
57e047e51c pf: allow scrub rules without fragment reassemble
scrub rules have defaulted to handling fragments for a long time, but
since we removed "fragment crop" and "fragment drop-ovl" in 64b3b4d611
this has become less obvious and more expensive ("reassemble" being the
more expensive option, even if it's the one the vast majority of users
should be using).

Extend the 'scrub' syntax to allow fragment reassembly to be disabled,
while retaining the other scrub behaviour (e.g. TTL changes, random-id,
..) using 'scrub fragment no reassemble'.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D37459
2022-11-28 20:19:05 +01:00
Bjoern A. Zeeb
ce9f36610e LinuxKPI: SKB: implement skb_peek()
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-11-28 18:47:08 +00:00
Bjoern A. Zeeb
23c73dbae7 LinuxKPI: iwlwifi: rtw88: rtw89: remove budget argument from netif_napi_add()
In preparation for future updates remove the budget argument from the
netif_napi_add() in drivers and update LinuxKPI to reflect that it is
gone and only set it internally.  This required changes to the currently
committed wireless drivers based on LinuxKPI (iwlwifi, rtw88, rtw89).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-11-28 17:30:40 +00:00
Bjoern A. Zeeb
1b91eba37b LinuxKPI: ethtool.h add more definitions
While we do not currently use ethtool, add the definitions to avoid
other longer-term maintenance problems with drivers.

Also migrate ETH_GSTRING_LEN into here from if_ether.h as it seems this
is where it belongs.

MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D37214
2022-11-28 17:25:58 +00:00
Bjoern A. Zeeb
0fce2dc157 LinuxKPI,lindebugfs: add u8 base type and blob support
Add debugfs_create_u8() based on other already present implementations.
Add a read-only implementation for debugfs_create_blob().

Both are needed for iwlwifi debugfs support.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
OKed by:	jfree (earlier version)
Differential Revision: https://reviews.freebsd.org/D37090
2022-11-28 17:21:50 +00:00
Bjoern A. Zeeb
af393426b3 LinuxKPI: add a no-op generic_file_llseek()
This is needed for debugfs implementations in drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
OKed by:	jfree
Differential Revision: https://reviews.freebsd.org/D37092
2022-11-28 17:14:10 +00:00
Bjoern A. Zeeb
5f2f582ccc LinuxKPI: pci.h add more MSI related constanst and pci_is_enabled()
Add more MSI related constansts defined to our native defines and
pci_is_enabled().  All are needed for another wireless driver.

MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D37225
2022-11-28 17:11:47 +00:00
Bjoern A. Zeeb
4495b4eb51 rtw88: correct SRCS+= in Makefile
Properly spell a SRCS+= for an optional file (this is why it stayed
unnoticed so far).

MFC after:	3 days
2022-11-28 15:48:44 +00:00
Eugene Grosbein
1cbe5012cf pw(8): fix combination of modes -N and -w random
The command "pw usermod nobody -Nw random" (or useradd)
generates random password and prints it in encrypted form
but skips choosen random string that makes not much sense
and contradicts the manual page pw.8

Fix it by showing random password in plain text with -N and
without it equally. Add yet another example of how to generate
pw-style random password.

MFC after:	2 weeks
2022-11-28 21:22:39 +07:00
Cy Schubert
0078721898 sqlite3: Vendor import of sqlite3 3.40.0
Changes at https://www.sqlite.org/releaselog/3_40_0.html

Obtained from:  https://www.sqlite.org/2022/sqlite-autoconf-3400000.tar.gz

Merge commit 'ac50343d44f8dff1efe667b4713de4b1351a19e1' into main
2022-11-28 06:08:46 -08:00
Oskar Holmlund
74a8d66c28 AM335x: Fix compatible name
In the DTS import from Linux 5.14 the compatible strings has changed for
the driver am335x_ecap.c && am335x_ehrpwm.c

Approved by: manu (mentor)
Differential revision: https://reviews.freebsd.org/D37502
2022-11-28 08:13:18 +01:00