]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agocontrib/tzdata: import tzdata 2021a
Philip Paeps [Mon, 25 Jan 2021 00:18:14 +0000 (08:18 +0800)]
contrib/tzdata: import tzdata 2021a

Merge commit '4cd7e1071de16a7392b0e466287f13e9e6f2081a'

Changes: https://github.com/eggert/tz/blob/2021a/NEWS

MFC after:      3 days

3 years agoImport tzdata 2021a
Philip Paeps [Mon, 25 Jan 2021 00:11:06 +0000 (08:11 +0800)]
Import tzdata 2021a

3 years agonfs_write(): do not call ncl_pager_setsize() after clearing TDP2_SBPAGES
Konstantin Belousov [Sat, 23 Jan 2021 21:40:07 +0000 (23:40 +0200)]
nfs_write(): do not call ncl_pager_setsize() after clearing TDP2_SBPAGES

This might unnecessary truncate file undoing extension done by the write.

Reported by: Yasuhiro Kimura <yasu@utahime.org>
Reviewed by: rmacklem
Tested by: rmacklem, Yasuhiro Kimura <yasu@utahime.org>
MFC after: 6 days
Sponsored by: The FreeBSD Foundation

3 years agonetmap: simplify parameter passing
Vincenzo Maffione [Sun, 24 Jan 2021 21:59:02 +0000 (21:59 +0000)]
netmap: simplify parameter passing

Changes imported from the netmap github.

3 years agoiflib: netmap: move per-packet operation out of fragments loop
Vincenzo Maffione [Sun, 24 Jan 2021 21:38:59 +0000 (21:38 +0000)]
iflib: netmap: move per-packet operation out of fragments loop

MFC after: 1 week

3 years agoiflib: netmap: add support for NS_MOREFRAG
Vincenzo Maffione [Sun, 24 Jan 2021 21:12:41 +0000 (21:12 +0000)]
iflib: netmap: add support for NS_MOREFRAG

The NS_MOREFRAG flag can be set in a netmap slot to represent a
multi-fragment packet. Only the last fragment of a packet does
not have the flag set. On TX rings, the flag may be set by the
userspace application. The kernel will look at the flag and use it
to properly set up the NIC TX descriptors.
On RX rings, the kernel may set the flag if the packet received
was split across multiple netmap buffers. The userspace application
should look at the flag to know when the packet is complete.

Submitted by: rajesh1.kumar_amd.com
Reviewed by: vmaffione
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27799

3 years agolualoader: improve loader.conf var processing
Kyle Evans [Sun, 24 Jan 2021 19:25:34 +0000 (13:25 -0600)]
lualoader: improve loader.conf var processing

lualoader was previously not processing \ as escapes; this commit fixes
that and does better error checking on the value as well.

Additionally, loader.conf had some odd restrictions on values that make
little sense. Previously, lines like:

kernel=foo

Would simply be discarded with a malformed line complaint you might not
see unless you disable beastie.

lualoader tries to process these as well as it can and manipulates the
environment, while forthloader did minimal processing and constructed a
`set` command to do the heavy lifting instead. The lua approach was
re-envisioned from building a `set` command so that we can appropriately
reset the environment when, for example, boot environments change.

Lift the previous restrictions to allow unquoted values on the right hand
side of an expression.  Note that an unquoted value is effectively:

[A-Za-z0-9-][A-Za-z0-9-_.]*

This commit also stops trying to weirdly limit what it can handle in a
quoted value. Previously it only allowed spaces, alphanumeric, and
punctuation, which is kind of weird. Change it here to grab as much as it
can between two sets of quotes, then let processEnvVar() do the needful and
complain if it finds something malformed looking.

My extremely sophisticated test suite is as follows:

<<EOF
X_01_simple_string="simple"
X_02_escaped_string="s\imple"

X_03_unquoted_val=3
X_04_unquoted_strval=simple_test

X_05_subval="${X_03_unquoted_val}"
X_06_escaped_subval="\${X_03_unquoted_val}"

X_07_embedded="truth${X_03_unquoted_val}"
X_08_escaped_embedded="truth\${X_03_unquoted_val}"

X_09_unknown="${unknown_val}"
X_10_unknown_embedded="truth${unknown_val}"

X_11_crunchy="crunch$unknown_val crunch"
X_12_crunchy="crunch${unknown_val}crunch"

Y_01_badquote="te"lol"
Y_02_eolesc="lol\"
Y_02_noteolesc="lol\\"
Y_03_eolvar="lol$"
Y_03_noteolvar="lol\$"
Y_04_badvar="lol${"

exec="echo Done!"
EOF

Future work may provide a stub loader module in userland so that we can
formally test the loader scripts rather than sketchy setups like the above
in conjunction with the lua-* tools in ^/tools/boot.

3 years agonetgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support
Neel Chauhan [Sun, 24 Jan 2021 19:23:39 +0000 (20:23 +0100)]
netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support

This extends upon the RFC 6598 support to libalias/ipfw in r357092.

Reviewed By: manpages (bcr), donner, adrian, kp
Approved by: kp (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23461

3 years agoExclude reserved iSCSI Initiator Task Tag.
Alexander Motin [Sun, 24 Jan 2021 19:23:04 +0000 (14:23 -0500)]
Exclude reserved iSCSI Initiator Task Tag.

RFC 7143 (11.2.1.8):
   An ITT value of 0xffffffff is reserved and MUST NOT be assigned for a
   task by the initiator.  The only instance in which it may be seen on
   the wire is in a target-initiated NOP-In PDU (Section 11.19) and in
   the initiator response to that PDU, if necessary.

MFC after: 1 month

3 years agoExclude reserved iSCSI Target Transfer Tag.
Alexander Motin [Sun, 24 Jan 2021 18:58:29 +0000 (13:58 -0500)]
Exclude reserved iSCSI Target Transfer Tag.

RFC 7143 (11.7.4):
   The Target Transfer Tag values are not specified by this protocol,
   except that the value 0xffffffff is reserved and means that the
   Target Transfer Tag is not supplied.

MFC after: 1 month

3 years agoRegen src.conf.5 after LLD description updates
Ed Maste [Sun, 24 Jan 2021 17:25:04 +0000 (12:25 -0500)]
Regen src.conf.5 after LLD description updates

3 years agoRemove Binutils from src.conf(5) option descriptions
Ed Maste [Sun, 24 Jan 2021 17:22:01 +0000 (12:22 -0500)]
Remove Binutils from src.conf(5) option descriptions

All binutils remnants have been removed before FreeBSD 13.

PR: 252842
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agocxgbetool: correct utilties typo
Ed Maste [Sun, 24 Jan 2021 15:21:53 +0000 (10:21 -0500)]
cxgbetool: correct utilties typo

3 years agoAdd a manual page for axp(4) / AMD 10G Ethernet driver
Gordon Bergling [Sun, 24 Jan 2021 13:57:16 +0000 (14:57 +0100)]
Add a manual page for axp(4) / AMD 10G Ethernet driver

Submitted by: Rajesh Kumar <rajesh1 dot kumar at amd dot com>
Reviewed by: bcr, brueffer, rpokala
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27800

3 years agolibc: try to skip memcpy in _gettemp
Mateusz Guzik [Sun, 24 Jan 2021 04:34:22 +0000 (05:34 +0100)]
libc: try to skip memcpy in _gettemp

3 years agolibc: remove open-coded strlen in _gettemp
Mateusz Guzik [Sun, 24 Jan 2021 04:32:46 +0000 (05:32 +0100)]
libc: remove open-coded strlen in _gettemp

3 years agolibc: skip spurious stat in _gettemp
Mateusz Guzik [Sun, 24 Jan 2021 04:15:13 +0000 (05:15 +0100)]
libc: skip spurious stat in _gettemp

It was only done to catch ENOTDIR, but the kernel already returns the
error where appropriate.

3 years agosctp: fix PR-SCTP stats when adding addtional streams
Michael Tuexen [Sat, 23 Jan 2021 23:50:33 +0000 (00:50 +0100)]
sctp: fix PR-SCTP stats when adding addtional streams

MFC after: 1 week

3 years agosctp: improve consistency
Michael Tuexen [Sat, 23 Jan 2021 19:56:45 +0000 (20:56 +0100)]
sctp: improve consistency

No functional change intended.

MFC: 1 week

3 years agoFix cross-build support for Ubuntu 16.04
Jessica Clarke [Sat, 23 Jan 2021 20:59:15 +0000 (20:59 +0000)]
Fix cross-build support for Ubuntu 16.04

Older glibc headers did some very nasty things that have since been
sanitised. We could also fix this by adding a linux/getopt.h wrapper
alongside the existing common/getopt.h that #undef's __need_getopt, but
that seems a little more hacky and complicated.

Reviewed by: arichardson

3 years agohcons: Fix manpage typo
Vladimir Kondratyev [Sat, 23 Jan 2021 19:19:50 +0000 (22:19 +0300)]
hcons: Fix manpage typo

Submitted by: Shunchao Hu <ankohuu_outlook.com>
Reviewed by: wulf, gbe
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D28294

3 years agocache: add back target entry on rename
Mateusz Guzik [Sat, 23 Jan 2021 17:21:42 +0000 (18:21 +0100)]
cache: add back target entry on rename

3 years agonetgraph/ng_source: If queue is full, don't enqueue
Lutz Donnerhacke [Sat, 23 Jan 2021 17:54:47 +0000 (18:54 +0100)]
netgraph/ng_source: If queue is full, don't enqueue

Submitted by: nc
Reviewed by: donner, kp
Approved by: kp (mentor)
Differential Revision: https://reviews.freebsd.org/D23477

3 years agoRevert "Define PNP info after defining driver modules"
Mark Johnston [Sat, 23 Jan 2021 15:55:09 +0000 (10:55 -0500)]
Revert "Define PNP info after defining driver modules"

This reverts commit aa37baf3d7cf51da92fd367476182802e71838ae.

The reverted commit was motivated by a problem observed on stable/12,
but it turns out that a better solution was committed in r348309 but not
MFCed.  So, revert this change since it is unnecessary and not really
correct: it assumes that the order in which module metadata records is
defined determines their order in the output linker set.  While this
seems to hold in my testing, it is not guaranteed.

Reported by: cem
Discussed with: imp
MFC after: 3 days

3 years agoelfctl: Fix type errors.
Konstantin Belousov [Sat, 23 Jan 2021 10:45:51 +0000 (12:45 +0200)]
elfctl: Fix type errors.

Target value for val has uint32_t type, not uint, adjust used constant.
Change val type to unsigned so that left and right sides of comparision
operator do not expose different signed types of same range [*].

Switch to unsigned long long and strtoll(3) so that 0x80000000 is
accepted by conversion function [**].

Reported by: kargl [*]
Noted by: emaste [**]
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28301

3 years agonfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write
Konstantin Belousov [Fri, 22 Jan 2021 21:47:06 +0000 (23:47 +0200)]
nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write

Otherwise writing thread might wait on sbusy state of the pages which were
busied by itself, similarly to nfs_read().  But also we need to clear
NVNSETSZKSIP flag possibly set by ncl_pager_setsize(), to not undo
extension done by write.

Reported by: bdrewery
Reviewed by: rmacklem
Tested by: pho
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28306

3 years agozfs: add support for lockless symlink lookup
Mateusz Guzik [Sat, 23 Jan 2021 13:46:32 +0000 (13:46 +0000)]
zfs: add support for lockless symlink lookup

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

3 years agotmpfs: add support for lockless symlink lookup
Mateusz Guzik [Sat, 23 Jan 2021 13:45:01 +0000 (13:45 +0000)]
tmpfs: add support for lockless symlink lookup

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

3 years agoufs: denote lack of support for lockless symlink lookup
Mateusz Guzik [Sat, 23 Jan 2021 13:42:16 +0000 (13:42 +0000)]
ufs: denote lack of support for lockless symlink lookup

It is unclear without investigating if it can be provided without using
extra memory, so for the time being just don't.

3 years agocache: add symlink support to lockless lookup
Mateusz Guzik [Sat, 23 Jan 2021 13:40:48 +0000 (13:40 +0000)]
cache: add symlink support to lockless lookup

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

3 years agoaxgbe: fix some link related issues
Vincenzo Maffione [Sat, 23 Jan 2021 13:44:24 +0000 (13:44 +0000)]
axgbe: fix some link related issues

By default, axgbe driver does a receiver reset after predefined number
of retries for the link to come up. However, this receiver reset
doesn't always suffice, due to an hardware issue.
In that case, as a workaround, a complete phy reset is necessary.
This patch introduces a sysctl that can be set to 1 to let the driver
reset the phy completely, rather than just doing receiver reset.
The workaround will be removed once the issue is fixed by means
of firmware update.

This patch also fixes the handling of the direct attach cables
properly.

Submitted by: rajesh1.kumar_amd.com
Differential Revision: https://reviews.freebsd.org/D28266

3 years agoloader: create built in font from bold font face
Toomas Soome [Fri, 22 Jan 2021 11:06:58 +0000 (13:06 +0200)]
loader: create built in font from bold font face

We did replace full version of default font 8x16v with bold, also
use bold version for built in font.

3 years agoelfctl: fix typo from last-minute refactoring
Ed Maste [Fri, 22 Jan 2021 21:23:12 +0000 (16:23 -0500)]
elfctl: fix typo from last-minute refactoring

Reported by: jkim
Fixes: 86f33b5fcf6087bf4439881011b920ff99e6e300

3 years agoelfctl: allow features to be specified by value
Ed Maste [Fri, 22 Jan 2021 17:22:35 +0000 (12:22 -0500)]
elfctl: allow features to be specified by value

This will allow elfctl on older releases to set bits that are not yet
known there, so that the binary will have the correct settings applied
if run on a later FreeBSD version.

PR: 252629 (related)
Suggested by: kib
Reviewed by: gbe (manpage, earlier), kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28284

3 years agogdb: only return signal values for powerpc's gdb_cpu_signal()
Mitchell Horne [Fri, 22 Jan 2021 18:56:56 +0000 (14:56 -0400)]
gdb: only return signal values for powerpc's gdb_cpu_signal()

Summary:
The values returned by this function are reported to the gdb client as
the reason for the break in execution, a signal value such as SIGTRAP,
SIGEMT, or SIGSEGV. As such, exact vector numbers can be misidentified.
Return SIGEMT in the default case instead.

Reviewed by: alfredo
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28046

3 years agojail: fix dangling reference bug from 6754ae2572eb
Jamie Gritton [Fri, 22 Jan 2021 18:56:24 +0000 (10:56 -0800)]
jail: fix dangling reference bug from 6754ae2572eb

The change to use refcounts for pr_uref was mishandled in
prison_proc_free, so killing a jail's last process could add
an extra reference, leaving it an unkillable zombie.

3 years agojail: A jail could be removed without calling OSD methods
Jamie Gritton [Fri, 22 Jan 2021 18:50:10 +0000 (10:50 -0800)]
jail: A jail could be removed without calling OSD methods

Fix a long-standing bug where setting nopersist on a process-less jail
would remove it without calling the the OSD PR_METHOD_REMOVE methods.

3 years agoRegen src.conf after MK_{LIBTHR,LIBPTHREAD} removal
Kyle Evans [Wed, 20 Jan 2021 14:03:21 +0000 (08:03 -0600)]
Regen src.conf after MK_{LIBTHR,LIBPTHREAD} removal

3 years agobuild: remove LIBPTHREAD/LIBTHR build options
Kyle Evans [Wed, 20 Jan 2021 14:01:25 +0000 (08:01 -0600)]
build: remove LIBPTHREAD/LIBTHR build options

WITHOUT_LIBTHR has been broken for a little over five years now, since the
xz 5.2.0 update introduced a hard liblzma dependency on libthr, and building
a useful system without threading support is becoming increasingly more
difficult.

Additionally, in the five plus years that it's been broken more reverse
dependencies have cropped up in libzstd, libsqlite3, and libcrypto (among
others) that make it more and more difficult to reconcile the effort needed
to fix these options.

Remove the broken options.

PR: 252760
Reviewed by: brooks, emaste, kib
Differential Revision: https://reviews.freebsd.org/D28263

3 years agopowerpc64le: don't enable COMPAT_* options in GENERIC64LE
Piotr Kubaj [Fri, 22 Jan 2021 16:39:15 +0000 (17:39 +0100)]
powerpc64le: don't enable COMPAT_* options in GENERIC64LE

Support for powerpc64le appeared in 13, so there's no point to enable COMPAT_* for older releases.

Also disable COMPAT_FREEBSD32, since there's no powerpcle. Since that may change in the future, leave the option commented out.

Approved by: bdragon, jhibbits (on IRC)

3 years agopowerpc: fix build without DDB
Mateusz Guzik [Fri, 22 Jan 2021 14:29:01 +0000 (14:29 +0000)]
powerpc: fix build without DDB

3 years agonewvers.sh: restore reporting branch names
Mateusz Guzik [Fri, 22 Jan 2021 13:00:24 +0000 (13:00 +0000)]
newvers.sh: restore reporting branch names

It got removed arguably without much discussion in the commit which
added gitup support.

3 years agoComplete Steps 5 and 9 from the Committer's guide
Lewis Cook [Fri, 22 Jan 2021 11:22:56 +0000 (11:22 +0000)]
Complete Steps 5 and 9 from the Committer's guide

Summary:
Steps 5 and 9:
 - Update Mentor and Mentee Information
 - Update Ports with Personal Information

Reviewers: tcberner, fernape

Reviewed By: fernape

Subscribers: imp

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

3 years agoRevert "[mips] revert r366664 - flip mips back from -O2 to -O"
Mateusz Guzik [Fri, 22 Jan 2021 10:17:34 +0000 (10:17 +0000)]
Revert "[mips] revert r366664 - flip mips back from -O2 to -O"

This reverts commit bd72252aace382921840ddbceea712b96f4ad242.

The commit at hand breaks the build for all mips targets and does not
have a one-liner fix.

make[5]: "/usr/src/share/mk/sys.mk" line 169: Malformed conditional (${MACHINE_CPUARCH} == "mips" && ${COMPILER_TYPE} == "gcc")

3 years agoarm64: fix typo in file name in GENERIC-MMCCAM-NODEBUG
Mateusz Guzik [Fri, 22 Jan 2021 10:16:57 +0000 (10:16 +0000)]
arm64: fix typo in file name in GENERIC-MMCCAM-NODEBUG

3 years agoCatch up another version bump to 14.0
Li-Wen Hsu [Fri, 22 Jan 2021 09:53:59 +0000 (17:53 +0800)]
Catch up another version bump to 14.0

Reported by: rm

3 years agoarmv8crypto: add AES-GCM support
Oleksandr Tymoshenko [Wed, 13 Jan 2021 06:27:10 +0000 (22:27 -0800)]
armv8crypto: add AES-GCM support

Add support for AES-GCM using OpenSSL's accelerated routines.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D27454
Sponsored by: Ampere Computing
Submitted by: Klara, Inc.

3 years agofix incorrect LLD_VERSION_STRING from previous commit
Glen Barber [Fri, 22 Jan 2021 00:49:30 +0000 (19:49 -0500)]
fix incorrect LLD_VERSION_STRING from previous commit

Reported by: Oliver Pinter
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoBump CURRENT to 14.0
Glen Barber [Fri, 22 Jan 2021 00:10:07 +0000 (19:10 -0500)]
Bump CURRENT to 14.0

This one goes to 14.

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agokvprintf(9): add missing FALLTHROUGH
Marius Strobl [Thu, 21 Jan 2021 23:16:37 +0000 (00:16 +0100)]
kvprintf(9): add missing FALLTHROUGH

Reported by: Coverity
CID: 1005166

3 years agommcsd(4): properly set BIO error when partition switching fails
Marius Strobl [Thu, 21 Jan 2021 23:09:09 +0000 (00:09 +0100)]
mmcsd(4): properly set BIO error when partition switching fails

While at it, remove redundant braces and goto in mmcsd_task().

Reported by: Coverity
CID: 1419639

3 years agosym(4): handle mixed tagged/untagged commands gracefully
Marius Strobl [Thu, 21 Jan 2021 22:48:08 +0000 (23:48 +0100)]
sym(4): handle mixed tagged/untagged commands gracefully

Handle the case of a tagged command arriving when there's an untagged
one still outstanding gracefully instead of panicing.

While at it:
- Replace fancy arithmetics with a simple assignment as busy_itl can
  only ever be either 0 or 1.
- Fix a comment typo in sym_free_ccb().

3 years agosym(4): fix nits reported by Coverity
Marius Strobl [Thu, 21 Jan 2021 22:34:19 +0000 (23:34 +0100)]
sym(4): fix nits reported by Coverity

- In ___dma_getp(), remove dead code. [1]
- In sym_sir_bad_scsi_status(), add missing FALLTHROUGH. [2]

While at it:
- For getbaddrcb(), remove __unused from the nseg argument as it's in
  fact used when compiling with INVARIANTS.
- In sym_int_sir(), ensure in all branches that cp is not NULL before
  using it.

Reported by: Coverity
CID: 1008861 [1], 114996 [2]

3 years agofb_if: remove unused method
Marius Strobl [Sun, 17 Jan 2021 13:31:56 +0000 (14:31 +0100)]
fb_if: remove unused method

Apparently, it never came into play.

3 years agoboot_font(4): remove obsolete font
Marius Strobl [Sun, 17 Jan 2021 13:21:49 +0000 (14:21 +0100)]
boot_font(4): remove obsolete font

It's no longer used since 4e421792ec80df7a5fa82e97dcc3575c3ec6740a
and r325892 respectively.

3 years agoFurther refactor IPv4 interface route creation.
Alexander V. Chernikov [Tue, 19 Jan 2021 23:50:34 +0000 (23:50 +0000)]
Further refactor IPv4 interface route creation.

* Fix bug with /32 aliases introduced in 81728a538d24.
* Explicitly document business logic for IPv4 ifa routes.
* Remove remnants of rtinit()
* Deduplicate ifa->route prefix code by moving it into ia_getrtprefix()
* Deduplicate conditional check for ifa_maintain_loopback_route()  by
 moving into ia_need_loopback_route()
* Remove now-unused flags argument from in_addprefix().

Reviewed by: donner
PR: 252883
Differential Revision: https://reviews.freebsd.org/D28246

3 years agoFix typo in pwait.c introduced in 5bdce6ff546e
Alexander V. Chernikov [Thu, 21 Jan 2021 21:43:27 +0000 (21:43 +0000)]
Fix typo in pwait.c introduced in 5bdce6ff546e

Reported by: kevans

3 years agoRemove deadlock in rc caused by pwait waiting for itself.
Alexander V. Chernikov [Thu, 21 Jan 2021 21:26:15 +0000 (21:26 +0000)]
Remove deadlock in rc caused by pwait waiting for itself.

The following situation can trigger the deadlock:
1) Long time ago a_service was started through rc.d
2) We want to restart a_service and issue service a_service restart
3) rc.subr reads current process PID (via file or process),
   sends TERM signal and runs pwait with PID harvested
4) a_service process dies very quickly so it's PID becomes available.
   It is possible that while original process was running,
   PID counter overflowed and pwait got assigned a_service's PID.

This patch ignores pid(s) to wait that are equal to pwait PID.

Reported by: Dan McGregor, Boris Lytochkin
Submitted by: Boris Lytochkin <lytboris at gmail.com>
Reviewed By: 0mp
MFC after: 2 weeks
PR: 218598
Differential Revision: https://reviews.freebsd.org/D28240

3 years agomalloc_aligned: roundup allocation size up to next power of two
Konstantin Belousov [Mon, 18 Jan 2021 21:17:21 +0000 (23:17 +0200)]
malloc_aligned: roundup allocation size up to next power of two

to make it use the right aligned zone.

Reported by: melifaro
Reviewed by: alc, markj (previous version)
Discussed with: jrtc27
Tested by: pho (previous version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28219

3 years agoRestrict supported alignment for malloc_domainset_aligned(9) to PAGE_SIZE.
Konstantin Belousov [Mon, 18 Jan 2021 09:01:23 +0000 (11:01 +0200)]
Restrict supported alignment for malloc_domainset_aligned(9) to PAGE_SIZE.

UMA page_alloc() does not take an alignment, so UMA can only handle
alignment less then page size.

Noted by: alc
Reviewed by: alc, markj (previous version)
Discussed with: jrtc27
Tested by: pho (previous version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28219

3 years agoFix manpage markup in 2c8bb126de56ce49637ad752e78957d9ebafba02
Allan Jude [Thu, 21 Jan 2021 20:32:15 +0000 (20:32 +0000)]
Fix manpage markup in 2c8bb126de56ce49637ad752e78957d9ebafba02

3 years agobhyve: Add missing man page section on the nodelete block-device-option
Allan Jude [Thu, 21 Jan 2021 17:17:57 +0000 (17:17 +0000)]
bhyve: Add missing man page section on the nodelete block-device-option

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D28272

3 years agolibcasper/cap_grp tests: Reset the group database handle
Mark Johnston [Thu, 21 Jan 2021 19:30:19 +0000 (14:30 -0500)]
libcasper/cap_grp tests: Reset the group database handle

Some tests verify that the capgrp capability does not permit calls to
setgrent(3), but all tests need to ensure that they reset the
capability's group database handle, otherwise the local process and
casper process will be out of sync.

The cap_pwd tests already handle this.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

3 years agolibc/nss: Ensure that setgroupent(3) actually works as advertised
Mark Johnston [Thu, 21 Jan 2021 19:30:19 +0000 (14:30 -0500)]
libc/nss: Ensure that setgroupent(3) actually works as advertised

Because the "files" and "compat" implementations failed to set the
"stayopen", keyed lookups would close the database handle, contrary to
the purpose of setgroupent(3).  setpassent(3)'s implementation does not
have this bug.

PR: 165527
Submitted by: Andrey Simonenko
MFC after: 1 month

3 years agolibc/nss tests: Add regression tests for commit 55444c823e1f
Mark Johnston [Thu, 21 Jan 2021 19:30:19 +0000 (14:30 -0500)]
libc/nss tests: Add regression tests for commit 55444c823e1f

PR: 252094
Sponsored by: The FreeBSD Foundation
MFC after: 1 month

3 years agolibc/nss: Restore iterator state when doing passwd/group lookups
Mark Johnston [Thu, 21 Jan 2021 19:30:19 +0000 (14:30 -0500)]
libc/nss: Restore iterator state when doing passwd/group lookups

The getpwent(3) and getgrent(3) implementations maintain some internal
iterator state.  Interleaved calls to functions which do passwd/group
lookups using a key, such as getpwnam(3), would in some cases clobber
this state, causing a subsequent getpwent() or getgrent() call to
restart iteration from the beginning of the database or to terminate
early.  This is particularly troublesome in programming environments
where execution of green threads is interleaved within a single OS
thread.

Take care to restore any iterator state following a keyed lookup.  The
"files" provider for the passwd database was already handling this
correctly, but "compat" was not, and both providers had this problem
when accessing the group database.

PR: 252094
Submitted by: Viktor Dukhovni <ietf-dane@dukhovni.org>
MFC after: 1 month

3 years agolibc/nss tests: Fix getpw and getgr single-pass tests
Mark Johnston [Thu, 21 Jan 2021 19:30:19 +0000 (14:30 -0500)]
libc/nss tests: Fix getpw and getgr single-pass tests

Some NSS regression tests for getgrent(3) and getpwent(3) were not
testing anything because the test incorrectly requested creation of a
database snapshot.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

3 years agolibc/nss tests: Style
Mark Johnston [Thu, 21 Jan 2021 19:30:18 +0000 (14:30 -0500)]
libc/nss tests: Style

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

3 years agoDefine PNP info after defining driver modules
Mark Johnston [Thu, 21 Jan 2021 19:30:18 +0000 (14:30 -0500)]
Define PNP info after defining driver modules

PNP info definitions currently have an unfortunate requirement in that
they must follow the associated module definition in the module metadata
linker set.  Otherwise devmatch can segfault while processing the linker
hints file since kldxref maintains the order in the linker set.

A number of drivers violate this requirement.  In some cases this can
cause devmatch(8) to segfault when processing the linker hints file.
Work around the problem for now simply by adjusting the drivers.

Reviewed by: imp
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D28260

3 years agonewvers.sh: avoid bare git invocation
Ed Maste [Thu, 21 Jan 2021 15:00:20 +0000 (10:00 -0500)]
newvers.sh: avoid bare git invocation

git may not be in the path, and $git_cmd includes some commandline
arguments.

Reported by: mjg
Tested by: mjg

3 years agoiflib: Fix a NULL pointer deref
Andrew Gallatin [Thu, 21 Jan 2021 14:45:15 +0000 (09:45 -0500)]
iflib: Fix a NULL pointer deref

rxd_frag_to_sd() have pf_rv parameter as NULL with the current
code. This patch fixes the NULL pointer dereference in that
case thus avoiding a possible panic.

Submitted by: rajesh1.kumar at amd.com
Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D28115

3 years agox86: switch vdso TSC timecounter to RDTSCP on AMD Zen CPUs
Konstantin Belousov [Thu, 21 Jan 2021 12:54:28 +0000 (14:54 +0200)]
x86: switch vdso TSC timecounter to RDTSCP on AMD Zen CPUs

Reported by: many
Tested by: gallatin, mikael, rhurlin
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agox86: switch kernel TSC timecounter to RDTSCP on AMD Zen CPUs
Konstantin Belousov [Thu, 21 Jan 2021 12:53:15 +0000 (14:53 +0200)]
x86: switch kernel TSC timecounter to RDTSCP on AMD Zen CPUs

Reported by: many
Tested by: gallatin, mikael, rhurlin
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoelf: add some definitions for i386 and amd64 relocations
Konstantin Belousov [Sun, 17 Jan 2021 07:03:31 +0000 (09:03 +0200)]
elf: add some definitions for i386 and amd64 relocations

I believe that rtld does not need to implement them, they are mostly for
the static linker.  'Mostly' because for amd64 our kernel linker loads
object files, and amd64 relocation types could be observed.

Defines were taken from glibc sources.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28205

3 years agoRemove FirstBurstLength limit for software iSCSI.
Alexander Motin [Thu, 21 Jan 2021 02:33:14 +0000 (21:33 -0500)]
Remove FirstBurstLength limit for software iSCSI.

For hardware offload solicited data may potentially be handled more
efficiently than unsolicited due to direct data placement.  Or there
can be some unsolicited write buffering limitations.  It may create
situations where FirstBurstLength limit is really useful.

Software driver though has no those factors, having to do memcopy()
any way and having no so hard limit on the temporary storage.  Same
time more active use of unsolicited transfers allows to avoid some
of Ready To Transfer (R2T) PDU round-trip times and processing.

This change effectively doubles from 64KB to 128KB the maximum size
of write command that can be transferred within one link RTT.  Tests
of (64KB, 128KB] QD1 writes mixed with simultaneous QD8 reads over
the same connection, increasing RTT, shows almost double write speed
and half latency, while we should be able to afford few megabytes of
RAM for additional buffering on a target these days.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

3 years agopkgbase: allow update-packages for first-run of packaging
Kyle Evans [Mon, 18 Jan 2021 20:11:58 +0000 (14:11 -0600)]
pkgbase: allow update-packages for first-run of packaging

If ${REPODIR}/${PKG_ABI} does not exist when we begin real-update-packages,
skip the comparison with the non-existent previous repository and just
finish the repo off. This allows external scripts to just assume they can
run `update-packages` rather than figuring out if they'd previously run
`packages` for this Version/Arch combo.

PKG_VERSION_FROM_DIR was added so that we could perhaps detect the three
distinct cases:

1.) If the repo has not yet been created, PKG_VERSION_FROM_DIR will be
  empty.
2.) If the repo is in some intermediate state between created and fully
  initialized, PKG_VERSION_FROM_DIR may point to the ABI directory.
3.) If the repo is fully initialized, then PKG_VERSION_FROM_DIR points to
  the latest build to compare to.

Option #2 is explicitly unhandled at the moment, but this is no different
than it was before.

Reviewed-by: manu
Differential-Revision: https://reviews.freebsd.org/D28229

3 years agovirtio_mmio: Delete a stale #if 0'ed debug print
Jessica Clarke [Thu, 21 Jan 2021 02:14:41 +0000 (02:14 +0000)]
virtio_mmio: Delete a stale #if 0'ed debug print

This was blindly moved in r360722 but the variable being printed is not
yet initialised. It's of little use and can easily be added back in the
right place if needed by someone debugging, so just delete it.

Reported by: bryanv

3 years agolinux64: Don't pass unnecessary -S and -g to objcopy
Jessica Clarke [Thu, 21 Jan 2021 01:54:52 +0000 (01:54 +0000)]
linux64: Don't pass unnecessary -S and -g to objcopy

Since we use --input-type binary these options are rather meaningless. Both
binutils and elftoolchain ignore the option in this case, but LLVM does not,
and instead strips all symbols from the output file, causing missing symbols at
run time if building with llvm-objcopy. Thus simply remove the options; the
linux module has never included them for building its VDSO (added in r283407),
but for some reason the original commit of linux64 (r283424) added them.

These should however eventually be changed to use template assembly files as is
now done for firmware and MFS_IMAGE.

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

3 years agoRename i386's Linux ELF to Linux ELF32
Jessica Clarke [Thu, 21 Jan 2021 01:54:12 +0000 (01:54 +0000)]
Rename i386's Linux ELF to Linux ELF32

This is what amd64 calls the i386 Linux ABI in order to distinguish it
from the amd64 Linux ABI, and matches the nomenclature used for the
FreeBSD ABIs where they always have the size suffix in the name.

Reviewed by: trasz
Differential Revision: https://reviews.freebsd.org/D27647

3 years agoBuild VirtIO modules on all architectures
Jessica Clarke [Thu, 21 Jan 2021 01:21:35 +0000 (01:21 +0000)]
Build VirtIO modules on all architectures

Currently only amd64, i386 and powerpc build VirtIO modules, yet all other
architectures have at least one kernel configuration that includes the
transport drivers, and so they lack drivers for all the devices they don't
statically compile into the kernel. Instead, enable the build everywhere so all
architectures have the full set of device drivers available.

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

3 years agovirtio: Reduce boilerplate for device driver module definitions
Jessica Clarke [Thu, 21 Jan 2021 01:07:23 +0000 (01:07 +0000)]
virtio: Reduce boilerplate for device driver module definitions

Rather than have every device register itself for both virtio_pci and
virtio_mmio, provide a VIRTIO_DRIVER_MODULE wrapper to declare both,
merge VIRTIO_SIMPLE_PNPTABLE with VIRTIO_SIMPLE_PNPINFO and make the
latter register for both buses. This also has the benefit of abstracting
away the available transports and their names.

Reviewed by: bryanv
Differential Revision: https://reviews.freebsd.org/D28073

3 years agovirtio_mmio: Fix V1 device probing spec conformance (section 4.2.3.1.1)
Jessica Clarke [Thu, 21 Jan 2021 01:03:44 +0000 (01:03 +0000)]
virtio_mmio: Fix V1 device probing spec conformance (section 4.2.3.1.1)

We must check MagicValue not just Version before anything else, and then
we must check DeviceID and immediately abort if zero (and this must not
be an error).

Do all this when probing rather than at the start of attaching as that's
where this belongs, and provides a clear boundary between the device
detection and device initialisation parts of the specified driver
initialisation process. This also means we don't create empty device
instances for placeholder devices, reducing clutter on systems that
pre-allocate a large number, such as QEMU's AArch64 virt machine (which
provides 32).

Reviewed by: bryanv
Differential Revision: https://reviews.freebsd.org/D28070

3 years agovirtio_mmio: Fix a style(9) issue
Jessica Clarke [Thu, 21 Jan 2021 01:02:30 +0000 (01:02 +0000)]
virtio_mmio: Fix a style(9) issue

3 years agoTidy some crypto-related lines in sys/conf/files.
John Baldwin [Thu, 21 Jan 2021 00:39:04 +0000 (16:39 -0800)]
Tidy some crypto-related lines in sys/conf/files.

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

3 years agoRestructure the crypto(7) manpage and add authentication algorithms.
John Baldwin [Thu, 21 Jan 2021 00:37:55 +0000 (16:37 -0800)]
Restructure the crypto(7) manpage and add authentication algorithms.

Add separate sections for authentication algorithms, block ciphers,
stream ciphers, and AEAD algorithms.  Describe properties commmon to
algorithms in each section to avoid duplication.

Use flat tables to list algorithm properties rather than nested
tables.

List implemented authentication algorithms.

Reviewed by: gbe (manpages)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27833

3 years agoSimplify dynamic ipfilter sysctls.
John Baldwin [Thu, 21 Jan 2021 00:33:34 +0000 (16:33 -0800)]
Simplify dynamic ipfilter sysctls.

Pass the structure offset in arg2 instead of arg1.  This avoids
having to undo the pointer arithmetic on arg1.  Instead arg2 can
be used directly as an offset relative to the desired structure.

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

3 years agojail: Use refcount(9) for prison references.
Jamie Gritton [Wed, 20 Jan 2021 23:08:27 +0000 (15:08 -0800)]
jail: Use refcount(9) for prison references.

Use refcount(9) for both pr_ref and pr_uref in struct prison.  This
allows prisons to held and freed without requiring the prison mutex.
An exception to this is that dropping the last reference will still
lock the prison, to keep the guarantee that a locked prison remains
valid and alive (provided it was at the time it was locked).

Among other things, this honors the promise made in a comment in
crcopy(9), that it will not block, which hasn't been true for two
decades.

3 years agodevinfo sysctl handler: Do not write zero-length strings in to sbuf twice
Vladimir Kondratyev [Wed, 20 Jan 2021 23:06:16 +0000 (02:06 +0300)]
devinfo sysctl handler: Do not write zero-length strings in to sbuf twice

This fixes missing PnPinfo and location strings in devinfo(8) output
for devices with no attached drivers.

3 years agopms: handle maximum size IO with any alignment
Ryan Libby [Wed, 20 Jan 2021 21:59:49 +0000 (13:59 -0800)]
pms: handle maximum size IO with any alignment

Define the maximum numbers of segments to allow for non-page alignment
at the beginning and end of a maxphys size transfer.  Also set
ccb_pathinq.maxio consistent with maxphys.

Reviewed by: imp
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D28043

3 years agopms: quiet -Wunused-variable
Ryan Libby [Wed, 20 Jan 2021 21:59:49 +0000 (13:59 -0800)]
pms: quiet -Wunused-variable

Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D27994

3 years agoevdev: Make variable-size ioctls return actual length of copyouted data
Vladimir Kondratyev [Wed, 20 Jan 2021 20:10:07 +0000 (23:10 +0300)]
evdev: Make variable-size ioctls return actual length of copyouted data

on success instead of 0 to match Linux.
Imprivata binary depends on this.

Submitted by: Shunchao Hu <ankohuu_outlook.com>
Reviewed by: wulf
Differential revision: https://reviews.freebsd.org/D28218

3 years agohmt: Allow I2C sampling mode support to be compiled out.
Vladimir Kondratyev [Wed, 20 Jan 2021 20:10:07 +0000 (23:10 +0300)]
hmt: Allow I2C sampling mode support to be compiled out.

3 years agohms: Workaround idle mouse drift in I2C sampling mode.
Vladimir Kondratyev [Wed, 20 Jan 2021 20:10:07 +0000 (23:10 +0300)]
hms: Workaround idle mouse drift in I2C sampling mode.

Many I2C "compatibility" mouse devices found on touchpads continue to
return last report data in sampling mode after touch has been ended.
That results in cursor drift.  Filter out such a reports with comparing
content of current report with content of previous one.

Reported by: many
Tested by: omatsuda, gllb (github.com)
Obtained from: sysutils/iichid

3 years agohconf(4): Do not fetch report before writing new usage values back.
Vladimir Kondratyev [Wed, 20 Jan 2021 20:10:06 +0000 (23:10 +0300)]
hconf(4): Do not fetch report before writing new usage values back.

There is a report that reading of surface/button switch feature report
causes SYN1B7D touchpad malfunction.  As specs does not require it to
be readable assume that report usages have default value on attach and
last written value during operation. Do not apply default usage values
on attachment and resume.
While here fix manpage typos and add avg@ to copyright header.

Reported by: Jakob Alvermark <jakob_AT_alvermark_DOT_net>
Reviewed by: avg
Differential revision: https://reviews.freebsd.org/D28196

3 years agoHandle arm64 undefied instructions on msr exceptions
Andrew Turner [Wed, 20 Jan 2021 09:56:47 +0000 (09:56 +0000)]
Handle arm64 undefied instructions on msr exceptions

When userspace tries to access a special register that it doesn't have
access to the kernel receives an exception. On most cores this exception
has been observed to be the undefined instruction exception, however on
the Apple M1 under a QEMU based hypervisor it can be the MSR exception.

Handle this second case by also running the undefined exception handler
on these exceptions.

Sponsored by: Innovate UK

3 years agoReuse the amd64 loader relocation code on arm64
Andrew Turner [Sun, 17 Jan 2021 18:11:11 +0000 (18:11 +0000)]
Reuse the amd64 loader relocation code on arm64

There is no need to keep multiple copies of the relocation code. The
amd64 code works on arm64 with a few small changes to relocation types.

Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D28213

3 years agocat: style nits
Mariusz Zaborski [Wed, 20 Jan 2021 17:46:26 +0000 (18:46 +0100)]
cat: style nits

Pointed out by: jhb

3 years agorelease: fix PORT variable
Glen Barber [Wed, 20 Jan 2021 17:15:13 +0000 (12:15 -0500)]
release: fix PORT variable

Reported by: Yasuhiro Kimura (yasu xat utahime dot org)
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoaio: micro-optimize the lio_opcode assignments
Alan Somers [Sun, 3 Jan 2021 04:25:05 +0000 (21:25 -0700)]
aio: micro-optimize the lio_opcode assignments

This allows slightly more efficient opcode testing in-kernel.  It is
transparent to userland, except to applications that sneakily submit
aio fsync or aio mlock operations via lio_listio, which has never been
documented, requires the use of deliberately undefined constants
(LIO_SYNC and LIO_MLOCK), and is arguably a bug.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D27942

3 years agoifconfig: add vlanproto "qiniq" as an alias for "802.1ad"
Allan Jude [Tue, 19 Jan 2021 23:22:07 +0000 (23:22 +0000)]
ifconfig: add vlanproto "qiniq" as an alias for "802.1ad"

QinQ is better known by this name, so accept it as an alias

Reported-by: Mike Geiger
Reviewed-by: melifaro, hselasky, rpokala
MFC-with: 366917
Sponsored-by: Klara Inc.
Differential-Revision: https://reviews.freebsd.org/D28245