]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agosysdecode_enum.3: Fix a typo: SIGBTRAP -> SIGTRAP.
John Baldwin [Tue, 5 Oct 2021 21:55:18 +0000 (14:55 -0700)]
sysdecode_enum.3: Fix a typo: SIGBTRAP -> SIGTRAP.

Sponsored by: DARPA

(cherry picked from commit 680d70b59e0379ded0cc94e3772bc47be2163c7f)

2 years agoAdd EPOCH_TRACE to NOTES to get LINT coverage.
John Baldwin [Sat, 11 Sep 2021 20:05:44 +0000 (13:05 -0700)]
Add EPOCH_TRACE to NOTES to get LINT coverage.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b9485d76e3ad4924032a23c82b8a30a0dce31918)

2 years agoDocument kern.log_wakeups_per_second.
John Baldwin [Wed, 4 Aug 2021 18:50:34 +0000 (11:50 -0700)]
Document kern.log_wakeups_per_second.

PR: 148680

(cherry picked from commit c51e4962a3cf2959d1f1cb9ab74ceab448583169)

2 years agoRemove 'make update'.
John Baldwin [Fri, 11 Jun 2021 21:56:28 +0000 (14:56 -0700)]
Remove 'make update'.

In the CVS days this used be a wrapper around either CVS or CVSup and
used to support updating src, doc, and ports checkouts.  With the move
to subversion this only supported updating src and was itself a
wrapper around 'svn update'.  With Git, users are probably better off
using appropriate Git commands directly to update without needing an
explicit make target as a wrapper.

Reviewed by: bcr, imp, emaste
Differential Revision: https://reviews.freebsd.org/D30736

(cherry picked from commit e290182bcf3895ca659dff111bca6a077c4708b1)

2 years agoconfig: Fix typo in comment.
John Baldwin [Mon, 1 Feb 2021 21:13:36 +0000 (13:13 -0800)]
config: Fix typo in comment.

(cherry picked from commit bcaa6aa15383cacf5f20179be919bb8dd45cc5f4)

2 years agonfscl: Add a check for "has acquired a delegation" to nfscl_removedeleg()
Rick Macklem [Mon, 27 Sep 2021 01:37:25 +0000 (18:37 -0700)]
nfscl: Add a check for "has acquired a delegation" to nfscl_removedeleg()

Commit 5e5ca4c8fc53 added a flag to a NFSv4 mount point that is set when
the first delegation is acquired from the NFSv4 server.

For a common case where delegations are not being issued by the
NFSv4 server, the nfscl_removedeleg() code acquires the mutex lock for
open/lock state, finds the delegation list empty, then just unlocks the
mutex and returns. This patch adds a check of the flag to avoid the
need to acquire the mutex for this common case.

This change appears to be performance neutral for a small number
of opens, but should reduce lock contention for a large number of opens
for the common case where server is not issuing delegations.

This commit should not affect the high level semantics of delegation
handling.

(cherry picked from commit 62c5be4ab4c8b8127185286e148638cb8cdf45f4)

2 years agoselsocket: handle sopoll() errors correctly
Brooks Davis [Tue, 19 Oct 2021 23:19:57 +0000 (00:19 +0100)]
selsocket: handle sopoll() errors correctly

Without this change, unmounting smbfs filesystems with an INVARIANTS
kernel would panic after 10e64782ed59727e8c9fe4a5c7e17f497903c8eb.

PR: 253079
Found by: markj
Reviewed by: markj, jhb
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D32492

(cherry picked from commit 04c91ac48ad13ce0d1392cedbd69c2c0223d206f)

2 years agomakesyscalls.lua: add a CAPENABLED flag
Brooks Davis [Tue, 19 Oct 2021 23:19:56 +0000 (00:19 +0100)]
makesyscalls.lua: add a CAPENABLED flag

The CAPENABLED flag indicates that the syscall can be used in capsicum
capability mode.  It is intended to replace capabilities.conf.

Reviewed by: kevans, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D31349

(cherry picked from commit 6945df3fff57a9606f8c8a4e3865def3a0e915e7)

2 years agomakesyscalls.lua: Add a new syscall type: RESERVED
Brooks Davis [Tue, 19 Oct 2021 23:19:56 +0000 (00:19 +0100)]
makesyscalls.lua: Add a new syscall type: RESERVED

RESERVED syscall number are reserved for local/vendor use.  RESERVED is
identical to UNIMPL except that comments are ignored.

Reviewed by: kevans
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27988

(cherry picked from commit 119fa6ee8a8056aab5e4ab1719d3c563cdb4a95a)

2 years agociss(4): Fix typo.
Alexander Motin [Sun, 19 Sep 2021 18:01:40 +0000 (14:01 -0400)]
ciss(4): Fix typo.

(cherry picked from commit 5f8cb13cfb0c91a4ec1a9648a3ae245b1dff36f6)

2 years agociss(4): Properly handle data underrun.
Alexander Motin [Sun, 19 Sep 2021 17:45:51 +0000 (13:45 -0400)]
ciss(4): Properly handle data underrun.

For SCSI data underrun is a part of normal life.  It should not be
reported as error.  This fixes MODE SENSE used by modern CAM.

MFC after: 1 month

(cherry picked from commit e8144a13e075ff13c1f162690c7f14dd3f0a4862)

2 years agocam(4): Limit search for disks in SES enclosure by single bus
Alexander Motin [Tue, 5 Oct 2021 19:01:16 +0000 (15:01 -0400)]
cam(4): Limit search for disks in SES enclosure by single bus

At least for SAS that we only support now disks are typically
connected to the same bus as the enclosure.  Limiting the search
scope makes it much faster on systems with multiple buses and
thousands of disks.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D32305

(cherry picked from commit 730ea72c706ef8e025616772cfd86fd89ed3d42e)

2 years agocam(4): Improve XPT_DEV_MATCH
Alexander Motin [Tue, 5 Oct 2021 18:54:03 +0000 (14:54 -0400)]
cam(4): Improve XPT_DEV_MATCH

Remove *_MATCH_NONE enums, making no sense and so never used.  Make
*_MATCH_ANY enums 0 (no any match flags set), previously used by
*_MATCH_NONE.  Bump CAM_VERSION to 0x1a reflecting those changes and
add compat shims.

When traversing through buses and devices do not descend if we can
already see that requested pattern does not match the bus or device.
It allows to save significant amount of time on system with thousands
of disks when doing limited searches.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D32304

(cherry picked from commit 8f9be1eed11c27c66386c3d72cd6c6aef597fa0d)

2 years agoChange lowest address on subnet (host 0) not to broadcast by default.
Mike Karels [Sun, 5 Sep 2021 18:14:04 +0000 (13:14 -0500)]
Change lowest address on subnet (host 0) not to broadcast by default.

The address with a host part of all zeros was used as a broadcast long
ago, but the default has been all ones since 4.3BSD and RFC1122.  Until
now, we would broadcast the host zero address as well as the configured
address.  Change to not broadcasting that address by default, but add a
sysctl (net.inet.ip.broadcast_lowest) to re-enable it.  Note that the
correct way to use the zero address for broadcast would be to configure
it as the broadcast address for the network.

See https:/datatracker.ietf.org/doc/draft-schoen-intarea-lowest-address/
and the discussion in https://reviews.freebsd.org/D19316.  Note, Linux
now implements this.

Reviewed by: rgrimes, tuexen; melifaro (previous version)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D31861

(cherry picked from commit fd0765933c3ccb059ad7456e657b2e8ed22f58b0)

2 years agoFix two typos in source code comments
Gordon Bergling [Sat, 16 Oct 2021 06:09:31 +0000 (08:09 +0200)]
Fix two typos in source code comments

- s/alocated/allocated/
- s/realocated/reallocated/

(cherry picked from commit 899a3b38f5172d70360396caeebb5b694638282e)

2 years agobpf(4): Fix a misnamed constant
Felix Johnson [Wed, 13 Oct 2021 23:00:41 +0000 (19:00 -0400)]
bpf(4): Fix a misnamed constant

rarpd.c was modified in r19859 to use REVARP_REQUEST instead of
ARPOP_REVREQUEST.

PR: 183333
Reported by: pluknet <pluknet@gmail.com>

(cherry picked from commit a524aaf68341d9f83a0ef7dc21ad54728ddaaa1e)

2 years agoacpi(4): Correct outdated sysctl
Felix Johnson [Wed, 13 Oct 2021 00:42:14 +0000 (20:42 -0400)]
acpi(4): Correct outdated sysctl

This changes the location of cx_supported sysctl to dev.cpu.N.

PR: 214370

(cherry picked from commit 6882064d0ced456c89d161da4bc43c5d97bab60b)

2 years agolibctf: Improve check for duplicate SOU definitions in ctf_add_type()
Mark Johnston [Mon, 4 Oct 2021 16:28:22 +0000 (12:28 -0400)]
libctf: Improve check for duplicate SOU definitions in ctf_add_type()

When copying a struct or union from one CTF container to another,
ctf_add_type() checks whether it matches an existing type in the
destination container.  It does so by looking for a type with the same
name and kind as the new type, and if one exists, it iterates over all
members of the source type and checks whether a member with matching
name and offset exists in the matched destination type.  This can
produce false positives, for example because member types are not
compared, but this is not expected to arise in practice.  If the match
fails, ctf_add_type() returns an error.

The procedure used for member comparison breaks down in the face of
anonymous struct and union members.  ctf_member_iter() visits each
member in the source definition and looks up the corresponding member in
the desination definition by name using ctf_member_info(), but this
function will descend into anonymous members and thus fail to match.
Fix the problem by introducing a custom comparison routine which does
not assume member names are unique.  This should also be faster for
types with many members; in the previous scheme, membcmp() would perform
a linear scan of the desination type's members to perform a lookup by
name.  The new routine steps through the members of both types in a
single loop.

PR: 258763
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 105fd928b0b5b35ab529e5f6914788dc49582901)

2 years agogeom_label: Add more validation for NTFS volume tasting
Mark Johnston [Mon, 4 Oct 2021 21:48:44 +0000 (17:48 -0400)]
geom_label: Add more validation for NTFS volume tasting

- Ensure that the computed MFT record size isn't negative or larger than
  maxphys before trying to read $Volume.
- Guard against truncated records in volume metadata.
- Ensure that the record length is large enough to contain the volume
  name.
- Verify that the (UTF-16-encoded) volume name's length is a multiple of
  two.

PR: 258833, 258914
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f0a08fa9f532a58f5d7a4814d6eb7ddd49f368da)

2 years agounzip: Fix segmentation fault if a zip file contains buggy filename.
Yoshihiro Takahashi [Sun, 10 Oct 2021 11:49:19 +0000 (20:49 +0900)]
unzip: Fix segmentation fault if a zip file contains buggy filename.

PR:             259011
Reported by:    Robert Morris
Submitted by:   ak

(cherry picked from commit 2c614481fd5248c1685e713f67d40cf2d5fba494)

2 years agovfs: Permit unix sockets to be opened with O_PATH
Mark Johnston [Fri, 17 Sep 2021 16:34:21 +0000 (12:34 -0400)]
vfs: Permit unix sockets to be opened with O_PATH

As with FIFOs, a path descriptor for a unix socket cannot be used with
kevent().

In principle connectat(2) and bindat(2) could be modified to support an
AT_EMPTY_PATH-like mode which operates on the socket referenced by an
O_PATH fd referencing a unix socket.  That would eliminate the path
length limit imposed by sockaddr_un.

Update O_PATH tests.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2bd9826995ca6b23f8b088cfa035c0ad1c578ac3)

2 years agong_ppp(4): Fix a typo in a comment
Gordon Bergling [Thu, 14 Oct 2021 13:30:32 +0000 (15:30 +0200)]
ng_ppp(4): Fix a typo in a comment

- s/delcared/declared/

(cherry picked from commit 0a8159d8ca85383ec84076396c0a457c6d3e08f9)

2 years agoRestore PPS_SYNC in NOTES
Konstantin Belousov [Mon, 11 Oct 2021 22:02:35 +0000 (01:02 +0300)]
Restore PPS_SYNC in NOTES

(cherry picked from commit 4cc167a35217f9cee81a2f366e451fae42fd4a6c)

2 years agoEnable PPS_SYNC on amd64, arm64 and armv7
Konstantin Belousov [Sun, 10 Oct 2021 12:20:45 +0000 (15:20 +0300)]
Enable PPS_SYNC on amd64, arm64 and armv7

PR: 259036

(cherry picked from commit e81e77c5a055d1cbf6d6a6f0acbaf443267aa84f)

2 years agovmci: fix panic due to freeing unallocated resources
Mark Peek [Sat, 9 Oct 2021 21:21:16 +0000 (14:21 -0700)]
vmci: fix panic due to freeing unallocated resources

Summary:
An error mapping PCI resources results in a panic due to unallocated
resources being freed up. This change puts the appropriate checks in
place to prevent the panic.

PR: 252445
Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Tested by: marcus
MFC after: 1 week
Sponsored by: VMware

Test Plan:
Along with user testing, also simulated error by inserting a ENXIO
return in vmci_map_bars().

Reviewed by: marcus
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D32016

(cherry picked from commit 0f14bcbe384091c729464cb770372aeb79061070)

2 years agotimecounter: Let kern.timecounter.stepwarnings be set as a tunable
Mark Johnston [Sat, 9 Oct 2021 16:34:06 +0000 (12:34 -0400)]
timecounter: Let kern.timecounter.stepwarnings be set as a tunable

(cherry picked from commit fa9da1f590caba94b98717c33633efcf719da151)

2 years agoriscv: move signal delivery code to exec_machdep.c
Konstantin Belousov [Mon, 4 Oct 2021 15:15:17 +0000 (18:15 +0300)]
riscv: move signal delivery code to exec_machdep.c

(cherry picked from commit aba66031f27cec0bf9f6c6bc5d857e03eaf97d4f)

2 years agoarm: move signal delivery code to exec_machdep.c
Konstantin Belousov [Mon, 4 Oct 2021 11:39:11 +0000 (14:39 +0300)]
arm: move signal delivery code to exec_machdep.c

(cherry picked from commit dfaf65023ef0d9f68da856f3795448596751a69d)

2 years agoarm64: move signal delivery code to exec_machdep.c
Konstantin Belousov [Mon, 4 Oct 2021 06:55:51 +0000 (09:55 +0300)]
arm64: move signal delivery code to exec_machdep.c

(cherry picked from commit b4ae6b166066a789641e4a579020ca6b10b40cfa)

2 years agoi386: move signal delivery code to exec_machdep.c
Konstantin Belousov [Mon, 4 Oct 2021 01:29:26 +0000 (04:29 +0300)]
i386: move signal delivery code to exec_machdep.c

(cherry picked from commit 4c5bf591522c5449d017b7ea496488c42f847963)

2 years agoO_PATH: allow vfs_extattr syscalls
Greg V [Sun, 10 Oct 2021 12:45:31 +0000 (15:45 +0300)]
O_PATH: allow vfs_extattr syscalls

(cherry picked from commit 98dae405de7f8b3506dd94dcd3e9f51d3fb15962)

2 years agoFix typo in comment
Konstantin Belousov [Thu, 14 Oct 2021 20:03:36 +0000 (23:03 +0300)]
Fix typo in comment

(cherry picked from commit 86929782cfab2664010a31979e9e3c0626721ebb)

2 years agoStyle
Konstantin Belousov [Thu, 14 Oct 2021 19:30:18 +0000 (22:30 +0300)]
Style

(cherry picked from commit 1adebca1fc9f6def501f7a5c2b2bde5fe9049477)

2 years agoarm, arm64, riscv: adjust top-level nexus comment
Mitchell Horne [Thu, 7 Oct 2021 18:02:02 +0000 (15:02 -0300)]
arm, arm64, riscv: adjust top-level nexus comment

These platforms don't manage resources for DMA request lines or I/O
ports, this is specific to x86. Remove the references from the comments.

Reviewed by: imp, jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32358

(cherry picked from commit 17f790f49f5879ae9888b99fdbf857010ec13f9c)

2 years agoriscv: fix VM_MAXUSER_ADDRESS checks in asm routines
Mitchell Horne [Thu, 7 Oct 2021 21:12:30 +0000 (18:12 -0300)]
riscv: fix VM_MAXUSER_ADDRESS checks in asm routines

There are two issues with the checks against VM_MAXUSER_ADDRESS. First,
the comparison should consider the values as unsigned, otherwise
addresses with the high bit set will fail to branch. Second, the value
of VM_MAXUSER_ADDRESS is, by convention, one larger than the maximum
mappable user address and invalid itself. Thus, use the bgeu instruction
for these comparisons.

Add a regression test case for copyin(9).

PR: 257193
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31209

(cherry picked from commit 8babb5582eed2250309084d76898798409a2aae0)

2 years agoriscv: handle page faults in the unmappable region
Mitchell Horne [Thu, 7 Oct 2021 21:05:38 +0000 (18:05 -0300)]
riscv: handle page faults in the unmappable region

When handling a kernel page fault, check explicitly that stval resides
in either the user or kernel address spaces, and make the page fault
fatal if not. Otherwise, a properly crafted address may appear to
pmap_fault() as a valid and present page in the kernel map, causing the
page fault to be retried continuously. This is mainly due to the fact
that the upper bits of virtual addresses are not validated by most of
the pmap code.

Faults of this nature should only occur due to some kind of bug in the
kernel, but it is best to handle them gracefully when they do.

Handle user page faults in the same way, sending a SIGSEGV immediately
when a malformed address is encountered.

Add an assertion to pmap_l1(), which should help catch other bugs of
this kind that make it this far.

Reviewed by: jrtc27, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31208

(cherry picked from commit 4a9f2f8b07c2d1a1c12f4aabdccd36f56b20cfda)

2 years agolibpmc: add some AMD pmu counter aliases
Mitchell Horne [Thu, 30 Sep 2021 14:13:37 +0000 (11:13 -0300)]
libpmc: add some AMD pmu counter aliases

Make it mostly compatible with what's defined for Intel. Except where
noted, these are defined for all of amdzen(1|2|3).

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32162

(cherry picked from commit a20c10893eb17e281f119d1b9b39c175dbf4d7bd)

2 years agolibpmc: fix the 'cycles' event alias on x86
Mitchell Horne [Thu, 30 Sep 2021 14:11:36 +0000 (11:11 -0300)]
libpmc: fix the 'cycles' event alias on x86

Looking for "tsc-tsc" in the pmu tables will fail every time. Instead,
make this an alias for the static TSC event defined in pmc_events.h.
This fixes 'pmcstat -s cycles' on Intel and AMD.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32197

(cherry picked from commit 937539e0a32ce1da46223664ca1cf3b252e02ece)

2 years agominidump: De-duplicate the progress bar
Mitchell Horne [Wed, 29 Sep 2021 17:44:27 +0000 (14:44 -0300)]
minidump: De-duplicate the progress bar

The implementation of the progress bar is simple, but duplicated for
most minidump implementations. Extract the common bits to kern_dump.c.
Ensure that the bar is reset with each subsequent dump; this was only
done on some platforms previously.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31885

(cherry picked from commit ab4ed843a303ea3e585f8ed3f79873e46d3b3ae3)

2 years agominidump: De-duplicate is_dumpable()
Mitchell Horne [Wed, 29 Sep 2021 17:30:11 +0000 (14:30 -0300)]
minidump: De-duplicate is_dumpable()

The function is identical in each minidump implementation, so move it to
vm_phys.c. The only slight exception is powerpc where the function was
public, for use in moea64_scan_pmap().

Reviewed by: kib, markj, imp (earlier version)
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31884

(cherry picked from commit 31991a5a45857e88c29dec422e0b8d6f68f8877b)

2 years agologin.conf.5: Mark passwordtime as implemented
Felix Johnson [Wed, 6 Oct 2021 20:47:02 +0000 (22:47 +0200)]
login.conf.5: Mark passwordtime as implemented

login.conf.5 listed passwordtime in RESERVED CAPABILITIES, which is a
section for capabilities not implemented in the base system. However,
passwordtime has been implemented in the base for several years now.

PR: 246099
Reported by: avg
Reviewed by: 0mp
MFC after: 3 days

(cherry picked from commit e7f8f3b95e1ff76765f1d2f4412b95f6ff5abe25)

2 years agontp.conf.5: Fix typos
Elyes HAOUAS [Wed, 6 Oct 2021 05:38:06 +0000 (07:38 +0200)]
ntp.conf.5: Fix typos

"certian" --> "certain"
"compatability" --> "compatibility"
"noticable" --> "noticeable"
"limite" --> "limit"
"acutal" --> "actual"
"ba" --> "be"

MFC after: 1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/550
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
(cherry picked from commit da3278ded3b2647d26da26788bab8363e502a144)

2 years agomps/mpr(4): Move xpt_register_async() out of lock.
Alexander Motin [Tue, 14 Sep 2021 21:37:02 +0000 (17:37 -0400)]
mps/mpr(4): Move xpt_register_async() out of lock.

It fixes lock ordere reversal between SIM and device locks.  Also
remove registration for AC_FOUND_DEVICE, unused for a while now.

MFC after: 1 month

(cherry picked from commit 02d8194012a9a0e367a92c7f89567b808bf0e9a8)

2 years ago[fib_algo][dxr] Retire counters which are no longer used
Marko Zec [Sat, 9 Oct 2021 11:47:10 +0000 (13:47 +0200)]
[fib_algo][dxr] Retire counters which are no longer used

The number of chunks can still be tracked via vmstat -z|fgrep dxr.

MFC after: 3 days

2 years ago[fib_algo][dxr] Improve incremental updating strategy
Marko Zec [Sat, 9 Oct 2021 11:22:27 +0000 (13:22 +0200)]
[fib_algo][dxr] Improve incremental updating strategy

Tracking the number of unused holes in the trie and the range table
was a bad metric based on which full trie and / or range rebuilds
were triggered, which would happen in vain by far too frequently,
particularly with live BGP feeds.

Instead, track the total unused space inside the trie and range table
structures, and trigger rebuilds if the percentage of unused space
exceeds a sysctl-tunable threshold.

MFC after: 3 days
PR: 257965

2 years agoBump __FreeBSD_version to 1300517 for LinuxKPI changes
Vladimir Kondratyev [Tue, 12 Oct 2021 13:22:37 +0000 (16:22 +0300)]
Bump __FreeBSD_version to 1300517 for LinuxKPI changes

2 years agoLinuxKPI: Import linux_page.c and some dependent code from drm-kmod
Vladimir Kondratyev [Wed, 29 Sep 2021 20:15:37 +0000 (23:15 +0300)]
LinuxKPI: Import linux_page.c and some dependent code from drm-kmod

No functional changes intended

Reviewed by: hselasky, manu, markj
Differential revision:  https://reviews.freebsd.org/D32167

(cherry picked from commit c072f6e856bc0348bf6fdd468761041948823f73)

2 years agoLinuxKPI: Update pte_fn_t definition to match Linux 5.3
Vladimir Kondratyev [Wed, 29 Sep 2021 20:15:27 +0000 (23:15 +0300)]
LinuxKPI: Update pte_fn_t definition to match Linux 5.3

Reviewed by: emaste, hselasky, manu
Differential revision: https://reviews.freebsd.org/D32166

(cherry picked from commit 88531adbfbe25c6ae56cc7bbe76c825a3f5dc504)

2 years agoLinuxKPI: Implement backlight_enable and backlight_disable functions
Vladimir Kondratyev [Wed, 29 Sep 2021 20:15:12 +0000 (23:15 +0300)]
LinuxKPI: Implement backlight_enable and backlight_disable functions

For now, disable backlight if brightness level is set to 0.
In the future we may implement separate knob in backlight(8).

Required by drm-kmod v5.6

Reviewed by: hselasky, manu
Differential revision: https://reviews.freebsd.org/D32165

(cherry picked from commit b52e36384091c5f80b06b79f5889492eac074426)

2 years agoLinuxKPI: Add dummy pgprot_decrypted() implementation
Vladimir Kondratyev [Wed, 29 Sep 2021 20:14:58 +0000 (23:14 +0300)]
LinuxKPI: Add dummy pgprot_decrypted() implementation

to reduce number of #ifdefs in drm-kmod

Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D32094

(cherry picked from commit 3d86f8f1d7d1a070dd2e81367a4196a272b3bd07)

2 years agoLinuxKPI: Cast offset_in_page() parameter to unsigned long
Vladimir Kondratyev [Wed, 29 Sep 2021 20:14:47 +0000 (23:14 +0300)]
LinuxKPI: Cast offset_in_page() parameter to unsigned long

to reduce number of patches in drm-kmod

Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D32093

(cherry picked from commit 37eba5b77a5733ac711b119141619c89b8446471)

2 years agoLinuxKPI: Import linux/poison.h header
Vladimir Kondratyev [Wed, 29 Sep 2021 20:14:34 +0000 (23:14 +0300)]
LinuxKPI: Import linux/poison.h header

Required by drm-kmod 5.6

Reviewed by: hselasky, imp, manu
Obtained from: OpenBSD
Differential revision: https://reviews.freebsd.org/D32092

(cherry picked from commit 6efabdeede7f3aac4b133116a421f5a7a721e24c)

2 years agoLinuxKPI: Add helper functions to store integers to linux/xarray.h
Vladimir Kondratyev [Wed, 29 Sep 2021 20:14:23 +0000 (23:14 +0300)]
LinuxKPI: Add helper functions to store integers to linux/xarray.h

Required by drm-kmod.

Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D32091

(cherry picked from commit b59ffedae8f3707bf0079b4fd0cbf8190eed0c5e)

2 years agoLinuxKPI: Allow cdev_pager prefault handler to steal pages
Vladimir Kondratyev [Wed, 29 Sep 2021 20:14:05 +0000 (23:14 +0300)]
LinuxKPI: Allow cdev_pager prefault handler to steal pages

from other vm_objects. This workarounds "Page already inserted" panic
in vm_page_insert routine triggered on attempt to mmap file created
with shmem_file_setup call. After introduction of "GTT mmap
interface v4" a.k.a. MMAP_OFFSET, vm_objects allocated by these calls
may try to own intersected sets of pages that leads to the assertion.

Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D32090

(cherry picked from commit 62ff0566c93056e00b3c9c3f8d2ac1e7d8e0c098)

2 years agoLinuxKPI: stub anon_inode_getfile
Vladimir Kondratyev [Wed, 29 Sep 2021 20:13:53 +0000 (23:13 +0300)]
LinuxKPI: stub anon_inode_getfile

Although drm-kmod contains better implementation which is able to
allocate real entries on pseudofs, this feature has never been used.

Starting from drm-kmod v5.6 old implementation began to leak entries
on each drm device close(). Now just drop pseudofs support instead of
fixing it in drm-kmod and provide stub in base.

Reviewed by: hselasky, manu
Differential revision: https://reviews.freebsd.org/D32069

(cherry picked from commit bd6d55adb4131d7172e0485d30ceca4e5aa12ff5)

2 years agoLinuxKPI: Factor out vmf_insert_pfn_prot() routine
Vladimir Kondratyev [Wed, 29 Sep 2021 20:13:41 +0000 (23:13 +0300)]
LinuxKPI: Factor out vmf_insert_pfn_prot() routine

from GEM and TTM page fault handlers and move it in to base system. This
code is tightly integrated with LKPI mmap support to belong to drm-kmod.

As this routine requires associated vm_object to be locked, it got
additional _locked suffix.

Reviewed by: hselasky, markj
Differential revision: https://reviews.freebsd.org/D32068

(cherry picked from commit f6823dac8fa6e9fc2926a866e9a0c4d43e38e236)

2 years agoLinuxKPI: Invoke release handler when file is destroyed by fput()
Vladimir Kondratyev [Wed, 29 Sep 2021 20:13:27 +0000 (23:13 +0300)]
LinuxKPI: Invoke release handler when file is destroyed by fput()

Required by drm_kmod 5.6

Reviewed by: hselasky, manu
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D32067

(cherry picked from commit 7d92d4835850fdc5c1ec1fa7c5634826a61ad0a5)

2 years agoLinuxKPI: allocate current before taking shrinkers lock
Vladimir Kondratyev [Wed, 29 Sep 2021 20:12:58 +0000 (23:12 +0300)]
LinuxKPI: allocate current before taking shrinkers lock

This fixes following warnings when shrinkers are invoked first time:

uma_zalloc_debug: zone "lkpicurr" with the following non-sleepable
locks held: exclusive sleep mutex lkpi-shrinker (lkpi-shrinker)

uma_zalloc_debug: zone "lkpimm" with the following non-sleepable locks
held: exclusive sleep mutex lkpi-shrinker (lkpi-shrinker)

Reviewed by: hselasky, manu
Differential revision: https://reviews.freebsd.org/D32066

(cherry picked from commit 2fe9ea5d3ad69d880138d98b2ae8d2c4309eeafa)

2 years agoLinuxKPI: implement _IOC_TYPE and _IOC_NR macros in linux/ioctl.h
Vladimir Kondratyev [Wed, 29 Sep 2021 20:12:47 +0000 (23:12 +0300)]
LinuxKPI: implement _IOC_TYPE and _IOC_NR macros in linux/ioctl.h

They are used by drm-kmod

Reviewed by: emaste, hselasky, manu
Differential revision: https://reviews.freebsd.org/D31674

(cherry picked from commit b58c916f115d9d40f91397a1b406891f36c39fad)

2 years agoLinuxKPI: Remove FreeBSD struct resource from all LKPI headers
Vladimir Kondratyev [Wed, 29 Sep 2021 20:12:36 +0000 (23:12 +0300)]
LinuxKPI: Remove FreeBSD struct resource from all LKPI headers

except linux/pci.h to avoid conflicts with Linux version.
This allows to #define resource in drm-kmod globally and strip some #ifdef-s

Reviewed by: hselasky, manu
Differential revision: https://reviews.freebsd.org/D31673

(cherry picked from commit 66ea390652d2ede405b43c168157986bd2b52bb9)

2 years agoLinuxKPI: Implement get_file_rcu()
Vladimir Kondratyev [Wed, 29 Sep 2021 20:12:25 +0000 (23:12 +0300)]
LinuxKPI: Implement get_file_rcu()

get_file_rcu() grabs a file if the file->f_count is not zero.

Required by drm-kmod 5.6

Reviewed by: hselasky, manu (previous version)
Differential revision: https://reviews.freebsd.org/D31672

(cherry picked from commit a81b36c6d35d74177891860b789dd02b9d1c5851)

2 years agoe1000: print EEPROM/NVM/OROM versions
Kevin Bowling [Wed, 6 Oct 2021 23:25:03 +0000 (16:25 -0700)]
e1000: print EEPROM/NVM/OROM versions

This is useful for diagnosing problems. In particular, the errata
sheets identify the EEPROM version for many fixes.

Reviewed by: gallatin
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32333

(cherry picked from commit 293663f4da9e8b8aeb106ce3b73a8ed2aa2a8a90)

2 years agoe1000: Lock nvm print sysctl
Kevin Bowling [Wed, 6 Oct 2021 23:20:26 +0000 (16:20 -0700)]
e1000: Lock nvm print sysctl

Otherwise results in KASSERT with debug kernels because we rely on the
iflib CTX lock to implement the software serialization to the NVM model

Reviewed by: gallatin
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32333

(cherry picked from commit 9b3e252e59c6e63594fb20e3f65188dab9e1eeff)

2 years agolinuxkpi: Handle a NULL cache pointer in kmem_cache_destroy()
Mark Johnston [Wed, 6 Oct 2021 18:45:22 +0000 (14:45 -0400)]
linuxkpi: Handle a NULL cache pointer in kmem_cache_destroy()

This is compatible with Linux, and some driver error paths depend on it.

Reviewed by: bz, emaste
Sponsored by: The FreeBSD Foundation

(cherry picked from commit a76de17715ab689b0b53a1012e22d8a08470b6e4)

2 years agosyslogd: Fix bug that caused -N to drop SecureMode if specified after -s
jfranklin13 [Tue, 28 Sep 2021 14:49:15 +0000 (16:49 +0200)]
syslogd: Fix bug that caused -N to drop SecureMode if specified after -s

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

(cherry picked from commit 9589362bc980290ff84fe61814e5716dea79e931)

2 years agoixgbe: Update shared code catchup
Kevin Bowling [Thu, 7 Oct 2021 01:43:27 +0000 (18:43 -0700)]
ixgbe: Update shared code catchup

Leftovers from DPDK sync

Reviewed by: grehan
Obtained from: DPDK
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 3f66b96d8658f8721e6b1c6f035611bec44675b9)

2 years agoOpenSSH: cherry-pick "need initgroups() before setresgid()"
Ed Maste [Tue, 12 Oct 2021 00:47:39 +0000 (20:47 -0400)]
OpenSSH: cherry-pick "need initgroups() before setresgid()"

From openssh-portable commits f3cbe43e28fe and bf944e3794ef, backported
to OpenSSH 7.9p1 on stable/13.

Reviewed by: delphij
Security: CVE-2021-41617
Differential Revision: https://reviews.freebsd.org/D32460

(cherry picked from commit 172fa4aa7577915bf5ace5783251821d3774dc05)

2 years agousr.bin/gh-bc, contrib/bc: update to version 5.0.0
Stefan Eßer [Tue, 10 Aug 2021 08:42:54 +0000 (10:42 +0200)]
usr.bin/gh-bc, contrib/bc: update to version 5.0.0

Merge commit 2f57ecae4b98e76e5d675563785a7e6c59c868c4

This is a new major release with a number of changes and extensions:

- Limited the number of temporary numbers and made the space for them
  static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
  and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
  environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
  and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
  left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.

MFC after: 1 week

(cherry picked from commit 44d4804d1945435745518cd09eb8ae6ab22ecef4)

vendor/bc: update to upstream version 5.0.2

(cherry picked from commit a60ef1802a36f2f2a5611564191440ea1c1e2f17)
(cherry picked from commit 662087dfd0668dee82ed20d00ced662aa3595059)

contrib/bc: remove files ommitted from the release

A number of files have been removed from the release distribution of
this bc implementation. They were mostly relevant for pre release
testing and benchmarking to identify regressions. The Markdown
sources of the man pages are only relevant for combinations of build
options not used in FreeBSD and need non-default conversion tools
(available as ports in FreeBSD).

All the omitted files can be found in the upstream git repository,
and they are fetched when building this software as a port. But they
have never been used in the FreeBSD base system.

(cherry picked from commit ea31d1a5c490193348e0b71fdda6d08a2c80a2eb)

Remove files that were checked in with wrong .gitattributes

These files will be added back in updated form, but are only relevant
for the Windows platform, anyway.

(cherry picked from commit d6c323eda215d05091f56d02a8274eb50c244a6f)

contrib/bc: merge version 5.1.0 from vendor branch

This version adds options and functions that allow to print numbers
in the open interval (-1 .. 1) with or without a leading 0 digit.

Additionally, an option has been added to prevent line wrap and
allows to print arbitrarily long results on a single line.

Merge commit '5d58a51571721190681c50d4bd3a1f45e6282d72'

(cherry picked from commit d43fa8ef534ac87a16843d45264f56cf11e0fcbc)

contrib/bc: update to version 5.1.1

Merge commit '6f49f5cdde1c62c4e5a743e895f3afe592b5c0e5'

(cherry picked from commit a30efc5ca7272e446abb71f0d72c76539f267bb6)

contrib/bc: temporarily disconnect the tests for 5.0.2

The tests that come with version 5.0.2 have been extended to cover the
line editing functions. It has been found that these tests generate
false negative results in FreeBSD, most likely due to an issue in the
pexpect functionality used.

These history tests are skipped on systems that do not have python and
py-pexpect installed (and thus are unlikely to cause CI test failures),
but in order to not cause irritating failures on systems were these
packages are in fact installed, I temporarily disconnect them.

I had planned to skip this version due to the issue with the history
tests, but some committer has asked me to go ahead since the currently
used version 5.0.0 contains a macro name that collides with a project
he is working on.

No MFC of this version is planned. A version 5.0.3 is expected to be
released soon, and that version will allow to reconnect the tests and
will be MFCed.

(cherry picked from commit f774652b0e837be415abd20935eae3466ea34a20)

Add back Windows only VCXProj files

(cherry picked from commit ded0d3d486eba766f613070de0ed12029a9a3816)

contrib/bc: re-enable tests after the import of version 5.1.0

The tests have been fixed to not write any data outside of the
temporary work directory provided by the test framework.

MFC after: 3 days

(cherry picked from commit b8d895faf47afb8f3b31055e2ec2db8d0df5db23)

Revert erroneous commit ded0d3d486eba

These files came from a prior commit to contrib/bc and seem to have
been placed in the top of the source tree by a failed git rebase.

Reported by: markj

(cherry picked from commit f902ca97bdbceccf62b4b02b0321af91ea398925)

2 years agomlx4en(4): Fix wrong mbuf cluster size in mlx4_en_debugnet_init()
Hans Petter Selasky [Tue, 5 Oct 2021 08:46:56 +0000 (10:46 +0200)]
mlx4en(4): Fix wrong mbuf cluster size in mlx4_en_debugnet_init()

This fixes an "invalid cluster size" panic when debugnet is activated.

panic()
m_getzone()
debugnet_mbuf_reinit()
debugnet_any_ifnet_update()
ifhwioctl()
ifioctl()

Submitted by: ae@
PR: 258923
Sponsored by: NVIDIA Networking

(cherry picked from commit 5a7de2b42caf6241e87b417a0521e9ab303989d7)

2 years agosound(4): Implement mixer mute control for feeder channels.
Hans Petter Selasky [Tue, 28 Sep 2021 07:41:18 +0000 (09:41 +0200)]
sound(4): Implement mixer mute control for feeder channels.

PR: 258711
Differential Revision: https://reviews.freebsd.org/D31636
Sponsored by: NVIDIA Networking

(cherry picked from commit 4a83ca1078e3ec70159741b51a6b48e844ada9f5)

2 years agoObsoleteFiles.inc: stop removing pthread_mutexattr_get/setpshared.3
Konstantin Belousov [Sun, 10 Oct 2021 14:38:20 +0000 (17:38 +0300)]
ObsoleteFiles.inc: stop removing pthread_mutexattr_get/setpshared.3

(cherry picked from commit 24b51c7295db6b316250f0288aaf05660a81063e)

2 years agomlx5_en: fix use of CALLOUT_DIRECT
Konstantin Belousov [Wed, 8 Sep 2021 15:37:20 +0000 (18:37 +0300)]
mlx5_en: fix use of CALLOUT_DIRECT

(cherry picked from commit 0eb2dcd32ea6fb59661d709872e02ea6b3e7b9e2)

2 years agoRemove obsolete amd(8) rc.conf configuration
Tom Hukins [Tue, 5 Oct 2021 14:34:52 +0000 (14:34 +0000)]
Remove obsolete amd(8) rc.conf configuration

The script that used these was removed in 13f7dbe822d5f along with amd
itself.

Fixes: 13f7dbe822d5 ("retire amd(8)")
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/548

(cherry picked from commit 70ffa69e1bc7d6acbe061315743b1407b7d722d8)

2 years agoRPCBIND: skip ipv6 link local when request is not from link local address
David Bright [Mon, 4 Oct 2021 15:43:41 +0000 (08:43 -0700)]
RPCBIND: skip ipv6 link local when request is not from link local address

RPCINFO on macOS behaves different compared to other linux clients and
doesn't provide request address in rpcb structure of the
RPCBPROC_GETADDRLIST call which doesn't seem to be forbidden.

In this case RPCBIND uses RPC call's source address and picks a
closest corresponding local address. If there are no addresses in the
same subnet as the source address, return of RPCBIND may vary
depending on the order of addresses returned in getifaddrs. If a link
local precedes global address it may be returned even if the request
comes from neither a link local nor from link local in a different
scope, which will prevent services like nfs from working in tpc6
scenario on macOS clients. Issue can be seen only on FreeBSD rpcbind
port due to changes in workflow of addrmerge call.

Submitted by: Dmitry Ovsyannikov (Dmitry.Ovsyannikov@dell.com)
Sponsored by: Dell EMC

(cherry picked from commit d18c9a91979543adc182c7b28819691b64fda388)

2 years agoFix the arm64 L2_BLOCK_MASK definition
Andrew Turner [Tue, 21 Sep 2021 13:46:10 +0000 (13:46 +0000)]
Fix the arm64 L2_BLOCK_MASK definition

It was missing the top 16 bits.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5a619ca07a2d6614b7b4ecbb7078d0949702dcd2)

2 years agoAdd ELF macros found in the aaelf64 spec
Andrew Turner [Mon, 20 Sep 2021 08:55:44 +0000 (08:55 +0000)]
Add ELF macros found in the aaelf64 spec

The arm64 aaelf64 spec [0] has DT_AARCH64_ that could be used with
dynamic linking. It also adds GNU_PROPERTY_AARCH64_FEATURE_1_AND used
to tell the kernel which CPU features the binary is compatible with,
but does not require to execute correctly.

Add these values so the kernel and elf tools can make use of them.

[0] https://github.com/ARM-software/abi-aa/blob/2021Q1/aaelf64/aaelf64.rst

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b94d360e4aa66d626ad5a0acde683ae9a9c71729)

2 years agoUse a 64 bit read to access GICR_TYPER
Andrew Turner [Wed, 15 Sep 2021 09:13:41 +0000 (09:13 +0000)]
Use a 64 bit read to access GICR_TYPER

The GICv3 ITS only needs to implement 32 bit access to the GICR_TYPER
when the CPU implements AArch32. As this may not always be the case
use a 64 bit read when checking if the ITS is enabled on the CPU.

PR: 258217
Reported by: Olivier Delande <olivier.delande@provenrun.com>
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1896a0094317c80d46beff5ad42b68215513c996)

2 years agovfs: hoist cn_thread assert in namei
Mateusz Guzik [Fri, 1 Oct 2021 21:13:38 +0000 (23:13 +0200)]
vfs: hoist cn_thread assert in namei

Making it condtional on whether ktrace happens to be enabled makes no
sense.

(cherry picked from commit c9536389d732feecf61afa4632397d67b04b2ab4)

2 years agolinprocfs: find cwd and root handling
Mateusz Guzik [Thu, 30 Sep 2021 10:50:18 +0000 (12:50 +0200)]
linprocfs: find cwd and root handling

The code would incorrectly use curthread instead of the target proc to
resolve vnodes.

Fixes: 8d03b99b9dafe928 ("fd: move vnodes out of filedesc into a dedicated structure")
PR: 258729
Noted by:  Damjan Jovanovic <damjan.jov@gmail.com>

(cherry picked from commit 69ab52838655912cf89699e0b2d21d244d3b9b27)

2 years agofd: add pwd_hold_proc
Mateusz Guzik [Thu, 30 Sep 2021 10:49:51 +0000 (12:49 +0200)]
fd: add pwd_hold_proc

(cherry picked from commit 85c855d31b18d7a8ab534259f27444c81b6ec797)

2 years agommc: fix 1-byte reallocs (when it should have been sizeof device_t)
Mateusz Guzik [Sat, 25 Sep 2021 12:49:43 +0000 (14:49 +0200)]
mmc: fix 1-byte reallocs (when it should have been sizeof device_t)

Reported by KASAN:
panic: ASan: Invalid access, 8-byte write at 0xfffffe00f0992610, RedZonePartial(1)
panic() at panic+0xb5/frame 0xffffffff86a595b0
__asan_store8_noabort() at __asan_store8_noabort+0x376/frame 0xffffffff86a59670
mmc_go_discovery() at mmc_go_discovery+0x6c61/frame 0xffffffff86a5a790
mmc_delayed_attach() at mmc_delayed_attach+0x35/frame 0xffffffff86a5a7b0
[snip]

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

(cherry picked from commit 13c63ae08df43d4e662b73ea3e05137fff88e639)

2 years agofifo: support flock
Mateusz Guzik [Sat, 25 Sep 2021 12:24:39 +0000 (14:24 +0200)]
fifo: support flock

This evens it up with Linux.

Original patch by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D24255#565302

(cherry picked from commit d71e1a883c92b8b166eea59734850acd54048d72)

2 years agoipsec: enter epoch before calling into ipsec_run_hhooks
Mateusz Guzik [Fri, 17 Sep 2021 12:00:20 +0000 (14:00 +0200)]
ipsec: enter epoch before calling into ipsec_run_hhooks

pfil_run_hooks which eventually can get called asserts on it.

Reviewed by: ae
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32007

(cherry picked from commit 590d0715b348d0d8da0c0355cebd9dff18e39831)

2 years agovfs: add missing VIRF_MOUNTPOINT in vfs_mountroot_shuffle
Mateusz Guzik [Sat, 18 Sep 2021 08:13:33 +0000 (10:13 +0200)]
vfs: add missing VIRF_MOUNTPOINT in vfs_mountroot_shuffle

Reported by: mav

(cherry picked from commit 7b2ac8eb9be76c96356b6e9a7c06a8080ea841ae)

2 years agovfs: add the missing vnode interlock in vfs_mountroot_shuffle
Mateusz Guzik [Sat, 18 Sep 2021 08:12:27 +0000 (10:12 +0200)]
vfs: add the missing vnode interlock in vfs_mountroot_shuffle

Around v_mountedhere assignment.

(cherry picked from commit 0d9e99ce3b1071c76ff5a2d9d4158341c0371c2f)

2 years agolockmgr: fix lock profiling of face adaptive spinning
Mateusz Guzik [Sat, 11 Sep 2021 18:23:51 +0000 (18:23 +0000)]
lockmgr: fix lock profiling of face adaptive spinning

(cherry picked from commit f902e4bb04ad717935a97ce1ae59e2dd389d940d)

2 years agocache: count vnodes in cache_purgevfs
Mateusz Guzik [Sat, 18 Sep 2021 08:30:15 +0000 (10:30 +0200)]
cache: count vnodes in cache_purgevfs

(cherry picked from commit a2cb65b8fe975a8f228258e3057b62e068dbf8e2)

2 years agovfs: retire VNODE_REFCOUNT_FENCE_* macros
Mateusz Guzik [Sat, 18 Sep 2021 08:14:35 +0000 (10:14 +0200)]
vfs: retire VNODE_REFCOUNT_FENCE_* macros

They are unused as of last year.

(cherry picked from commit 5d8e32a66c1700323c570d25b03672f35f4e0110)

2 years agoprometheus_sysctl_exporter(8): filter output using a regex
Robert Wing [Fri, 8 Oct 2021 01:00:27 +0000 (17:00 -0800)]
prometheus_sysctl_exporter(8): filter output using a regex

Add two options, -i and -e, for filtering prometheus metrics.

Each option takes a regular expression as an argument. The provided
regex will be tested against the prometheus metric name.

The -i option includes metrics matching the given regex.
The -e option excludes metrics matching the given regex.

Sponsored by:   Modirum MDPay
Sponsored by:   Klara Inc.
Reviewed by: 0mp, debdrup
Differential Revision: https://reviews.freebsd.org/D32269

(cherry picked from commit 8ff2b52241400f2b5c2287b91e6e12b97ffd5773)

2 years agokern_ctf: Use zlib's uncompress function for simpler code.
Yoshihiro Ota [Sun, 26 Sep 2021 06:28:43 +0000 (23:28 -0700)]
kern_ctf: Use zlib's uncompress function for simpler code.

Reviewed by: markj, delphij
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21531

2 years agopci_pci: Support growing bus ranges in bus_adjust_resource for NEW_PCIB
Jessica Clarke [Sun, 3 Oct 2021 18:35:26 +0000 (19:35 +0100)]
pci_pci: Support growing bus ranges in bus_adjust_resource for NEW_PCIB

This is the same underlying problem as 262459806433, just for bus ranges
rather than windows. SiFive's HiFive Unmatched has the following
topology:

  Root Port <---> Bridge <---> Bridge <-+-> Bridge <---> (Unused)
   (pcib0)        (pcib1)      (pcib2)  |   (pcib3)
                                        +-> Bridge <---> xHCI
                                        |   (pcib4)
                                        +-> Bridge <---> M.2 E-key
                                        |   (pcib5)
                                        +-> Bridge <---> M.2 M-key
                                        |   (pcib6)
                                        +-> Bridge <---> x16 slot
                                            (pcib7)

If a device is plugged into the x16 slot that itself has a bridge, such
as many graphics cards, we currently fail to allocate a bus number for
its child bus (and so pcib_attach_child skips adding a child bus for
further enumeration) as, when the new child bridge attaches, it attempts
to allocate a bus number from its parent (pcib7) which in turn attempts
to grow its own bus range by calling bus_adjust_resource on its own
parent (pcib2) whose bus rman cannot accommodate the request and needs
to itself be extended by calling its own parent (pcib1). Note that
pcib3-7 do not face the same issue when they attach since pcib1 ends up
managing bus numbers 1-255 from the beginning and so never needs to grow
its own range.

Reviewed by: jhb, mav
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32011

(cherry picked from commit 31776afdc79d5fb1ea211cc2a69c17c62b3dc8ff)

2 years agoriscv: Add vt and kbdmux to GENERIC for video console support
Jessica Clarke [Sun, 3 Oct 2021 18:34:53 +0000 (19:34 +0100)]
riscv: Add vt and kbdmux to GENERIC for video console support

No in-tree drivers are supported for RISC-V (given it supports UEFI we
could enable the EFI framebuffer, but U-Boot has very limited hardware
support and EDK2 remains a work in progress), but drm-kmod exists with
drivers for video cards that can be used with the HiFive Unmatched.

Reviewed by: imp, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32001

(cherry picked from commit 2404f03fca7e5f62946d0da0f614c9db75a0df09)

2 years agoLinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards
Jessica Clarke [Sun, 3 Oct 2021 18:34:40 +0000 (19:34 +0100)]
LinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards

One of the three uses is already guarded; this guards the remaining ones
to support architectures like riscv that do not provide write-combining,
and is needed to build drm-kmod on riscv.

Reviewed by: hselasky, manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31999

(cherry picked from commit 8167c92f65bc20145467b3b98c842cde57736900)

2 years agolibgcc_s: Export 64-bit int to 128-bit float functions
Jessica Clarke [Sun, 3 Oct 2021 18:34:25 +0000 (19:34 +0100)]
libgcc_s: Export 64-bit int to 128-bit float functions

The corresponding 32-bit int and 128-bit int functions were added in
790a6be5a169, as were all combinations of the float to int functions,
but these two were overlooked. __floatditf is needed to build curl for
riscv as there's a signed 64-bit int to 128-bit float conversion in
lib/progress.c's trspeed as of 7.77.0.

Reviewed by: dim
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31997

(cherry picked from commit 7047568821a9019359a8518e1f1481f73d6e5445)

2 years agoriscv: Add a stub pmap_change_attr implementation
Jessica Clarke [Sun, 3 Oct 2021 18:33:47 +0000 (19:33 +0100)]
riscv: Add a stub pmap_change_attr implementation

pmap_change_attr is required by drm-kmod so we need the function to
exist. Since the Svpbmt extension is on the horizon we will likely end
up with a real implementation of it, so this stub implementation does
all the necessary page table walking to validate the input, ensuring
that no new errors are returned once it's implemented fully (other than
due to out of memory conditions when demoting L2 entries) and providing
a skeleton for that future implementation.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31996

(cherry picked from commit 1be2e16df1d29148aee83964330a71ae403c6078)

2 years agollvm-objcopy: Install llvm-strip link
Jessica Clarke [Mon, 13 Sep 2021 20:52:40 +0000 (21:52 +0100)]
llvm-objcopy: Install llvm-strip link

Just as elftoolchain's objcopy doubles as strip, so does LLVM's. Note
that we do not currently have a committed copy of the manpage generated
from the rST source so no manpage is installed for llvm-strip.

(Note this is only a partial MFC, as WITH_LLVM_BINUTILS was not MFC'ed)

Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>
Tested by: Shawn Webb <shawn.webb@hardenedbsd.org>
MFC after: 1 week

(cherry picked from commit f28c1d0c5c6c6532df0dfa38eaf804343988d163)

2 years agolibc: Fix build on case-insensitive file systems
Jessica Clarke [Fri, 10 Sep 2021 00:19:38 +0000 (01:19 +0100)]
libc: Fix build on case-insensitive file systems

On case-insensitive file systems (most likely to be seen on macOS, where
it is the default), _Fork.o for the new POSIX _Fork function conflicts
with _fork.o for the PSEUDO file. This results in non-determinsitic
behaviour in terms of which ends up being present; if _Fork.o wins then
the build fails to link libc.so due to missing __sys_fork, and if
_fork.o wins then libc silently fails to include the implementation of
_Fork. A similar issue occurred in the past for C99's _Exit conflicting
with exit(2) and was fixed in cb1cb6a2a83f, so this adds a fix based on
that.

As a longer-term solution it might be better to instead make the
generated files use a different prefix that's less likely to conflict
with other things (such as __sys_foo.o given they always contain that)
but that's a rather more invasive change.

Fixes: 49ad342cc10c ("Add _Fork()")
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31895

(cherry picked from commit 877175a17a0a5da3f4f43ca9f38adb04042f4cf5)

2 years agoreadlinkat(2): allow O_PATH fd
Konstantin Belousov [Sat, 9 Oct 2021 05:12:05 +0000 (08:12 +0300)]
readlinkat(2): allow O_PATH fd

PR: 258856

(cherry picked from commit 5fb54d2fc845464ea809e6a1a69380693943cf51)

2 years agovm_fault: do not trigger OOM too early
Konstantin Belousov [Mon, 4 Oct 2021 06:36:02 +0000 (09:36 +0300)]
vm_fault: do not trigger OOM too early

(cherry picked from commit 174aad047e12e8f30f9a5919ca1c08919441a217)

2 years agoMake core dump writes interruptible with SIGKILL
Konstantin Belousov [Tue, 5 Oct 2021 05:11:32 +0000 (08:11 +0300)]
Make core dump writes interruptible with SIGKILL

(cherry picked from commit b5cadc643e853fa4cb23e5315e6f40bf9979a9c0)