Commit Graph

266693 Commits

Author SHA1 Message Date
Emmanuel Vadot
5def4c47d4 Import device-tree files from Linux 5.11
Sponsored by:	Diablotin Systems
2021-07-01 17:21:47 +02:00
Andrew Turner
244002b482 Switch the order of the ID_AA64PFR1_EL1 fields
This makes them consistent with the fields in other registers.

Sponsored by:	The FreeBSD Foundation
2021-07-01 00:48:56 +00:00
Ceri Davies
d93a2f5d67 fortune: correct documentation of default FORTUNE_PATH.
While here, fix a typo in a comment relating to FORTUNE_PATH
2021-07-01 14:02:00 +01:00
Edward Tomasz Napierala
db8d680ebe 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
2021-07-01 09:42:07 +01:00
Edward Tomasz Napierala
93c3453f11 linux(4): revert arm64 part of 447636e43c
The arm64 part of the patch was incomplete and prevented
linux64.ko from loading due to missing symbol.

Sponsored By:	EPSRC
2021-07-01 08:29:23 +00:00
Rick Macklem
c5f4772c66 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
2021-06-30 15:15:41 -07:00
Edward Tomasz Napierala
447636e43c 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
2021-06-30 22:45:06 +01:00
Greg V
8c2dd68caa libpmc: Import AMD Zen 3 PMU events
Reviewed by:	mav, mhorne
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30965
2021-06-30 18:21:23 -03:00
Mitchell Horne
13f5a3076b hwpmc_arm64: add a PMCDBG to the interrupt handler
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2021-06-30 18:21:23 -03:00
Olivier Houchard
8c3bd133dd arm: Make sure we can handle a thumb entry point.
Similarly to what's been done on arm64 with commit
712c060c94, 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
2021-06-30 22:56:50 +02:00
Antoine Brodin
d75d33870d ObsoleteFiles.inc: add a few missed files 2021-06-30 20:34:36 +00:00
Allan Jude
781c3b5119 Add Thomas Munro to the committers graph
Reported by:	gnn
2021-06-30 20:09:18 +00:00
Mitchell Horne
28dd6730a5 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
2021-06-30 16:47:18 -03:00
Mitchell Horne
8cc3815f02 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
2021-06-30 16:47:09 -03:00
Mitchell Horne
5867cccdc4 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
2021-06-30 16:26:07 -03:00
Mitchell Horne
2129c8f677 hwpmc_arm64.c: fix return style
In accordance to style(9).

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2021-06-30 16:26:07 -03:00
Alan Cox
1a8bcf30f9 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
2021-06-30 13:12:25 -05:00
Jose Luis Duran
3f197b101f 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
2021-06-30 11:13:51 -06:00
Jose Luis Duran
6ce785c50b 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
2021-06-30 11:08:26 -06:00
Jose Luis Duran
91604330e6 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
2021-06-30 11:08:26 -06:00
Olivier Houchard
712c060c94 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
2021-06-30 14:55:18 +02:00
Olivier Houchard
c1da17a86c 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.
2021-06-30 14:53:57 +02:00
Fernando Apesteguía
0a0f748641 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
2021-06-30 09:57:51 +02:00
Martin Matuska
c0149d0300 zfs: update zfs_config.h (missing in 2617128a2) 2021-06-30 08:34:36 +02:00
Martin Matuska
2617128a21 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:	4694131a0a
2021-06-30 08:02:44 +02:00
John Grafton
a00d703f2f top(1): support command name and argument grepping
Obtained from:  OpenBSD
Reviewed by:	imp@
Pull Request:	https://github.com/freebsd/freebsd-src/pull/479
2021-06-29 17:51:18 -06:00
Alfonso Gregory
0d9e8c286d 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
2021-06-29 17:39:55 -06:00
Alfonso Gregory
849dcdb1c0 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
2021-06-29 17:38:45 -06:00
Chuck Silvers
ed1a156b03 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
2021-06-29 14:29:15 -07:00
Brian Behlendorf
4694131a0a 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>
2021-06-29 13:16:38 -07:00
Laurențiu Nicola
3482c2b79a
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>
2021-06-29 12:33:49 -07:00
Colin Percival
2ef5995f49 portsnap: Remove superfluous semicolons
Submitted by:	des
2021-06-29 11:00:54 -07:00
Colin Percival
a9f5512f07 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
2021-06-29 11:00:54 -07:00
Dmitry Chagin
5ca9d41700 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
2021-06-29 20:20:01 +03:00
Dmitry Chagin
1fd26da926 LinuxKPI: Put compat code under appropriate condition.
Reviewed by:		hselasky, emaste, kib
Differential Revision:	https://reviews.freebsd.org/D30927
MFC after:		2 weeks
2021-06-29 20:19:17 +03:00
Dmitry Chagin
5d9f790191 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
2021-06-29 20:18:29 +03:00
Dmitry Chagin
945accf502 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
2021-06-29 20:17:16 +03:00
Dmitry Chagin
615f22b2fb 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
2021-06-29 20:15:08 +03:00
Alexander
6a19dea7f6
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
2021-06-29 08:26:11 -06:00
Mateusz Guzik
f77697dd9f mac: cheaper check for ifnet_create_mbuf and ifnet_check_transmit
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-06-29 15:06:45 +02:00
Jason A. Harmening
372691a7ae 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
2021-06-29 06:02:01 -07:00
Alexander Motin
5b7053a9a5
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
2021-06-29 06:59:14 -06:00
Edward Tomasz Napierala
435754a59e 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
2021-06-29 08:49:12 +01:00
Mateusz Guzik
d26ef5c7ac pf: make sure the dtrace probe has safe access to state
Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-06-29 07:24:53 +00:00
Mateusz Guzik
55cc305dfc 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")
2021-06-29 07:24:53 +00:00
Mateusz Guzik
803dfe3da0 pf: deduplicate V_pf_state_z handling with pfsync
Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-06-29 07:24:53 +00:00
Mateusz Guzik
7f025db57c 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")
2021-06-29 07:24:52 +00:00
Stefan Eßer
b33d1898c1 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
2021-06-29 09:21:57 +02:00
Alan Cox
26a357245f 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
2021-06-28 22:21:24 -05:00
Maigurs Stalidzans
857cde693f 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@
2021-06-28 19:42:17 -06:00