]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoConvert canary, execpathp, and pagesizes to pointers.
brooks [Thu, 16 Apr 2020 21:53:17 +0000 (21:53 +0000)]
Convert canary, execpathp, and pagesizes to pointers.

Use AUXARGS_ENTRY_PTR to export these pointers.  This is a followup to
r359987 and r359988.

Reviewed by: jhb
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24446

4 years agoUse %zu to print a size_t value instead of %ju.
jhb [Thu, 16 Apr 2020 20:46:35 +0000 (20:46 +0000)]
Use %zu to print a size_t value instead of %ju.

This fixes the build for 32-bit kernels.

4 years agoAdd 'gpio' since mmc now requires gpio_if.h.
jhb [Thu, 16 Apr 2020 20:45:54 +0000 (20:45 +0000)]
Add 'gpio' since mmc now requires gpio_if.h.

4 years agoarm: nvidia: pcie: Rename class name to pcib
manu [Thu, 16 Apr 2020 20:44:23 +0000 (20:44 +0000)]
arm: nvidia: pcie: Rename class name to pcib

Reported by: jhb

4 years agoAvoid calling protocol drain routines more than once per reclamation event.
jtl [Thu, 16 Apr 2020 20:17:24 +0000 (20:17 +0000)]
Avoid calling protocol drain routines more than once per reclamation event.

mb_reclaim() calls the protocol drain routines for each protocol in each
domain. Some protocols exist in more than one domain and share drain
routines. In the case of SCTP, it also uses the same drain routine for
its SOCK_SEQPACKET and SOCK_STREAM entries in the same domain.

On systems with INET, INET6, and SCTP all defined, mb_reclaim() calls
sctp_drain() four times. On systems with INET and INET6 defined,
mb_reclaim() calls tcp_drain() twice. mb_reclaim() is the only in-tree
caller of the pr_drain protocol entry.

Eliminate this duplication by ensuring that each pr_drain routine is only
specified for one protocol entry in one domain.

Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D24418

4 years agoAdd a regression test for the changes in r359922 and r359923.
jtl [Thu, 16 Apr 2020 20:07:34 +0000 (20:07 +0000)]
Add a regression test for the changes in r359922 and r359923.

Note that the Python code has been tested on both Python 2.7 and 3.7.

Reviewed by: olivier
MFC after: 2 weeks
Sponsored by: Netflix, Inc.

4 years agoarm: Fix duplicate pcib DRIVER_MODULE
manu [Thu, 16 Apr 2020 18:37:11 +0000 (18:37 +0000)]
arm: Fix duplicate pcib DRIVER_MODULE

Name each pcib driver uniquely.
This remove the warning printed at each arm boot :
module_register: cannot register simplebus/pcib from kernel; already loaded from kernel

4 years agoFix userland build broken by r360014.
melifaro [Thu, 16 Apr 2020 17:53:23 +0000 (17:53 +0000)]
Fix userland build broken by r360014.

4 years agoDocument TCP_TLS_MODE_TOE.
jhb [Thu, 16 Apr 2020 17:41:32 +0000 (17:41 +0000)]
Document TCP_TLS_MODE_TOE.

4 years agostyle(9): end continued line with operator.
brooks [Thu, 16 Apr 2020 17:24:13 +0000 (17:24 +0000)]
style(9): end continued line with operator.

4 years agoAdd nhop parameter to rti_filter callback.
melifaro [Thu, 16 Apr 2020 17:20:18 +0000 (17:20 +0000)]
Add nhop parameter to rti_filter callback.

One of the goals of the new routing KPI defined in r359823 is to
 entirely hide`struct rtentry` from the consumers. It will allow to
 improve routing subsystem internals and deliver more features much faster.
This change is one of the ongoing changes to eliminate direct
 struct rtentry field accesses.

Additionally, with the followup multipath changes, single rtentry can point
 to multiple nexthops.

With that in mind, convert rti_filter callback used when traversing the
 routing table to accept pair (rt, nhop) instead of nexthop.

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D24440

4 years agoarm: Fix duplicate ehci DRIVER_MODULE
manu [Thu, 16 Apr 2020 16:59:37 +0000 (16:59 +0000)]
arm: Fix duplicate ehci DRIVER_MODULE

Name each ehci driver uniquely.
This remove the warning printed at each arm boot :
module_register: cannot register simplebus/ehci from kernel; already loaded from kernel

A similar fix was done in r333074 but imx_ehci wasn't renamed and generic_ehci wasn't
present at that time.

4 years agovmm(4): Expose instruction decode to userspace build
cem [Thu, 16 Apr 2020 16:50:33 +0000 (16:50 +0000)]
vmm(4): Expose instruction decode to userspace build

Permit instruction decoding logic to be compiled outside of the kernel for
rapid iteration and validation.

Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D24439

4 years agoarm: allwinner: aw_mmc: Make it possible to unload the module
manu [Thu, 16 Apr 2020 16:00:21 +0000 (16:00 +0000)]
arm: allwinner: aw_mmc: Make it possible to unload the module

While here, add a makefile in sys/modules/allwinner so it is built.
Also add the PNP info so devmatch will load this module automatically.

MFC after: 1 month

4 years agoReduce default TCP delayed ACK timeout to 40ms.
rscheff [Thu, 16 Apr 2020 15:59:23 +0000 (15:59 +0000)]
Reduce default TCP delayed ACK timeout to 40ms.

Reviewed by: kbowling, tuexen
Approved by: tuexen (mentor)
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D23281

4 years agommc_fdt_helpers: Drain the cd pin taskqueue in mmc_fdt_gpio_teardown
manu [Thu, 16 Apr 2020 15:58:58 +0000 (15:58 +0000)]
mmc_fdt_helpers: Drain the cd pin taskqueue in mmc_fdt_gpio_teardown

We have no use for it now.

MFC after: 1 month

4 years agommc_fdt_helpers: Always init the timout
manu [Thu, 16 Apr 2020 12:32:28 +0000 (12:32 +0000)]
mmc_fdt_helpers: Always init the timout

We use the taskqueue to schedule card detection so always init it.
This is a proper solution instead of r359965.

MFC after: 1 month
MFH: r359924

4 years agoRevert r359965
manu [Thu, 16 Apr 2020 12:31:12 +0000 (12:31 +0000)]
Revert r359965

This cause board without a cd-gpio to not schedule a card detection.

4 years agoFix ps_strings type change for i386
scottl [Thu, 16 Apr 2020 05:27:13 +0000 (05:27 +0000)]
Fix ps_strings type change for i386

4 years agoAdd support for some IOCFacts fields that are available with mpr (12Gb)
scottl [Thu, 16 Apr 2020 04:17:06 +0000 (04:17 +0000)]
Add support for some IOCFacts fields that are available with mpr (12Gb)
controllers.  It's ugly due to the single codebase for mpr and mps and
not being able to share their respective headers.

4 years agoDon't keep a private copy of mpr_ioctl.h and mps_ioctl.h, since they
scottl [Thu, 16 Apr 2020 03:33:46 +0000 (03:33 +0000)]
Don't keep a private copy of mpr_ioctl.h and mps_ioctl.h, since they
easily get out of sync with the real files from the driver.

4 years agoAdd a small hack to the ioctl header files so that both mpr and mps can
scottl [Thu, 16 Apr 2020 03:28:28 +0000 (03:28 +0000)]
Add a small hack to the ioctl header files so that both mpr and mps can
be included.  This isn't a great solution, but fixing it correctly is a
bigger task and this is the lesser of the existing evils.

4 years agoSync with NetBSD/OpenBSD.
delphij [Thu, 16 Apr 2020 03:23:19 +0000 (03:23 +0000)]
Sync with NetBSD/OpenBSD.

4 years agoPreload hostuuid for early-boot use
kevans [Thu, 16 Apr 2020 00:54:06 +0000 (00:54 +0000)]
Preload hostuuid for early-boot use

prison0's hostuuid will get set by the hostid rc script, either after
generating it and saving it to /etc/hostid or by simply reading /etc/hostid.

Some things (e.g. arbitrary MAC address generation) may use the hostuuid as
a factor in early boot, so providing a way to read /etc/hostid (if it's
available) and using it before userland starts up is desirable. The code is
written such that the preload doesn't *have* to be /etc/hostid, thus not
assuming that there will be newline at the end of the buffer or even the
exact shape of the newline. White trailing whitespace/non-printables
trimmed, the result will be validated as a valid uuid before it's used for
early boot purposes.

The preload can be turned off with hostuuid_load="NO" in /boot/loader.conf,
just as other preloads; it's worth noting that this is a 37-byte file, the
overhead is believed to be generally minimal.

It doesn't seem necessary at this time to be concerned with kern.hostid.

One does wonder if we should consider validating hostuuids coming in
via jail_set(2); some bits seem to care about uuid form and we bother
validating format of smbios-provided uuid and in-fact whatever uuid comes
from /etc/hostid.

Reviewed by: karels, delphij, jamie
MFC after: 1 week (don't preload by default, probably)
Differential Revision: https://reviews.freebsd.org/D24288

4 years agoImprove TSC calibration logic.
kib [Wed, 15 Apr 2020 22:28:51 +0000 (22:28 +0000)]
Improve TSC calibration logic.

Stop attempting to use FADT legacy hardware flag, it is almost always
a lie.

Instead, unless user explicitly disabled the calibration, calibrate
against 8254 ISA clock.  Then, obtain the rough value of the expected
TSC frequency from CPUID leafs 0x15/0x16 or even from the CPU
marketing name string.  If calibration results look unbelievably bogus
comparing with CPUID leafs report, use CPUID one.

Intel does not recommend to use CPUID leaf 0x16 for the value of the
system time frequency, indeed the error there might be up to 1% which
e.g. makes ntpd give up.  If ISA clock is present, we win, if not, we
get some frequency that allows the machine to boot without enormous
delay.

Next improvement would be to use HPET for re-calibration if we decided
that ISA clock gives bogus results, after HPETs are enumerated. This
is a much bigger change since we probably would need to re-evaluate
some constants depending on TSC frequency.

Reviewed by: emaste, jhb, scottl
Tested by: scottl
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D24426

4 years agoFix the NFSv4.2 extended attribute support for remove extended attrbute.
rmacklem [Wed, 15 Apr 2020 21:27:52 +0000 (21:27 +0000)]
Fix the NFSv4.2 extended attribute support for remove extended attrbute.

I missed the "atomic" field of the RemoveExtendedAttribute operation's
reply when I implemented it. It worked between FreeBSD client and server,
since it was missed for both, but it did not conform to RFC 8276.
This patch adds the field for both client and server.

Thanks go to Frank for doing interoperability testing of the extended
attribute support against patches for Linux.

Submitted by: Frank van der Linden <fllinden@amazon.com>
Reported by: Frank van der Linden <fllinden@amazon.com>

4 years agoRevert commit b6cf400aa fro llvm git (by Nemanja Ivanovic):
dim [Wed, 15 Apr 2020 21:06:38 +0000 (21:06 +0000)]
Revert commit b6cf400aa fro llvm git (by Nemanja Ivanovic):

  Fix bots after a9ad65a2b34f

  In the last commit, I neglected to initialize the new subtarget
  feature I added which caused failures on a few bots. This should fix
  that.

This unbreaks the build after r359981, which reverted upstream commit
a9ad65a2b34f.

Reported by: jhibbits (and jenkins :)
MFC after: 6 weeks
X-MFC-With: 358851

4 years agoUse crypto_contiguous_subsegment().
jhb [Wed, 15 Apr 2020 21:05:38 +0000 (21:05 +0000)]
Use crypto_contiguous_subsegment().

This driver used a home-rolled version that predated the function and
didn't support mbufs.

4 years agopowerpc: autosize bpvo based on physical memory
alfredo [Wed, 15 Apr 2020 20:33:09 +0000 (20:33 +0000)]
powerpc: autosize bpvo based on physical memory

Default moea64_bpvo_pool_size 327680 was insufficient for initial
memory mapping at boot time on systems with, for example, 64G and
no huge pages enabled.

Submitted by: Andre Silva <afscoelho@gmail.com>
Reviewed by: jhibbits, alfredo
Approved by: jhibbits (mentor)
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D24102

4 years agoAttempt to use AT_PS_STRINGS to get the ps_strings pointer.
brooks [Wed, 15 Apr 2020 20:28:20 +0000 (20:28 +0000)]
Attempt to use AT_PS_STRINGS to get the ps_strings pointer.

This saves a system call and avoids one of the (relatively rare) cases
of the kernel exporting pointers via sysctl.

As a temporary measure, keep the sysctl support to allow limited
compatability with old kernels.

Fail gracefully if ps_strings can't be found (should never happen).

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24407

4 years agoSupport AT_PS_STRINGS in _elf_aux_info().
brooks [Wed, 15 Apr 2020 20:26:41 +0000 (20:26 +0000)]
Support AT_PS_STRINGS in _elf_aux_info().

This will be used by setproctitle().

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24407

4 years agoAdd procstat support for AT_ flags added in r359988.
brooks [Wed, 15 Apr 2020 20:25:38 +0000 (20:25 +0000)]
Add procstat support for AT_ flags added in r359988.

This includes argc, argv, envc, envv, and ps_strings.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24407

4 years agoExport argc, argv, envc, envv, and ps_strings in auxargs.
brooks [Wed, 15 Apr 2020 20:23:55 +0000 (20:23 +0000)]
Export argc, argv, envc, envv, and ps_strings in auxargs.

This simplifies discovery of these values, potentially with reducing the
number of syscalls we need to make at runtime.  Longer term, we wish to
convert the startup process to pass an auxargs pointer to _start() and
use that rather than walking off the end of envv.  This is cleaner,
more C-friendly, and for systems with strong bounds (e.g. CHERI)
necessary.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24407

4 years agoMake ps_strings in struct image_params into a pointer.
brooks [Wed, 15 Apr 2020 20:21:30 +0000 (20:21 +0000)]
Make ps_strings in struct image_params into a pointer.

This is a prepratory commit for D24407.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA

4 years agoIntroduce an AUXARGS_ENTRY_PTR() macro.
brooks [Wed, 15 Apr 2020 20:19:59 +0000 (20:19 +0000)]
Introduce an AUXARGS_ENTRY_PTR() macro.

As the name implys, it uses the a_ptr member of the auxarg entry (except
in compat32 where it uses a_val).  This is more correct and required for
systems where a_val is not the same size or hardware type as a_ptr (e.g.
CHERI).

This is a prepratory commit for D24407.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA

4 years agoDocument removal of deprecated algorithms from geli(4).
jhb [Wed, 15 Apr 2020 19:33:42 +0000 (19:33 +0000)]
Document removal of deprecated algorithms from geli(4).

4 years agoSet inp_flowid's for TOE connections.
jhb [Wed, 15 Apr 2020 19:28:51 +0000 (19:28 +0000)]
Set inp_flowid's for TOE connections.

KTLS uses the flowid to distribute software encryption tasks among its
pool of worker threads.  Without this change, all software KTLS
requests for TOE sockets ended up on the first worker thread.

Note that the flowid for TOE sockets created via connect() is not a
hash of the 4-tuple, but is instead the id of the TOE pcb (tid).  The
flowid of TOE sockets created from TOE listen sockets do use the
4-tuple RSS hash as the flowid since the firmware provides the hash in
the message containing the original SYN.

Reviewed by: np (earlier version)
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24348

4 years agoClear CPL_GET_TCB_RPL handler on module unload.
jhb [Wed, 15 Apr 2020 19:23:53 +0000 (19:23 +0000)]
Clear CPL_GET_TCB_RPL handler on module unload.

This fixes a panic when unloading and reloading t4_tom.ko since the
old pointer is still stored when t4_tom_load tries to set it.

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

4 years agoRevert commit a9ad65a2b from llvm git (by Nemanja Ivanovic):
dim [Wed, 15 Apr 2020 18:43:44 +0000 (18:43 +0000)]
Revert commit a9ad65a2b from llvm git (by Nemanja Ivanovic):

  [PowerPC] Change default for unaligned FP access for older subtargets

  This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40554

  Some CPU's trap to the kernel on unaligned floating point access and
  there are kernels that do not handle the interrupt. The program then
  fails with a SIGBUS according to the PR. This just switches the
  default for unaligned access to only allow it on recent server CPUs
  that are known to allow this.

  Differential revision: https://reviews.llvm.org/D71954

This upstream commit causes a compiler hang when building certain ports
(e.g. security/nss, multimedia/x264) for powerpc64.  The hang has been
reported in https://bugs.llvm.org/show_bug.cgi?id=45186, but in the mean
time it is more convenient to revert the commit.

Requested by: jhibbits
MFC after: 6 weeks
X-MFC-With: 358851

4 years agovalidate_uuid: absorb the rest of parse_uuid with a flags arg
kevans [Wed, 15 Apr 2020 18:39:12 +0000 (18:39 +0000)]
validate_uuid: absorb the rest of parse_uuid with a flags arg

This makes the naming annoyance (validate_uuid vs. parse_uuid) less of an
issue and centralizes all of the functionality into the new KPI while still
making the extra validation optional. The end-result is all the same as far
as hostuuid validation-only goes.

4 years agoMark eli_metadata_crypto_supported inline.
jhb [Wed, 15 Apr 2020 18:27:28 +0000 (18:27 +0000)]
Mark eli_metadata_crypto_supported inline.

This quiets warnings about it not being always used.

Reported by: kevans

4 years agoFix -Wvoid-pointer-to-enum-cast warnings.
brooks [Wed, 15 Apr 2020 18:15:58 +0000 (18:15 +0000)]
Fix -Wvoid-pointer-to-enum-cast warnings.

This pattern is used in callbacks with void * data arguments and seems
both relatively uncommon and relatively harmless.  Silence the warning
by casting through uintptr_t.

This warning is on by default in Clang 11.

Reviewed by: arichardson
Obtained from: CheriBSD (partial)
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24425

4 years agoFix a typo
0mp [Wed, 15 Apr 2020 17:11:44 +0000 (17:11 +0000)]
Fix a typo

Reported by: rgrimes
MFC with: 359967

4 years agosysctl_handle_string: Put logical or in parentheses.
kaktus [Wed, 15 Apr 2020 16:55:38 +0000 (16:55 +0000)]
sysctl_handle_string: Put logical or in parentheses.

Reported by: rdivacky
Approved by: kib (mentor)
Pointy-hat to: kaktus

4 years agosysctl(9): fix handling string tunables.
kaktus [Wed, 15 Apr 2020 16:33:55 +0000 (16:33 +0000)]
sysctl(9): fix handling string tunables.

r357614 changed internals of handling string sysctls, and inadvertently
broke setting string tunables.  Take them into account.

PR: 245463
Reported by: jhb, np
Reviewed by: imp, jhb, kib
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D24429

4 years agoDon't directly access userspace memory.
brooks [Wed, 15 Apr 2020 16:33:27 +0000 (16:33 +0000)]
Don't directly access userspace memory.

Rather then using the racy useracc() followed by direct access to
userspace memory, perform a copyin() and use the result if it succeeds.

Reviewed by: jhb
MFC after: 3 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24410

4 years agosshd: Warn about missing ssh-keygen only when necessary
0mp [Wed, 15 Apr 2020 14:07:33 +0000 (14:07 +0000)]
sshd: Warn about missing ssh-keygen only when necessary

The sshd service is using ssh-keygen to generate missing SSH keys.
If ssh-keygen is missing, it prints the following message:

> /etc/rc.d/sshd: WARNING: /usr/bin/ssh-keygen does not exist.

It makes sense when the key is not generated yet and
cannot be created because ssh-keygen is missing.

The problem is that even if the key is present on the host,
the sshd service would still warn about missing ssh-keygen
(even though it does not need it).

Reviewed by: emaste
Approved by: emaste (src)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D23911

4 years agoarm: allwinner: aw_sid: Fix thermal calibration size for A64
manu [Wed, 15 Apr 2020 13:35:28 +0000 (13:35 +0000)]
arm: allwinner: aw_sid: Fix thermal calibration size for A64

This fixes the aw_thermal driver on A64 SoC.

MFC after: 1 month
X-MFC-With: r359935

4 years agoCast all ioctl command arguments through uint32_t internally.
hselasky [Wed, 15 Apr 2020 13:20:51 +0000 (13:20 +0000)]
Cast all ioctl command arguments through uint32_t internally.

Hide debug print showing use of sign extended ioctl command argument
under INVARIANTS. The print is available to all and can easily fill
up the logs.

No functional change intended.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoDocument the exit status and the stdout message of nologin(8)
0mp [Wed, 15 Apr 2020 13:13:46 +0000 (13:13 +0000)]
Document the exit status and the stdout message of nologin(8)

Reviewed by: debdrup (earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24196

4 years agoConvert OFED rtable interactions to the new routing KPI.
melifaro [Wed, 15 Apr 2020 13:06:55 +0000 (13:06 +0000)]
Convert OFED rtable interactions to the new routing KPI.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24387

4 years agommc_fdt_helpers: Do not schedule a card detection is there is no cd gpio
manu [Wed, 15 Apr 2020 13:02:13 +0000 (13:02 +0000)]
mmc_fdt_helpers: Do not schedule a card detection is there is no cd gpio

If the fdt node doesn't have a cd-gpios properties or if the node is set
as non-removable we do not init the card detection timeout task as it is
useless so don't schedule it too.

MFC after: 1 month
X-MFC-With: r359924

4 years agoConvert pf rtable checks to the new routing KPI.
melifaro [Wed, 15 Apr 2020 13:00:48 +0000 (13:00 +0000)]
Convert pf rtable checks to the new routing KPI.

Switch uRPF to use specific fib(9)-provided uRPF.
Switch MSS calculation to the latest fib(9) kpi.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D24386

4 years agoConvert ip6_forward() to the new routing KPI.
melifaro [Wed, 15 Apr 2020 12:56:05 +0000 (12:56 +0000)]
Convert ip6_forward() to the new routing KPI.

Update ip6_forward() internals to use deembedded IPv6 addresses
 to simplify calls to the new KPI and prepare for the future
 scope-embedding cleanup.

Add in6_get_unicast_scopeid() and in6_set_unicast_scopeid() scopeid
 operation functions tailored for unicast processing.

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D24334

4 years agoAdd my birthday
tagattie [Wed, 15 Apr 2020 10:20:18 +0000 (10:20 +0000)]
Add my birthday

Approved by: ehaupt (mentor)

4 years agoDo not attempt to remove backward compatibility timezones.
jkim [Wed, 15 Apr 2020 08:18:28 +0000 (08:18 +0000)]
Do not attempt to remove backward compatibility timezones.

Since r359736, these timezones are unconditionally installed.

4 years agobhyve(8): Correct copyright boilerplate for r359950
cem [Wed, 15 Apr 2020 05:55:14 +0000 (05:55 +0000)]
bhyve(8): Correct copyright boilerplate for r359950

Use the text from the canonical sys/copyright.h 2-clause FreeBSD License.

Reported by: grehan (thanks!)

4 years agosys/types.h: adjust #endif comment to match reality
kevans [Wed, 15 Apr 2020 04:03:46 +0000 (04:03 +0000)]
sys/types.h: adjust #endif comment to match reality

Submitted by: sigsys gmail com

4 years agokern uuid: break format validation out into a separate KPI
kevans [Wed, 15 Apr 2020 03:59:26 +0000 (03:59 +0000)]
kern uuid: break format validation out into a separate KPI

This new KPI, validate_uuid, strictly validates the formatting of the input
UUID and, optionally, populates a given struct uuid.

As noted in the header, the key differences are that the new KPI won't
recognize an empty string as a nil UUID and it won't do any kind of semantic
validation on it. Also key is that populating a struct uuid is optional, so
the caller doesn't necessarily need to allocate a bogus one on the stack
just to validate the string.

This KPI has specifically been broken out in support of D24288, which will
preload /etc/hostid in loader so that early boot hostuuid users (e.g.
anything that calls ether_gen_addr) can have a valid hostuuid to work with
once it's been stashed in /etc/hostid.

4 years agocxgbe/iw_cxgbe: Do not start the EP timer if soaccept fails.
np [Wed, 15 Apr 2020 03:40:33 +0000 (03:40 +0000)]
cxgbe/iw_cxgbe: Do not start the EP timer if soaccept fails.

This fixes a panic that would occur when the timer tried to close a
stale socket.

Submitted by: Krishnamraju Eraparaju @ Chelsio
MFC after: 1 week
Sponsored by: Chelsio Communications

4 years agobhyve(8): Minor cosmetic niceties in instemul failure
cem [Wed, 15 Apr 2020 02:34:44 +0000 (02:34 +0000)]
bhyve(8): Minor cosmetic niceties in instemul failure

Print the failed instruction stream as a contiguous stream of hex.  This
is closer to something you could throw at a disassembler than 0xHH 0xHH
0xHH.

Also, use the debug.h 'raw' stdio-aware printf helper to avoid the
cascading
         line
             effect.

4 years agobhyve(8): Add VM Generation Counter ACPI device
cem [Wed, 15 Apr 2020 02:00:17 +0000 (02:00 +0000)]
bhyve(8): Add VM Generation Counter ACPI device

Add an implementatation of the 'Virtual Machine Generation ID' spec to
Bhyve.  The spec provides a randomly generated GUID (at bhyve start) in
device memory, along with an ACPI device with _CID VM_Gen_Counter and ADDR
evaluating to a Package pointing at that GUID.

A GPE is defined which Notifies the ACPI Device when the generation changes
(such as when a snapshot is rolled back).  At this time, Bhyve does not
support snapshotting, so the GPE is never actually raised.

Suggested by: rpokala
Discussed with: grehan
Differential Revision: https://reviews.freebsd.org/D23165

4 years agobhyve(8): Add bootrom allocation abstraction
cem [Wed, 15 Apr 2020 01:58:51 +0000 (01:58 +0000)]
bhyve(8): Add bootrom allocation abstraction

To allow more general use of the bootrom region, separate initialization from
allocation, and allocation from loading a file.

The bootrom segment is the high 16MB of the low 4GB region.

Each allocation in the segment creates a new mapping with specified protection.
By default, allocation begins at the low end of the range.  However, the
BOOTROM_ALLOC_TOP flag is provided to locate a provided bootrom in the high
region it is expected to be in.

The existing ROM-file loading code is refactored to use the new interface.

Reviewed by: grehan (earlier version)
Differential Revision: https://reviews.freebsd.org/D24422

4 years agobus_dma.9: Remove erroneous usage recommendation
cem [Wed, 15 Apr 2020 01:39:17 +0000 (01:39 +0000)]
bus_dma.9: Remove erroneous usage recommendation

It is not valid to pass BUS_SPACE_UNRESTRICTED to bus_dma_tag_create()'s
nsegments parameter as it is interpreted as a very large segment count.
Subsequent allocation operations on the tag will preallocate some multiple of
that count.  BUS_SPACE_UNRESTRICTED therefore indicates something like:
malloc(infinity).

Discussed with: bcr, jhb (earlier version)

4 years agoRemove support for geli(4) algorithms deprecated in r348206.
jhb [Wed, 15 Apr 2020 00:14:50 +0000 (00:14 +0000)]
Remove support for geli(4) algorithms deprecated in r348206.

This removes support for reading and writing volumes using the
following algorithms:

- Triple DES
- Blowfish
- MD5 HMAC integrity

In addition, this commit adds an explicit whitelist of supported
algorithms to give a better error message when an invalid or
unsupported algorithm is used by an existing volume.

Reviewed by: cem
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24343

4 years agotests: audit: mark closefrom test an expected fail for now
kevans [Tue, 14 Apr 2020 23:36:03 +0000 (23:36 +0000)]
tests: audit: mark closefrom test an expected fail for now

closefrom has been converted to close_range internally; remediation is
underway for this, marking it as an expected fail for now while proper
course is determined.

PR: 245625

4 years agoclosefrom: clamp lowfd to >= 0; close_range's parameters are unsigned.
kevans [Tue, 14 Apr 2020 23:24:24 +0000 (23:24 +0000)]
closefrom: clamp lowfd to >= 0; close_range's parameters are unsigned.

Pointy hat: kevans
Reported by: CI (lwhsu)

4 years agoConvert IP/IPv6 forwarding, ICMP processing and IP PCB laddr selection to
melifaro [Tue, 14 Apr 2020 23:06:25 +0000 (23:06 +0000)]
Convert IP/IPv6 forwarding, ICMP processing and IP PCB laddr selection to
 the new routing KPI.

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D24245

4 years agoFix the NFSv2 extended attribute support to handle 0 length attributes.
rmacklem [Tue, 14 Apr 2020 22:57:21 +0000 (22:57 +0000)]
Fix the NFSv2 extended attribute support to handle 0 length attributes.

I did not realize that zero length attributes are allowed, but they are.
This patch fixes the NFSv4.2 client and server to handle zero length
extended attributes correctly.

Submitted by: Frank van der Linden <fllinden@amazon.com> (earlier version)
Reported by: Frank van der Linden <fllinder@amazon.com>

4 years agoReorganise nd6 notification code to avoid direct rtentry field access.
melifaro [Tue, 14 Apr 2020 22:48:33 +0000 (22:48 +0000)]
Reorganise nd6 notification code to avoid direct rtentry field access.

One of the goals of the new routing KPI defined in r359823 is to entirely hide
 `struct rtentry` from the consumers. Doing so will allow to improve routing
 subsystem internals and deliver features more easily. This change is one of
  the ongoing changes to eliminate direct struct rtentry field accesses.

It introduces rtfree_func() wrapper around RTFREE() and reorganises nd6 notification
 code to avoid accessing most of the rtentry fields.

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D24404

4 years agomodules: dtb: allwinner: Remove sun50i-a64-sid.dtso
manu [Tue, 14 Apr 2020 22:16:40 +0000 (22:16 +0000)]
modules: dtb: allwinner: Remove sun50i-a64-sid.dtso

File was removed in r359935

MFC after: 2 month
X-MFC-With: r359935

4 years agoRemove bogus use of useracc() in (clock_)nanosleep.
brooks [Tue, 14 Apr 2020 20:53:12 +0000 (20:53 +0000)]
Remove bogus use of useracc() in (clock_)nanosleep.

There's no point in pre-checking that we can access the user's rmtp
pointer before we do it in copyout().

While here, improve style(9) compliance.

Reviewed by: imp
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24409

4 years agoCentralize compatability translation macros.
brooks [Tue, 14 Apr 2020 20:30:48 +0000 (20:30 +0000)]
Centralize compatability translation macros.

Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h
and replace existing definitation with includes where required. This
eliminates duplicate code and allows Linux and FreeBSD compatability
headers to be included in the same files.

Input from: cem, jhb
Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24275

4 years agomodules: dtb: allwinner: Remove non existant files
manu [Tue, 14 Apr 2020 20:20:08 +0000 (20:20 +0000)]
modules: dtb: allwinner: Remove non existant files

Those files have been removed in r359935.

MFC after: 2 months
X-MFC-With: r359935

4 years agoallwinner: aw_thermal: Cope with DTS changes
manu [Tue, 14 Apr 2020 19:05:17 +0000 (19:05 +0000)]
allwinner: aw_thermal: Cope with DTS changes

The upstream DTS now include the thermal device node and the SID
calibration entry.
Update our driver to cope with this change and remove the DTB
overlays that aren't needed anymore.

MFC after: 2 months
X-MFC-With: r359934

4 years agodts: Import DTS from Linux 5.6
manu [Tue, 14 Apr 2020 18:57:00 +0000 (18:57 +0000)]
dts: Import DTS from Linux 5.6

4 years agofiles: Add mmc_fdt_helpers for mmccam enabled config
manu [Tue, 14 Apr 2020 18:11:54 +0000 (18:11 +0000)]
files: Add mmc_fdt_helpers for mmccam enabled config

MFC after: 1 month
X-MFC-With: r359924

4 years agosysent: re-roll after r359930
kevans [Tue, 14 Apr 2020 18:11:26 +0000 (18:11 +0000)]
sysent: re-roll after r359930

4 years agoMark closefrom(2) COMPAT12, reimplement in libc to wrap close_range
kevans [Tue, 14 Apr 2020 18:07:42 +0000 (18:07 +0000)]
Mark closefrom(2) COMPAT12, reimplement in libc to wrap close_range

Include a temporarily compatibility shim as well for kernels predating
close_range, since closefrom is used in some critical areas.

Reviewed by: markj (previous version), kib
Differential Revision: https://reviews.freebsd.org/D24399

4 years agoImport DTS files from Linux 5.6
manu [Tue, 14 Apr 2020 16:56:11 +0000 (16:56 +0000)]
Import DTS files from Linux 5.6

4 years agoarm: dwmmc: Use mmc_fdt_helpers
manu [Tue, 14 Apr 2020 16:35:18 +0000 (16:35 +0000)]
arm: dwmmc: Use mmc_fdt_helpers

Use the mmc_fdt_parse function instead of parsing everything in the
driver.

MFC after: 1 month

4 years agoImprove the TCP blackhole detection. The principle is to reduce the
tuexen [Tue, 14 Apr 2020 16:35:05 +0000 (16:35 +0000)]
Improve the TCP blackhole detection. The principle is to reduce the
MSS in two steps and try each candidate two times. However, if two
candidates are the same (which is the case in TCP/IPv6), this candidate
was tested four times. This patch ensures that each candidate actually
reduced the MSS and is only tested 2 times. This reduces the time window
of missclassifying a temporary outage as an MTU issue.

Reviewed by: jtl
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D24308

4 years agoarm: allwinner: aw_mmc: Use the mmc_fdt_helper
manu [Tue, 14 Apr 2020 16:34:13 +0000 (16:34 +0000)]
arm: allwinner: aw_mmc: Use the mmc_fdt_helper

The fdt properties are now parsed via the help of mmc_fdt_helper functions.
This also adds card detection.
Note that on some boards (like the Pine64) card detection is broken due to
a missing resistor on the cd pin.

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

4 years agoThose functions are here to help fdt mmc controller drivers to parse
manu [Tue, 14 Apr 2020 16:30:54 +0000 (16:30 +0000)]
Those functions are here to help fdt mmc controller drivers to parse
the dts to find the supported speeds and the regulators.
Not all DTS have every settings properly defined so host controller
will still have to add some caps themselves.
It also add a mmc_fdt_gpio_setup function which will read the cd-gpios
property and register it as the CD pin.
If the pin support interrupts one will be registered and the cd_helper
function will be called.
If the pin doesn't support interrupts the internal taskqueue will poll
for change and call the same cd_helper function.
mmc_fdt_gpio_setup will also parse the wp-gpio property and MMC drivers
can know the write-protect pin value by calling the
mmc_fdt_gpio_get_readonly function.

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

4 years agoMake sonewconn() overflow messages have per-socket rate-limits and values.
jtl [Tue, 14 Apr 2020 15:38:18 +0000 (15:38 +0000)]
Make sonewconn() overflow messages have per-socket rate-limits and values.

sonewconn() emits debug-level messages when a listen socket's queue
overflows. Currently, sonewconn() tracks overflows on a global basis. It
will only log one message every 60 seconds, regardless of how many sockets
experience overflows. And, when it next logs at the end of the 60 seconds,
it records a single message referencing a single PCB with the total number
of overflows across all sockets.

This commit changes to per-socket overflow tracking. The code will now
log one message every 60 seconds per socket. And, the code will provide
per-socket queue length and overflow counts. It also provides a way to
change the period between log messages using a sysctl.

Reviewed by: jhb (previous version), bcr (manpages)
MFC after: 2 weeks
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D24316

4 years agoPrint more detail as part of the sonewconn() overflow message.
jtl [Tue, 14 Apr 2020 15:30:34 +0000 (15:30 +0000)]
Print more detail as part of the sonewconn() overflow message.

When a socket's listen queue overflows, sonewconn() emits a debug-level
log message. These messages are sometimes useful to systems administrators
in highlighting a process which is not keeping up with its listen queue.

This commit attempts to enhance the usefulness of this message by printing
more details about the socket's address. If all else fails, it will at
least print the domain name of the socket.

Reviewed by: bz, jhb, kbowling
MFC after: 2 weeks
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D24272

4 years agoMake the path length of UNIX domain sockets specified by a #define.
jtl [Tue, 14 Apr 2020 15:27:24 +0000 (15:27 +0000)]
Make the path length of UNIX domain sockets specified by a #define.
Also, add a comment describing the historical context for this length.

Reviewed by: bz, jhb, kbowling (previous version)
MFC after: 2 weeks
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D24272

4 years agoBump FreeBSD version after r359919 (KTLS / unmapped mbuf changes)
gallatin [Tue, 14 Apr 2020 14:48:00 +0000 (14:48 +0000)]
Bump FreeBSD version after r359919 (KTLS / unmapped mbuf changes)

The above changes mbufs, and any module using unmapped mbufs
would need to be re-compiled.

Sponsored by: Netflix

4 years agoKTLS: Re-work unmapped mbufs to carry ext_pgs in the mbuf itself.
gallatin [Tue, 14 Apr 2020 14:46:06 +0000 (14:46 +0000)]
KTLS: Re-work unmapped mbufs to carry ext_pgs in the mbuf itself.

While the original implementation of unmapped mbufs was a large
step forward in terms of reducing cache misses by enabling mbufs
to carry more than a single page for sendfile, they are rather
cache unfriendly when accessing the ext_pgs metadata and
data. This is because the ext_pgs part of the mbuf is allocated
separately, and almost guaranteed to be cold in cache.

This change takes advantage of the fact that unmapped mbufs
are never used at the same time as pkthdr mbufs. Given this
fact, we can overlap the ext_pgs metadata with the mbuf
pkthdr, and carry the ext_pgs meta directly in the mbuf itself.
Similarly, we can carry the ext_pgs data (TLS hdr/trailer/array
of pages) directly after the existing m_ext.

In order to be able to carry 5 pages (which is the minimum
required for a 16K TLS record which is not perfectly aligned) on
LP64, I've had to steal ext_arg2. The only user of this in the
xmit path is sendfile, and I've adjusted it to use arg1 when
using unmapped mbufs.

This change is almost entirely mechanical, except that we
change mb_alloc_ext_pgs() to no longer allow allocating
pkthdrs, the change to avoid ext_arg2 as mentioned above,
and the removal of the ext_pgs zone,

This change saves roughly 2% "raw" CPU (~59% -> 57%), or over
3% "scaled" CPU on a Netflix 100% software kTLS workload at
90+ Gb/s on Broadwell Xeons.

In a follow-on commit, I plan to remove some hacks to avoid
access ext_pgs fields of mbufs, since they will now be in
cache.

Many thanks to glebius for helping to make this better in
the Netflix tree.

Reviewed by: hselasky, jhb, rrs, glebius (early version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D24213

4 years agoposixshm: fix counting of writable mappings
kevans [Tue, 14 Apr 2020 13:32:03 +0000 (13:32 +0000)]
posixshm: fix counting of writable mappings

Similar to mmap'ing vnodes, posixshm should count any mapping where maxprot
contains VM_PROT_WRITE (i.e. fd opened r/w with no write-seal applied) as
writable and thus blocking of any write-seal.

The memfd tests have been amended to reflect the fixes here, which notably
includes:

1. Fix for error return bug; EPERM is not a documented failure mode for mmap
2. Fix rejection of write-seal with active mappings that can be upgraded via
    mprotect(2).

Reported by: markj
Discussed with: markj, kib

4 years agoPlug netmask NULL check during route addition causing kernel panic.
melifaro [Tue, 14 Apr 2020 13:12:22 +0000 (13:12 +0000)]
Plug netmask NULL check during route addition causing kernel panic.
 This bug was introduced by the r359823.

Reported by: hselasky

4 years agoImprove manual page formatting
0mp [Tue, 14 Apr 2020 10:10:31 +0000 (10:10 +0000)]
Improve manual page formatting

- Use appropriate macros for command arguments.
- Increase option list indentation for better readability.

MFC after: 3 days

4 years agoPostpone multipath seed init till SI_SUB_LAST, as it is needed only after
melifaro [Tue, 14 Apr 2020 07:38:34 +0000 (07:38 +0000)]
Postpone multipath seed init till SI_SUB_LAST, as it is needed only after
 some useland program installs multiple paths to the same destination.

While here, make multipath init conditional.

Discussed with: cem,ian

4 years agoRe-organize the NFS file handle affinity code for the NFS server.
rmacklem [Tue, 14 Apr 2020 00:01:26 +0000 (00:01 +0000)]
Re-organize the NFS file handle affinity code for the NFS server.

The file handle affinity code was configured to be used by both the
old and new NFS servers. This no longer makes sense, since there is
only one NFS server.
This patch copies a majority of the code in sys/nfs/nfs_fha.c and
sys/nfs/nfs_fha.h into sys/fs/nfsserver/nfs_fha_new.c and
sys/fs/nfsserver/nfs_fha_new.h, so that the files in sys/nfs can be
deleted. The code is simplified by deleting the function callback pointers
used to call functions in either the old or new NFS server and they were
replaced by calls to the functions.

As well as a cleanup, this re-organization simplifies the changes
required for handling of external page mbufs, which is required for KERN_TLS.

This patch should not result in a semantic change to file handle affinity.

4 years agoRemove FreeBSD/armv4 specific bits from CK.
cognet [Mon, 13 Apr 2020 23:16:32 +0000 (23:16 +0000)]
Remove FreeBSD/armv4 specific bits from CK.

Now that armv4/v5 is gone, remove the bits that implemented atomic operations
by disabling interrupts.
Those were specific to FreeBSD and never reached upstream.

4 years agolagg: stop double-counting output errors and counting drops as errors
gallatin [Mon, 13 Apr 2020 23:06:56 +0000 (23:06 +0000)]
lagg: stop double-counting output errors and counting drops as errors

Before this change, lagg double-counted errors from lagg members, and counted
every drop by a lagg member as an error.  Eg, if lagg sent a packet, and the
underlying hardware driver dropped it, a counter would be incremented by both
lagg and the underlying driver.

This change attempts to fix that by incrementing lagg's counters only for
errors that do not come from underlying drivers.

Reviewed by: hselasky, jhb
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D24331

4 years ago[evdev] Use proper mutex reference in autorepeat callout initialization.
wulf [Mon, 13 Apr 2020 22:06:28 +0000 (22:06 +0000)]
[evdev] Use proper mutex reference in autorepeat callout initialization.

This fixes panic occuring when evdev key autorepeat is enabled by driver
which initializes evdev with external mutex.

4 years agoEnsure `kyua list` working when there is no /dev/nvme*
lwhsu [Mon, 13 Apr 2020 21:08:54 +0000 (21:08 +0000)]
Ensure `kyua list` working when there is no /dev/nvme*

Sponsored by: The FreeBSD Foundation

4 years agoChecks here against useracc are not useful and are racy.
imp [Mon, 13 Apr 2020 21:04:33 +0000 (21:04 +0000)]
Checks here against useracc are not useful and are racy.

copyin/copyout are sufficient to guard against bad addresses. They will return
EFAULT if the user is up to no good (by choice or ignorance). There's no point
in checking, since it doesn't even improve the error messages.

Noticed by: jhb
Reviewed by: brooks, jhb

4 years agoRemove stale comment
imp [Mon, 13 Apr 2020 21:03:30 +0000 (21:03 +0000)]
Remove stale comment

There's no useracc here, and even if there was it shouldn't be here. vmapbuf is
sufficient and as the comment says, useracc is racy.