]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agolinux(4): Modify sv_onexec hook to return an error.
Dmitry Chagin [Tue, 20 Jul 2021 06:56:25 +0000 (09:56 +0300)]
linux(4): Modify sv_onexec hook to return an error.

Temporary add stubs to the Linux emulation layer which calls the existing hook.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D30911
MFC after: 2 weeks

2 years agoCall sv_onexec hook after the process VA is created.
Dmitry Chagin [Tue, 20 Jul 2021 06:55:14 +0000 (09:55 +0300)]
Call sv_onexec hook after the process VA is created.

For future use in the Linux emulation layer call sv_onexec hook right after
the new process address space is created. It's safe, as sv_onexec used only
by Linux abi and linux_on_exec() does not depend on a state of process VA.

Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D30899
MFC after: 2 weeks

2 years agoRemove bogus cast from exec_sysvec_init().
Dmitry Chagin [Tue, 20 Jul 2021 06:54:09 +0000 (09:54 +0300)]
Remove bogus cast from exec_sysvec_init().

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D30910
MFC after: 2 weeks

2 years agoModify exec_sysvec_init() to allow non-native abi to setup their sysentvecs.
Dmitry Chagin [Tue, 20 Jul 2021 06:53:21 +0000 (09:53 +0300)]
Modify exec_sysvec_init() to allow non-native abi to setup their sysentvecs.

For future use in the Linux emulation layer modify the exec_sysvec_init()
to allow non-native abi to fill sv_timekeep_base and sv_shared_page_obj.

Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D30898
MFC after: 2 weeks

2 years agolinux(4): Remove function prototypes from the vDSO.
Dmitry Chagin [Tue, 20 Jul 2021 06:52:08 +0000 (09:52 +0300)]
linux(4): Remove function prototypes from the vDSO.

In preparation for vDSO code revision get rid of incomplete vDSO methods
from locore, but leave .note.Linux section commented out.
.note.Linux section is used by glibc rtld to get the kernel version, that
saves one system call call. I'll try to implement it later, if figure out
how to use it with jails.

MFC after: 2 weeks

2 years agoelf: Remove R_RISCV_[GT]PREL_[IS] relocation defines
Jessica Clarke [Tue, 20 Jul 2021 05:13:43 +0000 (06:13 +0100)]
elf: Remove R_RISCV_[GT]PREL_[IS] relocation defines

These were internal binutils relocations that have no way to be
generated in assembly nor will ever be seen in the output, and so should
never have been defined in the psABI in the first place. They have
therefore been removed from the spec as of [1], so do so here too.

[1] https://github.com/riscv/riscv-elf-psabi-doc/commit/44f98e0fd8104def00f2a5a8d94b23dd647d18fb

2 years agoawk: remove proctab.c
Warner Losh [Mon, 12 Jul 2021 03:26:08 +0000 (21:26 -0600)]
awk: remove proctab.c

proctab.c is a generated file and never should have been committed to
the tree. This file has been added and removed a couple of times, most
recently added by me in my 2019 updates.

Sponsored by: Netflix

2 years agoawk: Add more details top the FS variable
Warner Losh [Tue, 20 Jul 2021 02:10:22 +0000 (20:10 -0600)]
awk: Add more details top the FS variable

The current description of the FS is true, but only part of the
truth. Add information about single characters and note that FS="" is
undefined by the standard, though the two other awk implenetations (mawk
and gawk) also have this interpretation.

PR: 226112
Sponsored by: Netflix

2 years agonfscl: Send stateid.seqid of 0 for NFSv4.1/4.2 mounts
Rick Macklem [Tue, 20 Jul 2021 00:35:39 +0000 (17:35 -0700)]
nfscl: Send stateid.seqid of 0 for NFSv4.1/4.2 mounts

For NFSv4.1/4.2, the client may set the "seqid" field of the
stateid to 0 in RPC requests.  This indicates to the server that
it should not check the "seqid" or return NFSERR_OLDSTATEID if the
"seqid" value is not up to date w.r.t. Open/Lock operations
on the stateid.  This "seqid" is incremented by the NFSv4 server
for each Open/OpenDowngrade/Lock/Locku operation done on the stateid.

Since a failure return of NFSERR_OLDSTATEID is of no use to
the client for I/O operations, it makes sense to set "seqid"
to 0 for the stateid argument for I/O operations.
This avoids server failure replies of NFSERR_OLDSTATEID,
although I am not aware of any case where this failure occurs.

This makes the FreeBSD NFSv4.1/4.2 client compatible with the
Linux NFSv4.1/4.2 client.

MFC after: 2 weeks

2 years agocxgbei: Don't assert F for data completion PDUs.
John Baldwin [Mon, 19 Jul 2021 22:36:31 +0000 (15:36 -0700)]
cxgbei: Don't assert F for data completion PDUs.

If a data PDU encounters an error such as a digest error, the firmware
will report that data PDU when completion moderation is active even if
it is not the final data PDU in a burst.

Sponsored by: Chelsio Communications

2 years agocxgbei: Remove invalid assertion.
John Baldwin [Mon, 19 Jul 2021 22:36:31 +0000 (15:36 -0700)]
cxgbei: Remove invalid assertion.

A non-placed PDU can be delivered by CPL_RX_ISCSI_CMP in the middle of
a burst of placed PDUs (received via DDP) in which case the rcv_nxt
will not match the start of the non-placed PDU.

Reported by: Jithesh Arakkan @ Chelsio
Sponsored by: Chelsio Communications

2 years agotcp: fix RACK and BBR when using VIMAGE enabled kernel
Michael Tuexen [Mon, 19 Jul 2021 22:29:18 +0000 (00:29 +0200)]
tcp: fix RACK and BBR when using VIMAGE enabled kernel

Fix a bug in VNET handling, which occurs when using specific NICs.
PR: 257195
Reviewed by: rrs
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D31212

2 years agozfs: Remove zfs-images submodule
Ed Maste [Mon, 14 Jun 2021 13:31:39 +0000 (09:31 -0400)]
zfs: Remove zfs-images submodule

This can cause issues like 'No url found for submodule path' in
downstream or derived projects making use of submodules.

Reviewed by: imp

2 years agoacpi: Fix a repeated comment typo
Jessica Clarke [Mon, 19 Jul 2021 16:19:23 +0000 (17:19 +0100)]
acpi: Fix a repeated comment typo

2 years agoacpi: Fix a repeated vm_offset_t that should be a vm_size_t
Jessica Clarke [Mon, 19 Jul 2021 16:19:23 +0000 (17:19 +0100)]
acpi: Fix a repeated vm_offset_t that should be a vm_size_t

The underlying types for both are the same so arguably this doesn't
really matter, but using the wrong type is still confusing and
technically incorrect.

2 years agoarm64: std.allwinner: Add aw_syscon
Emmanuel Vadot [Mon, 19 Jul 2021 15:31:57 +0000 (17:31 +0200)]
arm64: std.allwinner: Add aw_syscon

This was missed during the conversion of kernel configs
PR: 257278
Reported by:  Manuel Stühn <freebsd@justmail.de>

2 years agoDon't build lldb-tablegen if MK_LLDB=no
Alex Richardson [Mon, 5 Jul 2021 17:36:02 +0000 (18:36 +0100)]
Don't build lldb-tablegen if MK_LLDB=no

Split out from D31060.

Reviewed by: emaste

2 years agoAllow building usr.bin/vi with MK_ASAN
Alex Richardson [Mon, 19 Jul 2021 14:04:19 +0000 (15:04 +0100)]
Allow building usr.bin/vi with MK_ASAN

We have to namespace the regex functions to avoid duplicate symbol errors.
This also ensures that vi doesn't define the libc reg* functions with
mismatched signatures.

ld: error: duplicate symbol: regcomp
>>> defined at sanitizer_common_interceptors.inc:7519 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7519)
>>>            asan_interceptors.o:(__interceptor_regcomp) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regcomp.c
>>>            .../regex/regcomp.c.o:(.text+0x0)

ld: error: duplicate symbol: regerror
>>> defined at sanitizer_common_interceptors.inc:7543 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7543)
>>>            asan_interceptors.o:(__interceptor_regerror) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regerror.c
>>>            .../regex/regerror.c.o:(.text+0x0)

ld: error: duplicate symbol: regexec
>>> defined at sanitizer_common_interceptors.inc:7530 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7530)
>>>            asan_interceptors.o:(__interceptor_regexec) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regexec.c
>>>            .../regex/regexec.c.o:(.text+0x0)

ld: error: duplicate symbol: regfree
>>> defined at sanitizer_common_interceptors.inc:7553 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:7553)
>>>            asan_interceptors.o:(__interceptor_regfree) in archive /usr/lib/clang/10.0.1/lib/freebsd/libclang_rt.asan-x86_64.a
>>> defined at regfree.c
>>>            .../regex/regfree.c.o:(.text+0x0)

Committed upstream as https://github.com/lichray/nvi2/pull/92

Reviewed By: bapt
Differential Revision: https://reviews.freebsd.org/D31050

2 years agobin/ps: Avoid function name conflict with libc uname()
Alex Richardson [Mon, 19 Jul 2021 14:03:38 +0000 (15:03 +0100)]
bin/ps: Avoid function name conflict with libc uname()

This prevents ps from being built with address sanitizer instrumentation.

Reviewed By: trasz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31048

2 years agopf: shrink struct pf_kstate
Mateusz Guzik [Mon, 19 Jul 2021 12:35:31 +0000 (14:35 +0200)]
pf: shrink struct pf_kstate

Makes room for a pointer.

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

2 years agopf: add a comment to pf_kstate concerning compat with pf_state_cmp
Mateusz Guzik [Mon, 19 Jul 2021 12:17:33 +0000 (14:17 +0200)]
pf: add a comment to pf_kstate concerning compat with pf_state_cmp

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

2 years agopf: add a branch prediction to expire state check in pf_find_state
Mateusz Guzik [Mon, 19 Jul 2021 12:50:08 +0000 (14:50 +0200)]
pf: add a branch prediction to expire state check in pf_find_state

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

2 years agoarm: dedup counter(9) address calculation
Mateusz Guzik [Mon, 19 Jul 2021 10:46:01 +0000 (10:46 +0000)]
arm: dedup counter(9) address calculation

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

2 years agoarm: retire bcopy
Mateusz Guzik [Mon, 19 Jul 2021 09:53:02 +0000 (09:53 +0000)]
arm: retire bcopy

It is obsolete since ba96f37758412151 ("Use __builtin for various mem*
and b* (e.g. bzero) routines.")

Discussed with: cognet
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoarm: bcmp -> memcmp
Mateusz Guzik [Mon, 19 Jul 2021 09:52:23 +0000 (09:52 +0000)]
arm: bcmp -> memcmp

The bcmp symbol is not used, at the same time memcmp as pulled from
libkern does byte-by-byte comparison.

So happens bcmp as found in support.S is in fact renamed memcmp, rename
it back.

Discussed with: cognet
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agokenv: allow listing of static kernel environments
Kyle Evans [Sun, 20 Jun 2021 19:36:10 +0000 (14:36 -0500)]
kenv: allow listing of static kernel environments

The early environment is typically cleared, so these new options
need the PRESERVE_EARLY_KENV kernel config(8) option. These environments
are reported as missing by kenv(1) if the option is not present in the
running kernel.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D30835

2 years agokern: add an option for preserving the early kenv
Kyle Evans [Sun, 20 Jun 2021 19:29:31 +0000 (14:29 -0500)]
kern: add an option for preserving the early kenv

Some downstream configurations do not store secrets in the
early (loader/static) environments and desire a way to preserve these
for diagnostic reasons.  Provide an option to do so.

Reviewed by: imp, jhb (earlier version)
Differential Revision: https://reviews.freebsd.org/D30834

2 years agokenv: s/dump/list/ to clarify meaning
Kyle Evans [Mon, 21 Jun 2021 03:11:26 +0000 (22:11 -0500)]
kenv: s/dump/list/ to clarify meaning

The contents of the kenv will be dumped to stdout, while dump could have
also meant 'discard'. Call it 'list' instead.

Suggested by: imp
Reviewed by: imp, jhb
Differential Revision: https://reviews.freebsd.org/D30836

2 years agoarm64: std.allwinner: Fix mismerge
Emmanuel Vadot [Sun, 18 Jul 2021 16:35:47 +0000 (18:35 +0200)]
arm64: std.allwinner: Fix mismerge

Re-add aw_r_intc and remove duplicate a10_codec

2 years agoarm64: Add per SoC family kernel config
Emmanuel Vadot [Fri, 5 Feb 2021 20:41:06 +0000 (21:41 +0100)]
arm64: Add per SoC family kernel config

There is multiple reason for this :
- This makes it easier to see which driver is needed for each SoC
- This makes it easier to create a custom config for one SoC
- This really reduce boot time (which some people might want)

Some explaination about the files :
- std.arm64 contains all standard kernel option
- std.dev contains all the standard kernel devices
- std.<soc> contains all drivers needed to boot on this SoC family
- <SOC> includes std.arm64, std.dev and std.<soc>
- GENERIC includes std.arm64, std.dev and all std.<soc>

Sponsored by: Diablotin Systems
MFC After: 2 months
Reviewed by: mmel, cognet, imp
Differential Revision:       https://reviews.freebsd.org/D30474

2 years agoarm: TI AM335x fix gpio_pin numbers in lookup table.
Oskar Holmlund [Sun, 18 Jul 2021 11:06:26 +0000 (13:06 +0200)]
arm: TI AM335x fix gpio_pin numbers in lookup table.

gpio_pin are calculated as [GPIO_BANK]*32 + GPIO_PIN.
gpio_pin are wrong for these pins.
As a consequence wrong pins are acquired and used.

Approved by: manu (mentor)
Reported by: Martin Zakardissnehf
(martin.zakardissnehf@se.abb.com)
Differential revision: https://reviews.freebsd.org/D31164

2 years agoixgbe: Clean up ix_txrx
Kevin Bowling [Sun, 18 Jul 2021 06:24:28 +0000 (23:24 -0700)]
ixgbe: Clean up ix_txrx

The intention here is to reduce differences with D30072.
The only functional change is logical simplification in
ixgbe_rx_checksum.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D30074

2 years agoFix build
Xin LI [Sun, 18 Jul 2021 05:51:28 +0000 (22:51 -0700)]
Fix build

MFC after: 2 weeks

2 years agoless: upgrade to v590.
Xin LI [Sun, 18 Jul 2021 05:20:44 +0000 (22:20 -0700)]
less: upgrade to v590.

MFC after: 2 weeks

2 years agoVendor import of less v590.
Xin LI [Sun, 18 Jul 2021 05:00:54 +0000 (22:00 -0700)]
Vendor import of less v590.

2 years agovmd_bus: Fix typo in comment
Neel Chauhan [Sat, 17 Jul 2021 21:31:57 +0000 (14:31 -0700)]
vmd_bus: Fix typo in comment

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D31210

2 years agozfs: add missed dependency of zfs module on zlib
Konstantin Belousov [Sat, 17 Jul 2021 14:59:47 +0000 (17:59 +0300)]
zfs: add missed dependency of zfs module on zlib

Reviewed by: mm
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31207

2 years agocam: Mark the qos data is valid in xpd_done_direct() too.
Warner Losh [Sat, 17 Jul 2021 22:10:46 +0000 (16:10 -0600)]
cam: Mark the qos data is valid in xpd_done_direct() too.

Sponsored by: Netflix

2 years agopf tests: test locally originated connections with route-to
Kristof Provost [Wed, 14 Jul 2021 10:33:37 +0000 (12:33 +0200)]
pf tests: test locally originated connections with route-to

PR: 257106
Submitted by: Mark Cammidge <mark@peralex.com>
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D31178

2 years agopf: locally originating connections with 'route-to' fail
Kristof Provost [Wed, 14 Jul 2021 10:17:03 +0000 (12:17 +0200)]
pf: locally originating connections with 'route-to' fail

Similar to the REPLY_TO shortcut (6d786845cf) we also can't shortcut
ROUTE_TO. If we do we will fail to apply transformations or update the
state, which can lead to premature termination of the connections.

PR: 257106
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31177

2 years agopf: Remove unused arguments from pf_send_tcp()
Kristof Provost [Wed, 19 May 2021 18:33:28 +0000 (20:33 +0200)]
pf: Remove unused arguments from pf_send_tcp()

struct mbuf *replyto is not actually used (and only rarely provided).
The same applies to struct ifnet *ifp.

No functional change.

Reviewed by: mjg
MFC after: 1 week
Sponsored by:   Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31136

2 years agopf.conf.5: Document new 'match' keyword
Kristof Provost [Tue, 2 Mar 2021 19:34:41 +0000 (20:34 +0100)]
pf.conf.5: Document new 'match' keyword

Reviewed by: bcr
Obtained from: pfSense
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31117

2 years agopf tests: Test the match keyword
Kristof Provost [Tue, 2 Mar 2021 15:57:27 +0000 (16:57 +0100)]
pf tests: Test the match keyword

The new match keyword can currently only assign queues, so we can only
test it with ALTQ.
Set up a basic scenario where we use 'match' to assign ICMP traffic to a
slow queue, and confirm that it's really getting slowed down.

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

2 years agopf: match keyword support
Kristof Provost [Tue, 2 Mar 2021 15:01:04 +0000 (16:01 +0100)]
pf: match keyword support

Support the 'match' keyword.
Note that support is limited to adding queuing information, so without
ALTQ support in the kernel setting match rules is pointless.

For the avoidance of doubt: this is NOT full support for the match
keyword as found in OpenBSD's pf. That could potentially be built on top
of this, but this commit is NOT that.

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

2 years agoRELNOTES: Add an entry for commit ee29e6f31111
Rick Macklem [Fri, 16 Jul 2021 22:33:52 +0000 (15:33 -0700)]
RELNOTES: Add an entry for commit ee29e6f31111

2 years agoUPDATING: Add entry for commit ee29e6f31111
Rick Macklem [Fri, 16 Jul 2021 22:23:46 +0000 (15:23 -0700)]
UPDATING: Add entry for commit ee29e6f31111

2 years agoparam.h: Bump __FreeBSD_version to 1400026 for commit ee29e6f31111
Rick Macklem [Fri, 16 Jul 2021 22:13:27 +0000 (15:13 -0700)]
param.h: Bump __FreeBSD_version to 1400026 for commit ee29e6f31111

Commit ee29e6f31111 changed the internal KAPI between the nfscommon
and nfsd modules.  Bump __FreeBSD_version to 1400026 since both
modules will need to be rebuilt from sources.

2 years agonfsd: Add sysctl to set maximum I/O size up to 1Mbyte
Rick Macklem [Fri, 16 Jul 2021 22:01:03 +0000 (15:01 -0700)]
nfsd: Add sysctl to set maximum I/O size up to 1Mbyte

Since MAXPHYS now allows the FreeBSD NFS client
to do 1Mbyte I/O operations, add a sysctl called vfs.nfsd.srvmaxio
so that the maximum NFS server I/O size can be set up to 1Mbyte.
The Linux NFS client can also do 1Mbyte I/O operations.

The default of 128Kbytes for the maximum I/O size has
not been changed for two reasons:
- kern.ipc.maxsockbuf must be increased to support 1Mbyte I/O
- The limited benchmarking I can do actually shows a drop in I/O rate
  when the I/O size is above 256Kbytes.
However, daveb@spectralogic.com reports seeing an increase
in I/O rate for the 1Mbyte I/O size vs 128Kbytes using a Linux client.

Reviewed by: asomers
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30826

2 years agotcp: When rack or bbr get a pullup failure in the common code, don't free the NULL...
Randall Stewart [Fri, 16 Jul 2021 17:59:57 +0000 (13:59 -0400)]
tcp: When rack or bbr get a pullup failure in the common code, don't free the NULL mbuf.

There is a bug in the error path where rack_bbr_common does a m_pullup() and the pullup fails.
There is a stray mfree(m) after m is set to NULL. This is not a good idea :-)

Reviewed by: tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D31194

2 years agoPass the syscall number to capsicum permission-denied signals
David Chisnall [Sat, 10 Jul 2021 16:19:52 +0000 (17:19 +0100)]
Pass the syscall number to capsicum permission-denied signals

The syscall number is stored in the same register as the syscall return
on amd64 (and possibly other architectures) and so it is impossible to
recover in the signal handler after the call has returned.  This small
tweak delivers it in the `si_value` field of the signal, which is
sufficient to catch capability violations and emulate them with a call
to a more-privileged process in the signal handler.

This reapplies 3a522ba1bc852c3d4660a4fa32e4a94999d09a47 with a fix for
the static assertion failure on i386.

Approved by: markj (mentor)

Reviewed by: kib, bcr (manpages)

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

2 years agoMerge llvm-project 12.0.1 release
Dimitry Andric [Fri, 16 Jul 2021 16:29:42 +0000 (18:29 +0200)]
Merge llvm-project 12.0.1 release

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.1-0-gfed41342a82f, a.k.a. 12.0.1 release.

PR: 255570
MFC after: 6 weeks

2 years agoAdd some missing osd.9 MLINKs
Mark Johnston [Fri, 16 Jul 2021 16:13:51 +0000 (12:13 -0400)]
Add some missing osd.9 MLINKs

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoHide arm64 features that don't have a HWCAP
Andrew Turner [Thu, 15 Jul 2021 23:22:07 +0000 (23:22 +0000)]
Hide arm64 features that don't have a HWCAP

We should only export MSR fields if there is also a HWCAP so it doesn't
matter which software uses.

Sponsored by: The FreeBSD Foundation

2 years agotcp: Lro needs to validate that it does not go beyond the end of the mbuf as it parses.
Randall Stewart [Fri, 16 Jul 2021 10:07:13 +0000 (06:07 -0400)]
tcp: Lro needs to validate that it does not go beyond the end of the mbuf as it parses.

Currently the LRO parser, if given a packet that say has ETH+IP header but the TCP header
is in the next mbuf (split), would walk garbage. Lets make sure we keep track as we
parse of the length and return NULL anytime we exceed the length of the mbuf.

Reviewed by: tuexen, hselasky
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D31195

2 years agoixgbe: Print FW NVM and Option ROM versions
Kevin Bowling [Fri, 16 Jul 2021 06:50:14 +0000 (23:50 -0700)]
ixgbe: Print FW NVM and Option ROM versions

It can be useful for system operators to see this kind of information
when correlating issues or requesting support from the OEM or Intel for
hardware and firmware issues.

Reviewed by: gallatin
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30178

2 years agofreebsd-update: create a ZFS boot environment on install
Dave Fullard [Fri, 16 Jul 2021 04:02:48 +0000 (23:02 -0500)]
freebsd-update: create a ZFS boot environment on install

Updated freebsd-update to allow it to create boot environments using
bectl should the system support it. The bectl utility was updated in
r352211 (490e13c1403f) to support a 'check' to determine if the system
supports boot environments.  If UFS is used, the bectl check will fail
then no attempt will be made to create the boot environment.

If freebsd-update is run inside a jail, no attempt will be made to
create a boot environment.

The boot environment function will create a new environment using the
format: current FreeBSD kernel version and date/timestamp, example:

12.0-RELEASE-p10_2019-10-03_185233

This functionality can be disabled by setting 'CreateBootEnv' in
freebsd-update.conf to 'no'.

Discussed with: allanjude
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21892

2 years agocallout: Make cc_cpu local to kern_timeout.c
Mark Johnston [Fri, 16 Jul 2021 02:40:23 +0000 (22:40 -0400)]
callout: Make cc_cpu local to kern_timeout.c

No functional change intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agonfssvc: Zero the buffer copied out when NFSSVC_DUMPMNTOPTS is set
Mark Johnston [Fri, 16 Jul 2021 02:39:27 +0000 (22:39 -0400)]
nfssvc: Zero the buffer copied out when NFSSVC_DUMPMNTOPTS is set

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

2 years agolio_listio: Don't post a completion notification if none was requested
Mark Johnston [Fri, 16 Jul 2021 02:38:46 +0000 (22:38 -0400)]
lio_listio: Don't post a completion notification if none was requested

One is allowed to use LIO_NOWAIT without specifying a sigevent.  In this
case, lj->lioj_signal is left uninitialized, but several code paths
examine liov_signal.sigev_notify to figure out which notification to
post.  Unconditionally initialize that field to SIGEV_NONE.

Add a dumb test case which triggers the bug.

Reported by: KMSAN+syzkaller
Reviewed by: asomers
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31197

2 years agolibc: Use the initial-exec TLS model
Mark Johnston [Fri, 16 Jul 2021 02:35:28 +0000 (22:35 -0400)]
libc: Use the initial-exec TLS model

This permits more efficient accesses of thread-local variables, which
are heavily used at least by jemalloc and locale-aware code.  Note that
on amd64 and i386, jemalloc's thread-local variables already have their
TLS model overridden by defining JEMALLOC_TLS_MODEL.

For now the change is applied only to tested platforms, but should in
principle be enabled everywhere.

PR: 255840
Suggested by: jrtc27
Reviewed by: kib
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31070

2 years agortld/arm64: Remove checks for undefined symbols when processing TPREL64
Mark Johnston [Fri, 16 Jul 2021 02:26:25 +0000 (22:26 -0400)]
rtld/arm64: Remove checks for undefined symbols when processing TPREL64

lld emits several GOT relocations referencing the null sumbol in libc.so
when compiled with -ftls-model=initial-exec.  This symbol is specified
to be undefined.

We generally do not handle dynamic TLS relocations against weak,
undefined symbols, so avoid printing a warning here.  This makes it
possible to compile libc.so using the initial-exec TLS model on arm64.

Reviewed by: jrtc27, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31069

2 years agovmd: Rename vmd_bus class to pci
Neel Chauhan [Fri, 16 Jul 2021 02:03:05 +0000 (19:03 -0700)]
vmd: Rename vmd_bus class to pci

This fixes a kernel panic when probing for vmd_bus on Intel TigerLake on
14-CURRENT. Apparently, vmd_bus is a type of PCI bus, but was registered
as a separate device class.

PR: 256915
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D31071

2 years agoUPDATING: Not unusual side effect of the awk bug fixed in d4d252c49976
Warner Losh [Fri, 16 Jul 2021 00:30:53 +0000 (18:30 -0600)]
UPDATING: Not unusual side effect of the awk bug fixed in d4d252c49976

You might not be able to build the kernel if you have an awk between
Jul 7th and today. It does not affect all platforms due to the nature
of the bug (so amd64 is unaffected in stable/13 or current, but
is affected in stable/12. i386 seems to be affected everywhere).

Sponsored by: Netflix

2 years agoawk: revert upstream's attempt to disallow hex strings
Warner Losh [Thu, 15 Jul 2021 22:46:06 +0000 (16:46 -0600)]
awk: revert upstream's attempt to disallow hex strings

Upstream one-true-awk decided to disallow hex strings as numbers. This
is in line with awk's behavior prior to C99, and allowed by the POSIX
standard. The standard, however, allows them to be treated as numbers
because that's what the standard said in the 2001 through 2004 editions.
Since 2001, the nawk in FreeBSD has treated them as numbers, so restore
that behavior, allowed by the standard.

A number of scripts in the FreeBSD tree depend on this interpretation,
including scripts to build the kernel which had mysteriously started
failing for some people and not others. By re-allowing 0x hex numbers,
this fixes those scripts and restores POLA.

Upstream issue: https://github.com/onetrueawk/awk/issues/126
Sponsored by: Netflix
Reviewed by: kevans
MFC After: asap due to regression alrady merged to stable
Differential Revision: https://reviews.freebsd.org/D31199

2 years agoarm64: Sync icache when creating executable superpage mappings
Alan Cox [Wed, 14 Jul 2021 17:59:49 +0000 (12:59 -0500)]
arm64: Sync icache when creating executable superpage mappings

Reviewed by: andrew, kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31181

2 years agodevd: remove pccard entries
Warner Losh [Thu, 15 Jul 2021 22:17:33 +0000 (16:17 -0600)]
devd: remove pccard entries

The pccard entries are now obsolete, remove them.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31184

2 years agonvme: Enable interrupts after qpair fully constructed
Warner Losh [Thu, 15 Jul 2021 22:17:23 +0000 (16:17 -0600)]
nvme: Enable interrupts after qpair fully constructed

To guard against the ill effects of a spurious interrupt during
construction (or one that was bogusly pending), enable interrupts after
the qpair is completely constructed. Otherwise, we can die with null
pointer dereferences in nvme_qpair_process_completions. This has been
observed in at least one pre-release NVMe drive where the MSIX interrupt
fired while the queue was being created, before we'd started the NVMe
controller card.

The alternative of only turning on the interrupts after the rest was
tried, but was insufficient to work around this bug and made the code
more complicated w/o benefit.

Reviewed by: mav, chuck
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31182

2 years agonanobsd: Bump rescue size to 8GB
Warner Losh [Thu, 15 Jul 2021 22:11:15 +0000 (16:11 -0600)]
nanobsd: Bump rescue size to 8GB

Bump the rescue size from 1.2GB to just shy of 8GB as things have grown
somewhat. Also make it possible to build rescue somewhere other than
/usr/src.

Sponsored by: Netflix

2 years agopcengines: Fix kernel config
Warner Losh [Thu, 15 Jul 2021 22:11:11 +0000 (16:11 -0600)]
pcengines: Fix kernel config

Update the old ALIX config to remove devices, add iflib and remove
trailing white space.

Sponsored by: Netflix

2 years agonanobsd: default to -j $hw.ncpu
Warner Losh [Thu, 15 Jul 2021 22:07:51 +0000 (16:07 -0600)]
nanobsd: default to -j $hw.ncpu

For paralllel builds, default to using all the CPUs on the system. The
old default of -j 3 was too few.

Sponsored by: Netflix

2 years agonanobsd: Use gpart and create code image before full disk image
Arrigo Marchiori [Thu, 15 Jul 2021 22:06:51 +0000 (16:06 -0600)]
nanobsd: Use gpart and create code image before full disk image

The attached patch brings two main changes to the nanobsd script:
 1- gpart is used instead of fdisk;
 2- the code image is created first, and then used to ``assemble'' the
    full disk image.

The patch was first proposed on the freebsd-embedded list:
http://lists.freebsd.org/pipermail/freebsd-embedded/2012-June/001580.html
and is currently under discussion:
http://lists.freebsd.org/pipermail/freebsd-embedded/2014-January/002216.html

Another effect is that the -f option ("suppress code slice extraction")
now imples the -i option ("suppress disk image build").

imp@ applied Patch by hand to new legacy.sh, plus tweaked for NANO_LOG vs
NANO_OBJ confusion in original.

PR: 186030
Reviewed by: imp@
Differential Revision: https://reviews.freebsd.org/D31102

2 years agolibc: add mempcpy(3) and wmempcpy(3)
Konstantin Belousov [Wed, 14 Jul 2021 15:41:36 +0000 (18:41 +0300)]
libc: add mempcpy(3) and wmempcpy(3)

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31180

2 years agoCreate namespace for the symbols added during 14-CURRENT cycle.
Konstantin Belousov [Wed, 14 Jul 2021 15:41:05 +0000 (18:41 +0300)]
Create namespace for the symbols added during 14-CURRENT cycle.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31180

2 years agoeli: Zero pad bytes that arise when certain auth algorithms are used
Mark Johnston [Thu, 15 Jul 2021 16:23:04 +0000 (12:23 -0400)]
eli: Zero pad bytes that arise when certain auth algorithms are used

When authentication is configured, GELI ensures that the amount of data
per sector is a multiple of 16 bytes.  This is done in
eli_metadata_softc().  When the digest size is not a multiple of 16
bytes, this leaves some extra pad bytes at the end of every sector, and
they were not being zeroed before being written to disk.  In particular,
this happens with the HMAC/SHA1, HMAC/RIPEMD160 and HMAC/SHA384 data
authentication algorithms.

This change ensures that they are zeroed before being written to disk.

Reported by: KMSAN
Reviewed by: delphij, asomers
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31170

2 years agonfsclient: Avoid copying uninitialized bytes into statfs
Mark Johnston [Thu, 15 Jul 2021 16:18:17 +0000 (12:18 -0400)]
nfsclient: Avoid copying uninitialized bytes into statfs

hst will be nul-terminated but the remaining space in the buffer is left
uninitialized.  Avoid copying the entire buffer to ensure that
uninitialized bytes are not leaked via statfs(2).

Reported by: KMSAN
Reviewed by: rmacklem
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31167

2 years agopf: Constify tag name and queue name helper functions
Mark Johnston [Thu, 15 Jul 2021 16:17:58 +0000 (12:17 -0400)]
pf: Constify tag name and queue name helper functions

No functional change intended.

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

2 years agoAssert that valid PTEs are not overwritten when installing a new PTP
Mark Johnston [Thu, 15 Jul 2021 16:17:33 +0000 (12:17 -0400)]
Assert that valid PTEs are not overwritten when installing a new PTP

amd64 and 32-bit ARM already had assertions to this effect.  Add them to
other pmaps.

Reviewed by: alc, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31171

2 years agohwpmc: mostly clean up cc --analyze
Mateusz Guzik [Thu, 15 Jul 2021 14:01:11 +0000 (14:01 +0000)]
hwpmc: mostly clean up cc --analyze

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

2 years agoAdd __diagused
Mateusz Guzik [Thu, 15 Jul 2021 14:01:02 +0000 (14:01 +0000)]
Add __diagused

This can be used for variables which are only used with either
INVARIANTS or WITNESS. Without any annotation they run into dead store
warnings from cc --analyze and always annotating with __unused may hide
bad vars when it should not.

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

2 years agolinuxkpi: Add spin_trylock_irqsave() macro
Neel Chauhan [Thu, 15 Jul 2021 14:52:42 +0000 (07:52 -0700)]
linuxkpi: Add spin_trylock_irqsave() macro

This is needed by the drm-kmod 5.6 update.

Reviewed by: hselasky
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30706

2 years agoCleanup unused USB enums.
Hans Petter Selasky [Thu, 15 Jul 2021 10:38:16 +0000 (12:38 +0200)]
Cleanup unused USB enums.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoSend a zero-length-packet first when opening a BULK endpoint for USB serial
Hans Petter Selasky [Tue, 6 Jul 2021 10:29:57 +0000 (12:29 +0200)]
Send a zero-length-packet first when opening a BULK endpoint for USB serial
port devices. If it gets eaten it is fine. Many USB device side implementations
don't properly support the clear endpoint halt command and if they do, data is lost
because the transmit FIFO is typically reset when this command is received.

Tested by: jmg
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoAdd virtio_scsi to the arm64 GENERIC config
Andrew Turner [Wed, 14 Jul 2021 20:13:10 +0000 (20:13 +0000)]
Add virtio_scsi to the arm64 GENERIC config

This is needed to boot on the Oracle Cloud VM.Standard.A1.Flex instance

Sponsored by: The FreeBSD Foundation

2 years agoAdd virtio comments to the arm64 GENERIC config
Andrew Turner [Wed, 14 Jul 2021 20:08:29 +0000 (20:08 +0000)]
Add virtio comments to the arm64 GENERIC config

Most of these are from the amd64 GENERIC config.

Sponsored by: The FreeBSD Foundation

2 years agoRemove the newline from arm64 trap panics
Andrew Turner [Wed, 14 Jul 2021 19:49:58 +0000 (19:49 +0000)]
Remove the newline from arm64 trap panics

The panic function will already print a newline so there is no need to
add it here.

Sponsored by: The FreeBSD Foundation

2 years agoUpdate the SCTLR_EL1 register definitions
Andrew Turner [Thu, 8 Jul 2021 12:14:56 +0000 (12:14 +0000)]
Update the SCTLR_EL1 register definitions

They are valid as of the ARMv8.7 XML.

While here remove SCTLR_RES0 as it's unused and depends on which CPU
the kernel is running on and switch to shifted values as they are
easier to compare with the documentation.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31120

2 years agoUpdate the arm64 HCR_EL2 registers
Andrew Turner [Wed, 7 Jul 2021 11:51:40 +0000 (11:51 +0000)]
Update the arm64 HCR_EL2 registers

They are valid as of the ARMv8.7 XML.

While here switch to use shifted values as they are easier to compare
with values in the Arm Reference Manual.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31093

2 years agoloader: make sure CPUTYPE is ignored when building
Warner Losh [Thu, 15 Jul 2021 03:06:08 +0000 (21:06 -0600)]
loader: make sure CPUTYPE is ignored when building

CPUTYPE?=native causes -march=native to be added to the command
line. When the host machine is haswell, this causes some versions of
clang to generate code that can't execute in the efi boot loader
environment. Set _CPUCFLAGS= to undo what's done bsd.cpu.mk. bsd.cpu.mk
is included too early to control with NO_CPU_CFLAGS here. The only other
option is to put that in all the Makefiles, and this is less tedious and
error prone.

PR: 194641
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31187
MFC After: 1 week

2 years agoAdd missing libkern/strnstr.c file
Greg V [Thu, 15 Jul 2021 00:56:03 +0000 (17:56 -0700)]
Add missing libkern/strnstr.c file

Apparently it wasn't picked up by git.

Reviewed by: bz, hselasky, nc
Differential Revision: https://reviews.freebsd.org/D31131

2 years agolibkern: import strnstr from libc
Greg V [Thu, 15 Jul 2021 00:52:32 +0000 (17:52 -0700)]
libkern: import strnstr from libc

Required for drm-kmod 5.6 (amdgpu).

Reviewed by: bz, hselasky, nc
Differential Revision: https://reviews.freebsd.org/D31131

2 years agoprocctl(PROC_ASLR_STATUS): fix vmspace leak
Konstantin Belousov [Wed, 14 Jul 2021 23:40:04 +0000 (02:40 +0300)]
procctl(PROC_ASLR_STATUS): fix vmspace leak

Reported by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoloader: Create loader_simp(8) to document simple version of loader
Warner Losh [Wed, 14 Jul 2021 22:43:25 +0000 (16:43 -0600)]
loader: Create loader_simp(8) to document simple version of loader

loader_simp is a much simplified version of loader that will process a
linear sequence of commands from loader.rc. It has neither Forth nor Lua
built in and is much smaller. Document it. This is largely copied from
loader.8 since it implements those built-in commands. Future revisions
will fix this duplication.

Sponsored by: Netflix

2 years agoloader(8): fix path to be correct loader.4th.
Warner Losh [Wed, 14 Jul 2021 22:34:43 +0000 (16:34 -0600)]
loader(8): fix path to be correct loader.4th.

boot.4th was a thing for only a few months around FreeBSD 3.1. The
correct name has been loader.4th for a long time.

MFC After:    2 days
Sponsored by: Netflix

2 years agoRemove incorrect __restricted labels from strcspn
Alfonso Gregory [Wed, 14 Jul 2021 21:48:35 +0000 (15:48 -0600)]
Remove incorrect __restricted labels from strcspn

strcspn should never have had the __restrict keywords. While both of
these strings are const, it may have unindended side effects. While this
is the kernel, the POSIX definition also omits restrict.

Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/497

2 years agonfscl: Avoid KASSERT() panic in cache_enter_time()
Rick Macklem [Wed, 14 Jul 2021 20:33:37 +0000 (13:33 -0700)]
nfscl: Avoid KASSERT() panic in cache_enter_time()

Commit 844aa31c6d87 added cache_enter_time_flags(), specifically
so that the NFS client could specify that cache enter replace
any stale entry for the same name.  Doing so avoids a KASSERT()
panic() in cache_enter_time(), as reported by the PR.

This patch uses cache_enter_time_flags() for Readdirplus, to
avoid the panic(), since it is impossible for the NFS client
to know if another client (or a local process on the NFS server)
has replaced a file with another file of the same name.

This patch only affects NFS mounts that use the "rdirplus"
mount option.

There may be other places in the NFS client where this needs
to be done, but no panic() has been observed during testing.

PR: 257043
MFC after: 2 weeks

2 years agoPartially revert previous commit.
Alexander Motin [Wed, 14 Jul 2021 19:46:22 +0000 (15:46 -0400)]
Partially revert previous commit.

ns identify does not allow nsid of 0xffffffff.  Only general identify
allows it.

MFC after: 1 week

2 years agoFor ns identify/delete allow nsid of 0xffffffff.
Alexander Motin [Wed, 14 Jul 2021 18:56:34 +0000 (14:56 -0400)]
For ns identify/delete allow nsid of 0xffffffff.

The first should report common parameters, the second should delete
all namespaces.

MFC after: 1 week

2 years agoClear the accessed bit when copying a managed superpage mapping
Alan Cox [Tue, 13 Jul 2021 07:30:43 +0000 (02:30 -0500)]
Clear the accessed bit when copying a managed superpage mapping

pmap_copy() is used to speculatively create mappings, so those mappings
should not have their access bit preset.

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

2 years agoFilter out LBA formats with LBA Data Size of 0.
Alexander Motin [Wed, 14 Jul 2021 18:01:22 +0000 (14:01 -0400)]
Filter out LBA formats with LBA Data Size of 0.

According to the spec: "If the value reported is 0h, then LBA format
is not supported / used or is not currently available".

MFC after: 1 week

2 years agoloader: small Makefile style change
Warner Losh [Wed, 14 Jul 2021 13:54:44 +0000 (07:54 -0600)]
loader: small Makefile style change

Move to using M.${option} and M.yes to collecting man pages to install.

Sponsored by: Netflix