]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agotest/ptrace/scescx.c: fix printing of braces for syscalls without args
Konstantin Belousov [Thu, 16 Sep 2021 17:23:11 +0000 (20:23 +0300)]
test/ptrace/scescx.c: fix printing of braces for syscalls without args

(cherry picked from commit 9a8eb5db55964c2fc7aca0db5939d8300badc9ab)

2 years agoAdd -Wno-error=unused-but-set-variable when building with Clang 13+
Dimitry Andric [Thu, 26 Aug 2021 15:36:03 +0000 (17:36 +0200)]
Add -Wno-error=unused-but-set-variable when building with Clang 13+

This warning triggers many times while building world. Downgrade it to a
warning until all occurrences have been fixed. Once the Clang warnings
have been fixed we should be able to turn it on for GCC as well. See
also f4fed768bba45a406f73ed1491d7e52fd1a8711d which did the same for the
kernel builds.

Reviewed by: arichardson, imp
Differential Revision: https://reviews.freebsd.org/D31927

(cherry picked from commit 45feade38ec3e8e30086dedc6ee81cbf816293e3)

2 years agoe1000: Revert Update intel shared code
Kevin Bowling [Wed, 8 Sep 2021 22:43:13 +0000 (15:43 -0700)]
e1000: Revert Update intel shared code

This reverts commit fc7682b17f3738573099b8b03f5628dcc8148adb.

This will be done incrementally to help with bisecting an issue in
later I21x devices (ich8lan).

PR: 258153
Approved by: imp
MFC after: 1 day

(cherry picked from commit a4378873e9ce1b35b55378c21f8eae69e58c2525)

2 years agocalendar.freebsd: Fix off-by-one error
Kevin Bowling [Fri, 17 Sep 2021 23:05:27 +0000 (16:05 -0700)]
calendar.freebsd: Fix off-by-one error

(cherry picked from commit 007c2463d6d017ad5321d5cd2bc500e577d22196)

2 years agopf: fix NOINET6 builds
Kristof Provost [Fri, 10 Sep 2021 15:20:39 +0000 (17:20 +0200)]
pf: fix NOINET6 builds

MFC after: 1 week
Sponsored by: Modirum MDPay

(cherry picked from commit 9bdff593ead9434e01cfb6084f21c3e93a22963d)

2 years agopf: qid and pqid can be uint16_t
Kristof Provost [Tue, 7 Sep 2021 12:41:37 +0000 (14:41 +0200)]
pf: qid and pqid can be uint16_t

tag2name() returns a uint16_t, so we don't need to use uint32_t for the
qid (or pqid). This reduces the size of struct pf_kstate slightly. That
in turn buys us space to add extra fields for dummynet later.

Happily these fields are not exposed to user space (there are user space
versions of them, but they can just stay uint32_t), so there's no ABI
breakage in modifying this.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31873

(cherry picked from commit b64f7ce98f5286721a38b31fa2180313f800fb1d)

2 years agopf tests: synproxy to localhost test
Kristof Provost [Wed, 30 Jun 2021 12:22:27 +0000 (14:22 +0200)]
pf tests: synproxy to localhost test

Test syn-proxying a connection to the local host.

Sponsored by: Modirum MDPay
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31854

(cherry picked from commit 6598cababf6425181a755ec97c3fa66d7ee31393)

2 years agopf: fix synproxy to local
Kristof Provost [Wed, 1 Sep 2021 07:54:55 +0000 (09:54 +0200)]
pf: fix synproxy to local

When we're synproxy-ing a connection that's going to us (as opposed to a
forwarded one) we wound up trying to send out the pf-generated tcp
packets through pf_intr(), which called ip(6)_output(). That doesn't
work all that well for packets that are destined for us, so in that case
we must call ip(6)_input() instead.

MFC after: 1 week
Sponsored by:   Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31853

(cherry picked from commit 0a51d74c3ab8e7ee8771cc3ee78ffba831c953ef)

2 years agogeli(8): Do not report error on resize to the same size.
Alexander Motin [Wed, 18 Aug 2021 21:11:03 +0000 (17:11 -0400)]
geli(8): Do not report error on resize to the same size.

Just validate the old metadata and exit.  Originally the check was
added to not thash the only copy of metadata, but we can achieve the
same just by skipping the writing/trashing.  The metadata validation
should protect user from wrongly specifying new size instead of old.

MFC after: 1 month
Sponsored by: iXsystems, Inc.

(cherry picked from commit c7cf100aafb4cb881e05a5153de152907f6c07f3)

2 years agoopenssh: remove login class restrictions leftovers
Ed Maste [Thu, 2 Sep 2021 21:13:29 +0000 (17:13 -0400)]
openssh: remove login class restrictions leftovers

MFC after: 2 weeks
Fixes: 27ceebbc2402 ("openssh: simplify login class...")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit ba91e31f478aaade96bbdbf01560e8b7cbe41b56)

2 years agoConvert cryptostats to a counter_u64 array.
Mark Johnston [Tue, 30 Jun 2020 22:01:21 +0000 (22:01 +0000)]
Convert cryptostats to a counter_u64 array.

The global counters were not SMP-friendly.  Use per-CPU counters
instead.

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

(cherry picked from commit 7290cb47fced28b5d0654cd1de7cc721e214ea32)

2 years agoRemove unused 32-bit compatibility structures from cryptodev.
Mark Johnston [Tue, 30 Jun 2020 15:57:11 +0000 (15:57 +0000)]
Remove unused 32-bit compatibility structures from cryptodev.

The counters are exported by a sysctl and have the same width on all
platforms anyway.

Reviewed by: cem, delphij, jhb
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D25465

(cherry picked from commit a5ae70f5a0554235c499016bec3a721adbb1043a)

2 years agoRemove CRYPTO_TIMING.
Mark Johnston [Tue, 30 Jun 2020 15:56:54 +0000 (15:56 +0000)]
Remove CRYPTO_TIMING.

It was added a very long time ago.  It is single-threaded, so only
really useful for basic measurements, and in the meantime we've gotten
some more sophisticated profiling tools.

Reviewed by: cem, delphij, jhb
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D25464

(cherry picked from commit a5c053f5a78ca68f9dcace37186142266787eaa0)

2 years agoopencrypto: add kern.crypto sysctl node
Mateusz Guzik [Wed, 15 Sep 2021 13:23:48 +0000 (13:23 +0000)]
opencrypto: add kern.crypto sysctl node

This is a direct commit to facilitate upcoming merges.

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

2 years agobnxt(4): Fix bugs in WOL support.
Alexander Motin [Thu, 2 Sep 2021 22:11:58 +0000 (18:11 -0400)]
bnxt(4): Fix bugs in WOL support.

Before this change driver reported IFCAP_WOL_MAGIC enabled, but not
supported.  It caused errors on some SIOCSIFCAP calls.  Instead
report the support if hardware supports WOL, and enabled status if
it has such filter installed on boot.

Also bnxt_wol_config() should check WOL status in if_getcapenable(),
not in if_getcapabilities() to get current one.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

(cherry picked from commit 8c14d7da5b9be78f71b1aa803e93ae7de973dd42)

2 years agoi386 loaders: avoid lld 13 garbage collecting linker sets
Dimitry Andric [Wed, 8 Sep 2021 12:04:13 +0000 (14:04 +0200)]
i386 loaders: avoid lld 13 garbage collecting linker sets

Because lld 13 and higher default to garbage collecting start/stop
symbols when using --gc-sections, the linker sets used in the i386 boot
loaders will disappear. This leads to the loaders not recognizing any
commands, and failure to boot.

Until we have a good set of linker scripts for the loaders, work around
it by disabling the start-stop-gc feature.

(cherry picked from commit c90cab0d668af5d947054e47184d4f8dcb874ec8)

2 years agoopenssh: simplify login class restrictions
Ed Maste [Tue, 31 Aug 2021 19:30:50 +0000 (15:30 -0400)]
openssh: simplify login class restrictions

Login class-based restrictions were introduced in 5b400a39b8ad.  The
code was adapted for sshd's Capsicum sandbox and received many changes
over time, including at least fc3c19a9fceebd393de91cc3, and
e8c56fba2926.

During an attempt to upstream the work a much simpler approach was
suggested.  Adopt it now in the in-tree OpenSSH to reduce conflicts with
future updates.

Submitted by: Yuchiro Naito (against OpenSSH-portable on GitHub)
Obtained from: https://github.com/openssh/openssh-portable/pull/262
Reviewed by: allanjude, kevans
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31760

(cherry picked from commit 27ceebbc2402e4c98203c7eef9696f4bd3d326f8)

2 years agoapr: Merge r1889604, r1807975 from trunk:
Joe Orton [Fri, 2 Jul 2021 11:10:33 +0000 (11:10 +0000)]
apr: Merge r1889604, r1807975 from trunk:

* random/unix/sha2.c (apr__SHA256_Final, apr__SHA256_End): Fix parameter
  buffer lengths to match declaration, avoiding GCC 11 warning.
  (no functional change)

Bounds-check human-readable date fields (credit: Stefan Sperling)

Submitted by: jorton, niq
Reviewed by: jorton

git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1891198 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit fc1b69d0311e50ed05c00c46ad7dd5d560e57cb6)

2 years agoAlign taskqueue_enqueue_timeout() to hardclock.
Alexander Motin [Wed, 1 Sep 2021 03:47:51 +0000 (23:47 -0400)]
Align taskqueue_enqueue_timeout() to hardclock.

It is done for all other KPIs using HZ, but was missed here.

MFC after: 2 weeks

(cherry picked from commit 706b1a5724d668a8752ac89cd67113e4c6917d54)

2 years agonetpfil tests: IPv6 dummynet queue test
Kristof Provost [Thu, 2 Sep 2021 13:40:51 +0000 (15:40 +0200)]
netpfil tests: IPv6 dummynet queue test

Same as the v4 test, but with IPv6.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31789

(cherry picked from commit 12184311c16160464a36ae05b1cd8c5e3c24fbaa)

2 years agonetpfil tests: dummynet queue test
Kristof Provost [Thu, 2 Sep 2021 13:38:04 +0000 (15:38 +0200)]
netpfil tests: dummynet queue test

Test prioritisation and dummynet queues.
We need to give the pipe sufficient bandwidth for dummynet to work.
Given that we can't rely on the TCP connection failing alltogether, but
we can measure the effect of dummynet by imposing a time limit on a
larger data transfer.

If TCP is prioritised it'll get most of the pipe bandwidth and easily
manage to transfer the data in 3 seconds or less. When not prioritised
this will not succeed.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31788

(cherry picked from commit cb6bfef9ca78623e33d2aef347dcee112a639103)

2 years agodummynet tests: pipe test for IPv6
Kristof Provost [Mon, 14 Jun 2021 19:24:59 +0000 (21:24 +0200)]
dummynet tests: pipe test for IPv6

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31787

(cherry picked from commit 5fda5913e16afac72f3f420e227803e33d4c1542)

2 years agonetpfil tests: Basic dummynet pipe test
Kristof Provost [Fri, 21 May 2021 09:14:34 +0000 (11:14 +0200)]
netpfil tests: Basic dummynet pipe test

Test dummynet pipes (i.e. bandwidth limitation) with ipfw. This is put
in the common tests because we hope to add dummynet support to pf in the
near future.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30380

(cherry picked from commit ea3eca5cb6dbcb4deb7c7277a65c48911f0475d1)
(cherry picked from commit 1f4a6403969271885d1c37fd642820d5a6562791)

2 years agonetpfil tests: Add forward test for the three firewalls
Kristof Provost [Fri, 23 Aug 2019 12:11:46 +0000 (12:11 +0000)]
netpfil tests: Add forward test for the three firewalls

Submitted by: Ahsan Barkati
Reviewed by: kp
Sponsored by: Google, Inc. (GSoC 2019)
Differential Revision: https://reviews.freebsd.org/D21321

(cherry picked from commit 39cae0d5ed570804b4e689946f131447597122b8)

2 years agonetpfil tests: Add too many fragments test for pf, ipfw and ipf
Kristof Provost [Tue, 20 Aug 2019 14:46:12 +0000 (14:46 +0000)]
netpfil tests: Add too many fragments test for pf, ipfw and ipf

Add test for checking that the packets are dropped if it is fragmented into
more than the defined value.

Submitted by: Ahsan Barkati
Reviewed by: kp
Sponsored by: Google, Inc. (GSoC 2019)
Differential Revision: https://reviews.freebsd.org/D21307

(cherry picked from commit 3e1ebe7fb8244e6d9336216e9a982aa900a0a281)

2 years agonetpfil tests: Add the set ToS test for ipfw and pf
Kristof Provost [Tue, 20 Aug 2019 14:31:22 +0000 (14:31 +0000)]
netpfil tests: Add the set ToS test for ipfw and pf

This test tests the following:

 - The firewall is able to set the tos bits
 - The firewall is able to set the DSCP bits when EN bits is already set and
   the EN bits remains unchanged.
 - The firewall is able to drop the packets based on ToS value

Submitted by: Ahsan Barkati
Reviewed by: kp
Sponsored by: Google, Inc. (GSoC 2019)
Differential Revision: https://reviews.freebsd.org/D21305

(cherry picked from commit df3d236d96456f1c8400c7898045eae3ea93232d)

2 years agoAdd basic NAT test for pf, ipf and ipfw
Tom Jones [Sat, 17 Aug 2019 06:44:11 +0000 (06:44 +0000)]
Add basic NAT test for pf, ipf and ipfw

Add common firewall NAT tests for pf, ipf and ipfw (using both in-kernel and
userspace NAT).

Submitted by:   Ahsan Barkati
Sponsored by:   Google, Inc. (GSoC 2019)
Reviewed by:    kp
Approved by:    bz (mentor)
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D21199

(cherry picked from commit 0d9da68f01510ae4c5bb33b744f1e0b3711c7fb9)

2 years agoAdd common firewall test suite
Tom Jones [Mon, 5 Aug 2019 11:47:34 +0000 (11:47 +0000)]
Add common firewall test suite

Add a common test suite for the firewalls included in the base system. The test
suite allows common test infrastructure to test pf, ipfw and ipf firewalls from
test files containing the setup for all three firewalls.

Add the pass block test for pf, ipfw and ipf. The pass block test checks the
allow/deny functionality of the firewalls tested.

Submitted by:   Ahsan Barkati
Sponsored by:   Google, Inc. (GSoC 2019)
Reviewed by:    kp
Approved by:    bz (co-mentor)
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D21065

(cherry picked from commit f97a8a36153a9773d9f93018d66a7de2d050a59a)

2 years agodummynet: remove unused definitions
Kristof Provost [Wed, 16 Jun 2021 14:52:25 +0000 (16:52 +0200)]
dummynet: remove unused definitions

No functional change.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31806

(cherry picked from commit 415e81d5d9ed7a73825d371c0b538765fa57a801)

2 years agoipfw: Introduce dnctl
Kristof Provost [Tue, 25 May 2021 14:54:32 +0000 (16:54 +0200)]
ipfw: Introduce dnctl

Introduce a link to the ipfw command, dnctl, for dummynet configuration.
dnctl only handles dummynet configuration, and is part of the effort to
support dummynet in pf.

/sbin/ipfw continues to accept pipe, queue and sched commands, but these can
now also be issued via the new dnctl command.

Reviewed by: donner
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30465

(cherry picked from commit 0b95680e077b7ef5bc6930c7c0f1a41106251d5d)

2 years agopf: remove unused function prototype
Kristof Provost [Tue, 7 Sep 2021 12:33:59 +0000 (14:33 +0200)]
pf: remove unused function prototype

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit bb25e36e133bd723d5c5bdecf9f73452d597e100)

2 years agoixgbe: increase the timeout
Qiming Yang [Wed, 10 Jan 2018 16:04:33 +0000 (00:04 +0800)]
ixgbe: increase the timeout

Increase SECRX_RDY polling frequency and semaphore timeout which
fixes the FWSW.PT check in ixgbe_mng_present().

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Approved by: imp
Obtained from: DPDK (6175260d12cc22852cecf2fb7ecd95cdb07611b5)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 5fd1f4be8d81a0019c632103121d68e2f20bc238)

2 years agoixgbe: cleanup spelling mistakes in comments
Guinan Sun [Thu, 9 Jul 2020 08:00:33 +0000 (08:00 +0000)]
ixgbe: cleanup spelling mistakes in comments

Several functions in the driver code have a weird function comment
formatting which uses two spaces instead of only one space for the main
function body.

This formatting will be mechanically fixed by sed in a future patch, but
doing so leads to some spelling warnings on that patch. Cleanup the
spelling mistakes that will be detected first. This way, it is easier to
verify the mechanical transformation done by sed in the following patch.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (fc75eee32037c1379e77e57031c1c353badd2272)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 46981e903cf3e8e4a5bf7f6152f8ca5b92b37e07)

2 years agoixgbe: remove unnecessary return value check
Guinan Sun [Thu, 9 Jul 2020 08:00:38 +0000 (08:00 +0000)]
ixgbe: remove unnecessary return value check

Remove unnecessary return value check.

Signed-off-by: Jakub Chylkowski <jakubx.chylkowski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (4b0ee6529b7897c2a08dd56669f07ac1f46a8474)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 3a89005394bc5d82ce9b6baa9e7f8dee362354ae)

2 years agoixgbe: create function to restart autoneg
Guinan Sun [Thu, 9 Jul 2020 08:00:36 +0000 (08:00 +0000)]
ixgbe: create function to restart autoneg

This patch is for restarting auto negotiation on PHY.

Signed-off-by: Jakub Chylkowski <jakubx.chylkowski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (664ea2614eafbec8eda5c86764ff047475a1e5c6)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 80a39a2bda8208c716f614f792c8d9a3628d6c26)

2 years agoixgbe: add register definitions for NVM update
Guinan Sun [Thu, 9 Jul 2020 08:00:32 +0000 (08:00 +0000)]
ixgbe: add register definitions for NVM update

Added additional register for X550 and above device family.

Signed-off-by: Piotr Skajewski <piotrx.skajewski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (4a6847d78814b1c3df896efe31562643d419317d)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit ff8db817abbd348f0a7518ce32f0e52c6ab8e06e)

2 years agoixgbe: move increments after evaluations
Guinan Sun [Thu, 9 Jul 2020 08:00:35 +0000 (08:00 +0000)]
ixgbe: move increments after evaluations

The retry variable was being incremented before it was evaluated by the
subsequent conditional against the maximum retries to figure out which
message to print.  So we'll move the increment op to the end.

Signed-off-by: Jeb Cramer <jeb.j.cramer@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (390445ec30b4c52a3d2887c3d2a202d9cf37ea8e)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit dc11ba4eb3fe5cce615f361de83e85e07005ca24)

2 years agoixgbe: remove whitespace in function comments
Kevin Bowling [Tue, 7 Sep 2021 03:26:44 +0000 (20:26 -0700)]
ixgbe: remove whitespace in function comments

Remove unnecessary extra whitespace on all function comments, replacing
' *  ' with ' * '.

This was done automatically via sed using the following transformation:

  sed 's/^ \*  / * /'

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (40023f73c76579e58a859dab87b4c30278eb2e48)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 4cdc5e12a849871e4e8062a62a31f28545901d84)

2 years agoixgbe: support DCB registers dump
Xiaoyun Li [Mon, 17 Sep 2018 09:28:13 +0000 (17:28 +0800)]
ixgbe: support DCB registers dump

Add support for DCB registers dump.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Approved by: imp
Obtained from: DPDK (36a036bc6fdd0da74576a39ab74e50954598ba82)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 9e65ae746da23e1affdf66adb8944656a9da003c)

2 years agoixgbe: update X550 SFP identification
Xiaoyun Li [Mon, 17 Sep 2018 09:28:12 +0000 (17:28 +0800)]
ixgbe: update X550 SFP identification

Use ixgbe_identify_sfp_module_X550em to update SFP identification
flow. ixgbe_identify_sfp_module_X550em includes specific checks for
X550 about supported SFP modules.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Approved by: imp
Obtained from: DPDK (175bedb0cc8f801be3050fa35b8d8d0971cea7cc)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 0a4f0befab9d3a048232b00bea77bf3da20cfdd0)

2 years agoixgbe: Update copyright to 2020
Kevin Bowling [Tue, 7 Sep 2021 03:11:44 +0000 (20:11 -0700)]
ixgbe: Update copyright to 2020

Synced to the ixgbe shared code with DPDK shared code which has local
fixes on top of "not-released-cid-ixgbe.2020.06.09.tar.gz"

Approved by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 8455e365f77f5b66ac9521dbcd690f79345ce147)

2 years agoixgbe: remove dead code
Ferruh Yigit [Tue, 30 Jun 2020 14:45:54 +0000 (15:45 +0100)]
ixgbe: remove dead code

The question around getting rid of the assignments seems lived
long enough, if they are not needed until now, we can drop them.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Approved by: imp
Obtained from: DPDK (a6395d471e14e5a7432875dad8fb3533238c5167)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 0b487fb4547ad1a939be0d523e555557c94b7cd1)

2 years agoixgbe: replace an operation in X550 setup
Xiaoyun Li [Mon, 17 Sep 2018 09:28:11 +0000 (17:28 +0800)]
ixgbe: replace an operation in X550 setup

Replace "=" operation with "|=" operation to only set the intended
register bits.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Approved by: imp
Obtained from: DPDK (1b665ccd9cd73499e934b807bec2fd77193912ef)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit c85b6f2901e7804105ca1d6d41cc5eb9a60474b8)

2 years agoixgbe: Use C99 bool types
Kevin Bowling [Tue, 7 Sep 2021 02:54:22 +0000 (19:54 -0700)]
ixgbe: Use C99 bool types

Approved by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 79b36ec91decc18d062fc428e2fd34d41aba0630)

2 years agoixgbe: add FW recovery mode check
Xiaoyun Li [Mon, 17 Sep 2018 09:28:10 +0000 (17:28 +0800)]
ixgbe: add FW recovery mode check

Add FM NVM recovery mode check. Allow the software to detect this.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Approved by: imp
Obtained from: DPDK (5fb0a9acbb844b21691568c0014866e0e887bd19)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit b622bdb4ebdfc6dfe1a332fcc912426559c829f3)

2 years agoixgbe: add typecast for type mismatch
Guinan Sun [Thu, 9 Jul 2020 08:00:37 +0000 (08:00 +0000)]
ixgbe: add typecast for type mismatch

Add typecast for type mismatch.

Signed-off-by: Jakub Chylkowski <jakubx.chylkowski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (d8e52b2cf771c31b523b46852fd86225b5a2c721)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 994dd6328c66fc277438ad51ed074f3c52096147)

2 years agoixgbe: wait for link after copper MAC setup
Ashijeet Acharya [Fri, 24 May 2019 09:30:15 +0000 (11:30 +0200)]
ixgbe: wait for link after copper MAC setup

After setting up the link on x552/X557-AT 10GBASE-T NICs, sometimes the
link does not get set up properly and as a result all the subsequent
calls to ixgbe_check_link() from ixgbe_dev_link_update_share() fail.

Introduce a delay time of 1s in ixgbe_setup_mac_link_t_X550em() before
beginning to set up the external PHY link speed to ensure that the
controller can acquire the link.

Signed-off-by: Ashijeet Acharya <ashijeet.acharya@6wind.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Approved by: imp
Obtained from: DPDK (d31b95860d8e9dd7c6e242bd08baaac00a9714f0)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit d5bbb5500cf2ebeae078cb6ae38ecd4b15ec7f6d)

2 years agoixgbe: check host interface return status
Guinan Sun [Thu, 9 Jul 2020 08:00:44 +0000 (08:00 +0000)]
ixgbe: check host interface return status

Writing to read-only fields returns a non-OK Return Status
for shadow RAM write command for X550.
This information was previously discarded.

Signed-off-by: Stanislaw Grzeszczak <stanislaw.a.grzeszczak@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (db18e37090a3b9af47d6a6886248520f6b220bf9)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit c1a56b6f5ffd6f3180a654d058c1783ccb808e8b)

2 years agoixgbe: initialize data field in struct buffer
Guinan Sun [Thu, 9 Jul 2020 08:00:40 +0000 (08:00 +0000)]
ixgbe: initialize data field in struct buffer

While sending request using ixgbe_hic_unlocked() the data field in
buffer struct is not used. It is set when the struct is overwritten by
FW to deliver the response. To not pass random data to FW the whole
structure should be zeroed before use.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (40543be5376ca415b2a7e196315d0555725b8bdf)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit b3ebe337ffa06b0f1f460bf8f1e42fb55db77d0b)

2 years agoixgbe: fix x550em 10G NIC link status
Guinan Sun [Thu, 9 Jul 2020 08:00:30 +0000 (08:00 +0000)]
ixgbe: fix x550em 10G NIC link status

With the NVM image for x550em XFI will not report
the auto-negotiation feature correctly. The auto-negotiation
should be "No" for supports and advertised items.
At the same time update speed makes it support 1G and 10G.

Signed-off-by: Piotr Skajewski <piotrx.skajewski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (fb03b51da940f1d56d701776fd85a0dfc1ace098)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 8e9f1b239dc00a2375af87c48321f85a1e37c14e)

2 years agoixgbe: fix maximum wait time in comment
Xiaolong Ye [Thu, 15 Nov 2018 07:20:05 +0000 (15:20 +0800)]
ixgbe: fix maximum wait time in comment

As the code has changed the max wait time to 1000ms, the comment should
be changed accordingly.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Approved by: imp
Obtained from: DPDK (73247f1ced303c16987bb366d38a2d8a0fc40db4)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 96ef6eb3ae9d622906fb838c82ede3074f864cdc)

2 years agoixgbe: wait longer for link after fiber MAC setup
Matthew Smith [Mon, 16 Jul 2018 16:36:04 +0000 (11:36 -0500)]
ixgbe: wait longer for link after fiber MAC setup

After setting up the link on a fiber port, the maximum wait time for
the link to come up is 500 ms in ixgbe_setup_mac_link_multispeed_fiber().
On an x550 SFP+ port, this is often not sufficiently long for the link
to come up. This can result in never being able to retrieve accurate
link status for the port using rte_eth_link_get_nowait().

Increase the maximum wait time in ixgbe_setup_mac_link_multispeed_fiber()
to 1 s.

Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Approved by: imp
Obtained from: DPDK (64f1c8539c8ce99214b9eb1fb728a2c6745f3300)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit aaa3af802f90d93fdffb99100fe56f0bc3dda119)

2 years agoixgbe: fix host interface shadow RAM read
Guinan Sun [Thu, 9 Jul 2020 08:00:28 +0000 (08:00 +0000)]
ixgbe: fix host interface shadow RAM read

Host interface Shadow RAM Read (0x31) command response
buffer length should be stored in two bytes, instead of one byte.
This patch fixes it.

Signed-off-by: Mateusz Kowalski <mateusz.kowalski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (713fc4dd340e5eadd3bfa9a468446afaa5188624)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 31a23e3eb5314a6b5929e980a0810803adfaad1f)

2 years agoixgbe: fix response to apply-update command
Guinan Sun [Thu, 9 Jul 2020 08:00:29 +0000 (08:00 +0000)]
ixgbe: fix response to apply-update command

For the "Apply Update" command the firmware does not
given an response. For this command, success should
be return.

Signed-off-by: Mateusz Kowalski <mateusz.kowalski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (03b09c71c0c6c516ce05cad8e8aa75e8b9e14fba)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit c966c431c764c493fafbe65b717243a3c0b291be)

2 years agoixgbe: improve log about autoneg being disabled
Guinan Sun [Thu, 9 Jul 2020 08:00:41 +0000 (08:00 +0000)]
ixgbe: improve log about autoneg being disabled

On ESXi OS, when user disables auto negotiation, the following log
appears: "(unsupported) Flow control autoneg is disabled".
It is true that auto negotiation is disabled but it is
not necessarily true that it is not supported.

Signed-off-by: Jakub Chylkowski <jakubx.chylkowski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (ab6ac48d483ef7f906b90f45182f2ddf3254d876)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit f511cd22586a9c0358b86334a51e3db60ca2db01)

2 years agoixgbe: add IPv6 mask for flow director
Guinan Sun [Thu, 9 Jul 2020 08:00:42 +0000 (08:00 +0000)]
ixgbe: add IPv6 mask for flow director

Write FDIRIP6M register to allow flow director filter
to set ipv6 rules without setting ipv6 source/destination address.

Signed-off-by: Piotr Skajewski <piotrx.skajewski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (21feefa2fcd5899ee26a10be405c17c0a1109860)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit c4f73d5d6a6c0117e08a03920cce69202865ba13)

2 years agoixgbe: fix infinite recursion on PCIe link down
Guinan Sun [Thu, 9 Jul 2020 08:00:31 +0000 (08:00 +0000)]
ixgbe: fix infinite recursion on PCIe link down

In some corner cases the functions ixgbe_clear_rar_generic and
ixgbe_clear_vmdq_generic may call one another leading to infinite
recursion.

When ixgbe_clear_vmdq_generic is called with IXGBE_CLEAR_VMDQ_ALL
flag, it's going to clear MPSAR registers, and proceed to call
ixgbe_clear_rar_generic, which in turn will clear the RAR registers,
and recursively call back ixgbe_clear_vmdq_generic. Normally, the
latter would detect that MPSAR registers have already been cleared
and terminate the recursion.

However, when PCIe link is down, and before the driver has had the
opportunity to shut itself down, all register reads return 0xFFFFFFFF,
and all register writes fail silently. In such case, because
ixgbe_clear_vmdq_generic blindly assumes that clearing MPSAR registers
succeeded, it's going to always call ixgbe_clear_rar_generic, which
in turn will always call back ixgbe_clear_vmdq_generic, creating
infinite recursion.

This patch re-reads MPSAR register values after they had been cleared.
In case of PCIe link failure, the values read will be non-zero, which
will terminate the recursion. On the other hand, under normal
circumstances the value read from MPSAR registers is going to be equal
to the value previously written, so this patch is expected not to cause
any regressions.

Signed-off-by: Robert Konklewski <robertx.konklewski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
Approved by: imp
Obtained from: DPDK (2d04b9e856125197ec8e967471426d56ab7efcf0)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 8270b7174c48417a4d5f3effa4a4f4588205e687)

2 years agoixgbe: clear all queues on VF reset
Simon Ellmann [Thu, 17 Dec 2020 17:14:52 +0000 (18:14 +0100)]
ixgbe: clear all queues on VF reset

ixgbe devices support up to 8 Rx and Tx queues per virtual function.
Currently, the registers of only seven queues are set to default when
resetting a VF.

Signed-off-by: Simon Ellmann <simon.ellmann@tum.de>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Approved by: imp
Obtained from: DPDK (d2565b347915def3a0f3c68bde6824acf096a0e6)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 7165504a17682dc8c96d44c65319bf73c89f7f10)

2 years agowpa: Enclose FreeBSD specific defines
Cy Schubert [Thu, 26 Aug 2021 23:28:40 +0000 (16:28 -0700)]
wpa: Enclose FreeBSD specific defines

FreeBSD only defines are specific only to FreeBSD. Document them as such.
It is our intention to push this change to w1.fi.

(cherry picked from commit 213ceba977def36470df3abfe1fac47f689130c1)

2 years agowpa: Include all wpa include file search directories
Cy Schubert [Thu, 26 Aug 2021 23:17:11 +0000 (16:17 -0700)]
wpa: Include all wpa include file search directories

Though not all include file search directories are presently needed,
add them to the search list. This is required for the next update to
wpa.

No functional change intended.

(cherry picked from commit 81b521d2c0edaab4581546af18298310e6318b5d)

2 years agowpa: Correctly build the hostapd BSD driver
Cy Schubert [Thu, 26 Aug 2021 22:59:03 +0000 (15:59 -0700)]
wpa: Correctly build the hostapd BSD driver

driver.bsd.c initializes itself differently when built for
hostapd than it does when built for wpa_supplicant.

(cherry picked from commit a0f2aa9318a21f401a0aef2cde666edc56a92b46)

2 years agowpa: Add wpa_cli action file event
Cy Schubert [Thu, 12 Aug 2021 13:38:21 +0000 (06:38 -0700)]
wpa: Add wpa_cli action file event

Yang Zhong at FreeBSD Foundation is working on a wireless network
configuratior for an experimental FreeBSD installer. The new installer
requires an event to detect when connecting to a network fails due to a
bad password. When this happens a WPA-EVENT-TEMP-DISABLED event is
triggered. This patch passes the event to an action file provided by
the new experimental installer.

Submitted by: Yang Zhong <yzhong () freebsdfoundation.org>
Reviewed by: assumed to be reviewed by emaste (and cy)

(cherry picked from commit ce92f5a91b161c85e0a7e37cc754e3c28074281a)

2 years agowpa: The ap library is not needed by wpa_supplicant or wpa_cli
Cy Schubert [Sat, 12 Jun 2021 23:51:51 +0000 (16:51 -0700)]
wpa: The ap library is not needed by wpa_supplicant or wpa_cli

The ap library is not needed by wpa_supplicant or wpa_cli. It is only
used by hostapd.

MFC after: 2 months

(cherry picked from commit dc9d54b5c1e058b4f1bb9ab9372b171ac87a0d72)

2 years agowpa: Fix GCC 6 build
Cy Schubert [Fri, 4 Jun 2021 01:40:55 +0000 (18:40 -0700)]
wpa: Fix GCC 6 build

GCC 6 searches serially to resolve external references.

MFC after: 2 months
X-MFC with: 25ecdc7d52770caf1c9b44b5ec11f468f6b636f3

(cherry picked from commit 681500889424423403ace51f118b3467e09acc00)

2 years agowpa: Fix a SIGBUS error in wpa_sm_set_rekey_offload
Cy Schubert [Wed, 2 Jun 2021 19:46:02 +0000 (12:46 -0700)]
wpa: Fix a SIGBUS error in wpa_sm_set_rekey_offload

Incorrectly linked built-in wpa functions resulted in overwriting
sm->ctx->set_rekey_offload with garbage. It was initialized correctly
however it changed after wpa_supplicant became a daemon.

No SIGBUS violations reported by dhw@ were experienced during testing
of the original commit by msyelf or philip@.

Reported by: dhw
Tested by: dhw
MFC after: 2 months
X-MFC with: 25ecdc7d52770caf1c9b44b5ec11f468f6b636f3

(cherry picked from commit 9a0f82285322a338548d13fcda07e1d574301190)

2 years agowpa: Restructure wpa build
Cy Schubert [Thu, 20 May 2021 21:28:17 +0000 (14:28 -0700)]
wpa: Restructure wpa build

The current WPA build assumes a flat namespace. However the latest sources
from w1.fi now have a duplicate config.c, in two separate subdirectories.
The flat namespace will overwrite config.o with the output from the most
recently modified config.c, of which there are two of them.

This commit resolves this problem by building each component in
wpa's src subdirectory tree into its own .a archive, just as the w1.fi
upstream build as used by the port does. The advantages of this approach
are:

1. Duplicate source file names, i.e. config.c in the wpa_supplicant
   direcory and another config.c in src/utils in the next wpa
   will result in both compiles writing to the same .o file.

2. This restructure simplifies maintanence. A develper needs only to add
   new files as identified by git status in the vendor branch to the
   appropriate Makefile within the usr.sbin/wpa tree. This also reduces
   time required to prepare a new import and should reduce error.

3. The new wpa build structure more closely represents the build as
   performed by the upstream tarball.

This is in preparation for the next wpa update from w1.fi.

Reviewed by: philip
Tested by: philip
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D30372

(cherry picked from commit 25ecdc7d52770caf1c9b44b5ec11f468f6b636f3)

2 years ago[wpa] Add support for hostapd/wpa_supplicant when WITHOUT_CRYPT=YES
Adrian Chadd [Mon, 4 Jan 2021 20:39:53 +0000 (12:39 -0800)]
[wpa] Add support for hostapd/wpa_supplicant when WITHOUT_CRYPT=YES
is enabled.

This builds wpa_supplicant / hostpad using internal encryption routines
rather than using libcrypt.

This has been supported in wpa for years now, however since we use
local makefiles for this, we bitrotted dependencies and configuration
options.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D27958

(cherry picked from commit 7c5a624afae43c44d8e57eb8c5073b9b07f88064)

2 years agolinux: make sure to zero the l_siginfo structure for ptrace(2)
Edward Tomasz Napierala [Tue, 8 Jun 2021 09:18:29 +0000 (10:18 +0100)]
linux: make sure to zero the l_siginfo structure for ptrace(2)

Reported By: dchagin
Sponsored By: EPSRC

(cherry picked from commit f102b61d0ecffc6d9cc322fa7a48e0927391421b)

2 years agotop(1): indicate how to reset grep string
John Grafton [Tue, 7 Sep 2021 17:39:59 +0000 (13:39 -0400)]
top(1): indicate how to reset grep string

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/536/files

(cherry picked from commit 4ccbbe5f0689513de4399d6dad43e85d97ad9cde)

2 years agotop(1): support command name and argument grepping
John Grafton [Wed, 16 Jun 2021 19:40:21 +0000 (15:40 -0400)]
top(1): support command name and argument grepping

Obtained from:  OpenBSD
Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/479

(cherry picked from commit a00d703f2f438b199d3933d19d535540586b7792)

2 years agonetinet: prevent NULL pointer dereference in in_aifaddr_ioctl()
Artem Khramov [Tue, 24 Aug 2021 14:26:35 +0000 (17:26 +0300)]
netinet: prevent NULL pointer dereference in in_aifaddr_ioctl()

It appears that maliciously crafted ifaliasreq can lead to NULL
pointer dereference in in_aifaddr_ioctl(). In order to replicate
that, one needs to

1. Ensure that carp(4) is not loaded

2. Issue SIOCAIFADDR call setting ifra_vhid field of the request
   to a negative value.

A repro code would look like this.

int main() {
    struct ifaliasreq req;
    struct sockaddr_in sin, mask;
    int fd, error;

    bzero(&sin, sizeof(struct sockaddr_in));
    bzero(&mask, sizeof(struct sockaddr_in));

    sin.sin_len = sizeof(struct sockaddr_in);
    sin.sin_family = AF_INET;
    sin.sin_addr.s_addr = inet_addr("192.168.88.2");

    mask.sin_len = sizeof(struct sockaddr_in);
    mask.sin_family = AF_INET;
    mask.sin_addr.s_addr = inet_addr("255.255.255.0");

    fd = socket(AF_INET, SOCK_DGRAM, 0);
    if (fd < 0)
        return (-1);

    memset(&req, 0, sizeof(struct ifaliasreq));
    strlcpy(req.ifra_name, "lo0", sizeof(req.ifra_name));
    memcpy(&req.ifra_addr, &sin, sin.sin_len);
    memcpy(&req.ifra_mask, &mask, mask.sin_len);
    req.ifra_vhid = -1;

    return ioctl(fd, SIOCAIFADDR, (char *)&req);
}

To fix, discard both positive and negative vhid values in
in_aifaddr_ioctl, if carp(4) is not loaded. This prevents NULL pointer
dereference and kernel panic.

Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/530

(cherry picked from commit 620cf65c2bc4035a07e1152da419a4e60d36ff9b)

2 years agostand: Add MK_PIE=no to defs.mk
Warner Losh [Wed, 11 Aug 2021 16:59:28 +0000 (10:59 -0600)]
stand: Add MK_PIE=no to defs.mk

There's no need to build both pie and non-pie .o's for stand. There's
some other build thing with MK_BEAR_SSL=yes and/or MK_LOADER_VERIEXEC=yes
that causes the pie build to fail that the 'ar' stage now. Since we don't
need the PIE stuff and the non-PIE stuff, disable PIE for the boot loader.

Reviewed by: emaste
Sponsored by: Netflix

(cherry picked from commit 879675e9a0d84880cad9834e2ef98e8724c5532c)

2 years agomk: WITH_FOO=no now generates a warning
Warner Losh [Thu, 10 Jun 2021 00:10:12 +0000 (18:10 -0600)]
mk: WITH_FOO=no now generates a warning

Many people are used to gnu configure's behavior of changing
--with-foo=no to --without-foo. At the same time, several folks have
WITH_FOO=no in their config files to enable this ironic form of the
option because of an old meme from IRC, a mailing list or the forums (I
forget which). Add a warning to allow to alert people w/o breaking POLA.

Reviewed by: allanjude, bdrewery, manu
MFC After: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30684

(cherry picked from commit f4d987cd137cb2d0d54a3e35d9258ca7c175d291)

2 years agogenoffset: simplify and rewrite in sh
Warner Losh [Wed, 28 Jul 2021 19:47:05 +0000 (13:47 -0600)]
genoffset: simplify and rewrite in sh

genoffset used the fully generic ASSYM macro to generate the offsets
needed for the thread_lite structure. However, since these are offsets
into a structure, they will always be necessarily small and positive. As
such, just create a simple character array of the right size and use a
naming convention such that we can recover the field name, structure
name and type. Use nm -t d and sort -n to sort these into order, then
loop over the resutls to generate the thread_lite structure.

MFC After: 2 weeks
Reviewed by: kib, markj (earlier versions)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31203

(cherry picked from commit 824897a3aea5ca22db8cb7d5b404697a1de1210a)

2 years agogenassym.sh: Fix two minor issues found by shellcheck
Warner Losh [Wed, 28 Jul 2021 19:42:29 +0000 (13:42 -0600)]
genassym.sh: Fix two minor issues found by shellcheck

o Remove redunant $ in $(( )) expression.
o Quote arg passed to work so paths with spaces, etc will work.

MFC After: 2 weeks
Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31335

(cherry picked from commit 46dd3ef0338ba2ad24d05bab2a614410cf17b017)

2 years agoloader: support.4th resets the read buffer incorrectly
John Hood [Wed, 28 Jul 2021 19:43:02 +0000 (13:43 -0600)]
loader: support.4th resets the read buffer incorrectly

Large nextboot.conf files (over 80 bytes) are not read correctly by the
Forth loader, causing file parsing to abort, and nextboot configuration
fails to apply.

Simple repro:

nextboot -e foo=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
shutdown -r now

That will cause the bug to cause a parse failure but shouldn't otherwise
affect the boot.  Depending on your loader configuration, you may also
have to set beastie_disable and/or reduce the number of modules loaded
to see the error on a small console screen.  12.0 or CURRENT users will
also have to explicitly use the Forth loader instead of the Lua loader.
The error will look something like:

Warning: syntax error on file /boot/loader.conf.local
foo="xxxxxxxxxxxxxxnextboot_enable="YES"
                                    ^
/boot/support.4th has crude file I/O buffering, which uses a buffer
'read_buffer', defined to be 80 bytes by the 'read_buffer_size'
constant.  The loader first tastes nextboot.conf, reading and parsing
the first line in it for nextboot_enable="YES".  If this is true, then
it reopens the file and parses it like other loader .conf files.

Unfortunately, the file I/O buffering code does not fully reset the
buffer state in the reset_line_reading word.  If the last file was read
to the end, that doesn't matter; the file buffer is treated as empty
anyway.  But in the nextboot.conf case, the loader will not read to the
end of file if it is over 80 bytes, and the file buffer may be reused
when reading the next file.  When the file is reread, the corrupt text
may cause file parsing to abort on bad syntax (if the corrupt line has
<>2 quotes in it), the wrong variable to be set, no variable to be set
at all, or (if the splice happens to land at a line ending) something
approximating normal operation.

The bug is very old, dating back to at least 2000 if not before, and is
still present in 12.0 and CURRENT r345863 (though it is now hidden by
the Lua loader by default).

Suggested one-line attached.  This does change the behavior of the
reset_line_reading word, which is exported in the line-reading
dictionary (though the export is not documented in loader man pages).
But repo history shows it was probably exported for the PNP support
code, which was never included in the loader build, and was removed 5
months ago.

One thing that puzzles me: how has this bug gone unnoticed/unfixed for
nearly 2 decades?  I find it hard to believe that nobody's tried to do
something interesting with nextboot, like load a kernel and filesystem,
which is what I'm doing.

Tested by: Gary Jennejohn
PR: 239315
MFC After: 3 weeks
Reviewed by: imp (and correctly applied this time)
Differential Revision: https://reviews.freebsd.org/D31328

(cherry picked from commit dbdf2b52f59df7374eb1f799b4df1b54e4502e40)

2 years agocli.lua.8: make the command match the code
Warner Losh [Thu, 29 Jul 2021 02:53:18 +0000 (20:53 -0600)]
cli.lua.8: make the command match the code

It's disable-device, not device-disable

Spotted by: jrtc27
Sponsored by: Netflix

(cherry picked from commit 6b51baf6a8de7241a4e1b0c8436d70299cd55270)

2 years agolua loader: Add disable-device to disable a device.
Warner Losh [Wed, 28 Jul 2021 22:52:38 +0000 (16:52 -0600)]
lua loader: Add disable-device to disable a device.

disable-device fooX will set hint.foo.X.disabled=1 as a way to easily
disable a device attaching during boot.

Reviewed by: tsoome
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31297

(cherry picked from commit 07c4b78d0a1d26b6441cf3e52b917f20c932b9d0)

2 years agolualoader: use more concise verbiage for autoboot
Kyle Evans [Wed, 8 Sep 2021 21:34:33 +0000 (16:34 -0500)]
lualoader: use more concise verbiage for autoboot

The behavior remains the same, but lualoader now uses the more concise
verbiage that forthloader used.  This is particularly important because
the previous line would exceed the right boundary of the menu and run
straight into space that would typically be allowed for the logo.

This makes it slightly easier to port logos from forthloader to
lualoader.

(cherry picked from commit ed107537b43cabf7a18e73a17856a9d9e170c6e9)

2 years agolualoader: allow brands to specify a shift
Kyle Evans [Wed, 8 Sep 2021 21:33:28 +0000 (16:33 -0500)]
lualoader: allow brands to specify a shift

Some brands will want to specify a shift to make sure they're properly
centered; let it happen.

(cherry picked from commit e19d9a9b6e44e15087a140a26ab3e24b07f6ba56)

2 years agoloader: do not output empty menu title
Toomas Soome [Wed, 21 Apr 2021 11:42:10 +0000 (14:42 +0300)]
loader: do not output empty menu title

As we output spaces around the menu title, we should also check,
if the title is actually empty string.

PR: 255299
Submitted by: Jose Luis Duran
Reported by: Jose Luis Duran

(cherry picked from commit 4ba91fa0736bb0672d475b6b56d9e7b06e78ff69)

2 years agoloader: insert spaces around menu title
Toomas Soome [Tue, 23 Mar 2021 05:04:48 +0000 (07:04 +0200)]
loader: insert spaces around menu title

Small visual nit, make menu title more clean

(cherry picked from commit 62ffcaab8f3ccba6053d4a5622c5ef2de9f636b5)

2 years agoloader_lua: consider userboot console as serial
Toomas Soome [Sun, 14 Feb 2021 08:28:29 +0000 (10:28 +0200)]
loader_lua: consider userboot console as serial

We use ascii box chars with serial console because we do not know
if terminal can draw unixode box chars. Same problem is about userboot
console.

(cherry picked from commit 5d8c062fe3ee7b2d6aed0b46d22f62c7771c0af8)

2 years agoAdd support for recording EC2 AMI Ids in SSM
Colin Percival [Fri, 27 Aug 2021 00:54:53 +0000 (17:54 -0700)]
Add support for recording EC2 AMI Ids in SSM

If SSMPREFIX is specified, AMI Ids will be recorded in the SSM
Parameter Store under the name
  ${SSMPREFIX}/${ARCH}/${FLAVOUR}/${ROOTFS}/${REVISION}/${BRANCH}
where ARCH is "amd64" or "arm64", FLAVOUR is "base" (but may have
other options in the future), ROOTFS is "ufs" (but may have other
options in the future), and REVISION and BRANCH have their normal
meanings.

FreeBSD will be using the public prefix "/aws/service/freebsd",
resulting in SSM Parameter names which look like
  /aws/service/freebsd/amd64/base/ufs/14.0/CURRENT

Relnotes: yes
Sponsored by: https://patreon.com/cperciva
MFC after: 2 weeks

(cherry picked from commit c5af0ac1a732491aab789dda0da368ff48497871)

2 years agopf: ensure states passed to pf_free_state() are always unlinked
Kristof Provost [Fri, 3 Sep 2021 07:36:19 +0000 (09:36 +0200)]
pf: ensure states passed to pf_free_state() are always unlinked

In pf_create_state() we can end up deleting the state immediately. This
can happen if we fail to map the relevant addresses or fail
normalization or fail to insert it into the state table.
If that happens we delete the state again with pf_free_state(). However,
this asserts that the state must be unlinked.

It's correct to simply set the state to PFTM_UNLINKED because we've not
yet linked it.

Submitted by: Mateusz Guzik <mjg@FreeBSD.org>
Reviewed by: scottl
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31752

(cherry picked from commit a0c64a443e4cae67a5eea3a61a47d746866de3ee)

2 years agodtrace: fix ipfw_rule_info_t translator
Andrey V. Elsukov [Thu, 2 Sep 2021 13:35:01 +0000 (16:35 +0300)]
dtrace: fix ipfw_rule_info_t translator

322e5efda8578b has changed field names in the struct ip_fw.
Use correct names in ipfw_rule_info_t translator in the ipfw.d script.

Reported by: Keith White <kwhite uottawa at gmail>

(cherry picked from commit 5c8e8e82aeaf3aa788acdd6cfca30ef09094230d)

2 years agolibarchive: import bugfix from upstream
Martin Matuska [Fri, 27 Aug 2021 10:51:01 +0000 (12:51 +0200)]
libarchive: import bugfix from upstream

Reworked bugfix for upstream issue #1566:
  Do not follow symlinks when processing the fixup list

(cherry picked from commit c577bdfce6b4451ab897bfe5013543e78a7f9b62)

2 years agolibarchive: import changes from upstream
Martin Matuska [Mon, 23 Aug 2021 00:54:15 +0000 (02:54 +0200)]
libarchive: import changes from upstream

Libarchive 3.5.2

New features:
  PR #1502: Support for PWB and v7 binary cpio formats
  PR #1509: Support of deflate algorithm in symbolic link decompression
            for ZIP archives

Important bugfixes:
  IS #1044: fix extraction of hardlinks to symlinks
  PR #1480: Fix truncation of size values during 7zip archive
            extraction on 32bit architectures
  PR #1504: fix rar header skiming
  PR #1514: ZIP excessive disk read - fix location of central directory
  PR #1520: fix double-free in CAB reader
  PR #1521: Fixed leak of rar before ending with error
  PR #1530: Handle short writes from archive_write_callback
  PR #1532: 7zip: Use compression settings from file also for file header
  IS #1566: do not follow symlinks when processing the fixup list

Relnotes: yes

(cherry picked from commit ddce862ad8594542e1fa1af9ffae7264e12ffd27)

2 years agoopenssh: regenerate freebsd-namespace.h
Ed Maste [Thu, 2 Sep 2021 01:54:57 +0000 (21:54 -0400)]
openssh: regenerate freebsd-namespace.h

For some reason poly64 was omitted when this file was last generated
(perhaps it was inlined by the Clang version then in use).

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c7b4c21ee4615e2e418ab520abf6c026d6dae398)

2 years agoopenssh: disable libwrap (TCP wrappers) at configure time
Ed Maste [Thu, 2 Sep 2021 00:30:05 +0000 (20:30 -0400)]
openssh: disable libwrap (TCP wrappers) at configure time

We define LIBWRAP at build time in secure/usr.sbin/sshd/Makefile if
WITH_TCPWRAPPERS is in effect, so it should not be set in config.h.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 36cd1e5e8c216e0f67832d59d629f2910a02d4fc)

2 years agoopenssh: clarify krb5 use in freebsd-configure
Ed Maste [Thu, 2 Sep 2021 00:23:40 +0000 (20:23 -0400)]
openssh: clarify krb5 use in freebsd-configure

freebsd-configure.sh runs configure twice, --with-kerberos5 and
--without-kerberos5, in order to build a config.h that defaults to
kerberos5 disabled, and a small config file that represents the
differences.

Rename config.h.orig to config.h.kerberos5 to clarify the intent of this
script.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5e4dd21fd60958ceef4e4fd14b000844b957287e)

2 years agoopenssh: tag generated file with @generated
Ed Maste [Thu, 2 Sep 2021 01:49:44 +0000 (21:49 -0400)]
openssh: tag generated file with @generated

Tools like Phabricator use the @generated tag to identify files that
may be excluded from review by default.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b3e858f7622e7fb058c05f81abd657fc47c6f717)

2 years agopfctl: print counters in decimal
Kristof Provost [Sat, 4 Sep 2021 14:07:59 +0000 (16:07 +0200)]
pfctl: print counters in decimal

795d78a46713 pfctl: Don't use PRIu64 mistakenly changed these to be
printed as hexadecimal numbers.

Reported by: Florian Smeets
MFC after: 4 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 846a6e8f9ab25df4e06d28c05fb66060d803c9ba)

2 years agopfctl: Don't use PRIu64
Kristof Provost [Wed, 1 Sep 2021 16:18:26 +0000 (18:18 +0200)]
pfctl: Don't use PRIu64

Rather than PRIu64 we can just treat the data as uintmax_t, and use %jx
instead.

MFC after: 1 week
Suggested by: kib
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 795d78a46713fc16153966e77f20da2f40aac2a3)

2 years agopf: import pf_set_protostate() from OpenBSD
Kristof Provost [Tue, 20 Jul 2021 16:38:16 +0000 (18:38 +0200)]
pf: import pf_set_protostate() from OpenBSD

to change a state's state (that term is overloaded in pf, protocol state
like ESTABLISHED for tcp here), don't do it directly, but go through a newly
introduced pf_set_protostate()

Reviewed by: kbowling
Obtainted from: OpenBSD
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31729

(cherry picked from commit ce3ea45047c7321bcfcf0cd31272f0e4359640f2)

2 years agopf: Add counters for syncookies
Kristof Provost [Sun, 29 Aug 2021 13:54:50 +0000 (15:54 +0200)]
pf: Add counters for syncookies

Count when we send a syncookie, receive a valid syncookie or detect a
synflood.

Reviewed by: kbowling
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31713

(cherry picked from commit 4cab80a8dfecdf16333a1113513e046b9f4dd7f6)

2 years agocrypto(4): Fix a few typos in camellia.c
Gordon Bergling [Sat, 4 Sep 2021 11:02:11 +0000 (13:02 +0200)]
crypto(4): Fix a few typos in camellia.c

 - s/valiables/variables/

Obtained from: NetBSD

(cherry picked from commit 88a3af4da1aad5cf319c4c465baebc24b4e98fd8)

2 years agoFix a common typo in source code comments
Gordon Bergling [Sat, 4 Sep 2021 10:56:57 +0000 (12:56 +0200)]
Fix a common typo in source code comments

- s/existant/existent/

(cherry picked from commit 631504fb346800f95fc581c15eb88b01c1b66fcf)

2 years agonvme(4): Add MSI and single MSI-X support.
Alexander Motin [Tue, 31 Aug 2021 17:34:48 +0000 (13:34 -0400)]
nvme(4): Add MSI and single MSI-X support.

If we can't allocate more MSI-X vectors, accept using single shared.
If we can't allocate any MSI-X, try to allocate 2 MSI vectors, but
accept single shared.  If still no luck, fall back to shared INTx.

This provides maximal flexibility in some limited scenarios.  For
example, vmd(4) does not support INTx and can handle only limited
number of MSI/MSI-X vectors without sharing.

MFC after: 1 week

(cherry picked from commit e3bdf3da769a55f0944d9c337bb4d91b6435f02c)

2 years agonvme(4): Do not panic on admin queue construct error.
Alexander Motin [Tue, 31 Aug 2021 00:36:22 +0000 (20:36 -0400)]
nvme(4): Do not panic on admin queue construct error.

MFC after: 1 week

(cherry picked from commit 31111372e6bad7212dbee36dd312e3b53fdfd3f6)