Commit Graph

18695 Commits

Author SHA1 Message Date
Pedro F. Giffuni
0d2913adc3 usr.sbin/fstyp: Fix incorrect pfs_type test in ondisk inode
"ipdata.meta.pfs_type & HAMMER2_PFSTYPE_SUPROOT" happened to have
the same result (except HAMMER2_PFSTYPE_DUMMY could also match).

Obtained from: Dragonfly (git 29e6489bbd4f8e237c9c17b300ac8b711f36770)
2020-08-20 05:18:08 +00:00
Michael Gmelin
101d33b8fb Unbreak `freebsd-update updatesready'.
The command would only work if PWD happened to be WORKDIR.
Also, exit 1 in case WORKDIR exists, but isn't accessible
by the current user.

PR:		242709
Reported by:	Max Fiedler
MFC after:	1 week
2020-08-19 15:11:27 +00:00
Mateusz Piotrowski
51ae4071cb pmcstat.8: Improve description of -T 2020-08-17 10:51:03 +00:00
Mateusz Piotrowski
57b9e06a3a Revert 363598
The original wording was better.

Reported by:	rgrimes
2020-08-17 10:25:02 +00:00
Xin LI
b651906972 edquota(8): Cleanup to make it WARNS=6 clean.
Tested with:	make tinderbox
MFC after:	2 weeks
2020-08-17 05:57:22 +00:00
Alex Richardson
0d5e651861 crunchgen: use pwd -P without env
The -P flag is required by POSIX so we don't have to care whether pwd is
a shell builtin or not. This also allows removing pwd from the list of
bootstrap tools since all shells we care about for building have a
builtin pwd command. This effectively reverts r364190.

Suggested By:	rgrimes, jrtc27
2020-08-14 09:45:41 +00:00
Alex Richardson
d5c62a6f03 Use env pwd instead of pwd in crunchgen.c
In r364166 I changed /bin/pwd to pwd, but pwd can be shell builtin that
may not correctly return a real path. To ensure that all symlinks are
resolved use `env pwd -P` instead (the -P flag is part of POSIX so
should be supported everywhere).

Reported By:	rgrimes
Suggested By:	jrtc27
2020-08-12 17:27:24 +00:00
Alex Richardson
188d6f4bc6 Fix crunchgen usage of mkstemp()
On Glibc systems mkstemp can only be used once with the same template
string since it will be modified in-place and no longer contain any 'X' chars.
It is fine to reuse the same file here but we need to be explicit and use
open() instead of mkstemp() on the second use.

While touching this file also avoid a hardcoded /bin/pwd since that may not
work when building on non-FreeBSD systems.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D25990
2020-08-12 15:49:06 +00:00
Alex Richardson
b05fc77a36 Fix bootstrapping of pwd_mkdb after r364049
I moved the bootstrap pwd.h to a subdirectory in r364049 but forgot to
adjust the #include path.
2020-08-11 16:46:38 +00:00
Alex Richardson
dfb98e350c Fix i386 build of chpass after r363992
My change to allow bootstrapping pwd_mkdb (r363992) resulted in i386 build
failures because the bootstrap header was being included in non-bootstrap chpass.
Dropping the no longer required pwd_mkdb include path from chpass fixes
the build, but to be certain that the failure doesn't get re-introduced,
I've also moved the bootstrap pwd.h into a subdirectory so that adding
-I${SRCTOP}/usr.sbin/pwd_mkdb doesn't pull it in.

Reported by:	mjg
2020-08-08 10:05:27 +00:00
Alex Richardson
03266a2f08 Don't link against libdialog/ncurses when bootstrapping tzsetup 2020-08-07 16:04:10 +00:00
Alex Richardson
b4e38a41f5 makefs: Drop unnecessary sys/clock.h include
This breaks the build on macOS where this header doesn't exist. I could
also add a compat header to tools/build/cross-build but since it's not
needed removing it seems like the better solution.
2020-08-07 16:04:06 +00:00
Alex Richardson
a583962d61 Allow bootstrapping pwd_mkdb on Linux/macOS
We need to provide a struct passwd that is compatible with the target
system and this is not the case when cross-building from macOS/Linux.
It should also be a problem when bootstrapping for an i386 target from a
FreeBSD amd64 host since time_t does not match across those systems.
However, pwd_mkdb always truncates integer values to 32-bit so this
difference does not result in different databases.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D25931
2020-08-06 20:46:13 +00:00
Dimitry Andric
dd7660e5bd Fix clang 11 -Wformat warnings in yp_mkdb:
usr.sbin/yp_mkdb/yp_mkdb.c:91:40: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat]
                printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size,
                        ~~~~                         ^~~~~~~~
usr.sbin/yp_mkdb/yp_mkdb.c:92:7: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat]
                    data.data);
                    ^~~~~~~~~

MFC after:	3 days
2020-08-06 20:31:50 +00:00
Alexander Motin
8bdf81e4d1 Add CTL support for REPORT IDENTIFYING INFORMATION command.
It allows to report to initiator LU identifying information, preset via
"ident_info" and "text_ident_info" options.

Unfortunately it is impossible to implement SET IDENTIFYING INFORMATION,
since we have no persistent storage it requires, so the information is
read-only for initiator and has to be set out-of-band.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2020-08-06 19:16:11 +00:00
Mateusz Guzik
ec3b2a79b5 pmcstat: fix build on non-64 bit platforms 2020-08-05 20:42:08 +00:00
Mateusz Guzik
94e9ef85c5 pmcstat: implement showing offsets into symbols in top mode
The -I option (and hotkey) is reused for this. Skipping symbol resolution is
moved to the new -A option (and hotkey).

While arguably this violates POLA I think it's a change for the better.
ALso note the -I option was added in head.

Differential Revision:	https://reviews.freebsd.org/D21658
2020-08-05 19:05:49 +00:00
Eugene Grosbein
dca51295b2 bsnmptools: make it print protocol errors to stderr instead of stdout
Reviewed by:		syrinx, bz
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D25911
2020-08-05 09:19:41 +00:00
Gordon Bergling
3422ca83ba iovctl.conf(5): Use Lk macro for the URL of the UCL website
PR:		248334
Reported by:	chuck at tuffli dot net
Reviewed by:	bcr, 0mp
Approved by:	bcr, 0mp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25891
2020-08-04 11:13:13 +00:00
Alex Richardson
c4bd82d701 Allow bootstrapping mtree on Linux systems
Linux glibc has a dummy lchmod that always fails and emitting a linker
warning when used. Don't fail the build due to that warning when
bootstrapping by setting LD_FATAL_WARNINGS=no.

Reviewed By:	brooks, emaste
Differential Revision: https://reviews.freebsd.org/D25930
2020-08-03 18:08:10 +00:00
Peter Grehan
f1c3dac414 Replace magic numbers in Identify page register 0 with ATA definitions.
No functional change. Verified with objdump output before/after.

Requested by:	rpokala
Reviewed by:	rpokala
MFC after:	3 weeks
2020-07-31 12:10:28 +00:00
Alexander Motin
3b11655c7e When modifying LUN pass "special" options too.
Before switching to nvlists CTL merged previous and new options, so
any options not passed just kept previous value.  Now CTL completely
replaces them, so we must pass everything still relevant.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2020-07-28 22:32:50 +00:00
Yoshihiro Takahashi
8f11c99715 - Cleanups related to sparc64 removal.
- Remove remains of sparc64 files.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D25831
2020-07-28 10:58:37 +00:00
Mateusz Piotrowski
d421b01028 nologin.8: Improve wording
Reported by:	yuripv
Reviewed by:	bcr, yuripv
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D25814
2020-07-27 10:45:47 +00:00
Peter Grehan
9af3bcd7c9 Support the setting of additional AHCI controller parameters.
Allow the serial number, firmware revision, model number and nominal media
rotation rate (nmrr) parameters to be set from the command line.

Note that setting the nmrr value can be	used to	indicate the AHCI
device is an SSD.

Submitted by:	Wanpeng Qian
Reviewed by:	jhb, grehan (#bhyve)
Approved by:	jhb, grehan
MFC after:	3 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D24174
2020-07-27 07:56:55 +00:00
Juli Mallett
ce219ecd93 Remove reference to nlist(3) missed in SCCS revision 5.26 by mckusick
when converting rwhod(8) to using kern.boottime ather than extracting
the boot time from kernel memory directly.

Reviewed by:	imp
2020-07-24 16:58:13 +00:00
John-Mark Gurney
98b765e5c2 update example to make it active when creating a new boot method...
Clean up some of the sentences and grammar...

make igor happy..
2020-07-23 22:28:35 +00:00
Brooks Davis
e9b21d432b Correct a type-mismatch between xdr_long and the variable "bad".
Way back in r28911 (August 1997, CVS rev 1.22) we imported a NetBSD
information leak fix via OpenBSD.  Unfortunatly we failed to track the
followup commit that fixed the type of the error code.  Apply the change
from int to long now.

Reviewed by:	emaste
Found by:	CHERI
Obtained from:	CheriBSD
MFC after:	3 days
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D25779
2020-07-22 23:39:58 +00:00
Brooks Davis
d90b364147 Avoid reading one byte before the path buffer.
This happens when there's only one component (e.g. "/foo"). This
(mostly-harmless) bug has been present since June 1990 when it was
commited to mountd.c SCCS version 5.9.

Note: the bug is on the second changed line, the first line is changed
for visual consistency.

Reviewed by:	cem, emaste, mckusick, rmacklem
Found with:	CHERI
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D25759
2020-07-22 21:44:51 +00:00
Kyle Evans
ca7f7593ba pkg-bootstrap: complain on improper pkg bootstrap usage
Right now, the bootstrap will gloss over things like pkg bootstrap -x or
pkg bootstrap -f pkg. Make it more clear that this is incorrect, and hint
at the correct formatting.

Reported by:	jhb (IIRC via IRC)
Approved by:	bapt, jhb, manu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24750
2020-07-22 17:33:35 +00:00
Mark Johnston
ca19d0d78f traceroute6: Fix most warnings at the default WARNS level.
Fix some style issues as well.  Leave -Wno-cast-aligned set for now, as
most of the warnings come casts of CMSG_DATA(), which does provide
sufficient alignment in practice.

Submitted by:	Shubh Gupta <shubh@freebsd.org>
Sponsored by:	Google (GSOC 2020)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25603
2020-07-21 15:03:36 +00:00
Toomas Soome
6b8b1bfef0 efibootmgr: typo in long option name
del-timout should be del-timeout

Reported by:	mjg
MFC after:	1 week
2020-07-16 10:20:35 +00:00
Gregory Neil Shapiro
5b0945b570 Merge sendmail 8.16.1 to HEAD: See contrib/sendmail/RELEASE_NOTES for details
Includes build infrastructure & config updates required for changes in 8.16.1

MFC after:	5 days
2020-07-15 18:28:54 +00:00
Adrian Chadd
420306c3b7 [pmc] whoops, remove spurious #'s
pointed out by gonzo@, thanks!
2020-07-14 05:33:23 +00:00
Adrian Chadd
f8e66eb160 [hwpmc] Compile 'pmc' only if we have C++11.
I noticed when compiling with ye olde gcc-6.3.0 on mips that it tripped over
a lack of C++11 bits.  This allows it to compile fine.
2020-07-14 05:10:50 +00:00
Allan Jude
4cf6caac2f Actually install the new 221.backup-gpart periodic script
Submitted by:	Rob Fairbanks <rob.fx907@gmail.com>
Reported by:	Michael Butler <imb@protected-networks.net>
MFC with:	r363110
Sponsored by:	Klara Inc.
2020-07-14 00:46:20 +00:00
Gordon Bergling
aeeff830b9 arp(8) clarify the use of the '-a flag'
PR:		238146
Submitted by:	Andrew Stevenson <andrew at ugh dot net dot au>
Reported by:	Andrew Stevenson <andrew at ugh dot net dot au>
Reviewed by:	bcr (mentor)
Approved by:	bcr (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25645
2020-07-13 15:06:29 +00:00
Allan Jude
ce2fe5b109 Add a periodic script to backup the partition table and boot code
Optionally, alert you if the contents change from the previous backup

PR:		86388
Submitted by:	Rob Fairbanks <rob.fx907@gmail.com>, Miroslav Lachman <000.fbsd@quip.cz> (Original Version)
MFC after:	4 weeks
Relnotes:	yes
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
Differential Revision:	https://reviews.freebsd.org/D25628
2020-07-11 20:53:31 +00:00
Allan Jude
86e88c4f54 nscd: does not warn about invalid values what parsing config file
PR:		202135
Submitted by:	amutu@amutu.com
Reported By:	Trond.Endrestol@ximalas.info
Reviewed by:	markj, freqlabs
MFC after:	4 weeks
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
Differential Revision:	https://reviews.freebsd.org/D25627
2020-07-11 19:44:12 +00:00
Allan Jude
9d4c84dea4 ppp: Document the fact that ppp_nat is enabled by default
No functional change.

PR:		243062
Submitted by:	Evilham <contact@evilham.com> (original version)
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
Differential Revision:	https://reviews.freebsd.org/D25623
2020-07-11 18:24:16 +00:00
Allan Jude
c5acd3a091 bsdinstall: only kill the dhclient for the interface we are restarting
PR:		205821
Reported by:	mjg
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
2020-07-11 17:20:17 +00:00
Allan Jude
5b8d2467eb bsdinstall: don't fail if fstab is empty
PR:		210865
Submitted by:	Tim Lukasiewicz <eclipzetech08@gmail.com>, h-fujishima@sakura.ad.jp (original version)
Reported by:	h-fujishima@sakura.ad.jp
Reviewed by:	sef
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
2020-07-11 17:06:48 +00:00
Allan Jude
9a55656956 bsdinstall: kill dhclient before starting a new instance
PR:		205821
Submitted by:	William Orr <will@worrbase.com>
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Event:		July 2020 Bugathon
Differential Revision:	https://reviews.freebsd.org/D14572
2020-07-11 15:32:53 +00:00
Peter Grehan
fb5f5a17ef Advertise 64-bit physical-address capability.
This fixes a coredump with NetBSD guests when XHCI is configured.
On seeing the AC64 flag clear, the NetBSD XHCI driver was only writing
to the lower 32-bits of 64-bit physical address registers. The emulation
relies on a write to the hi 32-bits to calculate a host virtual address
for internal use, and has always supported 64-bit addressing.

All other guests were seen to write to both the lo- and hi- address
registers, regardless of the AC64 setting.

Discussed with:  Leon Dang (author)
Tested with:  Ubuntu 16/18/20, Windows10, OpenBSD UEFI guests.

MFC after:	2 weeks.
2020-07-10 07:26:50 +00:00
Cy Schubert
f329ac7dfb Enable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
hostapd and wpa_supplicant.

Submitted by:	bz
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Rubicon Communications, LLC (d/b/a "Netgate")
2020-07-09 23:01:36 +00:00
Takanori Watanabe
2105611236 Add le_rand command.
PR: 247808
Submitted by: Marc Veldman
2020-07-08 03:57:47 +00:00
Peter Grehan
6a7ff0600b Silence ACPI RTC error/warning in Linux guests.
Allow guests to	set the	RTC bit	in the ACPI PM control register.
This eliminates an annoying	(and harmless) Linux kernel boot message.

PR:	244721
Submitted by:	Jose Luis Duran
MFC after:	1 week
2020-07-06 08:36:14 +00:00
Alexander Motin
ebc22d0495 Decode APEI tables (BERT, EINJ, ERST, HEST).
MFC after:	2 weeks
2020-06-30 21:40:34 +00:00
Gordon Bergling
32100375a6 iovctl(8): Correct a typo in the manpage and correct the SYNOPSIS
PR:	246831
Submitted by:	Jose Luis Duran <jlduran at gmail dot com>
Reviewed by:	bcr (mentor)
Approved by:	bcr (mentor)
MFC after:	7 days
2020-06-30 17:21:28 +00:00
Edward Tomasz Napierala
3d10bf72ef Fix misplaced voltages/temperatures labels in 'sesutil show'.
PR:		bin/247384
Reported by:	brd
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25353
2020-06-30 16:49:43 +00:00
Kyle Evans
70448a5414 mailwrapper: switch mailer.conf to CONFS
This matches what was already being done in dma(8), and should again make
this merge with etcupdate/mergemaster.

Reported by:	jhb
2020-06-29 18:06:00 +00:00
Chuck Tuffli
0ed1d2e484 bhyve: fix NVMe Active Namespace list
The NVMe specification requires unused entries in the Identify, Active
Namespace ID data to be zero. Fix is bzero the provided page, similar to
what is done for the Namespace Descriptors list.

Fixes UNH Tests 2.6 and 2.9

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24901
2020-06-29 00:32:24 +00:00
Chuck Tuffli
a104b18c52 bhyve: NVMe handle zero length DSM ranges
Dataset Management range specifications may have a zero length (a.k.a.
an empty range definition). Handle the case of all ranges being empty by
completing with Success (DSM commands are advisory only). For
Deallocate, skip empty range definitions when sending TRIM's to the
backing storage.

Fixes UNH Test 2.2.4

Reviewed by:	imp
Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24900
2020-06-29 00:32:21 +00:00
Chuck Tuffli
7669ea7bb0 bhyve: fix NVMe Get Features, Predictable Latency
If the Predictable Latency Mode is not supported, NVMe Controllers must
return Invalid Field in Command status for the Get Features command
with IDs:
 - Predictable Latency Mode Config
 - Predictable Latency Mode Window

Fixes UNH Tests 3.6

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24899
2020-06-29 00:32:18 +00:00
Chuck Tuffli
f97ed15123 bhyve: add NVMe Feature Interrupt Vector Config
This adds support for NVMe Get Features, Interrupt Vector Config
parameter error checking done by the UNH compliance tests.

Fixes UNH Tests 1.6.8 and 5.5.6

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24898
2020-06-29 00:32:15 +00:00
Chuck Tuffli
46ea627374 bhyve: add basic NVMe Firmware Commit support
This commit updates the Identify Controller data to advertise the
Controller supports a single firmware slot and that firmware slot 1 is
read-only. Additionally, it returns an "Invalid Firmware Slot" error
when the host issues any Firmware Commit command (a.k.a. Firmware
Activate).

Fixes UNH Test 5.5.3

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24897
2020-06-29 00:32:11 +00:00
Chuck Tuffli
106329ef33 bhyve: Add AER support to NVMe emulation
This adds support to bhyve's NVMe device emulation for processing Async
Event Requests but not returning them (i.e. Async Event Notifications).

Fixes UNH Test 5.5.2

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24896
2020-06-29 00:32:08 +00:00
Chuck Tuffli
8bba8666e2 bhyve: validate the NVMe LBA start and count
Add checks that the combination of Starting LBA and Number of Logical
Blocks in a command will not exceed the range of the underlying storage.

Note that because NVMe specifices the Starting LBA as a uint64_t, care
must be taken when converting it and the block count to avoid an integer
overflow.

Fixes UNH Tests 2.2.3, 2.3.2, and 2.4.2

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24895
2020-06-29 00:32:04 +00:00
Chuck Tuffli
7d248cffd9 bhyve: implement NVMe SMART data I/O statistics
SMART data in NVMe includes statistics for number of read and write
commands issued as well as the number of "data units" read and written.
NVMe defines "data unit" as thousands of 512 byte blocks (e.g. 1 data
unit is 1-1,000 512 byte blocks, 3 data units are 2,001-3,000 512 byte
blocks).

This patch implements counters for:
 - Data Units Read
 - Data Units Written
 - Host Read Commands
 - Host Write Commands
and exposes the values when the guest reads the SMART/Health Log Page.

Fixes UNH Test 1.3.8

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24894
2020-06-29 00:32:01 +00:00
Chuck Tuffli
ae638f2bd5 bhyve: validate NVMe deallocate range values
For NVMe emulation, validate the Data Set Management LBA ranges do not
exceed the capacity of the backing storage. If they do, return an "LBA
Out of Range" error.

Fixes UNH Test 2.2.3

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24893
2020-06-29 00:31:58 +00:00
Chuck Tuffli
73cd73c0b8 bhyve: base pci_nvme_ioreq size on advertised MDTS
NVMe controllers advertise their Max Data Transfer Size (MDTS) to limit
the number of page descriptors in an I/O request. Take advantage of this
and size the struct pci_nvme_ioreq accordingly.

Ensuring these values match both future-proofs the code and allows
removing some complexity which only exists to handle this possibility.

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24891
2020-06-29 00:31:54 +00:00
Chuck Tuffli
206edceb73 bhyve: refactor NVMe I/O read/write
Split the NVM I/O function (i.e. nvme_opc_write_read) into separate
functions - one for RAM based backing-store and another for disk based
backing-store for easier maintenance. No functional changes.

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24890
2020-06-29 00:31:51 +00:00
Chuck Tuffli
a0900f46d1 bhyve: implement NVMe Format NVM command
The Format NVM command mainly allows the host to specify the block size
and protection information used for the Namespace. As the bhyve
implementation simply maps the capabilities of the backing storage
through to the guest, there isn't anything to implement. But a side
effect of the format is the NVMe Controller shall not return any data
previously written (i.e. erase previously written data). This patch
implements this later behavior to provide a compliant implementation.

Fixes UNH Test 1.6

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24889
2020-06-29 00:31:47 +00:00
Chuck Tuffli
45cf82682c bhyve: make unsupported NVMe commands a debug message
Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24888
2020-06-29 00:31:44 +00:00
Chuck Tuffli
e3ebd4210a bhyve: add more compliant NVMe Get/Set Features
Create a generic Get/Set Features by saving off the contents of CDW11
from the Set command and returning the saved value in the completion of
the Get command. Implementation allows providing optional implementation
for both Set and Get.

Add infrastructure to determine which feature ID's are namespace
specific and flag violations of this category of error.

Also adds the feature specific behavior of Set Features, Number of
Queues to only allow this command once per Controller reset.

Fixes UNH Tests 1.2, 5.4, and 5.5.6

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24887
2020-06-29 00:31:41 +00:00
Chuck Tuffli
d708ced617 bhyve: fix NVMe queue creation and deletion
Add checks for various types of invalid I/O Queue Create and Delete
command parameters, including:
 - QID=0
 - QID>MAX
 - QID already in use
 - Delete an Active CQ
 - Invalid QSIZE
 - Invalid CQID (SQ creation)
 - Invalid interrupt vector (CQ creation)

Fixes UNH Tests 1.4.2-5,7-8

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24886
2020-06-29 00:31:37 +00:00
Chuck Tuffli
f6f02911b6 bhyve: fix NVMe Get Log Page command
Fix the logic in nvme_opc_get_log_page to calculate the number of DWORDS
(uint32_t) instead of WORDS (uint16_t) for the byte length. And only
return the allowed number of Log Page bytes as determined by the user
request and actual size of the requested log page.

Fixes UNH Test 1.3

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24885
2020-06-29 00:31:34 +00:00
Chuck Tuffli
f8fa74679c bhyve: implement NVMe Namespace Identification Descriptor
NVMe 1.3 compliant controllers must implement the Namespace
Identification Descriptor structure (i.e. CNS=3). Previously this was
unimplemented.

Fixes UNH Test 1.1.4-0

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24884
2020-06-29 00:31:30 +00:00
Chuck Tuffli
064ca48f57 bhyve: Consolidate NVMe CQ update
Consolidate the code which writes Completion Queue entries and updates
the CQ doorbell value. While in the neighborhood, convert the "toggle CQ
phase bit" code to use an XOR operation instead of an "if/else" branch.

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24882
2020-06-29 00:31:27 +00:00
Chuck Tuffli
d7e180feb7 bhyve: add locks around NVMe queue accesses
The NVMe code attempted to ensure thread safety through a combination of
using atomics and a "busy" flag. But this approach leads to unavoidable
race conditions.

Fix is to use per-queue mutex locks to ensure thread safety within the
queue processing code. While in the neighborhood, move all the queue
initialization code to a common function.

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D19841
2020-06-29 00:31:24 +00:00
Chuck Tuffli
cf20131a15 bhyve: add a comment explaining NVME dsm option
Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24881
2020-06-29 00:31:20 +00:00
Chuck Tuffli
9963f1805c bhyve: implement NVMe Flush command
This adds support for the NVMe I/O command Flush. For block-based
devices, submit a DIOCGFLUSH to the backing storage. Otherwise, command
is treated like a NOP and completes with a Successful status.

Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24880
2020-06-29 00:31:17 +00:00
Chuck Tuffli
a43ab8d253 bhyve: refactor NVMe IO command handling
This refactors the NVMe I/O command processing function to make adding
new commands easier. The main change is to move command specific
processing (i.e. Read/Write) to separate functions for each NVMe I/O
command and leave the common per-command processing in the existing
pci_nvme_handle_io_cmd() function.

While here, add checks for some common errors (invalid Namespace ID,
invalid opcode, LBA out of range).

Add myself to the Copyright holders

Reviewed by:	imp
Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24879
2020-06-29 00:31:14 +00:00
Chuck Tuffli
0220a2aeed bhyve: convert NVMe logging statements
Convert the debug and warning logging macros to be parameterized and
correctly use bhyve's PRINTLN macro.

Reviewed by:	imp
Tested by:	Jason Tubnor
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24878
2020-06-29 00:31:11 +00:00
Mateusz Piotrowski
f36e950b9b Do not use macros in the argument to -width
This patch improves the presentation of the FILES section dramatically.

MFC after:	2 weeks
2020-06-28 22:04:52 +00:00
Adrian Chadd
016bac89db [fifolog] wrap the recno when we hit the end of the provided file size.
Without this the log just keeps growing to infinity.

Reviewed by:	phk
Differential Revision:	https://reviews.freebsd.org/D25478
2020-06-28 06:52:39 +00:00
Warner Losh
643d5ca3d6 Chroot first appeared in 4.3-Reno, not in 4.4 in the BSD world,
but in System III in the AT&T world.

Examination of the TUHS archives shows this was present in 4.3-Reno
and System III.

Reviewed by: 0mp@, allanjude@
MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D25479
2020-06-26 22:23:15 +00:00
Cy Schubert
1264cc08ff Add MATCH option for CONFIG_MATCH_IFACE.
If the interfaces on which wpa_supplicant is to run are not known or do
not exist, wpa_supplicant can match an interface when it arrives. Each
matched interface is separated with -M argument and the -i argument now
allows for pattern matching.

As an example, the following command would start wpa_supplicant for a
specific wired interface called lan0, any interface starting with wlan
and lastly any other interface. Each match has its own configuration
file, and for the wired interface a specific driver has also been given.

wpa_supplicant \
	-M -c wpa_wired.conf -ilan0 -D wired \
	-M -c wpa1.conf -iwlan* \
	-M -c wpa2.conf

PR:		247177
Reported by:	greg@unrelenting.technology
MFC after:	1 month
Related to:	ports r540412
2020-06-26 14:18:08 +00:00
Peter Grehan
71ab6f9708 Prevent calling USB backends multiple times.
The TRB processing loop could potentially call a back-end twice
with the same status transaction. While this was generally benign,
some code paths in the tablet backend weren't set up to handle
this case, resulting in a NULL dereference.

Fix by
 - returning a STALL error when an invalid request was seen in the backend
 - skipping a call to the backend if the number of packets in a status
   transaction was zero (this code fragment was taken from the Intel ACRN
   xhci backend)

PR:	246964
Reported by:  Ali Abdallah
Discussed with: Leon Dang (author)
Reviewed by: jhb (#bhyve), Leon Dang
Approved by: jhb
Obtained from:  Intel ACRN (partially)
MFC after: 2 weeks
Differential Revision:	https://reviews.freebsd.org/D25228
2020-06-26 08:20:38 +00:00
Pawel Biernacki
0a1016f9e8 bhyve: allow for automatic destruction on power-off
Introduce -D flag that allows for the VM to be destroyed on guest initiated
power-off by the bhyve(8) process itself.
This is quality of life change that allows for simpler deployments without
the need for bhyvectl --destroy.

Requested by:	swills
Reviewed by:	0mp (manpages), grehan, kib, swills
Approved by:	kib (mentor)
MFC after:	2 weeks
Sponsored by:	Mysterious Code Ltd.
Differential Revision:	https://reviews.freebsd.org/D25414
2020-06-25 12:35:20 +00:00
Conrad Meyer
4daa95f85d bhyve(8): For prototyping, reattempt decode in userspace
If userspace has a newer bhyve than the kernel, it may be able to decode
and emulate some instructions vmm.ko is unaware of.  In this scenario,
reset decoder state and try again.

Reviewed by:	grehan
Differential Revision:	https://reviews.freebsd.org/D24464
2020-06-25 00:18:42 +00:00
Jung-uk Kim
d836a9dbe3 Fix build with recent byacc. 2020-06-24 02:08:08 +00:00
Cy Schubert
767173cec2 MFV r362565:
Update 4.2.8p14 --> 4.2.8p15

Summary: Systems that use a CMAC algorithm in ntp.keys will not release
a bit of memory on each packet that uses a CMAC keyid, eventually causing
ntpd to run out of memory and fail. The CMAC cleanup from
https://bugs.ntp.org/3447, part of ntp-4.2.8p11, introduced a bug whereby
the CMAC data structure was no longer completely removed.

MFC after:	3 days
Security:	NTP Bug 3661
2020-06-24 01:51:05 +00:00
Li-Wen Hsu
bfd735d96e Revert r362390, those tests are fixed by r362418
PR:		247425
Sponsored by:	The FreeBSD Foundation
2020-06-23 19:14:38 +00:00
Piotr Pawel Stefaniak
3cbfd5815b pstat(8): improve the Size header width after r358181
All size values use fields of width 8. Also, all other headers use fields of
width 8. Make the Size header added in r358181 use 8 characters as well.
2020-06-23 18:19:22 +00:00
Tom Jones
a10f71c53a pkg: Provide a friendlier message when bootstrap fails due to address resolution
The current message when bootstapping pkg fails for any reason implies that pkg
is not available. We have the error code from fetch so if bootstrap failed due
to address resolution say so.

Reviewed by:    bapt, bz
Approved by:    bz (co-mentor)
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D25323
2020-06-23 15:14:54 +00:00
Mateusz Piotrowski
a97dcd5966 Fix a typo and sort options
MFC after:	1 week
2020-06-23 10:56:15 +00:00
Baptiste Daroussin
5b990a9463 Revert r362466
Such change should not have happen without prior discussion and review.

With hat:	transitioning core
2020-06-22 07:46:24 +00:00
Hans Petter Selasky
7747001b12 Improve wording to be more precise and clear.
No functional change intended.

s/Master Boot/Main Boot/ (also called MBR)

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-06-21 13:34:08 +00:00
Kirk McKusick
972670e132 Allocate an fs_summary_info structure when creating a UFS filesystem
needed since introduced in -r362358.

PR:           247425
Sponsored by: Netflix
2020-06-19 23:32:40 +00:00
Brandon Bergren
37f530582d [PowerPC] De-giant powermac_nvram, update documentation
* Remove the giant lock requirement from powermac_nvram.
* Update manual pages to reflect current state.

Reviewed by:	bcr (manpages), jhibbits
Sponsored by:	Tag1 Consulting, Inc.
Differential Revision:	https://reviews.freebsd.org/D24812
2020-06-19 18:36:10 +00:00
Li-Wen Hsu
865c7b713c Skip ufs related tests in fstyp(8) and makefs(8) temporarily
They are failing after r362358 and r362359.

PR:		247425
Sponsored by:	The FreeBSD Foundation
2020-06-19 17:32:30 +00:00
Kirk McKusick
34816cb9ae Move the pointers stored in the superblock into a separate
fs_summary_info structure. This change was originally done
by the CheriBSD project as they need larger pointers that
do not fit in the existing superblock.

This cleanup of the superblock eases the task of the commit
that immediately follows this one.

Suggested by: brooks
Reviewed by:  kib
PR:           246983
Sponsored by: Netflix
2020-06-19 01:02:53 +00:00
Mateusz Piotrowski
377d7c417a Fix the --guid flag description
MFC after:	2 weeks
2020-06-18 12:29:24 +00:00
Mateusz Piotrowski
aa1f87cb62 Improve periodic(8) manual page presentation
- Update synopsis to present all available arguments.
- Consistently call the argument specifying an arbitrary directory a
  "directory".
- Do not put macros into -width argument to Bl. They do not expand there.
- Stylize command modifiers like "daily" with Cm instead of Pa. While
  technically periodic(8) operates on directories with such names, it is
  confusing from the perspective of the manual page reader as Pa and Ar are
  stylized the same way. Also, I cannot recall a single manual page where
  Pa would be used to describe the syntax of command-line arguments.

MFC after:	2 weeks
2020-06-18 10:52:51 +00:00
Juli Mallett
e9de7669c3 Improve unit parsing of mpsutil.
Previously, it used atoi(3) to parse the unit parameter, which would silently
yield a unit of 0 in the presence of an invalid unit number.  As most users of
mpsutil(8) are likely to have at least a unit 0, this is could have confusing
results.

This behaviour was particularly unintuitive if one incorrectly passed an
adapter device name, or a device path, instead of a unit number.  In addition
to using strtoumax(3) instead of atoi(3) to parse unit numbers, support
stripping a device name (e.g. mps1) or path (e.g. /dev/mps2) to just its unit
number.

Reviewed by:	scottl (earlier version)
2020-06-16 19:21:28 +00:00
Eugene Grosbein
01cf0a1724 newsyslog(8): make configuration parser more robust.
Currently newsyslog supports <include> directive that is used
in our default /etc/newsyslog.conf in the following form:

<include> /usr/local/etc/newsyslog.conf.d/*

While this is suitable for ports installing their own rules
for logs rotation, this also makes newsyslog break entire
processing of all files if it encounters single line it cannot parse.
This includes lines referring to nonexistent username/group for log
ownership, so newsyslog stops calling errx() function in the parser.

With this fix, newsyslog uses warnx() instead of errx() in such cases
to print a warning, recover gracefully and continue with execution.

Among other cases, this unbreaks initial creation of log files
having flag "C" at boot time (newsyslog -CN). This is most important
for systems having RAM-based /var file system like nanobsd(8)-based
that rely on newsyslog to bring system log files into existence.

MFC after:	1 month
2020-06-16 17:45:23 +00:00
Rick Macklem
3e2d36ffa6 Make use of the UID_NOBODY and GID_NOGROUP definitions in sys/conf.h.
r362214 exposed UID_NOBODY and GID_NOGROUP to userspace, so use them
instead of the numbers.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D25281
2020-06-16 02:35:30 +00:00
Toomas Soome
e7fd9688ea Move font related data structured to sys/font.c and update vtfontcvt
Prepare support to be able to handle font data in loader, consolidate
data structures to sys/font.h and update vtfontcvt.

vtfontcvt update is about to output set of glyphs in form of C source,
the implementation does allow to output compressed or uncompressed font
bitmaps.

Reviewed by:	bcr
Differential Revision:	https://reviews.freebsd.org/D24189
2020-06-14 06:58:58 +00:00
Rick Macklem
cc5efdde94 Modify mountd to use the new struct export_args committed by r362158.
r362158 modified struct export_args for make the ex_flags field 64bits
and also changed the anonymous credentials to allow more than 16 groups.
This patch fixes mountd.c to use the new structure.
It does allocate larger exportlist and grouplist structures now.
That will be fixed in a future commit.
The only visible change will be that the credentials provided for the
-maproot and -mapall exports options can now have more than 16 groups.

Reviewed by:	kib, freqlabs
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D25088
2020-06-14 00:40:00 +00:00