]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years ago[ath] [ath_hal] Propagate the HAL_RESET_TYPE through to the chip reset; set it during...
adrian [Mon, 25 May 2020 22:31:45 +0000 (22:31 +0000)]
[ath] [ath_hal] Propagate the HAL_RESET_TYPE through to the chip reset; set it during ath_reset()

Although I added the reset type field to ath_hal_reset() years ago,
I never finished adding it both throughout the HALs and in if_ath.c.

This will eventually deprecate the ath_hal force_full_reset option
because it can be requested at the driver layer.

So:

* Teach ar5416ChipReset() and ar9300_chip_reset() about the HAL type
* Use it in ar5416Reset() and ar9300_reset() when doing a full chip reset
* Extend ath_reset() to include the HAL_RESET_TYPE parameter added in the above functions
* Use HAL_RESET_NORMAL in most calls to ath_reset()
* .. but use HAL_RESET_BBPANIC for the BB panics, and HAL_RESET_FORCE_COLD during fatal, beacon miss and other hardware related hangs.

This should be a glorified no-op outside of actual hardware issues.
I've tested things with ath_hal force_full_reset set to 1 for years now,
so I know that feature and a full reset works (albeit much slower than
a warm reset!) and it does unwedge hardware.

The eventual aim is to use this for all the places where the driver
detects a potential hang as well as if long calibration - ie, noise floor
calibration - fails to complete. That's one of the big hardware related
things that causes station mode operation to hang without easy recovery.

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

4 years agoSupport separate output buffers for aesni(4).
jhb [Mon, 25 May 2020 22:30:44 +0000 (22:30 +0000)]
Support separate output buffers for aesni(4).

The backend routines aesni(4) call for specific encryption modes all
expect virtually contiguous input/output buffers.  If the existing
output buffer is virtually contiguous, always write to the output
buffer directly from the mode-specific routines.  If the output buffer
is not contiguous, then a temporary buffer is allocated whose output
is then copied to the output buffer.  If the input buffer is not
contiguous, then the existing buffer used to hold the input is also
used to hold temporary output.

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

4 years agoSupport separate output buffers in ccr(4).
jhb [Mon, 25 May 2020 22:23:13 +0000 (22:23 +0000)]
Support separate output buffers in ccr(4).

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

4 years agoAdd a sysctl knob to use separate output buffers for /dev/crypto.
jhb [Mon, 25 May 2020 22:21:09 +0000 (22:21 +0000)]
Add a sysctl knob to use separate output buffers for /dev/crypto.

This is a testing aid to permit using testing a driver's support of
separate output buffers via cryptocheck.

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

4 years agoExport the _kern_crypto sysctl node from crypto.c.
jhb [Mon, 25 May 2020 22:18:33 +0000 (22:18 +0000)]
Export the _kern_crypto sysctl node from crypto.c.

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

4 years agoAdd support for optional separate output buffers to in-kernel crypto.
jhb [Mon, 25 May 2020 22:12:04 +0000 (22:12 +0000)]
Add support for optional separate output buffers to in-kernel crypto.

Some crypto consumers such as GELI and KTLS for file-backed sendfile
need to store their output in a separate buffer from the input.
Currently these consumers copy the contents of the input buffer into
the output buffer and queue an in-place crypto operation on the output
buffer.  Using a separate output buffer avoids this copy.

- Create a new 'struct crypto_buffer' describing a crypto buffer
  containing a type and type-specific fields.  crp_ilen is gone,
  instead buffers that use a flat kernel buffer have a cb_buf_len
  field for their length.  The length of other buffer types is
  inferred from the backing store (e.g. uio_resid for a uio).
  Requests now have two such structures: crp_buf for the input buffer,
  and crp_obuf for the output buffer.

- Consumers now use helper functions (crypto_use_*,
  e.g. crypto_use_mbuf()) to configure the input buffer.  If an output
  buffer is not configured, the request still modifies the input
  buffer in-place.  A consumer uses a second set of helper functions
  (crypto_use_output_*) to configure an output buffer.

- Consumers must request support for separate output buffers when
  creating a crypto session via the CSP_F_SEPARATE_OUTPUT flag and are
  only permitted to queue a request with a separate output buffer on
  sessions with this flag set.  Existing drivers already reject
  sessions with unknown flags, so this permits drivers to be modified
  to support this extension without requiring all drivers to change.

- Several data-related functions now have matching versions that
  operate on an explicit buffer (e.g. crypto_apply_buf,
  crypto_contiguous_subsegment_buf, bus_dma_load_crp_buf).

- Most of the existing data-related functions operate on the input
  buffer.  However crypto_copyback always writes to the output buffer
  if a request uses a separate output buffer.

- For the regions in input/output buffers, the following conventions
  are followed:
  - AAD and IV are always present in input only and their
    fields are offsets into the input buffer.
  - payload is always present in both buffers.  If a request uses a
    separate output buffer, it must set a new crp_payload_start_output
    field to the offset of the payload in the output buffer.
  - digest is in the input buffer for verify operations, and in the
    output buffer for compute operations.  crp_digest_start is relative
    to the appropriate buffer.

- Add a crypto buffer cursor abstraction.  This is a more general form
  of some bits in the cryptosoft driver that tried to always use uio's.
  However, compared to the original code, this avoids rewalking the uio
  iovec array for requests with multiple vectors.  It also avoids
  allocate an iovec array for mbufs and populating it by instead walking
  the mbuf chain directly.

- Update the cryptosoft(4) driver to support separate output buffers
  making use of the cursor abstraction.

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

4 years agocopystr(9): Move to deprecate (attempt #2)
cem [Mon, 25 May 2020 16:40:48 +0000 (16:40 +0000)]
copystr(9): Move to deprecate (attempt #2)

This reapplies logical r360944 and r360946 (reverting r360955), with fixed
copystr() stand-in replacement macro.  Eventually the goal is to convert
consumers and kill the macro, but for a first step it helps if the macro is
correct.

Prior commit message:

Unlike the other copy*() functions, it does not serve to copy from one
address space to another or protect against potential faults.  It's just
an older incarnation of the now-more-common strlcpy().

Add a coccinelle script to tools/ which can be used to mechanically
convert existing instances where replacement with strlcpy is trivial.
In the two cases which matched, fuse_vfsops.c and union_vfsops.c, the
code was further refactored manually to simplify.

Replace the declaration of copystr() in systm.h with a small macro
wrapper around strlcpy (with correction from brooks@ -- thanks).

Remove N redundant MI implementations of copystr.  For MIPS, this
entailed inlining the assembler copystr into the only consumer,
copyinstr, and making the latter a leaf function.

Reviewed by: jhb (earlier version)
Discussed with: brooks (thanks!)
Differential Revision: https://reviews.freebsd.org/D24672

4 years agoIntroduce a driver for NXP LS1046A SoC AHCI.
mw [Mon, 25 May 2020 16:00:08 +0000 (16:00 +0000)]
Introduce a driver for NXP LS1046A SoC AHCI.

Implement support for AHCI controller found in
NXP QorIQ Layerscape SoCs.

Submitted by: Artur Rojek <ar@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D24466

4 years agoIntroduce support for Epson RX-8803 RTC.
mw [Mon, 25 May 2020 15:40:02 +0000 (15:40 +0000)]
Introduce support for Epson RX-8803 RTC.

This patch introduces support for Epson RX-8803 RTC controller accessible
over I2C bus. It has a resolution of 1 sec.
Support for interrupt based alarm was not implemented.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D24364

4 years agoAdd TCA6416 GPIO expander support.
mw [Mon, 25 May 2020 15:31:43 +0000 (15:31 +0000)]
Add TCA6416 GPIO expander support.

Add basic TCA6416 GPIO expander support over I2C bus. The driver handles
enabling and disabling pins, setting pin mode to IN and OUT and
toggling the pins. External interrupts are not supported.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: manu, mmel
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D24363

4 years agoIntroduce VF610 I2C controller support.
mw [Mon, 25 May 2020 15:21:38 +0000 (15:21 +0000)]
Introduce VF610 I2C controller support.

NXP LS1046A contains I2C controller compatible with Vybrid VF610.
Existing Vybrid MVF600 driver can be used to support it. For that purpose
declare driver as ofw_iicbus and add methods associated with ofw_iicbus.

For VF610 add dynamic clock prescaler calculation using clock information
from clock driver and clock frequency requested in device tree.

On the occasion add detach function and add additional error handling
in i2c_attach function.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D24361

4 years agoAdd GPIO support for QorIQ boards.
mw [Mon, 25 May 2020 14:55:37 +0000 (14:55 +0000)]
Add GPIO support for QorIQ boards.

This patch adds a GPIO controller support targeted for NXP LS1046A
SoC. The driver implements the following features:
 * setting direction of each pin (IN or OUT)
 * setting the mode of output pins (PUSHPULL or OPENDRAIN)
 * setting the state of each output pin (1 or 0)
 * reading the state of each input pin (1 or 0)

Submitted by: Kamil Koczurek <kek@semihalf.com>
              Dawid Gorecki <dgr@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D24353

4 years agoAdd LS1046A clockgen driver.
mw [Mon, 25 May 2020 14:45:18 +0000 (14:45 +0000)]
Add LS1046A clockgen driver.

Driver provides probe and attach functions for LS1046A clockgen and passes
configuration information to QorIQ clockgen class. It may be used as
a reference implementation for different QorIQ clockgen devices.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: mmel, manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D24352

4 years agoAdd QorIQ platform clockgen driver.
mw [Mon, 25 May 2020 14:31:32 +0000 (14:31 +0000)]
Add QorIQ platform clockgen driver.

This patch adds classes and functions that can be used with various NXP
QorIQ Layerscape SoCs.

As for the clock topology - there is single platform PLL, which supplies
clocks for the peripheral bus and additional PLLs for CPU cores. There
can be multiple core PLLs (For example - LS1046A has two PLLs - CGAPLL1
and CGAPLL2). Each PLL has fixed dividers on output. The core PLLs
are not accessible from dts.

This is a preparation patch for NXP LS1046A SoC support.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: mmel
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D24351

4 years agolinuxkpi: Fix mod_timer and del_timer_sync
manu [Mon, 25 May 2020 12:46:05 +0000 (12:46 +0000)]
linuxkpi: Fix mod_timer and del_timer_sync

mod_timer is supposed to return 1 if the modified timer was pending, which
is exactly what callout_reset does so return the value after checking
that it's a correct one in case the api change.
del_timer_sync returns int so add a function and handle that.

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

4 years agolinuxkpi: Add refcount.h
manu [Mon, 25 May 2020 12:44:07 +0000 (12:44 +0000)]
linuxkpi: Add refcount.h

Implement some refcount functions needed by drm.
Just use the atomic_t struct and functions from linuxkpi for simplicity.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselsasky
Differential Revision: https://reviews.freebsd.org/D24985

4 years agolinuxkpi: Add __same_type and __must_be_array macros
manu [Mon, 25 May 2020 12:42:55 +0000 (12:42 +0000)]
linuxkpi: Add __same_type and __must_be_array macros

The same_type macro simply wraps around builtin_types_compatible_p which
exist for both GCC and CLANG, which returns 1 if both types are the same.
The __must_be_array macros returns 1 if the argument is an array.

This is needed for DRM v5.3

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24953

4 years agoproc: refactor clearing credentials into proc_unset_cred
mjg [Mon, 25 May 2020 12:41:44 +0000 (12:41 +0000)]
proc: refactor clearing credentials into proc_unset_cred

4 years agoImprove set progress parameters, SET PSV for HW TLS in mlx5en(4).
hselasky [Mon, 25 May 2020 12:37:45 +0000 (12:37 +0000)]
Improve set progress parameters, SET PSV for HW TLS in mlx5en(4).

There is no need for a fence and there is no need to provide
the TCP sequence number.

Sponsored by: Mellanox Technologies

4 years agoCorrectly set the initial vector for TLS v1.3 for mlx5en(4).
hselasky [Mon, 25 May 2020 12:34:15 +0000 (12:34 +0000)]
Correctly set the initial vector for TLS v1.3 for mlx5en(4).

For TLS v1.3 the 12 bytes of the initial vector, IV, should just be copied
as-is from the kernel to the gcm_iv field, which hold the first 4 bytes,
and the remaining 8 bytes go to the subsequent implicit_iv field.
There is no need to consider the byte order on the 12 bytes of IV like
initially done.

Sponsored by: Mellanox Technologies

4 years agoUpdate the TLS capability bit after recent PRM changes in mlx5en(4).
hselasky [Mon, 25 May 2020 12:31:48 +0000 (12:31 +0000)]
Update the TLS capability bit after recent PRM changes in mlx5en(4).

A CX6-DX firmware version equal to or newer than 12.27.0372 is
now required.

Sponsored by: Mellanox Technologies

4 years agoAdd example usage for formatting a floppy disk. Adding a more self
murray [Mon, 25 May 2020 07:18:47 +0000 (07:18 +0000)]
Add example usage for formatting a floppy disk.  Adding a more self
contained example here in the fdformat man page will allow us to
modernize and streamline the FreeBSD Handbook by cutting out some of
this legacy material.

While here, address some other minor grammatical nits in this man page.

Reviewed by: bcr (mentor)
Approved by: bcr (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24971

4 years agoFix pci-passthru MSI issues with OpenBSD guests
grehan [Mon, 25 May 2020 06:25:31 +0000 (06:25 +0000)]
Fix pci-passthru MSI issues with OpenBSD guests

- Return 2 x 16-bit registers in the correct byte order
 for a 4-byte read that spans the CMD/STATUS register.
  This reversal was hiding the capabilities-list, which prevented
 the MSI capability from being found for XHCI passthru.

- Reorganize MSI/MSI-x config writes so that a 4-byte write at the
 capability offset would have the read-only portion skipped.
  This prevented MSI interrupts from being enabled.

 Reported and extensively tested by Anatoli (me at anatoli dot ws)

PR: 245392
Reported by: Anatoli (me at anatoli dot ws)
Reviewed by: jhb (bhyve)
Approved by: jhb, bz (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24951

4 years agovfs: use atomic_{store,load}_long to manage f_offset
mjg [Mon, 25 May 2020 04:57:57 +0000 (04:57 +0000)]
vfs: use atomic_{store,load}_long to manage f_offset

... instead of depending on the compiler not to mess them up

4 years agovfs: restore mtx-protected foffset locking for 32 bit platforms
mjg [Mon, 25 May 2020 04:56:41 +0000 (04:56 +0000)]
vfs: restore mtx-protected foffset locking for 32 bit platforms

They depend on it to accurately read the offset.

The new code is not used as it would add an interrupt enable/disable
trip on top of the atomic.

This also fixes a bug where 32-bit nolock request would still lock the offset.

No changes for 64-bit.

Reported by: emaste

4 years ago[skip ci] ip.4: fix typos
asomers [Mon, 25 May 2020 04:17:01 +0000 (04:17 +0000)]
[skip ci] ip.4: fix typos

MFC after: 2 weeks

4 years agoChase r361344. Update unbound version strings.
cy [Sun, 24 May 2020 21:42:47 +0000 (21:42 +0000)]
Chase r361344. Update unbound version strings.

Reported by: mike tancsa <mike@sentex.net>
MFC after: 1 day

4 years agoMake i386 memstick images bootable.
emaste [Sun, 24 May 2020 18:25:49 +0000 (18:25 +0000)]
Make i386 memstick images bootable.

This reverts the i386 part of r342283, "Rework UEFI ESP generation", and
the followup commit in r342690.

r342283 added an ESP to the i386 memstick image, and as a side effect
made the ESP the active partition, not the bootcode-containing UFS
partition.  As a result the i386 memstick images would not boot in
either UEFI or legacy mode - UEFI failed because we do not support i386
UEFI booting, and legacy mode failed because the partition with legacy
bootcode was not active.

The bootcode-containing UFS partition is again the only, and active,
partition.

PR: 246494
Reported by: Jorge Maidana
Differential Revision: The FreeBSD Foundation

4 years agolibprocstat: try to fix fallout from r361363
avg [Sun, 24 May 2020 14:54:21 +0000 (14:54 +0000)]
libprocstat: try to fix fallout from r361363

The revision caused libprocstat to have two undefined symbols:
- __start_set_pcpu
- __stop_set_pcpu
probably because of __GLOBL() used in sys/pcpu.h under _KERNEL.
The symbols are not accessed by anything and the linker in base does not
complain about them, but some ports are failing to build.
Hack around the problem by providing definitions for those symbols.

Probably there is a better solution, but I could not think of it yet.

Reported by: zeising
MFC after: 3 days
X-MFC with: r361363
Sponsored by: Panzura

4 years agovfs: scale foffset_lock by using atomics instead of serializing on mtx pool
mjg [Sun, 24 May 2020 03:50:49 +0000 (03:50 +0000)]
vfs: scale foffset_lock by using atomics instead of serializing on mtx pool

Contending cases still serialize on sleepq (which would be taken anyway).

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

4 years agoUnbreak ARM64 kernel build after r361426
cem [Sat, 23 May 2020 23:10:03 +0000 (23:10 +0000)]
Unbreak ARM64 kernel build after r361426

X-MFC-With: r361426

4 years agoUpdate to Zstandard 1.4.5
cem [Sat, 23 May 2020 21:23:46 +0000 (21:23 +0000)]
Update to Zstandard 1.4.5

As usual, the full release notes are found on Github:

  https://github.com/facebook/zstd/releases/tag/v1.4.5

Notable changes include:

* Improved decompress performance on amd64 and arm (5-10%
  and 15-50%, respectively).
* '--patch-from' zstd(1) CLI option, which provides something like a very fast
  version of bspatch(1) with slightly worse compression.  See release notes.

In this update, I dropped the 3-year old -O0 workaround for an LLVM ARM bug;
the bug was fixed in LLVM SVN in 2017, but we didn't remove this workaround
from our tree until now.

MFC after: I won't, but feel free
Relnotes: yes

4 years agocontrib/zstd: Revise Xlist for 1.4.5 import
cem [Sat, 23 May 2020 20:39:36 +0000 (20:39 +0000)]
contrib/zstd: Revise Xlist for 1.4.5 import

4 years agoImport Zstd 1.4.5
cem [Sat, 23 May 2020 20:37:33 +0000 (20:37 +0000)]
Import Zstd 1.4.5

4 years agobbr: Use arc4random_uniform from libkern.
manu [Sat, 23 May 2020 19:52:20 +0000 (19:52 +0000)]
bbr: Use arc4random_uniform from libkern.

This unbreak LINT build

Reported by: jenkins, melifaro

4 years agoMove <add|del|change>_route() functions to route_ctl.c in preparation of
melifaro [Sat, 23 May 2020 19:06:57 +0000 (19:06 +0000)]
Move <add|del|change>_route() functions to route_ctl.c in preparation of
 multipath control plane changed described in D24141.

Currently route.c contains core routing init/teardown functions, route table
 manipulation functions and various helper functions, resulting in >2KLOC
 file in total. This change moves most of the route table manipulation parts
 to a dedicated file, simplifying planned multipath changes and making
 route.c more manageable.

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

4 years agolinuxkpi: Add prandom_u32_max
manu [Sat, 23 May 2020 17:52:25 +0000 (17:52 +0000)]
linuxkpi: Add prandom_u32_max

This is just a wrapper around arc4random_uniform
Needed by DRM v5.3

Sponsored-by: The FreeBSD Foundation
Reviewed by: cem, hselasky
Differential Revision: https://reviews.freebsd.org/D24961

4 years agolibkern: Add arc4random_uniform
manu [Sat, 23 May 2020 17:51:06 +0000 (17:51 +0000)]
libkern: Add arc4random_uniform

This variant get a random number up to the limit passed as the argument.
This is simply a copy of the libc version.

Sponsored-by: The FreeBSD Foundation
Reviewed by: cem, hselasky (previous version)
Differential Revision: https://reviews.freebsd.org/D24962

4 years agoRemove refcounting from rtentry.
melifaro [Sat, 23 May 2020 12:15:47 +0000 (12:15 +0000)]
Remove refcounting from rtentry.

After making rtentry reclamation backed by epoch(9) in r361409, there is
 no reason in keeping reference counting code.

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

4 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
dim [Sat, 23 May 2020 10:32:18 +0000 (10:32 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
llvmorg-10.0.1-rc1-0-gf79cd71e145 (aka 10.0.1 rc1).

MFC after: 3 weeks

4 years agoUse epoch(9) for rtentries to simplify control plane operations.
melifaro [Sat, 23 May 2020 10:21:02 +0000 (10:21 +0000)]
Use epoch(9) for rtentries to simplify control plane operations.

Currently the only reason of refcounting rtentries is the need to report
 the rtable operation details immediately after the execution.
Delaying rtentry reclamation allows to stop refcounting and simplify the code.
Additionally, this change allows to reimplement rib_lookup_info(), which
 is used by some of the customers to get the matching prefix along
 with nexthops, in more efficient way.

The change keeps per-vnet rtzone uma zone. It adds nh_vnet field to
 nhop_priv to be able to reliably set curvnet even during vnet teardown.
Rest of the reference counting code will be removed in the D24867 .

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

4 years agoRemove a workaround for GCM requests with an empty payload.
jhb [Fri, 22 May 2020 20:52:36 +0000 (20:52 +0000)]
Remove a workaround for GCM requests with an empty payload.

This was copied from ccr(4) (which does require the workaround), but
is reportedly not needed for ccp(4).

Discussed with: cem
Sponsored by: Netflix

4 years agoSimplify the RISC-V kernel linker invocation
mhorne [Fri, 22 May 2020 18:54:56 +0000 (18:54 +0000)]
Simplify the RISC-V kernel linker invocation

Remove our custom SYSTEM_LD definition. This generates program headers
that are more consistent with other architectures, and more importantly,
are in line with what loader(8) expects when loading a kernel.

As noted in https://reviews.freebsd.org/D22920, there is no apparent
reason why the kernel would need a writable text segment, so removal of
the -N flag isn't likely to cause issue.

Reviewed by: kp, br
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24909

4 years agoFix issues with FUSE_ACCESS when default_permissions is disabled
asomers [Fri, 22 May 2020 18:11:17 +0000 (18:11 +0000)]
Fix issues with FUSE_ACCESS when default_permissions is disabled

This patch fixes two issues relating to FUSE_ACCESS when the
default_permissions mount option is disabled:

* VOP_ACCESS() calls with VADMIN set should never be sent to a fuse server
  in the form of FUSE_ACCESS operations. The FUSE protocol has no equivalent
  of VADMIN, so we must evaluate such things kernel-side, regardless of the
  default_permissions setting.

* The FUSE protocol only requires FUSE_ACCESS to be sent for two purposes:
  for the access(2) syscall and to check directory permissions for
  searchability during lookup. FreeBSD sends it much more frequently, due to
  differences between our VFS and Linux's, for which FUSE was designed. But
  this patch does eliminate several cases not required by the FUSE protocol:

  * for any FUSE_*XATTR operation
  * when creating a new file
  * when deleting a file
  * when setting timestamps, such as by utimensat(2).

* Additionally, when default_permissions is disabled, this patch removes one
  FUSE_GETATTR operation when deleting a file.

PR: 245689
Reported by: MooseFS FreeBSD Team <freebsd@moosefs.pro>
Reviewed by: cem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24777

4 years agoDo not try to fill socket send buffer to the last byte.
mav [Fri, 22 May 2020 18:10:46 +0000 (18:10 +0000)]
Do not try to fill socket send buffer to the last byte.

Setting so_snd.sb_lowat to at least 1/8 of the socket buffer size allows
send thread more actively use PDUs coalescing, that dramatically reduces
TCP lock congestion and number of context switches, when the socket is
full and PDUs are small.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

4 years agoDisable nullfs cacheing on top of fusefs
asomers [Fri, 22 May 2020 18:03:14 +0000 (18:03 +0000)]
Disable nullfs cacheing on top of fusefs

Nullfs cacheing can keep a large number of vnodes active.  That results in
more active FUSE file handles, causing some FUSE servers to use extra
resources.  Disable nullfs cacheing for fusefs, just like we already do for
NFSv4.

PR: 245688
Reported by: MooseFS FreeBSD Team <freebsd@moosefs.pro>
MFC after: 2 weeks

4 years agoImplement Solaris-like link_map l_refname member.
kib [Fri, 22 May 2020 17:52:09 +0000 (17:52 +0000)]
Implement Solaris-like link_map l_refname member.

The implementation is based on the public documentation, in particular
dlinfo(3) from Solaris.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoAdd an unprivileged mode where calls to install are passed appropriate
brooks [Fri, 22 May 2020 17:45:07 +0000 (17:45 +0000)]
Add an unprivileged mode where calls to install are passed appropriate
flags.  For ease of integration, use the same flags as install:

 -U unprivileged mode
 -D <destdir> Specify DESTDIR (overrides the environment)
 -M <metalog> Full path to METALOG file

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

4 years agoUpdate name of description of vfs.ffs.setsize in comment.
jhb [Fri, 22 May 2020 17:23:43 +0000 (17:23 +0000)]
Update name of description of vfs.ffs.setsize in comment.

Previously it used the name 'adjsize' instead of 'setsize'.

4 years agoConvert linkmap_add() and linkmap_delete() to style(8).
kib [Fri, 22 May 2020 17:23:09 +0000 (17:23 +0000)]
Convert linkmap_add() and linkmap_delete() to style(8).

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoCorrect the minimum key length for Camellia to 16 bytes (128 bits).
jhb [Fri, 22 May 2020 17:21:22 +0000 (17:21 +0000)]
Correct the minimum key length for Camellia to 16 bytes (128 bits).

MFC after: 1 week

4 years agoRemove support for SSLv3 from the OpenSSL build.
gordon [Fri, 22 May 2020 16:53:39 +0000 (16:53 +0000)]
Remove support for SSLv3 from the OpenSSL build.

This is the default configuration in OpenSSL 1.1.1 already. This moves
to align with that default.

Reported by: jmg
Approved by: jkim, cem, emaste, philip
Differential Revision: https://reviews.freebsd.org/D24945

4 years agoImprove support for stream ciphers in the software encryption interface.
jhb [Fri, 22 May 2020 16:29:09 +0000 (16:29 +0000)]
Improve support for stream ciphers in the software encryption interface.

Add a 'native_blocksize' member to 'struct enc_xform' that ciphers can
use if they support a partial final block.  This is particular useful
for stream ciphers, but can also apply to other ciphers.  cryptosoft
will only pass in native blocks to the encrypt and decrypt hooks.  For
the final partial block, 'struct enc_xform' now has new
encrypt_last/decrypt_last hooks which accept the length of the final
block.  The multi_block methods are also retired.

Mark AES-ICM (AES-CTR) as a stream cipher.  This has some interesting
effects on IPsec in that FreeBSD can now properly receive all packets
sent by Linux when using AES-CTR, but FreeBSD can no longer
interoperate with OpenBSD and older verisons of FreeBSD which assume
AES-CTR packets have a payload padded to a 16-byte boundary.  Kornel
has offered to work on a patch to add a compatiblity sysctl to enforce
additional padding for AES-CTR in esp_output to permit compatibility
with OpenBSD and older versions of FreeBSD.

AES-XTS continues to use a block size of a single AES block length.
It is possible to adjust it to support partial final blocks by
implementing cipher text stealing via encrypt_last/decrypt_last hooks,
but I have not done so.

Reviewed by: cem (earlier version)
Tested by: Kornel DulÄ™ba <mindal@semihalf.com> (AES-CTR with IPsec)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D24906

4 years agoctime.3: Use ASCII asterisks for C, not special unicode math glyphs
cem [Fri, 22 May 2020 15:30:14 +0000 (15:30 +0000)]
ctime.3: Use ASCII asterisks for C, not special unicode math glyphs

PR: 246656
Reported by: danfe

4 years agosh: Remove a comment that was obsoleted by r358152
jilles [Fri, 22 May 2020 14:46:23 +0000 (14:46 +0000)]
sh: Remove a comment that was obsoleted by r358152

Since r358152, the read builtin has used a buffer.

Also, remove a space at the end of the line in a comment.

No functional change is intended.

4 years agonet80211: post RTM_IFINFO notification after toggling IFF_DRV_RUNNING
avg [Fri, 22 May 2020 11:25:45 +0000 (11:25 +0000)]
net80211: post RTM_IFINFO notification after toggling IFF_DRV_RUNNING

This is useful when a wireless driver is stopped or started in response
to events like an RF Kill button press.  Applications like
wpa_supplicant depend on such events to have a correct view of interface
state.

Reviewed by: adrian, cy, melifaro
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24925

4 years agolibprocstat: fix ZFS support
avg [Fri, 22 May 2020 11:20:23 +0000 (11:20 +0000)]
libprocstat: fix ZFS support

First of all, znode_phys_t hasn't been used for storing file attributes
for a long time now.  Modern ZFS versions use a System Attribute table
with a flexible layout.  But more importantly all the required
information is available in znode_t itself.

It's not easy to include zfs_znode.h in userland without breaking code
because the most interesting parts of the header are kernel-only. And
hardcoding field offsets is too fragile.  So, I created a new
compilation unit that includes zfs_znode.h using some mild kludges to
get it and its dependencies to compile in userland.  The compilation
unit exports interesting field offsets and does not have any other code.

PR: 194117
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Panzura
Differential Revision: https://reviews.freebsd.org/D24941

4 years agoBump __FreeBSD_version after r361275, HyperV socket support
whu [Fri, 22 May 2020 10:50:29 +0000 (10:50 +0000)]
Bump  __FreeBSD_version after r361275, HyperV socket support

Sponsored by: Microsoft

4 years agoUpdate pciids to 2020.05.22
bapt [Fri, 22 May 2020 09:38:44 +0000 (09:38 +0000)]
Update pciids to 2020.05.22

MFC after: 2 days

4 years agoSocket AF_HYPERV should return failure when it is not running on HyperV
whu [Fri, 22 May 2020 09:17:07 +0000 (09:17 +0000)]
Socket AF_HYPERV should return failure when it is not running on HyperV

Reported by: pho
Sponsored by: Microsoft

4 years agoInclude all currently present kernel options for IPFW
rgrimes [Fri, 22 May 2020 03:13:29 +0000 (03:13 +0000)]
Include all currently present kernel options for IPFW
Also fix igor complaint about manpage/s/man page

Reported by: rgrimes@freebsd.org

PR: 219075
Submitted by: Dries Michiels driesm.michiels_gmail.com
Reported by: rgrimes
Reviewed by: bcr (manpages), 0mp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D24541

4 years agoFix the build after r361033 when ACPI is disabled.
markj [Fri, 22 May 2020 01:18:55 +0000 (01:18 +0000)]
Fix the build after r361033 when ACPI is disabled.

Reported by: Herbert J. Skuhra <herbert@gojira.at>

4 years agoRestore the binary compatibility for link_map l_addr.
kib [Thu, 21 May 2020 22:24:23 +0000 (22:24 +0000)]
Restore the binary compatibility for link_map l_addr.

Keep link_map l_addr binary layout compatible, rename l_addr to l_base
where rtld returns map base.  Provide relocbase in newly added l_addr.

This effectively reverts the patch to the initial version of D24918.

Reported by: antoine (portmgr)
Reviewed by: jhb, markj
Tested by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D24946

4 years agoDCTCP: update alpha only once after loss recovery.
rscheff [Thu, 21 May 2020 21:42:49 +0000 (21:42 +0000)]
DCTCP: update alpha only once after loss recovery.

In mixed ECN marking and loss scenarios it was found, that
the alpha value of DCTCP is updated two times. The second
update happens with freshly initialized counters indicating
to ECN loss. Overall this leads to alpha not adjusting as
quickly as expected to ECN markings, and therefore lead to
excessive loss.

Reported by: Cheng Cui
Reviewed by: chengc_netapp.com, rrs, tuexen (mentor)
Approved by: tuexen (mentor)
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D24817

4 years agoWith RFC3168 ECN, CWR SHOULD only be sent with new data
rscheff [Thu, 21 May 2020 21:33:15 +0000 (21:33 +0000)]
With RFC3168 ECN, CWR SHOULD only be sent with new data

Overly conservative data receivers may ignore the CWR flag
on other packets, and keep ECE latched. This can result in
continous reduction of the congestion window, and very poor
performance when ECN is enabled.

Reviewed by: rgrimes (mentor), rrs
Approved by: rgrimes (mentor), tuexen (mentor)
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D23364

4 years agoRetain only mutually supported TCP options after simultaneous SYN
rscheff [Thu, 21 May 2020 21:26:21 +0000 (21:26 +0000)]
Retain only mutually supported TCP options after simultaneous SYN

When receiving a parallel SYN in SYN-SENT state, remove all the
options only we supported locally before sending the SYN,ACK.

This addresses a consistency issue on parallel opens.

Also, on such a parallel open, the stack could be coaxed into
running with timestamps enabled, even if administratively disabled.

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

4 years agoHandle ECN handshake in simultaneous open
rscheff [Thu, 21 May 2020 21:15:25 +0000 (21:15 +0000)]
Handle ECN handshake in simultaneous open

While testing simultaneous open TCP with ECN, found that
negotiation fails to arrive at the expected final state.

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

4 years agoMFV r361322:
cy [Thu, 21 May 2020 21:00:46 +0000 (21:00 +0000)]
MFV r361322:

Update unbound 1.9.6 --> 1.10.1.

Bug Fixes:
 - CVE-2020-12662 Unbound can be tricked into amplifying an incoming
   query into a large number of queries directed to a target.
 - CVE-2020-12663 Malformed answers from upstream name servers can be
   used to make Unbound unresponsive.

Reported by: emaste
MFC after: 3 days
Relnotes: yes
Security: CVE-2020-12662, CVE-2020-12663

4 years agolinuxkpi: Add rcu_work functions
manu [Thu, 21 May 2020 20:18:38 +0000 (20:18 +0000)]
linuxkpi: Add rcu_work functions

The rcu_work function helps to queue some work after waiting for a grace
period.
This is needed by DRM drivers.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24942

4 years agoFix ACCEPT_FILTER_DEFINE to pass the version to MODULE_VERSION.
markj [Thu, 21 May 2020 18:38:41 +0000 (18:38 +0000)]
Fix ACCEPT_FILTER_DEFINE to pass the version to MODULE_VERSION.

MFC with: r361263

4 years agoindent(1): add fallthrough markers
pstef [Thu, 21 May 2020 17:34:31 +0000 (17:34 +0000)]
indent(1): add fallthrough markers

This silences -Wimplicit-fallthrough warnings.

Submitted by: Michael Paquier
Obtained from: postgresql.org
MFC after: 3 days

4 years ago[PowerPC] Fix kernel boot on powerpc
bdragon [Thu, 21 May 2020 15:53:16 +0000 (15:53 +0000)]
[PowerPC] Fix kernel boot on powerpc

Recent changes have caused the vmspace objects to start coming from KVA
instead of direct-mapped memory on powerpc. As far as I can tell, this is
not actually a problem, so we should stop arbitrarily asserting that it is.

I do not know why this was not being triggered before.

Approved by: jhibbits
Sponsored by: Tag1 Consulting, Inc.

4 years agols: fix WITHOUT_LS_COLORS build
kevans [Thu, 21 May 2020 15:15:50 +0000 (15:15 +0000)]
ls: fix WITHOUT_LS_COLORS build

*sigh* references to colorflags should be gated by COLORLS.

Pointy hat to: kevans
Reported by: jenkins (rescue build)
X-MFC-With: r361318

4 years agols(1): actually restore proper behavior
kevans [Thu, 21 May 2020 14:39:00 +0000 (14:39 +0000)]
ls(1): actually restore proper behavior

Highlights:
- CLICOLOR in the environment should imply --color=auto to maintain
  compatibility with historical behavior
- -G should set CLICOLOR and imply --color=auto

The manpage has been updated to draw the connection between -G and --color;
the former is in-fact a sort of compromise between --color=always and
--color=auto, where we'll output color regardless of the environment lacking
CLICOLOR/COLORTERM assuming stdout is a tty.

X-MFC-With: r361318

4 years agolibprocstat: fix reading of file descriptor table via kvm
avg [Thu, 21 May 2020 13:46:30 +0000 (13:46 +0000)]
libprocstat: fix reading of file descriptor table via kvm

This seems to have been broken since r247602 (from year 2013!).
Can be easily tested with
  fstat -N /boot/kernel/kernel -M /var/crash/vmcore.last

MFC after: 1 week
Sponsored by: Panzura

4 years agoBring in support for single core Zynq devices. Turns out that real
jmg [Thu, 21 May 2020 06:40:51 +0000 (06:40 +0000)]
Bring in support for single core Zynq devices.  Turns out that real
hardware, the registers appear like there's two cores, but the second
core does not work, so base the number of cores upon the chip id.

Tested on a XC7Z007S.

also, previous commit was suppose to be D14429.

Submitted by:   Thomas Skibo
Differential Revision:  https://reviews.freebsd.org/D14429

4 years agominor cleanup of white space, and function name in panic...
jmg [Thu, 21 May 2020 06:17:54 +0000 (06:17 +0000)]
minor cleanup of white space, and function name in panic...

This is a partial commit of the review.

Submitted by:   Thomas Skibo
Differential Revision:  https://reviews.freebsd.org/D23319
Reviewed by: andrew

4 years agoFor the case when RB_REMOVE requires a nontrivial search to find the
dougm [Thu, 21 May 2020 05:34:02 +0000 (05:34 +0000)]
For the case when RB_REMOVE requires a nontrivial search to find the
node to replace the one being removed, restructure to first remove the
replacement node and correct the parent pointers around it, and then
let the all-cases code at the end deal with the parent of the deleted
node, making it point to the replacement node. This removes one or two
conditional branches.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D24845

4 years agoVendor import of Unbound 1.10.1.
cy [Thu, 21 May 2020 05:01:52 +0000 (05:01 +0000)]
Vendor import of Unbound 1.10.1.

Security: CVE-2020-12662, CVE-2020-12663

4 years ago[ath] Hopefully recover better-er upon RX restart on AR9380.
adrian [Thu, 21 May 2020 04:35:12 +0000 (04:35 +0000)]
[ath] Hopefully recover better-er upon RX restart on AR9380.

This is all very long-standing bug stuff that is touchy and still poorly
documented. Ok, here goes.

The basic bug:

* deleting a VAP causes the RX path (and TX path too) to be restarted
  without a full chip reset, which causes RX hangs on the AR9380 and later.
  (ie, the ones with the newer DMA engine.)

The basic fix:

* do an RX flush when stopping RX in ath_vap_delete() to match what happens
  when RX is stopped elsewhere.  This ensures any pending frames are completed
  and we restart at the right spot; it also ensures we don't push new RX buffers
  into the hardware if we're stopping receive.

The other issues I found:

* Don't bother checking the RX packet ring in the deferred read taskqueue;
  that's specifically supposed to be for completing frames rather than
  just yanking them off the receive ring.

* Cancel/drain any pending deferred read taskqueue.  This isn't done inside
  any locks so we should be super careful here.  This stops the hardware
  being reprogrammed at the same time in another thread/CPU whilst we're
  stopping RX.

* .. (yes, this should be better serialised, but that's for another day. maybe.)

* Add more debugging to trace what's going on here.

And the fun bit:

* Reinitialise the RX FIFO ONLY if we've been reset or stopped, rather than just
  reset.  I noticed that after all the above was done I was STILL seeing RXEOL.
  RXEOL isn't enabled on the AR9380 so I'd only see it if I was sending TX frames
  (ie a ping where it'd be transmitted but never received) so I was not being
  spammed by RXEOL.  So, as long as stuff is stopped, restart it.

This seems to be doing the right thing in both AP and STA modes.

What I should do next, if I ever get time:

* as I said above, serialise the receive stop/start to include taskqueues
* monitor RXEOL on the AR9380 and I keep seeing it spammed / lockups, just
  go do a full chip reset to get things back on track. It sucks, but it
  is better than nothing.

Tested:

* AR9380 AP/STA mode, adding/deleting a hostap VAP to trigger the TX/RX
  queue stop/start; whilst also running an iperf through it.  Lots of times.
  Lots.  Of.. Times.

4 years ago[ath] reset hardware if this particular mac bug is seen.
adrian [Thu, 21 May 2020 04:26:20 +0000 (04:26 +0000)]
[ath] reset hardware if this particular mac bug is seen.

I have to dig into why I'm seeing it on chips as late as the AR9380 era
stuff (as it's marked as an AR5416 bug, but who knows!) but i'm seeing
aggregate TX frames complete with no blockack bit set.  So, everything
should be treated as a failure and do a hardware reset for good measure.

Tested:

* AR9380, STA mode
* AR9580 (5GHz), AP mode

4 years ago[ath_rate_sample] Obey the maximum frame length even when using static rates.
adrian [Thu, 21 May 2020 03:53:45 +0000 (03:53 +0000)]
[ath_rate_sample] Obey the maximum frame length even when using static rates.

I wasn't enforcing the maximum packet length when using static rates
so although the driver was enforcing it itself OK, the statistics were
sometimes going into the wrong bin.

Tested:

* AR9380, STA mode

4 years agols: fix a --color regression from r337956
kevans [Thu, 21 May 2020 03:50:56 +0000 (03:50 +0000)]
ls: fix a --color regression from r337956

The regression is in-fact that I flipped the default from never to auto. The
incorrect impression was based on an alias that I failed to notice,
installed by the Linux distribution that I used for testing compatibility
here. Users that want the old default should be doing so with a shell alias
as is done elsewhere, rather than making this decision in ls(1).

Many thanks to rgrimes for pointing out the alias that I clearly overlooked
that resulted in this; if you despised colors in your terminal from this,
consider buying him a beer at the next venue that you see him at.

MFC after: 1 week
Relnotes: yes

4 years agopowerpc: Handle machine checks caused by D-ERAT multihit
jhibbits [Thu, 21 May 2020 03:33:20 +0000 (03:33 +0000)]
powerpc: Handle machine checks caused by D-ERAT multihit

Instead of crashing the user process when a D-ERAT multihit is detected, try
to flush the ERAT, and continue.  This machine check indicates a likely PMAP
invalidation shortcoming that will need to be addressed, but it's
recoverable, so just recover.  The recovery is pmap-specific to flush the
ERAT, so add a pmap function to do so, currently only implemented by the
POWER9 radix pmap.

4 years agoDecode the file descriptor argument to closefrom(2) as an Integer.
csjp [Thu, 21 May 2020 02:10:45 +0000 (02:10 +0000)]
Decode the file descriptor argument to closefrom(2) as an Integer.
This is consistent with what we are doing for close(2) and it makes
it a bit easier to follow when debugging file descriptor operations.
i.e. many other syscalls are decoding fds as integers rather than
base 16 numbers.

MFC after: 1 week

4 years agoDeduplicate fsid comparisons
freqlabs [Thu, 21 May 2020 01:55:35 +0000 (01:55 +0000)]
Deduplicate fsid comparisons

Comparing fsid_t objects requires internal knowledge of the fsid structure
and yet this is duplicated across a number of places in the code.

Simplify by creating a fsidcmp function (macro).

Reviewed by: mjg, rmacklem
Approved by: mav (mentor)
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D24749

4 years agoMerge bmake-20200517
sjg [Wed, 20 May 2020 22:25:46 +0000 (22:25 +0000)]
Merge bmake-20200517

Changes since 20181221 are mostly portability related
hence the large gap in versions imported.

There are however some bug fixes, and a rework of filemon handling.
In NetBSD make/filemon/filemon_ktrace.c allows use of fktrace
and elimination of filemon(4) which has not had the TLC it needs.

FreeBSD filemon(4) is in much better shape, so bmake/filemon/filemon_dev.c
allows use of that, with a bit less overhead than the ktrace model.

Summary of changes from ChangeLog

o str.c: empty string does not match % pattern
  plus unit-test changes
o var.c: import handling of old sysV style modifier using '%'
o str.c: refactor brk_string
o meta.c: meta_oodate, CHECK_VALID_META is too aggressive for CMD
  a blank command is perfectly valid.
o meta.c: meta_oodate, check for corrupted meta file
  earlier and more often.
* meta.c: meta_compat_parent check for USE_FILEMON
  patch from Soeren Tempel
o meta.c: fix compat mode, need to call meta_job_output()
o job.c: extra fds for meta mode not needed if using filemon_dev
o meta.c: avoid passing NULL to filemon_*() when meta_needed()
  returns FALSE.
o filemon/filemon_{dev,ktrace}.c: allow selection of
  filemon implementation.  filemon_dev.c uses the kernel module
  while filemon_ktrace.c leverages the fktrace api available in
  NetBSD.  filemon_ktrace.c can hopefully form the basis for
  adding support for other tracing mechanisms such as strace on
  Linux.
o meta.c: when target is out-of-date per normal make rules
  record value of .OODATE in meta file.
o parse.c: don't pass NULL to realpath(3)
  some versions cannot handle it.
o parse.c: ParseDoDependency: free paths rather than assert

plus more unit-tests

4 years agoFix libstand build breakage after r361298.
jhb [Wed, 20 May 2020 22:25:41 +0000 (22:25 +0000)]
Fix libstand build breakage after r361298.

- Use enc_xform_aes_xts.setkey() directly instead of duplicating the code
  now that it no longer calls malloc().
- Rather than bringing back all of xform_userland.h, add a conditional
  #include of <stand.h> to xform_enc.h.
- Update calls to encrypt/decrypt callbacks in enc_xform_aes_xts for
  separate input/output pointers.

Pointy hat to: jhb

4 years agoChange the samantic of struct link_map l_addr member.
kib [Wed, 20 May 2020 22:08:26 +0000 (22:08 +0000)]
Change the samantic of struct link_map l_addr member.

It previously returned the object map base address, while all other
ELF operating systems return load offset, i.e. the difference between
map base and the link base.

Explain the meaning of the field in the man page.

Stop filling the mips-only l_offs member, which is apparently unused.

PR: 246561
Requested by: Damjan Jovanovic <damjan.jov@gmail.com>
Reviewed by: emaste, jhb, cem (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D24918

4 years agoamd64: Add a knob to flush RSB on context switches if machine has SMEP.
kib [Wed, 20 May 2020 22:00:31 +0000 (22:00 +0000)]
amd64: Add a knob to flush RSB on context switches if machine has SMEP.

The flush is needed to prevent cross-process ret2spec, which is not handled
on kernel entry if IBPB is enabled but SMEP is present.
While there, add i386 RSB flush.

Reported by: Anthony Steinhauser <asteinhauser@google.com>
Reviewed by: markj, Anthony Steinhauser
Discussed with: philip
admbugs: 961
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoFix indentation in bsdinstall-created wpa_supplicant.conf
dteske [Wed, 20 May 2020 21:39:19 +0000 (21:39 +0000)]
Fix indentation in bsdinstall-created wpa_supplicant.conf

PR: base/221982
Reported by: emaste
Reviewed by: emaste, allanjude
MFC after: 0 days
X-MFC-to: stable/11
Differential Revision: https://reviews.freebsd.org/D23641

4 years agoDo not consider CAP_RDCL_NO as an indicator for all MDS vulnerabilities
kib [Wed, 20 May 2020 21:22:25 +0000 (21:22 +0000)]
Do not consider CAP_RDCL_NO as an indicator for all MDS vulnerabilities
handled by hardware.

Reported by: Anthony Steinhauser <asteinhauser@google.com>
admbugs: 962
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoVarious cleanups to the software encryption transform interface.
jhb [Wed, 20 May 2020 21:21:01 +0000 (21:21 +0000)]
Various cleanups to the software encryption transform interface.

- Consistently use 'void *' for key schedules / key contexts instead
  of a mix of 'caddr_t', 'uint8_t *', and 'void *'.

- Add a ctxsize member to enc_xform similar to what auth transforms use
  and require callers to malloc/zfree the context.  The setkey callback
  now supplies the caller-allocated context pointer and the zerokey
  callback is removed.  Callers now always use zfree() to ensure
  key contexts are zeroed.

- Consistently use C99 initializers for all statically-initialized
  instances of 'struct enc_xform'.

- Change the encrypt and decrypt functions to accept separate in and
  out buffer pointers.  Almost all of the backend crypto functions
  already supported separate input and output buffers and this makes
  it simpler to support separate buffers in OCF.

- Remove xform_userland.h shim to permit transforms to be compiled in
  userland.  Transforms no longer call malloc/free directly.

Reviewed by: cem (earlier version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D24855

4 years agoPrint CPU informtion later in boot.
jhb [Wed, 20 May 2020 21:16:54 +0000 (21:16 +0000)]
Print CPU informtion later in boot.

Match other architectures and print CPU information during
cpu_startup().  In particular, this prints the information after the
message buffer is initialized which allows it to be retrieved after
boot via dmesg(8).

While here, add some extern declarations to <machine/md_var.h> in
place of duplicated declarations in various source files.

Reviewed by: brooks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24936

4 years agoSimplify hot-patching cpu_switch() for lack of UserLocal register.
jhb [Wed, 20 May 2020 21:15:43 +0000 (21:15 +0000)]
Simplify hot-patching cpu_switch() for lack of UserLocal register.

Rather than walking all of cpu_switch looking for the sequence of
instructions to patch, add a global label at the location that needs
the patch applied.

Reviewed by: brooks, Alfredo Mazzinghi <alfredo.mazzinghi_cl.cam.ac.uk>
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24931

4 years agoloader: fix userboot's ability to detect a guest's interpreter
kevans [Wed, 20 May 2020 21:02:08 +0000 (21:02 +0000)]
loader: fix userboot's ability to detect a guest's interpreter

Some time after r338418, I believe with -Os/-Oz -ffunction-sections
-fdata-sections, the bootprog_interp variable that held our "$Interpreter:"
marker started getting strip from all loaders, with exception to userboot
since it used bootprog_interp to determine what flavor of userboot it was.

At some point, it had been brought to my attention that this was no longer
working and I had worked up some potential solutions to use the variable
that involved printing it out. My vague recollection is that this was
rejected, and I forgot to explore the alternatives; I cannot find records of
this discussion anymore.

Fast forward to present day, Andrew reported that it was non-functional and
offered (effectively) this patch (sans comment) to stop the compiler from
optimizing it out by assigning it to a volatile variable. This removes
concerns about user-facing change while retaining the interpreter marker.
Furthermore, it could certainly be uglier.

Reported and tested by: Andrew Gierth <andrew_tao173.riddles.org.uk>
MFC after: 3 days

4 years agoMFV r361280:
mm [Wed, 20 May 2020 20:58:48 +0000 (20:58 +0000)]
MFV r361280:
Update libarchive to 3.4.3

Relevant vendor changes:
  PR #1352: support negative zstd compression levels
  PR #1359: improve zstd version checking
  PR #1348: support RHT.security.selinux from GNU tar
  PR #1357: support for archives compressed with pzstd
  PR #1367: fix issues in acl tests
  PR #1372: child handling cleanup
  PR #1378: fix memory leak from passphrase callback

4 years agoRemove copyinfrom() and copyinstrfrom().
jhb [Wed, 20 May 2020 20:58:17 +0000 (20:58 +0000)]
Remove copyinfrom() and copyinstrfrom().

These functions were added in 2001 and are currently unused.
copyinfrom() looks to have never been used.  copyinstrfrom() was used
for two weeks before the code was refactored to remove it's sole use.

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

4 years agovt: fix duplicate keymap descriptions
emaste [Wed, 20 May 2020 20:24:37 +0000 (20:24 +0000)]
vt: fix duplicate keymap descriptions

PR: 246495
Submitted by: Jorge Maidana
MFC after: 1 week

4 years agoMerge freebsd32_exec_setregs() into exec_setregs() on MIPS.
jhb [Wed, 20 May 2020 19:51:39 +0000 (19:51 +0000)]
Merge freebsd32_exec_setregs() into exec_setregs() on MIPS.

The stack pointer was being decremented by 64k twice previously.

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