]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agogic_v3: add message based interrupts support
Cyprien Laplace [Sat, 5 Dec 2020 15:47:33 +0000 (10:47 -0500)]
gic_v3: add message based interrupts support

Pull Request: https://github.com/freebsd/freebsd-src/pull/451

(cherry picked from commit 35ebd8d33ad2f7c2038f6bf9aa02eab21252f689)

3 years agogic_v3: Use 64-bit writes to GICD_IROUTERn
Cyprien Laplace [Thu, 26 Nov 2020 01:17:04 +0000 (20:17 -0500)]
gic_v3: Use 64-bit writes to GICD_IROUTERn

While 32-bit accesses to GICD_IROUTERn are allowed,
this is a 64-bit register.

Pull Request: https://github.com/freebsd/freebsd-src/pull/451

(cherry picked from commit 46ca0b903cad8955574a2c61bed41c2b92aa2273)

3 years agorelease: fix overriding UNAME_r
Glen Barber [Thu, 11 Feb 2021 02:23:58 +0000 (21:23 -0500)]
release: fix overriding UNAME_r

release.sh: fix OSVERSION and UNAME_r overrides

Add PBUILD_FLAGS and UNAME_r overrides to extra_chroot_setup()
to fix building ports for 14-CURRENT builds on 13.x.

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

(cherry picked from commit c511a5ab53ba335dc85f7ac93843872eb5763602)
(cherry picked from commit 6462113b7012025c2d88451c1795368ef0607deb)

3 years agoloader: do not autoselect smaller font than 8x16 with high res display
Toomas Soome [Mon, 8 Feb 2021 22:34:47 +0000 (00:34 +0200)]
loader: do not autoselect smaller font than 8x16 with high res display

The VT screen buffer size is calculated based on our default
built in (8x16) font.

With high-resolution display, we want to use at least 8x16 font,
or we will have large unused areas on screen.

MFC after: 1 week

(cherry picke from commit a26f7358583174f2fe0df3e979f7b8b02069278c)

3 years agoloader: remove BORDER_PIXELS
Toomas Soome [Mon, 8 Feb 2021 18:49:09 +0000 (20:49 +0200)]
loader: remove BORDER_PIXELS

BORDER_PIXELS is left over from picking up the source from illumos
port. Since FreeBSD VT does not use border in terminal size
calculation, there is no reason why should loader use it.

MFC after: 1 week

(cherry picke from commit 96bef2053a87c8d01ce08ea88857e4657489c8e7)

3 years agousr.bin/grep: Fix Address OOB read error
Alex Richardson [Tue, 19 Jan 2021 11:35:07 +0000 (11:35 +0000)]
usr.bin/grep: Fix Address OOB read error

I found this when compiling all the bootstrap tools with -fsanitize=addres:

==65590==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62d000008400 at pc 0x000000473053 bp 0x7ffc1c7dd910 sp 0x7ffc1c7dd0b8
READ of size 32769 at 0x62d000008400 thread T0
    #0 0x473052 in regexec (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x473052)
    #1 0x4c9cf3 in procline /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:539:8
    #2 0x4c8687 in procfile /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:379:18
    #3 0x4c6596 in main /local/scratch/alr48/cheri/freebsd/usr.bin/grep/grep.c:714:8

0x62d000008400 is located 0 bytes to the right of 32768-byte region [0x62d000000400,0x62d000008400)
allocated by thread T0 here:
    #0 0x493d5d in malloc (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x493d5d)
    #1 0x4cad75 in grep_malloc /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:656:13
    #2 0x4c8129 in procfile /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c
    #3 0x4c6596 in main /local/scratch/alr48/cheri/freebsd/usr.bin/grep/grep.c:714:8

SUMMARY: AddressSanitizer: heap-buffer-overflow (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x473052) in regexec

Reviewed By: kevans
MFC after: 1 week

(cherry picked from commit 81c3f64110bb76e24d6062eafd7206c10f676d6f)

3 years agoinetd: fix unix sockaddr's length assignment
Kyle Evans [Fri, 12 Feb 2021 19:19:43 +0000 (13:19 -0600)]
inetd: fix unix sockaddr's length assignment

unsz was always exactly '1' here due to an unfortunate mispositioning
of closing parenthesis. While it's generally irrelevant because bind(2)
is passed the (accurate) sep->se_ctrladdr_size instead, it's not very
helpful for anything locally that wants to use it rather than assuming
that sep->se_ctrladdr_size perfectly fits the end of sun_path.

Just drop unsz entirely and use the result of SUN_LEN() for it.

(cherry picked from commit 1253835121cb38fd93478849e32a4a4c13436fb2)

3 years agofmtree: add a deprecation notice to the manpage
Kyle Evans [Wed, 10 Feb 2021 15:10:52 +0000 (09:10 -0600)]
fmtree: add a deprecation notice to the manpage

Note that this mtree(8) is actually installed as fmtree(8), while
mtree(8) is located in ^/contrib/mtree -- thus, the reference to
mtree(8) makes a lot more sense in the context in which folks would
actually notice it. Shout-out to Ravi for pointing out that this may
not be an obvious fact.

Relnotes: yes

(cherry picked from commit 6fea22cebe5cb1e51e98c894a738bea910b7bc2f)

3 years agoifconfig: fix incorrect wg allowed-ips netmask
Michael Chiu [Mon, 15 Feb 2021 00:38:26 +0000 (00:38 +0000)]
ifconfig: fix incorrect wg allowed-ips netmask

Currently when peer information is displayed with `ifconfig wgN peer ..`
or `ifconfig wgN peer-list`, the netmask of the first `allowed-ips` will
be used as the netmask of all CIDR in `allowed-ips`.  For example, if
the list is `192.168.1.0/24, 172.16.0.0/16`, it will display as
`192.168.1.0/24, 172.16.0.0/24`. While this does not affect the actual
functionality, it is very confusing.

Submitted by:   Michael Chiu <nyan -at- myuji.xyz>
Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D28655

(cherry picked from commit be2003ccfa1b12f372fa1329c38c29fe035f232f)

3 years agoMFC 57785538c6e0d7e8ca0f161ab95bae10fd304047 and
Cy Schubert [Sun, 7 Feb 2021 03:22:52 +0000 (19:22 -0800)]
MFC 57785538c6e0d7e8ca0f161ab95bae10fd304047 and
    1e811efbc591699b872bea42b9de419c373199df:

57785538c6e0d7e8ca0f161ab95bae10fd304047:

Simplify the FreeBSD check using __FreeBSD__ compiler macro.

Rather than rely on __FreeBSD_version, defined in sys/param.h, use
__FreeBSD__ defined by the compiler.

Reported by: emaste
MFC after: 1 week

(cherry picked from commit 57785538c6e0d7e8ca0f161ab95bae10fd304047)

1e811efbc591699b872bea42b9de419c373199df:

Fix non-IPv6 build post 57785538c6e0d7e8ca0f161ab95bae10fd304047.

57785538c6e0d7e8ca0f161ab95bae10fd304047 change the test for FreeBSD
from __FreeBSD_version to __FreeBSD__. However this test was performed
before sys/param.h was included, therefore __FreeBSD_version was never
defined. As the test was never true opt_random_ip_id.h was never included.

Submitted by: bdragon
Reported by: bdragon

(cherry picked from commit 1e811efbc591699b872bea42b9de419c373199df)

3 years agoMFC d20f7a5a3da1aa5bccdabb89c181ca0c49385ecd:
Cy Schubert [Sun, 7 Feb 2021 03:15:27 +0000 (19:15 -0800)]
MFC d20f7a5a3da1aa5bccdabb89c181ca0c49385ecd:

Simply FreeBSD check using __FreeBSD__ and remove OpenBSD

(cherry picked from commit d20f7a5a3da1aa5bccdabb89c181ca0c49385ecd)

3 years agoMFC 344f1083e128d8d41ca31853dac513ca3efd9d1f:
Cy Schubert [Fri, 5 Feb 2021 14:26:04 +0000 (06:26 -0800)]
MFC 344f1083e128d8d41ca31853dac513ca3efd9d1f:

ipfilter: Use the softn (NAT softc) host map size in ip_nat6 calculation.

The ipfilter NAT table host map size is a tunable that defaults to
a macro value defined at build time. HOSTMAP_SIZE is saved in softn
(the ipnat softc) at initialization. It can be tuned (changed) at runtime
using the ipf -T command. If the hostmap_size tunable is adjusted the
calculation to determine where to put new entries in the table was
incorrect. Use the tunable in the NAT softc instead of the static build
time value.

(cherry picked from commit 344f1083e128d8d41ca31853dac513ca3efd9d1f)

3 years agoMFC 10990cb46027b4cc4339540b1217117863b2cd15:
Cy Schubert [Wed, 3 Feb 2021 03:24:05 +0000 (19:24 -0800)]
MFC 10990cb46027b4cc4339540b1217117863b2cd15:

Simplify FreeBSD check.

(cherry picked from commit 10990cb46027b4cc4339540b1217117863b2cd15)

3 years agoMFC e673debe7db8ba95e4ee3b549d2570e71d19b596:
Cy Schubert [Wed, 3 Feb 2021 03:18:48 +0000 (19:18 -0800)]
MFC e673debe7db8ba95e4ee3b549d2570e71d19b596:

Simplify BSD macro tests.

All FreeBSD and NetBSD are BSD >= 199306 and have been for a long time.

(cherry picked from commit e673debe7db8ba95e4ee3b549d2570e71d19b596)

3 years agoMFC 0f34c80f376345b98a972940dd4757e58d7beb06:
Cy Schubert [Thu, 28 Jan 2021 05:50:04 +0000 (21:50 -0800)]
MFC 0f34c80f376345b98a972940dd4757e58d7beb06:

Replace the redundant MENTAT macro with SOLARIS.

MENTAT and SOLARIS are synonymous. Remove the extraneous duplicate
macro.

(cherry picked from commit 0f34c80f376345b98a972940dd4757e58d7beb06)

3 years agoMFC 7071734fae6019d1e3e44daf7deb4478582081cc:
Cy Schubert [Wed, 27 Jan 2021 15:25:00 +0000 (07:25 -0800)]
MFC 7071734fae6019d1e3e44daf7deb4478582081cc:

Indentation cleanup resulting from the cleanup of #ifdefs.

The conscious decision was made not to perform any indentation or
whitespace cleanup while cleaning out old redunant #ifdefs. The
reason for this was to avoid confusing future readers of history and
diffs with cosmetic changes, making bisection of any possible bugs
introduced more difficult. This commit cleans up the whitespace
detritus left behind from the previous #ifdef cleanup commits.

(cherry picked from commit 7071734fae6019d1e3e44daf7deb4478582081cc)

3 years agoMFC 4cd1807c7d2a67b633dd0c0bfde15091543a2514:
Cy Schubert [Tue, 26 Jan 2021 06:24:28 +0000 (22:24 -0800)]
MFC 4cd1807c7d2a67b633dd0c0bfde15091543a2514:

Retire the K&R/STD C __P prototype declarations.

In the old days when K&R C and STD C were each in use a workaround
(read hack) was required to allow the same code to work on each
without modification. All C compilers support STD C. We can finally
put the __P prototype to rest.

(cherry picked from commit 4cd1807c7d2a67b633dd0c0bfde15091543a2514)

3 years agoAdding PRR sysctls to tcp(4) man page
Richard Scheffenegger [Fri, 12 Feb 2021 11:32:48 +0000 (12:32 +0100)]
Adding PRR sysctls to tcp(4) man page

Documenting the newly added, and enabled by default,
Proportional Rate Reduction algorithm's governing sysctls.

Reviewed by: kbowling, rgrimes
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28568

(cherry picked from commit a78fee8182614593992e841fbb0d4a958f70da0f)

3 years agoktls: Use COUNTER_U64_DEFINE_EARLY
Mark Johnston [Mon, 8 Feb 2021 14:18:51 +0000 (09:18 -0500)]
ktls: Use COUNTER_U64_DEFINE_EARLY

This makes it a bit more straightforward to add new counters when
debugging.  No functional change intended.

Reviewed by: jhb
Sponsored by: Ampere Computing
Submitted by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D28498

(cherry picked from commit 1755b2b9891bb1bfa7a58383ef5126821f7e46e3)

3 years agoktls: Make configuration sysctls available as tunables
Mark Johnston [Mon, 8 Feb 2021 14:19:02 +0000 (09:19 -0500)]
ktls: Make configuration sysctls available as tunables

Reviewed by: gallatin, jhb
Sponsored by: Ampere Computing
Submitted by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D28499

(cherry picked from commit b5aa9ad43aead288dca0eb94fb4621991917f4e1)

3 years agoarmv8crypto: Extract GCM state into a structure
Mark Johnston [Mon, 8 Feb 2021 14:19:10 +0000 (09:19 -0500)]
armv8crypto: Extract GCM state into a structure

This makes it easier to refactor the GCM code to operate on
crypto_buffer_cursors rather than plain contiguous buffers, with the aim
of minimizing the amount of copying and zeroing done today.

No functional change intended.

Reviewed by: jhb
Sponsored by: Ampere Computing
Submitted by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D28500

(cherry picked from commit 7509b677b413b9551c15b483ec2ed9ce655d2455)

3 years agoiflib: Free resources in a consistent order during detach
Sai Rajesh Tallamraju [Mon, 1 Feb 2021 16:13:00 +0000 (11:13 -0500)]
iflib: Free resources in a consistent order during detach

Memory and PCI resources are freed with no particular order.  This could
cause use-after-frees when detaching following a failed attach.  For
instance, iflib_tx_structures_free() frees ctx->ifc_txqs[] but
iflib_tqg_detach() attempts to access this array. Similarly, adapter
queues gets freed by IFDI_QUEUES_FREE() but IFDI_DETACH() attempts to
access adapter queues to free PCI resources.

Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D27634

(cherry picked from commit 38bfc6dee33bedb290e1ea2540f97a86fe3caee0)

3 years agomca: Handle inconsistent CMCI capability reporting
Mark Johnston [Mon, 8 Feb 2021 19:42:54 +0000 (14:42 -0500)]
mca: Handle inconsistent CMCI capability reporting

A BIOS bug may apparently cause the BSP to report that it does not
implement CMCI, with some APs reporting that they do.  In this scenario,
avoid a NULL pointer dereference that occurs in cmci_monitor() because
cmc_state was not allocated by the BSP.

PR: 253272
Reported by: asomers, mmacy
Reviewed by: kib (previous version)

(cherry picked from commit b5770470276268acef21368b3e77a325df883500)

3 years agobinmiscctl: Avoid segfault with "binmiscctl add" and no extra params
Mark Johnston [Mon, 8 Feb 2021 14:20:38 +0000 (09:20 -0500)]
binmiscctl: Avoid segfault with "binmiscctl add" and no extra params

(cherry picked from commit c7fcb36f5670b1d6c1f80c3c29d9d2ba374807f7)

3 years agomlx4, mthca: Silence warnings about no-op alignment operations
Mark Johnston [Thu, 11 Feb 2021 15:16:59 +0000 (10:16 -0500)]
mlx4, mthca: Silence warnings about no-op alignment operations

Since commit 8fa6abb6f4f64f ("Expose clang's alignment builtins and use
them for roundup2/rounddown2"), clang emits warnings for several
alignment operations in these drivers because the operation is a no-op.
The compiler is arguably being too strict here, but in the meantime
let's silence the warnings by conditionally compiling the alignment
operations.

Reviewed by: arichardson, hselasky
Differential Revision: https://reviews.freebsd.org/D28576

(cherry picked from commit 29ed53850e72ab1b470b978d150561281addc0fc)

3 years agoFix incorrect powf(3) result with x near 1 and |y| much larger than 1
Steve Kargl [Mon, 8 Feb 2021 19:45:30 +0000 (20:45 +0100)]
Fix incorrect powf(3) result with x near 1 and |y| much larger than 1

This adjusts the check to trigger overflow/underflow to a slightly lower
value.

Before: powf(9.999995e-01, -1.342177e+08) -> inf
After:  powf(9.999995e-01, -1.342177e+08) -> 1.858724e+31

(cherry picked from commit 93fc67896550548f91b307dbe3053f11db5d4a8a)

Add test case for 93fc67896550 (incorrect powf(3) result)

This adds the test case to contrib/netbsd-tests/lib/libm/t_pow.c, as it
is currently the only place testing pow(3) and friends.

(cherry picked from commit 51af03328755c9095e94d20858a8d10acfe412ae)

3 years agoMerge bmake-20210206
Simon J. Gerraty [Thu, 11 Feb 2021 06:01:59 +0000 (22:01 -0800)]
Merge bmake-20210206

Changes of interest

  o unit-tests: use private TMPDIR to avoid errors from other users
  o avoid strdup in mkTempFile
  o always use vfork
  o job.c: do not create empty shell files in jobs mode
    reduce unnecessary calls to waitpid
  o cond.c: fix debug output for comparison operators in conditionals

(cherry picked from commit dba7b0ef928af88caa38728a73657b837aeeac93)

Approved by: re

3 years ago[POWERPC64LE] add mrsas to GENERIC64LE
Alfredo Dal'Ava Junior [Thu, 4 Feb 2021 06:12:38 +0000 (03:12 -0300)]
[POWERPC64LE] add mrsas to GENERIC64LE

Reviewed by: bdragon
Sponsored by: Eldorado Research Institute (eldorado.org.br)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28475

(cherry picked from commit eaffd270d8729c4d79f6ce268275ef4c0e6f7b04)

3 years agomrsas: update man page
Alfredo Dal'Ava Junior [Thu, 4 Feb 2021 06:13:13 +0000 (03:13 -0300)]
mrsas: update man page

update mrsas(4) since big-endian is supported since
e34a057ca6ebdf8e30ec8b0dc21d18eb450bf36a

Reviewed by:    bdragon, gbe
Sponsored by:   Eldorado Research Institute (eldorado.org.br)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D28475

(cherry picked from commit 20e1817f9a68abd9a232367e04d2afeaf4a3c2f8)

3 years ago[udp6] fix possible panic due to lack of locking.
Andrey V. Elsukov [Thu, 11 Feb 2021 08:38:41 +0000 (11:38 +0300)]
[udp6] fix possible panic due to lack of locking.

The lookup for a IPv6 multicast addresses corresponding to
the destination address in the datagram is protected by the
NET_EPOCH section. Access to each PCB is protected by INP_RLOCK
during comparing. But access to socket's so_options field is
not protected. And in some cases it is possible, that PCB
pointer is still valid, but inp_socket is not. The patch wides
lock holding to protect access to inp_socket. It copies locking
strategy from IPv4 UDP handling.

PR: 232192
Obtained from: Yandex LLC
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D28232

(cherry picked from commit 3c782d9c91666886d868426f0aea040d1a1a8ee4)

3 years ago[udp] fix possible mbuf and lock leak in udp_input().
Andrey V. Elsukov [Thu, 11 Feb 2021 08:55:39 +0000 (11:55 +0300)]
[udp] fix possible mbuf and lock leak in udp_input().

In error case we can leave `inp' locked, also we need to free
mbuf chain `m' in the same case. Release the lock and use `badunlocked'
label to exit with freed mbuf. Also modify UDP error statistic to
match the IPv6 code.

Remove redundant INP_RUNLOCK() from the `if (last == NULL)' block,
there are no ways to reach this point with locked `inp'.

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

(cherry picked from commit c6ded47d0bae801589b564dbe01dccd474edaed0)

3 years agovt: terminal size can grow too big with small font
Toomas Soome [Thu, 21 Jan 2021 22:18:56 +0000 (00:18 +0200)]
vt: terminal size can grow too big with small font

vt is using static buffers for on screen data, the buffer size is
calculated based on maximum supported screen size and 8x16 font.

When using hi-res graphics and very smaller than 8x16 font, we
need to be careful not to overflow static buffers in vt.

Testing: I did test by building smaller buffers than vt currently is using,
royger was testing on actual 4k capable hardware.

MFC after: 1 week
Tested by: royger

(cherry-picked from 32bf05ad89aaa93f4dd27e3721f4cb52cf57fa03)

3 years agossh: remove unused variable
Ed Maste [Fri, 12 Feb 2021 03:21:40 +0000 (22:21 -0500)]
ssh: remove unused variable

This was introduced in 03f6c5cd93ec, which added use of
sysctl net.inet.ip.portrange.reservedhigh instead of IPPORT_RESERVED,
but it appears the rest of that change was lost in some subsequent
update.

The change should probably be restored, but until then there is no
reason to leave an unused variable around.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 9e14b918f956c532d0b81c945160bd9bc85c5604)

3 years agossh: remove ssh-hpn leftovers
Ed Maste [Fri, 12 Feb 2021 14:09:00 +0000 (09:09 -0500)]
ssh: remove ssh-hpn leftovers

This was introduced in 8998619212f3a, and left behind when the hpn-ssh
patches were removed in 60c59fad8806.  Although Being able to log
SO_RCVBUF in debug mode might have some small value on its own, it's
not worth carrying an extra diff against upstream.

Reviewed by: kevans
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28610

(cherry picked from commit a62dc346f6171ef1bd52bb8795eaf2d64394ac24)

3 years agossh: diff reduction against OpenBSD, remove unused includes
Ed Maste [Fri, 12 Feb 2021 01:41:02 +0000 (20:41 -0500)]
ssh: diff reduction against OpenBSD, remove unused includes

These appear to be leftovers from ca86bcf2531c7 and f7167e0ea0bf5

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 154adbbeb8fc2a0d183ec3a4db32cd13668205e8)

3 years agoFix interface route addition with net/bird.
Alexander V. Chernikov [Sun, 14 Feb 2021 10:30:15 +0000 (10:30 +0000)]
Fix interface route addition with net/bird.

The case of adding interface route by specifying interface
 address as the gateway was missed during code refactoring.
Re-add it back by copying non-AF_LINK gateway data when RTF_GATEWAY
 is not set.

Reviewed by: donner

(cherry picked from commit 8170a7d43835047f9c1548a081eea45116473995)

3 years agoFix ifa refcount leak during route addition.
Alexander V. Chernikov [Fri, 12 Feb 2021 20:56:52 +0000 (20:56 +0000)]
Fix ifa refcount leak during route addition.

Reported by: rstone
Reviewed by: rstone

(cherry picked from commit a375ec52a7b423133f66878ecf002efc3b6e9fca)

3 years agousleep(3): replace 'process' with 'calling thread'
Konstantin Belousov [Thu, 11 Feb 2021 03:49:25 +0000 (05:49 +0200)]
usleep(3): replace 'process' with 'calling thread'

PR: 253395

(cherry picked from commit 4956af2a8f0d7723cb09c98e7f5295b156136f70)

3 years agoZFS: fix assertions with INVARIANTS
Alan Somers [Wed, 20 Jan 2021 15:55:36 +0000 (08:55 -0700)]
ZFS: fix assertions with INVARIANTS

AFAICT, this was an oversight from
9e5787d2284e187abb5b654d924394a65772e004 (svn r364746).  That revision
inadvertently disabled assertions unconditionally.

Reviewed by: freqlabs
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D28256

(cherry picked from commit 174a7e578a33c01401e33f9bfcc077fc3155251c)

3 years agovm: Honour the "noreuse" flag to vm_page_unwire_managed()
Mark Johnston [Wed, 10 Feb 2021 16:10:27 +0000 (11:10 -0500)]
vm: Honour the "noreuse" flag to vm_page_unwire_managed()

This flag indicates that the page should be enqueued near the head of
the inactive queue, skipping the LRU queue.  It is used when unwiring
pages from the buffer cache following direct I/O or after I/O when
POSIX_FADV_NOREUSE or _DONTNEED advice was specified, or when
sendfile(SF_NOCACHE) completes.  For the direct I/O and sendfile cases
we only enqueue the page if we decide not to free it, typically because
it's mapped.

Pass "noreuse" through to vm_page_release_toq() so that we actually
honour the desired LRU policy for these scenarios.

Reported by: bdrewery
Reviewed by: alc, kib
Differential Revision: https://reviews.freebsd.org/D28555

(cherry picked from commit 5c18744ea9b94cb6a9a091a900fa4999868736e1)

3 years agotest_inf_inputs: Use atf_tc_expect_fail() instead of atf_tc_skip()
Dimitry Andric [Fri, 12 Feb 2021 20:45:33 +0000 (21:45 +0100)]
test_inf_inputs: Use atf_tc_expect_fail() instead of atf_tc_skip()

Reviewed By: lwhsu
Differential Revision: https://reviews.freebsd.org/D28396

(cherry picked from commit 4d2edf3af1dbd8a3e7cf1b22343a1ecfc2dd41ba)

Fix lib/msun's ctrig_test/test_inf_inputs test case with clang >= 10

This sprinkles a few strategic volatiles in an attempt to defeat clang's
optimization interfering with the expected floating-point exception
flags.

Reported by: lwhsu
PR: 244732

(cherry picked from commit ac76bc1145dd7f4476e5d982ce8f355f71015713)

3 years agoktls(4): Mention WITH_OPENSSL_KTLS in the ktls(4) manual page
Gordon Bergling [Mon, 8 Feb 2021 20:21:26 +0000 (21:21 +0100)]
ktls(4): Mention WITH_OPENSSL_KTLS in the ktls(4) manual page

Since we ship a ktls(4) enabled OpenSSL version, mention
the src.conf(5) option WITH_OPENSSL_KTLS in the manual page.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D28435

(cherry picked from commit 6c34d8ce11cb73e718fc23d85b6fbfab07ee15b4)

3 years agonetgraph/ng_source: Switch queuing framework
Lutz Donnerhacke [Fri, 29 Jan 2021 11:03:17 +0000 (12:03 +0100)]
netgraph/ng_source: Switch queuing framework

Change the queuing framework from ifq to mbufq.

Reported by: glebius
Reviewed by: glebius, kp
Differential Revision: https://reviews.freebsd.org/D28407

3 years agonetgraph/ng_bridge: Deactivate old table ABI
Lutz Donnerhacke [Fri, 12 Feb 2021 07:59:26 +0000 (08:59 +0100)]
netgraph/ng_bridge: Deactivate old table ABI

This was announced to happen after the 12 releases.
Deactivate a depeciated ABI.

(refers to commit ed0a1527507e916c78e6937bcc4061bb81fd9da8)

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

3 years agoPrint DeviceHandle and PhysicalId in hex.
Alexander Motin [Fri, 5 Feb 2021 21:13:55 +0000 (16:13 -0500)]
Print DeviceHandle and PhysicalId in hex.

The first is actually a bitfield.  The second is printed in hex by
dmidecode, so uniformidy should be good.

MFC after: 1 week

(cherry picked from commit 92d0d6bb14d24abea0786edf546af316ff4a2afe)

3 years agoImprove ACPI_NFIT_CONTROL_REGION formatting.
Alexander Motin [Fri, 5 Feb 2021 15:07:37 +0000 (10:07 -0500)]
Improve ACPI_NFIT_CONTROL_REGION formatting.

MFC after: 1 week

(cherry picked from commit 35e39fd95fda64699b638192f3bab955d0f1cf0c)

3 years agoWhen we are about to send down to the driver layer
Randall Stewart [Wed, 27 Jan 2021 18:32:52 +0000 (13:32 -0500)]
When we are about to send down to the driver layer
we need to make sure that the m_nextpkt field is NULL
else the lower layers may do unwanted things.

Reviewed By:  gallatin, melifaro
Differential Revision: https://reviews.freebsd.org/D28377

(cherry picked from commit 24a8f6d369962f189ad808f538029179b1e7dc2f)

3 years agoTurn off forgotten multipath debug messages
Alexander V. Chernikov [Mon, 8 Feb 2021 20:11:38 +0000 (20:11 +0000)]
Turn off forgotten multipath debug messages

Reported by: mike tancsa<mike at sentex.net>

(cherry picked from commit adc4ea97bd775cb49df5dbfd71dd497c834ae150)

3 years agoarmv8crypto: Fix some edge cases in the AES-GCM implementation
Mark Johnston [Mon, 8 Feb 2021 14:19:07 +0000 (09:19 -0500)]
armv8crypto: Fix some edge cases in the AES-GCM implementation

- We were only hashing up to the first 16 bytes of the AAD.
- When computing the digest during decryption, handle the case where
  len == trailer, i.e., len < AES_BLOCK_LEN, properly.

While here:

- trailer is always smaller than AES_BLOCK_LEN, so remove a pair of
  unnecessary modulus operations.
- Replace some byte-by-byte loops with memcpy() and memset() calls.
  In particular, zero the full block before copying a partial block into
  it since we do that elsewhere and it means that the memset() length is
  known at compile time.

Reviewed by: jhb
Sponsored by: Ampere Computing
Submitted by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D28501

(cherry picked from commit 0dc7076037a87100060309f7179ef6a01f32f99e)

3 years agoarm32: Align arguments of sync_icache() syscall to cacheline size.
Michal Meloun [Tue, 9 Feb 2021 10:36:36 +0000 (11:36 +0100)]
arm32: Align arguments of sync_icache() syscall to cacheline size.

Otherwise, we may miss synchronization of the last cacheline.
MFC after: 3 days

(cherry picked from commit ec090f4a67654fa541e6d97fd5f74d3f66c1c0d0)

3 years agodwmmc: Multiple busdma fixes.
Michal Meloun [Thu, 21 Jan 2021 14:06:19 +0000 (15:06 +0100)]
dwmmc: Multiple busdma fixes.

- limit maximum segment size to 2048 bytes.  Although dwmmc supports a buffer
  fragment with a maximum length of 4095 bytes, use the nearest lower power
  of two as the maximum fragment size. Otherwise, busdma create excessive
  buffer fragments.
- fix off by one error in computation of the maximum data transfer length.
- in addition, reserve two DMA descriptors that can be used by busdma
  bouncing. The beginning or end of the buffer can be misaligned.
- Don’t ignore errors passed to bus_dmamap_load() callback function.
- In theory, a DMA engine may be running at time when next dma descriptor is
  constructed. Create a full DMA descriptor before OWN bit is set.

MFC after: 2 weeks

(cherry picked from commit 8727c174b0fe44766bb7ea765dac6d5f82818103)

3 years agoarm64: Initialize VFP control register.
Michal Meloun [Sat, 23 Jan 2021 20:19:07 +0000 (21:19 +0100)]
arm64: Initialize VFP control register.

The RW fields in this register reset to architecturally unknown values,
so initialize these to the proper rounding and denormal mode.
MFC after: 1 week

(cherry picked from commit 65618fdda0f272a823e6701966421bdca0efa301)

3 years agohid: bump HID_ITEM_MAXUSAGES to 8
Warner Losh [Mon, 8 Feb 2021 19:29:20 +0000 (12:29 -0700)]
hid: bump HID_ITEM_MAXUSAGES to 8

My YOGA requires a minimum of 7 to parse w/o an error. Since the memory savings
are trivial and the yoga a popular system, bump the default up to 8. There's no
API/ABI issues in doing this. This hid_item struct isn't exported to userland
and the one libusbhid has is different and only shares a name...

MFC After: 3 days
Reviewed by: wulf@
Differential Revision: https://reviews.freebsd.org/D28543

(cherry picked from commit db2f512381ac3c0c227f5c0354690bb929dcac17)

3 years agoacpi: limit the AMDI0020/AMDI0010 workaround to an option
Warner Losh [Mon, 8 Feb 2021 21:43:25 +0000 (14:43 -0700)]
acpi: limit the AMDI0020/AMDI0010 workaround to an option

It appears that production versions of EPYC firmware get the _STA method right
for these nodes. In fact, this workaround breaks on production hardware by
including too many uart nodes. This work around was for pre-release hardware
that wound up not having a large deployment. Move this work around to a kernel
option since the machines that needed it have been powered off and are difficult
to resurrect. Should there be a more significant deployment than is understood,
we can restrict it based on smbios strings.

Discussed with: mmacy@, seanc@, jhb@
MFC After: 3 days

(cherry picked from commit 35af933173d516101f4c44af328fbe2d6e587869)

3 years agogrep: fix -A handling in conjunction with -m match limitation
Kyle Evans [Mon, 8 Feb 2021 18:31:17 +0000 (12:31 -0600)]
grep: fix -A handling in conjunction with -m match limitation

The basic issue here is that grep, when given -m 1, would stop all
line processing once it hit the match count and exit immediately.  The
problem with exiting immediately is that -A processing only happens when
subsequent lines are processed and do not match.

The fix here is relatively easy; when bsdgrep matches a line, it resets
the 'tail' of the matching context to the value supplied to -A and
dumps anything that's been queued up for -B. After the current line has
been printed and tail is reset, we check our mcount and do what's
needed. Therefore, at the time that we decide we're doing nothing, we
know that 'tail' of the context is correct and we can simply continue
on if there's still more to pick up.

With this change, we still bail out immediately if there's been no -A
flag. If -A was supplied, we signal that we should continue on. However,
subsequent lines will not even bothere to try and process the line.  We
have reached the match count, so even if the next line would match then
we must process it if it hadn't. Thus, the loop in procfile() can
short-circuit and just process the line as a non-match until
procmatches() indicates that it's safe to stop.

A test has been added to reflect both that we should be picking up the
next line and that the next line should be considered a non-match even
if it should have been.

PR: 253350
(cherry picked from commit 3e2d96ac974db823255a6f40b90eeffa6e38d022)

3 years agogrep: turn off -w if -x is specified
Kyle Evans [Thu, 4 Feb 2021 21:35:58 +0000 (15:35 -0600)]
grep: turn off -w if -x is specified

-x overcomes -w in gnugrep, and it should here as well.  Flip it off as
needed to avoid confusing other parts of grep.

(cherry picked from commit 2373acbbb77d694b997d90f3251810c6edf5d6d8)

3 years agogrep: fix null pattern and empty pattern file behavior
Kyle Evans [Thu, 4 Feb 2021 21:26:45 +0000 (15:26 -0600)]
grep: fix null pattern and empty pattern file behavior

The null pattern semantics were terrible because I tried to match gnugrep,
but I got it wrong.  Let's unwind that:

- The null pattern should match every line if neither -w nor -x.
- The null pattern should match empty lines if -x.
- The null pattern should not match any lines if -w.

The first two will stop processing (shortcut) even if additional patterns
are specified. In any other case, we will continue processing other
patterns.  If no other patterns are specified beside a null pattern, then
we match if neither -w nor -x or set and do not match if either of those
are specified.

The justification for -w is that it should match on a whole word, but the
null pattern deos not have a whole word to match on.

Empty pattern files should never match anything, and more importantly, -v
should cause everything to be written.

PR: 253209
(cherry picked from commit f823c6dc730b0dd08b54a53be1d8fd587eee7021)

3 years agopowerpc64: Fix boot on virtual-mode OF (PowerMac G5)
Brandon Bergren [Sun, 7 Feb 2021 22:05:41 +0000 (16:05 -0600)]
powerpc64: Fix boot on virtual-mode OF (PowerMac G5)

In 78599c32efed3247d165302a1fbe8d9203e38974, CFI endproc decoration was
added to locore64.S. However, it missed the subtle detail that
__restartkernel_virtual() falls through to __restartkernel(). This was
causing boot failure on PowerMac G5, as it tried to execute the
epilogue as code.

Fix this by branching to __restartkernel() instead of intentionally
running off the end of the function.

While here, add some additional notes on how the virtual mode restart
works.

(cherry picked from commit d26f2a50ff48dacd38ba358d658882d51f7bdbc4)

3 years agoreadelf: decode LA48 and ASG_DISABLE feature flags
Ed Maste [Wed, 3 Feb 2021 21:16:45 +0000 (16:16 -0500)]
readelf: decode LA48 and ASG_DISABLE feature flags

Sponsored by: The FreeBSD Foundation

(cherry picked from commit e79b51e2b2e35d6256a1ef5311ce02ec4032d21f)

3 years agoSet file mode during zfs_write
Antonio Russo [Mon, 8 Feb 2021 17:15:05 +0000 (10:15 -0700)]
Set file mode during zfs_write

Apply https://github.com/openzfs/zfs/pull/11576

Direct commit from upstream openzfs. Full commit message below:

Set file mode during zfs_write

3d40b65 refactored zfs_vnops.c, which shared much code verbatim between
Linux and BSD.  After a successful write, the suid/sgid bits are reset,
and the mode to be written is stored in newmode.  On Linux, this was
propagated to both the in-memory inode and znode, which is then updated
with sa_update.

3d40b65 accidentally removed the initialization of newmode, which
happened to occur on the same line as the inode update (which has been
moved out of the function).

The uninitialized newmode can be saved to disk, leading to a crash on
stat() of that file, in addition to a merely incorrect file mode.

Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Antonio Russo <aerusso@aerusso.net>
Closes #11474
Closes #11576

Obtained from: openzfs/zfs@f8ce8aed0
MFC after: 0 days
Sponsored by: iXsystems, Inc.

(cherry picked from commit e9d419a05357036ea2fd37218d853d2c713d55cc)

3 years agortld: Fix null-pointer dereference
David Chisnall [Tue, 2 Feb 2021 14:06:33 +0000 (16:06 +0200)]
rtld: Fix null-pointer dereference

(cherry picked from commit 43d44842aef3972cc86ce673e84e31f372257b15)

3 years agoserf: Fix the default return value of the BIO control method.
John Baldwin [Wed, 3 Feb 2021 22:59:32 +0000 (14:59 -0800)]
serf: Fix the default return value of the BIO control method.

OpenSSL BIO classes provide an abstraction for dealing with I/O.
OpenSSL provides BIO classes for commonly used I/O primitives backed
by file descriptors, sockets, etc. as well as permitting consumers
of OpenSSL to define custom BIO classes.

One of the methods BIO classes implement is a control method invoked
by BIO_ctrl() for various ancilliary tasks somewhat analgous to
fcntl() and ioctl() on file descriptors.  According to the BIO_ctrl(3)
manual page, control methods should return 0 for unknown control
requests.

KTLS support in OpenSSL adds new control requests.  Two of those new
requests are queries to determine if KTLS is enabled for either
reading or writing.  These control reuquest return 1 if KTLS is
enabled and 0 if it is not.

serf includes two custom BIO classes for wrapping I/O requests from
files and from a buffer in memory.  These BIO classes both use a
custom control method.  However, this custom control method was
returning 1 for unknown or unsupported control requests instead of 0.
As a result, OpenSSL with KTLS believed that these BIOs were using
KTLS and were thus adding headers and doing encryption/decryption in
the BIO.  Correcting the return value removes this confusion.

PR: 253135
Reported by: Guido Falsi <mad@madpilot.net>
Sponsored by: Netflix

(cherry picked from commit cb7cc72c546e0f87598961c3860e17391f42866c)

3 years agoCatch up with 6edfd179c86: mechanically rename IFCAP_NOMAP to IFCAP_MEXTPG.
Gleb Smirnoff [Thu, 28 Jan 2021 21:08:48 +0000 (13:08 -0800)]
Catch up with 6edfd179c86: mechanically rename IFCAP_NOMAP to IFCAP_MEXTPG.

Originally IFCAP_NOMAP meant that the mbuf has external storage pointer
that points to unmapped address.  Then, this was extended to array of
such pointers.  Then, such mbufs were augmented with header/trailer.
Basically, extended mbufs are extended, and set of features is subject
to change.  The new name should be generic enough to avoid further
renaming.

(cherry-picked from commit 3f43ada98c89bce5ae416e203ba0e81595a5cd88)

3 years agoCatch up with 6edfd179c86: document M_EXTPG. While here sore flags
Gleb Smirnoff [Thu, 28 Jan 2021 20:56:36 +0000 (12:56 -0800)]
Catch up with 6edfd179c86: document M_EXTPG.  While here sore flags
as they are in sys/mbuf.h

(cherry picked from commit cf6ff85fe847225e7b7ca1c3669cab6412076765)

3 years agoMFC 093e72319089:
Hans Petter Selasky [Tue, 26 Jan 2021 15:59:42 +0000 (16:59 +0100)]
MFC 093e72319089:
Add missing decrement of active ratelimit connections.

Reviewed by: rrs@
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 093e7231908908b651b91c68ac03fb697c3a8352)

3 years agoMFC 85d8d30f9f70:
Hans Petter Selasky [Tue, 26 Jan 2021 14:01:38 +0000 (15:01 +0100)]
MFC 85d8d30f9f70:
Don't allow allocating a new send tag on an INP which is being torn down.
This fixes a potential send tag leak.

Reviewed by: rrs@
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 85d8d30f9f7046f5e89295352ded49135b25fbe3)

3 years agorelease: disable the 'reldoc' target after the ASCIIDoctor switch
Glen Barber [Fri, 5 Feb 2021 16:46:49 +0000 (11:46 -0500)]
release: disable the 'reldoc' target after the ASCIIDoctor switch

The 'reldoc' target includes release-related documentation on
installation medium.  Since the switch from XML to ASCIIDoctor,
the file locations have moved, and it will take some time to sort
out how this target should work now.

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

(cherry picked from commit 7b1d1a1658ffb69eff93afc713f9e88ed8b20eac)

3 years agoEnable pvscsi and vmx in arm64 GENERIC
Ed Maste [Fri, 5 Feb 2021 00:14:12 +0000 (19:14 -0500)]
Enable pvscsi and vmx in arm64 GENERIC

FreeBSD pvscsi and vmx work with VMware ESXi Arm "Fling"; provide these
in GENERIC for a convenient out-of-the-box experience.

PR: 253202
Reported by: Vincent Milum Jr
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 375d797b81916eb3d16927c9dac8c42975784252)

3 years agoamd64 GENERIC: compile in mlx5en(4)
Konstantin Belousov [Wed, 3 Feb 2021 12:19:12 +0000 (14:19 +0200)]
amd64 GENERIC: compile in mlx5en(4)

(cherry picked from commit 5832a3e398642f721381dc2bdc8e954ae43c17a7)

3 years agocpucontrol(8): Fix display.
Konstantin Belousov [Fri, 5 Feb 2021 01:00:27 +0000 (03:00 +0200)]
cpucontrol(8): Fix display.

(cherry picked from commit 856789c123d69de86684c5aa1ad8a53427dd47fc)

3 years agoAlways clamp curve25519 keys prior to use.
Peter Grehan [Wed, 3 Feb 2021 09:05:09 +0000 (19:05 +1000)]
Always clamp curve25519 keys prior to use.

This fixes an issue where a private key contained bits that should
have been cleared by the clamping process, but were passed through
to the scalar multiplication routine and resulted in an invalid
public key.

Issue diagnosed (and an initial fix proposed) by shamaz.mazum in
PR 252894.

This fix suggested by Jason Donenfeld.

PR: 252894
Reported by: shamaz.mazum

(cherry picked from commit 5aaea4b99e5cc724e97e24a68876e8768d3d8012)

3 years agopowerpc64le: readd COMPAT_FREEBSD11 and COMPAT_FREEBSD12
Piotr Kubaj [Sat, 6 Feb 2021 02:21:55 +0000 (03:21 +0100)]
powerpc64le: readd COMPAT_FREEBSD11 and COMPAT_FREEBSD12

lang/rust needs COMPAT_FREEBSD11 to build, even though powerpc64le itself is supported only since 13.0.
I also corrected a comment, because if we ever have lib32 for powerpc64le, it will be for powerpcle.

Reviewed by: bdragon (on IRC)

(cherry picked from commit 8b804ee616b4c8810015b69e37e31ef0c4161511)

3 years agoVendor import of Gavin Howard's bc version 3.2.6
Stefan Eßer [Sun, 31 Jan 2021 19:56:48 +0000 (20:56 +0100)]
Vendor import of Gavin Howard's bc version 3.2.6

(cherry picked from commit 47a52dc4d48f259ab7d9f9ba6b65f4f2331a22dc)

Second attempt after revert of a previous commit that affected files
with similar names in unrelated directories.

Thanks go to Martin Birgmaier for reporting the issue and identifying
the cause of git getting confused: files from the root of the vendor
files were associated with files in the FreeBSD base root directory.

Martin Birgmaier points out that to make this cherry-pick succeed,
the option -Xsubtree=contrib/bc has to be passed to prevent files
outside that path to be considered.

3 years agoRevert "bc: Vendor import of Gavin Howard's bc version 3.2.6"
Stefan Eßer [Fri, 5 Feb 2021 19:53:34 +0000 (20:53 +0100)]
Revert "bc: Vendor import of Gavin Howard's bc version 3.2.6"

This reverts commit 601ac82194693fcae9d7d2a7ec7d66ebaf3fd61e.

Seems that git cherry-pick mis-merges files for this software.
It associates files in completely unrelated sub-trees with same name
files from this package, e.g. README.md and .gitignore.

My attempt to fix the mis-merge was incomplete and wrong.
Therefore I'm reverting the commit that as a result of my failed
attempt at conflict resolution lead to README.md and .gitignore
in the top source directory to be deleted.

This mistake has been carried over to releng/13.0, which now
also lacks README.md and .gitignore in /usr/src.

I'll try to re-apply the failed commit over the next hours and to get
the fix merged to releng/13.0 with re approval.

3 years agomrsas: unbreak i386 build
Alfredo Dal'Ava Junior [Fri, 5 Feb 2021 18:43:48 +0000 (15:43 -0300)]
mrsas: unbreak i386 build

Fix build regression introduced by
e34a057ca6ebdf8e30ec8b0dc21d18eb450bf36a

Reviewed by: jhibbits
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D28494

(cherry picked from commit 59fffbcf46ba6369420e655ff9173571410c643d)

3 years agoparam.h: fix __FreeBSD_version convention
Glen Barber [Fri, 5 Feb 2021 16:38:27 +0000 (11:38 -0500)]
param.h: fix __FreeBSD_version convention

Note, this has the side effect of __FreeBSD_version going backwards.
If this causes too many problems, I will bump it to 1301500 with
a comment in the file as a reminder for 13.1.

Submitted by: Ka Ho Ng
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoBump shared library versions after ncurses bump in 13.
John Baldwin [Tue, 2 Feb 2021 01:09:33 +0000 (17:09 -0800)]
Bump shared library versions after ncurses bump in 13.

A few shared libraries in the base system link against ncurses.  An
upgrade from a 12.x host to 13 results in ABI breakage for existing
binaries since the newer versions of these libraries link against the
newer ncurses while the binary itself links against the older ncurses.
For example, dialog4ports built on 12.x sometimes crashes on 13 since
it depends on libdialog which links against ncurses internally.

(cherry picked from commit 0b7f1af804f06a285717b490bef80e24648adcbe)

3 years agoWITH_OFED build option: fix
Konstantin Belousov [Tue, 2 Feb 2021 13:01:26 +0000 (15:01 +0200)]
WITH_OFED build option: fix

(cherry picked from commit ff975f15d86001d5b948ab538de1e4aca852d2f5)

3 years agoCorrect description for kern.proc.proc_td
Ed Maste [Tue, 2 Feb 2021 21:55:51 +0000 (16:55 -0500)]
Correct description for kern.proc.proc_td

kern.proc.proc_td returns the process table with an entry for each
thread.  Previously the description included "no threads", presumably
a cut-and-pasteo in 2648efa621748.

Description suggested by PauAmma.

PR: 253146
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit edc374e7c41d3d9e28e0b3a76bc9ed021d7db571)

3 years agoRegenerate src.conf(5).
John Baldwin [Thu, 4 Feb 2021 21:47:26 +0000 (13:47 -0800)]
Regenerate src.conf(5).

3 years agoDisable MK_OPENSSL_KTLS for stable/13.
John Baldwin [Thu, 4 Feb 2021 21:40:25 +0000 (13:40 -0800)]
Disable MK_OPENSSL_KTLS for stable/13.

Due to the pending release of 13.0 and the recent bug in serf exposed
by the KTLS changes, disable OpenSSL's KTLS by default.  This keeps
crypto/openssl in sync with main while lowering the risk of introducing
instability into 13.0.

Discussed with: gjb (re), jkim, emaste (secteam)

3 years agoOpenSSL: Regenerate manual pages.
Jung-uk Kim [Tue, 26 Jan 2021 22:26:51 +0000 (14:26 -0800)]
OpenSSL: Regenerate manual pages.

(cherry picked from commit bb8acd558e66bd4bae31602fcbe569863f47382c)

3 years agoOpenSSL: Support for kernel TLS offload (KTLS)
John Baldwin [Sat, 16 Jan 2021 00:17:31 +0000 (16:17 -0800)]
OpenSSL: Support for kernel TLS offload (KTLS)

This merges upstream patches from OpenSSL's master branch to add
KTLS infrastructure for TLS 1.0-1.3 including both RX and TX
offload and SSL_sendfile support on both Linux and FreeBSD.

Note that TLS 1.3 only supports TX offload.

A new WITH/WITHOUT_OPENSSL_KTLS determines if OpenSSL is built with
KTLS support.  It defaults to enabled on amd64 and disabled on all
other architectures.

Sponsored by: Netflix

(cherry picked from commit aa906e2a4957db700d9e6cc60857e1afe1aecc85)

3 years agoFix ldd to work with more ELF files.
John Baldwin [Fri, 29 Jan 2021 18:53:50 +0000 (10:53 -0800)]
Fix ldd to work with more ELF files.

- Use libelf to parse ELF data structures and remove code duplication
  for ELF32.

- Don't require the OSABI field to be set to the FreeBSD OSABI for
  shared libraries.  Both AArch64 and RISC-V leave it set to "none"
  and instead depend on the ABI tag note.  For ldd, this means falling
  back to walking the notes in PT_NOTE segments to find the ABI tag
  note to determine if an ELF shared library without OSABI set in the
  header file is a FreeBSD shared library.

(cherry picked from commit 9d4104b214963bb3371ada05cae8006940121634)

3 years agoRename stable/13 to -STABLE now that releng/13.0 has branched
Glen Barber [Fri, 5 Feb 2021 00:02:14 +0000 (19:02 -0500)]
Rename stable/13 to -STABLE now that releng/13.0 has branched

Bump __FreeBSD_version

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

3 years agoMFC jail: Handle a parent jail when a child is added to it
Jamie Gritton [Fri, 29 Jan 2021 05:51:09 +0000 (21:51 -0800)]
MFC jail: Handle a parent jail when a child is added to it

It's possible when adding a jail that its dying parent comes back to
life.  Only allow that to happen when JAIL_DYING is specified.  And if
it does happen, call PR_METHOD_CREATE on it.

(cherry picked from commit c050ea803eaa1087313b86628b5d486c0e59e41b)

3 years agoMFC jail: fix dangling reference bug from 6754ae2572eb
Jamie Gritton [Fri, 22 Jan 2021 18:56:24 +0000 (10:56 -0800)]
MFC jail: fix dangling reference bug from 6754ae2572eb

The change to use refcounts for pr_uref was mishandled in
prison_proc_free, so killing a jail's last process could add
an extra reference, leaving it an unkillable zombie.

(cherry picked from commit 195cd6ae2481dd5ad555ed65c226b6f20908d66a)

3 years agoMFC jail: A jail could be removed without calling OSD methods
Jamie Gritton [Fri, 22 Jan 2021 18:50:10 +0000 (10:50 -0800)]
MFC jail: A jail could be removed without calling OSD methods

Fix a long-standing bug where setting nopersist on a process-less jail
would remove it without calling the the OSD PR_METHOD_REMOVE methods.

(cherry picked from commit 39c8ef90f6d035cd3c3ab40e051b1c0f419c76be)

3 years agoMFC 78c93a172114: Use process fib for inet/inet6 fib_algo sysctls.
Alexander V. Chernikov [Sun, 31 Jan 2021 10:48:47 +0000 (10:48 +0000)]
MFC 78c93a172114: Use process fib for inet/inet6 fib_algo sysctls.

This allows to set/query fib algo for non-default fibs.

3 years agoMFC 151ec796a230: Fix the design problem with delayed algorithm sync.
Alexander V. Chernikov [Sat, 30 Jan 2021 22:45:46 +0000 (22:45 +0000)]
MFC 151ec796a230: Fix the design problem with delayed algorithm sync.

Currently, if the immutable algorithm like bsearch or radix_lockless
 receives rtable update notification, it schedules algorithm rebuild.
This rebuild is executed by the callout after ~50 milliseconds.

It is possible that a script adding an interface address and than route
 with the gateway bound to that address will fail. It can happen due
 to the fact that fib is not updated by the time the route addition
 request arrives.

Fix this by allowing synchronous algorithm rebuilds based on certain
 conditions. By default, these conditions assume:
1) less than net.route.algo.fib_sync_limit=100 routes
2) routes without gateway.

* Move algo instance build entirely under rib WLOCK.
 Rib lock is only used for control plane (except radix algo, but there
  are no rebuilds).
* Add rib_walk_ext_locked() function to allow RIB iteration with
 rib lock already held.
* Fix rare potential callout use-after-free for fds by binding fd
 callout to the relevant rib rmlock. In that case, callout_stop()
 under rib WLOCK guarantees no callout will be executed afterwards.

3 years agoMFC dd9163003cb1: Add rib_subscribe_locked() and rib_unsubsribe_locked()
Alexander V. Chernikov [Sat, 30 Jan 2021 21:52:44 +0000 (21:52 +0000)]
MFC dd9163003cb1: Add rib_subscribe_locked() and rib_unsubsribe_locked()
 to support subscriptions during RIB modifications.
Add new subscriptions to the beginning of the lists instead of
 the end. This fixes the situation when new subscription is created
 int the callback for the existing subscription, leading to the
 subscription notification handler pick it.

3 years agoMFC ab6d9aaed76e: Move business logic from rebuild_fd_callout() into rebuild_fd().
Alexander V. Chernikov [Sat, 30 Jan 2021 22:32:42 +0000 (22:32 +0000)]
MFC ab6d9aaed76e: Move business logic from rebuild_fd_callout() into rebuild_fd().

This simplifies code a bit and allows for future non-callout
 callers to request rebuild.

3 years agoMFC f8b7ebea4905: Improve fib_algo debug messages.
Alexander V. Chernikov [Sat, 30 Jan 2021 22:06:40 +0000 (22:06 +0000)]
MFC f8b7ebea4905: Improve fib_algo debug messages.

* Move per-prefix debug lines under LOG_DEBUG2
* Create fib instance counter to distingush log messages between
 instances
* Add more messages on rebuild reason.

MFC after: 3 days

3 years agoMFC 91f2c69ec206: Fix unused-function waring when compiling with FIB_ALGO.
Alexander V. Chernikov [Sat, 30 Jan 2021 23:24:26 +0000 (23:24 +0000)]
MFC 91f2c69ec206: Fix unused-function waring when compiling with FIB_ALGO.

3 years agoMFC cb984c62d705: Fix multipath support for rib_lookup_info().
Alexander V. Chernikov [Fri, 29 Jan 2021 23:10:52 +0000 (23:10 +0000)]
MFC cb984c62d705: Fix multipath support for rib_lookup_info().

The initial plan was to remove rib_lookup_info() before
 FreeBSD 13. As several customers are still remaining,
 fix rib_lookup_info() for the multipath use case.

3 years agoMFC 53729367d388: Fix subinterface vlan creation.
Alexander V. Chernikov [Tue, 26 Jan 2021 07:22:23 +0000 (07:22 +0000)]
MFC 53729367d388: Fix subinterface vlan creation.

D26436 introduced support for stacked vlans that changed the way vlans
 are configured.  In particular, this change broke setups that have
 same-number vlans as subinterfaces.

Vlan support was initially created assuming "vlanX" semantics. In this paradigm,
 automatic number assignment supported by cloning (ifconfig vlan create) was a
 natural fit.
When "ifaceX.Y" support was added, allowing to have the same vlan number on
 multiple devices, cloning code became more complex, as the is no
unified "vlan" namespace anymore. Such interfaces got the first spare
index from "vlan" cloner. This, in turn, led to the following problem:
 ifconfig ix0.333 create -> index 1
 ifconfig ix0.444 create -> index 2
 ifconfig vlan2 create -> allocation failure

This change fixes such allocations by using cloning indexes only for
 "vlanX" interfaces.

Reviewed by:            hselasky
Differential Revision:  https://reviews.freebsd.org/D27505

3 years agoMFC eb0b1b33: Enable multipath routing by default.
Alexander V. Chernikov [Wed, 3 Feb 2021 08:49:46 +0000 (08:49 +0000)]
MFC eb0b1b33: Enable multipath routing by default.

ROUTE_MPATH was added to the GENERIC kernel in r368648.

According to the plan in D27428, it was enabled with `net.route.multipath` sysctl set to 0.
Given enough time has passed, this change enables route multipath by default.

The goal is to ship FreeBSD 13 with multipath turned on.

Reviewed By: donner, olivier
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D28423

3 years agoloader.efi: There are systems without ConOut, also use ConOutDev
Toomas Soome [Thu, 4 Feb 2021 20:49:02 +0000 (22:49 +0200)]
loader.efi: There are systems without ConOut, also use ConOutDev

Conout does contian the default output device name.
ConOutDev does contain all possible output device names, so we can
use it as fallback, when there is no ConOut.

PR: 253253

(cherry picked from commit 2bd4ff2d8911009283e4e615ca4aad35a845f48b)

3 years agohsctrl: Fix manpage typo
Vladimir Kondratyev [Thu, 28 Jan 2021 21:35:11 +0000 (00:35 +0300)]
hsctrl: Fix manpage typo

Use hsctrl_load to load the module at boot time.

Submitted by: Shunchao Hu <ankohuu_outlook.com>
Reviewed by: wulf
Differential revision: https://reviews.freebsd.org/D28343

(cherry picked from commit 5c689e213614bff65e9789875f839aa05053126b)

3 years agohcons: Fix manpage typo
Vladimir Kondratyev [Sat, 23 Jan 2021 19:19:50 +0000 (22:19 +0300)]
hcons: Fix manpage typo

Submitted by: Shunchao Hu <ankohuu_outlook.com>
Reviewed by: wulf, gbe
Differential revision: https://reviews.freebsd.org/D28294

(cherry picked from commit 0d528e6354141dd097f8719e858b3ae3686d2062)