]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoZero `struct weightened_nhop` fields in nhgrp_get_addition_group().
Alexander V. Chernikov [Sat, 20 Mar 2021 08:26:03 +0000 (08:26 +0000)]
Zero `struct weightened_nhop` fields in nhgrp_get_addition_group().

`struct weightened_nhop` has spare 32bit between the fields due to
 the alignment (on amd64).
Not zeroing these spare bits results in duplicating nhop groups
 in the kernel due to the way how comparison works.

MFC after: 1 day

3 years agozfs: Cherry-pick upstream commit ef977fce6636 to fix macOS/arm64 bootstrap
Jessica Clarke [Sat, 27 Mar 2021 02:23:59 +0000 (02:23 +0000)]
zfs: Cherry-pick upstream commit ef977fce6636 to fix macOS/arm64 bootstrap

Upstream commit message:

  Support running FreeBSD buildworld on Arm-based macOS hosts

  Arm-based Macs are like FreeBSD and provide a full 64-bit stat from the
  start, so have no stat64 variants. Thus, define stat64 and fstat64 as
  aliases for the normal versions.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
  Closes #11771

MFC after: 1 week

3 years agocxgbe: Make the TOE TLS stats per-queue instead of per-port.
John Baldwin [Fri, 26 Mar 2021 22:05:44 +0000 (15:05 -0700)]
cxgbe: Make the TOE TLS stats per-queue instead of per-port.

This avoids some atomics by using counter_u64 for TX and relying on
existing single-threading (single ithread per rxq) for RX.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29383

3 years agocxgbe: Add a struct sge_ofld_txq type.
John Baldwin [Fri, 26 Mar 2021 22:05:31 +0000 (15:05 -0700)]
cxgbe: Add a struct sge_ofld_txq type.

This type mirrors struct sge_ofld_rxq and holds state for TCP offload
transmit queues.  Currently it only holds a work queue but will
include additional state in future changes.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29382

3 years agoConsolidate machine/endian.h definitions
Mitchell Horne [Mon, 1 Mar 2021 15:07:54 +0000 (11:07 -0400)]
Consolidate machine/endian.h definitions

This change serves two purposes.

First, we take advantage of the compiler provided endian definitions to
eliminate some long-standing duplication between the different versions
of this header. __BYTE_ORDER__ has been defined since GCC 4.6, so there
is no need to rely on platform defaults or e.g. __MIPSEB__ to determine
endianness. A new common sub-header is added, but there should be no
changes to the visibility of these definitions.

Second, this eliminates the hand-rolled __bswapNN() routines, again in
favor of the compiler builtins. This was done already for x86 in
e6ff6154d203. The benefit here is that we no longer have to maintain our
own implementations on each arch, and can instead rely on the compiler
to emit appropriate instructions or libcalls, as available. This should
result in equivalent or better code generation. Notably 32-bit arm will
start using the `rev` instruction for these routines, which is available
on armv6+.

PR: 236920
Reviewed by: arichardson, imp
Tested by: bdragon (BE powerpc)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D29012

3 years agosecurity.7: fix typo in sysctl name
Piotr Pawel Stefaniak [Fri, 26 Mar 2021 21:24:06 +0000 (22:24 +0100)]
security.7: fix typo in sysctl name

It is machdep.syscall_ret_flush_l1d.

3 years agoRemove more terminfo entries after 16d3faad099a
Dimitry Andric [Sat, 20 Mar 2021 22:07:23 +0000 (23:07 +0100)]
Remove more terminfo entries after 16d3faad099a

Otherwise, several directories under /usr/share/terminfo will not be
cleaned up.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29355

3 years agobsdinstall: Drop vestigial bsdinstall-esps cleanup
Ryan Moeller [Fri, 26 Mar 2021 18:12:18 +0000 (14:12 -0400)]
bsdinstall: Drop vestigial bsdinstall-esps cleanup

This is not needed after 0b7472b3d8d2f1e90fade5236b44fd98d8e396c2.

MFC after: 3 days
Sponsored by: iXsystems, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D29325

3 years agorpc.lockd: Unconditionally close fds as daemon
Caleb St. John [Fri, 26 Mar 2021 18:00:14 +0000 (14:00 -0400)]
rpc.lockd: Unconditionally close fds as daemon

When lockd is configured with a debug level of > 0 and foreground == 0,
the process is daemonized with a truth noclose argument to daemon().
This doesn't seem to be the desired behavior because that prevents
stdout and stderr from being closed, however, stdout and stderr aren't
used anywhere else. Furthermore, the man pages state that with a higher
debug level it will use the syslog facilities to do so.

Submitted by: Caleb St. John
Discussed with: rmacklem
MFC after: 3 days
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D29415

3 years agocxgbe: remove unused linux headers
Bjoern A. Zeeb [Fri, 26 Mar 2021 16:10:25 +0000 (16:10 +0000)]
cxgbe: remove unused linux headers

Remove unused #includes of LinuxKPI headers noticed while trying to
solve LinuxKPI struct net_device and related functions.
Neither netdevice.h nor inetdevice.h nor notifier.h seem to be needed.
This takes cxgbe(4) out of the picture of D29366.

Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: np
X-D-R: D29366 (extracted as further cleanup)
Differential Revision: https://reviews.freebsd.org/D29432

3 years agoqlnxr: remove netdevice.h
Bjoern A. Zeeb [Fri, 26 Mar 2021 17:17:10 +0000 (17:17 +0000)]
qlnxr: remove netdevice.h

Remove unused #includes of a LinuxKPI header noticed while trying to
solve LinuxKPI struct net_device and related functions.
This takes qlnxr out of the picture of D29366.

Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
X-D-R: D29366 (extracted as further cleanup)

3 years agoobsoletefiles: also remove the terminfo directory along with the db
Baptiste Daroussin [Fri, 26 Mar 2021 16:58:06 +0000 (17:58 +0100)]
obsoletefiles: also remove the terminfo directory along with the db

3 years agomlx4: remove no longer needed header
Bjoern A. Zeeb [Fri, 26 Mar 2021 15:28:24 +0000 (15:28 +0000)]
mlx4: remove no longer needed header

Remove linux/inetdevice.h as neither of the two inline functions there
are used here.

Sposored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: hselasky
X-D-R: D29366 (extracted as further cleanup)
Differential Revision: https://reviews.freebsd.org/D29428

3 years agoAdd a new mode to the scripted partition editor for variant disk names.
Nathan Whitehorn [Fri, 26 Mar 2021 15:39:12 +0000 (11:39 -0400)]
Add a new mode to the scripted partition editor for variant disk names.

If the disk parameter "DEFAULT" is set in place of an actual device name,
or no disk is specified for the PARTITIONS parameter, the installer will
follow the logic used in the automatic-partitioning mode, in which it
will either provide a selection dialog for one of several disks if
several are present or automatically select it if there is only one. This
simplifies the creation of fully-automatic installation media for
hardware or VMs with varying disk names.

Suggested by: Egoitz Aurrekoetxea <egoitz@sarenet.es>
MFC after: 3 weeks
Relnotes: yes

3 years agoce: unifdef NPCI also
Ed Maste [Thu, 25 Mar 2021 23:39:49 +0000 (19:39 -0400)]
ce: unifdef NPCI also

After f9839a42ee5d NPCI is always 1.

Reported by: imp

3 years agoLinuxKPI: netdevice notifier callback argument
Bjoern A. Zeeb [Sun, 21 Mar 2021 21:18:34 +0000 (21:18 +0000)]
LinuxKPI: netdevice notifier callback argument

Introduce struct netdev_notifier_info as a container to pass
net_device to the callback functions.
Adjust netdev_notifier_info_to_dev() to return the net_device field.

Add explicit casts from ifp to ni->dev even though currently
struct net_device is defined to struct ifnet.  This is needed in
preparation for untangling this and improving the net_device compat
code.

Obtained-from: bz_iwlwifi
Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: hselasky
Differential Revision: https://reviews.freebsd.org/D29365

3 years agoLinuxKPI: add net_ratelimit()
Bjoern A. Zeeb [Tue, 23 Mar 2021 17:00:22 +0000 (17:00 +0000)]
LinuxKPI: add net_ratelimit()

Add a net_ratelimit() compat implementation based on ppsratecheck().
Add a sysctl to allow tuning of the number of messages.

Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: hselasky
Differential Revision: https://reviews.freebsd.org/D29399

3 years agopci: enhance printf for leaked MSI[-X] vectors
Bjoern A. Zeeb [Tue, 23 Mar 2021 15:47:24 +0000 (15:47 +0000)]
pci: enhance printf for leaked MSI[-X] vectors

When debugging leaked MSI/MSI-X vectors through LinuxKPI I found
the informational printf unhelpful.  Rather than just stating we
leaked also tell how many MSI or MSI-X vectors we leak.

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

3 years ago[iwn] Flip over to use VAP flags rather than ic flags for things
Adrian Chadd [Mon, 22 Mar 2021 16:47:43 +0000 (09:47 -0700)]
[iwn] Flip over to use VAP flags rather than ic flags for things

net80211 changed a while back to support per-VAP config for things
rather than it being global.  This is to support firmware NICs that
support per-VAP flags and configuration where the firmware will figure
out how to combine them.

However, it introduced a fun timing issue - those changes used to happen
to the shared ic state before newstate() was called, but now they're
also tasks and they can happen /after/.

This isn't a problem for ath(4), but it exposed some interesting
timing and config bugs here.  Notably, I saw short slot NOT being
configured in 5GHz mode during some associations, so 5GHz stuff
would hang or behave poorly.  Other times the follow-up auth has
the right config, so it didn't hang.

So for now, just flip this over to using the per-VAP flags which
are correct when newstate() is called.  net80211 should also have
those flags synch'ed to the global ic state before newstate() runs
and that can come in a subsequent commit.

Whilst here also fix plcp to be consistently logged as a hex value.

Tested:

* iwn(4) Intel 6205, STA mode, both 2GHz and 5GHz

Differential Revision: https://reviews.freebsd.org/D29379
Reviewed by: bz

3 years agotcp: Use PRR for ECN congestion recovery
Richard Scheffenegger [Fri, 26 Mar 2021 01:05:22 +0000 (02:05 +0100)]
tcp: Use PRR for ECN congestion recovery

MFC after: 2 weeks
Reviewed By: #transport, rrs
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28972

3 years agotcp: Refactor PRR code
Richard Scheffenegger [Thu, 25 Mar 2021 22:58:46 +0000 (23:58 +0100)]
tcp: Refactor PRR code

No functional change intended.

MFC after: 2 weeks
Reviewed By: #transport, rrs
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29411

3 years agotcp: Perform simple fast retransmit when SACK Blocks are missing on SACK session
Richard Scheffenegger [Thu, 25 Mar 2021 22:18:06 +0000 (23:18 +0100)]
tcp: Perform simple fast retransmit when SACK Blocks are missing on SACK session

MFC after: 2 weeks
Reviewed By: #transport, rrs
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28634

3 years agoaccept_filter: Fix filter parameter handling
Mark Johnston [Thu, 25 Mar 2021 21:55:20 +0000 (17:55 -0400)]
accept_filter: Fix filter parameter handling

For filters which implement accf_create, the setsockopt(2) handler
caches the filter name in the socket, but it also incorrectly frees the
buffer containing the copy, leaving a dangling pointer.  Note that no
accept filters provided in the base system are susceptible to this, as
they don't implement accf_create.

Reported by: Alexey Kulaev <alex.qart@gmail.com>
Discussed with: emaste
Security: kernel use-after-free
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agocxgbe(4): Allow a T6 adapter to switch between TOE and NIC TLS mode.
Navdeep Parhar [Wed, 24 Mar 2021 01:01:01 +0000 (18:01 -0700)]
cxgbe(4): Allow a T6 adapter to switch between TOE and NIC TLS mode.

The hw.cxgbe.kern_tls tunable was used for this in the past and if it
was set then all T6 adapters would be configured for NIC TLS operation
and could not be reconfigured for TOE without a reload.  With this
change ifconfig can be used to manipulate toe and txtls caps like any
other caps.  hw.cxgbe.kern_tls continues to work as usual but its
effects are not permanent any more.

* Enable nic_ktls_ofld in the default configuration file and use the
  firmware instead of direct register manipulation to apply/rollback
  NIC TLS configuration.  This allows the driver to switch the hardware
  between TOE and NIC TLS mode in a safe manner.  Note that the
  configuration is adapter-wide and not per-port.

* Remove the kern_tls config file as it works with 100G T6 cards only
  and leads to firmware crashes with 25G cards.  The configurations
  included with the driver (with the exception of the FPGA configs) are
  supposed to work with all adapters.

Reported by: Veeresh U.K. at Chelsio
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Reviewed by: jhb@
Differential Revision: https://reviews.freebsd.org/D29291

3 years agopf: remove obsolete reference to ndis(4) in a comment
Ed Maste [Thu, 25 Mar 2021 18:43:55 +0000 (14:43 -0400)]
pf: remove obsolete reference to ndis(4) in a comment

3 years agondis: remove leftover sys/modules/ndis
Ed Maste [Thu, 25 Mar 2021 18:30:11 +0000 (14:30 -0400)]
ndis: remove leftover sys/modules/ndis

Reported by: cognet
Fixes: bfc99943b04b ("ndis(4): remove as previous announced")

3 years agoce: remove long-obsolete FreeBSD version compatibility
Ed Maste [Thu, 25 Mar 2021 02:48:50 +0000 (22:48 -0400)]
ce: remove long-obsolete FreeBSD version compatibility

Mechanical change via unifdef.

3 years ago[PowerPC64] Clear low-order bits of ARPN
Leandro Lupori [Thu, 25 Mar 2021 16:30:56 +0000 (13:30 -0300)]
[PowerPC64] Clear low-order bits of ARPN

PowerISA 2.07B says that the low-order p-12 bits of the real page number
contained in ARPN and LP fields of a PTE must be 0s and are ignored
by the hardware (Book III-S, 5.7.7.1), where 2^p is the actual page size
in bytes, but we were clearing only the LP field.

This worked on bare metal and QEMU with KVM, that ignore these bits,
but caused a kernel panic on QEMU with TCG, that expects them to be
cleared.

This fixes running FreeBSD with HPT superpages enabled on QEMU
with TCG.

MFC after: 2 weeks
Sponsored by: Eldorado Research Institute (eldorado.org.br)

3 years ago[PowerPC64] Port optimized strcpy to PPC64LE
Leandro Lupori [Thu, 25 Mar 2021 16:14:00 +0000 (13:14 -0300)]
[PowerPC64] Port optimized strcpy to PPC64LE

Submitted by:           Bruno Larsen <bruno.larsen@eldorado.org.br>
Reviewed by:            luporl, bdragon (IRC)
MFC after:              1 week
Sponsored by:           Eldorado Research Institute (eldorado.org.br)
Differential Revision:  https://reviews.freebsd.org/D29067

3 years agoOpenSSL: Regen manual pages for 1.1.1k
Jung-uk Kim [Thu, 25 Mar 2021 16:17:52 +0000 (12:17 -0400)]
OpenSSL: Regen manual pages for 1.1.1k

3 years ago[PowerPC64] Enforce natural alignment in bcopy
Leandro Lupori [Thu, 25 Mar 2021 14:54:06 +0000 (11:54 -0300)]
[PowerPC64] Enforce natural alignment in bcopy

POWER architecture CPUs (Book-S) require natural alignment for
cache-inhibited storage accesses. Since we can't know the caching model
for a page ahead of time, always enforce natural alignment in bcopy.
This fixes a SIGBUS when calling the function with misaligned pointers
on POWER7.

Submitted by: Bruno Larsen <bruno.larsen@eldorado.org.br>
Reviewed by: luporl, bdragon (IRC)
MFC after: 1 week
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D28776

3 years agoipoib: Fix incorrectly computed IPOIB_CM_RX_SG value.
Hans Petter Selasky [Thu, 25 Mar 2021 15:55:02 +0000 (16:55 +0100)]
ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value.

The computed IPOIB_CM_RX_SG is too small. It doesn't account for fallback
to mbuf clusters when jumbo frames are not available and it also doesn't
account for the packet header and trailer mbuf.

This causes a memory overwrite situation when IPOIB_CM is configured.

While at it add a kernel assert to ensure the mapping array is not overwritten.

PR: 254474
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoSet default alternate setting when USB audio devices are not in use,
Hans Petter Selasky [Tue, 9 Mar 2021 16:41:18 +0000 (17:41 +0100)]
Set default alternate setting when USB audio devices are not in use,
to activate power save features.

Suggested by: Shichun_Ma@Dell.com
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoOpenSSL: Merge OpenSSL 1.1.1k
Jung-uk Kim [Thu, 25 Mar 2021 15:45:19 +0000 (11:45 -0400)]
OpenSSL: Merge OpenSSL 1.1.1k

Merge commit '94fa08a4bcdfbb3434b025d67d014af3b18e5380'

3 years agoImport OpenSSL 1.1.1k.
Jung-uk Kim [Thu, 25 Mar 2021 15:05:31 +0000 (11:05 -0400)]
Import OpenSSL 1.1.1k.

3 years agompsutil.8: fix typos in the man page
Alan Somers [Thu, 25 Mar 2021 14:43:40 +0000 (08:43 -0600)]
mpsutil.8: fix typos in the man page

MFC after: 2 weeks
Sponsored by: Axcient

3 years agolib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotations
Alex Richardson [Thu, 25 Mar 2021 11:22:10 +0000 (11:22 +0000)]
lib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotations

The error cases (goto fin) of _nsdispatch were missing the unlock.

This change also drops the checks for __isthreaded since the pthread stubs
are already no-ops if threads are not being used. Dropping those conditionals
allows clang's thread safety analysis to deal with the file and also makes
the code a bit more readable. While touching the file also add a few more
assertions in debug mode that the right locks are held.

Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D29372

3 years agogit-arc.sh: Make it compatible with Ubuntu 18.04
Alex Richardson [Thu, 25 Mar 2021 11:17:56 +0000 (11:17 +0000)]
git-arc.sh: Make it compatible with Ubuntu 18.04

dash does not allow function names containing a ":", so replace it with
a '_'. Additionally, Ubunutu 18.04 ships git 2.17 which does not support
the `--default false` flag for git config.

Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D29374

3 years agoFix most shellcheck warnings in git-arc.sh
Alex Richardson [Thu, 25 Mar 2021 11:17:30 +0000 (11:17 +0000)]
Fix most shellcheck warnings in git-arc.sh

Mostly adding quotes and replacing egrep/fgrep with grep -E/grep -F

Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D29373

3 years agoRISC-V: Fix feenableexcept return value
Alex Richardson [Thu, 25 Mar 2021 11:15:41 +0000 (11:15 +0000)]
RISC-V: Fix feenableexcept return value

The man page says "The feenableexcept(), fedisableexcept(), and
fegetexcept() functions return a bitmap of the exceptions that were
unmasked prior to the call.", so we should return zero not -1.

Reviewed By: mhorne
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29386

3 years agong_macfilter_test: Skip rather than fail if there is no network
Alex Richardson [Thu, 25 Mar 2021 11:14:46 +0000 (11:14 +0000)]
ng_macfilter_test: Skip rather than fail if there is no network

This should bring the number of Jenkins failures from 4 down to 3.
Locally kyua now prints `skipped: could not find a valid interface  [0.115s]`
when I run it in QEMU without a network device.

Reviewed By: lwhsu
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29414

3 years agotruss: improved support for decoding compat32 arguments
Alex Richardson [Thu, 25 Mar 2021 11:12:17 +0000 (11:12 +0000)]
truss: improved support for decoding compat32 arguments

Currently running `truss -a -e` does not decode any
argument values for freebsd32_* syscalls (open/readlink/etc.)

This change checks whether a syscall starts with freebsd{32,64}_ and if
so strips that prefix when looking up the syscall information. To ensure
that the truss logs include the real syscall name we create a copy of
the syscall information struct with the updated.

The other problem is that when reading string array values, truss
naively iterates over an array of char* and fetches the pointer value.
This will result in arguments not being loaded if the pointer is not
aligned to sizeof(void*), which can happens in the compat32 case. If it
happens to be aligned, we would end up printing every other value.
To fix this problem, this changes adds a pointer_size member to the
procabi struct and uses that to correctly read indirect arguments
as 64/32 bit addresses in the the compat32 case (and also compat64 on
CheriBSD).

The motivating use-case for this change is using truss for 64-bit
programs on a CHERI system, but most of the diff also applies to 32-bit
compat on a 64-bit system, so I'm upstreaming this instead of keeping it
as a local CheriBSD patch.

Output of `truss -aef ldd32 /usr/bin/ldd32` before:
39113: freebsd32_mmap(0x0,0x1000,0x3,0x1002,0xffffffff,0x0,0x0) = 543440896 (0x20644000)
39113: freebsd32_ioctl(0x1,0x402c7413,0xffffd2a0) = 0 (0x0)
/usr/bin/ldd32:
39113: write(1,"/usr/bin/ldd32:\n",16)  = 16 (0x10)
39113: fork()  = 39114 (0x98ca)
39114: <new process>
39114: freebsd32_execve(0xffffd97e,0xffffd680,0x20634000) EJUSTRETURN
39114: freebsd32_mmap(0x0,0x20000,0x3,0x1002,0xffffffff,0x0,0x0) = 541237248 (0x2042a000)
39114: freebsd32_mprotect(0x20427000,0x1000,0x1) = 0 (0x0)
39114: issetugid()  = 0 (0x0)
39114: openat(AT_FDCWD,"/etc/libmap32.conf",O_RDONLY|O_CLOEXEC,00) ERR#2 'No such file or directory'
39114: openat(AT_FDCWD,"/var/run/ld-elf32.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
39114: read(3,"Ehnt\^A\0\0\0\M^@\0\0\0#\0\0\0\0"...,128) = 128 (0x80)
39114: freebsd32_fstat(0x3,0xffffbd98)  = 0 (0x0)
39114: freebsd32_pread(0x3,0x2042f000,0x23,0x80,0x0) = 35 (0x23)
39114: close(3)  = 0 (0x0)
39114: openat(AT_FDCWD,"/usr/lib32/libc.so.7",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
39114: freebsd32_fstat(0x3,0xffffc7d0)  = 0 (0x0)
39114: freebsd32_mmap(0x0,0x1000,0x1,0x40002,0x3,0x0,0x0) = 541368320 (0x2044a000)

After:
  783: freebsd32_mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 543543296 (0x2065d000)
  783: freebsd32_ioctl(1,TIOCGETA,0xffffd7b0)    = 0 (0x0)
/usr/bin/ldd32:
  783: write(1,"/usr/bin/ldd32:\n",16)           = 16 (0x10)
  784: <new process>
  783: fork()                                    = 784 (0x310)
  784: freebsd32_execve("/usr/bin/ldd32",[ "(null)" ],[ "LD_32_TRACE_LOADED_OBJECTS_PROGNAME=/usr/bin/ldd32", "LD_TRACE_LOADED_OBJECTS_PROGNAME=/usr/bin/ldd32", "LD_32_TRACE_LOADED_OBJECTS=yes", "LD_TRACE_LOADED_OBJECTS=yes", "USER=root", "LOGNAME=root", "HOME=/root", "SHELL=/bin/csh", "BLOCKSIZE=K", "MAIL=/var/mail/root", "MM_CHARSET=UTF-8", "LANG=C.UTF-8", "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin", "TERM=vt100", "HOSTTYPE=FreeBSD", "VENDOR=amd", "OSTYPE=FreeBSD", "MACHTYPE=x86_64", "SHLVL=1", "PWD=/root", "GROUP=wheel", "HOST=freebsd-amd64", "EDITOR=vi", "PAGER=less" ]) EJUSTRETURN
  784: freebsd32_mmap(0x0,135168,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 541212672 (0x20424000)
  784: freebsd32_mprotect(0x20421000,4096,PROT_READ) = 0 (0x0)
  784: issetugid()                               = 0 (0x0)
  784: sigfastblock(0x1,0x204234fc)              = 0 (0x0)
  784: open("/etc/libmap32.conf",O_RDONLY|O_CLOEXEC,00) ERR#2 'No such file or directory'
  784: open("/var/run/ld-elf32.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
  784: read(3,"Ehnt\^A\0\0\0\M^@\0\0\0\v\0\0\0"...,128) = 128 (0x80)
  784: freebsd32_fstat(3,{ mode=-r--r--r-- ,inode=18680,size=32768,blksize=0 }) = 0 (0x0)
  784: freebsd32_pread(3,"/usr/lib32\0",11,0x80) = 11 (0xb)

Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D27625

3 years agobuild.7: Use proper .Dd date from this year
Warner Losh [Thu, 25 Mar 2021 07:48:12 +0000 (01:48 -0600)]
build.7: Use proper .Dd date from this year

3 years agobuild.7: Document SYSDIR variable
Warner Losh [Thu, 25 Mar 2021 07:45:21 +0000 (01:45 -0600)]
build.7: Document SYSDIR variable

Add a description of the SYSDIR variable.

3 years agoFix !VNET build broken by 66f138563becf12d5c21924f816d2a45c3a1ed7a.
Alexander V. Chernikov [Thu, 25 Mar 2021 00:30:41 +0000 (00:30 +0000)]
Fix !VNET build broken by 66f138563becf12d5c21924f816d2a45c3a1ed7a.

3 years agoFix fsck_ffs -R finds unfixed duplicate block errors when rerunning.
Kirk McKusick [Thu, 25 Mar 2021 00:23:33 +0000 (17:23 -0700)]
Fix fsck_ffs -R finds unfixed duplicate block errors when rerunning.

This fixes a long-standing but very obscure bug in fsck_ffs when
it is run with the -R (rerun after unexpected errors).  It only
occurs if fsck_ffs finds duplicate blocks and they are all contained
in inodes that reside in the first block of inodes (typically among
the first 128 inodes).

Rather than use the usual ginode() interface to walk through the
inodes in pass1, there is a special optimized `getnextinode()'
routine for walking through all the inodes. It has its own private
buffer for reading the inode blocks. If pass 1 finds duplicate
blocks it runs pass 1b to find all the inodes that contain these
duplicate blocks. Pass 1b also uses the `getnextinode()' to search
for the inodes with duplicate blocks. Pass 1b stops when all the
duplicate blocks have been found. If all the duplicate blocks are
found in the first block of inodes, then the getnextinode cache
holds this block of bad inodes. The subsequent cleanup of the inodes
in passes 2-5 is done using ginode() which uses the regular fsck_ffs
cache.

When fsck_ffs restarts, pass1() calls setinodebuf() to point at the
first block of inodes. When it calls getnextinode() to get inode
2, getnextino() sees that its private cache already has the first
set of inodes loaded and starts using them. They are of course the
trashed inodes left over from the previous run of pass1b().

The fix is to always invalidate the getnextinode cache when calling
setinodebuf().

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    3 days
Sponsored by: Netflix

3 years agoPlug nexthop group refcount leak.
Alexander V. Chernikov [Wed, 24 Mar 2021 23:51:45 +0000 (23:51 +0000)]
Plug nexthop group refcount leak.
In case with batch route delete via rib_walk_del(), when
 some paths from the multipath route gets deleted, old
 multipath group were not freed.

PR:    254496
Reported by:   Zhenlei Huang <zlei.huang@gmail.com>
MFC after:     1 day

3 years agortld: fix the man page
Mariusz Zaborski [Wed, 24 Mar 2021 23:49:59 +0000 (00:49 +0100)]
rtld: fix the man page

In f90218886fc8 in man page I used LD_PRELOAD_PATH_FDS instead of
LD_PRELOAD_FDS.

Reported by: rpokala

3 years agoFix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode".
Kirk McKusick [Wed, 24 Mar 2021 23:50:24 +0000 (16:50 -0700)]
Fix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode".

Pass 1b of fsck_ffs runs only when Pass 1 has found duplicate blocks.
When starting up, Pass 1b failed to properly skip over the two unused
inodes at the beginning of the filesystem resulting in the above error
message when it tried to read the filesystem root inode.

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    3 days
Sponsored by: Netflix

3 years agoGeneralize sanitizer interceptors for memory and string routines
Mark Johnston [Wed, 24 Mar 2021 23:43:05 +0000 (19:43 -0400)]
Generalize sanitizer interceptors for memory and string routines

Similar to commit 3ead60236f ("Generalize bus_space(9) and atomic(9)
sanitizer interceptors"), use a more generic scheme for interposing
sanitizer implementations of routines like memcpy().

No functional change intended.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

3 years agoqlnxr: remove duplicate defines
Bjoern A. Zeeb [Tue, 23 Mar 2021 14:31:37 +0000 (14:31 +0000)]
qlnxr: remove duplicate defines

upper_32_bits() and lower_32_bits() are defined twice in this file.
With the extra conditinal removed on LinuxKPI in 3b1ecc9fa1b5
they are also included from there already.  Use the LinuxKPI version
and remove the two local ones.

Sponsored-by: The FreeBSD Foundation
Reviewed-by: hselasky
MFC-after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29392

3 years agoLinuxKPI: remove < 5.0 version support
Bjoern A. Zeeb [Tue, 23 Mar 2021 14:24:49 +0000 (14:24 +0000)]
LinuxKPI: remove < 5.0 version support

We are not aware of any out-of-tree consumers anymore
which would need KPI support for before Linux version 5.
Update the two in-tree consumers to use the new KPI.
This allows us to remove the extra version check and
will also give access to {lower,upper}_32_bits() unconditionally.

Sponsored-by: The FreeBSD Foundation
Reviewed-by: hselasky, rlibby, rstone
MFC-after: 2 weeks
X-MFC: to 13 only
Differential Revision: https://reviews.freebsd.org/D29391

3 years agoLinuxKPI: add lockdep_map
Bjoern A. Zeeb [Tue, 23 Mar 2021 16:51:08 +0000 (16:51 +0000)]
LinuxKPI: add lockdep_map

Add stubs for struct lockdep_map and three accessor functions
used by iwlwifi.

Obtained-from: bz_iwlwifi
Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: hselasky, emaste
Differential Revision: https://reviews.freebsd.org/D29398

3 years agoLinuxKPI: add pci_ids.h
Bjoern A. Zeeb [Tue, 23 Mar 2021 17:13:15 +0000 (17:13 +0000)]
LinuxKPI: add pci_ids.h

brcm80211 include pci_ids.h directly while historically we were tracking
IDs in pci.h.  Move the current set of IDs from pci.h to pci_ids.h and
while here add IDs for Realtek and Broadcom as well as a network class
as needed by their wireless drivers.

We still include pci_ids.h from pci.h so this should not change anything.

MFC-after: 2 weeks
Reviewed-by: hselasky
Differential Revision: https://reviews.freebsd.org/D29400

3 years agoLinuxKPI: if_ether additions
Bjoern A. Zeeb [Tue, 23 Mar 2021 16:44:56 +0000 (16:44 +0000)]
LinuxKPI: if_ether additions

Add various protocol IDs found in various wireless drivers.
Also add ETH_FRAME_LEN and struct ethhdr.

Obtained-from: bz_iwlwifi
Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: hselasky
Differential Revision: https://reviews.freebsd.org/D29397

3 years agoLinuxKPI: add more linux-specific errno
Bjoern A. Zeeb [Tue, 23 Mar 2021 16:37:35 +0000 (16:37 +0000)]
LinuxKPI: add more linux-specific errno

Add ERFKILL and EBADE found in iwlwifi and brcmfmac wireless drivers.
While here add a comment above the block of error numbers above 500 to
document expectations.

Obtained-from: bz_iwlwifi
Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: hselasky, emaste
Differential Revision: https://reviews.freebsd.org/D29396

3 years agortld: introduce PRELOAD_FDS
Mariusz Zaborski [Wed, 24 Mar 2021 21:10:33 +0000 (22:10 +0100)]
rtld: introduce PRELOAD_FDS

The new PRELOAD_FDS variable accepts a list of file descriptors
that should be loaded into the process.

This may be used to optimize a loading process - in the case when
we already have a file descriptor to the library; we don't have
to look into multiple PATH to find it.

It may also be used in capability mode to load a single additional
library without the need to open a directory that contains it.

The last use of this functionality t may be a race-free method
of loading libraries.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D29334

3 years agortld: style nits
Mariusz Zaborski [Wed, 24 Mar 2021 21:05:39 +0000 (22:05 +0100)]
rtld: style nits

No functional change intended.

Requested by: kib

3 years agoifconfig: 80211, add line break after key info
Bjoern A. Zeeb [Tue, 23 Mar 2021 15:08:46 +0000 (15:08 +0000)]
ifconfig: 80211, add line break after key info

Beauty correction for verbose mode or in case we print multiple key
information to not continue with the next options directly after
as we did so far, e.g.:
AES-CCM 2:128-bit
AES-CCM 3:128-bit powersavemode ...

Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: adrian
Differential Revision: https://reviews.freebsd.org/D29393

3 years agoofed/linuxkpi: use proper accessor function
Bjoern A. Zeeb [Sun, 21 Mar 2021 21:07:45 +0000 (21:07 +0000)]
ofed/linuxkpi: use proper accessor function

In the notifier event callback function rather than casting directly
to the expected type use the proper accessor function as the mlx drivers
already do.
This is preparational work to allow us to improve the struct net_device
is struct ifnet compat code shortcut in the future.

Obtained-from: bz_iwlwifi
Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: hselasky
Differential Revision: https://reviews.freebsd.org/D29364

3 years agolinuxkpi: add ieee80211_node.h to headers to include before LIST_HEAD
Bjoern A. Zeeb [Thu, 18 Mar 2021 22:23:15 +0000 (22:23 +0000)]
linuxkpi: add ieee80211_node.h to headers to include before LIST_HEAD

ieee80211_node.h uses LIST_HEAD() which LinuxKPI redefines and this
can lead to problems (see comment there).  Make sure the net80211
header file is handled correctly by adding it to the list of files
to include before re-defining the macro.
Also add header files needed as dependencies.

Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: philip, hselasky
Differential Revision: https://reviews.freebsd.org/D29336

3 years agonet80211: prefix get_random_bytes() with net80211_
Bjoern A. Zeeb [Thu, 18 Mar 2021 22:15:00 +0000 (22:15 +0000)]
net80211: prefix get_random_bytes() with net80211_

Both linux/random.h and net80211 have a function named
get_random_bytes().  With overlapping files included these collide.
Arguably the function could be renamed in linuxkpi but the generic
name should also not be used in net80211 so rename it there.

Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: philip, adrian
Differential Revision: https://reviews.freebsd.org/D29335

3 years agoalign nfsdumpstate column output
Caleb St. John [Wed, 24 Mar 2021 20:33:41 +0000 (16:33 -0400)]
align nfsdumpstate column output

There are scenarios where an NFS client will mount an NFSv4 export
without specifying a callback address.

When running nfsdumpstate under this circumstance, the column output is
shifted incorrectly which places the "ClientID" value underneath the
"Clientaddr" column.

This diff is a small cosmetic change that prints a blank in the
"Clientaddr" column and ensures the data for the columns are aligned
appropriately.

Submitted by: Caleb St. John
Reviewed by: sef (previous version)
MFC after: 3 days
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D18958

3 years agobhyve hostbridge: Rename "device" property to "devid".
John Baldwin [Wed, 24 Mar 2021 16:29:15 +0000 (09:29 -0700)]
bhyve hostbridge: Rename "device" property to "devid".

"device" is already used as the generic PCI-level name of the device
model to use (e.g. "hostbridge").  The result was that parsing
"hostbridge" as an integer failed and the host bridge used a device ID
of 0.  The EFI ROM asserts that the device ID of the hostbridge is not
0, so booting with the current EFI ROM was failing during the ROM
boot.

Fixes: 621b5090487de9fed1b503769702a9a2a27cc7bb

3 years agoGet rid of i386 ref here as linux64 is a 64-bit module.
Dmitry Chagin [Wed, 24 Mar 2021 15:56:46 +0000 (18:56 +0300)]
Get rid of i386 ref here as linux64 is a 64-bit module.

Reviewed By: emaste, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29412

3 years agoamd64: Make KPDPphys local to pmap.c
Mark Johnston [Wed, 24 Mar 2021 13:55:22 +0000 (09:55 -0400)]
amd64: Make KPDPphys local to pmap.c

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoipfilter: simplify ipf_proxy_check() return codes
Cy Schubert [Tue, 23 Mar 2021 03:11:58 +0000 (20:11 -0700)]
ipfilter: simplify ipf_proxy_check() return codes

ipf_proxy_check() returns -1 for an error and 0 or 1 for success.
ipf_proxy_check()'s callers check for error and if the return code
is 0, they change it to 1 prior to returning to their callers. Simply
by returning -1 or 1 we reduce complexity and cycles burned changing
0 to 1.

MFC after: 1 week

3 years agoFix warning about signed comparison and drop WARNS for ktrdump(8).
Dmitry Chagin [Wed, 24 Mar 2021 07:51:25 +0000 (10:51 +0300)]
Fix warning about signed comparison and drop WARNS for ktrdump(8).

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

3 years agorandom(9): Restore historical [0,2^31-1] output range and related man
Lawrence Stewart [Wed, 24 Mar 2021 04:25:49 +0000 (15:25 +1100)]
random(9): Restore historical [0,2^31-1] output range and related man
documention.

Commit SVN r364219 / Git 8a0edc914ffd changed random(9) to be a shim around
prng32(9) and inadvertently caused random(9) to begin returning numbers in the
range [0,2^32-1] instead of [0,2^31-1], where the latter has been the documented
range for decades.

The increased output range has been identified as the source of numerous bugs in
code written against the historical output range e.g. ipfw "prob" rules and
stats(3) are known to be affected, and a non-exhaustive audit of the tree
identified other random(9) consumers which are also likely affected.

As random(9) is deprecated and slated for eventual removal in 14.0, consumers
should gradually be audited and migrated to prng(9).

Submitted by: Loic Prylli <lprylli@netflix.com>
Obtained from: Netflix
Reviewed by: cem, delphij, imp
MFC after: 1 day
MFC to: stable/13, releng/13.0
Differential Revision: https://reviews.freebsd.org/D29385

3 years agolibevent1: fix layout of duplicated RB_ENTRY() definition
Kyle Evans [Wed, 24 Mar 2021 04:31:02 +0000 (23:31 -0500)]
libevent1: fix layout of duplicated RB_ENTRY() definition

3a509754ded1 removed the color field from our definition, but libevent1
has a copy of it off to the side to prevent event.h consumers from
*needing* to pull in sys/queue.h and sys/tree.h.

Update the event.h definition so that we don't accidentally end up with
two different views of struct event.

This appears to have no functional effect on anything in tree, but this
came up in a local patch to port if_switch(4) and related components
from OpenBSD.

MFC after: 1 week

3 years agoMakefile.inc1: unbreak bootstrap when kbdcontrol does not exist
Glen Barber [Wed, 24 Mar 2021 00:47:14 +0000 (20:47 -0400)]
Makefile.inc1: unbreak bootstrap when kbdcontrol does not exist

Reviewed by: arichardson
MFC after: 12 hours
MFC target: stable/13, releng/13.0
Differential Review: https://reviews.freebsd.org/D29200
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoFix build for non-vnet non-multipath kernels broken by
Alexander V. Chernikov [Tue, 23 Mar 2021 23:35:23 +0000 (23:35 +0000)]
Fix build for non-vnet non-multipath kernels broken by
 a0308e48ec12ae37f525aa3c6d3c1a236fb55dcd.

3 years agoFix panic when destroying interface with ECMP routes.
Alexander V. Chernikov [Tue, 23 Mar 2021 22:00:04 +0000 (22:00 +0000)]
Fix panic when destroying interface with ECMP routes.

Reported by: Zhenlei Huang <zlei.huang at gmail.com>
PR: 254496
MFC after: immediately

3 years agonfsv4 client: fix forced dismount when sleeping in the renew thread
Rick Macklem [Tue, 23 Mar 2021 20:04:37 +0000 (13:04 -0700)]
nfsv4 client: fix forced dismount when sleeping in the renew thread

During a recent NFSv4 testing event a test server caused a hang
where "umount -N" failed.  The renew thread was sleeping on "nfsv4lck"
and the "umount" was sleeping, waiting for the renew thread to
terminate.

This is the second of two patches that is hoped to fix the renew thread
so that it will terminate when "umount -N" is done on the mount.

This patch adds a 5second timeout on the msleep()s and checks for
the forced dismount flag so that the renew thread will
wake up and see the forced dismount flag.  Normally a wakeup()
will occur in less than 5seconds, but if a premature return from
msleep() does occur, it will simply loop around and msleep() again.
The patch also adds the "mp" argument to nfsv4_lock() so that it
will return when the forced dismount flag is set.

While here, replace the nfsmsleep() wrapper that was used for portability
with the actual msleep() call.

MFC after: 2 weeks

3 years agomakefs: Ignore the "tags" keyword in mtree manifests
Mark Johnston [Tue, 23 Mar 2021 18:38:28 +0000 (14:38 -0400)]
makefs: Ignore the "tags" keyword in mtree manifests

An install using -DNO_ROOT emits mtree entries containing tags used by
pkgbase.  makefs(8) can safely ignore them, so do that rather than
emitting a warning for each entry.

Reviewed by: brooks, imp
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29384

3 years agodummynet: Move timekeeping information into dn_cfg
Kristof Provost [Tue, 9 Mar 2021 15:44:26 +0000 (16:44 +0100)]
dummynet: Move timekeeping information into dn_cfg

Just like with the packet counters move the timekeeping information into
dn_cfg. This reduces the global name space use for dummynet and will
make subsequent work to add vnet support and re-use in pf easier.

Reviewed by: donner
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Different Revision: https://reviews.freebsd.org/D29246

3 years agodummynet: Move packet counters into dn_cfg
Kristof Provost [Tue, 9 Mar 2021 15:27:31 +0000 (16:27 +0100)]
dummynet: Move packet counters into dn_cfg

Move the packets counters into the dn_cfg struct. This reduces the
global name space use for dummynet and will make future work for things
like vnet support and re-use in pf easier.

Reviewed by: donner
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29245

3 years agoReplace the arm64 initial_fpcr with a macro
Andrew Turner [Tue, 23 Mar 2021 15:28:20 +0000 (15:28 +0000)]
Replace the arm64 initial_fpcr with a macro

This value was never changed from its default value. Replace it with a
macro.

Sponsored by: Innovate UK

3 years agosyslogd: Increase message size limits
Dmitry Wagin [Tue, 23 Mar 2021 16:15:28 +0000 (12:15 -0400)]
syslogd: Increase message size limits

Add a -M option to control the maximum length of forwarded messages.
syslogd(8) used to truncate forwarded messages to 1024 bytes, but after
commit 1a874a126a54 ("Add RFC 5424 syslog message output to syslogd.")
applies a more conservative limit of 480 bytes for IPv4 per RFC 5426
section 3.2.  Restore the old default behaviour of truncating to 1024
bytes.  RFC 5424 specifies no upper limit on the length of forwarded
messages, while for RFC 3164 the limit is 1024 bytes.

Increase MAXLINE to 8192 bytes to correspond to commit 672ef817a192.

Replaced bootfile[] size for MAXPATHLEN used in getbootfile(3) as a
returned value. Using (MAXLINE+1) as a size for bootfile[] is excessive.

PR: 241937
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D27206

3 years agolibc: Some enhancements to syslog(3)
Dmitry Wagin [Tue, 23 Mar 2021 16:01:15 +0000 (12:01 -0400)]
libc: Some enhancements to syslog(3)

- Defined MAXLINE constant (8192 octets by default instead 2048) for
  centralized limit setting up. It sets maximum number of characters of
  the syslog message. RFC5424 doesn't limit maximum size of the message.
  Named after MAXLINE in syslogd(8).
- Fixed size of fmt_cpy buffer up to MAXLINE for rendering formatted
  (%m) messages.
- Introduced autoexpansion of sending socket buffer up to MAXLINE.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D27205

3 years agoarm64: Only check for freebsd,dts-version if we are booted in FDT mode.
Emmanuel Vadot [Tue, 23 Mar 2021 15:37:25 +0000 (16:37 +0100)]
arm64: Only check for freebsd,dts-version if we are booted in FDT mode.

Reported by:   andrew

3 years agoarm64: Check dtb version against the one we're expecting to find
Emmanuel Vadot [Tue, 23 Mar 2021 14:24:14 +0000 (15:24 +0100)]
arm64: Check dtb version against the one we're expecting to find

Do for arm64 what was done for armv7 in e63faa9ba832b6

3 years agopf: Handle unmapped mbufs when computing checksums
Mark Johnston [Tue, 23 Mar 2021 13:38:59 +0000 (09:38 -0400)]
pf: Handle unmapped mbufs when computing checksums

PR: 254419
Reviewed by: gallatin, kp
Tested by: Igor A. Valkov <viaprog@gmail.com>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29378

3 years agodts: Bump the freebsd branding version to 5.10
Emmanuel Vadot [Tue, 23 Mar 2021 14:02:21 +0000 (15:02 +0100)]
dts: Bump the freebsd branding version to 5.10

3 years agoUpdate DTS files from Linux v5.10
Emmanuel Vadot [Tue, 23 Mar 2021 14:00:35 +0000 (15:00 +0100)]
Update DTS files from Linux v5.10

3 years agoFix scripted installs on EFI systems after default mounting of the ESP.
Nathan Whitehorn [Tue, 23 Mar 2021 13:19:42 +0000 (09:19 -0400)]
Fix scripted installs on EFI systems after default mounting of the ESP.

Because the ESP mount point (/boot/efi) is in mtree, tar will attempt to
extract a directory at that point post-mount when the system is installed.
Normally, this is fine, since tar can happily set whatever properties it
wants. For FAT32 file systems, however, like the ESP, tar will attempt to
set mtime on the root directory, which FAT does not support, and tar will
interpret this as a fatal error, breaking the install (see
https://github.com/libarchive/libarchive/issues/1516). This issue would
also break scripted installs on bare-metal POWER8, POWER9, and PS3
systems, as well as some ARM systems.

This patch solves the problem in two ways:
- If stdout is a TTY, use the distextract stage instead of tar, as in
  interactive installs. distextract solves this problem internally and
  provides a nicer UI to boot, but requires a TTY.
- If stdout is not a TTY, use tar but, as a stopgap for 13.0, exclude
  boot/efi from tarball extraction and then add it by hand. This is a
  hack, and better solutions (as in the libarchive ticket above) will
  obsolete it, but it solves the most common case, leaving only
  unattended TTY-less installs on a few tier-2 platforms broken.

In addition, fix a bug with fstab generation uncovered once the tar issue
is fixed that umount(8) can depend on the ordering of lines in fstab in a
way that mount(8) does not. The partition editor now writes out fstab in
mount order, making sure umount (run at the end of scripted, but not
interactive, installs) succeeds.

PR: 254395
Reviewed by: gjb, imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29380

3 years agogpioc_detach: fix freeing of wrong pointers
Andriy Gapon [Tue, 23 Mar 2021 10:45:18 +0000 (12:45 +0200)]
gpioc_detach: fix freeing of wrong pointers

MFC after: 1 week

3 years agoxen/netback: do not attempt to connect in the Initialised state
Roger Pau Monné [Tue, 16 Mar 2021 11:43:49 +0000 (12:43 +0100)]
xen/netback: do not attempt to connect in the Initialised state

Only attempt to fetch the configuration data and connect the shared
ring once the frontend has switched to the 'Connected' state. This
seems to be inline with what Linux netback does, and is required to
make newer versions of NetBSD netfront work, since NetBSD only
publishes the required configuration before switching to the Connected
state.

MFC after: 1 week
Sponsored by: Citrix Systems R&D

3 years agobhyve amd: Small cleanups in amdvi_dump_cmds
Ka Ho Ng [Tue, 23 Mar 2021 08:11:56 +0000 (16:11 +0800)]
bhyve amd: Small cleanups in amdvi_dump_cmds

Bump offset with MOD_INC instead in amdvi_dump_cmds.

Reviewed by: jhb
Approved by: philip (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28862

3 years agoloader: insert spaces around menu title
Toomas Soome [Tue, 23 Mar 2021 05:04:48 +0000 (07:04 +0200)]
loader: insert spaces around menu title

Small visual nit, make menu title more clean

MFC after: 3 days

3 years agoGeneralize bus_space(9) and atomic(9) sanitizer interceptors
Mark Johnston [Tue, 23 Mar 2021 01:44:55 +0000 (21:44 -0400)]
Generalize bus_space(9) and atomic(9) sanitizer interceptors

Make it easy to define interceptors for new sanitizer runtimes, rather
than assuming KCSAN.  Lay a bit of groundwork for KASAN and KMSAN.

When a sanitizer is compiled in, atomic(9) and bus_space(9) definitions
in atomic_san.h are used by default instead of the inline
implementations in the platform's atomic.h.  These definitions are
implemented in the sanitizer runtime, which includes
machine/{atomic,bus}.h with SAN_RUNTIME defined to pull in the actual
implementations.

No functional change intended.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

3 years agoTeach DTrace that unaligned accesses are OK on aarch64, not just x86.
Robert Watson [Mon, 22 Mar 2021 01:50:00 +0000 (01:50 +0000)]
Teach DTrace that unaligned accesses are OK on aarch64, not just x86.

MFC after: 3 days
Reviewed: andrew
Differential Revision: https://reviews.freebsd.org/D29369

3 years agoTune DTrace 'aframes' for the FBT and profile providers on arm64.
Robert Watson [Sun, 21 Mar 2021 00:01:54 +0000 (00:01 +0000)]
Tune DTrace 'aframes' for the FBT and profile providers on arm64.
In both cases, too few frames were trimmed, leading to exception handling
or DTrace internals being exposed in stack traces exposed by D's stack()
primitive.

MFC after: 3 days
Reviewed by: emaste, andrew

3 years agoBump documentation date after recent updates to bsdinstall.8.
Nathan Whitehorn [Mon, 22 Mar 2021 23:41:49 +0000 (19:41 -0400)]
Bump documentation date after recent updates to bsdinstall.8.

3 years agoInclude examples of how to build script-install media.
Nathan Whitehorn [Mon, 22 Mar 2021 14:20:29 +0000 (10:20 -0400)]
Include examples of how to build script-install media.

3 years agoImprove example install scripts, making them simpler and more robust.
Nathan Whitehorn [Mon, 22 Mar 2021 14:08:55 +0000 (10:08 -0400)]
Improve example install scripts, making them simpler and more robust.

In particular:
- There is no need to do anything with gpart (the installer does that
  for you).
- There is no need to specify the network interface, since we have
  an option for defaults.

3 years agoretire obsolete mn(4) sync serial driver
Ed Maste [Mon, 22 Mar 2021 19:06:51 +0000 (15:06 -0400)]
retire obsolete mn(4) sync serial driver

Approved by: phk
Relnotes: yes

3 years agorsu: add KASSERT to document maximum mbuf size in rsu_tx_start
Ed Maste [Mon, 22 Mar 2021 18:34:31 +0000 (14:34 -0400)]
rsu: add KASSERT to document maximum mbuf size in rsu_tx_start

PR: 254479
Reviewed by: markj
Sponsored by: The FreeBSD Foundation

3 years agoSilence unused parameter warnings in the RISC-V fenv.h
Alex Richardson [Mon, 22 Mar 2021 17:47:50 +0000 (17:47 +0000)]
Silence unused parameter warnings in the RISC-V fenv.h

After increasing the lib/msun/tests WARNS to 6, this triggers a
compilation error for RISC-V.

Fixes: 87d65c747a43 ("lib/msun: Allow building tests with WARNS=6")
Reported by: Jenkins

3 years agoCorrect "Fondation" typo (missing "u")
Ed Maste [Mon, 22 Mar 2021 17:06:03 +0000 (13:06 -0400)]
Correct "Fondation" typo (missing "u")