]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoUpdate man-pages to describe the user.localbase variable added in r367179.
Stefan Eßer [Fri, 30 Oct 2020 19:37:53 +0000 (19:37 +0000)]
Update man-pages to describe the user.localbase variable added in r367179.

MFC after: 3 days

3 years agobectl(8): missing flag in the help message
Luca Pizzamiglio [Fri, 30 Oct 2020 19:37:34 +0000 (19:37 +0000)]
bectl(8): missing flag in the help message

Flag -o for destroy subcommand is missing in the help message,
but present in the man page. Fix it.

PR: 249325
Approved by: kevans
Differential Revision: https://reviews.freebsd.org/D26429

3 years agolinux(4): Quiesce warning about madvise(..., -1)
Conrad Meyer [Fri, 30 Oct 2020 19:02:59 +0000 (19:02 +0000)]
linux(4): Quiesce warning about madvise(..., -1)

This API misuse is intended to produce an error value to detect certain
bogus stub implementations of MADV_WIPEONFORK.  We don't need to log a
warning about it.

Example:
https://boringssl.googlesource.com/boringssl/+/ad5582985cc6b89d0e7caf0d9cc7e301de61cf66%5E%21/

Reviewed by: emaste, trasz
Differential Revision: https://reviews.freebsd.org/D27017

3 years agoUFS2: Fix DoS due to corrupted extattrfile
Conrad Meyer [Fri, 30 Oct 2020 19:00:42 +0000 (19:00 +0000)]
UFS2: Fix DoS due to corrupted extattrfile

Prior versions of FreeBSD (11.x) may have produced a corrupt extattr file.
(Specifically, r312416 accidentally fixed this defect by removing a strcpy.)
CURRENT FreeBSD supports disk images from those prior versions of FreeBSD.
Validate the internal structure as soon as we read it in from disk, to
prevent these extattr files from causing invariants violations and DoS.

Attempting to access the extattr portion of these files results in
EINTEGRITY.  At this time, the only way to repair files damaged in this way
is to copy the contents to another file and move it over the original.

PR: 244089
Reported by: Andrea Venturoli <ml AT netfence.it>
Reviewed by: kib
Discussed with: mckusick (earlier draft)
Security: no
Differential Revision: https://reviews.freebsd.org/D27010

3 years agoAdd help messages for camcontrol(8) MMCCAM functionality
Ilya Bakulin [Fri, 30 Oct 2020 18:55:08 +0000 (18:55 +0000)]
Add help messages for camcontrol(8) MMCCAM functionality

This adds the help messages for camcontrol(8) in-binary help.
Man page will follow in the separate change.

Reviewed by: bz
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D25963

3 years agoAdd read only sysctl variable user.localbase
Stefan Eßer [Fri, 30 Oct 2020 18:48:09 +0000 (18:48 +0000)]
Add read only sysctl variable user.localbase

The value is provided by the C library as for other sysctl variables in
the user tree. It is compiled in and returns the value of _PATH_LOCALBASE
defined in paths.h.

Reviewed by: imp, scottl
Differential Revision: https://reviews.freebsd.org/D27009

3 years agoarm64: set the correct partition type in make-memstick.sh
Mitchell Horne [Fri, 30 Oct 2020 18:22:46 +0000 (18:22 +0000)]
arm64: set the correct partition type in make-memstick.sh

We create a UFS root filesystem using makefs(8), and later pass it to
mkimg(1) when creating the final image. The correct partition type is
freebsd-ufs; the freebsd parition type is for partitions containing a
BSD disklabel.

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

3 years agoarm64: convert virtual machine images to GPT
Mitchell Horne [Fri, 30 Oct 2020 18:20:52 +0000 (18:20 +0000)]
arm64: convert virtual machine images to GPT

These images were switched to MBR in r281876 as a way to cope with a
hard-coded partition GUID in QEMU's default EFI firmware. Enough time
has passed that this is no longer a problem; QEMU versions >= 4.0
include a copy of edk2 EFI firmware that can detect the root filesystem
properly. Alternatively, sysutils/u-boot-qemu-arm64 can be used.

Switch back to building these images with a GPT partition table, and
re-enable the swap partition.

Reviewed by: gjb, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26986

3 years agovmimage.subr: noisier failure for unsupported targets
Mitchell Horne [Fri, 30 Oct 2020 18:18:25 +0000 (18:18 +0000)]
vmimage.subr: noisier failure for unsupported targets

The return code of write_partition_layout() doesn't bubble up, so an
invocation of make vm-release for an incorrect/unsupported target will
appear to succeed while make vm-install will fail due to missing
files. This isn't a common point of failure, but is worth handling
properly.

Upgrade this case to print a message to stderr, and exit in place. This
is okay to do since at this point in the execution of mk-vmimage.sh,
cleanup() has already been run.

Reviewed by: gjb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26985

3 years agoSlight refactor in vmimage.subr
Mitchell Horne [Fri, 30 Oct 2020 18:16:10 +0000 (18:16 +0000)]
Slight refactor in vmimage.subr

De-duplicate the invocation of mkimg(1). No functional change.

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

3 years agoopencrypto: Annotate hmac_init_(i|o)pad() to make auth_hash const
Mark Johnston [Fri, 30 Oct 2020 17:05:36 +0000 (17:05 +0000)]
opencrypto: Annotate hmac_init_(i|o)pad() to make auth_hash const

This makes them friendlier to drivers that try to use const pointers
whenever possible in their internal structures.

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

3 years agoPrint calendar entries in the order they occur
Stefan Eßer [Fri, 30 Oct 2020 15:43:52 +0000 (15:43 +0000)]
Print calendar entries in the order they occur

The calendar program used to output entries in reverse order, due to the
way an internal linked list was built up.

A regression test with 2 entries for the same day has been adapted to the
now non-reversed order.

MFC after: 3 days

3 years agoRevert debug output committed in r367166 by accident
Stefan Eßer [Fri, 30 Oct 2020 14:34:51 +0000 (14:34 +0000)]
Revert debug output committed in r367166 by accident

MFC after: 3 days

3 years agoFix length calculation in memmove
Stefan Eßer [Fri, 30 Oct 2020 14:32:13 +0000 (14:32 +0000)]
Fix length calculation in memmove

MFC after: 3 days

3 years agotmpfs: change tmpfs dirent zone into a malloc type
Mateusz Guzik [Fri, 30 Oct 2020 14:07:25 +0000 (14:07 +0000)]
tmpfs: change tmpfs dirent zone into a malloc type

It is 64 bytes.

3 years agovfs: change vnode poll to just a malloc type
Mateusz Guzik [Fri, 30 Oct 2020 14:02:56 +0000 (14:02 +0000)]
vfs: change vnode poll to just a malloc type

The size is 120, close fit for 128 and rarely used. The infrequent use
avoidably populates per-CPU caches and ends up with more memory.

3 years agonet: add ETHER_IS_IPV6_MULTICAST
Mitchell Horne [Fri, 30 Oct 2020 13:32:58 +0000 (13:32 +0000)]
net: add ETHER_IS_IPV6_MULTICAST

This can be used to detect if an ethernet address is specifically an
IPv6 multicast address, defined in accordance to RFC 2464.

ETHER_IS_MULTICAST is still preferred in the general case.

Reviewed by: ae
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26611

3 years agocache: add cache_vop_mkdir and rename cache_rename to cache_vop_rename
Mateusz Guzik [Fri, 30 Oct 2020 10:46:35 +0000 (10:46 +0000)]
cache: add cache_vop_mkdir and rename cache_rename to cache_vop_rename

3 years agoRe-implement comment parsing missing in the internal pre-processor
Stefan Eßer [Fri, 30 Oct 2020 10:44:46 +0000 (10:44 +0000)]
Re-implement comment parsing missing in the internal pre-processor

The internal pre-processor ignored lines that did not parse a calendar
entries, but did not support multi-line comments in the way the external
cpp did.

The calendar files distributed with the base system (now in a port) do
use comments, though.

Implement comment processing for single-line (//) and multi-line comments
(/* */) with same semantics as in a standard C pre-processor.

All tests pass with this version, but there are no tests that specifically
verify comment processing.

Reported by: jhs@berklix.com (Julian H. Stacey)
MFC after: 3 days

3 years agofetch(1): Fix style
Fernando Apesteguía [Fri, 30 Oct 2020 09:48:41 +0000 (09:48 +0000)]
fetch(1): Fix style

Fix style problems introduced in r367141:

* s/Ql/Pa/ for file names
* Break line properly in macro
* Properly generate back slash character

Not bumping .Dd

Reported by: xtouqh@icloud.com, steffen@sdaoden.eu
Approved by: 0mp@
Differential Revision: https://reviews.freebsd.org/D26946

3 years agobeinstall.sh: Use bectl instead of beadm by default
Mateusz Piotrowski [Fri, 30 Oct 2020 09:40:55 +0000 (09:40 +0000)]
beinstall.sh: Use bectl instead of beadm by default

This patch also introduces an environment variable BE_UTILITY,
which can be used to specify the utility to use for managing
ZFS boot environments (which can be either bectl or beadm).

While here, fix some typos in the manual page and
remove beadm from section "SEE ALSO".

Reviewed by: bcr, kevans, rpokala
Approved by: will
Differential Revision: https://reviews.freebsd.org/D21111

3 years agoFix a couple of silly bugs in r367149.
John Baldwin [Fri, 30 Oct 2020 00:06:36 +0000 (00:06 +0000)]
Fix a couple of silly bugs in r367149.

- Assign the TLS rate limit value to the correct member of the
  rl_params for the nested rate limit tag.

- Remove a dead condition.

Pointy hat to: jhb

3 years agobhyve currently reports each of "smbios.system.maker" and
Olivier Cochard [Fri, 30 Oct 2020 00:03:59 +0000 (00:03 +0000)]
bhyve currently reports each of "smbios.system.maker" and
"smbios.system.family" as " ".
This presents challenges for both humans and tools when trying to parse output
that uses those results.
The new values reported are now:
smbios.system.family="Virtual Machine"
smbios.system.maker="FreeBSD"

PR: 250728
Approved by: grehan@FreeBSD.org
Sponsored by: Netflix

3 years agoAdd m_snd_tag_alloc() as a wrapper around if_snd_tag_alloc().
John Baldwin [Thu, 29 Oct 2020 23:28:39 +0000 (23:28 +0000)]
Add m_snd_tag_alloc() as a wrapper around if_snd_tag_alloc().

This gives a more uniform API for send tag life cycle management.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27000

3 years agoConvert flags from int to bool. Some (compress) were already used in
Gleb Smirnoff [Thu, 29 Oct 2020 23:15:11 +0000 (23:15 +0000)]
Convert flags from int to bool.  Some (compress) were already used in
comparisons with bool values.  No functional changes.

3 years agoUse public interfaces to manage the nested rate limit send tag.
John Baldwin [Thu, 29 Oct 2020 22:22:27 +0000 (22:22 +0000)]
Use public interfaces to manage the nested rate limit send tag.

Each TLS send tag in mlx5 contains a nested rate limit send tag.
Previously, the driver was calling internal functions to manage the
nested tag.  Calling free methods directly instead of m_snd_tag_rele()
leaked send tag references and references on the ifp.  Changes to use
the ifp methods for the nested tag for other methods are more cosmetic
but do simplify the code.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26996

3 years agoCall m_snd_tag_rele() to free send tags.
John Baldwin [Thu, 29 Oct 2020 22:18:56 +0000 (22:18 +0000)]
Call m_snd_tag_rele() to free send tags.

Send tags are refcounted and if_snd_tag_free() is called by
m_snd_tag_rele() when the last reference is dropped on a send tag.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26995

3 years agoRemove an extra if_ref().
John Baldwin [Thu, 29 Oct 2020 22:16:59 +0000 (22:16 +0000)]
Remove an extra if_ref().

In r348254, if_snd_tag_alloc() routines were changed to bump the ifp
refcount via m_snd_tag_init().  This function wasn't in the tree at
the time and wasn't updated for the new semantics, so was still doing
a separate bump after if_snd_tag_alloc() returned.

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26999

3 years agoStore the new send tag in the right place.
John Baldwin [Thu, 29 Oct 2020 22:14:34 +0000 (22:14 +0000)]
Store the new send tag in the right place.

r350501 added the 'st' parameter, but did not pass it down to
if_snd_tag_alloc().

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26997

3 years agovfs: add NAMEI_DBG_HADSTARTDIR handling lost in rewrite
Mateusz Guzik [Thu, 29 Oct 2020 18:43:37 +0000 (18:43 +0000)]
vfs: add NAMEI_DBG_HADSTARTDIR handling lost in rewrite

Noted by: rpokala

3 years agofold(1): Add EXAMPLES section
Fernando Apesteguía [Thu, 29 Oct 2020 18:39:04 +0000 (18:39 +0000)]
fold(1): Add EXAMPLES section

A couple of examples covering -s and -w flags.

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26948

3 years agofmt(1): Add EXAMPLES section
Fernando Apesteguía [Thu, 29 Oct 2020 18:37:20 +0000 (18:37 +0000)]
fmt(1): Add EXAMPLES section

Very small EXAMPLES section.

While here, remove reference to nroff(1).

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26947

3 years agofetch(1): Add EXAMPLES section
Fernando Apesteguía [Thu, 29 Oct 2020 18:34:47 +0000 (18:34 +0000)]
fetch(1): Add EXAMPLES section

Add a few examples covering flags: 1, R, a, o, q, r, s, v

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26946

3 years agoMake linprocfs(4) print a warning when there's not enough room to fill
Edward Tomasz Napierala [Thu, 29 Oct 2020 15:44:44 +0000 (15:44 +0000)]
Make linprocfs(4) print a warning when there's not enough room to fill
/proc/self/maps.

Submitted by: dchagin (earlier version)
Reviewed by: emaste (earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20576

3 years agoOptimize set_syscall_retval for riscv by predicting the return
Edward Tomasz Napierala [Thu, 29 Oct 2020 15:36:20 +0000 (15:36 +0000)]
Optimize set_syscall_retval for riscv by predicting the return
value to be zero.

Reviewed by: mhorne, kp
MFC after: 2 weeks
Sponsored by: EPSRC
Differential Revision: https://reviews.freebsd.org/D26990

3 years agoMake it possible to mount nullfs(5) using plain mount(8)
Edward Tomasz Napierala [Thu, 29 Oct 2020 15:28:15 +0000 (15:28 +0000)]
Make it possible to mount nullfs(5) using plain mount(8)
instead of mount_nullfs(8).

Obviously you'd need to force mount(8) to not call
mount_nullfs(8) to make use of it.

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

3 years agoWhitespace cleanup
Li-Wen Hsu [Thu, 29 Oct 2020 14:44:09 +0000 (14:44 +0000)]
Whitespace cleanup

MFC after: 3 days

3 years agoFix typo.
Edward Tomasz Napierala [Thu, 29 Oct 2020 14:42:51 +0000 (14:42 +0000)]
Fix typo.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoRemove superfluous `this` in comment
Li-Wen Hsu [Thu, 29 Oct 2020 14:42:02 +0000 (14:42 +0000)]
Remove superfluous `this` in comment

PR: 250721
Submitted by: Hiroya EBINE <hebiyan@protonmail.com>
MFC after: 3 days

3 years agoAdd defines for Linux errno values and use them to make linux_errtbl[]
Edward Tomasz Napierala [Thu, 29 Oct 2020 14:23:52 +0000 (14:23 +0000)]
Add defines for Linux errno values and use them to make linux_errtbl[]
more readable.  While here, add linux_check_errtbl() function to make
sure we don't leave holes.

No objections: emaste (earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26972

3 years agoUpdate the due date of the quarterly status report
Li-Wen Hsu [Thu, 29 Oct 2020 14:21:25 +0000 (14:21 +0000)]
Update the due date of the quarterly status report

While here, move the date to keep 2 weeks ahead notificaion
and fix the part of speech.

Reviewed by: debdrup
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26998

3 years agovfs: add NDREINIT to facilitate repeated namei calls
Mateusz Guzik [Thu, 29 Oct 2020 12:56:02 +0000 (12:56 +0000)]
vfs: add NDREINIT to facilitate repeated namei calls

struct nameidata mixes caller arguments, internal state and output, which
can be quite error prone.

Recent addition of valdiating ni_resflags uncovered a caller which could
repeatedly call namei, effectively operating on partially populated state.

Add bare minimium validation this does not happen. The real fix would
decouple aforementioned state.

Reported by: pho
Tested by: pho (different variant)

3 years agoSimplify test for closing delimiter of #include argument (no functional
Stefan Eßer [Thu, 29 Oct 2020 08:31:47 +0000 (08:31 +0000)]
Simplify test for closing delimiter of #include argument (no functional
change).

While here: Fix invalid parameters of a commented-out debug printf() found
when testing with this code enabled.

MFC after: 3 days

3 years agoFix calendar -a processing of files included in the user's home directory
Stefan Eßer [Thu, 29 Oct 2020 08:26:38 +0000 (08:26 +0000)]
Fix calendar -a processing of files included in the user's home directory

The existing code performed a chdir() into the home directory, but the
parser fell back to using the invoking user's home directory as the base
directory for the search for an include file.

Since use of the -a option is limited to UID==0, the directory searched
was typically ~root/.calendar, not the .calendar directory of the user
whose file is being processed.

PR: 205580
Reported by: greg.bal4@gmail.com (Greg Balfour)
MFC after: 3 days

3 years agoCI: switch to qemu42 package
Ed Maste [Thu, 29 Oct 2020 02:02:30 +0000 (02:02 +0000)]
CI: switch to qemu42 package

It appears that booting FreeBSD from qemu's synthesized FAT filesystem
broke somehow in a recent qemu-devel update.  qemu42 works so switch to
it for now.

3 years agoSupport hardware rate limiting (pacing) with TLS offload.
John Baldwin [Thu, 29 Oct 2020 00:23:16 +0000 (00:23 +0000)]
Support hardware rate limiting (pacing) with TLS offload.

- Add a new send tag type for a send tag that supports both rate
  limiting (packet pacing) and TLS offload (mostly similar to D22669
  but adds a separate structure when allocating the new tag type).

- When allocating a send tag for TLS offload, check to see if the
  connection already has a pacing rate.  If so, allocate a tag that
  supports both rate limiting and TLS offload rather than a plain TLS
  offload tag.

- When setting an initial rate on an existing ifnet KTLS connection,
  set the rate in the TCP control block inp and then reset the TLS
  send tag (via ktls_output_eagain) to reallocate a TLS + ratelimit
  send tag.  This allocates the TLS send tag asynchronously from a
  task queue, so the TLS rate limit tag alloc is always sleepable.

- When modifying a rate on a connection using KTLS, look for a TLS
  send tag.  If the send tag is only a plain TLS send tag, assume we
  failed to allocate a TLS ratelimit tag (either during the
  TCP_TXTLS_ENABLE socket option, or during the send tag reset
  triggered by ktls_output_eagain) and ignore the new rate.  If the
  send tag is a ratelimit TLS send tag, change the rate on the TLS tag
  and leave the inp tag alone.

- Lock the inp lock when setting sb_tls_info for a socket send buffer
  so that the routines in tcp_ratelimit can safely dereference the
  pointer without needing to grab the socket buffer lock.

- Add an IFCAP_TXTLS_RTLMT capability flag and associated
  administrative controls in ifconfig(8).  TLS rate limit tags are
  only allocated if this capability is enabled.  Note that TLS offload
  (whether unlimited or rate limited) always requires IFCAP_TXTLS[46].

Reviewed by: gallatin, hselasky
Relnotes: yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26691

3 years agoSave the current TCP pacing rate in t_pacing_rate.
John Baldwin [Thu, 29 Oct 2020 00:03:19 +0000 (00:03 +0000)]
Save the current TCP pacing rate in t_pacing_rate.

Reviewed by: gallatin, gnn
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26875

3 years agoDisable ssp raw test without ASAN
Brooks Davis [Wed, 28 Oct 2020 23:10:54 +0000 (23:10 +0000)]
Disable ssp raw test without ASAN

r366981 disabled ASAN when it might not be reliable (with an external
compiler), but this test is broken without ASAN so disable it completely
in that case.

PR: 250706
Reviewed by: emaste, lwhsu
Differential Revision: https://reviews.freebsd.org/D26982

3 years agoCheck for process group change in tty_wait_background().
Konstantin Belousov [Wed, 28 Oct 2020 22:12:47 +0000 (22:12 +0000)]
Check for process group change in tty_wait_background().

The calling process's process group can change between PROC_UNLOCK(p)
and PGRP_LOCK(pg) in tty_wait_background(), e.g. by a setpgid() call
from another process. If that happens, the signal is not sent to the
calling process, even if the prior checks determine that one should be
sent.  Re-check that the process group hasn't changed after acquiring
the pgrp lock, and if it has, redo the checks.

PR: 250701
Submitted by: Jakub Piecuch <j.piecuch96@gmail.com>
MFC after: 2 weeks

3 years agoloader: add aarch64 support for zstd
Warner Losh [Wed, 28 Oct 2020 21:18:04 +0000 (21:18 +0000)]
loader: add aarch64 support for zstd

We don't have NEON available in the boot loader, so we have to disable
it. OpenZFS included ZSTD which used the wrong symbol to bring in neon
support. Change to use the code that's been submitted upstream as a
pull request to both.

__ARM_NEON is the proper symbol, defined in ARM C Language Extensions
Release 2.1 (https://developer.arm.com/documentation/ihi0053/d/). Some
sources suggest __ARM_NEON__, but that's the obsolete spelling from
prior versions of the standard.

OpenZFS Pull Request: https://github.com/openzfs/zfs/pull/11055
ZSTD Pull Request: https://github.com/facebook/zstd/pull/2356

3 years agoNote that sys/systm.h is special too
Warner Losh [Wed, 28 Oct 2020 21:09:56 +0000 (21:09 +0000)]
Note that sys/systm.h is special too

If you need / want to includerd sys/systm.h, it has to be just after
param.h/types.h. Document this existing practice. Not all kernel files
include systm.h, but when you do, it should be done out of order.

Reviewed by: vangyzen, kib, emaste
Differential Review: https://reviews.freebsd.org/D26981

3 years agoiflib: fix typo bug introduced by r367093
Vincenzo Maffione [Wed, 28 Oct 2020 21:06:17 +0000 (21:06 +0000)]
iflib: fix typo bug introduced by r367093

Code was supposed to call callout_reset_sbt_on() rather than
callout_reset_sbt(). This resulted into passing a "cpu" value
to a "flag" argument. A recipe for subtle errors.

PR: 248652
Reported by: sg@efficientip.com
MFC with: r367093

3 years agoFix use-after-free in icmp6_notify_error().
Alexander V. Chernikov [Wed, 28 Oct 2020 20:22:20 +0000 (20:22 +0000)]
Fix use-after-free in icmp6_notify_error().

Reported by: Maxime Villard <max at m00nbsd.net>
Reviewed by: markj
MFC after: 3 days

3 years agoFix unintentional constant rename in r367109.
Alexander Motin [Wed, 28 Oct 2020 18:22:25 +0000 (18:22 +0000)]
Fix unintentional constant rename in r367109.

MFC after: 1 week

3 years agoUse proper variable for device path.
Alexander Motin [Wed, 28 Oct 2020 17:28:48 +0000 (17:28 +0000)]
Use proper variable for device path.

It seems *-passthru commands were broken from the day one, since the
device path is fetched into opt.dev variable and not left in argv[optind].
The other three wrong argv[optind] instances are just in error messages.

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

3 years agoUpdate the list of searched manual sections after r367013
Mateusz Piotrowski [Wed, 28 Oct 2020 16:54:37 +0000 (16:54 +0000)]
Update the list of searched manual sections after r367013

3 years agoPrint NVMe controller capabilities in verbose dmesg.
Alexander Motin [Wed, 28 Oct 2020 15:43:29 +0000 (15:43 +0000)]
Print NVMe controller capabilities in verbose dmesg.

Those values are not reported in controller identification, while sometimes
interesting for development and debugging.

MFC after: 1 week

3 years agoAdd support for nested conditionals
Stefan Eßer [Wed, 28 Oct 2020 14:48:58 +0000 (14:48 +0000)]
Add support for nested conditionals

The previous behavior was to support nested #ifdef and #ifndef, but to
return to unconditional parsing after the next #endif, independently of
the number of previously parsed conditions.

E.g. after "#ifdef A / #ifdef B / #endif" the following lines were
unconditially parsed again, independently of A and/or B being defined.

The new behavior is to count the level of false conditions and to only
restart parsing of calendar entries when the corresponding number of
#endif tokens have been seen.

In addition to the above, an #else directive has been added, to toggle
between parsing and ignoring of the following lines.

No validation of the correct use of the condition directives is made.
#endif without prior #define or #ifndef is ignored and #else toggles
between parsing and skipping of entries.

The MFC period has been set to 1 month to allow for a review of the
changes and for a discussion, whether these modifications should not
be merged at all.

No correct input file is parsed differently than before, but if calendar
data files are published that use these new features, those data files
will not parse correctly on prior versions of this program.

MFC after: 1 month

3 years agoAdd local variable to store the sysent pointer. Just a cleanup,
Edward Tomasz Napierala [Wed, 28 Oct 2020 14:43:38 +0000 (14:43 +0000)]
Add local variable to store the sysent pointer.  Just a cleanup,
no functional changes.

Reviewed by: kib (earlier version)
MFC after: 2 weeks
Sponsored by: EPSRC
Differential Revision: https://reviews.freebsd.org/D26977

3 years agoMake linux_errtbl a bit more readable by using named initializers.
Edward Tomasz Napierala [Wed, 28 Oct 2020 14:16:08 +0000 (14:16 +0000)]
Make linux_errtbl a bit more readable by using named initializers.

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

3 years agoDrop "All rights reserved" from all my stuff. This includes
Edward Tomasz Napierala [Wed, 28 Oct 2020 13:46:11 +0000 (13:46 +0000)]
Drop "All rights reserved" from all my stuff.  This includes
Foundation copyrights, approved by emaste@.  It does not include
files which carry other people's copyrights; if you're one
of those people, feel free to make similar change.

Reviewed by: emaste, imp, gbe (manpages)
Differential Revision: https://reviews.freebsd.org/D26980

3 years agoFix off-by-one error in processing of #ifdef lines
Stefan Eßer [Wed, 28 Oct 2020 13:30:24 +0000 (13:30 +0000)]
Fix off-by-one error in processing of #ifdef lines

The convention in this program is to parse the line immediately starting
after the token (e.g. #defineA and #ifdefA define respectively look-up "A"),
and this commit restores this behavior instead of skipping an assumed
white-space character following #ifdef.

Reported by: kevans
MFC after: 3 days

3 years agoFix parsing of #ifdef in calendar files
Stefan Eßer [Wed, 28 Oct 2020 13:06:39 +0000 (13:06 +0000)]
Fix parsing of #ifdef in calendar files

There was code to process an #ifndef tokens, but none for #ifdef.
The #ifdef token was mentioned as unsupported in the BUGS section,
but no reason was given and I do not see why it should stay omitted.

Misleading information in The BUGS section of the man-page regarding
the maximum number of #define and #include statements supported has
been removed. These limits might have applied to a prior version of
this program, but do not seem to apply to the current implementation.

I have not tried to test for the existence of the limits, but the
include file processing just recursively calls the parser (without
counting the recursion depth) and the stringlist functions do not
impose a limit on the number of entries.

Reported by: jhs@berklix.com
MFC after: 3 days

3 years agoSpeed up Cirrus CI by using CROSS_TOOLCHAIN
Alex Richardson [Wed, 28 Oct 2020 11:54:09 +0000 (11:54 +0000)]
Speed up Cirrus CI by using CROSS_TOOLCHAIN

Installing the llvm11 package instead of bootstrapping it from the source
tree reduces the build time by about 20 minutes.

The last freebsd/freebsd build that was tested (r366629) took 1h 21m 22s,
whereas my GitHub fork with this .cirrus.yml took 58m 6s.
We could probably further reduce time by using images that have LLVM
pre-installed: the pkg install step took 4 minutes 30s.

Since the bootstrap toolchain is still tested by Jenkins, this should not
reduce test coverage of the CI testing.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D26747

3 years agoSignificantly reduce compile time for googletest internal tests
Alex Richardson [Wed, 28 Oct 2020 11:54:04 +0000 (11:54 +0000)]
Significantly reduce compile time for googletest internal tests

Clang's optimizer spends a really long time on these tests at -O2, so we now
use -O0 instead. This reduces the -j32 time for lib/googletest/test from 131s
to 29s. Using -O0 also reduces the disk usage from 144MB (at -O2) / 92MB (at
-O1) to 82MB.

Reviewed By: ngie, dim
Differential Revision: https://reviews.freebsd.org/D26751

3 years agoclang-format: Avoid breaking after the opening paren of function definitions
Alex Richardson [Wed, 28 Oct 2020 11:54:00 +0000 (11:54 +0000)]
clang-format: Avoid breaking after the opening paren of function definitions

This depends on https://reviews.llvm.org/D90246 to have any effect, but once
that has landed clang-format will no longer format code like this:

```
int
myfunction(
    int param1, int param2, int param2)
{
   ...
}
```

and instead create the following:

```
int
myfunction(int param1, int param2,
    int param2)
{
   ...
}
```

Reviewed By: emaste, cem
Differential Revision: https://reviews.freebsd.org/D26978

3 years agoclang-format: place sys/systm.h immediately after sys/param.h
Alex Richardson [Wed, 28 Oct 2020 11:53:55 +0000 (11:53 +0000)]
clang-format: place sys/systm.h immediately after sys/param.h

Should fix one of the objections to r366993.
See also https://reviews.freebsd.org/D26981.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D26979

3 years agoCorrect USB HID item in examples
Mateusz Piotrowski [Wed, 28 Oct 2020 08:29:31 +0000 (08:29 +0000)]
Correct USB HID item in examples

It turns out that examples were incorrectly referring to Volume_Up
and Volume_Down, which are not defined at all.

PR: 250683
Reported by: corvid%openmailbox.org
MFC after: 2 weeks

3 years agoAdd new USB IDs.
Hans Petter Selasky [Wed, 28 Oct 2020 08:22:38 +0000 (08:22 +0000)]
Add new USB IDs.

Submitted by: aleksi.kaalinpaa@kapsi.fi
PR: 250675
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd FreeBSD 12.2
Li-Wen Hsu [Wed, 28 Oct 2020 02:30:44 +0000 (02:30 +0000)]
Add FreeBSD 12.2

3 years agoMFV r367082:
Cy Schubert [Tue, 27 Oct 2020 23:03:15 +0000 (23:03 +0000)]
MFV r367082:

Update unbound 1.11.0 --> 1.12.0.

MFC after: 1 month.

3 years agoiflib: add per-tx-queue netmap timer
Vincenzo Maffione [Tue, 27 Oct 2020 21:53:33 +0000 (21:53 +0000)]
iflib: add per-tx-queue netmap timer

The way netmap TX is handled in iflib when TX interrupts are not
used (IFC_NETMAP_TX_IRQ not set) has some issues:
  - The netmap_tx_irq() function gets called by iflib_timer(), which
    gets scheduled with tick granularity (hz). This is not frequent
    enough for 10Gbps NICs and beyond (e.g., ixgbe or ixl). The end
    result is that the transmitting netmap application is not woken
    up fast enough to saturate the link with small packets.
  - The iflib_timer() functions also calls isc_txd_credits_update()
    to ask for more TX completion updates. However, this violates
    the netmap requirement that only txsync can access the TX queue
    for datapath operations. Only netmap_tx_irq() may be called out
    of the txsync context.

This change introduces per-tx-queue netmap timers, using microsecond
granularity to ensure that netmap_tx_irq() can be called often enough
to allow for maximum packet rate. The timer routine simply calls
netmap_tx_irq() to wake up the netmap application. The latter will
wake up and call txsync to collect TX completion updates.

This change brings back line rate speed with small packets for ixgbe.
For the time being, timer expiration is hardcoded to 90 microseconds,
in order to avoid introducing a new sysctl.
We may eventually implement an adaptive expiration period or use another
deferred work mechanism in place of timers.

Also, fix the timers usage to make sure that each queue is serviced
by a different CPU.

PR: 248652
Reported by: sg@efficientip.com
MFC after: 2 weeks

3 years agoUse my FreeBSD.org mail address in man pages I have written
Gordon Bergling [Tue, 27 Oct 2020 18:30:43 +0000 (18:30 +0000)]
Use my FreeBSD.org mail address in man pages I have written

MFC after: 3 days

3 years agovfs: tidy up vnlru_free
Mateusz Guzik [Tue, 27 Oct 2020 18:13:09 +0000 (18:13 +0000)]
vfs: tidy up vnlru_free

Apart from cosmeatic changes make sure to only decrease the recycled counter
if vtryrecycle succeeded.

Tested by: pho

3 years agovfs: fix vnode reclaim races against getnwevnode
Mateusz Guzik [Tue, 27 Oct 2020 18:12:07 +0000 (18:12 +0000)]
vfs: fix vnode reclaim races against getnwevnode

All vnodes allocated by UMA are present on the global list used by
vnlru. getnewvnode modifies the state of the vnode (most notably
altering v_holdcnt) but never locks it. Moreover filesystems also
modify it in arbitrary manners sometimes before taking the vnode
lock or adding any other indicator that the vnode can be used.

Picking up such a vnode by vnlru would be problematic.

To that end there are 2 fixes:
- vlrureclaim, not recycling v_holdcnt == 0 vnodes, takes the
interlock and verifies that v_mount has been set. It is an
invariant that the vnode lock is held by that point, providing
the necessary serialisation against locking after vhold.
- vnlru_free_locked, only wanting to free v_holdcnt == 0 vnodes,
now makes sure to only transition the count 0->1 and newly allocated
vnodes start with v_holdcnt == VHOLD_NO_SMR. getnewvnode will only
transition VHOLD_NO_SMR->1 once more making the hold fail

Tested by: pho

3 years agorefcount: make it atomic-clean
Mateusz Guzik [Tue, 27 Oct 2020 18:11:11 +0000 (18:11 +0000)]
refcount: make it atomic-clean

While here consistently use 'old' in all places.

Tested by: pho

3 years agoRevise the description of MAP_STACK. In particular, describe the guard
Alan Cox [Tue, 27 Oct 2020 18:08:33 +0000 (18:08 +0000)]
Revise the description of MAP_STACK.  In particular, describe the guard
in more detail.

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

3 years agoo Add the domain member to the struct bus_dma_tag_common as required by
Ruslan Bukin [Tue, 27 Oct 2020 15:29:53 +0000 (15:29 +0000)]
o Add the domain member to the struct bus_dma_tag_common as required by
  busdma_iommu.c.
o Add tag_set_domain() pointer to the struct bus_dma_impl as well.

Sponsored by: Innovate DSbD

3 years agoTake the ITS device lock around gicv3_its_release_irqsrc() since that
Ruslan Bukin [Tue, 27 Oct 2020 15:18:10 +0000 (15:18 +0000)]
Take the ITS device lock around gicv3_its_release_irqsrc() since that
function checks that the mutex lock is owned.

This fixes 'devctl disable re0' operation.

Sponsored by: Innovate DSbD
Differential Revision: https://reviews.freebsd.org/D26904

3 years agoVendor import of Unbound 1.12.0.
Cy Schubert [Tue, 27 Oct 2020 15:09:16 +0000 (15:09 +0000)]
Vendor import of Unbound 1.12.0.

3 years agoarm64: Remove a racy KASSERT from pmap_remove_pages()
Mark Johnston [Tue, 27 Oct 2020 13:27:47 +0000 (13:27 +0000)]
arm64: Remove a racy KASSERT from pmap_remove_pages()

PCPU_GET(curpmap) expands to multiple instructions on arm64, and if the
current thread is migrated in between execution of those instructions, a
stale value may be used in the assertion condition.

Diagnosed by: mmel
Reported by: mmel, Bob Prohaska <fbsd@www.zefox.net>
Submitted by: alc
MFC after: 1 week

3 years agoFix misnomer - linux_to_bsd_errno() does the exact opposite.
Edward Tomasz Napierala [Tue, 27 Oct 2020 12:49:40 +0000 (12:49 +0000)]
Fix misnomer - linux_to_bsd_errno() does the exact opposite.

Reported by: arichardson
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26965

3 years agoriscv: Minor cleanup in startup code
Kristof Provost [Tue, 27 Oct 2020 12:44:49 +0000 (12:44 +0000)]
riscv: Minor cleanup in startup code

 - remove setting of register value which is not used until the next value is
   set
 - Use the L2_SHIFT constant when setting up L2 superpages

Submitted by: Antonin Houska <ah AT melesmeles DOT cz>

3 years agorenice(8): Clarify "who" parameters.
Fernando Apesteguía [Tue, 27 Oct 2020 12:32:17 +0000 (12:32 +0000)]
renice(8): Clarify "who" parameters.

There was a question raised in freebsd-questions@ mail list[1] about the
"who" parameters in this man page. It seems OpenBSD[2] amd NetBSD[3]
both have more legible descriptions so I borrowed some of their ideas to try
and make this page clearer.

[1] https://lists.freebsd.org/pipermail/freebsd-questions/2020-October/291914.html
[2] https://man.bsd.lv/renice
[3] https://man.netbsd.org/renice.8

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26950

3 years agodiff: don't force the format to 'context' with -p immediately
Kyle Evans [Tue, 27 Oct 2020 12:27:26 +0000 (12:27 +0000)]
diff: don't force the format to 'context' with -p immediately

Instead, leave the fomat as unspecified (if it hasn't been) and use the
-p flag as a hint to 'context' if no other formatting option is specified.

This fixes `diff -purw`, used frequently by emaste, and matches the behavior
of its GNU counterpart.

PR: 250015
Reviewed by: emaste
MFC after: 1 week

3 years agoReplace literal uses of /usr/local in C sources with _PATH_LOCALBASE
Stefan Eßer [Tue, 27 Oct 2020 11:29:11 +0000 (11:29 +0000)]
Replace literal uses of /usr/local in C sources with _PATH_LOCALBASE

Literal references to /usr/local exist in a large number of files in
the FreeBSD base system. Many are in contributed software, in configuration
files, or in the documentation, but 19 uses have been identified in C
source files or headers outside the contrib and sys/contrib directories.

This commit makes it possible to set _PATH_LOCALBASE in paths.h to use
a different prefix for locally installed software.

In order to avoid changes to openssh source files, LOCALBASE is passed to
the build via Makefiles under src/secure. While _PATH_LOCALBASE could have
been used here, there is precedent in the construction of the path used to
a xauth program which depends on the LOCALBASE value passed on the compiler
command line to select a non-default directory.

This could be changed in a later commit to make the openssh build
consistently use _PATH_LOCALBASE. It is considered out-of-scope for this
commit.

Reviewed by: imp
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D26942

3 years agoDo not recommend to install kyua with pkg in the tests README
Mateusz Piotrowski [Tue, 27 Oct 2020 09:53:49 +0000 (09:53 +0000)]
Do not recommend to install kyua with pkg in the tests README

Kyua is now available in the base system.

While here, reword the usage section a bit.

3 years agoClean up backlight.8
Mateusz Piotrowski [Tue, 27 Oct 2020 09:41:01 +0000 (09:41 +0000)]
Clean up backlight.8

- Sort flags
- Stylize incr|+ and decr|- properly
- Add a missing period at the end of the description
- Use the standard layout for the EXAMPLES section (remove the list macro
  and add indentation to the code block)

3 years agoMount devfs inside a beinstall(8) chroot
Mateusz Piotrowski [Tue, 27 Oct 2020 09:32:06 +0000 (09:32 +0000)]
Mount devfs inside a beinstall(8) chroot

It turns out that without /dev/null beinstall is not able to complete and
instead exits with messages similar to these:

  --------------------------------------------------------------
  >>> Installing kernel GENERIC completed on Sun Oct 25 17:47:37 CET 2020
  --------------------------------------------------------------
  /tmp/beinstall.JleGoP/mnt: Inspecting dirs /usr/src /usr/obj/usr/src/amd64.amd64
  --- installworld ---
  make[1]: "/usr/obj/usr/src/amd64.amd64/toolchain-metadata.mk" line 1: Using cached toolchain metadata from build at t480 on Sun Oct 25 15:53:28 CET 2020
  make[2]: "/dev/null" line 2: Need an operator
  make[2]: Fatal errors encountered -- cannot continuemake[1]: "/usr/src/Makefile.inc1" line 593: CPUTYPE global should be set with ?=.
  Cleaning up ...
  umount -f /tmp/beinstall.JleGoP/mnt/usr/src /tmp/beinstall.JleGoP/mnt/usr/obj/usr/src/amd64.amd64 /tmp/beinstall.JleGoP/mnt
  Destroyed successfully
  error: Installworld failed!

Upon a bit of debugging, it turns out that /dev/null inside the chroot
environment is full random bytes, which cause "make -f /dev/null" to
misbehave. Mounting a proper devfs inside the chroot seems to be the most
appropriate way to fix it.

will@ also noted that this change requires that whatever is needed in devfs
must exist in the old kernel.

Approved by: will
MFC after: 2 week
Differential Revision: https://reviews.freebsd.org/D26944

3 years agoRemove frontstuff
Warner Losh [Tue, 27 Oct 2020 06:43:24 +0000 (06:43 +0000)]
Remove frontstuff

Nothing implements this in the tree. Remove the ioctl and the
conversion to the geom atttribute stuff.

This was introduced in r94287 in 2002 and was retired in r113390
2003. It appeared in FreeBSD 5.0, but no other releases. This is a
vestige that was missed at the time and overlooked until now. No
compat is provided for this reason.  And there's no implementation of
it today. And it was never part of a release from a stable branch.

Reviewed by: phk@
Differential Revision: https://reviews.freebsd.org/D26967

3 years agoRemove a random equal sign from the example. It should not be there.
Cy Schubert [Tue, 27 Oct 2020 04:35:47 +0000 (04:35 +0000)]
Remove a random equal sign from the example. It should not be there.
It's a syntax error.

PR: 210303
Reported by: leventelist at gmail.com
MFC after: 3 days

3 years agoContinued ipfilter #ifdef cleanup. The r343701 log entry contains a
Cy Schubert [Tue, 27 Oct 2020 04:35:36 +0000 (04:35 +0000)]
Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after: 3 days

3 years agoriscv: make use of SBI legacy replacement extensions
Mitchell Horne [Mon, 26 Oct 2020 19:13:22 +0000 (19:13 +0000)]
riscv: make use of SBI legacy replacement extensions

Version 0.2 of the SBI specification [1] marked the existing SBI
functions as "legacy" in order to move to a newer calling convention. It
also introduced a set of replacement extensions for some of the legacy
functionality. In particular, the TIME, IPI, and RFENCE extensions
implement and extend the semantics of their legacy counterparts, while
conforming to the newer version of the spec.

Update our SBI code to use the new replacement extensions when
available, and fall back to the legacy ones. These will eventually be
dropped, when support for version 0.2 is ubiquitous.

[1] https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc

Submitted by: Danjel Q. <danq1222@gmail.com>
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D26953

3 years agoriscv: remove sbi_clear_ipi()
Mitchell Horne [Mon, 26 Oct 2020 19:06:30 +0000 (19:06 +0000)]
riscv: remove sbi_clear_ipi()

S-mode software has write access to the SIP.SSIP bit, so instead of
making a second round-trip through the SBI we can clear it ourselves.
The SBI spec has deprecated this function for this exactly this reason.

Submitted by: Danjel Q. <danq1222@gmail.com
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D26952

3 years agolinux: silence renameat2 flags warning
Mateusz Guzik [Mon, 26 Oct 2020 18:03:50 +0000 (18:03 +0000)]
linux: silence renameat2 flags warning

Hogs the console while building the Linux kernel in a Ubuntu Focal jail.

3 years agolinux: add missing conversions for compat.linux.use_emul_path handling
Mateusz Guzik [Mon, 26 Oct 2020 18:02:52 +0000 (18:02 +0000)]
linux: add missing conversions for compat.linux.use_emul_path handling

3 years agocache: add missing NIRES_ABS handling
Mateusz Guzik [Mon, 26 Oct 2020 18:01:18 +0000 (18:01 +0000)]
cache: add missing NIRES_ABS handling

3 years agoKey decleration of union semun on src version
Brooks Davis [Mon, 26 Oct 2020 17:52:28 +0000 (17:52 +0000)]
Key decleration of union semun on src version

__FreeBSD__ is defined by the compiler derived from the triple. When
building FreeBSD 11 on a FreeBSD 12 with a CROSS_TOOLCHAIN=llvm10,
__FreeBSD__ was set to 12 when building lib32 (for some reason no triple
is being passed which seems to mean that we're taking default values
from the build system).  This in turn meant we end up with a double
decleration of union semun which is a build error.

Reviewed by: gshapiro, dim
Differential Revision: https://reviews.freebsd.org/D26902

3 years agoaudit: also correctly audit linux_execve()
Kyle Evans [Mon, 26 Oct 2020 17:30:17 +0000 (17:30 +0000)]
audit: also correctly audit linux_execve()

Linux execve() gets audited as AUE_EXECVE as well, we should also interpret
the return from this correctly for the same reasoning as in r367002.

MFC with: r367002

3 years agodb_search_symbol: prevent pollution from bogus symbols
Eric van Gyzen [Mon, 26 Oct 2020 16:42:53 +0000 (16:42 +0000)]
db_search_symbol: prevent pollution from bogus symbols

The kernel will never map the first page, so any symbols in that
range cannot refer to addresses.  Some third-party assembly files
define internal constants which appear in their symbol table.
Avoiding the lookup for those symbols avoids replacing small offsets
with those symbols during disassembly.

Reported by: Anton Rang <rang%acm.org>
Reviewed by: Anton Rang <rang%acm.org>, markj
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26895