]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 months agoAdd UPDATING entries and bump version.
Gordon Tetlow [Wed, 21 Jun 2023 05:40:02 +0000 (22:40 -0700)]
Add UPDATING entries and bump version.

Approved by:    so

11 months agopam_krb5: Fix spoofing vulnerability
Cy Schubert [Wed, 31 May 2023 19:20:27 +0000 (12:20 -0700)]
pam_krb5: Fix spoofing vulnerability

An adversary on the network can log in via ssh as any user by spoofing
the KDC. When the machine has a keytab installed the keytab is used to
verify the service ticket. However, without a keytab there is no way
for pam_krb5 to verify the KDC's response and get a TGT with the
password.

If both the password _and_ the KDC are controlled by an adversary, the
adversary can provide a password that the adversary's spoofed KDC will
return a valid tgt for.  Currently, without a keytab, pam_krb5 is
vulnerable to this attack.

Reported by: Taylor R Campbell <riastradh@netbsd.org> via emaste@
Reviewed by: so
Approved by: so
Security: FreeBSD-SA-23:04.pam_krb5
Security: CVE-2023-3326

(cherry picked from commit 813847e49e35439ba5d7bf16034b0691312068a4)
(cherry picked from commit 6322a6c9daaabbf0b5d17c5d5a4f245f474a7e30)

11 months agompr: fix copying of event_mask
Mariusz Zaborski [Fri, 21 Apr 2023 07:50:16 +0000 (09:50 +0200)]
mpr: fix copying of event_mask

Before the commit 6cc44223cb6717795afdac4348bbe7e2a968a07d the
field event_mask was fully copied to the EventMasks field.
After this commit the event_mask (uint8_t) is 4 times casted to
EventMask (uint32_t). Because of that 24 bits of each event_mask array
is lost.

This commits brings back simple copying of field, and after words
converting 32 bits field to the requested endian.

I don't think we need more sophisticated method,
as the array is of size 4 (for 32 bits version).

Reviewed by: imp
MFC after: 1 week
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D39562

(cherry picked from commit ea6597c38c77c7bfaae71259d8636cbb89add6a3)
(cherry picked from commit e7a3a08febd01c95b74185bb971ec29cca64b8e1)

Approved by: so
Security: FreeBSD-EN-23:07.mpr

11 months agoloader: comconsole: don't unconditionally wipe out hw.uart.console
Kyle Evans [Fri, 14 Apr 2023 04:41:22 +0000 (23:41 -0500)]
loader: comconsole: don't unconditionally wipe out hw.uart.console

It may be the case that we need to set hw.uart.console manually in some
scenarios that comconsole can't necessarily support.  Avoid clobbering
hw.uart.console unless we've actually selected comconsole so that one
could at least get kernel console output..

Discussed with: imp
Sponsored by: Zenith Electronics LLC
Sponsored by: Klara, Inc.

(cherry picked from commit ec671f4980437008b0119c6367816083e15fa503)
(cherry picked from commit 362677cae8e9ac4c6f7ff4d74a4378ea11d47797)

Approved by: so
Security: FreeBSD-EN-23:06.loader

13 months agoUpdate in preparation for 13.2-RELEASE
Colin Percival [Fri, 7 Apr 2023 00:03:18 +0000 (17:03 -0700)]
Update in preparation for 13.2-RELEASE

- Bump BRANCH to RELEASE
- Add the anticipated RELEASE announcement date
- Set a static __FreeBSD_version

Approved by: re (implicit)
Sponsored by: https://www.patreon.com/cperciva

13 months ago13.2: update to RC6
Colin Percival [Fri, 31 Mar 2023 00:47:18 +0000 (17:47 -0700)]
13.2: update to RC6

Approved by: re (implicit)

13 months agoamd64 wakeup: recalculate mitigations after APICs are woken
Konstantin Belousov [Tue, 28 Mar 2023 23:51:44 +0000 (02:51 +0300)]
amd64 wakeup: recalculate mitigations after APICs are woken

PR: 270489
Approved by: re (cperciva)

(cherry picked from commit cd137909c3097fe223ce2b49075eed42a4933bb5)
(cherry picked from commit 738b20a47f7379b27ccf7a6d2af2c1bbfa11d05f)

14 months agocontrib/tzdata: import tzdata 2023c
Philip Paeps [Wed, 29 Mar 2023 01:09:54 +0000 (09:09 +0800)]
contrib/tzdata: import tzdata 2023c

Changes: https://github.com/eggert/tz/blob/2023c/NEWS

The tzdata 2023c release reverts all changes made in 2023b other than
commentary, as that appears to be the best of a bad set of short-notice
choices for modeling this week's daylight saving chaos in Lebanon.

Approved by: re (cperciva)

(cherry picked from commit 9fbeeb6e38310b4f42a14c4b043bbee82c5e4752)
(cherry picked from commit bb7b15831531a85b1d29e80358e3b80cc799094a)

14 months ago13.2: update to RC5
Colin Percival [Sat, 25 Mar 2023 15:58:19 +0000 (08:58 -0700)]
13.2: update to RC5

We're doing one more (hopefully last!) RC but decided against waiting
the usual 1 week between RCs.

Approved by: re (implicit)

14 months agocontrib/tzdata: import tzdata 2023a and tzdata 2023b
Philip Paeps [Thu, 23 Mar 2023 01:33:45 +0000 (09:33 +0800)]
contrib/tzdata: import tzdata 2023a and tzdata 2023b

Changes: https://github.com/eggert/tz/blob/2023a/NEWS
Changes: https://github.com/eggert/tz/blob/2023b/NEWS

(cherry picked from commit 259e2ad76d1da961cc34c2903cb5f72f28503eb8)
(cherry picked from commit 9cb5b954606ec8a49b6127d2f58f7ee37ca0bb9c)
(cherry picked from commit 2084f6a496cefb5da9dbdabad5aa99342e2fc163)
(cherry picked from commit 38e0d28fa4e2f98ebb060441f0aeb0536d6fd202)

Approved by: re (cperciva)

14 months agombuf: Fix an offset calculation in m_apply_extpg_one()
Mark Johnston [Wed, 10 Nov 2021 21:57:12 +0000 (16:57 -0500)]
mbuf: Fix an offset calculation in m_apply_extpg_one()

We were not including the requested starting offset in the page offset.

Approved by: re (cperciva)
Reviewed by: jhb
Fixes: 3c7a01d773ac ("Extend m_apply() to support unmapped mbufs.")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32922

(cherry picked from commit ac2b54441742b3148de72e3b29aa0f00d29bb825)
(cherry picked from commit 70421fd527e315bbc4850db2d7e80fc008393bce)

14 months ago13.2: update to RC4
Colin Percival [Fri, 24 Mar 2023 00:48:54 +0000 (17:48 -0700)]
13.2: update to RC4

Approved by: re (implicit)

14 months agovfs cache: return ENOTDIR for not_a_dir/{.,..} lookups
Mateusz Guzik [Thu, 23 Mar 2023 19:19:48 +0000 (19:19 +0000)]
vfs cache: return ENOTDIR for not_a_dir/{.,..} lookups

Reported by: Oliver Kiddle
PR: 270419
MFC: 3 days
Approved by: re (gjb)

(cherry picked from commit c16c4ea6d399332d4a023df6e423be61fdb875a5)
(cherry picked from commit 5d83656c09f522d6bf4f1050be60f270ddef04af)

14 months ago_endian.h: Include sys/cdefs.h for visibility macros
Warner Losh [Wed, 22 Mar 2023 02:25:58 +0000 (20:25 -0600)]
_endian.h: Include sys/cdefs.h for visibility macros

BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN will be required by the
forthcoming POSIX Issue 8. In addition, they are provided in the BSD
compilation environments. However, depending on the order includes
happend, sys/cdefs.h may or may not be included when endian.h is
included. Include it here so we can safely test __BSD_VISIBLE.  Add
visibility when we're compiling in the future for issue 8, but since the
date number for issue 8 hasn't been fixed, use strictly greater than the
issue 7 date.of 200809.

This had the side effect of sometimes (in the traditional BSD
compliation environment)
 #if BYTE_ORDER == LITTLE_ENDIAN
and
 #if BYTE_ORDER == BIG_ENDIAN
both being true because none of these were defined. This fixes
that. It also fixes including it after <stdio.h> but not before.

PR: 269249
MFC After: 1d (build related)
Reviewed by: kib, emaste
Differential Revision: https://reviews.freebsd.org/D39176
Approved by: re@ (gjb)

(cherry picked from commit ed52baf51bd142b5e32701842346452a7ebe37a5)
(cherry picked from commit 4ccd5e64b76bbaa874c50755d17394a7ed195f93)

14 months agocarp: carp_master_down_locked() requires net epoch
Zhenlei Huang [Thu, 16 Mar 2023 10:00:13 +0000 (18:00 +0800)]
carp: carp_master_down_locked() requires net epoch

Reviewed by: kp
Approved by: re (gjb)
Fixes: 1d126e9b9474 carp: Widen epoch coverage
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D39113

(cherry picked from commit 49cad3daf2a3abe8270f71ee5b15b8990a19529d)
(cherry picked from commit c15ceae9e7f98f7e74ff7848b3aff7176c7e263a)

14 months agokerneldump: Inline dump_savectx() into its callers
Mark Johnston [Mon, 20 Mar 2023 18:16:00 +0000 (14:16 -0400)]
kerneldump: Inline dump_savectx() into its callers

The callers of dump_savectx() (i.e., doadump() and livedump_start())
subsequently call dumpsys()/minidumpsys(), which dump the calling
thread's stack when writing the dump.  If dump_savectx() gets its own
stack frame, that frame might be clobbered when its caller later calls
dumpsys()/minidumpsys(), making it difficult for debuggers to unwind the
stack.

Fix this by making dump_savectx() a macro, so that savectx() is always
called directly by the function which subsequently calls
dumpsys()/minidumpsys().

This fixes stack unwinding for the panicking thread from arm64
minidumps.  The same happened to work on amd64, but kgdb reports the
dump_savectx() calls as coming from dumpsys(), so in that case it
appears to work by accident.

Approved by: re (gjb)
Fixes: c9114f9f86f9 ("Add new vnode dumper to support live minidumps")
Reviewed by: mhorne, jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39151

(cherry picked from commit c3179891f897d840f578a5139839fcacb587c96d)
(cherry picked from commit 2310894c1021f49b6c3003ba215ca978eee2be75)

14 months agoFFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.
Kirk McKusick [Wed, 8 Mar 2023 06:02:07 +0000 (22:02 -0800)]
FFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.

Clarification of the size of the snapshot file.

Suggested by: Matteo Riondato
PR:           266358
Differential Revision: https://reviews.freebsd.org/D38817
Approved by: re (gjb)

(cherry picked from commit 129ea078cd16b768a1100b497282fd9359e8dfea)

14 months agoFFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.
Kirk McKusick [Tue, 7 Mar 2023 05:43:32 +0000 (21:43 -0800)]
FFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.

Minor clarification.

Approved by: re (gjb)

(cherry picked from commit 7741a5c4dc5e318dcaabf5e336dfa9cf3f3b6805)

14 months agoFFS/UFS snapshots: improve documentation.
Kirk McKusick [Mon, 6 Mar 2023 05:37:23 +0000 (21:37 -0800)]
FFS/UFS snapshots: improve documentation.

This update provides a more detailed description of FFS/UFS snapshots
and adds links to useful man pages.

Requested by: Graham Perrin
Submitted by: darius-dons.net.au
Reviewed by:  Ravi Pokala
PR:           266358
Differential Revision: https://reviews.freebsd.org/D38817
Approved by: re (gjb)

(cherry picked from commit 528d8e55c8d338e78fa4e6c9f182e8975f75199a)

14 months agoacpi_wakeup.c: apply the reviewer' editorial corrections to the comment text.
Konstantin Belousov [Sat, 18 Mar 2023 15:45:49 +0000 (17:45 +0200)]
acpi_wakeup.c: apply the reviewer' editorial corrections to the comment text.

Approved by: re (gjb)

(cherry picked from commit 2b4b3789f877918e9e89a217d3b25d854d1a2267)
(cherry picked from commit 38cefd30516e0c27194b822cb7db5a7d92e780cd)

14 months agoamd64: properly recalculate mitigations knobs after resume
Konstantin Belousov [Fri, 17 Mar 2023 13:02:03 +0000 (15:02 +0200)]
amd64: properly recalculate mitigations knobs after resume

Approved by: re (gjb)

(cherry picked from commit 02904a06c76be857307b78184863654b9e7b88ab)
(cherry picked from commit 7c5d3ec4c02b89754ec3ce55d1b7943c404209df)

14 months agoamd64 acpi_wakeup.c: fix typo
Konstantin Belousov [Fri, 17 Mar 2023 12:42:26 +0000 (14:42 +0200)]
amd64 acpi_wakeup.c: fix typo

Approved by: re (gjb)

(cherry picked from commit ff6d60946a0e9e0ade3045b734ed4bea08e20938)
(cherry picked from commit 107004380c895d7ccd438eaf98941f92b4aa54b9)

14 months ago13.2: update to RC3
Colin Percival [Fri, 17 Mar 2023 03:28:20 +0000 (20:28 -0700)]
13.2: update to RC3

Approved by: re (implicit)

14 months agossh: Update to OpenSSH 9.3p1
Ed Maste [Thu, 16 Mar 2023 14:29:55 +0000 (10:29 -0400)]
ssh: Update to OpenSSH 9.3p1

This release fixes a number of security bugs and has minor new
features and bug fixes.  Security fixes, from the release notes
(https://www.openssh.com/txt/release-9.3):

This release contains fixes for a security problem and a memory
safety problem. The memory safety problem is not believed to be
exploitable, but we report most network-reachable memory faults as
security bugs.

 * ssh-add(1): when adding smartcard keys to ssh-agent(1) with the
   per-hop destination constraints (ssh-add -h ...) added in OpenSSH
   8.9, a logic error prevented the constraints from being
   communicated to the agent. This resulted in the keys being added
   without constraints. The common cases of non-smartcard keys and
   keys without destination constraints are unaffected. This problem
   was reported by Luci Stanescu.

 * ssh(1): Portable OpenSSH provides an implementation of the
   getrrsetbyname(3) function if the standard library does not
   provide it, for use by the VerifyHostKeyDNS feature. A
   specifically crafted DNS response could cause this function to
   perform an out-of-bounds read of adjacent stack data, but this
   condition does not appear to be exploitable beyond denial-of-
   service to the ssh(1) client.

   The getrrsetbyname(3) replacement is only included if the system's
   standard library lacks this function and portable OpenSSH was not
   compiled with the ldns library (--with-ldns). getrrsetbyname(3) is
   only invoked if using VerifyHostKeyDNS to fetch SSHFP records. This
   problem was found by the Coverity static analyzer.

Approved by: re (cperciva)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4d3fc8b0570b29fb0d6ee9525f104d52176ff0d4)
(cherry picked from commit 802b483630974c2ccf2bfbc90b39102b9e47d22b)

14 months agoheimdal: Resolve hdb_free_entry() SIGSEGV/SIGILL
Cy Schubert [Tue, 7 Feb 2023 15:46:59 +0000 (07:46 -0800)]
heimdal: Resolve hdb_free_entry() SIGSEGV/SIGILL

When the client sends kadmind a create principal (kadm_create) request
kadm_s_create_principal() returns an error before zeroing out ent (an
hdb entry structure wrapper -- hdb_entry_ex), resulting in a NULL
reference.

Fix obtained from upstream commit 35ea4955a.

PR: 268059
Reported by: Robert Morris <rtm@lcs.mit.edu>
Obtained from: Heimdal commit 35ea4955a
Approved by: re (cperciva)

(cherry picked from commit 6a70e0b4cdc606931555cdc59dc6c8d4a3ab4e3e)
(cherry picked from commit 75b5693ed73e4abb6dbb90affbf3ba56c4cdfdc4)

14 months agoheimdal: Fix CVE-2022-4152, signature validation error
Cy Schubert [Fri, 10 Mar 2023 01:03:52 +0000 (17:03 -0800)]
heimdal: Fix CVE-2022-4152, signature validation error

When CVE-2022-3437 was fixed by changing memcmp to be a constant
time and the workaround for th e compiler was to add "!=0". However
the logic implmented was inverted resulting in CVE-2022-4152.

Reported by: Timothy E Zingelman <zingelman _AT_ fnal.gov>
Security: CVE-2022-4152
Security: https://www.cve.org/CVERecord?id=CVE-2022-45142
Security: https://nvd.nist.gov/vuln/detail/CVE-2022-45142
Security: https://security-tracker.debian.org/tracker/CVE-2022-45142
Security: https://bugs.gentoo.org/show_bug.cgi?id=CVE-2022-45142
Security: https://bugzilla.samba.org/show_bug.cgi?id=15296
Security: https://www.openwall.com/lists/oss-security/2023/02/08/1
Approved by: re (cperciva)

(cherry picked from commit 5abaf0866445a61c11665fffc148ecd13a7bb9ac)
(cherry picked from commit 59c26d1a95a00418892e08341e3eae074c238680)

14 months agoroute.8: Don't reference an external command in EXAMPLES
Gordon Bergling [Tue, 14 Mar 2023 13:55:28 +0000 (14:55 +0100)]
route.8: Don't reference an external command in EXAMPLES

It is better to mention the externel command for showing
the routing table as using an explicit command.

PR: 231579
Suggested by: karels
Reviewed by: karles, gbe
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D39075

(cherry picked from commit 21f268182838f072f96234c727778d5603a580e3)

14 months agonetlink: Fix "version introduced" documentation
Tom Hukins [Sat, 4 Mar 2023 15:59:02 +0000 (08:59 -0700)]
netlink: Fix "version introduced" documentation

netlink(4) and associated features will exist in FreeBSD 14.0 but they
will also exist in 13.2, an older version, from commits such as 02b958b1
and b309249b.

This commit needs merging to stable/13 and releng/13.2.

MFC after: 2days (needs to be in RC2)
Reviewed by: imp,melifaro
Pull Request: https://github.com/freebsd/freebsd-src/pull/651
Approved by: re@ (cperciva)

(cherry picked from commit 6d2feb39ad13768f3ea06381fcd95937a09f0d62)

14 months agomakefs: make msdos creation go fast
Warner Losh [Mon, 13 Mar 2023 20:28:51 +0000 (14:28 -0600)]
makefs: make msdos creation go fast

Add missing brelse(bp). Without it the cache grows and we have a n^2
lookup.  I'm not entirely sure why we read the block before we write it
back out, since the only side effect of that is to allocate memory,
clear the memory, read it in from disk, throw it away with the contents
of the file being written out. We likely should just do a getblk() here
instead, but even with all that, this takes the time it takes to create
a 150MB msdos fs image down from 5 minutes to 30 seconds.

Old: 317.663u 0.685s 5:18.34 100.0% 198+360k 0+19io 1009pf+0w
New: 7.330u 23.841s 0:31.17 100.0% 198+360k 0+250522io 4pf+0w

See code review for how we got this. tl;dr: netbsd move brelse
into bwrite and we picked up msdos code after that, but not the
move. That change should be picked up later.

Sponsored by: Netflix
Reviewed by: emaste
MFC After: 1 day (13.2 is coming fast)
Differential Revision: https://reviews.freebsd.org/D39025
Approved by: re@ (cperciva)

(cherry picked from commit 370e009188ba90c3290b1479aa06ec98b66e140a)
(cherry picked from commit aa1e6a4f4c28c7051ee9431ecb7802309cc1bf96)

14 months agopowerpc/pmap: Add pmap_sync_icache() for radix pmap
Justin Hibbits [Sun, 12 Mar 2023 15:46:57 +0000 (11:46 -0400)]
powerpc/pmap: Add pmap_sync_icache() for radix pmap

DTrace pid provider writes to user space to set breakpoints.  Failing to
sync the icache can lead to SIGTRAP.  Radix pmap is the only one missing
a pmap_sync_icache() method, so the pid provider would only potentially
crash a process on a POWER9 or later system.

Approved by: re (cperciva)

(cherry picked from commit 6f0b2a235a133a381634ba9a7f5f477c64db9873)
(cherry picked from commit ed2c3bda43fbd0bfad9e45c78a59fff8a62422da)

14 months agodtrace/powerpc: Adjust AFRAMES for fbt and profile
Justin Hibbits [Sat, 11 Mar 2023 16:23:38 +0000 (11:23 -0500)]
dtrace/powerpc: Adjust AFRAMES for fbt and profile

FBT_AFRAMES was skipping over too many frames, while PROFILE_AFRAMES was
skipping over too few.  Adjust them empirically.

Approved by: re (cperciva)

(cherry picked from commit 635ecbf47015c259226cb47a3de8fc00c9ed5924)
(cherry picked from commit 1026d170f4f70cdeb63cd05819c5557041e8ea94)

14 months agodtrace/powerpc: "Fix" stack traces across trap frames
Justin Hibbits [Sat, 11 Mar 2023 16:30:00 +0000 (11:30 -0500)]
dtrace/powerpc: "Fix" stack traces across trap frames

In function boundary tracing the link register is not yet saved to the
save stack location, so the save point contains whatever the previous
'lr' save was, or even garbage, at the time the trap is taken.  Address
this by explicitly loading the link register from the trap frame instead
of the stack, and propagate that out.

Approved by: re (cperciva)

(cherry picked from commit 3e1155ade1baab51458374efd0295bdf6db455fc)
(cherry picked from commit e620e088cbd1c062655eee825aaf4f80bd255e1f)
(cherry picked from commit 0a21a6659e5dfe503da587fb0460ae19bd765859)

14 months agoepair: Simplify the transmit path and address lost wakeups
Mark Johnston [Wed, 1 Mar 2023 20:21:30 +0000 (15:21 -0500)]
epair: Simplify the transmit path and address lost wakeups

epairs currently shuttle all transmitted packets through a single global
taskqueue thread.  To hand packets over to the taskqueue thread, each
epair maintains a pair of ring buffers and a lockless scheme for
notifying the thread of pending work.  The implementation can lead to
lost wakeups, causing to-be-transmitted packets to end up stuck in the
queue.

Rather than extending the existing scheme, simply replace it with a
linked list protected by a mutex, and use the mutex to synchronize
wakeups of the taskqueue thread.  This appears to give equivalent or
better throughput with >= 16 producer threads and eliminates the lost
wakeups.

Approved by: re (cperciva)
Reviewed by: kp
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D38843

(cherry picked from commit df7bbd8c354a907d2c2f85a6e18f356f76458f57)
(cherry picked from commit 762ad964ee346cffdbf3eaa6ff87fa5b32d30738)

14 months agoepair: Avoid loading m_flags into a short
Mark Johnston [Mon, 6 Mar 2023 14:39:17 +0000 (09:39 -0500)]
epair: Avoid loading m_flags into a short

The m_flags field of struct mbuf is 24 bits wide and so gets truncated
in a couple of places in the epair code.  Instead of preserving the
entire flag set, just remember whether M_BCAST or M_MCAST is set.

Approved by: re (cperciva)
MFC after: 1 week
Sponsored by: Klara, Inc.

(cherry picked from commit 48227d1c6db8fceaceebbf8578612302d64ca170)
(cherry picked from commit c3bd32f225ec093ba0f7cd7fc1a000b02aad5211)

14 months agonvmecontrol: Fix default ns create parameters.
Alexander Motin [Thu, 9 Mar 2023 15:19:00 +0000 (10:19 -0500)]
nvmecontrol: Fix default ns create parameters.

Instead of passing 0xff's for all unset parameters, prefer reasonable
defaults.  It is much easier to use it this was without specs in hand.

PR: 269912
Approved by: re (cperciva)
(cherry picked from commit 20dc2c4d11ddaa980c491116b65c51ab522028e9)
(cherry picked from commit de0b02cb7b112947191af96dd34e7a95b760019c)

14 months agoroute.8: Fix mandoc warnings
Gordon Bergling [Sun, 26 Feb 2023 13:33:58 +0000 (14:33 +0100)]
route.8: Fix mandoc warnings

- skipping end of block that is not open: Oc
- no blank before trailing delimiter
- remove useless TN macros
- remove commented out reference for esis(4)

Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D38783

(cherry picked from commit 6dbfbe6e11a04f6e2ae893dbf46b059ab49eb517)

14 months agoroute.8: Add information about ROUTE_MPATH and FIB_ALGO
Gordon Bergling [Sun, 26 Feb 2023 13:15:34 +0000 (14:15 +0100)]
route.8: Add information about ROUTE_MPATH and FIB_ALGO

Since the kernel options ROUTE_MPATH and FIB_ALGO are enabled
per default for a while, it's good to have some user facing
documetation about the general functionality of multipath
routing and fib lookup algorithms.

Reviewed by: pauamma, Jose Luis Duran <jlduran at gmail dot com>
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D38783

(cherry picked from commit b06338167d64507e79e003500002e22fbe583832)

14 months agoroute(8): Remove obsolete information
Warner Losh [Wed, 15 Dec 2021 23:06:19 +0000 (16:06 -0700)]
route(8): Remove obsolete information

xns and osi are no longer relevant (or supported) so remove their
vestiges.

Noticed by: phk
Sponsored by: Netflix

Approved by: re (cperciva)

(cherry picked from commit c6b2efb64e279b4d543aaa10073c63765bf6e790)

14 months agoroute(8): Add an example how to print the routing tables
Gordon Bergling [Tue, 13 Apr 2021 04:44:04 +0000 (06:44 +0200)]
route(8): Add an example how to print the routing tables

The manual page currently doesn't show an example how to print
the routing table, so add one and .Xr netstat while here.

PR: 231579
Reported by: Pekka Järvinen <pekka dot jarvinen at gmail dot com>
Reviewed by: debdrup
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D29702

(cherry picked from commit bc54f5f1cd5c01aa5f941234034839fb0b8f54ed)

14 months agorc.d: Generate machine-id from hostid_save
Tijl Coosemans [Wed, 15 Feb 2023 20:09:51 +0000 (21:09 +0100)]
rc.d: Generate machine-id from hostid_save

rc.d/hostid_save saves a UUID generated by rc.d/hostid in /etc/hostid.
Store the same UUID, without hyphens, in /etc/machine-id.  The hyphens
are removed with a shell function because hostid_save runs before file
systems are mounted so other tools may not be available yet.

This eliminates some duplication between hostid and machine-id and for
virtual machines machine-id now contains the UUID configured in the
hypervisor like it does on Linux.

Reviewed by: delphij
Discussed with: bapt
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D38811

(cherry picked from commit ecad3f5c4d922f93ceba455f8bff1c54e1ed4174)
(cherry picked from commit d6852eed98ed32ad51120a22aa1ebdf0601917b3)

14 months agohostid: Generate random UUID by default
Tijl Coosemans [Thu, 9 Mar 2023 09:02:45 +0000 (10:02 +0100)]
hostid: Generate random UUID by default

This way MAC addresses are no longer exposed.

Discussed with: bapt
Approved by: re (cperciva)

(cherry picked from commit 862aab6281a5e6b5dad89761ac17ca2a0e83ab32)
(cherry picked from commit baf1e9713969fccdaf7481e3568ca89b7237dafd)

14 months ago13.2: update to RC2
Colin Percival [Fri, 10 Mar 2023 00:24:24 +0000 (16:24 -0800)]
13.2: update to RC2

Approved by: re (implicit)
Sponsored by: https://www.patreon.com/cperciva

14 months agogrowfs_fstab startup script: set dumpdev to AUTO
Mike Karels [Tue, 28 Feb 2023 13:55:35 +0000 (07:55 -0600)]
growfs_fstab startup script: set dumpdev to AUTO

The growfs_fstab script has been testing dumpdev, and if it is AUTO,
enables dumps on the newly-added swap device for the initial boot.
However, dumpdev defaults to AUTO on main, but NO on stable/13 and
release branches.  On the other hand, bsdinstall adds dumpdev="AUTO"
by default (controlled by a menu item).  bsdinstall is not used when
booting an SD card or other disk image.  Adopt the default from
bsdinstall, and set dumpdev to AUTO in /etc/rc.conf in the
growfs_fstab script if a swap partition has been added, along with
the explanatory comment added by bsdinstall.

Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D38751

(cherry picked from commit eef9f9900f118b5efcabbd5864e7b8b993d09922)
(cherry picked from commit 009abff336b6e83219178e7d87f6a91f54e31839)

14 months agolinux_80211: Don't dequeue lsta if not queued
Colin Percival [Sun, 5 Mar 2023 20:10:57 +0000 (12:10 -0800)]
linux_80211: Don't dequeue lsta if not queued

This fixes an instapanic when restarting wpa_supplicant on my laptop's
iwlwifi device.  After this change, iwlwifi enters a nonfunctional
state if wpa_supplicant is restarted, but "service netif restart wlan0"
is enough to get it working again.

Approved by: re (kib)

(cherry picked from commit 3689f8aeab82150da6789be87b6c2f9385810c23)
(cherry picked from commit 790dc4d825c910c8a2eda49fe9e6dd827519f0f4)

14 months agoxz: Improve compatibility with systems without capability mode support
Xin LI [Sun, 5 Mar 2023 09:40:13 +0000 (01:40 -0800)]
xz: Improve compatibility with systems without capability mode support

When the kernel is built without capability mode support, or when
using an emulator like qemu-user-static that does not translate
system calls, these calls will return a negative number and set
the errno to ENOSYS. However, this error does not indicate a
real programming or runtime error and is generally ignored by
base system applications built with capability mode sandboxing.

Match this behavior by making xz(1) to ignore ENOSYS errors
when calling capability mode system calls too.

PR: 269185
Reported by: Dan Kotowski
Approved by: re (cperciva)

(cherry picked from commit c237c10a2346dec422233db05b2012afd45363fa)
(cherry picked from commit 0cc2deb476bec103ad7c8dbeb650aa2937d6a0da)

14 months agoamd64: Avoid copying td_frame from kernel procs
Mark Johnston [Sat, 25 Sep 2021 14:15:31 +0000 (10:15 -0400)]
amd64: Avoid copying td_frame from kernel procs

When creating a new thread, we unconditionally copy td_frame from the
creating thread.  For threads which never return to user mode, this is
unnecessary since td_frame just points to the base of the stack or a
random interrupt frame.

If KASAN is configured this copying may also trigger false positives
since the td_frame region may contain poisoned stack regions.  It was
not noticed before since thread0 used a dummy proc0_tf trapframe, and
kernel procs are generally created by thread0.  Since commit
df8dd6025af88a99d34f549fa9591a9b8f9b75b1, though, we call
cpu_thread_alloc(&thread0) when initializing FPU state, which
reinitializes thread0.td_frame.

Work around the problem by not copying the frame unless the copying
thread came from user mode.  While here, de-duplicate the copying and
remove redundant re(initialization) of td_frame.

Reported by: syzbot+2ec89312bffbf38d9aec@syzkaller.appspotmail.com
Reviewed by: kib
Approved by: re (delphij)
Fixes: df8dd6025af8
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32057

(cherry picked from commit ca1e447b1048b26b855d7f7fbcdad78309e4d741)
(cherry picked from commit cf25fa7f31e7bda9b8aa20757659524db9c4ef97)

14 months agonetlink: fix OOB read in genetlink
Alexander V. Chernikov [Sat, 18 Feb 2023 17:24:59 +0000 (17:24 +0000)]
netlink: fix OOB read in genetlink

Reported by: Coverity Scan
Approved by: re (cperciva)
CID: 1498863

(cherry picked from commit 8f7455a9265f4952f885b06c08c57fcce6f16e5c)
(cherry picked from commit d9d596bb2ce04bbec5ea811342efd4216c1fc2a3)

14 months agonetlink: call genetlink notification handler upon successful family
Alexander V. Chernikov [Fri, 17 Feb 2023 17:58:53 +0000 (17:58 +0000)]
netlink: call genetlink notification handler upon successful family
search.

Approved by: re (cperciva)

(cherry picked from commit 7cbe771f013f6cf3316910648f6d46641cad7f44)
(cherry picked from commit ac40ea6fbb4e6af98a4540fc8fd5a3e824cb181d)

14 months agomachine-id: generate a compact version of the uuid
Baptiste Daroussin [Tue, 28 Feb 2023 10:31:06 +0000 (11:31 +0100)]
machine-id: generate a compact version of the uuid

dbus and other actually expect an uuid without hyphens

Approved by: re (cperciva)
Reported by: tijl
MFC After: 3 days

(cherry picked from commit a28ccb32bf5678fc401f1602865ee9b37ca4c990)

14 months agouuidgen: add -c for compact uuid
Baptiste Daroussin [Tue, 28 Feb 2023 10:29:51 +0000 (11:29 +0100)]
uuidgen: add -c for compact uuid

It generates the uuid string but without the hyphen

Approved by: re (cperciva)
MFC After: 3 days
Reviews by: tcberner
Differential Revision: https://reviews.freebsd.org/D38820

(cherry picked from commit b2b294f27cf4618d6f7510007b41882860a080b9)
(cherry picked from commit 0ba66872bea87abdf13660d5a7946769fd7b118f)
(cherry picked from commit 4cd30c640db978355cf2da666e2749189babda5e)

14 months agonetlink: do not memcpy 0 bytes from a NULL pointer
Ed Maste [Mon, 6 Mar 2023 16:30:26 +0000 (11:30 -0500)]
netlink: do not memcpy 0 bytes from a NULL pointer

Although it works in practice it is UB, and might break after a future
compiler update.

This was rewritten in main and the memcpy call no longer exists, so this
is a direct commit to stable/13 before 055776c84a41 is MFC'd.

Discussed with: melifaro
Approved by: re (cperciva)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38927

(cherry picked from commit 305aaa93e0c805294c8bcbb5fe8b9f7caa28b349)

14 months agonetlink: simplify temporary address allocation in rtnl_handle_getlink().
Alexander V. Chernikov [Fri, 17 Feb 2023 17:57:44 +0000 (17:57 +0000)]
netlink: simplify temporary address allocation in rtnl_handle_getlink().

Approved by: re (cperciva)

(cherry picked from commit 45356a1864c79680c6911b48a18b14a88a7d07fa)
(cherry picked from commit 4c1ef49999c6687905664eecd73ea9473ffe5fda)

14 months agonetlink: fix interface dump.
Alexander V. Chernikov [Thu, 16 Feb 2023 13:17:58 +0000 (13:17 +0000)]
netlink: fix interface dump.

The current code missed interface addition when reallocating
 temporary buffer.
Tweak the code to perform the reallocation first and add
 interface afterwards unconditionally.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Approved by: re (cperciva)

(cherry picked from commit 86fd0bdba540132ae298457e160b651f61d1db6b)
(cherry picked from commit a800622765b1e7cab79fa857e9a671e6c0c1ccec)

14 months agong_atmllc: deprecate
Brooks Davis [Fri, 3 Mar 2023 16:20:29 +0000 (16:20 +0000)]
ng_atmllc: deprecate

With the deprecation of NgATM, ng_atmllc is the last vestage of ATM
support so deprecate it too.

Reviewed by: manu, emaste
Approved by: re (cperciva)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D38878

(cherry picked from commit c2285a7b092f524b5694e42bfb5fd24f71815771)
(cherry picked from commit 85aac7cc92f59ad023d40c81826b5c4f829dba15)

14 months agoNgATM: deprecate
Brooks Davis [Fri, 3 Mar 2023 16:20:18 +0000 (16:20 +0000)]
NgATM: deprecate

Support for ATM NICs was removed prior to FreeBSD 12.  At the time it
was unclear if this code was still useful without it.  Now the time has
come to finish removing support.

Add DREPRECATION NOTICEs to the manpages and gone_in(14, ...) warnings
in the constructors (or module init for ngatmbase).

Reviewed by: manu, emaste
Approved by: re (cperciva)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D38877

(cherry picked from commit 211c302f10d76fc12e50c87039cfc06aa9e659c1)
(cherry picked from commit 08a5f8c5cbc7143601a34ac7e52831e996a9347e)

14 months agofreebsd-update: use grep -E instead of egrep
Ed Maste [Thu, 2 Mar 2023 23:54:52 +0000 (18:54 -0500)]
freebsd-update: use grep -E instead of egrep

GNU egrep emits a warning that it is obsolescent and suggests grep -E
instead.  Switch to grep -E in case we end up invoking GNU (e)grep (and
for consistency with other invocations in this file).

Reported by: Steffen Nurpmeso
Approved by: re (cperciva)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e27ded83c76a609687a3d9e82b80fe7e1b782bf6)
(cherry picked from commit b562307b70346030f59fe6a05d125814c74da47b)

14 months agomergemaster: add deprecation notice to man page
Ed Maste [Wed, 22 Jan 2020 21:04:03 +0000 (16:04 -0500)]
mergemaster: add deprecation notice to man page

PR: 252417
Reviewed by: bapt, gjb, kevans (all earlier)
Approved by: re (cperciva)
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23327

(cherry picked from commit 398b12691b4f1e7a73afca4c051c182bfcaf9671)
(cherry picked from commit ab53efd14237b71c3c0e4e212ada6526ef14402c)

14 months agoEnsure .inc files are regenerated when llvm/clang tblgen binaries change
Dimitry Andric [Sat, 25 Feb 2023 15:25:57 +0000 (16:25 +0100)]
Ensure .inc files are regenerated when llvm/clang tblgen binaries change

When doing a fully incremental build (with WITHOUT_CLEAN enabled), from
a commit before llvm 15 was merged (3264f6b88fce), to a commit after
that, a number of .inc files were not regenerated. This could lead to
unexpected compilation errors when these .inc files were included from
llvm-project sources, similar to:

  In file included from /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp:8268:
  /usr/obj/usr/src/amd64.amd64/lib/clang/libclang/clang/Basic/arm_mve_builtin_cg.inc:279:18: error: no matching constructor for initialization of 'clang::CodeGen::Address'
    Address Val2 = Address(Val1, CharUnits::fromQuantity(2));
                   ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Work around this by making the .inc files dependent on the tblgen binary
used for generating them. E.g., we can relatively safely assume that if
the binary gets updated, the .inc files must also be updated. (Although
this is not 100% optimal, the gain by complicating things even more is
probaby not worth the effort.)

Approved by: re (cperciva)
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38770

(cherry picked from commit ab80f0b21fbb9c44d40e6f7a99090188f4ed2f71)
(cherry picked from commit 3912f99ecae61dc7fe89c076a654332e3adb1bdc)

14 months ago13.2: update to RC1
Colin Percival [Fri, 3 Mar 2023 00:01:05 +0000 (16:01 -0800)]
13.2: update to RC1

Approved by: re (implicit)
Sponsored by: https://www.patreon.com/cperciva

14 months agofreebsd-update: avoid effects of user's environment on grep
Ed Maste [Wed, 14 Dec 2022 17:13:19 +0000 (12:13 -0500)]
freebsd-update: avoid effects of user's environment on grep

A user had GREP_OPTIONS containing --color=always, which broke grep use
in freebsd-update.  Unset this environment variable.

PR: 255990
Reviewed by: kevans
Approved by: re (cperciva)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e093c61b2d69e9cca54a2332096c0e36f97bffc0)
(cherry picked from commit 24fe8a518324e291b9ea3fe4e60f2e0fb4f857c5)

14 months agofreebsd-update: re-edit files if merge conflict markers remain
Ed Maste [Wed, 14 Dec 2022 17:34:59 +0000 (12:34 -0500)]
freebsd-update: re-edit files if merge conflict markers remain

freebsd-update will open ${EDITOR} if conflicts occur while merging
updates to config files.  Inform the user if they've left conflict
markers behind, and go back to editing the file.

PR: 185546
PR: 229689
Reviewed by: delphij
Approved by: re (cperciva)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37703

(cherry picked from commit ceb5f28ba5fcfa69de7410d2327d4a5abf2a421f)
(cherry picked from commit c7e3703352037a5afacdc4126725f351fe7da72b)

14 months agoRemove an extra argument to SYSCTL_FOREACH
Andrew Turner [Wed, 5 Oct 2022 09:27:48 +0000 (10:27 +0100)]
Remove an extra argument to SYSCTL_FOREACH

This was missed in e0853c933661.

Approved by: re (cperciva, delphij)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit fbc9f1b2d6cf90c02b918671fb7791cf36472cfd)
(cherry picked from commit f36ca798c42960383e0ff9612e56eb20c796cf04)

14 months agolinprocfs(4): Fixup process size in the /proc/pid/stat file
Dmitry Chagin [Sun, 26 Feb 2023 13:42:22 +0000 (16:42 +0300)]
linprocfs(4): Fixup process size in the /proc/pid/stat file

According to the Linux sources the kernel exposes a proces virtual
memory size via proc filesystem into the three files - stat, status
and statm. This is the struct mm->total_vm value adjusted to the
corresponding units - bytes, kilobytes and pages.

The fix is based on a fernape@ analysis.

Approved by: re (delphij)
PR: 265937
Reported by: Ray Bellis
MFC after: 3 days

(cherry picked from commit a55b5a9aed3981fcec205e246436991d138c78a2)
(cherry picked from commit 867e8404efed7a33553646b89588831db1a2102b)

14 months agossh: default VerifyHostKeyDNS to no, following upstream
Ed Maste [Fri, 17 Feb 2023 01:26:41 +0000 (20:26 -0500)]
ssh: default VerifyHostKeyDNS to no, following upstream

Revert to upstream's default.  Using VerifyHostKeyDNS may depend on a
trusted nameserver and network path.

This reverts commit 83c6a5242c80160fff76fb85454938761645b0c4.

Reported by: David Leadbeater, G-Research
Reviewed by: gordon
Approved by: re (delphij)
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38648

(cherry picked from commit 41ff5ea22cb95deb9e7415510eb2f5f00b91537a)
(cherry picked from commit 43fd77233cd49061839cfdd936cfeba53e9855c3)

14 months agoapic: prevent divide by zero in CPU frequency init
Mina Galić [Tue, 28 Feb 2023 02:58:45 +0000 (19:58 -0700)]
apic: prevent divide by zero in CPU frequency init

If a CPU for some reason returns 0 as CPU frequency, we currently panic
on the resulting divide by zero when trying to initialize the CPU(s) via
APIC. When this happens, we'll fallback to measuring the frequency
instead.

PR: 269767
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/664
Approved by: re@ (cperciva)

(cherry picked from commit 499171a98c8813e4dc6e085461d5c47750efa555)
(cherry picked from commit a1c63b8e29e832d9ada7c252e7e80ce8b94aeb41)

14 months agostand: fix build userboot without zfs
Michael Paepcke [Tue, 28 Feb 2023 02:58:03 +0000 (19:58 -0700)]
stand: fix build userboot without zfs

Fix regression in building userboot -DWITHOUT_LOADER_ZFS

Fixes: e307eb94ae520
MFC After: 3 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/665
Approved by: re@ (cperciva)

(cherry picked from commit 4d59545d0cacb5881e2515eecce15e8478f07276)
(cherry picked from commit 3464fc5f2a3376b4cd5612f1ee0986072b4a65f3)

14 months agoDelete obsolete Solaris compat header file stdlib.h
Zhenlei Huang [Thu, 23 Feb 2023 18:00:09 +0000 (02:00 +0800)]
Delete obsolete Solaris compat header file stdlib.h

This drops function `getexecname()` redirection.

Historically `getexecname()` is a compatibility definition. Since
openzfs has its own implementation of function `getexecname()` in libspl
and has been merged into base, the compat header file stdlib.h is
no longer needed and should not be used.

Also without this fix libspl will end up an incompatible version of
`getprogname()` with libc. In particular, if zfs is enabled, programs
such as pgrep in /rescue can be wrongly statically linked with libspl
and will not function properly.

PR: 269738
Reviewed by: markj
Approved by: re (delphij)
Fixes: 9e5787d2284e Merge OpenZFS support in to HEAD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38733

(cherry picked from commit 7f0ebf0876c82a098bd5815ea6bf3a8efa6dd6f3)
(cherry picked from commit 95f418fe2a0fb96080afbd2afc160929a32d12fb)

14 months agoctfdump: Use getprogname()
Zhenlei Huang [Thu, 23 Feb 2023 16:28:35 +0000 (00:28 +0800)]
ctfdump: Use getprogname()

Also remove no longer used function `getpname()`.

Reviewed by: markj
Approved by: re (delphij)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38740

(cherry picked from commit 3dd5524264095ed8612c28908e13f80668eff2f9)
(cherry picked from commit 994eb2fb8a901c883f2bd24fa29c6cd513cb4340)

ctf: Remove unused function prototype for getpname()

(cherry picked from commit f8e1aa85fed08d5f689cb36d65a76d191f6500dd)
(cherry picked from commit eba26d0ba37e647572b3ec285352f778ef0ec9f0)

14 months agonetlink: make the maximum allowed netlink socket buffer runtime tunable.
Alexander V. Chernikov [Mon, 27 Feb 2023 10:44:54 +0000 (10:44 +0000)]
netlink: make the maximum allowed netlink socket buffer runtime tunable.

Dumping large routng tables (>1M paths with multipath) require the socket
 buffer which is larger than the currently defined limit.
Allow the limit to be set in runtime, similar to kern.ipc.maxsockbuf.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 1 day
Approved by: re(cperciva)

(cherry picked from commit 28a5d88f7091d1fc72f4f1bd8562d3c8b15883f5)
(cherry picked from commit b656161b84dce0322ab00d7958267fa47cda6318)

14 months agosrc.conf: regen man page for settings on release branch
Ed Maste [Wed, 1 Mar 2023 16:09:06 +0000 (11:09 -0500)]
src.conf: regen man page for settings on release branch

Approved by: re (cperciva)
Sponsored by: The FreeBSD Foundation

14 months agosrc.conf: regen man page
Ed Maste [Tue, 28 Feb 2023 21:42:53 +0000 (16:42 -0500)]
src.conf: regen man page

This hadn't been regenerated on the stable branch after some MFCs.

Approved by: re (cperciva)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 242ef804209cce56cb9689283a5d4507a3714fce)

14 months agounbound: Fix config file path
Juraj Lutter [Tue, 17 Jan 2023 17:25:47 +0000 (18:25 +0100)]
unbound: Fix config file path

Commit 1838dec31895fd4752fa8631322ab93be0705a66 changed the
config file path to /usr/local/etc/unbound/unbound.conf which
is wrong for unbound in base.

Reported by: Ihor Antonov <ihor_AT_antonovs_family>
Approved by: re (cperciva)
Reviewed by: zlei
Approved by: zlei
Differential Revision: https://reviews.freebsd.org/D38106

Fixes: 1838dec31895fd4752fa8631322ab93be0705a66
(cherry picked from commit 1d577bedbae80ced38ccb834e6835e5fd98bc411)
(cherry picked from commit e0c3f2a1e2961b5e4813399bf2a4bea467d2c301)

14 months agounbound: Fix config.h
Cy Schubert [Sun, 15 Jan 2023 06:55:05 +0000 (22:55 -0800)]
unbound: Fix config.h

FreeBSD src does not support HAVE_DECL_EVSIGNAL_ASSIGN. While reviewing
the new config.h after regenerating it, this definition was not removed.

Updating config.h is a manual process of configuring the port and
copying/merging the generated config.h into src. This definition was
missed and not removed (#undef'd).

Approved by: re (cperciva)
Fixes: 1838dec31895fd4752fa8631322ab93be0705a66

(cherry picked from commit 06b93ef8cda227d755d7f6cfa95d08c0ccc9dc2d)
(cherry picked from commit 9f9f2a1270c510b33e1e50b1bac09ebe10bbb974)

14 months agounbound: Vendor import 1.17.1
Cy Schubert [Sun, 15 Jan 2023 05:39:31 +0000 (21:39 -0800)]
unbound: Vendor import 1.17.1

Release notes at
    https://www.nlnetlabs.nl/news/2023/Jan/12/unbound-1.17.1-released/.

Approved by: re (cperciva)

Merge commit '7699e1386a16236002b26107ffd2dcbde375e197' into main

(cherry picked from commit 1838dec31895fd4752fa8631322ab93be0705a66)
(cherry picked from commit 26ba9518ffeccd0b64d2f610e731989193844814)

14 months agoping: Fix unsigned integer underflow resuling in a ping -R segfault
Cy Schubert [Thu, 23 Feb 2023 05:43:17 +0000 (21:43 -0800)]
ping: Fix unsigned integer underflow resuling in a ping -R segfault

ping -R (F_RROUTE) will loop at ping.c:1381 until it segfaults or
the unsigned int hlen happens to be less than the size of an IP header:

slippy$ ping -R 192.168.0.101
PING 192.168.0.101 (192.168.0.101): 56 data bytes
64 bytes from 192.168.0.101: icmp_seq=0 ttl=63 time=1.081 ms
RR:  192.168.0.1
192.168.0.101
192.168.0.101
10.1.1.254
10.1.1.91
unknown option bb
unknown option 32
unknown option 6
...
unknown option 96
unknown option 2d
Segmentation fault

The reason for this is while looping through loose source routing (LSRR)
and strict source routing (SSRR), hlen will become smaller than the IP
header. It may even become negative. This should terminate the loop.
However, when hlen is unsigned, an integer underflow occurs becoming a
large number causing the loop to continue virtually forever until hlen
is either by chance smaller than the lenghth of an IP header or it
segfaults.

Approved by: re (cperciva)
Reviewed by: asomers
Fixes: 46d7b45a267b
Differential Revision: https://reviews.freebsd.org/D38744

(cherry picked from commit 70960bb86a3ba5b6f5c4652e613e6313a7ed1ac1)
(cherry picked from commit 18936d3526f3090e4164b8155762bf5bd54038a8)

14 months agoUpdate leap-seconds to latest leap-seconds.3676924800 (expires 2023-12-28)
Dimitry Andric [Fri, 24 Feb 2023 12:17:16 +0000 (13:17 +0100)]
Update leap-seconds to latest leap-seconds.3676924800 (expires 2023-12-28)

Approved by: re (cperciva)
Obtained from: ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.3676924800
MFC after: 3 days

(cherry picked from commit df2fbbfa71b8ecc9e9e75ce85a635aade9c691cb)
(cherry picked from commit 0196b0944430916d5aaf0bb87571626b391c3138)

14 months agolinux(4): Fixup the interface name translation in netlink
Dmitry Chagin [Thu, 23 Feb 2023 08:01:18 +0000 (11:01 +0300)]
linux(4): Fixup the interface name translation in netlink

Netlink should translate a FreeBSD interface name to a Linux
interface name.

Approved by: re (cperciva)
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38715
MFC after: 3 days

(cherry picked from commit e55e4a6ba3f4cd31d47b74574ea7370d5ab14b48)
(cherry picked from commit 123ca9ab11896f356245537ee41207fb6943fccd)

14 months agolinux(4): Consolidate a FreeBSD interface names translation code
Dmitry Chagin [Thu, 23 Feb 2023 08:00:29 +0000 (11:00 +0300)]
linux(4): Consolidate a FreeBSD interface names translation code

We have some amount of interface names translation functions which are
differs by bugs implementation. Consolidates it in a one place.

Fixup loopback interface names translation and use ifnet methods and
accessors, where possible.

Approved by: re (cperciva)
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38714
MFC after: 3 days
X-MFC with: 32fdc75fe7

(cherry picked from commit 3ab3c9c29cf0e5df8dbbaaf2003456445534bad8)
(cherry picked from commit a83551a52d1cfa8a756ef8dd298cab8042e27437)

14 months agolinux(4): Move use_real_names knob to the linux.c
Dmitry Chagin [Tue, 14 Feb 2023 14:46:32 +0000 (17:46 +0300)]
linux(4): Move use_real_names knob to the linux.c

MI linux.[c|h] are the module independent in terms of the Linux emulation
layer (ie, intended for both ISA - 32 & 64 bit), analogue of MD linux.h.
There must be a code here that cannot be placed into the corresponding by
common sense MI source and header files, i.e., code is machine independent,
but ISA dependent.
For the use_real_names knob, the code must be placed into the
linux_socket.[c|h], however linux_socket is ISA dependent.

Approved by: re (cperciva)
MFC after: 2 weeks

(cherry picked from commit 32fdc75fe7276083d446964055b0de0e29970b7c)
(cherry picked from commit 884ea80d4ebbd2d8ff03d56eddc1dc64d49be908)

14 months agoRevert "netlink: add NETLINK to GENERIC."
Alexander V. Chernikov [Mon, 27 Feb 2023 15:43:41 +0000 (15:43 +0000)]
Revert "netlink: add NETLINK to GENERIC."

This is a Direct commit to releng/13.2.

Requested by: re (cperciva)
Approved by: re (cperciva)

This reverts commit 6058f6cc48f5ec02476bf46693673bd71291a5c0.
This reverts commit 692e19cf519578176d51d4c1001b01b1f355c1de.

14 months agonetlink: fix addition of blackhole/reject routes.
Alexander V. Chernikov [Thu, 23 Feb 2023 17:38:18 +0000 (17:38 +0000)]
netlink: fix addition of blackhole/reject routes.

* Make nhop_set_blackhole() set all necessary properties for the
 nexthop
* Make nexthops blackhole/reject based on the rtm_type netlink
 property instead of using rtflags.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 3 days
Approved by: re(cperciva)

(cherry picked from commit d2deebe21b591336fbd8915b37d409b25da54d4d)
(cherry picked from commit f054a56ef3e8dc30ba0904d43cf7ec7b3e6e0ed4)

14 months agonetlink: clear IPv6 embedded scope when dumping route gateways.
Alexander V. Chernikov [Tue, 21 Feb 2023 12:25:58 +0000 (12:25 +0000)]
netlink: clear IPv6 embedded scope when dumping route gateways.

Reported by: zarychtam@plan-b.pwste.edu.pl
MFC after: 3 days
Approved by: re(cperciva)

(cherry picked from commit b9b2184322da85e1f4d52e3b0a6322dd214210ec)
(cherry picked from commit d101991d8dcc1e056d1c06ca83b88826f4d65ae5)

14 months agonetlink: fix IPv6 route addition with link-local gateway
Alexander V. Chernikov [Mon, 20 Feb 2023 14:24:01 +0000 (14:24 +0000)]
netlink: fix IPv6 route addition with link-local gateway

Currently kernel assumes that IPv6 gateway address is in "embedded"
 form - that is, for the link-local IPv6 addresses, interface index
 is embedded in bytes 2 and 3 of the address.
Fix address embedding in netlink by wrapping nhop_set_gw() in the
 netlink-specific nl_set_nexthop_gw(), which does such embedding
 automatically.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 3 days
Approved by: re(cperciva)

(cherry picked from commit c7c348162101a70b1f99299578dabe1d3b100e48)
(cherry picked from commit 240ee0183fa190502a5e1f163c49f336f8f10cd4)

14 months agovm_fault: Fix a race in vm_fault_soft_fast()
Mark Johnston [Mon, 13 Feb 2023 21:24:40 +0000 (16:24 -0500)]
vm_fault: Fix a race in vm_fault_soft_fast()

When vm_fault_soft_fast() creates a mapping, it release the VM map lock
before unbusying the top-level object.  Without the map lock, however,
nothing prevents the VM object from being deallocated while still busy.

Fix the problem by unbusying the object before releasing the VM map
lock.  If vm_fault_soft_fast() fails to create a mapping, the VM map
lock is not released, so those cases don't need to change.

Approved by: re (cperciva)
Reported by: syzkaller
Reviewed by: kib (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38527

(cherry picked from commit d0991948182a1a149ee84f1b9c4d3e30450c8f0b)
(cherry picked from commit 2f57ef2d3b8f776a28e195cd780a3bb4924570be)

15 months ago13.2: update to BETA3
Colin Percival [Fri, 24 Feb 2023 07:50:45 +0000 (23:50 -0800)]
13.2: update to BETA3

Approved by: re (implicit)
Sponsored by: https://www.patreon.com/cperciva

15 months agoLinuxKPI: return an address string in pci_name()
Val Packett [Mon, 6 Feb 2023 21:50:13 +0000 (21:50 +0000)]
LinuxKPI: return an address string in pci_name()

amdgpu's virtual display feature uses pci_name() to match a module parameter
string, and the documentation shows an example of `0000:26:00.0` for the name.
In our case the name was just `drmn`, which is not actually unique across
devices.

The other consumers are wireless drivers, which will benefit from this
change.

Generate the expected string for pci_name() to return.

Related to: https://github.com/freebsd/drm-kmod/issues/134
Sponsored by: https://www.patreon.com/valpackett
Reviewed by: bz, hselasky, manu (earlier)
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D34248

(cherry picked from commit 393b0ba25f1a54dcc3f94244933c665f1c471d1a)
(cherry picked from commit 30960c51e646c51134fcb72e0adc881f36a41c38)

15 months agoLinuxKPI: pci: add more functions
Bjoern A. Zeeb [Sat, 28 Jan 2023 15:02:51 +0000 (15:02 +0000)]
LinuxKPI: pci: add more functions

Add a dummy pci_assign_resource() and an implementation of
pci_irq_vector() returning the irq for MSI-X, MSI, and legacy interrupt.
Both are needed by wirless drivers.

Sponsored by: The FreeBSD Foundation
Reviewed by: jhb
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D38237

(cherry picked from commit fd1a2f3dfc0e8fb20d0d397d586000bb918aab47)
(cherry picked from commit 7b65e6f377ca0005a986c59f1e31a0421d92660f)

15 months agoLinuxKPI: PCI: implement support for more than 1 MSI vector
Bjoern A. Zeeb [Fri, 27 Jan 2023 15:34:42 +0000 (15:34 +0000)]
LinuxKPI: PCI: implement support for more than 1 MSI vector

Following e9715b1c4474333ff119aba3a9a74bff91f72372 and
4b56afaf7bf4fa37bae5b26fd93ee1ff5969c1bb, implement support
for up-to 32 MSI vectors.  This is used by wireless drivers.
This also switches msi_desc to an array in order to store
per-vector information.

Sponsored by: The FreeBSD Foundation
Discussed with: grehan (in Dec)
Reviewed by: jhb
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D38222

(cherry picked from commit b15491b4773af99ce2470144ef6bcd9146cc9a98)
(cherry picked from commit 03a85378b81fcaffae5f8efdd75e2b8e10094e6a)

15 months agoLinuxKPI: implement irq_get_msi_desc()
Bjoern A. Zeeb [Mon, 28 Nov 2022 18:27:03 +0000 (18:27 +0000)]
LinuxKPI: implement irq_get_msi_desc()

Add irq_get_msi_desc() as a wrapper around a PCI function which will
allocate a single cached value (see comment on struct) for the
msi_desc requested if it doesn't exist yet and handle freeing it
when the PCI device goes away.  We take the values from the ivars of
the native (FreeBSD) device.

While changing struct pci_dev also add the msi_cap field requested by
a wireless driver.

Reviewed by: hselasky (earlier version)
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D37523

(cherry picked from commit 4b56afaf7bf4fa37bae5b26fd93ee1ff5969c1bb)
(cherry picked from commit 7d23664b35a2611dc4fea56f7cfd2b99f91626a0)

15 months agoLinuxKPI: 802.11: basic implementation of *queue(s)/*txq*
Bjoern A. Zeeb [Tue, 31 Jan 2023 16:17:14 +0000 (16:17 +0000)]
LinuxKPI: 802.11: basic implementation of *queue(s)/*txq*
LinuxKPI: 802.11: deal with stopped queues

Very basic implementations of ieee80211_{wake,stop}_queue[s],
as well as ieee80211_txq_schedule_start(), ieee80211_next_txq(),
and ieee80211_schedule_txq().
Various combinations of these are used by different wireless
drivers, incl. iwlwifi.

Following 5a9a0d7803382321b5f9fff1deae5fb08463cf1a initialize the
queue values explicitly and deal with a stopped queue in
ieee80211_tx_dequeue().

Sponsored by: The FreeBSD Foundation (parts of this work)
Approved by: re (cperciva)

(cherry picked from commit 5a9a0d7803382321b5f9fff1deae5fb08463cf1a)
(cherry picked from commit 0cbcfa1964de89cd346ee6f79437c6ab83a3b716)
(cherry picked from commit 9f9d047405778b2d2aca829a2037532b8ae8ed5d)

15 months agoLinuxKPI: 802.11: fix indent in lkpi_wake_tx_queues()
Bjoern A. Zeeb [Tue, 31 Jan 2023 23:12:30 +0000 (23:12 +0000)]
LinuxKPI: 802.11: fix indent in lkpi_wake_tx_queues()

Fix indentation in lkpi_wake_tx_queues().
No functional changes.

Sponsored by: The FreeBSD Foundation
Approved by: re (cperciva)

(cherry picked from commit b0ddb44fd427d44b8153781ce9c461e393771aff)
(cherry picked from commit 9e782bfab9042aed12c36746534b1e4e4ec6d597)

15 months agoLinuxKPI: 802.11: enhance lkpi_scan_ies_add() for HT and VHT
Bjoern A. Zeeb [Tue, 31 Jan 2023 23:00:28 +0000 (23:00 +0000)]
LinuxKPI: 802.11: enhance lkpi_scan_ies_add() for HT and VHT

Add code (currently disabled by #ifdef) for HT and VHT to
lkpi_scan_ies_add().  Switch to a local variable for ic given
the new code also needs the value.

Sponsored by: The FreeBSD Foundation
Approved by: re (cperciva)

(cherry picked from commit 3dd980267f4e53df259eb6d322e7332a8bc5bb0a)
(cherry picked from commit 28fbc0caa49b0fb119cc34a704d5437d63f479a3)

15 months agoLinuxKPI: 802.11: implement ieee80211_is_pspoll()
Bjoern A. Zeeb [Tue, 31 Jan 2023 16:36:24 +0000 (16:36 +0000)]
LinuxKPI: 802.11: implement ieee80211_is_pspoll()

Implement ieee80211_is_pspoll() and move it up to the set of implemented
ieee80211_is_*() functions.

There are no further changes (git diff just looks weird).

Sponsored by: The FreeBSD Foundation
Approved by: re (cperciva)

(cherry picked from commit ff76cbc81d57ffc4bbc9bc20fd22325b2a8c2028)
(cherry picked from commit 2336248a8ba9763ad38074db40f32e117edd86f5)
(cherry picked from commit 16dc23caf17f8ffa21e365a1f2fe1a72d7fecbe8)

15 months agoLinuxKPI: 802.11: implement ieee80211_tx_status_ext()
Bjoern A. Zeeb [Tue, 31 Jan 2023 15:35:59 +0000 (15:35 +0000)]
LinuxKPI: 802.11: implement ieee80211_tx_status_ext()

Add an implementation of ieee80211_tx_status_ext() extending the
internal linuxkpi_ieee80211_tx_status() implementation.

Sponsored by: The FreeBSD Foundation
Approved by: re (cperciva)

(cherry picked from commit a839757109891573123d8777b539fafa2d2198bb)
(cherry picked from commit df109ed24233e367ef7060a25ab1b55e2afcddc8)

15 months agoLinuxKPI: 802.11: extend linuxkpi_ieee80211_rx()
Bjoern A. Zeeb [Tue, 31 Jan 2023 15:05:30 +0000 (15:05 +0000)]
LinuxKPI: 802.11: extend linuxkpi_ieee80211_rx()

Extend linuxkpi_ieee80211_rx() by another argument for
the ieee80211_rx_list() implementation (even though the argument
is currently ignored).

Sponsored by: The FreeBSD Foundation
Approved by: re (cperciva)

(cherry picked from commit e30e05d3ab3979a148068235298e1a6f73b675f0)
(cherry picked from commit e420c65378a04c5b9cde34013cab78188bc5a4c2)

15 months agoLinuxKPI: 802.11: fix types and whitespace
Bjoern A. Zeeb [Tue, 31 Jan 2023 13:39:04 +0000 (13:39 +0000)]
LinuxKPI: 802.11: fix types and whitespace

Correct struct member types, fix whitespace, and remove superfluous
return statements in void functions.

No functional changes.

Sponsored by: The FreeBSD Foundation
Approved by: re (cperciva)

(cherry picked from commit a3baca22d0b7789a040a60f389e3c132b6e1755b)
(cherry picked from commit d282e777d7c9721614f110a1de66c7d88d0a6ea8)

15 months agoLinuxKPI: skbuff: implement skb_free_frag()
Bjoern A. Zeeb [Sat, 28 Jan 2023 15:33:12 +0000 (15:33 +0000)]
LinuxKPI: skbuff: implement skb_free_frag()

Using the work from 55038a6306a570c9f2df89f5ad076de0f7d98152 implement
skb_free_frag() calling page_frag_free().

Sponsored by: The FreeBSD Foundation
Approved by: re (cperciva)

(cherry picked from commit dbbf46ebba78770c2c3a1d7983e92e79ca67abc0)
(cherry picked from commit 8a6a4122e6dd91489e48de50a3080f82d00e8715)

15 months agoLinuxKPI: add more dummy header files
Bjoern A. Zeeb [Sun, 29 Jan 2023 18:16:00 +0000 (18:16 +0000)]
LinuxKPI: add more dummy header files

Add more empty header files wireless drivers try to include but
we do not (yet) need for any implementation.

Sponsored by: The FreeBSD Foundation
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D38271

(cherry picked from commit 52c28b99034bd32c86e6c058f68cfbf11c8f76c3)
(cherry picked from commit 8a091335fc63c86b80704abf58055f53c0621740)

15 months agoLinuxKPI: pm.h: add dummy pm_wakeup_event()
Bjoern A. Zeeb [Sat, 28 Jan 2023 15:53:03 +0000 (15:53 +0000)]
LinuxKPI: pm.h: add dummy pm_wakeup_event()

Add a dummy implementation of pm_wakeup_event() which is used to notify
the power management system about a wakeup (which we currently do not
implement yet).

Sponsored by: The FreeBSD Foundation
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D38239

(cherry picked from commit 934cb7a3316609380fdea8da73233759f6dfff43)
(cherry picked from commit fbc5dea2a3af8edf1f22603605f78fe9f9b71494)

15 months agoLinuxKPI: device: add device_set_wakeup_enable()
Bjoern A. Zeeb [Sat, 28 Jan 2023 15:18:24 +0000 (15:18 +0000)]
LinuxKPI: device: add device_set_wakeup_enable()

Add a dummy device_set_wakeup_enable() which is used for WoWLAN which we
do not (yet) support and device_wakeup_enable() which is a wrapper to the
former with the enable argument being true.

Sponsored by: The FreeBSD Foundation
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D38238

(cherry picked from commit ffdf10fb9cf13464801f2d78d3e1470201394812)
(cherry picked from commit b45e9a172d3830bed00018325eaa73c04a0b3a13)