FreeBSD/src f7b368dlib/libc/gen rtld_get_var.3

rtld_get_var(3): provide explicit list of rtld vars that can be modified

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D56055
DeltaFile
+17-0lib/libc/gen/rtld_get_var.3
+17-01 files

FreeBSD/src 9f16078libexec/rtld-elf/tests set_var_test.c Makefile

rtld: add a test for rtld_set_var (with LIBRARY_PATH_FDS)

PR:     294054
Reviewed by:    kib
MFC after:      1 week
DeltaFile
+38-0libexec/rtld-elf/tests/set_var_test.c
+1-0libexec/rtld-elf/tests/Makefile
+39-02 files

FreeBSD/src b9f046dlibexec/rtld-elf rtld.c

rtld: properly handle update of several vars in rtld_set_var()

Besides setting the value in the array of the values, rtld sometimes
needs to recalculate some internal control variable for the change to
take effect.  Allow the variable description to supply a method called
on the update.  Lock the function with the bind lock for safe operation.

Mark several variables as allowed for update, since the on_update method
is provided for them.  The list is LD_BIND_NOW, LD_BIND_NOT,
LD_LIBMAP_DISABLE, LD_LOADFLTR.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D56055
DeltaFile
+152-36libexec/rtld-elf/rtld.c
+152-361 files

FreeBSD/src f39754dlib/msun/aarch64 fenv.h, lib/msun/amd64 fenv.c

fenv.h: stop declaring feclearexcept() extern inline

The function is already exported from libm.  We only need to stop
declare it extern inline, and instead provide a macro which uses the
internal inline function __feclearexcept_int() instead.

PR:     277958
Reviewed by:    dim (x86)
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55975
DeltaFile
+5-2lib/msun/aarch64/fenv.h
+6-1lib/msun/amd64/fenv.c
+6-1lib/msun/arm/fenv.c
+6-1lib/msun/i387/fenv.c
+6-1lib/msun/powerpc/fenv.c
+5-2lib/msun/x86/fenv.h
+34-85 files not shown
+58-1311 files

FreeBSD/src 7e7d4e7sys/x86/x86 cpu_machdep.c tsc.c

x86: Handle when MPERF/APERF MSRs aren't writable

For performance and/or correct reasons some hypervisors allow
MPERF/APERF MSRs to be read but not written to. This change
modifies the handling of these MSRs to not rely on writes.
This patch is part of Google Cloud Engine (GCE) C4-LSSD turnup.

Sponsored by:           Google
Tested by:              NetApp (previous)
PR:                     292808
MFC after:              3 days
Co-authored-by:         Jim Mattson <jmattson at google.com>
Reviewed by:            jrtc27, imp, kib, markj, olce, obiwac
Differential Revision:  https://reviews.freebsd.org/D55996
DeltaFile
+7-7sys/x86/x86/cpu_machdep.c
+6-3sys/x86/x86/tsc.c
+13-102 files

FreeBSD/src c505fc1sys/x86/x86 cpu_machdep.c

x86: Guard clock frequency against a divide by 0

We may be running in a Virtual Machine which may not fully support
hardware performance counters. If the MPERF counter somehow ends up
at zero, return an error and fail gracefully instead of panicking.
This patch is part of Google Cloud Engine (GCE) C4-LSSD turnup.

Sponsored by:           Google
Tested by:              NetApp (previous)
PR:                     292808
MFC after:              3 days
Co-authored-by:         Aymeric Wibo <obiwac at google.com>
Co-authored-by:         Jim Mattson <jmattson at google.com>
Suggested by:           jrtc27 (split out this part)
Reviewed by:            imp, obiwac, olce
Differential Revision:  https://reviews.freebsd.org/D56056
DeltaFile
+8-1sys/x86/x86/cpu_machdep.c
+8-11 files

FreeBSD/src 4b16ff4tests/sys/kern timerfd.c

timerfd: Guard expected performance failure

During the timerfd__periodic_timer_performance test, only expect
failures when the expiration count is less than 400000000. This
prevents the test from being reported as a true failure in environments
where scheduling latency is high enough to delay timerfd wakeups.

Fixes:          cb692380f1e0 ("timerfd: Expect periodic timer ...")
MFC after:      1 week
DeltaFile
+2-1tests/sys/kern/timerfd.c
+2-11 files

FreeBSD/src 557f502sys/amd64/conf NOTES, sys/i386/conf MINIMAL

sys: vt_efifb: EFI not supported on i386; move it back to amd64/NOTES

We do not support EFI boot on i386.  Thus:
1. Move (back) 'device vt_efifb' from x86/NOTES to amd64/NOTES.
2. Remove 'device vt_efifb' from i386/MINIMAL.

Reported by:    jhb
Fixes:          f224591746bd ("Add ASMC_DEBUG make option")
Fixes:          67599eef01f5 ("sys/x86/NOTES: Add vt_efifb")
Sponsored by:   The FreeBSD Foundation
(cherry picked from commit 9c25620e57f01d8227f0d53c6b2134ab37a49fdf)
DeltaFile
+3-0sys/amd64/conf/NOTES
+0-1sys/i386/conf/MINIMAL
+3-12 files

FreeBSD/src 6a1ebd1sys/fs/fuse fuse_node.h fuse_node.c, tests/sys/fs/fusefs read.cc rename.cc

fusefs: redo vnode attribute locking

Previously most fields in fuse_vnode_data were protected by the vnode
lock.  But because DEBUG_VFS_LOCKS was never enabled by default until
stable/15 the assertions were never checked, and many were wrong.
Others were missing.  This led to panics in stable/15 and 16.0-CURRENT,
when a vnode was expected to be exclusively locked but wasn't, for fuse
file systems that mount with "-o async".

In some places it isn't possible to exclusively lock the vnode when
accessing these fields.  So protect them with a new mutex instead.  This
fixes panics and unprotected field accesses in VOP_READ,
VOP_COPY_FILE_RANGE, VOP_GETATTR, VOP_BMAP, and FUSE_NOTIFY_INVAL_ENTRY.
Add assertions everywhere the protected fields are accessed.

Lock the vnode exclusively when handling FUSE_NOTIFY_INVAL_INODE.

During fuse_vnode_setsize, if the vnode isn't already exclusively
locked, use the vn_delayed_setsize mechanism.  This fixes panics during

    [14 lines not shown]
DeltaFile
+192-0tests/sys/fs/fusefs/read.cc
+80-11sys/fs/fuse/fuse_node.h
+90-0tests/sys/fs/fusefs/rename.cc
+71-18sys/fs/fuse/fuse_node.c
+74-7sys/fs/fuse/fuse_vnops.c
+24-18sys/fs/fuse/fuse_internal.c
+531-545 files not shown
+609-7911 files

FreeBSD/src 9ac21f8tests/sys/fs/fusefs bmap.cc

fusefs: add a regression test for a cluster_read bug

VOP_BMAP is purely advisory.  If VOP_BMAP returns an error during
readahead, cluster_read should still succeed, because the actual data
was still read just fine.

Add a regression test for PR 264196, wherein cluster_read would fail if
VOP_BMAP did.

PR:             264196
Reported by:    danfe
Reviewed by:    arrowd
Differential Revision: https://reviews.freebsd.org/D51316

(cherry picked from commit 6d408ac490730614b3ed0ebd3caffcd23f303fb4)
DeltaFile
+87-0tests/sys/fs/fusefs/bmap.cc
+87-01 files

FreeBSD/src 1ebccc3sys/kern vfs_cluster.c

vfs_cluster.c: Do not propagate VOP_BMAP errors to the caller

The code that makes this VOP_BMAP call tries to perform a read-ahead I/O
operation. Failing to do that for any reason isn't fatal for `cluster_read()`,
because we still can return some data to the caller. This change is consistent
with other places within `cluster_read()`, where error returned by VOP_BMAP is
not returned to the caller - see the `if (nblks > 1)` block above the changed
lines and `if (reqbp)` at the end of the function.

PR:     264196
Approved by:    markj, kib
Differential Revision: https://reviews.freebsd.org/D51254

(cherry picked from commit 62aef3f73f38db9fb68bffc12cc8900fecd58f0e)
DeltaFile
+3-1sys/kern/vfs_cluster.c
+3-11 files

FreeBSD/src d069250sys/fs/fuse fuse_ipc.c fuse_ipc.h

fusefs: remove the obsolete rename_lock

This lock was included in the original GSoC submission.  Its purpose
seems to have been to prevent concurrent FUSE_RENAME operations for the
current mountpoint, as well as to synchronize FUSE_RENAME with
fuse_vnode_setparent.  But it's obsolete, now that ef6ea91593e added
mnt_renamelock .

Sponsored by:   ConnectWise
Reviewed by:    kib
Differential Revision: https://reviews.freebsd.org/D55231

(cherry picked from commit 7755a406a6ae3801e885a79f714155f97c4d2bc6)
DeltaFile
+0-2sys/fs/fuse/fuse_ipc.c
+0-2sys/fs/fuse/fuse_ipc.h
+0-2sys/fs/fuse/fuse_vnops.c
+0-63 files

FreeBSD/src 1ce3d3ftests/sys/aio aio_test.c

aio(4) tests: do not rely on (int *)-1 being invalid address

Explicitly mmap guard and use it as the invalid address instead.

(cherry picked from commit dc9a8d300ba5c4c319589d78231e9d0e76576cbf)
DeltaFile
+6-1tests/sys/aio/aio_test.c
+6-11 files

FreeBSD/src 34ecd90tests/sys/kern pdwait.c Makefile

Add tests for pdwait

Sponsored by:   ConnectWise

(cherry picked from commit 277539ae7f2f07a8dd29d4deb318d66414f8ae2a)

pdwait(2) tests: do not rely on (int *)-1 being invalid address

Explicitly mmap guard and use it as the invalid address instead.

(cherry picked from commit 05492ff6f636108c4fac40c259defe9b2eac7833)
DeltaFile
+309-0tests/sys/kern/pdwait.c
+1-0tests/sys/kern/Makefile
+310-02 files

FreeBSD/src c595e21tests/sys/kern procdesc.c Makefile

procdesc: Add a test for pid recycling behavior

Sponsored by:   ConnectWise

(cherry picked from commit e35df41f68916cc23893a29e0284f386ec727462)
DeltaFile
+98-0tests/sys/kern/procdesc.c
+1-0tests/sys/kern/Makefile
+99-02 files

FreeBSD/src e3e71c6tests/sys/capsicum Makefile

tests: sys/capsicum/functional requires mqueuefs

Skip this test if mqueuefs isn't loaded.  Unfortunately, that will skip
the entire googletest test program, including test cases that don't
require mqueuefs.  But the test's own skipping logic doesn't work, and
we don't yet have a googletest-compatible require_kmods() function.

Sponsored by:   ConnectWise
Reviewed by:    emaste, ngie
Differential Revision: https://reviews.freebsd.org/D54902

(cherry picked from commit df68a09ea2ec18ee975fb937d46a18250d4663c8)
DeltaFile
+1-0tests/sys/capsicum/Makefile
+1-01 files

FreeBSD/src 04d58d5lib/libc/gen syslog.3, sbin/dmesg dmesg.8

manuals: System message vs kernel message

Wordsmith mentions throughout the manual of syslog and dmesg, to clearly
differentiate them in an externally consisteny way, increasing operator
onboarding speed and elegance.

The daemon that handles general system messages, syslog, describes them
as "system messages", and "messages" is the standard filename. Rewrite
syslog related manual titles to align search results with this, and hier
entries to align the index. Use care to maintain keywords and not add
extra lines. Newsyslog trades "maintain" with "rotate" for visibility.

MFC after:      3 days
Reviewed by:    markj
Closes:         https://github.com/freebsd/freebsd-src/pull/2067
DeltaFile
+2-4usr.sbin/newsyslog/newsyslog.conf.5
+3-3sbin/dmesg/dmesg.8
+3-3share/man/man7/hier.7
+2-4usr.sbin/syslogd/syslog.conf.5
+2-2lib/libc/gen/syslog.3
+2-2usr.sbin/newsyslog/newsyslog.8
+14-186 files

FreeBSD/src 1e2c9bclib/libsys kldload.2

kldload.2: Provide more info about file argument

The information is basically taken from kldload(8).

Reviewed by:            kib, ziaee
Differential Revision:  https://reviews.freebsd.org/D55170
DeltaFile
+15-2lib/libsys/kldload.2
+15-21 files

FreeBSD/src 23d6516lib/libc/amd64/string strrchr.S

libc/amd64/strrchr.S: fix rebase error

I accidentally dropped a part of the patch on squash rebase.
Should be fine now.

Fixes:          253f15c016ca699906f78b8e522a3f7ed675929b
PR:             293915
MFC after:      1 week
DeltaFile
+4-4lib/libc/amd64/string/strrchr.S
+4-41 files

FreeBSD/src 253f15clib/libc/amd64/string strrchr.S

libc/amd64/strrchr.S: rewrite and fix scalar implementation

The original scalar implementation of strrchr() had incorrect
logic that failed if the character searched for was the NUL
character.  It was also possibly affected by the issue fixed
in 3d8ef251a for strchrnul().

Rewrite the function with logic that actually works.  We defer
checking for the character until after we have checked for NUL.
When we encounter the final NUL byte, we mask out the characters
beyond the tail before checking for a match.

This bug only affects users running on amd64 with ARCHLEVEL=scalar
(cf. simd(7)).  The default configuration is not affected.

The bug was unfortunately not caught by the unit test inherited
from NetBSD.  An extended unit test catching the issue is proposed
in D56037.


    [6 lines not shown]
DeltaFile
+26-52lib/libc/amd64/string/strrchr.S
+26-521 files

FreeBSD/src 9b98c4busr.bin/diff diffreg.c

diff: handle read(2) failures

MFC After:      1 week
DeltaFile
+5-0usr.bin/diff/diffreg.c
+5-01 files

FreeBSD/src f088a26sbin/route route_netlink.c

route(8): Fix -expire argument when using netlink

Also fixes nexthop expire value on route get using netlink.

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

(cherry picked from commit 8230cf1aa18d9215ee17fec743fc7c7c8fa2da13)
DeltaFile
+4-6sbin/route/route_netlink.c
+4-61 files

FreeBSD/src 824f5e7usr.bin/netstat route_netlink.c

netstat(1): Fix expire column in -r flag using netlink

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

(cherry picked from commit 2f7cfeebcc4356d3bb85e953900ba5d3f75831ff)
DeltaFile
+3-2usr.bin/netstat/route_netlink.c
+3-21 files

FreeBSD/src b51cfb5sys/netlink netlink_snl_route_parsers.h, sys/netlink/route rt.c

rtnetlink: Add support for nexthop expiration in new/get route

Before this change, netlink only shows nexthop
expire value if route is not multipath.
Now it can set expire time during route creation.
Also, show expire time of multipath nexthops.

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

(cherry picked from commit ff6d1faa65a1a77d04746b43023feb457cfa27b8)
DeltaFile
+11-1sys/netlink/route/rt.c
+2-0sys/netlink/netlink_snl_route_parsers.h
+13-12 files

FreeBSD/src 33424fdusr.bin/diff3 diff3.c

diff3: plug fd leak

MFC After:      1 week
Reported by:    kib
DeltaFile
+1-0usr.bin/diff3/diff3.c
+1-01 files

FreeBSD/src 6d8b2acusr.bin/diff pr.c

diff: prefer posix_spawn over pdfork/execl

MFC After:              1 week
Reviewed by:            kib
Differential Revision:  https://reviews.freebsd.org/D56076
DeltaFile
+39-23usr.bin/diff/pr.c
+39-231 files

FreeBSD/src 5f7f0efusr.bin/diff3 diff3.c

diff3: prefer posix_spawn over pdfork/execlp

MFC After:              1 week
Reviewed by:            kib
Differential Revision:  https://reviews.freebsd.org/D56075
DeltaFile
+29-18usr.bin/diff3/diff3.c
+29-181 files

FreeBSD/src 981cd08sys/vm vm_mmap.c

Provide more precise error explanations for mmap(2) EINVAL errors.

Reviewed by:  kib
Differential Revision: https://reviews.freebsd.org/D55888
Sponsored by: Netflix

(cherry picked from commit dad6e6fc1ea4b737e9f1661ebd30da5d551e3d4a)
DeltaFile
+23-13sys/vm/vm_mmap.c
+23-131 files

FreeBSD/src b0ef93asys/vm vm_mmap.c

Delete error-check code that can never happen.

Near the top of kern_mmap() that implements the mmap(2) system call,
it sets

        prot = PROT_EXTRACT(prot);

with

So prot can only be the three PROT_ flags.

The following test of the user's mmap(2) parameters (near line 275
in vm/vm_mmap.c):

        if (prot != PROT_NONE &&
            (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) != 0) {
                return (EXTERROR(EINVAL, "invalid prot %#jx", prot));
        }


    [8 lines not shown]
DeltaFile
+0-4sys/vm/vm_mmap.c
+0-41 files

FreeBSD/src 5c4e558. UPDATING, sys/conf newvers.sh

Add UPDATING entries and bump version

Approved by:    so
DeltaFile
+5-0UPDATING
+1-1sys/conf/newvers.sh
+6-12 files