]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 weeks agoMerge branch 'releng/13.2' into releng-CDN/13.2 releng-CDN/13.2
Merge Robot [Thu, 28 Mar 2024 05:15:57 +0000 (00:15 -0500)]
Merge branch 'releng/13.2' into releng-CDN/13.2

4 weeks agoAdd UPDATING entries and bump the branch version. releng/13.2
Gordon Tetlow [Thu, 28 Mar 2024 03:08:55 +0000 (20:08 -0700)]
Add UPDATING entries and bump the branch version.

Approved by:    so

4 weeks agounbound: Vendor import 1.19.1
Cy Schubert [Tue, 19 Sep 2023 04:17:09 +0000 (21:17 -0700)]
unbound: Vendor import 1.19.1

Release notes at
    https://www.nlnetlabs.nl/news/2024/Feb/13/unbound-1.19.1-released/

Security: CVE-2023-50387, CVE-2023-50868
Security: FreeBSD-SA-24:03.unbound
Approved by:    so

(cherry picked from commit 8f76bb7dad48538c6832c2fb466a433d2a3f8cd5)
(cherry picked from commit 4f4adb0576dfbcd0d956db0146c9de7e1bb71563)
(cherry picked from commit 948e11aaf420cd7d493cc2e118cacc06d18653fe)
(cherry picked from commit f5a091c1f6a068cdc5c3bd23536830de9dfe7b84)
(cherry picked from commit 6e71235e558ef579605e7f35b02f983b9a246a4a)
(cherry picked from commit 64ac3bca3a6ec8510ae7175cbdd73aa594756e2a)
(cherry picked from commit 103ba509e72e3949d22485666949e9705d4af8cd)
(cherry picked from commit 2bdab519a5c9822571d005c62adec484cf65c2e7)
(cherry picked from commit 5aab39b24ce7437265b94461ffdd9b12c0723658)
(cherry picked from commit a077e95570d9cef9882be688dc28303b6257cfd0)
(cherry picked from commit 67267734315c6a48db31697f0a0669fa1f985969)
(cherry picked from commit 17b51a12dca08f5126600e11181cee9454884e02)
(cherry picked from commit b76ef9a7cb8a7c62d10ae8101f41014f34819174)
(cherry picked from commit abe4ced2b9de0a3dd44d7e2068cfd7fa2b428c16)

4 weeks agoif_wg: use proper barriers around pkt->p_state
Kyle Evans [Fri, 15 Mar 2024 01:19:18 +0000 (20:19 -0500)]
if_wg: use proper barriers around pkt->p_state

Without appropriate load-synchronization to pair with store barriers in
wg_encrypt() and wg_decrypt(), the compiler and hardware are often
allowed to reorder these loads in wg_deliver_out() and wg_deliver_in()
such that we end up with a garbage or intermediate mbuf that we try to
pass on.  The issue is particularly prevalent with the weaker
memory models of !x86 platforms.

Switch from the big-hammer wmb() to more explicit acq/rel atomics to
both make it obvious what we're syncing up with, and to avoid somewhat
hefty fences on platforms that don't necessarily need this.

With this patch, my dual-iperf3 reproducer is dramatically more stable
than it is without on aarch64.

PR: 264115
Reviewed by: andrew, zlei
Approved by: so
Security: FreeBSD-EN-24:06.wireguard

(cherry picked from commit 3705d679a6344c957cae7a1b6372a8bfb8c44f0e)
(cherry picked from commit 806e51f81dbae21feb6e7ddd95d2ed2a28b04f8f)

4 weeks agokern: fix panic with disabled ttys
Ed Maste [Mon, 26 Feb 2024 15:38:45 +0000 (10:38 -0500)]
kern: fix panic with disabled ttys

PR: 277240, 277329
Reviewed by: kib (earlier version)
Fixes: f1d0a0cbecf2 ("jail: Fix information leak.")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44086
Approved by: so
Security: FreeBSD-EN-24:05.tty

(cherry picked from commit 975d7730828a8bde28c2a0092b6e95c4c4e22f34)
(cherry picked from commit 8d22744f5be165a2a82a2a204789e44bbdc5a2ee)
(cherry picked from commit a60220bbb5511469fe53fd4290713ba891f8f48a)

2 months agoMerge branch 'releng/13.2' into releng-CDN/13.2
Merge Robot [Thu, 15 Feb 2024 06:15:56 +0000 (00:15 -0600)]
Merge branch 'releng/13.2' into releng-CDN/13.2

2 months agorc.conf: correct $ntp_leapfile_sources
Philip Paeps [Thu, 7 Dec 2023 05:48:13 +0000 (13:48 +0800)]
rc.conf: correct $ntp_leapfile_sources

IETF is no longer serving leap-seconds.list.  Update to the canonical place.

This fixes "service ntpd fetch".

IERS is the source of truth for leap seconds. Their leapsecond file is
updated most quickly and is always right (unlike the IANA one which
often lags). IERS operates this public service for the express purpose
of random people downloading it. Their terms of service are compatible
with open source (we could include this in our release). Rather than
fighting with questions around this because the IANA one changed
locations or the auto update script broken, just use this.

This is in preference to the NIST ftp copy. NIST is in the process of
retiring their FTP services.

Sponsored by: Netflix
Reviewed by: philip, delphij, cy
Differential Revision: https://reviews.freebsd.org/D43752

(cherry picked from commit b1c95af45488bef649e9a84890e2414ff80b3a00)
(cherry picked from commit 74a8c6da4f28e691c169aa502713a5aaebc00584)
(cherry picked from commit 11da791920ba285f0832f09cb504ac81e35ff8d1)
(cherry picked from commit 0eea8292ae8c8e9119520ce54aa82cae491d83b9)

Security:       FreeBSD-EN-24:01.tzdata
Approved by:    so (gordon)

2 months agoperiodic/daily/480.leapfile-ntpd: only attempt to refresh leap-seconds.list
Xin LI [Sun, 3 Dec 2023 07:00:32 +0000 (23:00 -0800)]
periodic/daily/480.leapfile-ntpd: only attempt to refresh leap-seconds.list
when ntpd is enabled.

The leap-seconds.list is used exclusively by ntpd, therefore, do not bother
to perform the fetch when ntpd is not enabled.

PR: conf/275419
Reviewed by: cy, michaelo, imp
Differential Revision: https://reviews.freebsd.org/D42875

(cherry picked from commit 3b3195f6767b39eb33b3523134ef988931c9c86d)
(cherry picked from commit 3ef596c6e80562710da09c16558d7351749ea143)

Security:       FreeBSD-EN-24:01.tzdata
Approved by:    so (gordon)

2 months agoMerge branch 'releng/13.2' into releng-CDN/13.2
Merge Robot [Wed, 14 Feb 2024 06:15:47 +0000 (00:15 -0600)]
Merge branch 'releng/13.2' into releng-CDN/13.2

2 months agoAdd UPDATING entries and bump the branch version.
Gordon Tetlow [Wed, 14 Feb 2024 06:03:19 +0000 (22:03 -0800)]
Add UPDATING entries and bump the branch version.

Approved by: so

2 months agojail: Fix information leak.
Pawel Jakub Dawidek [Wed, 17 Jan 2024 17:43:55 +0000 (09:43 -0800)]
jail: Fix information leak.

There is a lack of proper visibility checking in kern.ttys sysctl handler
which leads to information leak about processes outside the current jail.

This can be demonstrated with pstat -t: when called from within a jail,
it will output all terminal devices including process groups and
session leader process IDs:

jail# pstat -t | grep pts/ | head
      LINE   INQ  CAN  LIN  LOW  OUTQ  USE  LOW   COL  SESS  PGID STATE
     pts/2  1920    0    0  192  1984    0  199     0  4132 27245 Oi
     pts/3  1920    0    0  192  1984    0  199    16 24890 33627 Oi
     pts/5     0    0    0    0     0    0    0    25 17758     0 G
    pts/16     0    0    0    0     0    0    0     0 52495     0 G
    pts/15     0    0    0    0     0    0    0    25 53446     0 G
    pts/17     0    0    0    0     0    0    0  6702 33230     0 G
    pts/19     0    0    0    0     0    0    0    14  1116     0 G
     pts/0     0    0    0    0     0    0    0     0  2241     0 G
    pts/23     0    0    0    0     0    0    0    20 15639     0 G
     pts/6     0    0    0    0     0    0    0     0 44062 93792 G
jail# pstat -t | grep pts/ | wc -l
      85

Devfs does the filtering correctly and we get only one entry:

jail# ls /dev/pts/
2

Approved by: mzaborski, secteam
MFC after: 1 week
Sponsored by: Fudo Security
Approved by: so
Security: FreeBSD-SA-24:02.tty
Security: CVE-2024-25941

(cherry picked from commit f1d0a0cbecf2c688061f35adea85bfb29c9ec893)
(cherry picked from commit a376108029a20f4ce51476d98f2483a7008ce7b5)

(cherry picked from commit 41ac0b4ce00bae061164384f23356a4df6e0e695)
(cherry picked from commit 9bff7ec98354a76c171905ce9530f85685725ee7)

2 months agobhyveload: use a dirfd to support -h
Kyle Evans [Wed, 3 Jan 2024 22:17:59 +0000 (16:17 -0600)]
bhyveload: use a dirfd to support -h

Don't allow lookups from the loader scripts, which in rare cases may be
in guest control depending on the setup, to leave the specified host
root.  Open the root dir and strictly do RESOLVE_BENEATH lookups from
there.

cb_open() has been restructured a bit to work nicely with this, using
fdopendir() in the directory case and just using the fd we already
opened in the regular file case.

hostbase_open() was split out to provide an obvious place to apply
rights(4) if that's something we care to do.

Reviewed by: allanjude (earlier version), markj
Approved by: so
Security: FreeBSD-SA-24:01.bhyveload
Security: CVE-2024-25940

(cherry picked from commit 6779d44bd878e3cf4723f7386b11da6508ab5431)
(cherry picked from commit 78345dbd7a004e0a6d1b717e7dbc758ae67ca293)

2 months agoEVFILT_SIGNAL: do not use target process pointer on detach
Konstantin Belousov [Tue, 28 Nov 2023 12:51:54 +0000 (14:51 +0200)]
EVFILT_SIGNAL: do not use target process pointer on detach

PR: 275286
Approved by: so
Security: FreeBSD-EN-24:03.kqueue

(cherry picked from commit ed410b78edc53e17b5a3e93ace2adbeb3a734ae9)
(cherry picked from commit 55e91944998c128d74b94b9b48a04ef41ff5e9d0)

2 months agosetusercontext(): Apply personal settings only on matching effective UID
Olivier Certner [Tue, 30 May 2023 16:35:08 +0000 (18:35 +0200)]
setusercontext(): Apply personal settings only on matching effective UID

Commit 35305a8dc114 (r211393) added a check on whether 'uid' was equal
to getuid() before calling setlogincontext().  Doing so still allows
a setuid program to apply resource limits and priorities specified in
a user-controlled configuration file ('~/.login_conf') where
a non-setuid program could not.  Plug the hole by checking instead that
the process' effective UID is the target one (which is likely what was
meant in the initial commit).

PR:                     271750
Reviewed by:            kib, des
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40351
Approved by: so
Security: FreeBSD-EN-24:02.libutil

(cherry picked from commit 892654fe9b5a9115815c30a423b8db47185aebbd)

Approved by:    markj (mentor)

(cherry picked from commit 9fcf54d3750e379868e51e4aa7fbf696877ab2ed)

2 months agocontrib/tzdata: import tzdata 2024a
Philip Paeps [Fri, 2 Feb 2024 02:01:39 +0000 (10:01 +0800)]
contrib/tzdata: import tzdata 2024a

Changes: https://github.com/eggert/tz/blob/2024a/NEWS
Approved by: so
Security: FreeBSD-EN-24:01.tzdata

(cherry picked from commit 2723c7ffb7f729a1d3f7c59e7db48b0edf3d30a6)
(cherry picked from commit f4256acec1c980b7d08e9e526be6d2a7c4751f0b)

2 months agocontrib/tzdata: import tzdata 2023d
Philip Paeps [Sat, 23 Dec 2023 01:51:01 +0000 (09:51 +0800)]
contrib/tzdata: import tzdata 2023d

Changes: https://github.com/eggert/tz/blob/2023d/NEWS
Approved by: so
Security: FreeBSD-EN-24:01.tzdata

(cherry picked from commit eebb9c2caea1584773ae4cec311cee1eea5b1655)
(cherry picked from commit 436f43d41cc78aa475015b4618f8787e1ed10000)

4 months agoMerge branch 'releng/13.2' into releng-CDN/13.2
Merge Robot [Wed, 20 Dec 2023 06:15:40 +0000 (00:15 -0600)]
Merge branch 'releng/13.2' into releng-CDN/13.2

4 months agoAdd an UPDATING entry and bump the branch version.
Gordon Tetlow [Tue, 19 Dec 2023 20:18:52 +0000 (12:18 -0800)]
Add an UPDATING entry and bump the branch version.

Approved by: so

4 months agoImplement "strict key exchange" in ssh and sshd.
Gordon Tetlow [Mon, 18 Dec 2023 16:22:22 +0000 (08:22 -0800)]
Implement "strict key exchange" in ssh and sshd.

This adds a protocol extension to improve the integrity of the SSH
transport protocol, particular in and around the initial key exchange
(KEX) phase.

Full details of the extension are in the PROTOCOL file.

OpenBSD-Commit-ID: 2a66ac962f0a630d7945fee54004ed9e9c439f14

Approved by: so (implicit)
Obtained from: https://anongit.mindrot.org/openssh.git/patch/?id=1edb00c58f8a6875fad6a497aa2bacf37f9e6cd5
Security: CVE-2023-48795
Security: FreeBSD-SA-23:19.openssh

(cherry picked from commit 92f58c69a14c0afe910145f177c0e8aeaf9c7da4)
(cherry picked from commit 3bafcb9744c966ff7750357b24fc7942f2d928d4)

4 months agoMerge branch 'releng/13.2' into releng-CDN/13.2
Merge Robot [Wed, 13 Dec 2023 06:15:35 +0000 (00:15 -0600)]
Merge branch 'releng/13.2' into releng-CDN/13.2

4 months agoAdd UPDATING entries and bump the branch version
Mark Johnston [Tue, 12 Dec 2023 19:16:35 +0000 (14:16 -0500)]
Add UPDATING entries and bump the branch version

Approved by: so

4 months agonfsclient: Propagate copyin() errors from nfsm_uiombuf()
Mark Johnston [Tue, 12 Dec 2023 01:04:56 +0000 (20:04 -0500)]
nfsclient: Propagate copyin() errors from nfsm_uiombuf()

Approved by: so
Security: SA-23:18.nfsclient
Reviewed by: rmacklem
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6fa843f6e647a1a1e0e42af1e7abc9e903699f31)
(cherry picked from commit f1d1d50e1d089f0bfcd38e5f08b1e8bf5a1d64c3)

4 months agoMerge branch 'releng/13.2' into releng-CDN/13.2
Merge Robot [Wed, 6 Dec 2023 06:15:37 +0000 (00:15 -0600)]
Merge branch 'releng/13.2' into releng-CDN/13.2

4 months agoAdd UPDATING entries and bump version
Mark Johnston [Tue, 5 Dec 2023 18:29:45 +0000 (13:29 -0500)]
Add UPDATING entries and bump version

Approved by: so

4 months agopf: remove incorrect fragmentation check
Kristof Provost [Wed, 29 Nov 2023 18:06:31 +0000 (19:06 +0100)]
pf: remove incorrect fragmentation check

We do not need to check PFDESC_IP_REAS while tracking TCP state.
Moreover, this check incorrectly considers no-data packets (e.g. RST) to
be in-window when this flag is not set.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Approved by: so
Security: FreeBSD-SA-23:17.pf

(cherry picked from commit 6284d5f76d6bd2d97fe287c5adabf59c79688eda)
(cherry picked from commit ee1d1e38fae65d045b113a7053651bbd7b780e1d)

4 months agocompiler-rt: avoid segfaults when re-exec'ing with ASLR
Dimitry Andric [Wed, 22 Nov 2023 18:23:06 +0000 (19:23 +0100)]
compiler-rt: avoid segfaults when re-exec'ing with ASLR

The ReExec() function that re-executes the binary after
turning off ASLR should not call elf_aux_info(3) and realpath(3), since
these will also be intercepted. Instead, loop directly over the elf aux
info vector to find the executable path, and avoid calling realpath(3)
since it is actually unwanted for this use case.

Fixes: 930a7c2ac67e96fe7c8ab0f6

(cherry picked from commit 4c9a0adad18263ec8725d9bfc5f560c6ad1da8bd)
(cherry picked from commit 7c25a53a2cb975e516cfea78898bfb850db88524)

Note: This is a partial cherry-pick, as only the ReExec change from the
original applies to FreeBSD 13.2.

Security: EN-23:15.sanitizer
Approved by: so

4 months agoMerge branch 'releng/13.2' into releng-CDN/13.2
Merge Robot [Fri, 1 Dec 2023 06:15:35 +0000 (00:15 -0600)]
Merge branch 'releng/13.2' into releng-CDN/13.2

4 months agoAdd UPDATING entries and bump version.
Gordon Tetlow [Thu, 30 Nov 2023 21:51:02 +0000 (13:51 -0800)]
Add UPDATING entries and bump version.

Approved by: so

4 months agozfs: cherry-pick commit from master
Rob N [Tue, 28 Nov 2023 17:07:57 +0000 (04:07 +1100)]
zfs: cherry-pick commit from master

 #15571 30d581121 dnode_is_dirty: check dnode and its data for dirtiness

Obtained from: OpenZFS
Approved by: so
Security: FreeBSD-EN-23:16.openzfs

(cherry picked from commit 30d581121bb122c90959658e7b28b1672d342897)
(cherry picked from commit 5858f93a8b66aa6331d99bed6aad68bc7e9648ba)

5 months agoMerge branch 'releng/13.2' into releng-CDN/13.2
Merge Robot [Wed, 8 Nov 2023 06:15:34 +0000 (00:15 -0600)]
Merge branch 'releng/13.2' into releng-CDN/13.2

5 months agoAdd UPDATING entries and bump version.
Ed Maste [Wed, 8 Nov 2023 01:08:10 +0000 (20:08 -0500)]
Add UPDATING entries and bump version.

Approved by: so

5 months agoregcomp: use unsigned char when testing for escapes
Christos Zoulas [Wed, 30 Aug 2023 20:37:24 +0000 (20:37 +0000)]
regcomp: use unsigned char when testing for escapes

- cast GETNEXT to unsigned where it is being promoted to int to prevent
  sign-extension (really it would have been better for PEEK*() and
  GETNEXT() to return unsigned char; this would have removed a ton of
  (uch) casts, but it is too intrusive for now).
- fix an isalpha that should have been iswalpha

PR: 264275, 274032
Reviewed by: kevans, eugen (previous version)
Obtained from: NetBSD

(cherry picked from commit 3fb80f1476c7776f04ba7ef6d08397cef6abcfb0)
(cherry picked from commit ac695744e2cfb461a64018276fb94999fb0cad9c)

Approved by: so
Security: FreeBSD-EN-23:14

5 months agofreebsd-update: create deep BEs by default
Kyle Evans [Thu, 12 Oct 2023 02:51:07 +0000 (21:51 -0500)]
freebsd-update: create deep BEs by default

The -r flag to bectl needs to go away, and we need to just do the right
thing.  In the meantime, we can apply an -r in freebsd-update as a
minimal fix to stop creating partial backups in these (non-default) deep
BE setups.

PR: 267535
(cherry picked from commit 989c5f6da99081b1f2b76ec09e91078e531e1250)
(cherry picked from commit 80f747781f125576de40ab8b3d8d70b351ef0518)

Approved by: so
Security: FreeBSD-EN-23:13

5 months agocap_net: correct capability name from addr2name to name2addr
Mariusz Zaborski [Mon, 23 Oct 2023 21:03:51 +0000 (23:03 +0200)]
cap_net: correct capability name from addr2name to name2addr

Previously, while checking name2addr capabilities, we mistakenly used
the addr2name set. This error could cause a process to inadvertently
reset its limitations.

Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>

(cherry picked from commit afd74c400075d94e01dd3430844bb290834660ef)
(cherry picked from commit 765757c6301fa41c0b59108347c600fbc9020c39)
(cherry picked from commit 114c6d9bef765a47ebcb8e65d1c935cbcbe51002)

Approved by: so
Approved by: re (implicit)
Security: SA-23:16.cap_net
Sponsored by: The FreeBSD Foundation

5 months agofflush: correct buffer handling in __sflush
Dag-Erling Smørgrav [Thu, 3 Aug 2023 15:08:03 +0000 (15:08 +0000)]
fflush: correct buffer handling in __sflush

This fixes CVE-2014-8611 correctly.

The commit that purported to fix CVE-2014-8611 (805288c2f062) only hid
it behind another bug.  Two later commits, 86a16ada1ea6 and
44cf1e5eb470, attempted to address this new bug but mostly just confused
the issue.  This commit rolls back the three previous changes and fixes
CVE-2014-8611 correctly.

The key to understanding the bug (and the fix) is that `_w` has
different meanings for different stream modes.  If the stream is
unbuffered, it is always zero.  If the stream is fully buffered, it is
the amount of space remaining in the buffer (equal to the buffer size
when the buffer is empty and zero when the buffer is full).  If the
stream is line-buffered, it is a negative number reflecting the amount
of data in the buffer (zero when the buffer is empty and negative buffer
size when the buffer is full).

At the heart of `fflush()`, we call the stream's write function in a
loop, where `t` represents the return value from the last call and `n`
the amount of data that remains to be written.  When the write function
fails, we need to move the unwritten data to the top of the buffer
(unless nothing was written) and adjust `_p` (which points to the next
free location in the buffer) and `_w` accordingly.  These variables have
already been set to the values they should have after a successful
flush, so instead of adjusting them down to reflect what was written,
we're adjusting them up to reflect what remains.

The bug was that while `_p` was always adjusted, we only adjusted `_w`
if the stream was fully buffered.  The fix is to also adjust `_w` for
line-buffered streams.  Everything else is just noise.

Fixes: 805288c2f062
Fixes: 86a16ada1ea6
Fixes: 44cf1e5eb470
Sponsored by: Klara, Inc.

(cherry picked from commit 1f90b4edffe815aebb35e74b79e10593b31f6b75)
(cherry picked from commit 1e99535be2ea9c0ef8bc57fc885e9c01fa95d2dd)
(cherry picked from commit ccdd8337f9cbd7d34e2e95df1440dd5f7225d0b4)
(cherry picked from commit d09a3bf72c0b5f1779c52269671872368c99f02a)
(cherry picked from commit 92709431b14df6c0687446247ac57cfc189ee827)
(cherry picked from commit 6cb5690b3495741e9ece6f42ba4a85732932aa83)
(cherry picked from commit 418f026bd5a5084c1c4e2e91ad38051f6caa928c)
(cherry picked from commit abe12d2f4ce31c3da0961b1b0a58df11f5a41e19)
(cherry picked from commit 59ec3ffdd7ce85f32ea833e8024f7bacd36d4e97)
(cherry picked from commit 4e0e01bf6511c28212d7dff94fe131a502e13026)
(cherry picked from commit d2c65a1c948648f11342274029a3f18b90aa58d2)
(cherry picked from commit 0b7939d725ba0ca903c5f8a3ca6d74347eb88690)

Approved by: so
Approved by: re (implicit)
Security: SA-23:15.stdio
Sponsored by: The FreeBSD Foundation

6 months agoMerge branch 'releng/13.2' into releng-CDN/13.2
Merge Robot [Wed, 4 Oct 2023 05:15:36 +0000 (00:15 -0500)]
Merge branch 'releng/13.2' into releng-CDN/13.2

6 months agoAdd UPDATING entries and bump version.
Gordon Tetlow [Tue, 3 Oct 2023 21:51:35 +0000 (14:51 -0700)]
Add UPDATING entries and bump version.

Approved by: so

6 months agoarm64: Fix errata workarounds that depend on smccc
Andrew Turner [Mon, 18 Sep 2023 16:34:51 +0000 (17:34 +0100)]
arm64: Fix errata workarounds that depend on smccc

Some arm64 errata depend on calling into the firmware via the SMCCC
interface. This needs to happen after the psci driver has attached
as they share the interface.

Fix this by allowing the workarounds to mark when they depend on
device drivers attaching.

This is only an issue on CPU 0 as the workarounds are applied later
for the non-boot CPUs.

Reviewed by: emaste
Approved by: so
Security: FreeBSD-SA-23:14.smccc
Security: CVE-2023-5370
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41916

(cherry picked from commit c643e82dba0b17b2716de4c9d44a3c9c547cbbd5)
(cherry picked from commit 843bea18711d726cd2f0a3c3f9144b218e4de3e8)
(cherry picked from commit 4df1447f2c76d0db988197f3a05d48e15f976c7c)

6 months agocopy_file_range: require CAP_SEEK capability
Mariusz Zaborski [Thu, 28 Sep 2023 13:24:39 +0000 (15:24 +0200)]
copy_file_range: require CAP_SEEK capability

When using copy_file_range(2) with an offset parameter,
the CAP_SEEK capability should be required.
This requirement is similar to the behavior observed with
pread(2)/pwrite(2).

Reported by: theraven
Reviewed by:    emaste, theraven, kib, markj
Approved by: so
Security: FreeBSD-SA-23:13.capsicum
Security: CVE-2023-5369
Differential Revision:  https://reviews.freebsd.org/D41967

(cherry picked from commit 15a51d3abaef27ddea66320cac7caa549738a1a6)
(cherry picked from commit 3f0ce63828dc3d4030b32ad0effb4e588af49c03)

6 months agomsdosfs: zero partially valid extended cluster
Gordon Tetlow [Tue, 3 Oct 2023 21:23:40 +0000 (14:23 -0700)]
msdosfs: zero partially valid extended cluster

Approved by: so
Security: FreeBSD-SA-23:12.msdosfs
Security: CVE-2023-5368

6 months agofreebsd-update: handle file -> directory on upgrade
Ed Maste [Wed, 27 Sep 2023 13:36:33 +0000 (09:36 -0400)]
freebsd-update: handle file -> directory on upgrade

Upgrading from FreeBSD 13.2 to 14.0 failed with
  install: ///usr/include/c++/v1/__string exists but is not a directory
because __string changed from a file to a directory with an LLVM
upgrade.

Now, remove the existing file when the type conflicts.  Note that this
is only an interim fix to facilitate upgrades from 13.2 for 14.0 BETA
testing.  This change does not handle the directory -> file case and
further work is needed.

PR: 273661
Reviewed by: dim, gordon
Approved by: so
Security: FreeBSD-EN-23:12.freebsd-update
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41893

(cherry picked from commit f6d37c9ca13f8ab0ef32cf5344daecb8122d1e85)
(cherry picked from commit 774cc6348a50c13b952e9f36ef8395f9b48733db)

7 months agoMerge branch 'releng/13.2' into releng-CDN/13.2
Merge Robot [Thu, 7 Sep 2023 05:15:42 +0000 (00:15 -0500)]
Merge branch 'releng/13.2' into releng-CDN/13.2

7 months agoAdd UPDATING entries and bump version.
Gordon Tetlow [Wed, 6 Sep 2023 17:18:35 +0000 (10:18 -0700)]
Add UPDATING entries and bump version.

Approved by: so

7 months agonet80211: fail for unicast traffic without unicast key
domienschepers [Thu, 10 Nov 2022 00:00:00 +0000 (00:00 +0000)]
net80211: fail for unicast traffic without unicast key

Falling back to the multicast key may cause unicast traffic to leak.
Instead fail when no key is found.

For more information see the 'Framing Frames: Bypassing Wi-Fi Encryption
by Manipulating Transmit Queues' paper.

Approved by: so
Security: FreeBSD-SA-23:11.wifi
Security: CVE-2022-47522

(cherry picked from commit 61605e0ae5d8f34b89b8e71e393f3006f511e86a)
(cherry picked from commit 6c9bcecfb296b96a383012e02bc9582260588339)

7 months agopf: handle multiple IPv6 fragment headers
Kristof Provost [Thu, 13 Jul 2023 08:25:49 +0000 (10:25 +0200)]
pf: handle multiple IPv6 fragment headers

With 'scrub fragment reassemble' if a packet contains multiple IPv6
fragment headers we would reassemble the packet and immediately
continue processing it.

That is, we'd remove the first fragment header and expect the next
header to be a final header (i.e. TCP, UDP, ICMPv6, ...). However, if
it's another fragment header we'd not treat the packet correctly.
That is, we'd fail to recognise the payload and treat it as if it were
an IPv6 fragment rather than as its actual payload.

Fix this by restarting the normalisation on the reassembled packet.
If there are multiple fragment headers drop the packet.

Reported by: Enrico Bassetti bassetti@di.uniroma1.it (NetSecurityLab @ Sapienza University of Rome)
Sponsored by: Rubicon Communications, LLC ("Netgate")
Approved by: so
Security: FreeBSD-SA-23:10.pf
Security: CVE-2023-4809

(cherry picked from commit 76afcbb52492f9b3e72ee7d4c4ed0a54c25e1c48)
(cherry picked from commit 3a0461f23a4f4fe8fc82b3445285d3d07787b016)

7 months agocaroot: add new certs
Kyle Evans [Sun, 25 Jun 2023 23:47:49 +0000 (18:47 -0500)]
caroot: add new certs

Based on dates, these were likely just missed in the last update... add
them now.

- Twenty (20) new

Approved by: so
Security: FreeBSD-EN-23:11.caroot

(cherry picked from commit ee0aa1ce12b3caea34477a31e9d2111a329e33b9)
(cherry picked from commit 565712db0dfa62eb876147c0f605903f451725b3)

7 months agopcib: Allocate the memory BAR with the MSI-X table.
John Baldwin [Mon, 19 Jun 2023 16:15:48 +0000 (09:15 -0700)]
pcib: Allocate the memory BAR with the MSI-X table.

This is required for pci_alloc_msix() to work and to thus use
MSI-X interrupts for PCI-e hotplug.

Reported by: cperciva
Reviewed by: cperciva
Approved by: so
Security: FreeBSD-EN-23:10.pci
Differential Revision: https://reviews.freebsd.org/D40581

(cherry picked from commit e6b838363fb473b5e35a8ae6a1da5e15f5b52960)
(cherry picked from commit 12ce57e6d3e770db9ca83a8cbaa8f332515ce3d7)

7 months agofreebsd-update: Fix merging already-updated files
Colin Percival [Fri, 5 May 2023 03:00:58 +0000 (20:00 -0700)]
freebsd-update: Fix merging already-updated files

When performing an "upgrade" (moving between FreeBSD releases, as
opposed to "update" which merely applies security/errata updates
to the installed release) FreeBSD Update:

1. Generates a list of "files needing to be merged", namely those
files which don't match the version installed in the "old" release
and have paths matching the MergeChanges configuration directive
(by default, /boot/device.hints and everything under /etc/).

and later on,

2. Compares the currently-installed files to the versions in the
"new" release, removing index entries for files which "don't need
to be updated because they're not changing".

Unfortunately if a file falls into both of these categories -- that
is to say, if a file in /etc/ is the same as the version in the new
release and not the same as the version in the old release -- the
resulting "merge" step saw that the file was no longer listed as
being part of the new release, resulting in the file being deleted.

For the first 18 years of FreeBSD Update's existence, this never
happened, since $FreeBSD$ tags resulted in "new release" files
always being different from any files systems would already have
installed.

This commit fixes this behaviour by only placing a file into the
"files needing to be merged" list if it does not match the version
in the old release *or* the version in the new release.

Reported by: des
Reviewed by: delphij (earlier version), des, emaste
Approved by: so
Security: FreeBSD-EN-23:09.freebsd-update
Differential Revision: https://reviews.freebsd.org/D39973

(cherry picked from commit c55b7e522629cb78adeb54bd9964304481d55eab)
(cherry picked from commit 866e5c6b3ce7ca3e15a24180fa1a0dcbda7c4b0f)

8 months agoMerge branch 'releng/13.2' into releng-CDN/13.2
Merge Robot [Sun, 13 Aug 2023 00:30:16 +0000 (19:30 -0500)]
Merge branch 'releng/13.2' into releng-CDN/13.2

8 months agoAdd UPDATING entries and bump version
Mark Johnston [Tue, 1 Aug 2023 15:12:45 +0000 (11:12 -0400)]
Add UPDATING entries and bump version

Approved by: so

8 months agofrag6: Avoid a possible integer overflow in fragment handling
Jonathan T. Looney [Tue, 1 Aug 2023 14:58:34 +0000 (10:58 -0400)]
frag6: Avoid a possible integer overflow in fragment handling

Reviewed by: kp, markj, bz
Approved by: so
Security: FreeBSD-SA-23:06.ipv6
Security: CVE-2023-3107

(cherry picked from commit ff3d1a3f9d71e706f320f51bae258e4e1a51b388)
(cherry picked from commit 9515f04fe3b12b9e6ef6c802b647dd4cbdba621b)

8 months agobhyve: Fully reset the fwctl state machine if the guest requests a reset.
John Baldwin [Thu, 29 Jun 2023 18:27:12 +0000 (11:27 -0700)]
bhyve: Fully reset the fwctl state machine if the guest requests a reset.

If a guest tries to reset the fwctl device while a pending request was
in flight, the fwctl state machine can be left in an incomplete state.
Specifically, rinfo is not cleared.

Normally the state machine for fwctl alternates between REQ (receiving
request) and RESP (sending response) and ignores port writes while in
RESP or port reads while in REQ.  Once a guest completes the writes to
the port to send a request, the state machine transitions to RESP and
ignores future writes.

However, if a guest writes a full request and then resets the fwctl
device, the state would transition to REQ without draining the pending
response or discarding the received request.  Instead, additional
port writes after the reset were treated as new payload bytes, but
were appended to the previously-received request and could overflow
the fget_str buffer.

To fix, fully reset the fwctl state machine if the guest requests a
reset.

admbugs: 998
Approved by: so
Reviewed by: markj
Reported by: Omri Ben Bassat <t-benbassato@microsoft.com>
Security: FreeBSD-SA-23:07.bhyve
Security: CVE-2023-3494

(cherry picked from commit bed3ae1d7863ac1e0b1e82ae7bf952937e921efe)
(cherry picked from commit 9fe302d78109b12867bd933bb68cd900c9940b7d)

8 months agossh: Update to OpenSSH 9.3p2
Ed Maste [Tue, 1 Aug 2023 14:38:11 +0000 (10:38 -0400)]
ssh: Update to OpenSSH 9.3p2

Approved by: so
Security: FreeBSD-SA-23:08.ssh
Security: CVE-2023-38408

8 months agoWork around VNET and DPCPU related panics on aarch64
Dimitry Andric [Sun, 23 Jul 2023 13:48:36 +0000 (15:48 +0200)]
Work around VNET and DPCPU related panics on aarch64

lld >= 14 and recent GNU ld can relax adrp+add and adrp+ldr
instructions, which breaks VNET and DPCPU when used in modules.

Until VNET and DPCPU can be fixed to deal with these relaxed
instructions, disable linker relaxation for now.

PR: 264094
Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41156

(cherry picked from commit 80e4ac2964a11edef456a15b77e43aadeaf273a2)
(cherry picked from commit f1f27dfa4ad9da53fcdfc6aae644fab83bda4e76)

Approved by: so
Security: FreeBSD-EN-23:08.vnet

8 months agopam_krb5: Add missing patch
Cy Schubert [Sat, 8 Jul 2023 03:09:18 +0000 (20:09 -0700)]
pam_krb5: Add missing patch

Include a portion of the patch that was missed in 813847e49e35.

Reported by: markj
Fixes: 813847e49e35

(cherry picked from commit bfa51318dee8afd9307f15e49a6a521938dccd06)
(cherry picked from commit d295e418ae7e60d87af6576ecdfad41a98d7442c)

Approved by: so
Security: FreeBSD-SA-23:09.pam_krb5
Security: CVE-2023-3326

10 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

10 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)

10 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

10 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

11 months agocdn-patch: offer option to mount /etc/keys before attaching geli devices
CyberLeo [Fri, 22 Nov 2019 02:17:38 +0000 (20:17 -0600)]
cdn-patch: offer option to mount /etc/keys before attaching geli devices

11 months agocdn-patch: fix checkyesno warning in efi keysource
CyberLeo [Fri, 22 Nov 2019 02:14:09 +0000 (20:14 -0600)]
cdn-patch: fix checkyesno warning in efi keysource

11 months agocdn-patch: use key from efi if it exists
CyberLeo [Sat, 9 Nov 2019 04:12:26 +0000 (22:12 -0600)]
cdn-patch: use key from efi if it exists

11 months agocdn-patch: mark unionfs as jail-safe
CyberLeo [Sun, 23 Jul 2017 08:42:13 +0000 (03:42 -0500)]
cdn-patch: mark unionfs as jail-safe

12 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

12 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)

12 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)

13 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)