Commit Graph

256188 Commits

Author SHA1 Message Date
Allan Jude
e6d795d154 Fix manpage markup in 2c8bb126de 2021-01-21 20:32:15 +00:00
Allan Jude
2c8bb126de bhyve: Add missing man page section on the nodelete block-device-option
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D28272
2021-01-21 20:30:55 +00:00
Mark Johnston
1a05d9519d 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
2021-01-21 14:30:19 -05:00
Mark Johnston
48a1868634 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
2021-01-21 14:30:19 -05:00
Mark Johnston
6e411d8b14 libc/nss tests: Add regression tests for commit 55444c823e1f
PR:		252094
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
2021-01-21 14:30:19 -05:00
Mark Johnston
5619d49e07 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
2021-01-21 14:30:19 -05:00
Mark Johnston
7abc10098b 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
2021-01-21 14:30:19 -05:00
Mark Johnston
ed14c69d56 libc/nss tests: Style
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
2021-01-21 14:30:18 -05:00
Mark Johnston
aa37baf3d7 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
2021-01-21 14:30:18 -05:00
Ed Maste
9e98065cf1 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
2021-01-21 10:03:39 -05:00
Andrew Gallatin
0c864213ef 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
2021-01-21 09:47:06 -05:00
Konstantin Belousov
523d94dbea 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
2021-01-21 14:55:31 +02:00
Konstantin Belousov
9f47eeffa3 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
2021-01-21 14:55:31 +02:00
Konstantin Belousov
f7d181543f 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
2021-01-21 14:55:31 +02:00
Alexander Motin
ff751ee05c 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.
2021-01-20 23:17:12 -05:00
Kyle Evans
26490d9b74 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
2021-01-20 21:58:30 -06:00
Jessica Clarke
85ad7f8da1 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
2021-01-21 02:14:41 +00:00
Jessica Clarke
513c5cd827 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
2021-01-21 01:54:52 +00:00
Jessica Clarke
5faeda9037 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
2021-01-21 01:54:12 +00:00
Jessica Clarke
32cb85d0f1 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
2021-01-21 01:21:35 +00:00
Jessica Clarke
633218ee46 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
2021-01-21 01:07:23 +00:00
Jessica Clarke
be79a2c60f 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
2021-01-21 01:05:21 +00:00
Jessica Clarke
0e72f2c541 virtio_mmio: Fix a style(9) issue 2021-01-21 01:05:20 +00:00
John Baldwin
5bd565855a Tidy some crypto-related lines in sys/conf/files.
Reviewed by:	cem (earlier version)
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D27835
2021-01-20 16:40:05 -08:00
John Baldwin
4a6cd37b75 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
2021-01-20 16:40:03 -08:00
John Baldwin
d86d319495 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
2021-01-20 16:34:25 -08:00
Jamie Gritton
6754ae2572 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.
2021-01-20 15:08:27 -08:00
Vladimir Kondratyev
e3dd8ed77b 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.
2021-01-21 02:06:16 +03:00
Ryan Libby
e54a1d5751 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
2021-01-20 13:59:49 -08:00
Ryan Libby
84ab9074d4 pms: quiet -Wunused-variable
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27994
2021-01-20 13:59:49 -08:00
Vladimir Kondratyev
7a810290b8 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
2021-01-20 23:10:07 +03:00
Vladimir Kondratyev
5cc21ab994 hmt: Allow I2C sampling mode support to be compiled out. 2021-01-20 23:10:07 +03:00
Vladimir Kondratyev
3e954a8bc6 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
2021-01-20 23:10:07 +03:00
Vladimir Kondratyev
fa656aefe4 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
2021-01-20 23:10:06 +03:00
Andrew Turner
8e67b9389d 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
2021-01-20 17:59:38 +00:00
Andrew Turner
f6f0b849fb 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
2021-01-20 17:59:38 +00:00
Mariusz Zaborski
0614d73967 cat: style nits
Pointed out by:	jhb
2021-01-20 18:46:26 +01:00
Glen Barber
5b0914aea2 release: fix PORT variable
Reported by:	Yasuhiro Kimura (yasu xat utahime dot org)
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-01-20 12:15:13 -05:00
Alan Somers
2247f48941 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
2021-01-20 09:02:25 -07:00
Allan Jude
b84d0aaa4e 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
2021-01-20 15:50:45 +00:00
Cy Schubert
d70886d063 wpa_supplicant uses PF_ROUTE to return the routing table in order to
determine the length of the routing table buffer. As of 81728a538d
wpa_supplicant is started before the routing table has been populated
resulting in the length of zero to be returned. This causes
wpa_supplicant to loop endlessly. (The workaround is to kill and restart
wpa_supplicant as by the time it is restarted the routing table is
populated.)

(Personally, I was not able to reproduce this unless wlan0 was a member of
lagg0. However, others experienced this problem on standalone wlan0.)

PR:		252844
Submitted by:	shu <ankohuu _ outlook.com>
Reported by:	shu <ankohuu _ outlook.com>
Reviewed by:	cy
X-MFC with:	81728a538d
Differential Revision:	https://reviews.freebsd.org/D28249
2021-01-20 07:45:18 -08:00
Kyle Evans
b9fdd1446c Regenerate src.conf(5) after 7c5a624afa
WITHOUT_CRYPT no longer implies WITHOUT_WIRELESS after the aforementioned
commit.
2021-01-20 08:29:16 -06:00
Richard Scheffenegger
bc7ee8e5bc Address panic with PRR due to missed initialization of recover_fs
Summary:
When using the base stack in conjunction with RACK, it appears that
infrequently, ++tp->t_dupacks is instantly larger than tcprexmtthresh.

This leaves the recover flightsize (sackhint.recover_fs) uninitialized,
leading to a div/0 panic.

Address this by properly initializing the variable just prior to first
use, if it is not properly initialized.

In order to prevent stale information from a prior recovery to
negatively impact the PRR calculations in this event, also clear
recover_fs once loss recovery is finished.

Finally, improve the readability of the initialization of recover_fs
when t_dupacks == tcprexmtthresh by adjusting the indentation and
using the max(1, snd_nxt - snd_una) macro.

Reviewers: rrs, kbowling, tuexen, jtl, #transport, gnn!, jmg, manu, #manpages

Reviewed By: rrs, kbowling, #transport

Subscribers: bdrewery, andrew, rpokala, ae, emaste, bz, bcran, #linuxkpi, imp, melifaro

Differential Revision: https://reviews.freebsd.org/D28114
2021-01-20 12:06:34 +01:00
Alex Richardson
cef1942711 libc: Fix null pointer arithmetic warning in mergesort
This file has other questionable code and "optimizations" (such as copying
one int at a time) that are probably no longer useful, so it might make
sense to replace it with a different implementation at some point.

Reviewed By:	jhb
Differential Revision: https://reviews.freebsd.org/D28134
2021-01-20 09:56:01 +00:00
Alex Richardson
7e99c034f7 Emit uprintf() output for initproc if there is no controlling terminal
This patch helped me debug why /sbin/init was not being loaded after
making changes to the image activator in CheriBSD.

Reviewed By:	jhb (earlier version), kib
Differential Revision: https://reviews.freebsd.org/D28121
2021-01-20 09:54:46 +00:00
Alex Richardson
db4b5a16a3 Minor simplification of MK_PMC case in usr.sbin/Makefile
MK_PMC is already guarded by MK_CXX in src.opts.mk, so we can actually
merge it with the following SUBDIR statement after c1a3d7f206.

Suggested By:	jrtc27
2021-01-20 09:52:58 +00:00
Michael Osipov
a9fc14fbf4 newvers.sh: add support for gitup(1)
gitup writes a .gituprevision file into the shallow clone directory. Read that
file and print commit information only.

Submitted by:	Michael Osipov <michael.osipov@siemens.com>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/449

While here, drop the redundant branch name from the git output and don't
count commits in shallow clones.

Reported by:	Michael Osipov <michael.osipov@siemens.com>
MFC after:	2 weeks
2021-01-20 10:48:27 +01:00
Mateusz Piotrowski
a0e85d0eb5 Remove the unnecessary space before the colon
MFC after:	3 days
2021-01-20 09:46:15 +01:00
Mateusz Guzik
2171b8e8a2 cache: augment sdt probe in cache_fplookup_dot
Same as 6d386b4c ("cache: save a branch in cache_fplookup_next")
2021-01-20 07:23:14 +00:00
Mateusz Guzik
aae03cfe64 cache: whitespace nit in cache_fplookup_modifying 2021-01-20 07:22:04 +00:00