Alex Richardson [Fri, 2 Jul 2021 08:21:04 +0000 (09:21 +0100)]
Simplify and speed up the kyua build
Instead of having multiple kyua libraries, just include the files as part
of usr.bin/kyua. Previously, we would build each kyua source up to four
times: once as a .o file and once as a .pieo. Additionally, the kyua
libraries might be built again for compat32. As all the kyua libraries
amount to 102 C++ sources the build time is significant (especially when
using an assertions enabled compiler). This change ensures that we build
306 fewer .cpp source files as part of buildworld.
Reviewed By: brooks
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30967
Edward Tomasz Napierala [Fri, 2 Jul 2021 07:49:20 +0000 (08:49 +0100)]
proccontrol(1): implement 'nonewprivs'
This adds the 'nonewprivs' mode, corresponding to newly added
procctl(2) commands PROC_NO_NEW_PRIVS_CTL and PROC_NO_NEW_PRIVS_STATUS.
Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30940
Ganbold Tsagaankhuu [Fri, 2 Jul 2021 07:20:25 +0000 (15:20 +0800)]
dtb: rockchip: Add NanoPI-R4S and RockPI E to the build
Stefan Eßer [Fri, 2 Jul 2021 06:38:42 +0000 (08:38 +0200)]
netstat: Fix typo
Correct spelling of "received packers" to "received packets".
PR: 256926
Reported by: ghuckriede@blackberry.com
MFC after: 3 days
Peter Holm [Fri, 2 Jul 2021 05:24:38 +0000 (07:24 +0200)]
stress2: Added a test scenario from Bug 227041
Peter Holm [Fri, 2 Jul 2021 05:23:05 +0000 (07:23 +0200)]
stress2: Update the list of test not to run
Peter Holm [Fri, 2 Jul 2021 05:22:18 +0000 (07:22 +0200)]
stress2: Improve cleanup code
Ceri Davies [Thu, 1 Jul 2021 21:51:37 +0000 (22:51 +0100)]
rc.conf.5: -Tlint fixes.
Ceri Davies [Thu, 1 Jul 2021 21:35:14 +0000 (22:35 +0100)]
rc.conf.5: add .Xr to firewall(7), growfs(7), and tuning(7)
Ceri Davies [Thu, 1 Jul 2021 21:10:34 +0000 (22:10 +0100)]
cd(9): correct minor typo in manpage.
Mateusz Guzik [Thu, 1 Jul 2021 19:25:43 +0000 (21:25 +0200)]
pfctl: cache getprotobynumber results
As for example pfctl -ss keeps calling it, it saves a lot of overhead
from elided parsing of /etc/nsswitch.conf and /etc/protocols.
Sample result when running a pre-nvlist binary with nfs root and dumping
7 mln states:
before: 24.817u 62.993s 1:28.52 99.1%
after: 8.064u 1.117s 0:18.87 48.5%
Idea by Jim Thompson
Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Alexander Motin [Thu, 1 Jul 2021 19:28:55 +0000 (15:28 -0400)]
mrsas(4): Report more correct maximum I/O size.
Subtract one SGE for the case of misaligned address. Also take into
account maximum number of sectors reported by firmware, that gives
nicer 256KB limit instead of 276KB calculated from the SGE limit.
While there, remove number of I/O size checks, duplicating what is
already checked by CAM and busdma(9).
MFC after: 1 month
Sponsored by: iXsystems, Inc.
Kristof Provost [Thu, 1 Jul 2021 15:15:36 +0000 (17:15 +0200)]
pf tests: ftp-proxy test
Basic test case for ftp-proxy
PR: 256917
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Kristof Provost [Thu, 1 Jul 2021 15:16:10 +0000 (17:16 +0200)]
ftp-proxy: Revert incorrect migration to libpfctl
libpfctl supports creating rules, but not (yet) adding addresses to a
pool. Adding addresses certainly does not work through adding a rule.
PR: 256917
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Kristof Provost [Thu, 1 Jul 2021 07:42:34 +0000 (09:42 +0200)]
dummynet: fix sysctls
The sysctl nodes which use V_dn_cfg must be marked as CTLFLAG_VNET so
that we use the correct per-vnet offset
PR: 256819
Reviewed by: donner
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30974
Kornel Duleba [Thu, 1 Jul 2021 18:27:41 +0000 (20:27 +0200)]
ofw_pci: fix probing for non-DT cases
phandle_t is a uint32_t type, <= 0 comparison doesn't work with it as intended.
This caused the ofw_pci code to attach to PCI bus on ACPI based systems.
Since
3eae4e106ac7 ("Fix error value returned by ofw_bus_gen_get_node().")
ofw subsystem can only return -1 for invalid nodes. Use that.
MFC after: 4 weeks
Reviewed by: mw
Differential revision: https://reviews.freebsd.org/D30953
Kornel Duleba [Thu, 1 Jul 2021 18:21:17 +0000 (20:21 +0200)]
dts: fsl-ls1028a: Correct ECAM PCIE window ranges
Currently all PCIE windows point to bus address 0x0, which does not match
the values obtained from hardware during EA.
Replace those values with CPU addresses, since in reality we
have a 1:1 mapping between the two.
This patch is queued for Linux v5.14 in linux-next tree:
6bee93d93111 "arm64: dts: fsl-ls1028a: Correct ECAM PCIE window ranges"
Ferhat Gecdogan [Thu, 1 Jul 2021 18:09:46 +0000 (20:09 +0200)]
tegra_pcie: use switch instead of if in tegra_pcib_pex_ctrl
Simplify obtaining per-port data in tegra_pcib_pex_ctrl() routine.
Reviewed by: imp, mw
Pull Request: https://github.com/freebsd/freebsd-src/pull/481
Emmanuel Vadot [Thu, 1 Jul 2021 16:48:44 +0000 (18:48 +0200)]
dts: Bump the freebsd branding version to 5.13
Sponsored by: Diablotin Systems
Emmanuel Vadot [Thu, 1 Jul 2021 16:41:05 +0000 (18:41 +0200)]
arm64: allwinner: Add r_intc driver
The r intc interrupt controller seems to do a lot of things :
- It can handle the NMI interrupt
- It have local interrupts for some device that also can be muxed with GIC
- It can serve as an forwarder for the GIC
It's mostly used for deepsleep/wakeup if I understood correctly and we do not
support this on arm64.
For now just forward everything to the GIC so interrupts works again for device
which now have this interrupts controller set since dts v5.12
Sponsored by: Diablotin Systems
Ceri Davies [Thu, 1 Jul 2021 15:04:33 +0000 (16:04 +0100)]
build.7: remove documentation of "make update"
update target was removed in
e290182bcf3895ca659dff111bca6a077c4708b1
Emmanuel Vadot [Thu, 1 Jul 2021 15:50:54 +0000 (17:50 +0200)]
Import device-tree files from Linux 5.13
Sponsored by: Diablotin Systems
Emmanuel Vadot [Thu, 1 Jul 2021 15:50:17 +0000 (17:50 +0200)]
Import device-tree files from Linux 5.13
Emmanuel Vadot [Thu, 1 Jul 2021 15:41:47 +0000 (17:41 +0200)]
Import device-tree files from Linux 5.12
Sponsored by: Diablotin Systems
Emmanuel Vadot [Thu, 1 Jul 2021 15:39:42 +0000 (17:39 +0200)]
Import device-tree files from Linux 5.12
Warner Losh [Thu, 1 Jul 2021 15:32:40 +0000 (09:32 -0600)]
hz.9: update stathz for current usage
Update the stathz description to reflect reality. profhz is the only
thing we should deprecate. Add some implementation notes that describe
the optimizations made to date.
Discusssed with: emaste
Reviewed by: kib (prior), jhb (prior), gbe
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30815
Emmanuel Vadot [Thu, 1 Jul 2021 15:20:05 +0000 (17:20 +0200)]
Import device-tree files from Linux 5.11
Sponsored by: Diablotin Systems
Andrew Turner [Thu, 1 Jul 2021 00:45:39 +0000 (00:45 +0000)]
Switch the order of the ID_AA64PFR1_EL1 fields
This makes them consistent with the fields in other registers.
Sponsored by: The FreeBSD Foundation
Ceri Davies [Thu, 1 Jul 2021 13:00:06 +0000 (14:00 +0100)]
fortune: correct documentation of default FORTUNE_PATH.
While here, fix a typo in a comment relating to FORTUNE_PATH
Edward Tomasz Napierala [Thu, 1 Jul 2021 08:11:11 +0000 (09:11 +0100)]
procctl(2): add PROC_NO_NEW_PRIVS_CTL, PROC_NO_NEW_PRIVS_STATUS
This introduces a new, per-process flag, "NO_NEW_PRIVS", which
is inherited, preserved on exec, and cannot be cleared. The flag,
when set, makes subsequent execs ignore any SUID and SGID bits,
instead executing those binaries as if they not set.
The main purpose of the flag is implementation of Linux
PROC_SET_NO_NEW_PRIVS prctl(2), and possibly also unpriviledged
chroot.
Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30939
Edward Tomasz Napierala [Thu, 1 Jul 2021 08:28:01 +0000 (08:28 +0000)]
linux(4): revert arm64 part of
447636e43c0
The arm64 part of the patch was incomplete and prevented
linux64.ko from loading due to missing symbol.
Sponsored By: EPSRC
Rick Macklem [Wed, 30 Jun 2021 22:15:41 +0000 (15:15 -0700)]
nfscl: Improve "Consider increasing kern.ipc.maxsockbuf" message
When the setting of kern.ipc.maxsockbuf is less than what is
desired for I/O based on vfs.maxbcachebuf and vfs.nfs.bufpackets,
a console message of "Consider increasing kern.ipc.maxsockbuf".
is printed.
This patch modifies the message to provide a suggested value
for kern.ipc.maxsockbuf.
Note that the setting is only needed when the NFS rsize/wsize
is set to vfs.maxbcachebuf.
While here, make nfs_bufpackets global, so that it can be used
by a future patch that adds a sysctl to set the NFS server's
maximum I/O size. Also, remove "sizeof(u_int32_t)" from the maximum
packet length, since NFS_MAXXDR is already an "overestimate"
of the actual length.
MFC after: 2 weeks
Edward Tomasz Napierala [Wed, 30 Jun 2021 16:45:21 +0000 (17:45 +0100)]
linux(4): implement coredump support
Implement dumping core for Linux binaries on amd64, for both
32- and 64-bit executables. Some bits are still missing.
This is based on a prototype by chuck@.
Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30019
Greg V [Wed, 30 Jun 2021 21:15:21 +0000 (18:15 -0300)]
libpmc: Import AMD Zen 3 PMU events
Reviewed by: mav, mhorne
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30965
Mitchell Horne [Wed, 19 May 2021 16:29:59 +0000 (13:29 -0300)]
hwpmc_arm64: add a PMCDBG to the interrupt handler
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Olivier Houchard [Wed, 30 Jun 2021 20:56:50 +0000 (22:56 +0200)]
arm: Make sure we can handle a thumb entry point.
Similarly to what's been done on arm64 with commit
712c060c94fd447c91b0e6218c12a431206b487a, when executing a binary, if the
entry point is a thumb symbol, then make sure we set the PSL_T flag, otherwise
the CPU will interpret it in ARM mode, and that will likely leads to an
undefined instruction.
PR: 256899
MFC after: 1 week
Antoine Brodin [Wed, 30 Jun 2021 20:34:01 +0000 (20:34 +0000)]
ObsoleteFiles.inc: add a few missed files
Allan Jude [Wed, 30 Jun 2021 20:09:18 +0000 (20:09 +0000)]
Add Thomas Munro to the committers graph
Reported by: gnn
Mitchell Horne [Thu, 27 May 2021 20:02:04 +0000 (17:02 -0300)]
libpmc: enable pmu_utils on arm64
This allows supported libpmc to query/select from the pmu-events table,
which may have a more complete set of events than what we define
manually. A future update to these definitions should greatly improve
this support. The alias table is empty for now, until this future import
is complete.
Add the Foundation's copyright for recent work on this file.
Reviewed by: ray (slightly earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30603
Mitchell Horne [Wed, 19 May 2021 16:11:33 +0000 (13:11 -0300)]
hwpmc_arm64: accept raw event codes for PMC_OP_PMCALLOCATE
Make it possible to specify event codes without an offset of
PMC_EV_ARMV8_FIRST, by setting a machine-dependent flag. This is
required to make use of event definitions from pmu-events.
Reviewed by: ray (slightly earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30602
Mitchell Horne [Thu, 1 Apr 2021 13:19:43 +0000 (10:19 -0300)]
hwpmc_arm64: fill kern.hwpmc.cpuid
This will be used to detect supported pmu events. The expected format is
the MIDR register with the revision and variant fields masked. See also:
lib/libpmc/pmu-events/arch/arm64/mapfile.csv.
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30601
Mitchell Horne [Mon, 14 Jun 2021 15:21:08 +0000 (12:21 -0300)]
hwpmc_arm64.c: fix return style
In accordance to style(9).
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Alan Cox [Wed, 30 Jun 2021 05:59:21 +0000 (00:59 -0500)]
amd64: a simplication to pmap_remove_{all,write}
Eliminate some unnecessary unlocking and relocking when we have to retry
the operation to avoid deadlock. (All of the other pmap functions that
iterate over a PV list already implemented retries without these same
unlocking and relocking operations.)
Reviewed by: kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30951
Jose Luis Duran [Sun, 20 Jun 2021 00:00:19 +0000 (21:00 -0300)]
release: Remove C-like string comparison operator
Per [(1), i.e. test(1), the string comparison operator should be `=`,
not `==` in sh(1) scripts.
No functional change. FreeBSD's test accepts `==` as an alias for `=`
for compatibility with gnu test's `==` extension.
Reviewed by: imp@, gjb@
Pull Request: https://github.com/freebsd/freebsd-src/pull/485
Jose Luis Duran [Sun, 20 Jun 2021 02:22:48 +0000 (23:22 -0300)]
bsdinstall: Also copy /var/db/zoneinfo
Per tzsetup(8), /etc/localtime and /var/db/zoneinfo go hand in hand.
Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/486
Jose Luis Duran [Sun, 20 Jun 2021 02:19:00 +0000 (23:19 -0300)]
sysbuild: Also copy /var/db/zoneinfo
Per tzsetup(8), /etc/localtime and /var/db/zoneinfo go hand in hand.
Remove extra white spaces as well.
Reviewed by: imp@, phk@ (informal no objection email)
Pull Request: https://github.com/freebsd/freebsd-src/pull/486
Olivier Houchard [Wed, 30 Jun 2021 12:50:47 +0000 (14:50 +0200)]
arm64: Make sure COMPAT_FREEBSD32 handles thumb entry point.
If the entry point for the binary executed is a thumb 2 entry point, make
sure we set the PSR_T bit, or the CPU will interpret it as arm32 code and
bad things will happen.
PR: 256899
MFC after: 1 week
Olivier Houchard [Fri, 25 Jun 2021 23:06:26 +0000 (01:06 +0200)]
arm: Garbage collect _arm_memcpy/_arm_bzero.
Remove any attempt to use _arm_memcpy and _arm_bzero. It was used by some
xscale platforms to provide functions to use the DMA engine for big
zeroing/copying work, but those platforms are long gone, and it's unlikely
anything else will use those.
Fernando Apesteguía [Wed, 9 Jun 2021 10:58:04 +0000 (12:58 +0200)]
man: Build manpages for all architectures
Building and installing architecture-specific man pages only raises a number of
problems:
* The https://www.freebsd.org/cgi/man.cgi is incomplete. As an
example, it does not show results for pae(4). The reason for this is
that the cgi interface runs on FreeBSD amd64.
* In FreeBSD amd64 some manual pages have broken X-refs. See hptrr(4)
for an example.
* Also, we have broken links in our Release Notes. This is a
consequence of the first point. See
https://www.freebsd.org/releases/13.0R/hardware/#proc-i386.
Make MAN_ARCH default to 'all' so we build all the man pages for all the
architectures. The difference in disk space is negligible. Also link
architecture-specific man pages to their own section while keeping their own
namespace.
PR: 212290
Reported by: mj@bsdops.com
Approved by: ceri@, wosch@
MFC after: 4 weeks
Martin Matuska [Wed, 30 Jun 2021 06:34:36 +0000 (08:34 +0200)]
zfs: update zfs_config.h (missing in
2617128a2)
Martin Matuska [Wed, 30 Jun 2021 06:02:44 +0000 (08:02 +0200)]
zfs: merge openzfs/zfs@
4694131a0 (master) into main
Notable upstream pull request merges:
#12253 module/zfs: simplify ddt_stat_add() loop
#12288 Avoid 64bit division in multilist index functions
Obtained from: OpenZFS
OpenZFS commit:
4694131a0a05b6db2727c9801f9729b9378d3064
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
Alfonso Gregory [Fri, 25 Jun 2021 15:30:57 +0000 (11:30 -0400)]
Change strmode argument type to mode_t for crossbuild
To match the libc changes.
Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/493
Alfonso Gregory [Fri, 25 Jun 2021 15:35:14 +0000 (11:35 -0400)]
Change strmode argument type to mode_t
Finally, we have the correct function definition for strmode. NetBSD/OpenBSD
did this many years ago. This code is weird sign extension safe.
Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/493
Chuck Silvers [Tue, 29 Jun 2021 21:29:15 +0000 (14:29 -0700)]
fsck_ffs: don't try to write in read-only mode
Skip trying to change fs_mtime for SU+J if we are running read-only.
Reviewed by: mckusick
Sponsored by: Netflix
Brian Behlendorf [Tue, 29 Jun 2021 20:16:38 +0000 (13:16 -0700)]
Linux 5.13 compat: META
Increase the Linux-Maximum version in the META file to 5.13.
All of the required compatibility patches have been merged
and the 5.13 kernel has been officially released.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Laurențiu Nicola [Tue, 29 Jun 2021 19:33:49 +0000 (22:33 +0300)]
zed: fix sending emails (#12292)
Commit 6fc3099 broke the quoting when invoking the mail program, revert
that change.
Signed-off-by: Laurențiu Nicola <lnicola@dend.ro>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Colin Percival [Tue, 29 Jun 2021 17:59:59 +0000 (10:59 -0700)]
portsnap: Remove superfluous semicolons
Submitted by: des
Colin Percival [Tue, 29 Jun 2021 17:45:46 +0000 (10:45 -0700)]
portsnap: Shorten 'Skipping' output lines
Portsnap uses patches opportunistically to reduce download bandwidth: It
attempts to fetch patches which could be useful, and then makes use of
whichever patches it actually gets. (This solves the otherwise O(n^2)
issue for the server to build patches between every pair of versions.)
During the process of applying patches, portsnap prints lines of the
form "Skipping XXX-YYY (123 of 4567).\r", where the \r serves to allow
each of these (potentially many) lines to overwrite the previous one
on the console. Unfortunately, XXX and YYY here are SHA256 hashes,
resulting in these lines wrapping on reasonable-width consoles.
Replace the hashes with abbreviations of the form "0123...cdef"
(cutting 64 characters down to 11) in order to keep lines to a
reasonable length.
The rather ugly shell code here is used to avoid forking additional
processes; it would be much cleaner using sed(1), but in my testing
the sed-based alternative increases CPU time consumption by 50%.
Requested by: des
Dmitry Chagin [Tue, 29 Jun 2021 17:20:01 +0000 (20:20 +0300)]
LinuxKPI: Rename a short description of the kmalloc type.
To avoid duplication in the vmstat -m output rename the kmalloc type short
description to 'lkpikmalloc' as the Linux emulation layer historically names
its linux malloc type as 'linux'.
Reviewed by: hselasky, kib, emaste
Differential Revision: https://reviews.freebsd.org/D30928
MFC after: 2 weeks
Dmitry Chagin [Tue, 29 Jun 2021 17:19:17 +0000 (20:19 +0300)]
LinuxKPI: Put compat code under appropriate condition.
Reviewed by: hselasky, emaste, kib
Differential Revision: https://reviews.freebsd.org/D30927
MFC after: 2 weeks
Dmitry Chagin [Tue, 29 Jun 2021 17:18:29 +0000 (20:18 +0300)]
Eliminate p_elf_machine from struct proc.
Instead of p_elf_machine use machine member of the Elf_Brandinfo which is now
cached in the struct proc at p_elf_brandinfo member.
Note to MFC: D30918, KBI
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D30926
MFC after: 2 weeks
Dmitry Chagin [Tue, 29 Jun 2021 17:17:16 +0000 (20:17 +0300)]
LinuxKPI: Use the proper API to determine the ABI of the running process.
Reviewed by: markj, hselasky, kib
Differential Revision: https://reviews.freebsd.org/D30924
MFC after: 2 weeks
Dmitry Chagin [Tue, 29 Jun 2021 17:15:08 +0000 (20:15 +0300)]
Add a link to the Elf_Brandinfo into the struc proc.
To allow the ABI to make a dicision based on the Brandinfo add a link
to the Elf_Brandinfo into the struct proc. Add a note that the high 8 bits
of Elf_Brandinfo flags is private to the ABI.
Note to MFC: it breaks KBI.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D30918
MFC after: 2 weeks
Alexander [Tue, 29 Jun 2021 14:26:11 +0000 (16:26 +0200)]
module/zfs: simplify ddt_stat_add() loop
LLVM's Polly (ISL to be precise) is unhappy with the loop from
ddt_stat_add():
CC [M] fs/zfs/zfs/ddt.o
../lib/External/isl/isl_schedule_node.c:2470: cannot insert node
between set or sequence node and its filter children
(building with the custom patch which adds Polly support to Kbuild)
The mentioned loop is rather suboptimal. All that we need is to just
treat ddt_stat_t as an array of u64 and perform 1:1 addition or
substraction. This can be done in simpler for-loop with the
determined index and bounds. Compiler will expand d_end - d into
a number of ddt_stat_t fields at compile time.
This prevents Polly from failing on this file.
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Closes #12253
Mateusz Guzik [Tue, 29 Jun 2021 12:56:19 +0000 (14:56 +0200)]
mac: cheaper check for ifnet_create_mbuf and ifnet_check_transmit
Sponsored by: Rubicon Communications, LLC ("Netgate")
Jason A. Harmening [Sat, 12 Jun 2021 19:45:18 +0000 (12:45 -0700)]
unionfs: release parent vnodes in deferred context
Each unionfs node holds a reference to its parent directory vnode.
A single open file reference can therefore end up keeping an
arbitrarily deep vnode hierarchy in place. When that reference is
released, the resulting VOP_RECLAIM call chain can then exhaust the
kernel stack.
This is easily reproducible by running the unionfs.sh stress2 test.
Fix it by deferring recursive unionfs vnode release to taskqueue
context.
PR: 238883
Reviewed By: kib (earlier version), markj
Differential Revision: https://reviews.freebsd.org/D30748
Alexander Motin [Tue, 29 Jun 2021 12:59:14 +0000 (08:59 -0400)]
Avoid 64bit division in multilist index functions
The number of sublists in a multilist is relatively small. We dont need
64 bits to calculate an index. 32 bits is sufficient and makes the
code more efficient.
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12288
Edward Tomasz Napierala [Tue, 29 Jun 2021 07:49:04 +0000 (08:49 +0100)]
Add infrastructure required for Linux coredump support
This adds `sv_elf_core_osabi`, `sv_elf_core_abi_vendor`,
and `sv_elf_core_prepare_notes` fields to `struct sysentvec`,
and modifies imgact_elf.c to make use of them instead
of hardcoding FreeBSD-specific values. It also updates all
of the ABI definitions to preserve current behaviour.
This makes it possible to implement non-native ELF coredump
support without unnecessary code duplication. It will be used
for Linux coredumps.
Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30921
Mateusz Guzik [Mon, 28 Jun 2021 19:32:20 +0000 (21:32 +0200)]
pf: make sure the dtrace probe has safe access to state
Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Mateusz Guzik [Mon, 28 Jun 2021 18:50:56 +0000 (20:50 +0200)]
pf: revert: Use counter(9) for pf_state byte/packet tracking
stats are not shared and consequently per-CPU counters only waste
memory.
No slowdown was measured when passing over 20M pps.
Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Mateusz Guzik [Mon, 28 Jun 2021 18:18:26 +0000 (20:18 +0200)]
pf: deduplicate V_pf_state_z handling with pfsync
Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Mateusz Guzik [Mon, 28 Jun 2021 18:29:58 +0000 (20:29 +0200)]
pf: fix error-case leaks in pf_create_state
The hand-rolled clean up failed to free counters.
Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Stefan Eßer [Tue, 29 Jun 2021 07:01:13 +0000 (09:01 +0200)]
md5: Improve compatibility with coreutils and format fix
The previous changes that added support for the coreutils -c option
modified the output generated by passing -r to match that of the
coreutils versions. The difference is that coreutils separates the
hash from the file name by two blanks " " (or a blank followed by
an asterisk " *" with the -b option denoting).
While most scripts or users will not notice the difference, it might
be considered a violation of POLA and this commit reverts the change
for the non-sum programs. These will print a single blank " " as the
separator, as they die before the previous commit.
In order to still generate output that is identical to that of the
coreutils programs, this commit generates the " " or " *" separator
used by them for the -sum versions, depending on the presence of the
-b option.
MFC after: 3 days
Alan Cox [Tue, 29 Jun 2021 02:57:04 +0000 (21:57 -0500)]
arm64: a few simplications to pmap_remove_{all,write}
Eliminate some unnecessary unlocking and relocking when we have to retry
the operation to avoid deadlock. (All of the other pmap functions that
iterate over a PV list already implemented retries without these same
unlocking and relocking operations.)
Avoid a pointer dereference by using an existing local variable that
already holds the desired value.
Eliminate some unnecessary repetition of code on a failed fcmpset.
Specifically, there is no point in retesting the DBM bit because it
cannot change state while the pmap lock is held.
Reviewed by: kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30931
Maigurs Stalidzans [Tue, 29 Jun 2021 01:27:30 +0000 (19:27 -0600)]
UPDATING: Fix typos / improve langauge
This fixes a couple of typos in older entries, and clarifies the
language of a newer one. It also removes a joke that trips up
foreign readers due its use of faux archaic English.
Reviewed by: imp@
John-Mark Gurney [Tue, 29 Jun 2021 01:09:14 +0000 (18:09 -0700)]
ued may be NULL here which will cause a panic... reproducable by
simply doing a usbconfig reset on a device which doesn't reset itself
properly...
Ed Maste [Mon, 28 Jun 2021 21:30:48 +0000 (17:30 -0400)]
Clarify notice for profiled libraries in FreeBSD 14
Reported by: kevans
Fixes:
175841285e28 ("Add deprecation notice for...")
Sponsored by: The FreeBSD Foundation
Warner Losh [Mon, 28 Jun 2021 23:22:35 +0000 (17:22 -0600)]
cam: Fix GENERIC-MMCCAM build
Fix forgotten argument and type error. MMCCAM isn't enabled by default,
and I'd mistakenly thought it was, so these went undetected precommit.
Sponsored by: Netflix
Warner Losh [Mon, 28 Jun 2021 22:04:54 +0000 (16:04 -0600)]
cam_sim: remove unused sim_doneq member
Its use was removed in
227d67aa54 by mav when locking was revamped.
Reviewed by: scottl@, mav@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30890
Warner Losh [Mon, 28 Jun 2021 22:04:02 +0000 (16:04 -0600)]
cam: change xpt_clone_path to return int
xpt_clone_path originally returned a cam_status, but it doesn't do I/O
and should return an errno instead. I added it last year and it's only
used in one place. It's not yet documented, so no doc changes are
nneeded.
Reviewed by: scottl@, mav@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30884
Warner Losh [Mon, 28 Jun 2021 22:03:01 +0000 (16:03 -0600)]
cam: Remove CAM_TRUE and CAM_FALSE, they are unused and duplicate bool
These were in the original CAM commit in 3.0, but were not used there,
nor have they been used since then. They also duplicate the now-standard
bool type. Remove them.
Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30879
Warner Losh [Mon, 28 Jun 2021 22:01:30 +0000 (16:01 -0600)]
cam: fix xpt_bus_register and xpt_bus_deregister return errno
xpt_bus_register and xpt_bus_deregister returns a hybrid error that's
neither a cam_status, nor an errno, but a mix of both. Update
xpt_bus_register and xpt_bus_deregister to return an errno. The vast
majority of current users compare against zero, which can also be
spelled CAM_SUCCESS. Nobody uses CAM_FAILURE, so remove that symbol
to prevent comfusion (nothing returns it either).
Where the return value is saved, ensure that the variable 'error' is
used to store an errno and 'status' is used to store a cam_status where
it makes the code clearer (usually just in functions that already mix
and match). Where the return value isn't used at all, avoid storing it
at all.
Reviewed by: scottl@, mav@ (earlier version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30860
Warner Losh [Mon, 28 Jun 2021 22:00:44 +0000 (16:00 -0600)]
cam: delete cam_sim_alloc_dev
cam_sim_alloc_dev was only used internally by the MMC system. That has
been convered to using xpt_path_device() and has stopped using this
interface, so this can be retired.
Reviewed by: scottl@, mav@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30858
Warner Losh [Mon, 28 Jun 2021 22:00:37 +0000 (16:00 -0600)]
sdhci: stop using cam_sim_alloc_dev
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30857
Warner Losh [Mon, 28 Jun 2021 22:00:20 +0000 (16:00 -0600)]
mmc_sim: stop using cam_sim_alloc_dev
Use the vanilla flavor of cam_sim_alloc. Now that sdiob has been
converted to get the device_t from the cam_path, this data is no longer
necessary.
Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30856
Warner Losh [Mon, 28 Jun 2021 22:00:09 +0000 (16:00 -0600)]
sdiob: get the device_t from periph's path
Use the new xpt_path_device to get the device_t using the periph's path.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30855
Warner Losh [Mon, 28 Jun 2021 21:59:04 +0000 (15:59 -0600)]
cam mmc: Assert that the xpt_bus_register registered a device_t
Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30854
Warner Losh [Mon, 28 Jun 2021 21:57:51 +0000 (15:57 -0600)]
cam: add xpt_path_sim_device to return device_t associated with a path
Return the device associated with the sim's bus when it called
xpt_bus_register, if any. Most real SIMs in the tree set this device,
but some virtual ones do not have a device_t assocaited with them.
Reviewed by: scottl@, mav@ (earlier version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30853
Warner Losh [Mon, 28 Jun 2021 21:56:55 +0000 (15:56 -0600)]
cam: Group all xpt_path*() functions together in cam_xpt.h
Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30852
Warner Losh [Mon, 28 Jun 2021 21:56:08 +0000 (15:56 -0600)]
cam: fix UB behavior
The trick of subtracting one from the poitner returned from malloc
results in undefined behavior:
>>C89: 3.3.6 Unless both the pointer operand and the result point to a
>>member of the same array object, or one past the last member of the
>>array object, the behavior is undefined.
Instead, allocate 1 extra element and stop adjusting the pointer. While
a little wasteful, the extra is in the noise on today's systems.
Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30847
Warner Losh [Mon, 28 Jun 2021 21:55:02 +0000 (15:55 -0600)]
cam: save parent_dev in xpt_bus_register
Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30846
Warner Losh [Fri, 25 Jun 2021 21:33:31 +0000 (15:33 -0600)]
cam: kill trailing white space in two spots
Robert Wing [Mon, 28 Jun 2021 18:27:27 +0000 (10:27 -0800)]
vn_isdisk(9): update after r364372
Reviewed by: mjg
Differential Revision: https://reviews.freebsd.org/D30874
Mateusz Guzik [Mon, 28 Jun 2021 12:49:40 +0000 (14:49 +0200)]
pf: assert that sizeof(struct pf_state) <= 312
To prevent accidentally going over a threshold which makes UMA fit only
12 objects per page instead of 13.
Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Mateusz Guzik [Mon, 28 Jun 2021 12:22:31 +0000 (14:22 +0200)]
pf: factor out state allocation into pf_alloc_state
Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Mateusz Guzik [Mon, 28 Jun 2021 12:18:43 +0000 (14:18 +0200)]
pf: add pf_release_staten and use it in pf_unlink_state
Saves one atomic op.
Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Ed Maste [Sun, 27 Jun 2021 17:21:26 +0000 (13:21 -0400)]
Add deprecation notice for WITH_PROFILE option
As discussed on freebsd-current [1] and freebsd-arch [2] and review
D30833, FreeBSD 14 will ship without the _p.a libraries built with -pg.
Both upstream and base system (in commit
b762974cf4b9) Clang have been
modified to remove the special case for linking against these libraries.
Clang's -pg support and mcount() remain, so building with -pg can still
be used on code that the user builds; we just do not provide prebuilt
libraries compiled with -pg. A similar change is still needed for GCC.
[1] https://lists.freebsd.org/pipermail/freebsd-current/2020-January/075105.html
[2] https://lists.freebsd.org/archives/freebsd-arch/2021-June/000016.html
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Bjoern A. Zeeb [Fri, 18 Jun 2021 09:57:16 +0000 (09:57 +0000)]
net80211: ieee80211_probereq_ie fix length calculation for hw scans
c338cf2c6d5eacdee813191d5976aa531d450ee7 split up ieee80211_probereq_ie().
For HW scans we usually do not want to add a SSID to the IEs.
During that split we allocate memory based on the length which will
always include the length of the SSID and only later we reduced the
length but never updated the value passed back to the caller.
Split the SSID handling up and reduce the length before malloc().
This not only makes us not over-allocate in these situatoins but also
fixes the length returned to the caller and with that usually directly
passed to firmware.
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D30813
Bjoern A. Zeeb [Sun, 20 Jun 2021 13:49:46 +0000 (13:49 +0000)]
LinuxKPI: firmware, implement deferred loading for "nowait"
Change linuxkpi_request_firmware_nowait() to deferred firmware loading
scheduling a task. This changes behaviour in some cases that we
return from loading the driver before the driver is finished
initialising if the driver does not deal with it (wait).
This brings the behaviour one would expect from when this function is
called and I implemented it to see if it would help a specific case.
Sponsored by: The FreeBSD Foundation
MFC after: 12 days
Reviewed by: hselasky, imp (earlier version)
Differential Revision: https://reviews.freebsd.org/D30830