]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
19 months agoAdd UPDATING entries and bump version releng-CDN/13.0 releng/13.0
Ed Maste [Tue, 30 Aug 2022 23:06:09 +0000 (19:06 -0400)]
Add UPDATING entries and bump version

Approved by: so

19 months agocontrib/tzdata: import tzdata 2022b and 2022c
Philip Paeps [Thu, 11 Aug 2022 02:48:24 +0000 (10:48 +0800)]
contrib/tzdata: import tzdata 2022b and 2022c

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

The tzdata2022b import restored the zoneinfo/GMT link.
Don't delete it again with 'make delete-old'.

(cherry picked from commit 9f9fc6bb8028ea29da6b04c338c750cedc3040f3)
(cherry picked from commit f5d5282cf7d1181f933626dcdc3525db0d70a266)
(cherry picked from commit 5f33eb7266f938857ce2fc9ea59679ea46a0694b)
(cherry picked from commit f7cb47731675828d27ebd55c9fc46953ee168d48)

Approved by: so

19 months agozlib: Fix a bug when getting a gzip header extra field with inflate().
Mark Adler [Sat, 30 Jul 2022 22:51:11 +0000 (15:51 -0700)]
zlib: Fix a bug when getting a gzip header extra field with inflate().

If the extra field was larger than the space the user provided with
inflateGetHeader(), and if multiple calls of inflate() delivered
the extra header data, then there could be a buffer overflow of the
provided space. This commit assures that provided space is not
exceeded.

(cherry picked from zlib commit eff308af425b67093bab25f80f1ae950166bece1)
(cherry picked from zlib commit 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d)

(cherry picked from commit dc3509f1aafcd966f3dd9226115cf94b691ff3c7)
(cherry picked from commit 2969066f73fc67a614144ac09b9f3f5291937fed)
(cherry picked from commit 10cc2bf5f7a592981ee00d22eb13e100beed1e64)

Approved by: so
Security: CVE-2022-37434

20 months agoAdd UPDATING entries and bump version.
Mark Johnston [Tue, 26 Jul 2022 13:44:27 +0000 (09:44 -0400)]
Add UPDATING entries and bump version.

Approved by: so

20 months agolib9p: Remove potential buffer overwrite in l9p_puqids()
Konrad Sewiłło-Jopek [Mon, 8 Aug 2022 16:25:48 +0000 (12:25 -0400)]
lib9p: Remove potential buffer overwrite in l9p_puqids()

Structure l9p_f_wralk reserves at most L9P_MAX_WELEM entries
and that number actually set the maximum we can safely use.

Approved by: so
Security: FreeBSD-SA-22:12.lib9p
PR: 265385
Reviewed by: markj

(cherry picked from commit 2dd83b3f0507fc7bc64b908fb88f285a3b9663c8)
(cherry picked from commit c536045c51da78a85138e963d3b7e13a547713c9)

20 months agovm_fault: Shoot down shared mappings in vm_fault_copy_entry()
Mark Johnston [Mon, 25 Jul 2022 20:53:21 +0000 (16:53 -0400)]
vm_fault: Shoot down shared mappings in vm_fault_copy_entry()

As in vm_fault_cow(), it's possible, albeit rare, for multiple vm_maps
to share a shadow object.  When copying a page from a backing object
into the shadow, all mappings of the source page must therefore be
removed.  Otherwise, future operations on the object tree may detect
that the source page is fully shadowed and thus can be freed.

Approved by: so
Security: FreeBSD-SA-22:11.vm
Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35635

(cherry picked from commit 5c50e900ad779fccbf0a230bfb6a68a3e93ccf60)
(cherry picked from commit 3ea8c7ad90f75129c52a2b64213c5578af23dc8d)

20 months agoelf_note_prpsinfo: handle more failures from proc_getargv()
Konstantin Belousov [Fri, 3 Jun 2022 08:21:23 +0000 (11:21 +0300)]
elf_note_prpsinfo: handle more failures from proc_getargv()

Resulting sbuf_len() from proc_getargv() might return 0 if user mangled
ps_strings enough. Also, sbuf_len() API contract is to return -1 if the
buffer overflowed. The later should not occur because get_ps_strings()
checks for catenated length, but check for this subtle detail explicitly
as well to be more resilent.

The end result is that p_comm is used in this situations.

Approved by: so
Security: FreeBSD-SA-22:09.elf
Reported by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: delphij, markj
admbugs: 988
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35391

(cherry picked from commit 00d17cf342cd9f4f8fd1dcd79c8caec359145532)
(cherry picked from commit 8a44a2c644fc6d4ec1740fcc0b3ff01eac989ddf)

21 months agoCAM: Keep periph_links when restoring CCB in camperiphdone().
Alexander Motin [Thu, 28 Apr 2022 01:39:50 +0000 (21:39 -0400)]
CAM: Keep periph_links when restoring CCB in camperiphdone().

While recovery command executed, some other commands from the periph
may complete, that may affect periph_links of this CCB.  So restoring
original CCB we must keep current periph_links as more up to date.

I've found this triggering assertions with debug kernel and suspect
some memory corruptions otherwise when spun down disk receives two
or sometimes more concurrent requests.

Approved by: so
Security: FreeBSD-EN-22:17.cam
Sponsored by: iXsystems, Inc.

(cherry picked from commit 404f001161b975164d8b52d9f404d07ac7584027)
(cherry picked from commit 84849cfd1dc016917402511bc5a55d3d7317ce39)

21 months agopam_exec: fix segfault when authtok is null
Yan Ka Chiu [Sun, 22 May 2022 16:33:02 +0000 (12:33 -0400)]
pam_exec: fix segfault when authtok is null

According to pam_exec(8), the `expose_authtok` option should be ignored
when the service function is `pam_sm_setcred`. Currently `pam_exec` only
prevent prompt for anth token when `expose_authtok` is set on
`pam_sm_setcred`. This subsequently led to segfault when there isn't an
existing auth token available.

Bug reported on this: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263893

After reading https://reviews.freebsd.org/rS349556 I am not sure if the
default behaviour supposed to be simply not prompt for authentication
token, or is it to ignore the option entirely as stated in the man page.

This patch is therefore only adding an additional NULL check on the item
`pam_get_item` provide, and exit with `PAM_SYSTEM_ERR` when such item is
NULL.

Approved by: so
Security: FreeBSD-EN-22:19.pam_exec
MFC after: 1 week
Reviewed by: des, khng
Differential Revision: https://reviews.freebsd.org/D35169

(cherry picked from commit b75e0eed345d2ab047a6b1b00a9a7c3bf92e992c)
(cherry picked from commit ea80848e1c0639e2ac8d3f974ddb9c6233491eb3)

21 months agoaio_aqueue(): avoid ucred leak on failure path
Konstantin Belousov [Fri, 24 Sep 2021 00:14:56 +0000 (03:14 +0300)]
aio_aqueue(): avoid ucred leak on failure path

Approved by: so
Security: FreeBSD-SA-22:10.aio
PR: 258698

(cherry picked from commit 45c2c7c484de7747014492b17ff89e323ee66496)
(cherry picked from commit 9499d3c1e40dfeb1f63f61af7cdf25ee27f9a2ec)

2 years agoAdd UPDATING entries and bump version.
Ed Maste [Tue, 5 Apr 2022 23:30:36 +0000 (19:30 -0400)]
Add UPDATING entries and bump version.

Approved by: so

2 years agoAssure that the number of bits for deflatePrime() is valid.
Ed Maste [Tue, 5 Apr 2022 23:33:30 +0000 (19:33 -0400)]
Assure that the number of bits for deflatePrime() is valid.

Cherry picked from zlib 4346a16853e19b45787ce933666026903fb8f3f8

Approved by: so
Security: FreeBSD-SA-22:08.zlib

2 years agozlib: Fix a bug that can crash deflate on some input when using Z_FIXED.
Ed Maste [Tue, 5 Apr 2022 23:32:46 +0000 (19:32 -0400)]
zlib: Fix a bug that can crash deflate on some input when using Z_FIXED.

Cherry picked from zlib 5c44459c3b28a9bd3283aaceab7c615f8020c531:

This bug was reported by Danilo Ramos of Eideticom, Inc. It has
lain in wait 13 years before being found! The bug was introduced
in zlib 1.2.2.2, with the addition of the Z_FIXED option. That
option forces the use of fixed Huffman codes. For rare inputs with
a large number of distant matches, the pending buffer into which
the compressed data is written can overwrite the distance symbol
table which it overlays. That results in corrupted output due to
invalid distances, and can result in out-of-bound accesses,
crashing the application.

The fix here combines the distance buffer and literal/length
buffers into a single symbol buffer. Now three bytes of pending
buffer space are opened up for each literal or length/distance
pair consumed, instead of the previous two bytes. This assures
that the pending buffer cannot overwrite the symbol table, since
the maximum fixed code compressed length/distance is 31 bits, and
since there are four bytes of pending space for every three bytes
of symbol space.

Approved by: so
Security: CVE-2018-25032
Security: FreeBSD-SA-22:08.zlib

2 years agonet80211: validate Mesh ID length in ieee80211_parse_beacon
Bjoern A. Zeeb [Tue, 5 Apr 2022 23:27:00 +0000 (23:27 +0000)]
net80211: validate Mesh ID length in ieee80211_parse_beacon

Reported by: m00nbsd working with Trend Micro Zero Day Initiative

(cherry picked from commit fb8c87b4f3bfdfac014f9d894fe75fbad0391b24)
(cherry picked from commit 72617f9246e3a4be28eeafeae1bdd983143eef3e)

Approved by: so
Security: CVE-2022-23088
Security: FreeBSD-SA-22:07.wifi_meshid

2 years agompr/mps/mpt: verify cfg page ioctl lengths
Ed Maste [Tue, 5 Apr 2022 23:26:48 +0000 (23:26 +0000)]
mpr/mps/mpt: verify cfg page ioctl lengths

*_CFG_PAGE ioctl handlers in the mpr, mps, and mpt drivers allocated a
buffer of a caller-specified size, but copied to it a fixed size header.
Add checks that the size is at least the required minimum.

Note that the device nodes are owned by root:operator with 0640
permissions so the ioctls are not available to unprivileged users.

This change includes suggestions from scottl, markj and mav.

Two of the mpt cases were reported by Lucas Leong (@_wmliang_) of
Trend Micro Zero Day Initiative; scottl reported the third case in mpt.
Same issue found in mpr and mps after discussion with imp.

Reported by: Lucas Leong (@_wmliang_), Trend Micro Zero Day Initiative
Reviewed by: imp, mav
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34692

(cherry picked from commit 8276c4149b5fc7c755d6b244fbbf6dae1939f087)
(cherry picked from commit 0b29e1b9f9df3bde6402cccc49cb850c0dcc35fb)

Approved by: so
Security: CVE-2022-23086
Security: FreeBSD-SA-22:06.ioctl

2 years agobhyve: validate e82545 checksum offset field
Mark Johnston [Tue, 5 Apr 2022 23:26:02 +0000 (23:26 +0000)]
bhyve: validate e82545 checksum offset field

Reported by: Mehdi Talbi, Synacktiv

(cherry picked from commit b0aa20bec5db244980a0248e24dd6b8e1e68c4d0)
(cherry picked from commit 53f72209479885dfa6a7e6ed68cbc82c68464f4b)

Approved by:    so
Security: CVE-2022-23087
Security:       FreeBSD-SA-22:05.bhyve

2 years agonetmap: Fix TOCTOU vulnerability in nmreq_copyin
Vincenzo Maffione [Tue, 5 Apr 2022 23:26:02 +0000 (23:26 +0000)]
netmap: Fix TOCTOU vulnerability in nmreq_copyin

The total size of the user-provided nmreq was first computed and then
trusted during the copyin. This might lead to kernel memory corruption
and escape from jails/containers.

Reported by: Lucas Leong (@_wmliang_) of Trend Micro Zero Day Initiative
Security: CVE-2022-23084
MFC after: 3 days

(cherry picked from commit 393729916564ed13f966e09129a24e6931898d12)
(cherry picked from commit 9f600a260a738d87015b2e9722b7b4f228cbd47d)

Approved by: so
Security: FreeBSD-SA-22:04.netmap

2 years agonetmap: Fix integer overflow in nmreq_copyin
Vincenzo Maffione [Tue, 5 Apr 2022 23:26:02 +0000 (23:26 +0000)]
netmap: Fix integer overflow in nmreq_copyin

An unsanitized field in an option could be abused, causing an integer
overflow followed by kernel memory corruption. This might be used
to escape jails/containers.

Reported by: Reno Robert and Lucas Leong (@_wmliang_) of Trend Micro
Zero Day Initiative
Security: CVE-2022-23085

(cherry picked from commit 694ea59c7021c25417e6d516362d2f59b4e2c343)
(cherry picked from commit 9df8dd3ea36c8b3abe8fc182647472ca9cd83efd)

Approved by: so
Security: FreeBSD-SA-22:04.netmap

2 years agopf: Initialize the table entry zone limit at initialization time
Mark Johnston [Tue, 5 Apr 2022 23:26:02 +0000 (23:26 +0000)]
pf: Initialize the table entry zone limit at initialization time

The limit may later be updated by the "set limit" directive in pf.conf.
UMA does not permit a limit to be set on a zone after any items have
been allocated from a zone.

Other UMA zones used by pf do not appear to be susceptible to this
problem: they either set a limit at zone creation time or never set one
at all.

PR: 260406
Reviewed by: kp
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7d1ab866911a2b29e041d64bc83a93638533f957)
(cherry picked from commit 1487f84223ce1341ebdfc87e50fbcddedc6d1de8)

Approved by: so
Security: FreeBSD-EN-22:15.pf

2 years agoAdd UPDATING entries and bump version.
Gordon Tetlow [Tue, 22 Mar 2022 16:25:42 +0000 (09:25 -0700)]
Add UPDATING entries and bump version.

Approved by: so

2 years agocontrib/tzdata: import tzdata 2022a
Philip Paeps [Tue, 22 Mar 2022 15:54:07 +0000 (15:54 +0000)]
contrib/tzdata: import tzdata 2022a

Merge commit '971fa603f2bdf16273135a00ff16c5585520c53f'

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

With this merge, we return to our previous long-standing practice of
distributing the IANA Time Zone Database unmodified.

Releases of tzdb since 2021b have merged some time zones where clocks
have agreed since 1970.  The overwhelming majority of users will not be
affected by this change.  A port of the newly created global-tz fork of
the IANA Time Zone database (misc/global-tz) is available for users who
need more granular pre-1970 time zone history.

Approved by: so
Security: FreeBSD-EN-22:14.tzdata

(cherry picked from commit 8ea5af2b77f2b43c250cacb257f42c0a54d644c4)
(cherry picked from commit 5dbd160076c09b0a3c7b175b506a57bd8b71f22a)

2 years agoAdd UPDATING entry and bump version.
Gordon Tetlow [Tue, 22 Mar 2022 04:51:59 +0000 (21:51 -0700)]
Add UPDATING entry and bump version.

Approved by: so

2 years agoRestore dirty dnode detection logic
Brian Behlendorf [Thu, 11 Nov 2021 00:14:32 +0000 (16:14 -0800)]
Restore dirty dnode detection logic

In addition to flushing memory mapped regions when checking holes,
commit de198f2d95 modified the dirty dnode detection logic to check
the dn->dn_dirty_records instead of the dn->dn_dirty_link.  Relying
on the dirty record has not be reliable, switch back to the previous
method.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #11900
Closes #12745
(cherry picked from commit d7e640cf95f72deeca501d34afed59a0bc9d7940)

Approved by: so
Security: FreeBSD-EN-22:13.zfs

2 years agoFreeBSD: fix world build after de198f2d9
Martin Matuška [Mon, 15 Nov 2021 16:07:39 +0000 (17:07 +0100)]
FreeBSD: fix world build after de198f2d9

The inline function vn_flush_cached_data() in vnode.h
must not be compiled when building BASE.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Martin Matuska <mm@FreeBSD.org>
Closes #12743
(cherry picked from commit b8dcfb2c9ff35fabcfe9dffa58278c7e14b18088)

Approved by: so

2 years agoAdd UPDATING entries and bump version
Mark Johnston [Tue, 15 Mar 2022 17:30:31 +0000 (13:30 -0400)]
Add UPDATING entries and bump version

Approved by: so

2 years agoFix lseek(SEEK_DATA/SEEK_HOLE) mmap consistency
Brian Behlendorf [Sun, 7 Nov 2021 21:27:44 +0000 (13:27 -0800)]
Fix lseek(SEEK_DATA/SEEK_HOLE) mmap consistency

When using lseek(2) to report data/holes memory mapped regions of
the file were ignored.  This could result in incorrect results.
To handle this zfs_holey_common() was updated to asynchronously
writeback any dirty mmap(2) regions prior to reporting holes.

Additionally, while not strictly required, the dn_struct_rwlock is
now held over the dirty check to prevent the dnode structure from
changing.  This ensures that a clean dnode can't be dirtied before
the data/hole is located.  The range lock is now also taken to
ensure the call cannot race with zfs_write().

Furthermore, the code was refactored to provide a dnode_is_dirty()
helper function which checks the dnode for any dirty records to
determine its dirtiness.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #11900
Closes #12724
(cherry picked from commit 664d487a5dbd758216ac613934a4080fcc1de347)

Approved by: so
Security: FreeBSD-EN-22:11.zfs

2 years agoFreeBSD: Clean up zfsdev_close to match Linux
Ryan Moeller [Sat, 13 Mar 2021 00:09:15 +0000 (19:09 -0500)]
FreeBSD: Clean up zfsdev_close to match Linux

Resolve some oddities in zfsdev_close() which could result in a
panic and were not present in the equivalent function for Linux.

- Remove unused definition ZFS_MIN_MINOR
- FreeBSD: Simplify zfsdev state destruction
- Assert zs_minor is valid in zfsdev_close
- Make locking around zfsdev state match Linux

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #11720

Approved by: so
Security: FreeBSD-EN-22:12.zfs

2 years agoFix handling of errors from dmu_write_uio_dbuf() on FreeBSD
Mark Johnston [Fri, 21 Jan 2022 19:54:05 +0000 (14:54 -0500)]
Fix handling of errors from dmu_write_uio_dbuf() on FreeBSD

FreeBSD's implementation of zfs_uio_fault_move() returns EFAULT when a
page fault occurs while copying data in or out of user buffers.  The VFS
treats such errors specially and will retry the I/O operation (which may
have made some partial progress).

When the FreeBSD and Linux implementations of zfs_write() were merged,
the handling of errors from dmu_write_uio_dbuf() changed such that
EFAULT is not handled as a partial write.  For example, when appending
to a file, the z_size field of the znode is not updated after a partial
write resulting in EFAULT.

Restore the old handling of errors from dmu_write_uio_dbuf() to fix
this.  This should have no impact on Linux, which has special handling
for EFAULT already.

Reviewed-by: Andriy Gapon <avg@FreeBSD.org>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #12964
(cherry picked from commit 063daa8350d4a78f96d1ee6550910363fd3756fb)
(cherry picked from commit b55a7f3422d76a6765716b2b6e78967bd75199c9)

Approved by: so
Security: FreeBSD-EN-22:10.zfs

2 years agonet80211: correct length check in ieee80211_ies_expand()
Bjoern A. Zeeb [Wed, 6 Oct 2021 18:09:39 +0000 (18:09 +0000)]
net80211: correct length check in ieee80211_ies_expand()

In ieee80211_ies_expand() we are looping over Elements
(also known as Information Elements or IEs).
The comment suggests that we assume well-formedness of
the IEs themselves.
Checking the buffer length being least 2 (1 byte Element ID and
1 byte Length fields) rather than just 1 before accessing ie[1]
is still good practise and can prevent and out-of-bounds read in
case the input is not behaving according to the comment.

Reported by: (coypu sdf.org)
admbugs: 857

(cherry picked from commit 09dd08f167812a5fdb516fc98f14dbb43221432f)
(cherry picked from commit 32c2c00e3f90d3a01a03ebdf7131c7e300da034c)

Approved by: so
Security: FreeBSD-SA-22:02.wifi

2 years agonet80211: proper ssid length check in setmlme_assoc_adhoc()
Bjoern A. Zeeb [Wed, 6 Oct 2021 18:41:37 +0000 (18:41 +0000)]
net80211: proper ssid length check in setmlme_assoc_adhoc()

A user supplied SSID length is used without proper checks in
setmlme_assoc_adhoc() which can lead to copies beyond the end
of the user supplied buffer.
The ssid is a fixed size array for the ioctl and the argument
to setmlme_assoc_adhoc().
In addition to an ssid_len check of 0 also error in case the
ssid_len is larger than the size of the ssid array to prevent
problems.

PR: 254737
Reported by: Tommaso (cutesmilee.research protonmail.com)

(cherry picked from commit 526370fb85db4b659cff4625eb2f379acaa4a1a8)
(cherry picked from commit 0525ece3554edce14fa68a7fb61078ae2110c44b)
(cherry picked from commit ab5678c6c0d0b28feafdb2fd397866d6088f37d8)

Approved by: so
Security: FreeBSD-SA-22:02.wifi

2 years agonet80211: prevent plaintext injection by A-MSDU RFC1042/EAPOL frames
Mathy Vanhoef [Sun, 6 Jun 2021 22:10:56 +0000 (22:10 +0000)]
net80211: prevent plaintext injection by A-MSDU RFC1042/EAPOL frames

No longer accept plaintext A-MSDU frames that start with an RFC1042
header with EtherType EAPOL.  This is done by only accepting EAPOL
packets that are included in non-aggregated 802.11 frames.

Note that before this patch, FreeBSD also only accepted EAPOL frames
that are sent in a non-aggregated 802.11 frame due to bugs in
processing EAPOL packets inside A-MSDUs. In other words,
compatibility with legitimate devices remains the same.

This relates to section 6.5 in the 2021 Usenix "FragAttacks" (Fragment
and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation)
paper.

Submitted by: Mathy Vanhoef (Mathy.Vanhoef kuleuven.be)
Security: CVE-2020-26144
PR: 256120

(cherry picked from commit ffc19cf52da5546973965f78cf32aa0f2c9657f8)
(cherry picked from commit 8b2ba742cc2c732bc4bc1d43f8256adce06657d0)

Approved by: so
Security: FreeBSD-SA-22:02.wifi

2 years agonet80211: mitigation against A-MSDU design flaw
Mathy Vanhoef [Sun, 6 Jun 2021 22:10:52 +0000 (22:10 +0000)]
net80211: mitigation against A-MSDU design flaw

Mitigate A-MSDU injection attacks by detecting if the destination address
of a subframe equals an RFC1042 (i.e., LLC/SNAP) header, and if so
dropping the complete A-MSDU frame.  This mitigates known attacks,
although new (unknown) aggregation-based attacks may remain possible.

This defense works because in A-MSDU aggregation injection attacks, a
normal encrypted Wi-Fi frame is turned into an A-MSDU frame. This means
the first 6 bytes of the first A-MSDU subframe correspond to an RFC1042
header. In other words, the destination MAC address of the first A-MSDU
subframe contains the start of an RFC1042 header during an aggregation
attack. We can detect this and thereby prevent this specific attack.

This relates to section 7.2 in the 2021 Usenix "FragAttacks" (Fragment
and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation)
paper.

Submitted by: Mathy Vanhoef (Mathy.Vanhoef kuleuven.be)
Security: CVE-2020-24588
PR: 256119

(cherry picked from commit f024bdf1155f36d2d8c4caa533b66e4040c4c469)
(cherry picked from commit 41ca1d50a8657959df2009daa300dda56a090d5e)

Approved by: so
Security: FreeBSD-SA-22:02.wifi

2 years agonet80211: reject mixed plaintext/encrypted fragments
Mathy Vanhoef [Sun, 6 Jun 2021 22:10:41 +0000 (22:10 +0000)]
net80211: reject mixed plaintext/encrypted fragments

ieee80211_defrag() accepts fragmented 802.11 frames in a protected Wi-Fi
network even when some of the fragments are not encrypted.
Track whether the fragments are encrypted or not and only accept
successive ones if they match the state of the first fragment.

This relates to section 6.3 in the 2021 Usenix "FragAttacks" (Fragment
and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation)
paper.

Submitted by: Mathy Vanhoef (Mathy.Vanhoef kuleuven.be)
Security: CVE-2020-26147
PR: 256118

(cherry picked from commit 11572d7d7fb9802ceb46ea9dc6cbe3bb95373e55)
(cherry picked from commit e13d483c5677d12b52f1c81537d54faa85ed43b9)

Approved by: so
Security: FreeBSD-SA-22:02.wifi

2 years agoFix a bug in BN_mod_sqrt() that can cause it to loop forever.
Gordon Tetlow [Tue, 15 Mar 2022 16:48:59 +0000 (09:48 -0700)]
Fix a bug in BN_mod_sqrt() that can cause it to loop forever.

Obtained from: OpenSSL Project
Security: CVE-2022-0778
Security: FreeBSD-SA-22:03.openssl

(cherry picked from commit fdc418f15e92732a3551832bcb625ba9b47242df)
(cherry picked from commit 5f3d952f6e6bce1151ab4a260c6922ba10d7a7ba)

Approved by: so

2 years agoAdd UPDATING entries and bump version.
Gordon Tetlow [Tue, 1 Feb 2022 17:42:23 +0000 (09:42 -0800)]
Add UPDATING entries and bump version.

Approved by: so

2 years agoamd64: disable LA57 by default for now
Konstantin Belousov [Wed, 28 Apr 2021 15:50:16 +0000 (18:50 +0300)]
amd64: disable LA57 by default for now

(cherry picked from commit 72a42ec63b4a98f812f5f6164415eeb9a55e1933)
(cherry picked from commit df6241fcef9a8df76839caeaef61520d5f3a7925)

Approved by: so
Security: FreeBSD-EN-22:07.la57

2 years agoAdd UPDATING entries and bump version
Ed Maste [Tue, 11 Jan 2022 17:42:59 +0000 (12:42 -0500)]
Add UPDATING entries and bump version

Approved by: so

2 years agovt: bound buffer access in redraw optimization
Ed Maste [Wed, 22 Sep 2021 18:41:00 +0000 (14:41 -0400)]
vt: bound buffer access in redraw optimization

PR: 248628
Reported by: oleg
Reviewed by: cem, oleg (both earlier)
Fixes: ee97b2336aa4 ("Speed up vt(4) by keeping...")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32059

(cherry picked from commit dbc7ca59451561a179f9852642e13ef024169d84)
(cherry picked from commit e4fcff8ee124f8faed2f1fcc1e15b7ae6906d4d7)

Approved by: so
Security: FreeBSD-SA-22:01.vt

2 years agoFix fragmented UDP packets handling since rev.360967.
Maxim Sobolev [Mon, 10 Jan 2022 00:19:08 +0000 (19:19 -0500)]
Fix fragmented UDP packets handling since rev.360967.

Consider IP_MF flag when checking length of the UDP packet to
match the declared value.

Sponsored by: Sippy Software, Inc.
Differential Revision: https://reviews.freebsd.org/D32363
MFC after: 2 weeks

(cherry picked from commit 461e6f23db3b9794e6af88b381b066a2c0463d1c)
(cherry picked from commit 73c5a2566dbb3ae57970b203d4de6fcf6088701c)

Approved by: so
Sponsored by: The FreeBSD Foundation [rework for 13.0]
Errata: FreeBSD-EN-22:06.libalias

2 years agotail: fix "tail -F" file rotation detection
Chuck Silvers [Tue, 2 Feb 2021 00:21:14 +0000 (16:21 -0800)]
tail: fix "tail -F" file rotation detection

When checking if the newly opened file is the same as the old one,
we need to fstat() the new file descriptor, not the old one again.

Reviewed by: glebius
Sponsored by: Netflix

(cherry picked from commit 7787e7eed9d2a43fb6eb66666040f1b495995a2f)
(cherry picked from commit 8c59e863e2c03c3b4ab2c403243561a4cc4fcb10)

Approved by: so
Errata: FreeBSD-EN-22:05.tail

2 years agoHyper-V: vPCI: Prepopulate device bars
Wei Hu [Sat, 27 Nov 2021 06:42:34 +0000 (06:42 +0000)]
Hyper-V: vPCI: Prepopulate device bars

In recent Hyper-V releases on Windows Server 2022, vPCI code does not
initialize the last 4 bit of device bar registers. This behavior change
could result weird problems cuasing PCI code failure when configuring
bars.

Just write all 1's to those bars whose probed values are not the same
as current read ones. This seems to make Hyper-V vPCI and
pci_write_bar() to cooperate correctly on these releases.

Reported by: khng@freebsd.org
Tested by: khng@freebsd.org
MFC after: 2 weeks
Sponsored by: Microsoft

(cherry picked from commit 75412a521f60d4b0393c730ffb284e7c6ff9d2de)
(cherry picked from commit d11e9de955ea01fe01dce58c7eb090fe0352bced)

Approved by: so
Errata: FreeBSD-EN-22:03.hyperv

2 years agoamd64: correct size of the SSE area in the xsave layout
Konstantin Belousov [Sun, 12 Dec 2021 02:49:50 +0000 (04:49 +0200)]
amd64: correct size of the SSE area in the xsave layout

(cherry picked from commit 73b357be92385cbb70ba19e7023a736af2c6b493)
(cherry picked from commit 1d6ebddb62bc18833b21a15f8e7eb86102140100)

Approved by: so
Errata: FreeBSD-EN-22:02.xsave

2 years agofsck_ffs: fix bad inode number errors
Kirk McKusick [Wed, 24 Mar 2021 23:50:24 +0000 (16:50 -0700)]
fsck_ffs: fix bad inode number errors

Fix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode".

(cherry picked from commit bc444e2ec6e6cc9d96d35ab7ce3c02c0da952fad)
(cherry picked from commit fab7c18ce3229d53b732fdfdbb6e9a1a1c72739a)

Fix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode".

(cherry picked from commit fe815b88b553667c40353c46b58f9779efa3570e)

PR:           255979
Sponsored by: Netflix

(cherry picked from commit e198c1dc8f6faaa85bd20990d15e3bcb9d081873)

Approved by: so
Errata: FreeBSD-EN-22:01.fsck_ffs

2 years agoFix Cirrus-CI boot smoke test
Ed Maste [Mon, 19 Apr 2021 18:36:21 +0000 (14:36 -0400)]
Fix Cirrus-CI boot smoke test

We now use compute_engine_instance which allows us to specify a custom
disk size.  Also go back to using the default qemu version (rather than
qemu42 or qemu-devel) as any issues were fixed some time ago.

Reviewed by: lwhsu, markj
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30082

(cherry picked from commit a7d593dd1da27833b5384349700bc3c7bcae6aad)
(cherry picked from commit 982cd962061552fbeb43e3bce2a5d7fd05231dde)
(cherry picked from commit 407abff2b91847e23711625ad7c69c17e99b3d1d)
(cherry picked from commit 87c0db9d0174fb1906a58d2f3bd5aff6dad528de)
(cherry picked from commit cec2682cd2910080951782391d7d7cd30c95c4ea)
(cherry picked from commit 088dbb4b8d3eb8275c9aba34eb521dbc79f98f51)

Note that this does not have any effect on built artifacts (and thus is
not an EN candidate) but allows Cirrus-CI to be used on the releng
branch.

Approved by: so

2 years agortld: Do not install libmap.conf when installing the COMPAT32 version
Emmanuel Vadot [Wed, 13 Oct 2021 12:40:26 +0000 (14:40 +0200)]
rtld: Do not install libmap.conf when installing the COMPAT32 version

This has the effect of installing the same file twice at the same location
and confuse pkgbase as we add this file twice in the package config part.

Approved by: so (markj@)
MFC after:  1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit d0f0e0bd741af867582ceede8ac1b0aec90eae2d)

2 years agoAdd UPDATING entries and bump version.
Gordon Tetlow [Wed, 3 Nov 2021 20:53:11 +0000 (13:53 -0700)]
Add UPDATING entries and bump version.

Approved by:    so

2 years agoTimezone database information update.
Gordon Tetlow [Wed, 3 Nov 2021 20:44:52 +0000 (13:44 -0700)]
Timezone database information update.

Approved by: so
Security: EN-21:29.tzdata

2 years agoFix kernel panic in vmci driver initialization.
Gordon Tetlow [Wed, 3 Nov 2021 20:40:19 +0000 (13:40 -0700)]
Fix kernel panic in vmci driver initialization.

Approved by: so
Security: EN-21:28.vmci

2 years agoRoot certificate bundle update.
Gordon Tetlow [Wed, 3 Nov 2021 20:30:05 +0000 (13:30 -0700)]
Root certificate bundle update.

Approved by: so
Security: EN-21:27.caroot

2 years agoFix libevent1 ABI breakage.
Gordon Tetlow [Wed, 3 Nov 2021 20:23:13 +0000 (13:23 -0700)]
Fix libevent1 ABI breakage.

Approved by: so
Security: EN-21:26.libevent

2 years agoAdd UPDATING entries and bump version.
Gordon Tetlow [Tue, 24 Aug 2021 18:23:29 +0000 (11:23 -0700)]
Add UPDATING entries and bump version.

Approved by: so

2 years agoFix multiple OpenSSL vulnerabilities.
Gordon Tetlow [Tue, 24 Aug 2021 18:08:04 +0000 (11:08 -0700)]
Fix multiple OpenSSL vulnerabilities.

Approved by:    so
Security:       SA-21:16.openssl
Security:       CVE-2021-3711
Security:       CVE-2021-3712

2 years agoFix libfetch out of bounds read.
Gordon Tetlow [Tue, 24 Aug 2021 18:00:47 +0000 (11:00 -0700)]
Fix libfetch out of bounds read.

Approved by: so
Security: SA-21:15.libfetch
Security: CVE-2021-36159

2 years agoFix remote code execution in ggatec(8).
Gordon Tetlow [Tue, 24 Aug 2021 17:37:45 +0000 (10:37 -0700)]
Fix remote code execution in ggatec(8).

Approved by: so
Security: SA-21:14.ggatec
Security: CVE-2021-29630

2 years agoFix missing error handling in bhyve(8) device models.
Gordon Tetlow [Tue, 24 Aug 2021 17:33:35 +0000 (10:33 -0700)]
Fix missing error handling in bhyve(8) device models.

Approved by: so
Security: SA-21:13.bhyve
Security: CVE-2021-29631

2 years agoFix NVMe iovec construction for large IOs.
Gordon Tetlow [Tue, 24 Aug 2021 17:28:07 +0000 (10:28 -0700)]
Fix NVMe iovec construction for large IOs.

Approved by: so
Security: EN-21:25.bhyve

2 years agoFix OpenSSL 1.1.1e API functions not being exported.
Gordon Tetlow [Tue, 24 Aug 2021 17:25:47 +0000 (10:25 -0700)]
Fix OpenSSL 1.1.1e API functions not being exported.

Approved by: so
Security: EN-21:24.libcrypto

2 years agoFix virtio_blk(4) failing to attach on some hypervisors.
Gordon Tetlow [Tue, 24 Aug 2021 16:31:52 +0000 (09:31 -0700)]
Fix virtio_blk(4) failing to attach on some hypervisors.

Approved by: so
Security: EN-21:23.virtio_blk

2 years agoAdd UPDATING entries and bump version
Mark Johnston [Tue, 29 Jun 2021 17:18:53 +0000 (13:18 -0400)]
Add UPDATING entries and bump version

Approved by: so

2 years agolinux(4): Prevent integer overflow in futex_requeue.
Dmitry Chagin [Thu, 10 Jun 2021 11:23:11 +0000 (14:23 +0300)]
linux(4): Prevent integer overflow in futex_requeue.

To prevent a signed integer overflow in futex_requeue add a sanity check
to catch negative values of nrwake or nrrequeue.

Approved by: so
Security: EN-21:22.linux_futex

(cherry picked from commit 25b09d6f398ea8a260ee8e2e8209fd76c61e13ee)
(cherry picked from commit 7a37d13b6cfa5235c88678f96ede6bfca74b28e8)

2 years agoipfw: Update the pfil mbuf pointer in ipfw_check_frame()
Mark Johnston [Wed, 16 Jun 2021 13:46:56 +0000 (09:46 -0400)]
ipfw: Update the pfil mbuf pointer in ipfw_check_frame()

ipfw_chk() might call m_pullup() and thus can change the mbuf chain
head.  In this case, the new chain head has to be returned to the pfil
hook caller, otherwise the pfil hook caller is left with a dangling
pointer.

Note that this affects only the link-layer hooks installed when the
net.link.ether.ipfw sysctl is set to 1.

Approved by: so
Security: EN-21:21.ipfw
PR: 256439, 254015, 255069, 255104
Fixes: f355cb3e6
Reviewed by: ae
Sponsored by: The FreeBSD Foundation

(cherry picked from commit bc6a2267fffeafd3946637607a74cfd639398f9d)
(cherry picked from commit ed1acef3fe3053b418ce3e41036ccf24957253a4)

2 years agoFix vlan creation for the older ifconfig(8) binaries.
Alexander V. Chernikov [Sun, 11 Apr 2021 16:47:03 +0000 (17:47 +0100)]
Fix vlan creation for the older ifconfig(8) binaries.

Approved by: so
Security: EN-21:20.vlan
Reported by: allanjude
MFC after: immediately

(cherry picked from commit afbb64f1d85b7d8c2938031c3567946b5d10da4f)
(cherry picked from commit 9abc85d17d0538704641fe2c4d9da1b666f86e4e)

2 years agolibcasper: fix descriptors numbers
Mariusz Zaborski [Wed, 9 Jun 2021 21:46:51 +0000 (23:46 +0200)]
libcasper: fix descriptors numbers

Casper services expect that the first 3 descriptors (stdin/stdout/stderr)
will point to /dev/null. Which Casper will ensure later. The Casper
services are forked from the original process. If the initial process
closes one of those descriptors, Casper may reuse one of them for it on
purpose. If this is the case, then renumarate the descriptors used by
Casper to higher numbers. This is done already after the fork, so it
doesn't break the parent process.

Approved by: so
Security: EN-21:19.libcasper
PR: 255339
Reported by: Borja Marcos <borjam (at) sarenet.es>
Tested by: jkim@

(cherry picked from commit aa310ebfba3d49a0b6b03a103b969731a8136a73)
(cherry picked from commit 934e10b4a388b13c2bcd8fbac8cd8cc4a641b1b0)

2 years agoAdd C++ headers <barrier> <concepts> <execution> <latch> <numbers> <semaphore>
Dimitry Andric [Thu, 3 Jun 2021 18:53:18 +0000 (20:53 +0200)]
Add C++ headers <barrier> <concepts> <execution> <latch> <numbers> <semaphore>

I missed adding these to the libc++ Makefile, when importing
llvm-project 11.0.0-rc1, even though they were supplied by upstream.

While here, update OptionalObsoleteFiles.inc to add these new headers,
and cleanup old cruft.

Approved by: so
Security: EN-21:18.libc++
Reported by: yuri
Submitted by: jkim (Makefile diff)
PR: 255374
MFC after: 3 days

(cherry picked from commit 95aa617e4bf09fcc813b1bab3d0dbf4b606807b1)
(cherry picked from commit 70e13c4cffd5ff7a70296bc5c4c3b7525c278b1d)

2 years agoAdd UPDATING entries and bump version
Mark Johnston [Tue, 1 Jun 2021 20:28:18 +0000 (16:28 -0400)]
Add UPDATING entries and bump version

Approved by: so

2 years agolibradius: Fix attribute length validation in rad_get_attr(3)
Mark Johnston [Fri, 28 May 2021 14:41:43 +0000 (10:41 -0400)]
libradius: Fix attribute length validation in rad_get_attr(3)

The length of the attribute header needs to be excluded when comparing
the attribute length against the length of the packet.  Otherwise,
validation may incorrectly fail when fetching the final attribute in a
message.

Approved by: so
Security: FreeBSD-EN-21:17.libradius
Fixes: 8d5c78130 ("libradius: Fix input validation bugs")
Reported by: Peter Eriksson
Tested by: Peter Eriksson
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6bb5699d2b59491097bc21ffa3c097cdd4853f89)
(cherry picked from commit f9972532343bb1eb101bf7afef2966972eea3b5e)

2 years agoAdd UPDATING entries and bump version
Mark Johnston [Wed, 26 May 2021 20:23:45 +0000 (16:23 -0400)]
Add UPDATING entries and bump version

Approved by: so

2 years agolibradius: Fix input validation bugs
Mark Johnston [Tue, 25 May 2021 17:59:09 +0000 (13:59 -0400)]
libradius: Fix input validation bugs

Approved by: so
Security: FreeBSD-SA-21:12.libradius
Security: CVE-2021-29629
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8d5c7813061dfa0b187500dfe3aeea7a28181c13)
(cherry picked from commit bec0d2c9c8413707b0fff8e65fb96aa53f149be3)

2 years agobc: Fix stack handling in the "P" command implementation
Mark Johnston [Wed, 26 May 2021 20:11:57 +0000 (16:11 -0400)]
bc: Fix stack handling in the "P" command implementation

Approved by: so
Security: EN-21:16.bc
Submitted by: se

2 years agovirtio_pci_legacy: Allow memory space for configuration
Ka Ho Ng [Sat, 20 Mar 2021 07:40:55 +0000 (15:40 +0800)]
virtio_pci_legacy: Allow memory space for configuration

For guests running under some kind of VMMs, configuration structure is
available in memory space but not I/O space.

Approved by: so
Security: EN-21:15.virtio
Reported by: Yuan Rui <number201724@me.com>
Reviewed by: rpokala, bryanv, jhb
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D28818

(cherry picked from commit cf5d1112408ddef3fdff8212599727c49ba90fa4)
(cherry picked from commit 2e107638eac2a721bc024314ae79d4688edfc130)

2 years agovirtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap
Ka Ho Ng [Sat, 20 Mar 2021 07:40:52 +0000 (15:40 +0800)]
virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap

The MSI-X resource shouldn't be assumed to be always on BAR1.
The Virtio v1.1 Spec did not specify that MSI-X table and PBA BAR has to
be BAR1 either.

Approved by: so
Security: EN-21:15.virtio
Reported by: Yuan Rui <number201724@me.com>
Reviewed by: bryanv, jhb
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D28817

(cherry picked from commit faf9a4e9142a02c289ee543a6091bd4b925c6a63)
(cherry picked from commit 98740ead97c60caca1d7cb3e996108c75f499beb)

2 years agoamd64/linux*: add required header to get the constant value
Konstantin Belousov [Tue, 25 May 2021 22:19:44 +0000 (01:19 +0300)]
amd64/linux*: add required header to get the constant value

Otherwise asm silently interpret it as the external global symbol.

Approved by: so
Security: FreeBSD-SA-21:11.smap
Security: CVE-2021-29628
Reported by: bz
Sponsored by: The FreeBSD Foundation
Fixes: 91aae953cb80

(cherry picked from commit a59f0285377aa3d61cccda64e9ade126ecb3d2d9)
(cherry picked from commit 876ffe28796c4a81fbedcdaa4d7e4527cd1c79c5)

2 years agoamd64: clear PSL.AC in the right frame
Konstantin Belousov [Sat, 22 May 2021 19:48:36 +0000 (22:48 +0300)]
amd64: clear PSL.AC in the right frame

If copyin family of routines fault, kernel does clear PSL.AC on the
fault entry, but the AC flag of the faulted frame is kept intact.  Since
onfault handler is effectively jump, AC survives until syscall exit.

Approved by: so
Security: FreeBSD-SA-21:11.smap
Security: CVE-2021-29628
Reported by: m00nbsd, via Sony
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
admbugs: 975

(cherry picked from commit 91aae953cb807d6fb7a70782b323bf9beb60d7c9)
(cherry picked from commit 6bbde34ae6088285af9d1cc587249c3e7a0159a9)

2 years agodivert: Fix mbuf ownership confusion in div_output()
Mark Johnston [Fri, 7 May 2021 18:27:58 +0000 (14:27 -0400)]
divert: Fix mbuf ownership confusion in div_output()

div_output_outbound() and div_output_inbound() relied on the caller to
free the mbuf if an error occurred.  However, this is contrary to the
semantics of their callees, ip_output(), ip6_output() and
netisr_queue_src(), which always consume the mbuf.  So, if one of these
functions returned an error, that would get propagated up to
div_output(), resulting in a double free.

Fix the problem by making div_output_outbound() and div_output_inbound()
responsible for freeing the mbuf in all cases.

Approved by: so
Security: EN-21:12.divert
Reported by: Michael Schmiedgen <schmiedgen@gmx.net>
Tested by: Michael Schmiedgen
Reviewed by: donner
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30129

(cherry picked from commit a1fadf7de25b973a308b86d04c4ada4fa8be193f)
(cherry picked from commit eafeee082c50850c2577f4fce0eaa7acb034f565)

2 years agopms(4): Limit maximum I/O size to 256KB instead of 1MB.
Alexander Motin [Fri, 16 Apr 2021 19:39:01 +0000 (15:39 -0400)]
pms(4): Limit maximum I/O size to 256KB instead of 1MB.

There is a weird limit of AGTIAPI_MAX_DMA_SEGS (128) S/G segments per
I/O since the initial driver import.  I don't know why it was added,
can only guess some hardware limitation, but in worst case it means
maximum I/O size of 508KB.  Respect it to be safe, rounding to 256KB.

Approved by: so
Security: EN-21:14.pms
MFC after: 1 week
Sponsored by: iXsystems, Inc.

(cherry picked from commit 3e347834200b5d91a33384e696793e4ac20a44d4)
(cherry picked from commit 6514cb18d94e9ab46406b7077d207c8b1a551e6e)

2 years agopms(4): Do not return CAM_REQ_CMP on errors.
Alexander Motin [Fri, 16 Apr 2021 19:16:09 +0000 (15:16 -0400)]
pms(4): Do not return CAM_REQ_CMP on errors.

It is a direct request for data corruptions, one report of which we
have received.  I am very surprised that only one.

Approved by: so
Security: EN-21:14.pms
MFC after: 1 week
Sponsored by: iXsystems, Inc.

(cherry picked from commit 8434a65ce49bd6bc6779f0e57b0ce0f4bc46f48e)
(cherry picked from commit 4bc708e1e87b493551fc286e25477490b1a75b99)

2 years agompt(4): Remove incorrect S/G segments limits.
Alexander Motin [Sat, 17 Apr 2021 14:41:35 +0000 (10:41 -0400)]
mpt(4): Remove incorrect S/G segments limits.

First, two of those four checks are unreachable.
Second, I don't believe there should be ">=" instead of ">".
Third, bus_dma(9) already returns the same EFBIG if ">".

This fixes false I/O errors in worst S/G cases with maxphys >= 2MB.

Approved by: so
Security: EN-21:13.mpt
MFC after: 1 week

(cherry picked from commit 0f29396e493bd87ffa6a63fcb602b12e79d21a1e)
(cherry picked from commit f0077b4c1dcfa7eda6efadf197e8423fe002ac5d)

3 years ago13.0: update to RELEASE
Glen Barber [Fri, 9 Apr 2021 00:14:30 +0000 (20:14 -0400)]
13.0: update to RELEASE

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years ago13.0/UPDATING: anticipate 13.0-RELEASE date
Glen Barber [Fri, 9 Apr 2021 00:13:47 +0000 (20:13 -0400)]
13.0/UPDATING: anticipate 13.0-RELEASE date

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years ago13.0: set static __FreeBSD_version
Glen Barber [Fri, 9 Apr 2021 00:12:37 +0000 (20:12 -0400)]
13.0: set static __FreeBSD_version

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoAdd UPDATING entries and bump version
Mark Johnston [Tue, 6 Apr 2021 19:03:53 +0000 (15:03 -0400)]
Add UPDATING entries and bump version

Approved by: re (implicit, so)
Approved by: so

3 years agomount: Disallow mounting over a jail root
Mark Johnston [Mon, 5 Apr 2021 21:19:15 +0000 (17:19 -0400)]
mount: Disallow mounting over a jail root

Discussed with: jamie
Approved by: re (so, implicit)
Approved by: so
Security: CVE-2020-25584
Security: FreeBSD-SA-21:10.jail_mount

(cherry picked from commit 2425f5e9128102c8e6e473567ad6759a55be5b02)
(cherry picked from commit 3ae17faa370491d7ce1fcfc4d5b9cd1ed0117b67)

3 years agovm_fault: Shoot down multiply mapped COW source page mappings
Mark Johnston [Mon, 15 Mar 2021 20:02:17 +0000 (16:02 -0400)]
vm_fault: Shoot down multiply mapped COW source page mappings

Reviewed by: kib, rlibby
Discussed with: alc
Approved by: re (so, implicit)
Approved by: so
Security: CVE-2021-29626
Security: FreeBSD-SA-21:08.vm

(cherry picked from commit 982693bb729badac4e65ecd59772979f2849a2b2)
(cherry picked from commit 2e08308d62f381312b3da9dac8970dcdad4b3f2d)

3 years ago13.0: update to RC5
Glen Barber [Fri, 2 Apr 2021 00:26:03 +0000 (20:26 -0400)]
13.0: update to RC5

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoZero `struct weightened_nhop` fields in nhgrp_get_addition_group().
Alexander V. Chernikov [Sat, 20 Mar 2021 08:26:03 +0000 (08:26 +0000)]
Zero `struct weightened_nhop` fields in nhgrp_get_addition_group().

`struct weightened_nhop` has spare 32bit between the fields due to
 the alignment (on amd64).
Not zeroing these spare bits results in duplicating nhop groups
 in the kernel due to the way how comparison works.

Approved by: re (gjb)

(cherry picked from commit 6f43c72b472ee78e04f1ebd347ca0ae7787ee876)

3 years agoFix nexhtop group index array scaling.
Alexander V. Chernikov [Mon, 29 Mar 2021 23:00:17 +0000 (23:00 +0000)]
Fix nexhtop group index array scaling.

The current code has the limit of 127 nexthop groups due to the
 wrongly-checked bitmask_copy() return value.

PR: 254303
Reported by: Aleks <a.ivanov at veesp.com>
Approved by: re (gjb)

(cherry picked from commit 923e7f7e12670e97b097a195e69c848a6e8773a2)

3 years agoFetch the sigfastblock value in syscalls that wait for signals
Jonathan T. Looney [Fri, 12 Mar 2021 18:14:17 +0000 (18:14 +0000)]
Fetch the sigfastblock value in syscalls that wait for signals

We have seen several cases of processes which have become "stuck" in
kern_sigsuspend(). When this occurs, the kernel's td_sigblock_val
is set to 0x10 (one block outstanding) and the userspace copy of the
word is set to 0 (unblocked). Because the kernel's cached value
shows that signals are blocked, kern_sigsuspend() blocks almost all
signals, which means the process hangs indefinitely in sigsuspend().

It is not entirely clear what is causing this condition to occur.
However, it seems to make sense to add some protection against this
case by fetching the latest sigfastblock value from userspace for
syscalls which will sleep waiting for signals. Here, the change is
applied to kern_sigsuspend() and kern_sigtimedwait().

Approved by: re (gjb)

(cherry picked from commit dbec10e08808e375365fb2a2462f306e0cdfda32)
(cherry picked from commit a25c17022e2d6344dcbc6192af276d2798d76d44)

3 years agoTeach DTrace that unaligned accesses are OK on aarch64, not just x86.
Robert Watson [Mon, 22 Mar 2021 01:50:00 +0000 (01:50 +0000)]
Teach DTrace that unaligned accesses are OK on aarch64, not just x86.

Reviewed by: andrew
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D29369

(cherry picked from commit fb581531c1a0e6f1bf5392a2e97ed39d21d6e1fd)
(cherry picked from commit ba08ba5226ff8551ea3926ce49b8604b71c9cabf)

3 years agoTune DTrace 'aframes' for the FBT and profile providers on arm64.
Robert Watson [Sun, 21 Mar 2021 00:01:54 +0000 (00:01 +0000)]
Tune DTrace 'aframes' for the FBT and profile providers on arm64.

In both cases, too few frames were trimmed, leading to exception handling
or DTrace internals being exposed in stack traces exposed by D's stack()
primitive.

Reviewed by: emaste, andrew
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D29356

(cherry picked from commit 599fb1d198ec6792ba062114d2589ca9f01a3568)
(cherry picked from commit fcc700abe4fa85b0f0ec9d953436725533cecc17)

3 years agoarm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs
Ed Maste [Wed, 17 Mar 2021 14:10:41 +0000 (10:10 -0400)]
arm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs

On FreeBSD/arm fill_fpregs, fill_dbregs are stubs that zero the reg
struct and return success. set_fpregs and set_dbregs do nothing and
return success.

Provide the same implementation for arm64 COMPAT_FREEBSD32.

Reviewed by: andrew
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29314

(cherry picked from commit 5be27cbf16c85ce95d21db57349f61494f851821)
(cherry picked from commit db50c8123469e3eab07e931019bf6d4df2d55c78)

3 years agomn: report that this driver is removed in 14, not 13
Ed Maste [Thu, 25 Mar 2021 02:35:38 +0000 (22:35 -0400)]
mn: report that this driver is removed in 14, not 13

(cherry picked from commit a66e75d9e2ddd9a84f8de204438282a25bb1a954)

mn: bump deprecation version to 14 in man page as well

Fixes: 66e75d9e2ddd ("mn: report that this driver is removed in 14, not 13")
(cherry picked from commit 6acecf247f60fcd3ba9662d54c59fc7bd46fb67a)

Approved by: re (gjb)

3 years ago13.0: update to RC4
Glen Barber [Sun, 28 Mar 2021 23:51:40 +0000 (19:51 -0400)]
13.0: update to RC4

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoPlug nexthop group refcount leak.
Alexander V. Chernikov [Wed, 24 Mar 2021 23:51:45 +0000 (23:51 +0000)]
Plug nexthop group refcount leak.
In case with batch route delete via rib_walk_del(), when
 some paths from the multipath route gets deleted, old
 multipath group were not freed.

PR:    254496
Reported by:   Zhenlei Huang <zlei.huang@gmail.com>
Approved by: re (gjb)

(cherry picked from commit 47c00a9835926e96e562c67fa28e4432e99d9c56)

3 years agoFix panic when destroying interface with ECMP routes.
Alexander V. Chernikov [Tue, 23 Mar 2021 22:00:04 +0000 (22:00 +0000)]
Fix panic when destroying interface with ECMP routes.

Reported by: Zhenlei Huang <zlei.huang at gmail.com>
PR: 254496
Approved by: re (gjb)

(cherry picked from commit af85312e8a6f34ea7c8af77b9841fab6b5559e25)

3 years agoFix kassert panic when inserting multipath routes from multiple threads.
Alexander V. Chernikov [Sun, 21 Mar 2021 18:15:29 +0000 (18:15 +0000)]
Fix kassert panic when inserting multipath routes from multiple threads.

Reported by: Marco Zec <zec at fer.hr>
Approved by: re (gjb)

(cherry picked from commit 42f997d9b721ce5b64c37958f21fa81630f5a224)

3 years agoFlush remaining routes from the routing table during VNET shutdown.
Alexander V. Chernikov [Mon, 8 Mar 2021 21:35:41 +0000 (21:35 +0000)]
Flush remaining routes from the routing table during VNET shutdown.

Summary:
This fixes rtentry leak for the cloned interfaces created inside the
 VNET.

Loopback teardown order is `SI_SUB_INIT_IF`, which happens after `SI_SUB_PROTO_DOMAIN` (route table teardown).
Thus, any route table operations are too late to schedule.
As the intent of the vnet teardown procedures to minimise the amount of effort by doing global cleanups instead of per-interface ones, address this by adding a relatively light-weight routing table cleanup function, `rib_flush_routes()`.
It removes all remaining routes from the routing table and schedules the deletion, which will happen later, when `rtables_destroy()` waits for the current epoch to finish.

Test Plan:
```
set_skip:set_skip_group_lo  ->  passed  [0.053s]
tail -n 200 /var/log/messages | grep rtentry
```

PR: 253998
Reported by: rashey at superbox.pl
Reviewed By: kp
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D29116

(cherry picked from commit 8aafa7a0276302a0dcc3d0bd78b4d3842dfd1640)

3 years agoFix blackhole/reject routes.
Alexander V. Chernikov [Mon, 8 Feb 2021 23:29:05 +0000 (23:29 +0000)]
Fix blackhole/reject routes.

Traditionally *BSD routing stack required to supply some
 interface data for blackhole/reject routes. This lead to
 varieties of hacks in routing daemons when inserting such routes.
With the recent routeing stack changes, gateway sockaddr without
 RTF_GATEWAY started to be treated differently, purely as link
 identifier.

This change broke net/bird, which installs blackhole routes with
 127.0.0.1 gateway without RTF_GATEWAY flags.

Fix this by automatically constructing necessary gateway data at
 rtsock level if RTF_REJECT/RTF_BLACKHOLE is set.

Reported by: Marek Zarychta <zarychtam at plan-b.pwste.edu.pl>
Reviewed by: donner
Approved by: re (gjb)

(cherry picked from commit 3489286a5f368e7fcf11a9691f9bb5df77abe9a3)

3 years agorelease: amd64: Fix ISO/USB hybrid image
Emmanuel Vadot [Sat, 27 Mar 2021 11:04:51 +0000 (12:04 +0100)]
release: amd64: Fix ISO/USB hybrid image

Recent mkimg changes forces to have partitions given in explicit order.
This is so we can have the first partition starting at a specific offset
and the next ones starting after without having to specify an offset.
Switch the partition in the mkisoimage.sh script so the first one created
is the isoboot one.

Approved by: re(gjb)
PR:    254490
Reported by: Michael Dexter <editor@callfortesting.org
Tested by: Vincent Milum Jr <freebsd@darkain.com>
MFC after: Right now

(cherry picked from commit 90d2f7c413f9fc4ac479fa5e91ba1de6d4ea8d45)
(cherry picked from commit 08639983e0384556a37d19814f55417f604964a1)

3 years agoMakefile.inc1: unbreak bootstrap when kbdcontrol does not exist
Glen Barber [Wed, 24 Mar 2021 00:47:14 +0000 (20:47 -0400)]
Makefile.inc1: unbreak bootstrap when kbdcontrol does not exist

Approved by: re (cperciva)
Submitted by: Evgeniy Khramtsov
Reviewed by: arichardson
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 50179c5ec7d09d7b02497caf95dca5d33f93bcd9)
(cherry picked from commit 1048c56784c0e1d044b6828b030f326e48eaba28)

3 years agoaccept_filter: Fix filter parameter handling
Mark Johnston [Thu, 25 Mar 2021 21:55:20 +0000 (17:55 -0400)]
accept_filter: Fix filter parameter handling

For filters which implement accf_create, the setsockopt(2) handler
caches the filter name in the socket, but it also incorrectly frees the
buffer containing the copy, leaving a dangling pointer.  Note that no
accept filters provided in the base system are susceptible to this, as
they don't implement accf_create.

Approved by: re (gjb)
Reported by: Alexey Kulaev <alex.qart@gmail.com>
Discussed with: emaste
Security: kernel use-after-free
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 653a437c04440495cd8e7712c7cf39444f26f1ee)
(cherry picked from commit c7d10e7ec872070a40bbddc3158b1997c1df09af)