]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
18 months agoOptionalObsoleteFiles.inc: add zoneinfo/America/Ciudad_Juarez
Philip Paeps [Wed, 30 Nov 2022 01:47:03 +0000 (09:47 +0800)]
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

18 months agocontrib/tzdata: import tzdata 2022g
Philip Paeps [Wed, 30 Nov 2022 01:36:28 +0000 (09:36 +0800)]
contrib/tzdata: import tzdata 2022g

Changes: https://github.com/eggert/tz/blob/2022g/NEWS

MFC after: 1 day

18 months agoImport tzdata 2022g
Philip Paeps [Wed, 30 Nov 2022 01:31:56 +0000 (09:31 +0800)]
Import tzdata 2022g

18 months agoping: Fix handling of IP packet sizes
Tom Jones [Thu, 17 Nov 2022 10:31:38 +0000 (10:31 +0000)]
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

18 months agolibc: remove unneeded sys/types.h include from several synopses
Guilherme Janczak [Mon, 28 Nov 2022 22:57:37 +0000 (00:57 +0200)]
libc: remove unneeded sys/types.h include from several synopses

PR: 268028
Reviewed by: kib
Discussed with: imp
MFC after: 1 week

18 months agoofw_net: Use c99 initializers
Warner Losh [Tue, 29 Nov 2022 21:47:02 +0000 (14:47 -0700)]
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

18 months agonet80211: fix IEEE80211_DEBUG_REFCNT builds
Bjoern A. Zeeb [Tue, 29 Nov 2022 18:21:05 +0000 (18:21 +0000)]
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

18 months agocsh: install hard link with same mode as target
Ed Maste [Wed, 23 Nov 2022 17:14:18 +0000 (12:14 -0500)]
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

18 months agonewbus: Comment style nit
Warner Losh [Tue, 29 Nov 2022 20:04:39 +0000 (13:04 -0700)]
newbus: Comment style nit

Sponsored by: Netflix

18 months agostand/ofw: Use strpbrk instead of two strchrs
Warner Losh [Tue, 29 Nov 2022 20:02:40 +0000 (13:02 -0700)]
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

18 months agoxen/acpi: only evaluate Processor objects matching online CPUs
Roger Pau Monné [Tue, 29 Nov 2022 15:21:51 +0000 (16:21 +0100)]
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: b93f47eaeef7 ('xen/acpi: upload Cx and Px data to Xen')
18 months agobsdinstall: Fix local_unbound option default on revisit
Jessica Clarke [Tue, 29 Nov 2022 03:09:51 +0000 (03:09 +0000)]
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: 58eb9abb3157 ("Add a line to the post-installation configuration dialog to enable the local_unbound service.")

18 months agobsdinstall: Fix issues parsing rc.conf.services on revisit
Jessica Clarke [Tue, 29 Nov 2022 02:56:25 +0000 (02:56 +0000)]
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.

18 months agobsdinstall: Fix ntpd_sync_on_start service option
Jessica Clarke [Tue, 29 Nov 2022 00:57:38 +0000 (00:57 +0000)]
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: c153a35bfd71 ("bsdinstall: replace ntpdate by ntpd_sync_on_start")

18 months agobhyve: Avoid passing a possible garbage pointer to free().
John Baldwin [Tue, 29 Nov 2022 01:10:30 +0000 (17:10 -0800)]
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

18 months agobhyve: Appease warning about a potentially unaligned pointer.
John Baldwin [Tue, 29 Nov 2022 01:10:07 +0000 (17:10 -0800)]
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

18 months agobhyve: Fix sign compare warnings in the NVMe device model.
John Baldwin [Tue, 29 Nov 2022 01:09:44 +0000 (17:09 -0800)]
bhyve: Fix sign compare warnings in the NVMe device model.

Reviewed by: corvink
Differential Revision: https://reviews.freebsd.org/D37489

18 months agobhyve: Avoid unlikely truncation of the blockif ident strings.
John Baldwin [Tue, 29 Nov 2022 01:09:15 +0000 (17:09 -0800)]
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

18 months agobhyve: Clear lid to 0 for internal device errors for NVMe AENs.
John Baldwin [Tue, 29 Nov 2022 01:08:57 +0000 (17:08 -0800)]
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

18 months agobhyve: Don't leak uninitialized bits in NVMe completion statuses.
John Baldwin [Tue, 29 Nov 2022 01:08:36 +0000 (17:08 -0800)]
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

18 months agobhyve: Fix sign compare warnings in the e1000 device model.
John Baldwin [Tue, 29 Nov 2022 01:08:09 +0000 (17:08 -0800)]
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

18 months agobhyve basl: Use GCC pragmas.
John Baldwin [Tue, 29 Nov 2022 01:07:39 +0000 (17:07 -0800)]
bhyve basl: Use GCC pragmas.

These work with both clang and GCC.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37484

18 months agodpaa: Don't assume the MDIO is on the same fman as the MAC
Justin Hibbits [Mon, 28 Nov 2022 22:03:15 +0000 (17:03 -0500)]
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.

18 months agoLinuxKPI: 802.11: minor header updates
Bjoern A. Zeeb [Mon, 28 Nov 2022 21:21:06 +0000 (21:21 +0000)]
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

18 months agoLinuxKPI: SKB update
Bjoern A. Zeeb [Mon, 28 Nov 2022 20:54:57 +0000 (20:54 +0000)]
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

18 months agopf tests: test that reassembly is or is not performed as expected
Kristof Provost [Thu, 24 Nov 2022 09:25:40 +0000 (10:25 +0100)]
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")

18 months agopf: drop support for fragment crop|drop-ovl
Kristof Provost [Tue, 22 Nov 2022 13:43:59 +0000 (14:43 +0100)]
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

18 months agopf: allow scrub rules without fragment reassemble
Kristof Provost [Tue, 22 Nov 2022 13:23:27 +0000 (14:23 +0100)]
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

18 months agoLinuxKPI: SKB: implement skb_peek()
Bjoern A. Zeeb [Mon, 28 Nov 2022 18:47:08 +0000 (18:47 +0000)]
LinuxKPI: SKB: implement skb_peek()

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

18 months agoLinuxKPI: iwlwifi: rtw88: rtw89: remove budget argument from netif_napi_add()
Bjoern A. Zeeb [Mon, 28 Nov 2022 15:12:58 +0000 (15:12 +0000)]
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

18 months agoLinuxKPI: ethtool.h add more definitions
Bjoern A. Zeeb [Sun, 30 Oct 2022 17:07:49 +0000 (17:07 +0000)]
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

18 months agoLinuxKPI,lindebugfs: add u8 base type and blob support
Bjoern A. Zeeb [Sat, 22 Oct 2022 18:12:16 +0000 (18:12 +0000)]
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

18 months agoLinuxKPI: add a no-op generic_file_llseek()
Bjoern A. Zeeb [Sat, 22 Oct 2022 20:27:42 +0000 (20:27 +0000)]
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

18 months agoLinuxKPI: pci.h add more MSI related constanst and pci_is_enabled()
Bjoern A. Zeeb [Mon, 31 Oct 2022 22:14:10 +0000 (22:14 +0000)]
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

18 months agortw88: correct SRCS+= in Makefile
Bjoern A. Zeeb [Mon, 28 Nov 2022 15:48:44 +0000 (15:48 +0000)]
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

18 months agopw(8): fix combination of modes -N and -w random
Eugene Grosbein [Mon, 28 Nov 2022 14:22:39 +0000 (21:22 +0700)]
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

18 months agosqlite3: Vendor import of sqlite3 3.40.0
Cy Schubert [Mon, 28 Nov 2022 14:08:46 +0000 (06:08 -0800)]
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

18 months agoAM335x: Fix compatible name
Oskar Holmlund [Mon, 28 Nov 2022 07:13:18 +0000 (08:13 +0100)]
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

18 months agosqlite3: Vendor import of sqlite3 3.40.0
Cy Schubert [Mon, 28 Nov 2022 00:03:49 +0000 (16:03 -0800)]
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

18 months agoRevert "Remove UPDATING entries from old branches."
Alexander Leidinger [Sun, 27 Nov 2022 21:10:09 +0000 (22:10 +0100)]
Revert "Remove UPDATING entries from old branches."

This reverts commit ff0c7816db696d31adc437134dcad45a70ad5889 as more
history than just from branch N-1 to N is requested/needed by some
downstram consumers.

Requested by: imp

18 months agoofw: Remove old K&R function declaration
Warner Losh [Sun, 27 Nov 2022 20:34:33 +0000 (13:34 -0700)]
ofw: Remove old K&R function declaration

We don't need to forward declar strchr anymore.

Sponsored by: Netflix

18 months agoofw: Cast function pointer to proper type
Warner Losh [Sun, 27 Nov 2022 20:23:28 +0000 (13:23 -0700)]
ofw: Cast function pointer to proper type

clang 15 insists that we call entry() via a function prototype. Rather
than copping out and using (...), cast it to the same prototype that's
used elsewhere (with tweaks to pointers to make them fit into that
prototype). No functional change.

Sponsored by: Netflix

18 months agoashldi3: Use C89-style function definition
Warner Losh [Sun, 27 Nov 2022 20:23:25 +0000 (13:23 -0700)]
ashldi3: Use C89-style function definition

Use the 'prototype' style function definition. No functional change.

Sponsored by: Netflix

18 months agomd5: Use c89 function definitions
Warner Losh [Sun, 27 Nov 2022 20:22:31 +0000 (13:22 -0700)]
md5: Use c89 function definitions

Use the c89 function definitions rather than the old K&R definitions.

Sponsored by: Netflix

18 months agorelease/oci: add Oracle Cloud image builder
Dave Cottlehuber [Sun, 27 Nov 2022 11:12:02 +0000 (11:12 +0000)]
release/oci: add Oracle Cloud image builder

Provides an OCI (Oracle Cloud Infrastructure) release target for
Oracle's KVM-based VM implementation. Tested using 13.1-RELEASE,
primarily on Ampere CPU on A1.Flex VM shapes, but also works on
amd64 shapes.

- supports cloud-init and custom scripts
- provides a freebsd@ sudo-enabled user
- root user disabled over ssh & console

Approved by:    gjb
Reviewed by:    emaste
MFS after:      1 week
Sponsored by:   The FreeBSD Foundation
Sponsored by:   SkunkWerks, GmbH
Technical assistance from:  Oracle
Differential Revision: https://reviews.freebsd.org/D34746

18 months agoheimdal: Check return code from _hdb_fetch_kvno()
Cy Schubert [Sat, 26 Nov 2022 20:18:03 +0000 (12:18 -0800)]
heimdal: Check return code from _hdb_fetch_kvno()

A malformed principal will cause kadmind to segfault. The PR
addresses only when chpass is requested but delete is also affected.
Fix both.

PR: 268002
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days

18 months agoheimdal: Add missing iprop error checks.
Cy Schubert [Sat, 26 Nov 2022 18:19:55 +0000 (10:19 -0800)]
heimdal: Add missing iprop error checks.

Inspired by upstream 9d6dd21256f87988605fa75172be9cc92535064c.

Obtained from: Heimdal 9d6dd21256f87988605fa75172be9cc92535064c
MFC after: 3 days

18 months agoheimdal: Add missing kadmind error checks
Cy Schubert [Sat, 26 Nov 2022 17:48:31 +0000 (09:48 -0800)]
heimdal: Add missing kadmind error checks

Inspired by: Heimdal commmit 1b213c1082be4ef5a1c23928d614c762f837dbe7
MFC after: 3 days

18 months agoheimdal: Add missing kadm5 error checks
Cy Schubert [Sat, 26 Nov 2022 17:06:09 +0000 (09:06 -0800)]
heimdal: Add missing kadm5 error checks

Obtained from: Heimdal commit 4a0e01f9edabe36d0f2cab188078dd29fa5aaf02
MFC after: 3 days

18 months agoheimdal: Add missing kadm5 error checks
Cy Schubert [Sat, 26 Nov 2022 16:48:51 +0000 (08:48 -0800)]
heimdal: Add missing kadm5 error checks

Generally obtained from upstream 655c057769f56bd8cdb7d16e93f1e7a7cb260342.

PR: 267944, 267972
Obtained from: Heimdal commit 655c057769f56bd8cdb7d16e93f1e7a7cb260342
MFC after: 3 days

18 months agoheimdal: Fix uninitialized pointer dereference
Cy Schubert [Fri, 25 Nov 2022 23:29:14 +0000 (15:29 -0800)]
heimdal: Fix uninitialized pointer dereference

krb5_ret_preincipal() returns a non-zero return code when
a garbage principal is passed to it. Unfortunately ret_principal_ent()
does not check the return code, with garbage pointing to what would
have been the principal. This results in a segfault when free() is
called.

PR: 267944, 267972
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days

18 months agodpaa: Don't probe disabled devices
Justin Hibbits [Sun, 27 Nov 2022 00:45:37 +0000 (19:45 -0500)]
dpaa: Don't probe disabled devices

Probing disabled devices just adds noise.

18 months agodpaa: Use BUS_PASS_SUPPORTDEV for pqmdio
Justin Hibbits [Sat, 26 Nov 2022 16:32:24 +0000 (11:32 -0500)]
dpaa: Use BUS_PASS_SUPPORTDEV for pqmdio

BUS_PASS_SUPPORTDEV is semantically better than BUS_PASS_RESOURCE, since
it's a support device for dtsec, so only needs probed before dtsec, not
before interrupts.

Suggested by: manu

18 months agodpaa: Probe and attach pqmdio at BUS_PASS_RESOURCE
Justin Hibbits [Sat, 26 Nov 2022 16:28:09 +0000 (11:28 -0500)]
dpaa: Probe and attach pqmdio at BUS_PASS_RESOURCE

Avoid the fragile nature of depending on ordering of the devices in the
FDT by forcing the MDIO driver to precede the DTSEC driver.

18 months agodpaa: Account for MDIO device not being found
Justin Hibbits [Sat, 26 Nov 2022 15:38:13 +0000 (10:38 -0500)]
dpaa: Account for MDIO device not being found

It's possible the MDIO device hasn't been and attached, or is incorrect
in the device tree so can't probe and attach.  In this case,
ofw_bus_find_child_device_by_phandle() will fail, and return NULL.
Return an error from find_mdio() here to prevent the MAC from attaching,
rather than worry about a NULL pointer dereference later on when
accessing the PHY.

18 months agopkgbase: report errors via metalog reader exit status
Ed Maste [Wed, 23 Nov 2022 21:40:22 +0000 (16:40 -0500)]
pkgbase: report errors via metalog reader exit status

Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37482

18 months agoRemove UPDATING entries from old branches.
Alexander Leidinger [Fri, 25 Nov 2022 09:17:14 +0000 (10:17 +0100)]
Remove UPDATING entries from old branches.

We only support updates from major version N to N+1:
stable/13 was branched on 20210122, remove all old entries from stable/10
branch point in 2013 to 20210122.

18 months agoflua: chown(2) binding, fix bad copy/paste
Baptiste Daroussin [Fri, 25 Nov 2022 08:05:40 +0000 (09:05 +0100)]
flua: chown(2) binding, fix bad copy/paste

18 months agoflua: add a chown(2) binding
Baptiste Daroussin [Thu, 24 Nov 2022 08:16:05 +0000 (09:16 +0100)]
flua: add a chown(2) binding

The main difference with the chown in luaposix, is that it checks
and reports if a user or a group do exist when a string is passed
as arguments

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D37479

18 months agonlm: only access refcounts using dedicated primitives
Mateusz Guzik [Thu, 24 Nov 2022 19:25:25 +0000 (19:25 +0000)]
nlm: only access refcounts using dedicated primitives

Sponsored by: Rubicon Communications, LLC ("Netgate")

18 months agobpf: only access refcounts using dedicated primitives
Mateusz Guzik [Thu, 24 Nov 2022 10:33:37 +0000 (10:33 +0000)]
bpf: only access refcounts using dedicated primitives

Sponsored by: Rubicon Communications, LLC ("Netgate")

18 months agoheimdal: Handle other types of garbage data
Cy Schubert [Thu, 24 Nov 2022 15:07:43 +0000 (07:07 -0800)]
heimdal: Handle other types of garbage data

In addition to garbage realm data, also handle garbage dbname, acl_file,
stash_file, and invalid bitmask garbage data.

PR: 267912
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days

18 months agoheimdal: Fix NULL dereference when mangled realm message
Cy Schubert [Thu, 24 Nov 2022 14:22:13 +0000 (06:22 -0800)]
heimdal: Fix NULL dereference when mangled realm message

Fix a NULL dereference in _kadm5_s_init_context() when the client
sends a mangled realm message.

PR: 267912
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days

18 months agoheimdal: The version string must always contain a terminating NUL
Cy Schubert [Mon, 21 Nov 2022 15:33:08 +0000 (07:33 -0800)]
heimdal: The version string must always contain a terminating NUL

Should the sender send a string without a terminating NUL, ensure that
the NUL terminates the string regardless.

And while at it only process the version string when bytes are returned.

PR: 267884
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D37471

18 months agoClarify what's normally not required.
Pau Amma [Wed, 23 Nov 2022 22:00:02 +0000 (22:00 +0000)]
Clarify what's normally not required.

Reported by: karels

Reviewed by: carlavilla, karels (informally)

Approved by: carlavilla (mentor)

Differential Revision: https://reviews.freebsd.org/D37483

18 months agopam.d: install hard link with same mode as target
Ed Maste [Wed, 23 Nov 2022 15:34:58 +0000 (10:34 -0500)]
pam.d: install hard link with same mode as target

Previously when using NO_ROOT we recorded a METALOG entry for the
pam.d/ftp hard link with a different file mode than the link target
pam.d/ftpd, which is not permitted.

This change is similar to 1dbb9994d4dd for .profile

Sponsored by: The FreeBSD Foundation

18 months ago<type_traits>: Avoid instantiating a pointer type in std::decay<>.
John Baldwin [Thu, 24 Nov 2022 00:10:05 +0000 (16:10 -0800)]
<type_traits>: Avoid instantiating a pointer type in std::decay<>.

GCC expands the pointer type in this conditional expression even for
template types _Up that are not arrays.  This raises an error when
std::decay<> is used with reference types (as is done in LLVM's
sources).  Using add_pointer<> causes GCC to only instantiate a
pointer type for array types.

A similar change to this commit (albeit reworked due to upstream
changes) has been merged to libc++ in commit
26068c6e60324ed866a1ca2afb5cb5eb0aaf015b.

In file included from /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/__compare/ordering.h:13,
                 from /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/__compare/common_comparison_category.h:12,
                 from /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/tuple:168,
                 from /usr/src/contrib/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h:20,
                 from /usr/src/contrib/llvm-project/llvm/include/llvm/ADT/DenseMap.h:17,
                 from /usr/src/contrib/llvm-project/llvm/lib/Transforms/Scalar/GVNHoist.cpp:36:
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/type_traits: In instantiation of 'struct std::__1::__decay<llvm::CHIArg&, true>':
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/type_traits:1591:89:   required from 'struct std::__1::decay<llvm::CHIArg&&>'
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/__utility/pair.h:132:16:   required by substitution of 'template<class _Tuple, typename std::__1::enable_if<typename std::__1::conditional<(std::__1::__tuple_like_with_size<_Tuple, 2, typename std::__1::__uncvref<_Tp>::type>::value && (! std::__1::is_same<typename std::__1::decay<_Tp>::type, std::__1::pair<llvm::BasicBlock*, llvm::SmallVector<llvm::CHIArg, 2> > >::value)), std::__1::pair<llvm::BasicBlock*, llvm::SmallVector<llvm::CHIArg, 2> >::_CheckTupleLikeConstructor, std::__1::__check_tuple_constructor_fail>::type::__enable_implicit<_Tuple>(), void>::type* <anonymous> > constexpr std::__1::pair<llvm::BasicBlock*, llvm::SmallVector<llvm::CHIArg, 2> >::pair(_Tuple&&) [with _Tuple = llvm::CHIArg&&; typename std::__1::enable_if<typename std::__1::conditional<(std::__1::__tuple_like_with_size<_Tuple, 2, typename std::__1::__uncvref<_Tp>::type>::value && (! std::__1::is_same<typename std::__1::decay<_Tp>::type, std::__1::pair<llvm::BasicBlock*, llvm::SmallVector<llvm::CHIArg, 2> > >::value)), std::__1::pair<llvm::BasicBlock*, llvm::SmallVector<llvm::CHIArg, 2> >::_CheckTupleLikeConstructor, std::__1::__check_tuple_constructor_fail>::type::__enable_implicit<_Tuple>(), void>::type* <anonymous> = <missing>]'
/usr/src/contrib/llvm-project/llvm/lib/Transforms/Scalar/GVNHoist.cpp:892:51:   required from here
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/type_traits:1582:30: error: forming pointer to reference type 'std::__1::remove_extent<llvm::CHIArg&>::type' {aka 'llvm::CHIArg&'}
 1582 |                      >::type type;
      |                              ^~~~

Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D36898

18 months agoFix igor and mandoc -T lint low-hanging fruit in hier(7)
Pau Amma [Wed, 23 Nov 2022 01:41:04 +0000 (01:41 +0000)]
Fix igor and mandoc -T lint low-hanging fruit in hier(7)

Reviewed by: danfe, gjb (mentor)

Approved by: gjb (mentor)

MFC after: 3 days

Differential Revision: https://reviews.freebsd.org/D37473

18 months agoRemove disused /cdrom toplevel dir from hier(7).
Pau Amma [Tue, 22 Nov 2022 22:56:46 +0000 (22:56 +0000)]
Remove disused /cdrom toplevel dir from hier(7).

Reviewed by: gjb

Approved by: gjb (mentor)

MFC after: 3 days

Differential Revision: https://reviews.freebsd.org/D37472

18 months agodwatch: install hard links with same mode as target
Ed Maste [Wed, 23 Nov 2022 15:44:41 +0000 (10:44 -0500)]
dwatch: install hard links with same mode as target

Previoulsy when using NO_ROOT we recorded METALOG entries for dwatch
hard links with different file modes than their link targets, which is
not permitted.

Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37477

18 months agosh: install hard link with same mode as target
Ed Maste [Wed, 23 Nov 2022 15:20:49 +0000 (10:20 -0500)]
sh: install hard link with same mode as target

Previously when using NO_ROOT we recorded a METALOG entry for the
/.profile hard link with a different mode than the link target, which is
not permitted.

Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37476

18 months agomakefs: Ignore some sign comparison warnings from GCC.
John Baldwin [Wed, 23 Nov 2022 18:38:29 +0000 (10:38 -0800)]
makefs: Ignore some sign comparison warnings from GCC.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D37470

18 months agomakefs zfs: Disable -Wunused-function for GCC as well.
John Baldwin [Wed, 23 Nov 2022 18:35:30 +0000 (10:35 -0800)]
makefs zfs: Disable -Wunused-function for GCC as well.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D37469

18 months agomakefs zfs: Use signed values for both results of ?:.
John Baldwin [Wed, 23 Nov 2022 18:35:14 +0000 (10:35 -0800)]
makefs zfs: Use signed values for both results of ?:.

Reported by: GCC -Wsign-compare
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D37468

18 months agocompat32: retire now-unused MIPS support
Ed Maste [Wed, 23 Nov 2022 14:30:49 +0000 (09:30 -0500)]
compat32: retire now-unused MIPS support

This reverts commit a6d20bbaa2f4bb3684d2c396ef1f1411c8fb8499.

18 months agovmm: don't lock a mtx in the icr_low write handler
Corvin Köhne [Mon, 21 Nov 2022 14:00:04 +0000 (15:00 +0100)]
vmm: don't lock a mtx in the icr_low write handler

x2apic accesses are handled by a wrmsr exit. This handler is called in a
critical section. So, we can't lock a mtx in the icr_low handler.

Reported by: kp, pho
Tested by: kp, pho
Approved by: manu (mentor)
Fixes: c0f35dbf19c3c8825bd2b321d8efd582807d1940 vmm: Use a cpuset_t for vCPUs waiting for STARTUP IPIs.
MFC after: 1 week
MFC with: c0f35dbf19c3c8825bd2b321d8efd582807d1940
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37452

18 months agogitignore: whack dead architectures
Mateusz Guzik [Wed, 23 Nov 2022 01:18:03 +0000 (01:18 +0000)]
gitignore: whack dead architectures

18 months agotftpd: Disable -Wformat-nonliteral for GCC.
John Baldwin [Tue, 22 Nov 2022 19:12:06 +0000 (11:12 -0800)]
tftpd: Disable -Wformat-nonliteral for GCC.

GCC warns about the non-literal format string passed to strftime().  A
warning here seems a bit odd as strftime() does not take varargs so
there is not a risk of missing args.

18 months agosystat: Fix a bunch of use after frees in fetch_ifstat().
John Baldwin [Tue, 22 Nov 2022 19:11:42 +0000 (11:11 -0800)]
systat: Fix a bunch of use after frees in fetch_ifstat().

I think this was probably just a typo.  initifstat() continues around
a similar loop if the mib data fails to fetch, and fetch_ifstat() was
already using a FOREACH_SAFE loop here so expected to keep going.
Calling clearifstat() from the fetch routine also seems wrong, and the
sort_interface_list() call triggered by the existing needsort = 1 will
itself set needclear to trigger a future clearifstat().

Reported by: GCC 12 -Wuse-after-free
Differential Revision: https://reviews.freebsd.org/D36823

18 months agoiwlwifi: fix hang on unloading driver
Bjoern A. Zeeb [Tue, 22 Nov 2022 17:29:41 +0000 (17:29 +0000)]
iwlwifi: fix hang on unloading driver

f808c43ad9234670770601ba32a7426b00bbf528 introduced a FreeBSD specific
behaviour to wait for firmware load completion before returning from
loading the driver.  This does no longer allow iwl_drv_stop to detect
that startup has completed and it will wait indefinitely for a
completion event that will not happen.
We could change the complete() call to a complete_all() but to avoid
confusion, future side effects, and for simplicity daisy-chain two
complete events in FreeBSD.

PR: 267869
Reported by: Peter Much (pmc citylink.dinoex.sub.org)
Tested by: Peter Much (pmc citylink.dinoex.sub.org)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

18 months agotftp: Use printf0 attribute for options_set_request/reply.
John Baldwin [Tue, 22 Nov 2022 16:37:26 +0000 (08:37 -0800)]
tftp: Use printf0 attribute for options_set_request/reply.

These functions accept a NULL format argument so should use the printf0
attribute rather than plain printf.

Reported by: GCC -Wformat

18 months agolibicp: Link with -z noexecstack for ld.bfd.
John Baldwin [Tue, 22 Nov 2022 16:37:12 +0000 (08:37 -0800)]
libicp: Link with -z noexecstack for ld.bfd.

The assembly source files do not contain GNU-stack annotations, so
ld.bfd defaults to using an executable stack.

18 months agolibcrypto padlock.so: Link with -z noexecstack for ld.bfd.
John Baldwin [Tue, 22 Nov 2022 16:37:04 +0000 (08:37 -0800)]
libcrypto padlock.so: Link with -z noexecstack for ld.bfd.

The assembly source files do not contain GNU-stack annotations, so
ld.bfd defaults to using an executable stack.

18 months agolibsa: Add missing GNU-stack annotations to _setjmp.S.
John Baldwin [Tue, 22 Nov 2022 16:36:40 +0000 (08:36 -0800)]
libsa: Add missing GNU-stack annotations to _setjmp.S.

ld.bfd marks the stack as executable for the crt objects due to the
missing annotations which raises a fatal warning starting with version
2.39.

18 months agostand/libsa: Remove MIPS setjmp() and longjmp().
John Baldwin [Tue, 22 Nov 2022 16:36:28 +0000 (08:36 -0800)]
stand/libsa: Remove MIPS setjmp() and longjmp().

18 months agoUse __freebsd_kprintf__ with GCC 12+ similar to clang.
John Baldwin [Tue, 22 Nov 2022 16:36:12 +0000 (08:36 -0800)]
Use __freebsd_kprintf__ with GCC 12+ similar to clang.

18 months agoUpdate resolv.conf(5) "not necessary" language.
Pau Amma [Mon, 21 Nov 2022 00:19:55 +0000 (00:19 +0000)]
Update resolv.conf(5) "not necessary" language.

While there, fix mandoc -T lint warnings.

PR: 262492

Differential Revision: https://reviews.freebsd.org/D37449

MFC after: 1 week

Reviewed by: gjb

Approved by: gjb (mentor)

18 months agocrypto: move all zeroing into crypto_getreq
Mateusz Guzik [Tue, 22 Nov 2022 12:28:07 +0000 (12:28 +0000)]
crypto: move all zeroing into crypto_getreq

Reviewed by: jhb, markj
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D36774

18 months agoipsec: add key_havesp_any
Mateusz Guzik [Wed, 7 Sep 2022 20:05:38 +0000 (22:05 +0200)]
ipsec: add key_havesp_any

Saves on work in a common case of checking both directions.

Note further work in the area is impending to elide these in the common
case to begin with.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D36485

18 months agoipsec: prohibit unknown directions in key_havesp
Mateusz Guzik [Wed, 7 Sep 2022 20:27:15 +0000 (22:27 +0200)]
ipsec: prohibit unknown directions in key_havesp

Eliminates a branch checking for its validity.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D36485

18 months agoAdd dnctl rc.d service
Goran Mekic [Tue, 22 Nov 2022 09:46:19 +0000 (10:46 +0100)]
Add dnctl rc.d service

As PF now also supports dummynet but can not configure it on its own,
the service which configures pipes, queues and schedulers is needed.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D37451

18 months agoipfw: Fix ipfw/dnctl detection
Goran Mekic [Tue, 22 Nov 2022 08:53:20 +0000 (09:53 +0100)]
ipfw: Fix ipfw/dnctl detection

Running "dnctl" vs "/sbin/dnctl" gave different results, because we
looked at the entire argv[0] string, rather than the basename.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D37431

18 months agoAdd support for _CR3 critical standby (S3) threshold.
Cyrus Rahman [Fri, 18 Nov 2022 18:30:30 +0000 (10:30 -0800)]
Add support for _CR3 critical standby (S3) threshold.

Along with _PSV, _HOT, and _CRT, ACPI supports the _CR3 threshold
which specifies a temperature above which a system should transition
to the S3 standby state.

On FreeBSD, this is more useful than _HOT, which specifies the S4
transition threshold temperature (since FreeBSD does not generally
support the S4 state), or, in many cases, _CRT, since after
transitioning to S3 the system can cool and then be resumed.

Reviewed by: jhb, bcr (manpages)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D35980

18 months agoRetire CLANG_IS_CC option
Ed Maste [Thu, 29 Sep 2022 18:15:39 +0000 (14:15 -0400)]
Retire CLANG_IS_CC option

A small reduction in build infrastructure complexity; when we had both
Clang and GCC in the tree it was useful to have both built, and choose
one or the other to install as /usr/bin/cc.  Now only Clang is in the
tree, and there is no point in building and installing base Clang but
not providing it as cc (and c++, cpp).

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37075

18 months agobhyve: use dynamic ACPI table offsets
Corvin Köhne [Wed, 6 Apr 2022 09:10:44 +0000 (11:10 +0200)]
bhyve: use dynamic ACPI table offsets

Now that all ACPI tables are build by basl, basl can dynamically
calculate the offset for each table.

Reviewed by: jhb, markj (older version)
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37002

18 months agobhyve: build RSDP table by basl
Corvin Köhne [Wed, 6 Apr 2022 09:10:43 +0000 (11:10 +0200)]
bhyve: build RSDP table by basl

Building the RSDP table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by: jhb, markj (older version)
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37001

18 months agobhyve: build RSDT table by basl
Corvin Köhne [Wed, 6 Apr 2022 09:10:43 +0000 (11:10 +0200)]
bhyve: build RSDT table by basl

Building the RSDT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by: jhb, markj (older version)
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37000

18 months agobhyve: build XSDT table by basl
Corvin Köhne [Wed, 6 Apr 2022 09:10:42 +0000 (11:10 +0200)]
bhyve: build XSDT table by basl

Building the XSDT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by: jhb, markj (older version)
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36999

18 months agobhyve: build FADT table by basl
Corvin Köhne [Wed, 6 Apr 2022 09:10:42 +0000 (11:10 +0200)]
bhyve: build FADT table by basl

Building the FADT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by: jhb, markj (older version)
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36998

18 months agobhyve: build MADT table by basl
Corvin Köhne [Wed, 6 Apr 2022 09:10:42 +0000 (11:10 +0200)]
bhyve: build MADT table by basl

Building the MADT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by: jhb, markj (older version)
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36997