]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agofreebsd32: sync some audit types with default ABI
Brooks Davis [Wed, 17 Nov 2021 20:12:27 +0000 (20:12 +0000)]
freebsd32: sync some audit types with default ABI

Reviewed by: kevans

2 years agofreebsd32: sync return types with default ABI
Brooks Davis [Wed, 17 Nov 2021 20:12:26 +0000 (20:12 +0000)]
freebsd32: sync return types with default ABI

This consists of int -> ssize_t where required and one int -> mode_t.
As a rule, return types are informative rather than functional as the
actual return is in a register.

Reviewed by: kevans

2 years agofreebsd32: semid_t -> int32_t
Brooks Davis [Wed, 17 Nov 2021 20:12:26 +0000 (20:12 +0000)]
freebsd32: semid_t -> int32_t

semid_t is historically an intptr_t so it should be an int32_t.

Reviewed by: kevans

2 years agofreebsd32: update unimplemented syscall comments
Brooks Davis [Wed, 17 Nov 2021 20:12:26 +0000 (20:12 +0000)]
freebsd32: update unimplemented syscall comments

These were out of sync with sys/kern/syscalls.master

Reviewed by: kevans

2 years agofreebsd32: use __socklen_t consistently
Brooks Davis [Wed, 17 Nov 2021 20:12:26 +0000 (20:12 +0000)]
freebsd32: use __socklen_t consistently

Reviewed by: kevans

2 years agofreebsd32: tag RESERVED syscalls
Brooks Davis [Wed, 17 Nov 2021 20:12:26 +0000 (20:12 +0000)]
freebsd32: tag RESERVED syscalls

This reduces diffs when generating freebsd32 files from the default
ABI's syscalls.master.

Reviewed by: kevans

2 years agofreebsd32: rename 32-bit compat pads to _pad
Brooks Davis [Wed, 17 Nov 2021 20:12:26 +0000 (20:12 +0000)]
freebsd32: rename 32-bit compat pads to _pad

Some 32-bit architectures pass 64-bit values in aligned
register pairs (a0,a1), (a2,a3) etc.  In freebsd32 we add these pads
explicitly from compat code.  We also sometimes add pads in the default
ABI.  Differentiate the two by making the freebsd32 ones int _pad.
In a future commit the 32-bit ones will be automatically generated.

Reviewed by: kevans

2 years agofreebsd32: have sigqueue take a void *
Brooks Davis [Wed, 17 Nov 2021 20:12:26 +0000 (20:12 +0000)]
freebsd32: have sigqueue take a void *

This matches the default ABI and we work around issues with
union sigval by extracting the bottom 32-bits in a manual handler.

Reviewed by: kevans

2 years agofreebsd32: fix getfsstat sign extension bugs
Brooks Davis [Wed, 17 Nov 2021 20:12:26 +0000 (20:12 +0000)]
freebsd32: fix getfsstat sign extension bugs

Add freebsd32 versions of getfsstat and freebsd11_getfsstat so that
bufsize is properly sign-extended if a negative value is passed.
Reject negative values before passing to kern_getfsstat as a size_t.

Reviewed by: kevans

2 years agofreebsd32: signed long corrections
Brooks Davis [Wed, 17 Nov 2021 20:12:26 +0000 (20:12 +0000)]
freebsd32: signed long corrections

Syscalls that take signed longs need to treat the 32-bit versions as
signed int so that sign extension happens correctly.  Improve
decleration quality and add a few minimal syscall implementations.

Reviewed by: kevans

2 years agofreebsd32: add missing pads to preadv and pwritev
Brooks Davis [Wed, 17 Nov 2021 20:12:25 +0000 (20:12 +0000)]
freebsd32: add missing pads to preadv and pwritev

Reviewed by: kevans

2 years agofreebsd32: add stubs for ofreebsd32_(send|recv)msg
Brooks Davis [Wed, 17 Nov 2021 20:12:25 +0000 (20:12 +0000)]
freebsd32: add stubs for ofreebsd32_(send|recv)msg

The upcoming change to generate freebsd32 generated files from
sys/kern/syscalls.master doesn't have a way to handle disabling
this one without disabling the non-COMPAT counterpart so just add
a stub for now.

Reviewed by: kevans

2 years agofreebsd32: add real abort2
Brooks Davis [Wed, 17 Nov 2021 20:12:25 +0000 (20:12 +0000)]
freebsd32: add real abort2

Previously, the code would copy twice as many pointers as specified
and print pairs of them a single 64-bit pointer.

abort2 doesn't return so make the return type void

freebsd32_abort2 is in it's own file with a 2-clause BSD license
based on a discussion with Wojciech many years ago.

Reviewed by: kevans

2 years agofreebsd32: add feed foward clock syscalls
Brooks Davis [Wed, 17 Nov 2021 20:12:25 +0000 (20:12 +0000)]
freebsd32: add feed foward clock syscalls

These are required when supporting i386 because time_t is 32-bit which
reduces struct bintime to 12-bytes when combined with the fact that 64-bit
integers only requiring 32-bit alignment on i386.  Reusing the default
ABI version resulted in 4-byte overreads or overwrites to userspace.

Reviewed by: kevans

2 years agofreebsd32: enable trivial syscalls
Brooks Davis [Wed, 17 Nov 2021 20:12:25 +0000 (20:12 +0000)]
freebsd32: enable trivial syscalls

These syscalls require no translation.  They were simply missing
from compat/freebsd32/syscalls.master.

Reviewed by: kevans

2 years agofreebsd32: don't implement kldsym
Brooks Davis [Wed, 17 Nov 2021 20:12:25 +0000 (20:12 +0000)]
freebsd32: don't implement kldsym

Previously we fell back to sys_kldsym, but because we'd always
mismatch on the version field we'd return EINVAL.  A freebsd32
implementation is impossible with the current ABI as there simply
isn't space to store a kernel virtual address in a uint32_t.

Reviewed by: kevans

2 years agofreebsd32: remove freebsd11_freebsd32_getdents
Brooks Davis [Wed, 17 Nov 2021 20:12:25 +0000 (20:12 +0000)]
freebsd32: remove freebsd11_freebsd32_getdents

It's exactly the same as freebsd11_getdents.

Reviewed by: kevans

2 years agofreebsd32: remove redundent osig*() implementations
Brooks Davis [Wed, 17 Nov 2021 20:12:25 +0000 (20:12 +0000)]
freebsd32: remove redundent osig*() implementations

ofreebsd32_sigprocmask, ofreebsd32_sigblock, ofreebsd32_sigsetmask,
and ofreebsd32_sigsuspend were all duplicates of the default ABI
versions and there are no type concerns as all arguments are the
same.

Reviewed by: kevans

2 years agofreebsd32: remove freebsd32_recvfrom
Brooks Davis [Wed, 17 Nov 2021 20:12:24 +0000 (20:12 +0000)]
freebsd32: remove freebsd32_recvfrom

The freebsd32_recvfrom() serves no purpose as no arguments require
translation.  The prototype was mis-declared and the implementation
contained (relatively harmless) errors.

Reviewed by: kevans

2 years agofreebsd32: remove redundant no-arg syscalls
Brooks Davis [Wed, 17 Nov 2021 20:12:24 +0000 (20:12 +0000)]
freebsd32: remove redundant no-arg syscalls

pipe requires no special handling.

ofreebsd32_sigpending did differ from osigpending in that it acted
on the siglist rather than the sigqueue, but this appears to be an
oversight in 3fbdb3c21524d9d95278ada1d61b4d1e6bee654b.

ogetpagesize could theoretically have ABI-dependent results, but in
practice does not. If it does it would be easy handle in the central
implementation and be the least of the problems in changing the value of
PAGE_SIZE.

Reviewed by: kevans

2 years agofreebsd32: simplify memrange translation
Brooks Davis [Wed, 17 Nov 2021 20:12:24 +0000 (20:12 +0000)]
freebsd32: simplify memrange translation

Assume we've been passed a valid argument and use _IOC_NEWTYPE to
translate the command as we do elsewhere.

Reviewed by: kevans

2 years agofreebsd32: rename fstat() stat buffer argument
Brooks Davis [Wed, 17 Nov 2021 20:12:24 +0000 (20:12 +0000)]
freebsd32: rename fstat() stat buffer argument

Reviewed by: kevans

2 years agofreebsd32: rename struct wrusage32 to struct __wrusage32
Brooks Davis [Wed, 17 Nov 2021 20:12:24 +0000 (20:12 +0000)]
freebsd32: rename struct wrusage32 to struct __wrusage32

This matches struct __wrusage

Reviewed by: kevans

2 years agofreebsd32: include `__` in semctl names
Brooks Davis [Wed, 17 Nov 2021 20:12:24 +0000 (20:12 +0000)]
freebsd32: include `__` in semctl names

This mirrors sys/kern/syscall.master and will simplify generation
of freebsd32 files.

Reviewed by: kevans

2 years agofreebsd32: sync _umtx_op args with default ABI
Brooks Davis [Wed, 17 Nov 2021 20:12:24 +0000 (20:12 +0000)]
freebsd32: sync _umtx_op args with default ABI

Reviewed by: kevans

2 years agofreebsd32: rename fstat argument to match default abi
Brooks Davis [Wed, 17 Nov 2021 20:12:24 +0000 (20:12 +0000)]
freebsd32: rename fstat argument to match default abi

Reviewed by: kevans

2 years agofreebsd32: rename old SysV IPC types
Brooks Davis [Wed, 17 Nov 2021 20:12:23 +0000 (20:12 +0000)]
freebsd32: rename old SysV IPC types

Move the 32 from ...32_old to ..._old32 to aid automatic generation.

Reviewed by: kevans

2 years agofreebsd32: struct kld32_file_stat -> struct kld_file_stat32
Brooks Davis [Wed, 17 Nov 2021 20:12:23 +0000 (20:12 +0000)]
freebsd32: struct kld32_file_stat -> struct kld_file_stat32

Follow common convention and put the `32` on the end of the struct
name.  This is a step toward generating freebsd32 syscall files
from sys/kern/syscalls.master.

Reviewed by: kevans

2 years agofreebsd32: add a union semun_old32
Brooks Davis [Wed, 17 Nov 2021 20:12:23 +0000 (20:12 +0000)]
freebsd32: add a union semun_old32

Use this for COMPAT7 support.  In practice it's the same as
union semun32 since the pointers become uint32_t's the it's more
symetric and is the logical thing to generate from semun_old.

Reviewed by: kevans

2 years agofreebsd32: fix type size of pointer array args
Brooks Davis [Wed, 17 Nov 2021 20:12:23 +0000 (20:12 +0000)]
freebsd32: fix type size of pointer array args

Make pointers to arrays of pointers `uint32_t *` so the sizes of the
array elements are correct.  In an ideal world we'd use something
like __ptr32 annotations instead.

Reviewed by: kevans

2 years agofreebsd32: thread IDs are int32_t
Brooks Davis [Wed, 17 Nov 2021 20:12:23 +0000 (20:12 +0000)]
freebsd32: thread IDs are int32_t

Thread IDs are of type long which means int32_t on 32-bit systems.
While this detail is handled without compat functions, expose it
here as code to generate prototypes from the default syscalls.master
will do so.

Reviewed by: kevans

2 years agofreebsd32: fix types on statfs syscalls
Brooks Davis [Wed, 17 Nov 2021 20:12:23 +0000 (20:12 +0000)]
freebsd32: fix types on statfs syscalls

Rename struct statfs32 to struct ostatfs32 to mirror struct ostatfs.
These structs are use for COMPAT4 support.  Stop using struct statfs32
for modern implementations as struct statfs uses fixed-width types
and it the same on all architectures.

Reviewed by: kevans

2 years agofreebsd32: fix type of olstat arg
Brooks Davis [Wed, 17 Nov 2021 20:12:23 +0000 (20:12 +0000)]
freebsd32: fix type of olstat arg

Reviewed by: kevans

2 years agofreebsd32: wait6 and procctl take idtype_t
Brooks Davis [Wed, 17 Nov 2021 20:12:23 +0000 (20:12 +0000)]
freebsd32: wait6 and procctl take idtype_t

Reviewed by: kevans

2 years agofreebsd32: use size_t where the default ABI does
Brooks Davis [Wed, 17 Nov 2021 20:12:23 +0000 (20:12 +0000)]
freebsd32: use size_t where the default ABI does

While the caller will never pass a larger value, we can use size_t
due to it being unsigned.

Reviewed by: kevans

2 years agofreebsd32: match ioctl type to default ABI
Brooks Davis [Wed, 17 Nov 2021 20:12:22 +0000 (20:12 +0000)]
freebsd32: match ioctl type to default ABI

The command is a u_long and unsigned integers do not require special
handling. The data argument isn't a special structure, just use char *.

Reviewed by: kevans

2 years agofreebsd32: [gs]etitimer's which arg is an int
Brooks Davis [Wed, 17 Nov 2021 20:12:22 +0000 (20:12 +0000)]
freebsd32: [gs]etitimer's which arg is an int

Reviewed by: kevans

2 years agofreebsd32: sprinkle in missing consts
Brooks Davis [Wed, 17 Nov 2021 20:12:22 +0000 (20:12 +0000)]
freebsd32: sprinkle in missing consts

A number of syscalls have missing consts on their arguments relative to
the default syscalls.master.

Also, use timespec32 and timeval32 where appropriate.

No functional change.

Reviewed by: kevans

2 years agofreebsd32: prototype gssd_syscall()
Brooks Davis [Wed, 17 Nov 2021 20:12:22 +0000 (20:12 +0000)]
freebsd32: prototype gssd_syscall()

Nothing about the interface should prevent this from working so
go ahead and prototype it for consistency.

Reviewed by: kevans

2 years agofreebsd32: name the ucontext struct __ucontext32
Brooks Davis [Wed, 17 Nov 2021 20:12:22 +0000 (20:12 +0000)]
freebsd32: name the ucontext struct __ucontext32

This matches the default ABI's struct __ucontext.

Reviewed by: kevans

2 years agofreebsd32: rename freebsd4_freebsd32_sigreturn arg
Brooks Davis [Wed, 17 Nov 2021 20:12:22 +0000 (20:12 +0000)]
freebsd32: rename freebsd4_freebsd32_sigreturn arg

Rename struct freebsd4_freebsd32_ucontext to struct freebsd4_ucontext32
allowing conversion from the default ABI's struct freebsd4_ucontext
by appending "32".  This has no practical effect as this type does not
actually exist.

Give freebsd4_freebsd32_sigreturn an ANSI C prototype.

Reviewed by: kevans

2 years agosyscalls: use struct siginfo rather than siginfo_t
Brooks Davis [Wed, 17 Nov 2021 20:12:22 +0000 (20:12 +0000)]
syscalls: use struct siginfo rather than siginfo_t

This allows freebsd32 to use struct siginfo32 with an automatable
conversion.

Reviewed by: kevans

2 years agosyscalls: fix type of osendmsg
Brooks Davis [Wed, 17 Nov 2021 20:12:22 +0000 (20:12 +0000)]
syscalls: fix type of osendmsg

osendmsg takes an struct omsghdr * not a void *.

Reviewed by: kevans

2 years agosyscalls: use __socklen_t as appropriate
Brooks Davis [Wed, 17 Nov 2021 20:12:22 +0000 (20:12 +0000)]
syscalls: use __socklen_t as appropriate

No functional change as __socklen_t is an int.

Obtained from: CheriBSD

Reviewed by: kevans

2 years agosyscalls: [gs]etitimer takes an int which
Brooks Davis [Wed, 17 Nov 2021 20:12:21 +0000 (20:12 +0000)]
syscalls: [gs]etitimer takes an int which

Match the function decleration which takes an int not a signed int.
No functional change as the range of valid values is 0-2.

Obtained from: CheriBSD

Reviewed by: kevans

2 years agosyscalls: sprinkle in const values
Brooks Davis [Wed, 17 Nov 2021 20:12:21 +0000 (20:12 +0000)]
syscalls: sprinkle in const values

Add missing const qualifiers to a number of syscall arguments.

Obtained from: CheriBSD

Reviewed by: kevans

2 years agomakesyscalls: make strip_abi_prefix more robust
Brooks Davis [Wed, 17 Nov 2021 20:12:21 +0000 (20:12 +0000)]
makesyscalls: make strip_abi_prefix more robust

Allow strip_abi_prefix() to be called with nil and return nil in that
case.  This simplifies handling of RESERVED entries.

Reviewed by: kevans

2 years agoExport symbols from opensolaris.ko and dtrace.ko
Mark Johnston [Wed, 17 Nov 2021 16:01:59 +0000 (11:01 -0500)]
Export symbols from opensolaris.ko and dtrace.ko

Both modules provide many symbols used by various DTrace provider
modules, so just export everything.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agobridge(4): Fix spelling
Tom Marcoen [Wed, 17 Nov 2021 17:47:33 +0000 (12:47 -0500)]
bridge(4): Fix spelling

PR: 237725
MFC after: 3 days

2 years agoFix ZFS module build
Allan Jude [Wed, 17 Nov 2021 15:07:05 +0000 (15:07 +0000)]
Fix ZFS module build

resolves: link_elf_obj: symbol abd_checksum_edonr_native undefined

The required module-build bits were originally identified in the
upstream pull request: https://github.com/openzfs/zfs/pull/12735
But were missed when the code was imported (since they are not
committed upstream).

X-MFC-With: dae1713419a609cd63416051
Submitted by: freqlabs
Sponsored by: Klara Inc.

2 years agotcp: Rack ack war with a mis-behaving firewall or nat with resets.
Randall Stewart [Wed, 17 Nov 2021 14:45:51 +0000 (09:45 -0500)]
tcp: Rack ack war with a mis-behaving firewall or nat with resets.

Previously we added ack-war prevention for misbehaving firewalls. This is
where the f/w or nat messes up its sequence numbers and causes an ack-war.
There is yet another type of ack war that we have found in the wild that is
like unto this. Basically the f/w or nat gets a ack (keep-alive probe or such)
and instead of turning the ack/seq around and adding a TH_RST it does something
real stupid and sends a new packet with seq=0. This of course triggers the challenge
ack in the reset processing which then sends in a challenge ack (if the seq=0 is within
the range of possible sequence numbers allowed by the challenge) and then we rinse-repeat.

This will add the needed tweaks (similar to the last ack-war prevention using the same sysctls and counters)
to prevent it and allow say 5 per second by default.

Reviewed by: Michael Tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D32938

2 years agozfs: fix commit dae1713419a6 merge openzfs/zfs@269b5dadc into main
Stefan Eßer [Wed, 17 Nov 2021 12:16:39 +0000 (13:16 +0100)]
zfs: fix commit dae1713419a6 merge openzfs/zfs@269b5dadc into main

Commit dae1713419a6 did not add two required lines for edonr specific
functionality to this file, causing kernel build failures if ZFS is
compiled in.

This commit should be included in an eventual MFC of dae1713419a6.

2 years agozfs: merge openzfs/zfs@269b5dadc (master) into main
Martin Matuska [Wed, 17 Nov 2021 08:35:14 +0000 (09:35 +0100)]
zfs: merge openzfs/zfs@269b5dadc (master) into main

Notable upstream pull request merges:
  #12285 Introduce a tunable to exclude special class buffers from L2ARC
  #12689 Check l2cache vdevs pending list inside the vdev_inuse()
  #12735 Enable edonr in FreeBSD
  #12743 FreeBSD: fix world build after de198f2
  #12745 Restore dirty dnode detection logic

Obtained from: OpenZFS
OpenZFS commit: 269b5dadcfd1d5732cf763dddcd46009a332eae4

2 years agom_get3(): actually use the selected zone
Kristof Provost [Tue, 16 Nov 2021 19:47:37 +0000 (20:47 +0100)]
m_get3(): actually use the selected zone

Reported by: markj

2 years agopf: add COMPAT_FREEBSD13 for DIOCKEEPCOUNTERS
Kristof Provost [Mon, 15 Nov 2021 20:14:00 +0000 (21:14 +0100)]
pf: add COMPAT_FREEBSD13 for DIOCKEEPCOUNTERS

DIOCKEEPCOUNTERS used to overlap with DIOCGIFSPEEDV0, which has been
fixed in 14, but remains in stable/12 and stable/13.
Support the old, overlapping, call under COMPAT_FREEBSD13.

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

2 years agoAdd a COMPAT_FREEBSD13 kernel option
Kristof Provost [Mon, 15 Nov 2021 21:01:34 +0000 (22:01 +0100)]
Add a COMPAT_FREEBSD13 kernel option

Use it wherever COMPAT_FREEBSD11 is currently specified.

Reviewed by: jhb (previous version)
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33005

2 years agoriscv: add COMPAT_FREEBSD12 option
Kristof Provost [Tue, 16 Nov 2021 19:46:26 +0000 (20:46 +0100)]
riscv: add COMPAT_FREEBSD12 option

Turn on compat option for older FreeBSD versions (i.e. 12). We do not
enable the compat options for 11 or older because riscv was never
supported in those versions.

Reviewed by: jrtc27 (previous version)
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33015

2 years agonfsd: Add a new rc variable nfs_server_maxio
Rick Macklem [Wed, 17 Nov 2021 00:02:53 +0000 (16:02 -0800)]
nfsd: Add a new rc variable nfs_server_maxio

Since vfs.nfsd.srvmaxio can only be set when nfsd.ko
is loaded, but nfsd is not running, setting it in
/etc/sysctl.conf is not feasible when "options NFSD"
was not specified for the kernel.

This patch adds a new rc variable nfs_server_maxio,
which sets vfs.nfsd.srvmaxio at the correct time.

rc.conf.5 will be patched separately.

Reviewed by: 0mp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D32997

2 years agoSkip -flto for all MIPS ports
Warner Losh [Tue, 16 Nov 2021 23:10:25 +0000 (16:10 -0700)]
Skip -flto for all MIPS ports

There likely should be a macro for the ports that support lto, but I'm
making sure that all the mips things build before decommissioning it and
this is the only thing that's broken...

Sponsored by: Netflix

2 years agoRevert "bsdinstall: add knob to set ASLR sysctls"
Marcin Wojtas [Fri, 12 Nov 2021 19:32:57 +0000 (20:32 +0100)]
Revert "bsdinstall: add knob to set ASLR sysctls"

This reverts commit 020f4112559ebf7e94665c9a69f89d21929ce82a.

Because now ASLR is enabled by default for 64-bit architectures
and the purpose of the installation menu is to allow choosing
additional 'mitigation'/'hardening' options that are originally
disabled, remove the ASLR knob from bsdinstall.

Discussed with: emaste
Obtained from: Semihalf
Sponsored by: Stormshield

2 years agoEnable ASLR by default for 64-bit executables
Marcin Wojtas [Sun, 24 Oct 2021 14:53:06 +0000 (16:53 +0200)]
Enable ASLR by default for 64-bit executables

Address Space Layout Randomization (ASLR) is an exploit mitigation
technique implemented in the majority of modern operating systems.
It involves randomly positioning the base address of an executable
and the position of libraries, heap, and stack, in a process's address
space. Although over the years ASLR proved to not guarantee full OS
security on its own, this mechanism can make exploitation more difficult.

Tests on the tier 1 64-bit architectures demonstrated that the ASLR is
stable and does not result in noticeable performance degradation,
therefore it should be safe to enable this mechanism by default.
Moreover its effectiveness is increased for PIE (Position Independent
Executable) binaries. Thanks to commit 9a227a2fd642 ("Enable PIE by
default on 64-bit architectures"), building from src is not necessary
to have PIE binaries. It is enough to control usage of ASLR in the
OS solely by setting the appropriate sysctls.

This patch toggles the kernel settings to use address map randomization
for PIE & non-PIE 64-bit binaries. It also disables SBRK, in order
to allow utilization of the bss grow region for mappings. The latter
has no effect if ASLR is disabled, so apply it to all architectures.

As for the drawbacks, a consequence of using the ASLR is more
significant VM fragmentation, hence the issues may be encountered
in the systems with a limited address space in high memory consumption
cases, such as buildworld. As a result, although the tests on 32-bit
architectures with ASLR enabled were mostly on par with what was
observed on 64-bit ones, the defaults for the former are not changed
at this time. Also, for the sake of safety keep the feature disabled
for 32-bit executables on 64-bit machines, too.

The committed change affects the overall OS operation, so the
following should be taken into consideration:
* Address space fragmentation.
* A changed ABI due to modified layout of address space.
* More complicated debugging due to:
  * Non-reproducible address space layout between runs.
  * Some debuggers automatically disable ASLR for spawned processes,
    making target's environment different between debug and
    non-debug runs.

In order to confirm/rule-out the dependency of any encountered issue
on ASLR it is strongly advised to re-run the test with the feature
disabled - it can be done by setting the following sysctls
in the /etc/sysctl.conf file:
kern.elf64.aslr.enable=0
kern.elf64.aslr.pie_enable=0

Co-developed by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: emaste, kib
Obtained from: Semihalf
Sponsored by: Stormshield
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D27666

2 years agombuf: Properly set the default value for mb_use_ext_pgs
Mark Johnston [Tue, 16 Nov 2021 21:23:11 +0000 (16:23 -0500)]
mbuf: Properly set the default value for mb_use_ext_pgs

Reported by: Jenkins
Fixes: fcaa890c4469 ("mbuf: Only allow extpg mbufs if the system has a direct map")
Pointy hat: markj

2 years agoEnable edonr in FreeBSD
Rich Ercolani [Tue, 16 Nov 2021 19:40:10 +0000 (14:40 -0500)]
Enable edonr in FreeBSD

The code is integrated, builds fine, runs fine, there's not really
any reason not to.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #12735

2 years agosctp: Remove now-unneeded mb_unmapped_to_ext() calls
Mark Johnston [Tue, 16 Nov 2021 18:38:09 +0000 (13:38 -0500)]
sctp: Remove now-unneeded mb_unmapped_to_ext() calls

sctp_delayed_checksum() now handles unmapped mbufs, thanks to m_apply().

No functional change intended.

Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32942

2 years agosctp: Use m_apply() to calcuate a checksum for an mbuf chain
Mark Johnston [Tue, 16 Nov 2021 18:36:30 +0000 (13:36 -0500)]
sctp: Use m_apply() to calcuate a checksum for an mbuf chain

m_apply() works on unmapped mbufs, so this will let us elide
mb_unmapped_to_ext() calls preceding sctp_calculate_cksum() calls in
the network stack.

Modify sctp_calculate_cksum() to assume it's passed an mbuf header.
This assumption appears to be true in practice, and we need to know the
full length of the chain.

No functional change intended.

Reviewed by: tuexen, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32941

2 years agombuf: Only allow extpg mbufs if the system has a direct map
Mark Johnston [Tue, 16 Nov 2021 18:31:04 +0000 (13:31 -0500)]
mbuf: Only allow extpg mbufs if the system has a direct map

Some upcoming changes will modify software checksum routines like
in_cksum() to operate using m_apply(), which uses the direct map to
access packet data for unmapped mbufs.  This approach of course does not
work on platforms without a direct map, so we have to disallow the use
of unmapped mbufs on such platforms.

I believe this is the right tradeoff: we only configure KTLS on amd64
and arm64 today (and one KTLS consumer, NFS TLS, requires a direct map
already), and the use of unmapped mbufs with plain sendfile is a recent
optimization.  If need be, m_apply() could be modified to create
CPU-private mappings of extpg mbuf pages as a fallback.

So, change mb_use_ext_pgs to be hard-wired to zero on systems without a
direct map.  Note that PMAP_HAS_DMAP is not a compile-time constant on
some systems, so the default value of mb_use_ext_pgs has to be
determined during boot.

Reviewed by: jhb
Discussed with: gallatin
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32940

2 years agounix: Remove a write-only local variable
Mark Johnston [Tue, 16 Nov 2021 14:43:33 +0000 (09:43 -0500)]
unix: Remove a write-only local variable

Reported by: clang
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoaesni: Avoid a potential out-of-bounds load in AES_GCM_encrypt()
Mark Johnston [Tue, 16 Nov 2021 14:16:16 +0000 (09:16 -0500)]
aesni: Avoid a potential out-of-bounds load in AES_GCM_encrypt()

Reported by: Jenkins (KASAN job)
Reviewed by: cem, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33012

2 years agortsol/rtsold: Add option to skip random delay
Colin Percival [Tue, 16 Nov 2021 18:24:05 +0000 (10:24 -0800)]
rtsol/rtsold: Add option to skip random delay

In accordance with a SHOULD in RFC 4861, rtsol and rtsold wait a
random time between zero and one (aka MAX_RTR_SOLICITATION_DELAY)
seconds before sending a Router Solicitation, in order to avoid
network congestion if many hosts come online at once.  (The
question of how many hosts would be required to cause congestion
by each sending a single packet on a Gbps+ network is left to the
reader.)

The new option -i disables this wait and instructs rtsol and rtsold
to send the Router Solicitation immediately.

Reviewed by: bz, kp (earlier version)
MFC after: 1 week
Relnotes: yes
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D32956

2 years agokvmclock: Expose implied TSC frequency via sysctl
Colin Percival [Tue, 16 Nov 2021 18:21:31 +0000 (10:21 -0800)]
kvmclock: Expose implied TSC frequency via sysctl

An interface was added to derive an implied TSC frequency from pvclock
in 2015, but this interface was never exposed anywhere user-visible.

Reviewed by: kib, bryanv
Differential Revision: https://reviews.freebsd.org/D32974

2 years agorandomdev: Remove 100 ms sleep from write routine
Colin Percival [Sat, 13 Nov 2021 16:38:09 +0000 (08:38 -0800)]
randomdev: Remove 100 ms sleep from write routine

This was introduced in 2014 along with the comment (which has since
been deleted):
/* Introduce an annoying delay to stop swamping */

Modern cryptographic random number generators can ingest arbitrarily
large amounts of non-random (or even maliciously selected) input
without losing their security.

Depending on the number of "boot entropy files" present on the system,
this can speed up the boot process by up to 1 second.

Reviewed by: cem
MFC ater: 1 week
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D32984

2 years agoffs: fix newly introduced LOR between mntfs vnode lock and topology lock
Konstantin Belousov [Tue, 16 Nov 2021 17:31:11 +0000 (19:31 +0200)]
ffs: fix newly introduced LOR between mntfs vnode lock and topology lock

The mntfs vnode lock should be before topology, as established in
ffs_mountfs().  Extend the locked region in ffs_unmount().

Reported and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33013

2 years agoktls: Split encrypt vs decrypt OCF counters.
John Baldwin [Tue, 16 Nov 2021 17:58:52 +0000 (09:58 -0800)]
ktls: Split encrypt vs decrypt OCF counters.

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33006

2 years agoktls tests: Check the return values of close().
John Baldwin [Tue, 16 Nov 2021 17:56:15 +0000 (09:56 -0800)]
ktls tests: Check the return values of close().

Suggested by: markj
Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33004

2 years agoktls: Use ATF_REQUIRE instead of assert() for validating TLS header lengths.
John Baldwin [Tue, 16 Nov 2021 17:56:15 +0000 (09:56 -0800)]
ktls: Use ATF_REQUIRE instead of assert() for validating TLS header lengths.

The TLS header length field is set by the kernel, so if it is
incorrect that is an indication of a kernel bug, not an internal error
in the tests.

Prompted by: markj (comment in an earlier review)
Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33003

2 years agonfsclient: upgrade vnode lock in VOP_OPEN()/VOP_CLOSE() if we need to flush buffers
Konstantin Belousov [Mon, 15 Nov 2021 20:24:46 +0000 (22:24 +0200)]
nfsclient: upgrade vnode lock in VOP_OPEN()/VOP_CLOSE() if we need to flush buffers

VOP_FSYNC() asserts that the vnode is exclusively locked for NFS.
If we try to execute file with recently modified content, the assert is
triggered.

Reviewed by: rmacklem
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32999

2 years agoFreeBSD: fix world build after de198f2d9
Martin Matuška [Mon, 15 Nov 2021 16:07:39 +0000 (17:07 +0100)]
FreeBSD: fix world build after de198f2d9

The inline function vn_flush_cached_data() in vnode.h
must not be compiled when building BASE.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Martin Matuska <mm@FreeBSD.org>
Closes #12743

2 years agoFix `zfs:AUTO` autodetection in initramfs scripts
Damian Szuberski [Sat, 13 Nov 2021 15:02:50 +0000 (16:02 +0100)]
Fix `zfs:AUTO` autodetection in initramfs scripts

Don't exit early in find_rootfs() when zpool.bootfs
is set to `zfs:AUTO`.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #12658

2 years agoRemove (now unused) td argument from zfs_lookup()
Pawel Jakub Dawidek [Sat, 13 Nov 2021 01:06:44 +0000 (17:06 -0800)]
Remove (now unused) td argument from zfs_lookup()

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #12748

2 years agoIntroduce a tunable to exclude special class buffers from L2ARC
George Amanakis [Thu, 11 Nov 2021 20:52:16 +0000 (21:52 +0100)]
Introduce a tunable to exclude special class buffers from L2ARC

Special allocation class or dedup vdevs may have roughly the same
performance as L2ARC vdevs. Introduce a new tunable to exclude those
buffers from being cacheable on L2ARC.

Reviewed-by: Don Brady <don.brady@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #11761
Closes #12285

2 years agoRemove basename(1). Clean up/shorten some coreutils pipelines
наб [Thu, 11 Nov 2021 20:27:37 +0000 (21:27 +0100)]
Remove basename(1). Clean up/shorten some coreutils pipelines

Basenames that remain, in cmd/zed/zed.d/statechange-led.sh:
dev=$(basename "$(echo "$therest" | awk '{print $(NF-1)}')")
vdev=$(basename "$ZEVENT_VDEV_PATH")
I don't wanna interfere with #11988

scripts/zfs-tests.sh:
SINGLETESTFILE=$(basename "$SINGLETEST")
tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list.kshlib:
ACTUAL=$(basename $dataset)
ACTUAL=$(basename $dataset)
tests/zfs-tests/tests/functional/cli_user/zpool_iostat/
zpool_iostat_-c_homedir.ksh:
typeset USER_SCRIPT=$(basename "$USER_SCRIPT_FULL")
tests/zfs-tests/tests/functional/cli_user/zpool_iostat/
zpool_iostat_-c_searchpath.ksh:
typeset CMD_1=$(basename "$SCRIPT_1")
typeset CMD_2=$(basename "$SCRIPT_2")
tests/zfs-tests/tests/functional/cli_user/zpool_status/
zpool_status_-c_homedir.ksh:
typeset USER_SCRIPT=$(basename "$USER_SCRIPT_FULL")
tests/zfs-tests/tests/functional/cli_user/zpool_status/
zpool_status_-c_searchpath.ksh
typeset CMD_1=$(basename "$SCRIPT_1")
typeset CMD_2=$(basename "$SCRIPT_2")
tests/zfs-tests/tests/functional/migration/migration.cfg:
export BNAME=`basename $TESTFILE`
tests/zfs-tests/tests/perf/perf.shlib:
typeset logbase="$(get_perf_output_dir)/$(basename \
tests/zfs-tests/tests/perf/perf.shlib:
typeset logbase="$(get_perf_output_dir)/$(basename \

These are potentially Of Directories, where basename is actually
useful

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12652

2 years agoCheck l2cache vdevs pending list inside the vdev_inuse()
Fedor Uporov [Thu, 11 Nov 2021 19:54:15 +0000 (11:54 -0800)]
Check l2cache vdevs pending list inside the vdev_inuse()

The l2cache device could be added twice because vdev_inuse() does not
check spa_l2cache for added devices. Make l2cache vdevs inuse checking
logic more closer to spare vdevs.

Reviewed-by: George Amanakis <gamanakis@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Fedor Uporov <fuporov.vstack@gmail.com>
Closes #9153
Closes #12689

2 years agozhack: Add repair label option
Fedor Uporov [Thu, 11 Nov 2021 19:26:18 +0000 (11:26 -0800)]
zhack: Add repair label option

In case if all label checksums will be invalid on any vdev, the pool
will become unimportable. The zhack with newly added cli options could
be used to restore label checksums and make pool importable again.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Fedor Uporov <fuporov.vstack@gmail.com>
Closes #2510
Closes #12686

2 years agoZTS: zfs_list_004_neg should not check paths that belong to ZFS
Palash Gandhi [Thu, 11 Nov 2021 15:46:44 +0000 (07:46 -0800)]
ZTS: zfs_list_004_neg should not check paths that belong to ZFS

When ZFS is on root, /tmp is a ZFS. This causes zfs_list_004_neg to
fail since `zfs list` on /tmp passes when the test expects it not to.
The fix is to exclude paths that belong to ZFS.

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Palash Gandhi <pbg4930@rit.edu>
Closes #12744

2 years agoRestore dirty dnode detection logic
Brian Behlendorf [Thu, 11 Nov 2021 00:14:32 +0000 (16:14 -0800)]
Restore dirty dnode detection logic

In addition to flushing memory mapped regions when checking holes,
commit de198f2d95 modified the dirty dnode detection logic to check
the dn->dn_dirty_records instead of the dn->dn_dirty_link.  Relying
on the dirty record has not be reliable, switch back to the previous
method.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #11900
Closes #12745

2 years agoExclude zfs_copies_003_pos on Linux
Brian Behlendorf [Wed, 10 Nov 2021 20:56:01 +0000 (12:56 -0800)]
Exclude zfs_copies_003_pos on Linux

This test case may fail on 5.13 and newer Linux kernels if the
/dev/zvol/ device is not created by udev.

Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #12301
Closes  #12738

2 years agozdb: Report bad label checksum
Fedor Uporov [Wed, 10 Nov 2021 19:22:00 +0000 (11:22 -0800)]
zdb: Report bad label checksum

In case if all label checksums will be invalid on any vdev, the pool
will become unimportable. From other side zdb with -l option will not
provide any useful information why it happened. Add notifications
about corrupted label checksums.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Fedor Uporov <fuporov.vstack@gmail.com>
Closes #2509
Closes #12685

2 years agoFix two more nits from 0mp
George V. Neville-Neil [Wed, 10 Nov 2021 17:51:42 +0000 (12:51 -0500)]
Fix two more nits from 0mp

2 years agoAddress review comments from 0mp, debdrup and oshogbo
George V. Neville-Neil [Wed, 10 Nov 2021 13:18:32 +0000 (08:18 -0500)]
Address review comments from 0mp, debdrup and oshogbo

2 years agoInitial clean up the language in the manual pages.
George V. Neville-Neil [Wed, 10 Nov 2021 06:38:36 +0000 (01:38 -0500)]
Initial clean up the language in the manual pages.

Summary: The manual pages need a bit of editing for language and clarity.

Reviewers: oshogbo, #manpages

Subscribers: imp

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

2 years agoloader: Do not force comconsole for arm and arm64
Emmanuel Vadot [Mon, 15 Nov 2021 11:17:43 +0000 (12:17 +0100)]
loader: Do not force comconsole for arm and arm64

This makes GOP not probed on some situation (AMD Card on PCIe slot
with EDK2 as we have a SERIAL_IO_PROTOCOL compatible uart).

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D32992
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoloader: lsefi: Print more information
Emmanuel Vadot [Mon, 15 Nov 2021 11:12:50 +0000 (12:12 +0100)]
loader: lsefi: Print more information

Printing the EFI_HANDLE pointer isn't very useful.
If the handle have a IMAGE_DEVICE_PATH or a DEVICE_PATH protocol print it.
This makes it easier to see which devices are present and what protocol they
expose.

Reviewed by: imp, tsoome
Differential Revision: https://reviews.freebsd.org/D32991
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agompr: Minor formatting changes to match mps.
Warner Losh [Tue, 16 Nov 2021 03:35:58 +0000 (20:35 -0700)]
mpr: Minor formatting changes to match mps.

Minor reformatting nits to make mprsas_scsiio_timeout match
mpssas_scsiio_timeout more closely. The differences aren't necessary and
are distracting when comparing the routines. No functional changes.

Sponsored by: Netflix

2 years agomps: Fix debugging line
Warner Losh [Tue, 16 Nov 2021 03:31:48 +0000 (20:31 -0700)]
mps: Fix debugging line

Print cm instead of sc here, as is done in mpr. We can get the sc from
cm, but not vice versa.

Sponsored by: Netflix

2 years agoFollowup to f2b391528ad9 to improve printed message.
Kirk McKusick [Tue, 16 Nov 2021 00:10:02 +0000 (16:10 -0800)]
Followup to f2b391528ad9 to improve printed message.

Sponsored by: Netflix

2 years agoAllow forced r/w mount of UFS/FFS filesystem with a bad check hash.
Kirk McKusick [Tue, 16 Nov 2021 00:03:08 +0000 (16:03 -0800)]
Allow forced r/w mount of UFS/FFS filesystem with a bad check hash.

Normally a UFS/FFS filesystem with a bad check hash can only be
mounted read only. With this commit the mount(8) -f (force) option
can be used to force a read-write mount of a UFS/FFS filesystem with
a bad check hash. Conveniently the filesystem will proceed to
update its on-disk superblock with a corrected check hash.

Sponsored by: Netflix

2 years agoAllow the MNT_FORCE flag to be passed through to an initial mount.
Kirk McKusick [Mon, 15 Nov 2021 23:45:06 +0000 (15:45 -0800)]
Allow the MNT_FORCE flag to be passed through to an initial mount.

When doing an initial mount(8) with its -f (force) flag, the MNT_FORCE
flag is not passed through to the underlying filesystem mount routine.
MNT_FORCE is only passed through on later updates to an existing
mount. With this commit the MNT_FORCE flag is now passed through on the
initial mount.

Sanity check: kib
Sponsored by: Netflix

2 years agox86: Implement deferred TSC calibration
Mark Johnston [Mon, 15 Nov 2021 20:31:21 +0000 (15:31 -0500)]
x86: Implement deferred TSC calibration

There is no universal way to find the TSC frequency.  Newer Intel CPUs
may report it via CPUID leaves 0x15 and 0x16.  Sometimes it can be
obtained from the PLATFORM_INFO MSR as well, though we never use that.
On older platforms we derive the frequency using a DELAY(1000000) call,
which uses the 8254 PIT.  On some newer platforms the 8254 is apparently
non-functional, leading to bogus calibration results.  On such platforms
the TSC frequency must be available from CPUID.  It is also possible to
disable calibration with a tunable, in which case we try to parse the
brand string if the TSC freq is not available from CPUID.

CPUID 0x15 provides an authoritative TSC frequency value, but even that
is not always available on new Intel platforms.  CPUID 0x16 provides the
specified processor base frequency, which is not the same as the TSC
frequency.  Empirically, it is close enough for early boot, but too far
off for timekeeping: on a Comet Lake NUC, CPUID 0x16 yields 1600MHz but
the TSC frequency is rougly 1608MHz, leading to frequent clock stepping
when NTP is in use.

Thus we have a situation where we cannot calibrate using the PIT and
cannot obtain a precise frequency from CPUID (or MSRs).  This change
seeks to address that by using the CPUID 0x16 value during early boot
and refining the calibration later once ACPI-based timecounters are
available.  TSC frequency detection is thus split into two phases:

Early phase:
- On Intel platforms, query CPUID 0x15 and 0x16 and use that value
  initially if available.
- Otherwise, get an estimate using the PIT, reducing the delay loop to
  100ms from 1s.
- Continue to register the TSC as the CPU ticks provider early, even
  though the frequency may be off.  Otherwise any code executed during
  boot that uses cpu_ticks() (e.g., context switching) gets tripped up
  when the ticks provider changes.

Later phase:
- In SI_SUB_CLOCKS, once the timehands are initialized, load the current
  TSC and timecounter (sbinuptime()) values at the beginning and end of
  a 1s interval and use the timecounter frequency (typically from
  kvmclock, HPET or the ACPI PM timer) to estimate the TSC frequency.
- Update the TSC timecounter, global tsc_freq and CPU ticker with the
  new frequency and finally register the TSC as a timecounter.

Reviewed by: kib, jhb (previous version)
Discussed with: imp, cperciva
MFC after: 6 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32512

2 years agoclock: Group the "clocks" SYSINIT with the function definition
Mark Johnston [Mon, 15 Nov 2021 20:31:03 +0000 (15:31 -0500)]
clock: Group the "clocks" SYSINIT with the function definition

This is how most SYSINITs are defined.  Also annotate the dummy
parameter with __unused.  No functional change intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoldd: also use exec mode for -a
Konstantin Belousov [Mon, 15 Nov 2021 20:45:51 +0000 (22:45 +0200)]
ldd: also use exec mode for -a

The -a option also requires passing specific environment variables to
instance of rtld doing tracing.

PR: 259069
Sponsored by: The FreeBSD Foundation
MFC after: 1 week