]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agorc.conf(5): describe devmatch rc variables
Mitchell Horne [Sun, 10 Jan 2021 20:53:59 +0000 (16:53 -0400)]
rc.conf(5): describe devmatch rc variables

Reviewed by: imp, gbe (manpages)

(cherry picked from commit ef757da441b199da680bfbd24afaa9d3c16e5b55)

3 years agoiwm(4): Add support for Intel Killer(R) Wireless-AC 1550i
Mark Johnston [Thu, 14 Jan 2021 16:41:28 +0000 (11:41 -0500)]
iwm(4): Add support for Intel Killer(R) Wireless-AC 1550i

PR: 252578
Submitted by: shu <ankohuu@outlook.com>

(cherry picked from commit 90cc8706ccb2da130c0b1a28434a9ec5d4c80d81)

3 years agotmpfs_reclaim: detach unlinked node on dereferencing.
Konstantin Belousov [Tue, 12 Jan 2021 16:10:07 +0000 (18:10 +0200)]
tmpfs_reclaim: detach unlinked node on dereferencing.

(cherry picked from commit 2d1e4220ebd50b9220d3266754425f025c786108)

3 years agopf tests: pass NULL buffer to DIOCRCLRTSTATS
Kristof Provost [Wed, 13 Jan 2021 18:41:07 +0000 (19:41 +0100)]
pf tests: pass NULL buffer to DIOCRCLRTSTATS

As discovered by syzcaller this used to provoke panics.

MFC after: 1 week

(cherry picked from commit 44117554b1ee8edd66d7383c17802d5799fd18f2)

3 years agopf: Don't hold PF_RULES_WLOCK during copyin() on DIOCRCLRTSTATS
Kristof Provost [Wed, 13 Jan 2021 18:30:01 +0000 (19:30 +0100)]
pf: Don't hold PF_RULES_WLOCK during copyin() on DIOCRCLRTSTATS

We cannot hold a non-sleepable lock during copyin(). This means we can't
safely count the table, so instead we fall back to the pf_ioctl_maxcount
used in other ioctls to protect against overly large requests.

Reported by: syzbot+81e380344d4a6c37d78a@syzkaller.appspotmail.com
MFC after: 1 week

(cherry picked from commit ea36212bf5711206bbaf5362a23ebb52c7f7e2a4)

3 years agopf: Copy kif flags to userspace
Kristof Provost [Thu, 7 Jan 2021 21:24:38 +0000 (22:24 +0100)]
pf: Copy kif flags to userspace

This was overlooked in the pfi_kkif/pfi_kif splitup and as a result
userspace could no longer tell which interfaces had the skip flag
applied.

MFC after: 2 weeks

(cherry picked from commit 0fcb03fbaca1307175edc96355c867471db309f8)

3 years agopfctl: Fix NOCLEAN build
Kristof Provost [Tue, 19 Jan 2021 12:48:31 +0000 (13:48 +0100)]
pfctl: Fix NOCLEAN build

We've created a new pf_ruleset.c file for pfctl and no longer use the
kernel vrsion, but the build system doesn't handle this dependency
change correctly. Delete the dependency file if it contains the kernel
version of the file.

(modified from commit c38e59ce1b0a6c030a942d0814d581dbd7f67e3c)

3 years agopfctl: Stop sharing pf_ruleset.c with the kernel
Kristof Provost [Thu, 24 Dec 2020 15:02:04 +0000 (16:02 +0100)]
pfctl: Stop sharing pf_ruleset.c with the kernel

Now that we've split up the datastructures used by the kernel and
userspace there's essentually no more overlap between the pf_ruleset.c
code used by userspace and kernelspace.

Copy the userspace bits to the pfctl directory and stop using the kernel
file.

Reviewed by: philip
MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D27764

(cherry picked from commit fda7daf06301beef1bdad39891232a12c6925b22)

3 years agopf: Convert pfi_kkif to use counter_u64
Kristof Provost [Sun, 13 Dec 2020 16:20:02 +0000 (17:20 +0100)]
pf: Convert pfi_kkif to use counter_u64

Improve caching behaviour by using counter_u64 rather than variables
shared between cores.

The result of converting all counters to counter(9) (i.e. this full
patch series) is a significant improvement in throughput. As tested by
olivier@, on Intel Xeon E5-2697Av4 (16Cores, 32 threads) hardware with
Mellanox ConnectX-4 MCX416A-CCAT (100GBase-SR4) nics we see:

x FreeBSD 20201223: inet packets-per-second
+ FreeBSD 20201223 with pf patches: inet packets-per-second
+--------------------------------------------------------------------------+
|                                                                        + |
| xx                                                                     + |
|xxx                                                                    +++|
||A|                                                                       |
|                                                                       |A||
+--------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x   5       9216962       9526356       9343902     9371057.6     116720.36
+   5      19427190      19698400      19502922      19546509     109084.92
Difference at 95.0% confidence
        1.01755e+07 +/- 164756
        108.584% +/- 2.9359%
        (Student's t, pooled s = 112967)

Reviewed by: philip
MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D27763

(cherry picked from commit 5a3b9507d784aaa6a7ce35432b2111a7eec12cba)

3 years agopf: Allocate and free pfi_kkif in separate functions
Kristof Provost [Sun, 13 Dec 2020 10:36:54 +0000 (11:36 +0100)]
pf: Allocate and free pfi_kkif in separate functions

Factor out allocating and freeing pfi_kkif structures. This will be
useful when we change the counters to be counter_u64, so we don't have
to deal with that complexity in the multiple locations where we allocate
pfi_kkif structures.

No functional change.

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D27762

(cherry picked from commit 26c841e2a402ed43896313d1b3f00facaa9d839f)

3 years agopf: Split pfi_kif into a user and kernel space structure
Kristof Provost [Sat, 12 Dec 2020 14:14:56 +0000 (15:14 +0100)]
pf: Split pfi_kif into a user and kernel space structure

No functional change.

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D27761

(cherry picked from commit 320c11165b6b1113b34f9e156cbf85b5ed0aa5eb)

3 years agopf: Change pf_krule counters to use counter_u64
Kristof Provost [Sat, 5 Dec 2020 20:41:42 +0000 (21:41 +0100)]
pf: Change pf_krule counters to use counter_u64

This improves the cache behaviour of pf and results in improved
throughput.

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D27760

(cherry picked from commit c3adacdad4d72b045058cd932351b94579cdd543)

3 years agopf: Remove unused fields from pf_krule
Kristof Provost [Sat, 5 Dec 2020 13:38:12 +0000 (14:38 +0100)]
pf: Remove unused fields from pf_krule

The u_* counters are used only to communicate with userspace, as
userspace cannot use counter_u64. As pf_krule is not passed to userspace
these fields are now obsolete.

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D27759

(cherry picked from commit c7bdafe2f1b703fdf72489019edc3d6b9e5483da)

3 years agopf: Split pf_rule into kernel and user space versions
Kristof Provost [Sat, 5 Dec 2020 13:32:54 +0000 (14:32 +0100)]
pf: Split pf_rule into kernel and user space versions

No functional change intended.

MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D27758

(cherry picked from commit e86bddea9fe62d5093a1942cf21950b3c5ca62e5)

3 years agopf: Migrate pf_rule and related structs to pf.h
Kristof Provost [Thu, 3 Dec 2020 16:17:39 +0000 (17:17 +0100)]
pf: Migrate pf_rule and related structs to pf.h

As part of the split between user and kernel mode structures we're
moving all user space usable definitions into pf.h.

No functional change intended.

MFC after:      2 weeks
Sponsored by:   Orange Business Services
Differential Revision: https://reviews.freebsd.org/D27757

(cherry picked from commit dc865dae89c34291467e0ba569a8c78fc7a5d360)

3 years agopf: Use counter_u64 in pf_src_node
Kristof Provost [Fri, 13 Nov 2020 19:31:51 +0000 (20:31 +0100)]
pf: Use counter_u64 in pf_src_node

Reviewd by: philip
MFC after:      2 weeks
Sponsored by:   Orange Business Services
Differential Revision: https://reviews.freebsd.org/D27756

(cherry picked from commit fbbf270eef271806a0a106e45356d91f5b5e1f55)

3 years agopf: Split pf_src_node into a kernel and userspace struct
Kristof Provost [Wed, 23 Dec 2020 13:51:52 +0000 (14:51 +0100)]
pf: Split pf_src_node into a kernel and userspace struct

Introduce a kernel version of struct pf_src_node (pf_ksrc_node).

This will allow us to improve the in-kernel data structure without
breaking userspace compatibility.

Reviewed by: philip
MFC after: 2 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D27707

(cherry picked from commit 17ad7334ca6225e0dc5caca12d1eb5886115f7af)

3 years agoAdd some examples to script.1
Mateusz Piotrowski [Tue, 5 Jan 2021 15:28:32 +0000 (16:28 +0100)]
Add some examples to script.1

While here:

- Split synopsis into two parts. The first explains how to record
  sessions, while the second one explains how to replay (some of)
  the recorded sessions.
- Fix the -width argument of the environment variables list.

(cherry picked from commit d41149a8e9cbb76ff89322a3363299f1b93823d2)

3 years agoImprove readability of the options list
Mateusz Piotrowski [Tue, 5 Jan 2021 14:46:56 +0000 (15:46 +0100)]
Improve readability of the options list

(cherry picked from commit 225afb6cad9808af42408875baaa243d6d75d92d)

3 years agoFix a typo
Mateusz Piotrowski [Thu, 7 Jan 2021 14:28:29 +0000 (15:28 +0100)]
Fix a typo

(cherry picked from commit 0199cbf641db5f28d258153014fa8a657ae98ea6)

3 years agoAdd a missing period and remove a macro from Bl's width argument
Mateusz Piotrowski [Thu, 12 Nov 2020 16:44:56 +0000 (16:44 +0000)]
Add a missing period and remove a macro from Bl's width argument

(cherry picked from commit 2bbc7e74368c73d198838ee821a4b3dd75a8be6a)

3 years agobootparamd: Fix build with GCC.
Yoshihiro Takahashi [Tue, 19 Jan 2021 17:41:37 +0000 (02:41 +0900)]
bootparamd: Fix build with GCC.

Remove CWARNFLAGS for GCC because GCC 4.2.1 does not have
-Wdiscarded-qualifiers option.

This is direct commit to stable/12.

Pointy hat to: nyan

3 years agobootparamd: Add missing __unused mark.
Yoshihiro Takahashi [Sat, 2 Jan 2021 15:40:34 +0000 (00:40 +0900)]
bootparamd: Add missing __unused mark.

e03764d931d820185a019334259b18df2e3f6b6c did not catch all unused
variables.

Submitted by: otis
Differential Revision: https://reviews.freebsd.org/D27894

(cherry picked from commit 8c45fe5d8ecda4be7564aadaa50712790c6c0a6f)

3 years agobootparamd: Fix several warnings and increase warn level to 6.
Yoshihiro Takahashi [Sat, 2 Jan 2021 03:36:09 +0000 (12:36 +0900)]
bootparamd: Fix several warnings and increase warn level to 6.

- Increase WARNS to 6.
- Except -Wcast-align and -Wincompatible-pointer-types-discards-qualifiers
  checks.
- Use ANSI C prototype.
- Statically variables and functions.
- Add extern declaration for global variables.
- Rename local variables to resolve shadow warnings.

PR: 71667

(cherry picked from commit e03764d931d820185a019334259b18df2e3f6b6c)

3 years agounzip: Sync with NetBSD upstream.
Yoshihiro Takahashi [Sat, 2 Jan 2021 01:50:08 +0000 (10:50 +0900)]
unzip: Sync with NetBSD upstream.

- Ignore malformed directory entries as created by Dropbox ("/").
  (rev 1.24)
- Use libarchive 3.x interface: check result for archive_read_free()
  and don't call archive_read_close manually. (rev 1.23)
- Always overwrite symlinks on extraction, ever if they're newer than
  entries in archive.
- Use getline() rather than getdelim().

PR: 231827
Submitted by: ak
Reviewed by: mm
Obtained from: NetBSD

(cherry picked from commit 0cdfa4956424dc816944a84568a4d9900b68f5e3)

3 years agoelftcl: add -i flag to ignore unknown flags
Ed Maste [Wed, 13 Jan 2021 03:24:52 +0000 (22:24 -0500)]
elftcl: add -i flag to ignore unknown flags

This may allow an identical elfctl invocation to be used on multiple
FreeBSD versions, with features not implemented on older releases being
silently ignored.

PR: 252629 (related)
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28130

(cherry picked from commit f6d95a01103a49a94c876d5a51bb4be25c06d964)

3 years agortld: map without PROT_EXEC for relocation
Ed Maste [Mon, 4 Jan 2021 18:55:44 +0000 (13:55 -0500)]
rtld: map without PROT_EXEC for relocation

This makes text segment relocation work under W^X.

Submitted by: Greg V <greg@unrelenting.technology> (original version)
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D27953

(cherry picked from commit 613a08cfa2e0fb1b99906961c7a676d527e17f05)

3 years agoqat: Free counters during detach
Mark Johnston [Thu, 14 Jan 2021 16:41:28 +0000 (11:41 -0500)]
qat: Free counters during detach

Sponsored by: Rubicon Communications, LLC (Netgate)

(cherry picked from commit 6483fc224b1a68528a65c16e9d8e55e2b5535ee9)

3 years agoqat: Count request allocation failures
Mark Johnston [Thu, 14 Jan 2021 16:41:28 +0000 (11:41 -0500)]
qat: Count request allocation failures

This can be useful for troubleshooting performance problems.

Sponsored by: Rubicon Communications, LLC (Netgate)

(cherry picked from commit a33b29a0447b24a054ecc48e51355d2abf7e6b5b)

3 years agoqat: Fix DH895XCC firmware module autoloading
Mark Johnston [Thu, 14 Jan 2021 16:41:28 +0000 (11:41 -0500)]
qat: Fix DH895XCC firmware module autoloading

Sponsored by: Rubicon Communications, LLC (Netgate)

(cherry picked from commit 95ee7d9b879ce42088277c85d85e61f6c79674ad)

3 years agolibdtrace: Format USDT symbols correctly based on symbol binding
Mark Johnston [Sun, 10 Jan 2021 22:46:32 +0000 (17:46 -0500)]
libdtrace: Format USDT symbols correctly based on symbol binding

Before we did not handle weak symbols correctly, sometimes resulting in
link errors from dtrace -G when processing object files where functions
with weak aliases contain USDT probes.

Reported by: rlibby
Sponsored by: The FreeBSD Foundation

(cherry picked from commit d00431a7bd0c4b4607943baed588e58ad5ae6150)

3 years agomvneta: Acquire the softc lock before clearing the MIB
Mark Johnston [Sat, 9 Jan 2021 15:03:46 +0000 (10:03 -0500)]
mvneta: Acquire the softc lock before clearing the MIB

Reported by: Andrei Martin <andrei.cos.martin@gmail.com>

(cherry picked from commit 109260d202fb64be6f2efcf243c25090c1f64420)

3 years agomvneta: Fix 64-bit MIB reads
Mark Johnston [Mon, 4 Jan 2021 13:22:21 +0000 (08:22 -0500)]
mvneta: Fix 64-bit MIB reads

It appears we must read MIB values as 2 4-byte words, lower address
first.  A single 8-byte MIB read returns the value with the lower 4
bytes copied into the upper 4 bytes, resulting in bogus byte counter
values.

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

(cherry picked from commit caf552a607191ffc798e3edb697ae99d5b15711a)

3 years agoxen: allow limiting the amount of duplicated pending xenstore watches
Roger Pau Monné [Wed, 25 Nov 2020 11:34:38 +0000 (12:34 +0100)]
xen: allow limiting the amount of duplicated pending xenstore watches

Xenstore watches received are queued in a list and processed in a
deferred thread. Such queuing was done without any checking, so a
guest could potentially trigger a resource starvation against the
FreeBSD kernel if such kernel is watching any user-controlled xenstore
path.

Allowing limiting the amount of pending events a watch can accumulate
to prevent a remote guest from triggering this resource starvation
issue.

For the PV device backends and frontends this limitation is only
applied to the other end /state node, which is limited to 1 pending
event, the rest of the watched paths can still have unlimited pending
watches because they are either local or controlled by a privileged
domain.

The xenstore user-space device gets special treatment as it's not
possible for the kernel to know whether the paths being watched by
user-space processes are controlled by a guest domain. For this reason
watches set by the xenstore user-space device are limited to 1000
pending events. Note this can be modified using the
max_pending_watch_events sysctl of the device.

This is XSA-349.

Sponsored by: Citrix Systems R&D
MFC after: 3 days

(cherry picked from commit 4e4e43dc9e1afc863670a031cc5cc75eb5e668d6)

3 years agoxen/xenstore: remove unused functions
Roger Pau Monné [Thu, 26 Nov 2020 08:57:47 +0000 (09:57 +0100)]
xen/xenstore: remove unused functions

Those helpers are not used, so remove them. No functional change.

Sponsored by: Citrix Systems R&D
MFC after: 3 days

(cherry picked from commit 2ae75536d370c238f77ad09e5e994d2b8bdf010c)

3 years agoarm64: fix early devmap assertion
Mitchell Horne [Wed, 13 Jan 2021 18:30:50 +0000 (14:30 -0400)]
arm64: fix early devmap assertion

PR: 25241
Reported by: gbe
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 818390ce0ca539300dd15d7a817784f1e3f7a9b8)

3 years agolibthr malloc: support recursion on thr_malloc_umtx.
Konstantin Belousov [Tue, 12 Jan 2021 09:02:37 +0000 (11:02 +0200)]
libthr malloc: support recursion on thr_malloc_umtx.

PR: 252579

(cherry picked from commit 85d028223bc2768651f4d44881644ceb5dc2a664)

3 years agolibthr: wrap pdfork(2), same as fork(2).
Konstantin Belousov [Sun, 10 Jan 2021 19:22:49 +0000 (21:22 +0200)]
libthr: wrap pdfork(2), same as fork(2).

(cherry picked from commit 21f749da82e755aafab127618affeffb86cff9a5)

3 years agosbin/camcontrol: use calloc/strlcpy where appropriate.
Xin LI [Mon, 4 Jan 2021 06:52:28 +0000 (22:52 -0800)]
sbin/camcontrol: use calloc/strlcpy where appropriate.

MFC after: 2 weeks

(cherry picked from commit fd340a122259d44a7d01a72890ff40411f87d79c)

3 years agore: netmap: enable/disable krings on interface reinit
Vincenzo Maffione [Sun, 10 Jan 2021 15:09:05 +0000 (15:09 +0000)]
re: netmap: enable/disable krings on interface reinit

This prevents krings from being used during an interface
reset, and notifies the active applications.
See also 1d238b07d5d4d9660ae0.

MFC after:      1 week

(cherry picked from commit 54bbcca4f9790e012e0a0f1512d9c879a48d5293)

3 years agonetmap: vtnet: stop krings during interface reset
Vincenzo Maffione [Sat, 9 Jan 2021 22:34:10 +0000 (22:34 +0000)]
netmap: vtnet: stop krings during interface reset

Similarly to what done for iflib in 1d238b07d5d4d9660ae0e,
this patch prevents access to the krings during the interface
reset triggered by netmap_register().

MFC after: 1 week

(cherry picked from commit 9ac59d42c0b4b6cd9c36a5dace7f49753c2e175a)

netmap: vtnet: enable/disable krings on any interface reinit

See 3d65fd97e85ab807f3b for a detailed explanation.

PR:             252453
MFC after:      1 week

(cherry picked from commit bb714db6d39583a9fbf5d11849c5e2365e7c0d80)

netmap: vtnet: fix RX initialization after netmap_reset()

At device reset, we must not publish those netmap receive buffers
that are owned by userspace (nm_kr_rxspace).

MFC after: 1 week

(cherry picked from commit 3005e10ddbfbec3ecf46a080607bb0d85986eee5)

3 years agonetmap: iflib: stop krings during interface reset
Vincenzo Maffione [Sat, 9 Jan 2021 20:54:11 +0000 (20:54 +0000)]
netmap: iflib: stop krings during interface reset

When different processes open separate subsets of the
available rings of a same netmap interface, a device
reset may be performed while one of the processes
is actively using some rings (e.g., caused by another
process executing a nmport_open()).
With this patch, such situation will cause the
active process to get a POLLERR, so that it can
have a chance to detect the situation.
We also guarantee that no process is running a txsync
or rxsync (ioctl or poll) while an iflib device reset
is in progress.

PR:     252453
MFC after:  1 week

(cherry picked from commit 1d238b07d5d4d9660ae0e08daede6da7e91c7853)

netmap: iflib: fix asserts in netmap_fl_refill()

When netmap_fl_refill() is called at initialization time (e.g.,
during netmap_iflib_register()), nic_i must be 0, since the
free list is reinitialized. At the end of the refill cycle, nic_i
must still be zero, because exactly N descriptors (N is the ring size)
are refilled.
This patch therefore fixes the assertions to check on nic_i rather
than on nm_i. The current netmap_reset() may in fact cause nm_i
to be != 0 while the device is resetting: this may happen when
multiple non-cooperating processes open different subsets of the
available netmap rings.

PR:     252518
MFC after:  1 week

(cherry picked from commit 3189ba61673af5bd3ed2ee9e33be92bc0b9995ba)

netmap: refactor netmap_reset

The netmap_reset() function is meant to be called by the driver
when they initialize (or re-initialize) a hardware ring.
However, since the introduction of support for opening (in
netmap mode) a subset of the available rings, netmap_reset()
may be called multiple times on actively used rings, causing
both kring and netmap ring to transition to an inconsistent
state.
This changes improves the situation by resetting all the
indices fields of the kring to 0, as expected after the
reinitialization of a hardware ring.

PR:     252518
MFC after:  1 week

(cherry picked from commit 7ba6ecf216fb15e8b147db268b91d9b82c5a0682)

netmap: iflib: enable/disable krings on any interface reinit

Since 1d238b07d5d4d9660ae0e0, krings are disabled before
a reinit cycle triggered by iflib_netmap_register.
However, this operation is actually necessary also for
any interface reinit triggered by other causes (i.e.,
ifconfig commands).
We achieve this goal by moving the krings enable/disable
operation inside iflib_stop() and iflib_init_locked().

Once here, this change also removes some redundant operations
from iflib_netmap_register(), that are already performed by
iflib_stop().

PR: 252453
MFC after: 1 week

(cherry picked from commit 3d65fd97e85ab807f3baa62aa979ae527914a3ea)

iflib: fix build failure in case DEV_NETMAP is not defined

This addresses the build failure introduced by
3d65fd97e85ab807f3baa62.

MFC with: 3d65fd97e85ab807f3baa62

(cherry picked from commit 8aa8484cbf06bb26ad87177fe4aebcaf1519f138)

netmap: restore hwofs and support it in iflib

Restore the hwofs functionality temporarily disabled by
7ba6ecf216fb15e8b147db2 to prevent issues with iflib.
This patch brings the necessary changes to iflib to
enable howfs to allow interface restarts without
disrupting netmap applications actively using its
rings.
After this change, it becomes possible for multiple
non-cooperating netmap applications to use non-overlapping
subsets of the available netmap rings without clashing
with each other.

PR: 252453
MFC after: 1 week

(cherry picked from commit 55f0ad5fdee1a779d6889481ba591a819081b9ca)

3 years agobectl(8): sync man page and help text
Robert Wing [Wed, 6 Jan 2021 19:38:25 +0000 (10:38 -0900)]
bectl(8): sync man page and help text

Sync man page with behavior of bectl(8).

Sync help text with man page.

PR:             246697
Reported by: olgeni
Submitted by:   olgeni (with changes)
Reviewed by:    kevans, olgeni
Approved by:    kevans (mentor)
Differential Revision: https://reviews.freebsd.org/D27482

(cherry picked from commit b1ea63e2e3c92d1346af067f5cf609e3e062f8b9)

3 years agotmpfs: make M_TMPFSMNT static to tmpfs_vfsops.c
Konstantin Belousov [Tue, 5 Jan 2021 18:52:42 +0000 (20:52 +0200)]
tmpfs: make M_TMPFSMNT static to tmpfs_vfsops.c

(cherry picked from commit 42bebbda9ed13d12d0454b676aa81f34b39e496f)

3 years agoissignal(): when handling STOP-like signals, drop sigacts mutex earlier.
Konstantin Belousov [Thu, 31 Dec 2020 01:45:12 +0000 (03:45 +0200)]
issignal(): when handling STOP-like signals, drop sigacts mutex earlier.

(cherry picked from commit e0d83cd3e49f0b9e16bc82ced7bd3b0ef9aa6a71)

3 years agotty_wait_background: improve locking.
Konstantin Belousov [Thu, 31 Dec 2020 13:45:06 +0000 (15:45 +0200)]
tty_wait_background: improve locking.

(cherry picked from commit a008bdeda3b8278fe600cf83ecf44acd1ccb30b6)

3 years agotmpfs_free_tmp(): explicitly assert that tmp is locked
Konstantin Belousov [Tue, 5 Jan 2021 18:53:45 +0000 (20:53 +0200)]
tmpfs_free_tmp(): explicitly assert that tmp is locked

(cherry picked from commit 9f200bc47b5d8445d91d51f6dfd6af0f1fbbe354)

3 years agotmpfs_reclaim: style
Konstantin Belousov [Wed, 13 Jan 2021 06:55:38 +0000 (08:55 +0200)]
tmpfs_reclaim: style

(cherry picked from commit 685265ecfbd8e929d7c6988a99b708d3a3a5cbf4)

3 years agolibc: implement rtld_get_stack_prot() for real
Konstantin Belousov [Sun, 10 Jan 2021 03:05:42 +0000 (05:05 +0200)]
libc: implement rtld_get_stack_prot() for real

(cherry picked from commit 81b3a0a34145ee6c855f50c8035728f76d63c3f0)

3 years agox86: Add rdtscp32() into cpufunc.h.
Konstantin Belousov [Sat, 9 Jan 2021 20:39:19 +0000 (22:39 +0200)]
x86: Add rdtscp32() into cpufunc.h.

(cherry picked from commit 45974de8fb23710873417f1d2ca513761da6cacc)

3 years agox86 budma_bounce: style.
Konstantin Belousov [Mon, 11 Jan 2021 23:42:04 +0000 (01:42 +0200)]
x86 budma_bounce: style.

(cherry picked from commit 895ad33784e00fc9d601fd51f0571e0e02d9d146)

3 years agotcgetwinsize(3): provide man page
Konstantin Belousov [Fri, 1 Jan 2021 22:28:42 +0000 (00:28 +0200)]
tcgetwinsize(3): provide man page

(cherry picked from commit 4e0c81c5fafb5b72cabc342f640aff6cac445853)

3 years agoAdd tcgetwinsize(3) and tcsetwinsize(3) to termios
Konstantin Belousov [Thu, 24 Dec 2020 23:05:31 +0000 (01:05 +0200)]
Add tcgetwinsize(3) and tcsetwinsize(3) to termios

(cherry picked from commit 7d7fad7bd969fb464f64d34932234060cee112af)

3 years agonetmap: pkt-gen: fix offset hex formatting
Vincenzo Maffione [Tue, 12 Jan 2021 22:02:28 +0000 (22:02 +0000)]
netmap: pkt-gen: fix offset hex formatting

PR: 252594
Reported by: brpoole@vt.edu
MFC after: 3 days

3 years agocmp: fix -s (silent) when used with skip offsets
Ed Maste [Mon, 11 Jan 2021 00:02:56 +0000 (19:02 -0500)]
cmp: fix -s (silent) when used with skip offsets

-s causes cmp to print nothing for differing files, for use when only
the exit status is of interest.

-z compares the file size first, for regular files, and fails the
comparison early if they do not match.

Prior to this change -s implied -z as an optimization, but this is not
valid when file offsets are specified.  Now, enable the -z optimization
for -s only if both skip arguments are not provided / 0.

Note that using -z with differing skip values will currently always
fail.  We may want to compare size1 - skip1 with size2 - skip2 instaead,
and in any case the man page should be clarified.

PR: 252542
Fixes: 3e6902efc802ab57fc4e9bf798f2d271b152e7f9
Reported by: William Ahern
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28071

(cherry picked from commit 80445b7a3f738e0b0a33ee7a11905a275346a6de)

3 years agocmp: use C99 bool for flags
Ed Maste [Mon, 11 Jan 2021 00:02:55 +0000 (19:02 -0500)]
cmp: use C99 bool for flags

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28072

(cherry picked from commit 1f7661742de650bcb6b9124ee3da7e94c8650c4b)

3 years agodiff: honour flags with -q
Ed Maste [Sat, 9 Jan 2021 16:22:28 +0000 (11:22 -0500)]
diff: honour flags with -q

Previously -q (just print a line when files differ) ignored flags like
-w (ignore whitespace).  Avoid the D_BRIEF short-circuit when flags are
in effect.

PR: 252515
Reported by: Scott Aitken
Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28064

(cherry picked from commit 12a8d3027d414abd15798de1b6d8b01151bdac50)

3 years agolibc: fix undefined behavior from signed overflow in strstr and memmem
Ed Maste [Thu, 19 Nov 2020 00:03:15 +0000 (00:03 +0000)]
libc: fix undefined behavior from signed overflow in strstr and memmem

unsigned char promotes to int, which can overflow when shifted left by
24 bits or more. this has been reported multiple times but then
forgotten. it's expected to be benign UB, but can trap when built with
explicit overflow catching (ubsan or similar). fix it now.

note that promotion to uint32_t is safe and portable even outside of
the assumptions usually made in musl, since either uint32_t has rank
at least unsigned int, so that no further default promotions happen,
or int is wide enough that the shift can't overflow. this is a
desirable property to have in case someone wants to reuse the code
elsewhere.

musl commit: 593caa456309714402ca4cb77c3770f4c24da9da

Obtained from: musl

(cherry picked from commit 33482dae89c26158a22ccb3b7f2ca6e6652f29b4)

3 years agolibc: optimize memmem two-way bad character shift
Ed Maste [Thu, 19 Nov 2020 00:02:12 +0000 (00:02 +0000)]
libc: optimize memmem two-way bad character shift

first, the condition (mem && k < p) is redundant, because mem being
nonzero implies the needle is periodic with period exactly p, in which
case any byte that appears in the needle must appear in the last p
bytes of the needle, bounding the shift (k) by p.

second, the whole point of replacing the shift k by mem (=l-p) is to
prevent shifting by less than mem when discarding the memory on shift,
in which case linear time could not be guaranteed. but as written, the
check also replaced shifts greater than mem by mem, reducing the
benefit of the shift. there is no possible benefit to this reduction of
the shift; since mem is being cleared, the full shift is valid and
more optimal. so only replace the shift by mem when it would be less
than mem.

musl commits:
8f5a820d147da36bcdbddd201b35d293699dacd8
122d67f846cb0be2c9e1c3880db9eb9545bbe38c

Obtained from: musl

(cherry picked from commit 7dbcd06e63101d51e6a777f7315cfde794411e53)

3 years agoclang-format libc string functions imported from musl
Ed Maste [Wed, 18 Nov 2020 22:01:34 +0000 (22:01 +0000)]
clang-format libc string functions imported from musl

We have adopted these and don't consider them 'contrib' code, so bring
them closer to style(9).  This is a followon to r315467 and r351700.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4874ddfd373c582d9cd7fe915d2259295d75d1e5)

3 years agolinuxkpi: handle ARI
Konstantin Belousov [Mon, 4 Jan 2021 21:41:12 +0000 (23:41 +0200)]
linuxkpi: handle ARI

(cherry picked from commit de27805fee0bbe3b714615b1df4cf0b8ebbc39b9)

3 years agopfctl: Call ifa_load() before ifa_grouplookup()
Kristof Provost [Sun, 19 Apr 2020 15:37:13 +0000 (15:37 +0000)]
pfctl: Call ifa_load() before ifa_grouplookup()

ifa_grouplookup() uses the data loaded in ifa_load() (through is_a_group()), so
we must call ifa_load() before we can rely on any of the data it populates.

Submitted by: Nick Rogers
MFC after: 1 week
Sponsored by: RG Nets

(cherry picked from commit 8fd675d8a0538544a85483f7a9bed2bd48382926)

3 years agopfctl: Another set skip <group> fix
Kristof Provost [Mon, 11 Jan 2021 13:09:08 +0000 (14:09 +0100)]
pfctl: Another set skip <group> fix

When retrieving the list of group members we cannot simply use
ifa_lookup(), because it expects the interface to have an IP (v4 or v6)
address. This means that interfaces with no address are not found.
This presents as interfacing being alternately marked as skip and not
whenever the rules are re-loaded.

Happily we only need to fix ifa_grouplookup(). Teach it to also accept
AF_LINK (i.e. interface) node_hosts.

PR:      250994
MFC after: 3 days

(cherry picked from commit 0c156a3c32cd0d9168570da5686ddc96abcbbc5a)

3 years agotsc: use u_int for return type for prototype, same as in definitions.
Konstantin Belousov [Tue, 5 Jan 2021 20:44:10 +0000 (22:44 +0200)]
tsc: use u_int for return type for prototype, same as in definitions.

(cherry picked from commit 826fc3cc3d59c1d0af4caf3a08888e168bfe22b2)

3 years agox86 identcpu.c: fix formatting of the comment.
Konstantin Belousov [Wed, 6 Jan 2021 14:52:27 +0000 (16:52 +0200)]
x86 identcpu.c: fix formatting of the comment.

(cherry picked from commit aa9450e44b5f017bb132ab5a00df68c9d7aa1d94)

3 years agoStyle. Improve some KASSERTs messages.
Konstantin Belousov [Thu, 31 Dec 2020 00:45:47 +0000 (02:45 +0200)]
Style.  Improve some KASSERTs messages.

(cherry picked from commit 993a1699b1948d30c4903440e8d8b23a7d5fc6c5)

3 years agoMFC ea0efc370416:
Hans Petter Selasky [Thu, 7 Jan 2021 14:34:26 +0000 (15:34 +0100)]
MFC ea0efc370416:
Add support for PL2303HXN to uplcom(4).

Code changes in this commit were obtained from straight from OpenBSD's
uplcom.c with almost no modification, the list of chip names and USB
IDs was obtained from Linux.

Differential Revision: https://reviews.freebsd.org/D27952
Submitted by: tomli_tomli.me (Yifeng Li)
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC c834f30a0c16:
Hans Petter Selasky [Thu, 7 Jan 2021 14:27:24 +0000 (15:27 +0100)]
MFC c834f30a0c16:
Add new PCI ID for XHCI(4).

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC 9e7fa1e66c1e:
Hans Petter Selasky [Mon, 12 Oct 2020 08:18:48 +0000 (10:18 +0200)]
MFC 9e7fa1e66c1e:
Collect statistics from all rate-limit queues in mlx5en(4).

Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC aca12148b113:
Hans Petter Selasky [Wed, 9 Dec 2020 12:59:01 +0000 (13:59 +0100)]
MFC aca12148b113:
Improve error message printing in krping.
Don't print completion queue flush as an error.

Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC 1622a498525b:
Hans Petter Selasky [Wed, 23 Dec 2020 10:54:42 +0000 (11:54 +0100)]
MFC 1622a498525b:
No need to stop XHCI endpoints in disabled state.

Some AMD XHCI implementations apparently assert a permanent
internal failure if this happens.

Submitted by: ali.abdallah@suse.com
PR: 251503
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC ddce63fcb6d0:
Hans Petter Selasky [Wed, 23 Dec 2020 10:37:44 +0000 (11:37 +0100)]
MFC ddce63fcb6d0:
Remove not needed variable initialization.
And switch from int to bool while at it.

Reviewed by: melifaro@
Differential Revision: https://reviews.freebsd.org/D27725
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC 19ecb5e8dabe:
Hans Petter Selasky [Tue, 29 Dec 2020 16:34:01 +0000 (17:34 +0100)]
MFC 19ecb5e8dabe:
Fix for IPoIB over lagg(4).

Need to update both link layer address and broadcast address when active link changes for IP over infiniband.
This is because the broadcast address contains the so-called P-key, which is interface dependent.

Reviewed by: kib @
Differential Revision: https://reviews.freebsd.org/D27658
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC ec52ff6d1411 and 747feea146d8:
Hans Petter Selasky [Tue, 29 Dec 2020 17:01:57 +0000 (18:01 +0100)]
MFC ec52ff6d1411 and 747feea146d8:
Streamline the infiniband code according to the ethernet code.

Specifically implement the if_requestencap callback function for infiniband.
Most of the changes are simply a cut and paste of the equivalent ethernet part.

Reviewed by: melifaro @
Differential Revision: https://reviews.freebsd.org/D27631
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoFix newvers.sh to no longer print an outdated SVN rev
Ulrich Spörlein [Wed, 23 Dec 2020 21:29:34 +0000 (22:29 +0100)]
Fix newvers.sh to no longer print an outdated SVN rev

We have stopped using SVN, so the notes containing the old SVN revisions
are no longer populated, so fall back to purely counting the number of
commits (currently at about 255337).

Also turn the format more into what git-describe produces, with a name
first, then the number of commits and the hash last. Note that as we
don't tag anything on `main`, git describe will never produce something
useful there and finds the newest vendor tag that was merged in instead.

Sample output:
FreeBSD 13.0-CURRENT #6 main-c255126-gb81783dc98e6-dirty
FreeBSD 12.2-STABLE #0 stable/12-c243035-gd16dac42b641-dirty

MFC after: 3 weeks
Reviewed by: imp, glebius
Differential Revision: https://reviews.freebsd.org/D27751

(cherry picked from commit 8d405efd73d3991fe1647f91a2b7c9989dd5f18f)

3 years agonewvers: append commit count to uname version string
Ed Maste [Thu, 1 Aug 2019 14:13:04 +0000 (14:13 +0000)]
newvers: append commit count to uname version string

In a git world this provides a facsimile of a monotonically increasing
version number.  This might be refined further, but this provides a
starting point for investigation.

Reviewed by: cem
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20462

The "Relnotes" flag in the commit message is removed in cherry-pick as
git repo doesn't affect the stable/11 and stable/12 release.

(cherry picked from commit ecb2bbc081ae906956f4718ec946b9e4fcea241f)

3 years agoFix devinfo typo.
Alexander Motin [Tue, 5 Jan 2021 19:56:23 +0000 (14:56 -0500)]
Fix devinfo typo.

Submitted by: Nick Wolff <darkfiberiru@gmail.com>
Differential Revision: https://reviews.freebsd.org/D27981

(cherry picked from commit 4d86ab429ee9b4b22654b52380512f7b8cee4478)

3 years agogeom(8): list geoms with /dev/ prefix
Robert Wing [Sat, 12 Dec 2020 07:22:38 +0000 (07:22 +0000)]
geom(8): list geoms with /dev/ prefix

Allow geom(8) to list geoms with the '/dev/' prefix.

`geom part show` accepts the '/dev/' prefix but `geom part list` does not.

Modify find_geom() in sbin/geom/core/geom.c to be consistent with the behavior
of find_geom() in lib/geom/part/geom_part.c.

PR:             188213
Reported by:    Ronald F. Guilmette <rfg@tristatelogic.com>
Reviewed by:    imp, kevans
Approved by:    kevans (mentor)
Differential Revision:  https://reviews.freebsd.org/D27556

(cherry picked from commit f200cc255f8e90b1905d94d0506a22f5dcd467c0)

3 years agompr, mps: Fix a stack buffer overflow in the user passthru ioctl
Mark Johnston [Fri, 8 Jan 2021 18:32:04 +0000 (13:32 -0500)]
mpr, mps: Fix a stack buffer overflow in the user passthru ioctl

Previously we copied in the request into a stack-allocated structure
that could be smaller than the request size.  Furthermore, we checked
the request size only after doing the copyin.

Fix this by allocating a buffer to hold the request, then copying the
buffer's contents into a command descriptor.  This is a bit heavy-handed
but I expect the overhead will not be noticeable.  The approach of
coping the header in first is susceptible to TOCTOU problems.

Reviewed by: imp
Reported by: maxpl0it@protonmail.com
Differential Revision: https://reviews.freebsd.org/D27963

(cherry picked from commit de828a91db29fb20440e0d92f3d3136b314a9584)

3 years agompr, mps: Fix an off-by-one bug in the BTDH_MAPPING ioctl
Mark Johnston [Fri, 8 Jan 2021 18:32:05 +0000 (13:32 -0500)]
mpr, mps: Fix an off-by-one bug in the BTDH_MAPPING ioctl

The device mapping table contains sc->max_devices entries, so only
indices in [0, sc->max_devices) are valid.

Differential Revision: https://reviews.freebsd.org/D27964

(cherry picked from commit adc0dcc352bb9f5a67a054d95c6959ea5aa26d91)

3 years agosafexcel: Fix a race around unblocking of crypto ops
Mark Johnston [Fri, 8 Jan 2021 18:32:04 +0000 (13:32 -0500)]
safexcel: Fix a race around unblocking of crypto ops

safexcel_ring_intr() could fail to observed that sc_blocked is set after
completing all outstanding ops for a ring, in which case blocked ops
would be deferred forever.

Request structures are managed by individual rings, so move the
"blocked" flag into the per-ring state block and use the ring lock to
synchronize with safexcel_process().  Remove sc_mtx since it is now
unused.

(cherry picked from commit 092cf8d63f9fb9153c677f5793135926edc101d7)

3 years agosafexcel: Stop using a stack buffer for the ring lock name
Mark Johnston [Fri, 8 Jan 2021 18:32:04 +0000 (13:32 -0500)]
safexcel: Stop using a stack buffer for the ring lock name

mtx_init() does not make a copy of the name so the buffer must be valid
for the lifetime of the driver instance.  Store each ring's lock's name
in the ring structure.

(cherry picked from commit 8ba6acbbe6995efcd12c375e1826d55e35a8bdc9)

3 years agoigmp: Avoid leaking mbuf when source validation fails
Mark Johnston [Fri, 8 Jan 2021 18:32:04 +0000 (13:32 -0500)]
igmp: Avoid leaking mbuf when source validation fails

PR: 252504
Submitted by: Panagiotis Tsolakos <panagiotis.tsolakos@gmail.com>

(cherry picked from commit 501159696cb5204d94d03393e4bc5d82f2e348e6)

3 years agocontrib/libarchive: Import libarchive 3.5.1
Martin Matuska [Sun, 27 Dec 2020 23:34:06 +0000 (00:34 +0100)]
contrib/libarchive: Import libarchive 3.5.1

(cherry picked from commit 69a18c5826c9633a6d77e18f9f34e02c83d22717)

3 years agobsdcat,cpio,tar: derive version string from archive.h
Xin LI [Tue, 29 Dec 2020 21:38:47 +0000 (13:38 -0800)]
bsdcat,cpio,tar: derive version string from archive.h

(cherry picked from commit 2ff66a915526b6509ca57f2046bc7b20b0de8a61)

3 years agofortune(6): Add EXIT STATUS and HISTORY sections
Gordon Bergling [Sun, 3 Jan 2021 22:50:18 +0000 (23:50 +0100)]
fortune(6): Add EXIT STATUS and HISTORY sections

Obtained from: OpenBSD
Differential Revision: https://reviews.freebsd.org/D27941

(cherry picked from commit c949ba1d202c6e939e71f1cb555958b8de3dd048)

3 years agonetmap: bridge: fix NS_MOREFRAG support
Vincenzo Maffione [Thu, 7 Jan 2021 07:00:43 +0000 (07:00 +0000)]
netmap: bridge: fix NS_MOREFRAG support

Support for NS_MOREFRAG is broken, as NS_MOREFRAG is copied from
the TX slot to the RX slot rather than the other way around.
Also, the NS_MOREFRAG must be copied also in case of packet
copy (no zerocopy).

Reported by: rajesh1.kumar_amd.com
Differential Revision: https://reviews.freebsd.org/D27980

(cherry picked from commit 163f4f15733f82584a967538cf2340bf1b6a245f)

3 years agosyscons: scrnmaps: appease -Wmissing-variable-declarations
Kyle Evans [Fri, 1 Jan 2021 17:53:47 +0000 (11:53 -0600)]
syscons: scrnmaps: appease -Wmissing-variable-declarations

scrmap is only used in the one compilation unit in all cases, make it static
rather than extern'ing it. There's little benefit, but it's easy to do.

It's unclear how this hasn't failed many builds before now, since it should
have cropped up sometime around deeper hierarchies getting a default WARNS.

(cherry picked from commit fb6bc290fb342864f5362ab9cef7dd214df05cf3)

3 years agokern: efirt: correct configuration table entry size
Kyle Evans [Sun, 27 Dec 2020 17:26:45 +0000 (11:26 -0600)]
kern: efirt: correct configuration table entry size

Each entry actually stores a native pointer, not a uint64_t quantity. While
we're here, go ahead and export the pointer as-is rather than converting it
to KVA. This may be more useful as consumers can map /dev/mem and observe
the entry.

For reference, see: sys/contrib/edk2/Include/Uefi/UefiSpec.h

(cherry picked from commit ee938b20335d26ca652deac4a1a063e90cafa303)

3 years agokern: efirt: enter runtime environment to deref efi_cfgtbl
Kyle Evans [Sun, 27 Dec 2020 17:28:32 +0000 (11:28 -0600)]
kern: efirt: enter runtime environment to deref efi_cfgtbl

This fixes an insta-panic when EFIIOC_GET_TABLE is used.

(cherry picked from commit 0861c7d3e048556841fa5085173660dceadc5646)

3 years agonfs server: improve use of the VFS KPI
Konstantin Belousov [Fri, 1 Jan 2021 15:35:44 +0000 (17:35 +0200)]
nfs server: improve use of the VFS KPI

(cherry picked from commit 51a9b978e75021415fdced616b4e4bc373a20a8a)

3 years agodump(8): clarify the recommended use of cache and snapshots
Guangyuan Yang [Mon, 28 Dec 2020 21:54:36 +0000 (21:54 +0000)]
dump(8): clarify the recommended use of cache and snapshots

PR: 131626
Submitted by: Andrew Hamilton-Wright <andrew@qemg.org>
Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D27775

(cherry picked from commit 70a2e109bd486f97e6fa5f969be9d90e404de016)

3 years agortld: call close(2) after errno is saved
Konstantin Belousov [Fri, 1 Jan 2021 22:24:46 +0000 (00:24 +0200)]
rtld: call close(2) after errno is saved

(cherry picked from commit 741d78126b5584e860811c78f87f51597e375592)

3 years agoMFC llvm fixes for building ceph on powerpc
Dimitry Andric [Fri, 8 Jan 2021 16:35:18 +0000 (17:35 +0100)]
MFC llvm fixes for building ceph on powerpc

Merge commit 8f5e3c74b from llvm git (by Teresa Johnson):

  [PowerPC] Fix compile time issue in recursive CTR analysis code

  Summary:
  Avoid re-examining operands on recursive walk looking for CTR.
  This was causing huge compile time after some earlier optimization
  created a large expression.

  The start of the expression (created by IndVarSimplify) looked like:

  %469 = lshr i64 trunc (i128 xor (i128 udiv (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011), i128 64), i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011)) to i64), i64 45) to i128), i128 8192506886679785011), i128 64), i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011), i128 64), i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011)) to i64), i64 45) to i128), ...

  with the _ZN4absl13hash_internal13CityHashState5kSeedE referenced many times.

  Reviewers: hfinkel

  Subscribers: nemanjai, hiraditya, kbarton, jsji, shchenz, llvm-commits

  Tags: #llvm

  Differential Revision: https://reviews.llvm.org/D75790

Merge commit 4f568fbd2 from llvm git (by Nemanja Ivanovic):

  [PowerPC] Do not emit HW loop when TLS var accessed in PHI of loop exit

  If any PHI nodes in loop exit blocks have incoming values from the
  loop that are accesses of TLS variables with local dynamic or general
  dynamic TLS model, the address will be computed inside the loop. Since
  this includes a call to __tls_get_addr, this will in turn cause the
  CTR loops verifier to complain.
  Disable CTR loops in such cases.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=48527
This should fix building ceph 12.2.12 on powerpc64, powerpc, powerpcspe
and powerpc64le.

Requested by: pkubaj

(cherry picked from commit 543478be758fdfbf050eca5b58b7c74ba51b9175)

3 years agoo In iflib_txq_drain():
Marius Strobl [Wed, 26 Jun 2019 15:28:21 +0000 (15:28 +0000)]
o In iflib_txq_drain():
  - Remove desc_used, which is only ever written to.
  - Remove a dead store to reclaimed.
  - Don't recycle avail.
  - Sort variables according to style(9).
  These changes will make a subsequent commit easier to read.
o In iflib_tx_credits_update(), don't bother checking whether the
  ift_txd_credits_update method pointer is NULL; _iflib_pre_assert()
  asserts upfront that this method has been assigned and functions
  like iflib_{fast_intr_rxtx,netmap_timer_adjust,txq_can_drain}()
  and _task_fn_tx() were already unconditionally relying on the
  method being callable.

(cherry picked from commit c2c5d1e7874dd2928bc5e85912e59541741f74a3)

3 years agoV_ip6_forwarding and V_ipforwarding have been defined in ip6_var.h /
Marko Zec [Wed, 19 Jun 2019 08:49:24 +0000 (08:49 +0000)]
V_ip6_forwarding and V_ipforwarding have been defined in ip6_var.h /
ip_var.h since at least 2008, so make use of those definitions here.

(cherry picked from commit 188adcb7e471a228398a6d879c65ca5e65333c1c)

3 years agoEvaluating htons() at compile time is more efficient than doing ntohs()
Marko Zec [Wed, 19 Jun 2019 08:39:19 +0000 (08:39 +0000)]
Evaluating htons() at compile time is more efficient than doing ntohs()
at runtime.  This change removes a dependency on a barrel shifter pass
before branch resolution, while reducing the instruction stream size
by 9 bytes on amd64.

(cherry picked from commit 6aee0bfa85685017dbc5050ce36793f7dcd80f82)

3 years agoEnsure that dirent's d_off field is initialized
Mark Johnston [Sun, 3 Jan 2021 16:32:30 +0000 (11:32 -0500)]
Ensure that dirent's d_off field is initialized

We have the d_off field in struct dirent for providing the seek offset
of the next directory entry.  Several filesystems were not initializing
the field, which ends up being copied out to userland.

Reported by: Syed Faraz Abrar <faraz@elttam.com>
Reviewed by: kib

(cherry picked from commit 90f580b954090e669da234f6c8e8d0379ff9d8bc)

3 years agomsdosfs: Fix a leak of dirent padding bytes
Mark Johnston [Sun, 27 Dec 2020 21:52:30 +0000 (16:52 -0500)]
msdosfs: Fix a leak of dirent padding bytes

This was missed in r340856 / commit
6d2e2df764199f0a15fd743e79599391959cc17d.  Three bytes from the kernel
stack may be leaked when reading directory entries.

Reported by: Syed Faraz Abrar <faraz@elttam.com>

(cherry picked from commit 599f90446376370eb365a0fde857ea2b5766873a)

3 years agoqatfw: Fix firmware autoloading for qat_c2xxx devices
Mark Johnston [Wed, 23 Dec 2020 16:31:47 +0000 (11:31 -0500)]
qatfw: Fix firmware autoloading for qat_c2xxx devices

r368193 was suppsed to rename the MOF firmware image, but the
qat_c2xxxfw makefile defined the two images in the wrong order so the
MMP image was renamed instead.

(cherry picked from commit 3b216bfb6cce24aa84519315138be8d23ac5d613)