Commit Graph

18695 Commits

Author SHA1 Message Date
Hans Petter Selasky
7b2f84db82 Put advertising data in correct place.
Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245848
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-25 00:57:48 +00:00
Kyle Evans
2b17527cea freebsd-update: rehash certs
With the inclusion of caroot bits, we'll need to also rehash on update as we
do in mergemaster/etcupdate.

If certctl's installed on the system, just unconditionally rehash. This
isn't an expensive operation, and we can refine it to compare
INDEX-{OLD,NEW} later if we really want to.

Reviewed by:	emaste, allanjude
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D21805
2020-04-25 00:14:17 +00:00
Hans Petter Selasky
f75d5ee735 Rename two commands to match the Bluetooth specification in hccontrol(8).
Fix some bad spelling while at it.

Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245868
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-24 14:53:55 +00:00
Hans Petter Selasky
c3f60abc30 Add support for LE advertising to hccontrol(8).
Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245848
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-24 08:07:59 +00:00
Allan Jude
9d433cb875 trim(8): candelete() returns wrong results because fd is opened O_WRONLY
This was discovered while using trim(8) to test bhyve trim

Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D24371
2020-04-23 20:14:59 +00:00
Allan Jude
22769bbe30 Add VIRTIO_BLK_T_DISCARD (TRIM) support to the bhyve virtio-blk backend
This will advertise support for TRIM to the guest virtio-blk driver and
perform the DIOCGDELETE ioctl on the backing storage if it supports it.

Thanks to Jason King and others at Joyent and illumos for expanding on
my original patch, adding improvements including better error handling
and making sure to following the virtio spec.

Submitted by:	Jason King <jason.king@joyent.com> (improvements)
Reviewed by:	jhb
Obtained from:	illumos-joyent (improvements)
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D21707
2020-04-23 19:20:58 +00:00
Hans Petter Selasky
1719371ae5 Add support for Read_Local_Supported_Commands command to hccontrol(8).
Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245811
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-22 14:38:39 +00:00
Mateusz Piotrowski
77d208a3ae Improve formatting of synopsis section
This patch is about sorting the arguments and using proper mdoc(7) macros
to stylize arguments and command modifiers for much better readability.

Further style fixes in other sections within the bhyve manual page are
going to be worked on in upcoming patches.

Reviewed by:	rgrimes
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24526
2020-04-22 06:32:51 +00:00
Hans Petter Selasky
872d83be7b Update string tables in hccontrol(8).
Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245796
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-21 17:51:54 +00:00
Hans Petter Selasky
21eefd310a Substitute le_read_supported_status with le_read_supported_states.
Refer to bluetooth core v5.2 specifications Vol4. Part E. 7.8.27.

PR:		245763
Submitted by:	Marc Veldman <marc@bumblingdork.com>
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-20 13:44:14 +00:00
Hans Petter Selasky
6cf6c1510d Fix cut and paste off-by-one error in hccontrol(8).
Make sure strncpy() doesn't write beyond its given buffer.

PR:		245739
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-19 14:25:56 +00:00
Hans Petter Selasky
ea01149104 Improve printing of le features in hccontrol(8).
Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245739
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-19 14:22:21 +00:00
Hans Petter Selasky
3bc36313e4 Bring HCI error messages up-to-date.
See Bluetooth v5.6 core specification Vol.1 Part F: Controller error codes.

Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245737
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-19 10:24:15 +00:00
Rick Macklem
3c49a19fc9 Change the type of "len" to avoid warnings.
The "len" variable is used as the last argument to getsockname(2) and
accept(2). It was declared an "int" and this patch changes it to "socklen_t".
2020-04-18 23:46:58 +00:00
Hans Petter Selasky
6f80a2c88e Add missing feature descriptions to hci_features2str().
The list of possible features in hccontrol/features2str() is incomplete.
Refer to "Bluetooth Core Specification 5.2 Vol. 2 Part C. 3.3 Feature Mask Definition".

Submitted by:	Marc Veldman <marc@bumblingdork.com>
PR:		245354
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-04-18 08:29:16 +00:00
Eugene Grosbein
4e49fbcd37 jail(8): improve manual and usage information with more clear
description for "jail -e" mode to show that it does not take
additional jail name argument.

Reported by:		David Marec <david.marec@davenulle.org>
MFC after:		3 days
2020-04-17 10:12:11 +00:00
Scott Long
3859e5c3c6 Add support for some IOCFacts fields that are available with mpr (12Gb)
controllers.  It's ugly due to the single codebase for mpr and mps and
not being able to share their respective headers.
2020-04-16 04:17:06 +00:00
Scott Long
39e2d6bc38 Don't keep a private copy of mpr_ioctl.h and mps_ioctl.h, since they
easily get out of sync with the real files from the driver.
2020-04-16 03:33:46 +00:00
Xin LI
02371ceb33 Sync with NetBSD/OpenBSD. 2020-04-16 03:23:19 +00:00
Mateusz Piotrowski
1565e1889a Fix a typo
Reported by:	rgrimes
MFC with:	359967
2020-04-15 17:11:44 +00:00
Mateusz Piotrowski
6f2b877647 Document the exit status and the stdout message of nologin(8)
Reviewed by:	debdrup (earlier version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D24196
2020-04-15 13:13:46 +00:00
Conrad Meyer
38e6153f75 bhyve(8): Correct copyright boilerplate for r359950
Use the text from the canonical sys/copyright.h 2-clause FreeBSD License.

Reported by:	grehan (thanks!)
2020-04-15 05:55:14 +00:00
Conrad Meyer
52c39ee643 bhyve(8): Minor cosmetic niceties in instemul failure
Print the failed instruction stream as a contiguous stream of hex.  This
is closer to something you could throw at a disassembler than 0xHH 0xHH
0xHH.

Also, use the debug.h 'raw' stdio-aware printf helper to avoid the
cascading
         line
             effect.
2020-04-15 02:34:44 +00:00
Conrad Meyer
9cb339cc7b bhyve(8): Add VM Generation Counter ACPI device
Add an implementatation of the 'Virtual Machine Generation ID' spec to
Bhyve.  The spec provides a randomly generated GUID (at bhyve start) in
device memory, along with an ACPI device with _CID VM_Gen_Counter and ADDR
evaluating to a Package pointing at that GUID.

A GPE is defined which Notifies the ACPI Device when the generation changes
(such as when a snapshot is rolled back).  At this time, Bhyve does not
support snapshotting, so the GPE is never actually raised.

Suggested by:	rpokala
Discussed with:	grehan
Differential Revision:	https://reviews.freebsd.org/D23165
2020-04-15 02:00:17 +00:00
Conrad Meyer
bb30b08e76 bhyve(8): Add bootrom allocation abstraction
To allow more general use of the bootrom region, separate initialization from
allocation, and allocation from loading a file.

The bootrom segment is the high 16MB of the low 4GB region.

Each allocation in the segment creates a new mapping with specified protection.
By default, allocation begins at the low end of the range.  However, the
BOOTROM_ALLOC_TOP flag is provided to locate a provided bootrom in the high
region it is expected to be in.

The existing ROM-file loading code is refactored to use the new interface.

Reviewed by:	grehan (earlier version)
Differential Revision:	https://reviews.freebsd.org/D24422
2020-04-15 01:58:51 +00:00
Chris Rees
1d3500e065 Add mention of wireless option in bsdconfig
Submitted by:		debdrup
Approved by:		dteske (maintainer)
Differential Revision:	https://reviews.freebsd.org/D24378
2020-04-12 20:54:35 +00:00
Jason A. Harmening
31de6cad17 config(8): use sbuf to manage line buffers
PR:	245476
Reported by:	kevans
Reviewed by:	imp, kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24373
2020-04-12 02:42:42 +00:00
Emmanuel Vadot
19602a3869 gpioctl: Print interrupts capabilities
GPIO drivers who supports interrupts report them in the caps
(obtain via the getcaps method) but gpioctl doesn't know
how to interpret this and print "UNKNOWN" for each one of them.
Even if we don't have userland gpio interrupts support for now
let gpioctl print the supported caps.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D24133
2020-04-11 15:25:40 +00:00
John Baldwin
ba10a6d08c Remove the -o option from gssd(8).
This uses DES and the kernel no longer supports DES for in-kernel GSS.

Reviewed by:	kp
Relnotes:	yes
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D24345
2020-04-10 23:10:28 +00:00
Rodney W. Grimes
9d3fd86663 In the past changes have been made to smbios->minor without updating the
smbios->bcdrev value.
Correct that by calculating bcdrev from the major/minor values.

Reported by:	bcran
Reviewed by:	bcran, jhb
Approved by:	jhb (maintainer)
2020-04-07 23:17:44 +00:00
Aleksandr Fedorov
1ff57e3a25 Add VIRTIO_NET_F_MTU flag support for the bhyve virtio-net device.
The flag can be enabled using the new 'mtu' option:
bhyve -s X:Y:Z,virtio-net,[tapN|valeX:N],mtu=9000

Reported by:	vmaffione, jhb
Approved by:	vmaffione (mentor)
Differential Revision:	https://reviews.freebsd.org/D23971
2020-04-07 17:06:33 +00:00
Kyle Evans
610acef538 config(8): "fix" a couple of buffer overflows
Recently added/changed lines in various kernel configs have caused some
buffer overflows that went undetected. These were detected with a config
built using -fno-common as these line buffers smashed one of our arrays,
then further triaged with ASAN.

Double the sizes; this is really not a great fix, but addresses the
immediate need until someone rewrites config. While here, add some bounds
checking so that we don't need to detect this by random bus errors or other
weird failures.

MFC after:	3 days
2020-04-07 14:14:59 +00:00
Maxim Sobolev
a8b8edb25e Normalize deployment tools usage and definitions by putting into one place
instead of sprinkling them out over many disjoint files. This is a follow-up
to achieve the same goal in an incomplete rev.348521.

Approved by:	imp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D20520
2020-04-07 02:46:22 +00:00
Kyle Evans
3a166b3323 yp*: fix -fno-common build
This is mostly two problems spread out far and wide:
- ypldap_process should be declared properly
- debug is defined differently in many programs

For the latter, just extern it and define it everywhere that actually needs
it. This mostly works out nicely for ^/libexec/ypxfr, which can remove the
assignment at the beginning of main in favor of defining it properly.

-fno-common will become the default in GCC10/LLVM11.

MFC after:	3 days
2020-04-06 23:16:05 +00:00
Kyle Evans
f5339b097a adduser: allow standard IFS characters in passwords
Notably, the default IFS contains space/tab, thus any leading/trailing
whitespace characters tend to be removed.

Set IFS= for just the read lines to mitigate this, allowing the user to be
less surprised when their leading/trailing spaces weren't actually captured
in the password as they are with other means of setting a user's password.

PR:		245342
Submitted by:	dereks_lifeofadishwasher.com
Reviewed by:	jilles
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24292
2020-04-05 19:25:46 +00:00
Brooks Davis
415a606e17 pmc: diable position-independent builds, they fail to link on amd64
PR:		245189
Reported by:	Gordon Bergling
Sponsored by:	DARPA
2020-04-03 16:10:42 +00:00
Edward Tomasz Napierala
28930b94b2 Stop hardcoding WARNS in uefisign(8).
MFC after:	2 weeks
Sponsored by:	DARPA
2020-04-01 15:10:26 +00:00
Edward Tomasz Napierala
1e89ef5dc1 Stop hardcoding WARNS in iscsid(8).
MFC after:	2 weeks
Sponsored by:	DARPA
2020-04-01 15:09:52 +00:00
Edward Tomasz Napierala
981e04778f Stop hardcoding WARNS in automount(8) et al.
MFC after:	2 weeks
Sponsored by:	DARPA
2020-04-01 15:08:13 +00:00
Andrew Turner
3a142cd10c Use memmove to copy within a buffer
jail(8) would try to use strcpy to remove the interface from the start of
an IP address. This is undefined, and on arm64 will result in unexpected
IPv6 addresses.

Fix this by using memmove top move the string.

PR:		245102
Reported by:	sbruno
MFC after:	2 weeks
Sponsored by:	Innovate UK
2020-04-01 09:51:29 +00:00
Vincenzo Maffione
2bec4e57e1 valectl: fix typo in man page
Submitted by:	Jose Luis Duran
MFC after:	3 days
2020-03-31 16:47:15 +00:00
Edward Tomasz Napierala
7fcbecd004 Add 'ctld -t', to test configuration file validity.
Reviewed by:	mav, allanjude, bcr (man pages)
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D23792
2020-03-31 13:43:09 +00:00
Rebecca Cran
e23fe873b2 Bhyve: fix SMBIOS Type 17 table generation
According to the SMBIOS specification (revision 2.7 or newer), the
extended module size field should only be used for sizes that can't
fit in the older size field.

Reviewed by:	rgrimes, grehan, jhb
Differential Revision:	https://reviews.freebsd.org/D24107
2020-03-31 02:36:39 +00:00
Ed Maste
b4b880cb6d correct 'disble' typo in hccontrol
PR:		245125
Submitted by:	Marc Veldman
MFC after:	1 week
2020-03-30 17:38:13 +00:00
Kyle Evans
89c7bb5613 cron: respect PATH from login.conf
As a followup to the use of login.conf environment vars (other than PATH) in
cron, this patch adds PATH (and HOME) to the list of login.conf settings
respected.

The new logic is as follows:

1. SHELL is always _PATH_BSHELL unless explicitly overridden in the crontab
file itself; no other settings are respected. This is unchanged.

2. PATH is taken from the first of: crontab file, login.conf, _PATH_DEFPATH

3. HOME is taken from the first of: crontab file, login.conf, passwd entry,
unset

4. The current directory for invoking the command is taken from the crontab
file's value of HOME (existing behavior), or the passwd entry, but not
anywhere else (so it might not equal HOME if that was set in login.conf).

Submitted by:	Andrew Gierth <andrew_tao173.riddles.org.uk>
Reviewed by:	sigsys_gmail.com
Differential Revision:	https://reviews.freebsd.org/D23597
2020-03-30 03:26:52 +00:00
Kyle Evans
a33e986417 config(8): fixes for -fno-common
Move this handful of definitions into main.c, properly declare these as
extern in config.h. This fixes the config(8) build with -fno-common.

Unexplained in my previous commit to gas, -fno-common will become the
default in GCC10 and LLVM11, so it's worth addressing these in advance.

MFC after:	3 days
2020-03-28 04:02:00 +00:00
Chuck Tuffli
1264a2b909 bhyve: fix NVMe emulation update of SQHD
The SQHD field of a Completion Queue entry indicates the current
Submission Queue head pointer value. The head pointer represents the
next entry to be consumed and is updated after consuming the current
entry.

In the Admin queue processing, the current code updates the head pointer
after reporting the value to the host via the SQHD. This gives the
impression that the Controller is perpetually one command behind in its
processing of the Admin SQ. And while this doesn't appear to bother some
initiators, it is wrong.

Fix is to update the SQ head pointer prior to writing the SQHD value in
the completion.

While here, fix missed update of dword 0 (cdw0) in the completion
message.

Reported by:	khng300
Reviewed by:	jhb, imp
Approved by:	jhb (maintainer)
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24083
2020-03-27 15:28:27 +00:00
Chuck Tuffli
961be12f6a bhyve: fix NVMe emulation missed interrupts
The bhyve NVMe emulation has a race in the logic which generates command
completion interrupts. On FreeBSD guests, this manifests as kernel log
messages similar to:
    nvme0: Missing interrupt

The NVMe emulation code sets a per-submission queue "busy" flag while
processing the submission queue, and only generates an interrupt when
the submission queue is not busy.

Aside from being counter to the NVMe design (i.e. interrupt properties
are tied to the completion queue) and adding complexity (e.g. exceptions
to not generating an interrupt when "busy"), it causes a race condition
under the following conditions:
 - guest OS has no outstanding interrupts
 - guest OS submits a single NVMe IO command
 - bhyve emulation processes the SQ and sets the "busy" flag
 - bhyve emulation submits the asynchronous IO to the backing storage
 - IO request to the backing storage completes before the SQ processing
   loop exits and doesn't generate an interrupt because the SQ is "busy"
 - bhyve emulation finishes processing the SQ and clears the "busy" flag

Fix is to remove the "busy" flag and generate an interrupt when the CQ
head and tail pointers do not match.

Reported by:	khng300
Reviewed by:	jhb, imp
Approved by:	jhb (maintainer)
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24082
2020-03-27 15:28:22 +00:00
Chuck Tuffli
f3e46ff932 bhyve: use STAILQ in NVMe emulation
Use the standard queue(3) macros instead of hand-crafted linked list
code.

Reviewed by:	imp, jhb
Approved by:	jhb (maintainer)
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D24081
2020-03-27 15:28:16 +00:00
Chuck Tuffli
cd65e08916 bhyve: implement NVMe deallocate command
This adds support for the Dataset Management (DSM) command to the NVMe
emulation in general, and more specifically, for the deallocate
attribute (a.k.a. trim in the ATA protocol). If the backing storage for
the namespace supports delete (i.e. deallocate), setting the deallocate
attribute in a DSM will trim/delete the requested LBA ranges in the
underlying storage.

Reviewed by:	jhb, araujo, imp
Approved by:	jhb (maintainer)
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D21839
2020-03-27 15:28:11 +00:00
Chuck Tuffli
d31d525ef5 bhyve: refactor NVMe namespace initialization
Pass the struct pci_nvme_blockstore pointer for this namespace to the
namespace initialization function instead of only the desired eui64
value.

Minor functional change in that the code updates the eui64 value in the
blockstore.

Reviewed by:	jhb, araujo
Approved by:	jhb (maintainer)
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D21838
2020-03-27 15:28:05 +00:00
Chuck Tuffli
da8de3e9a8 bhyve: refactor NVMe PRP memcpy
Add a "copy direction" parameter to nvme_prp_memcpy such that data can
be copied to the memory specified by the PRP entries (current behavior)
or copied from the PRP entries (new behavior). The upcoming deallocate
functionality will use the copy from capability.

Reviewed by:	jhb, araujo
Approved by:	jhb (maintainer)
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D21837
2020-03-27 15:28:00 +00:00
Andrey V. Elsukov
ccf8b02c94 Fix typo.
MFC after:	2 weeks
2020-03-26 12:00:26 +00:00
Andrey V. Elsukov
7d367c51c8 Add property-based filters for syslogd.
Property-based filters allow substring and regular expressions
(see re_format(7)) matching against various message attributes.
Filter specification starts with '#:' or ':' followed by three
comma-separated fields property, operator, "value". Value must be
double-quoted. A double quote and backslash must be escaped by a
blackslash.

Following properties are supported as test value:
o msg - body of the message received;
o programname - program name sent the message;
o hostname - hostname of message's originator;
o source - an alias for hostname.

Supported operators:
o contains - true if filter value is found as a substring of property;
o isequal - true if filter value is equal to property;
o startswith - true if property starts with filter value;
o regex - true if property matches basic regular expression defined
    in filter value;
o ereregex - true if property matches extended regular expression
    defined in filter value;

Operator may be prefixed by '!' to invert compare logic or by
'icase_' to make comparison function case insensitive.

Submitted by:	Boris N. Lytochkin <lytboris at gmail com>
MFC after:	2 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D23468
2020-03-26 11:54:25 +00:00
Simon J. Gerraty
53f151f906 Fix pkgfs stat so it satisfies libsecureboot
We need a valid st_dev, st_ino and st_mtime
to correctly track which files have been verified
and to update our notion of time.

ve_utc_set(): ignore utc if it would jump our current time
by more than VE_UTC_MAX_JUMP (20 years).

Allow testing of install command via userboot.
Need to fix its stat implementation too.

bhyveload also needs stat fixed - due to change to userboot.h

Call ve_error_get() from vectx_close() when hash is wrong.

Track the names of files we have hashed into pcr

For the purposes of measured boot, it is important
to be able to reproduce the hash reflected in
loader.ve.pcr
so loader.ve.hashed provides a list of names in the order they
were added.

Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Juniper Networks
Differential Revision:	https://reviews.freebsd.org//D24027
2020-03-25 19:12:19 +00:00
Emmanuel Vadot
ee55186dfd pmc: Add include path for libpmcstat as it is an internallib
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D24173
2020-03-25 01:32:16 +00:00
Emmanuel Vadot
e055e3367e wlandebug: Add include path for libifconfig as it is a internallib
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D24172
2020-03-25 01:31:26 +00:00
Sergio Carlavilla Delgado
cdb51c125a Correct path in EXAMPLES ypldap.conf.5
PR:		244743
Submitted by:	alex@i.org.ua
Patch by:	alex@i.org.ua
Approved by:	bcr@(mentor), 0mp
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D24144
2020-03-24 19:12:28 +00:00
Mark Johnston
4c8f64714a newsyslog: Add fallthrough comments to appease Coverity.
CID:		1008165, 1008166, 1008167
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-03-24 18:17:10 +00:00
Mark Johnston
13d1902439 Add regression tests for newsyslog.conf's p flag.
While here do a bit of cleanup:
- declare local variables as such,
- make tmpdir_create() clean up logfile directories, to handle a
  previously interrupt test run more gracefully.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2020-03-24 18:16:56 +00:00
Mark Johnston
faff7ddb00 newsyslog: Fix stack corruption when initializing a zipwork structure.
This happens when compressing a previously uncompressed already-rotated
file, as happens when handling the 'p' flag in newsyslog.conf.  The file
name is stored in a flexible array member, so these structures cannot be
stack allocated.

Also make sure that we call change_attrs() and do_zipwork() in dry-run
mode; they handle this properly, contrary to the commit log message for
r327451.

CID:		1008168
Github PR:	https://github.com/freebsd/freebsd/pull/427
MFC after:	2 weeks
Submitted by:	Radek Brich (original version)
2020-03-24 18:16:36 +00:00
Emmanuel Vadot
8daefe0081 auditdistd: Remove useless linking with libl 2020-03-24 07:08:39 +00:00
Baptiste Daroussin
4ce887ccc8 Remove useless linking to libl 2020-03-23 14:44:23 +00:00
Baptiste Daroussin
a75f9261d6 pw: do not removed home directories if not owned
When deleting a user, if its home directory does not belong to it, it should
not be removed. This is the promise that the manpage makes, the tool should
ensure that it respects that promise.

Add a regression test about it

PR:		244967
Submitted by:	Eric Hanneken <eric@erichanneken.com>
MFC after:	3 days
2020-03-23 08:23:22 +00:00
Scott Long
e1ae0ee172 When printing out the contents of the VSEC, include the contents of the
headers.  Device documentation often times give offsets relative to the
start of the entire VSEC, not just the post-header data area, so this
change makes it easier to correlate offsets.
2020-03-20 23:26:37 +00:00
Cy Schubert
b323455767 PACKAGE_STRING should be the same as PACKAGE_VERSION.
MFC after:	3 days
2020-03-18 22:14:25 +00:00
Rebecca Cran
a717adb5a0 Bhyve: log message when rfb client connects
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D24098
2020-03-18 03:17:15 +00:00
Rebecca Cran
cbd7ddcf65 Bhyve: DPRINTF already includes newline, so don't add another
Reviewed by:	jhb, vmaffione, emaste
Differential Revision:	https://reviews.freebsd.org/D24099
2020-03-18 03:15:57 +00:00
Ryan Moeller
797711a84f libpmcstat: Try /boot/modules if module not found
Modules from ports/pkg are commonly installed to /boot/modules rather than to
the same directory the kernel resides in.  Look there if a module is not found
next to the kernel.

Submitted by:	mmacy
Reported by:	Nick Principe <nap@iXsystems.com>
Approved by:	mmacy (mentor)
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2020-03-12 23:04:40 +00:00
Pedro F. Giffuni
68983a2bc7 style(9): Fix space after #define.
No functional change.
2020-03-12 03:56:54 +00:00
Ed Maste
13f7dbe822 retire amd(8)
autofs was introduced with FreeBSD 10.1 and is the supported method for
automounting filesystems.  As of r296194 the amd man page claimed that it
is deprecated.  Remove it from base now; the sysutils/am-utils port is
still available if necessary.

Discussed with:	cy
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2020-03-09 20:46:43 +00:00
Cy Schubert
2d4e511ca2 MFV r358616:
Update ntp-4.2.8p13 --> 4.2.8p14.

The advisory can be found at:
http://support.ntp.org/bin/view/Main/SecurityNotice#\
March_2020_ntp_4_2_8p14_NTP_Rele

No CVEs have been documented yet.

MFC after:	now
Security:	http://support.ntp.org/bin/view/Main/NtpBug3610
		http://support.ntp.org/bin/view/Main/NtpBug3596
		http://support.ntp.org/bin/view/Main/NtpBug3592
2020-03-04 21:45:12 +00:00
Mateusz Piotrowski
98b486dc7a powerd.8: Improve style & fix typos
- Sort options.
- Do not use macros (like .Ar) to specify width for Bl (macros within that
  string are not expanded).
- Use Cm instead of Ar for mode names.
- Fix some typos reported by mandoc.
- Move the documentation of the PID file from the -P flag description to
  the FILES section.

Approved by:	bcr (mentor)
Differential Revision:	https://reviews.freebsd.org/D23941
2020-03-03 13:25:08 +00:00
Conrad Meyer
fd1efedc79 Add extremely useful calendar(1) application to FreeBSD
It does extremely useful things like execute sendmail and spew dubiously
accurate factoids.

From the feedback, it seems like it is an essential utility in a modern unix
and not at all a useless bikeshed.  How do those Linux people live without it?
Reverts r358561.
2020-03-03 00:20:08 +00:00
Conrad Meyer
3c565de33f Fix typo in r278616
FreeBSD isn't an encyclopedia.
2020-03-02 23:37:47 +00:00
Colin Percival
d91382866f Add -N option to powerd(8) to ignore "nice" time.
With powerd_flags="-N", this makes powerd(8) exclude "nice" time when
computing the CPU utilization.  This makes it possible to prevent
CPU-intensive "background" processes from spinning up the CPU.

Note that only *userland* CPU usage belonging to "nice" processes is
excluded; we do not track whether time spent in the kernel is on behalf
of nice or non-nice processes, so kernel-intensive nice processes can
still result in the CPU being sped up.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D23868
2020-02-29 22:31:23 +00:00
Pedro F. Giffuni
c92671e108 /etc/services: attempt to bring the database to this century 1/2.
This is the result of splitting r358153 in two, in order to avoid a build
system bug and being able to merge the change to previous releases..

Document better this file, updating the URL to the IANA registry and closely
match the official services.

For system ports (0 to 1023) we now try to follow the registry closely, noting
some historical differences where applicable.

As a side effect: drop references to unofficial Kerberos IV which was EOL'ed
on Oct 2006[1]. While it is conceivable some people may still use it in some
very old FreeBSD machines that can't be replaced easily, the use of it is
considered a security risk. Also drop the unofficial netatalk, which we
supported long ago in the kernel but was dropped long ago.

Leave for now smtps, even though it conflicts with IANA's submissions.
The change should have very little visibility, if any, but should be a
step closer to the current IANA database.

[1] https://web.mit.edu/kerberos/krb4-end-of-life.html

MFC after:	2 weeks
2020-02-28 20:43:35 +00:00
Philip Paeps
762f1f6b68 bsdinstall: remove the Italian mirror
ftp.it.FreeBSD.org has been down for several years.

PR:             244481
Reported by:    xgeoplasma6@gmail.com
MFC after:      3 days
2020-02-28 03:39:00 +00:00
Philip Paeps
52bae46390 bsdconfig: remove the Italian mirror
ftp.it.FreeBSD.org has been down for several years.

PR:             244481
Reported by:    xgeoplasma6@gmail.com
MFC after:      3 days
2020-02-28 03:38:57 +00:00
John Baldwin
98ee12e64e Use stream_read() to read all 12 bytes of the RFB client version.
read() can return a short read, whereas stream_read() waits until the
full version string is read.

Submitted by:	Ka Ho Ng <khng300_gmail.com>
Reviewed by:	grehan
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23591
2020-02-27 16:51:41 +00:00
Warner Losh
f33a95bc86 Create ../compile
Give up the battle to keep extra files in $MACHINE/compile to keep the file in
the tree. Instead, create CDIR (usually ../compile) if it doesn't exist when
we're using a default build location (eg, not using -d). If it does, we do
nothing. This only affects people that do old-school builds, but it's bit me a
dozen times since last summer so time to fix the bug.
2020-02-24 16:41:16 +00:00
Warner Losh
6e773df698 Bump CONFIGVERS to 600017.
This change reflects the ability to change machine_arch in a config file. This
is useful for including one config in another and changing the machine_arch
in the second one.
2020-02-23 23:39:55 +00:00
Warner Losh
9bcb741864 Relax machine directives a little.
Currently, you can have multiple machine directives if they are otherwise
identical. Relax this so that only the machinename part is the same. This allows
one to change the machine arch in a different config file you've included easily.
2020-02-23 23:36:56 +00:00
Edward Tomasz Napierala
125de8263a Fix formatting for tps values between 99.95 and 99.99; previously
it would display as "100.0", breaking vertical alignment.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D23538
2020-02-21 20:57:32 +00:00
Christian S.J. Peron
9a990500e5 - Implement -h (human readable) for the size of the underlying block disk.
Currently, the size of the swap device is unconditionally reported using
  blocks, even if -h has been used.
- While here, switch to CONVERT_BLOCKS() instead of CONVERT() which will
  avoid overflowing size counters (in human readable form see: r196244)
- Update the column headers to reflect that a size is being reported instead
  of the block size units being used

Before:

$ swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/gpt/swapfs   1048576        0  1048576     0%
$

After:

$ swapinfo -h
Device           Size     Used    Avail Capacity
/dev/gpt/swapfs    1.0G       0B     1.0G     0%
$

Differential Revision:	https://reviews.freebsd.org/D23758
Reviewed by:	kevans
MFC after:	3 weeks
2020-02-20 21:12:10 +00:00
Vincenzo Maffione
f92bb8c19a bhyve: enable virtio-net mergeable rx buffers for tap(4)
This patch adds a new netbe_peek_recvlen() function to the net
backend API. The new function allows the virtio-net receive code
to know in advance how many virtio descriptors chains will be
needed to receive the next packet. As a result, the implementation
of the virtio-net mergeable rx buffers feature becomes efficient,
so that we can enable it also with the tap(4) backend. For the
tap(4) backend, a bounce buffer is introduced to implement the
peeck_recvlen() callback, which implies an additional packet copy
on the receive datapath. In the future, it should be possible to
remove the bounce buffer (and so the additional copy), by
obtaining the length of the next packet from kevent data.

Reviewed by:    grehan, aleksandr.fedorov@itglobal.com
MFC after:      1 week
Differential Revision:	https://reviews.freebsd.org/D23472
2020-02-20 21:07:23 +00:00
Konstantin Belousov
f1bbdf8709 Print out some newly added PCIe extended capabilities and subclasses.
Taken from
https://pcisig.com/sites/default/files/files/PCI_Code-ID_r_1_11__v24_Jan_2019.pdf

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2020-02-20 17:10:25 +00:00
Pedro F. Giffuni
edff1c29d3 Revert r358153: it is causing unexpected issues with the build system. 2020-02-20 15:52:36 +00:00
Xin LI
151004e2bc Bump PROTOMAX.
MFC after:	3 weeks
X-MFC-with:	r358153
2020-02-20 06:03:41 +00:00
Pedro F. Giffuni
74eb8d905b /etc/services: attempt bring the database to this century.
Document better this file, updating the URL to the IANA registry and closely
match the official services.

For system ports (0 to 1023) we now try to follow the registry closely, noting
some historical differences where applicable.
For the User ports (1024 - 49151) we try to keep some sensible balance only
of services that are likely to be found on FreeBSD/UNIX systems. This attempts
to strike a balance between complexity and usefulness.

As a side effect: drop references to unofficial Kerberos IV which was EOL'ed
on Oct 2006[1]. While it is conceivable some people may still use it in some
very old FreeBSD machines that can't be replaced easily, the use of it is
considered a security risk. Also drop the unofficial netatalk, which we
supported long ago in the kernel but was dropped long ago.

[1] https://web.mit.edu/kerberos/krb4-end-of-life.html

MFC after:	3 weeks (likely to 12-stable only)
Differential Revision:	https://reviews.freebsd.org/D23621
2020-02-20 03:54:07 +00:00
Sergio Carlavilla Delgado
8209febbb3 Add some HISTORY sections to manpages
environ(7) was in AT&T Version 7
ac(8): Add a HISTORY section
sa(8): Add a HISTORY section
sqrt(3): Add the actual sqrt function to the HISTORY section

Obtained from: OpenBSD

Submitted by:	gbergling@gmail.com
Approved by:	bcr@(mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23693
2020-02-19 12:49:49 +00:00
Hiroki Sato
294de6bbd6 Add _BIX (Battery Information Extended) object support.
ACPI Control Method Batteries have a _BIF and/or _BIX object which
provide static properties of the battery.  FreeBSD acpi_cmbat module
supported _BIF object only, which was deprecated as of ACPI 4.0.
_BIX is an extended version of _BIF defined in ACPI 4.0 or later.

As of writing, _BIX has two revisions.  One is in ACPI 4.0 (rev.0) and
another is in ACPI 6.0 (rev.1).  It seems that hardware vendors still
stick to _BIF only or _BIX rev.0 + _BIF for the maximum compatibility.
Microsoft requires _BIX rev.0 for Windows machines, so there are some
laptop machines with _BIX rev.0 only. In this case, FreeBSD does not
recognize the battery information.

After this change, the acpi_cmbat module gets battery information from
_BIX or _BIF object and internally uses _BIX rev.1 data structure as
the primary information store in the kernel.  ACPIIO_BATT_GET_BI[FX]
returns an acpi_bi[fx] structure built by using information obtained
from a _BIF or a _BIX object found on the system.  The revision number
field can be used to check which field is available.  The acpiconf(8)
utility will show additional information if _BIX is available.

Although ABIs of ACPIIO_BATT_* were changed, the existing APIs for
userland utilities are not changed and the backward-compatible ABIs
are provided.  This means that older versions of acpiconf(8) can also
work with the new kernel. The (union acpi_battery_ioctl_arg) was
padded to 256 byte long to avoid another ABI change in the future.
A _BIX object with its revision number >1 will be treated as
compatible with the rev.1 _BIX format.

Reviewed by:	takawata
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23728
2020-02-19 06:28:55 +00:00
Kyle Evans
946966d161 certctl(8): switch to install(1) to fix DESTDIR support
"Oops" - ln(1) is fine and dandy, but when you're using DESTDIR...it's not-
the path will almost certainly be invalid once the root you've just
installed to is relocated, perhaps to /.

Switch to install(1) using `-l rs` to calculate the relative symlink between
the two, which should work just fine in all cases.

MFC after:	1 week
2020-02-19 02:34:56 +00:00
Konstantin Belousov
3b7a70d990 pciconf: List names of all known extended PCIe capabilities.
Some ids are redundand because the list_ecaps() function decodes them
by explicit switch case.  But listing them all makes it easier to not
miss ecaps, while not changing the functionality.

Initial submission by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2020-02-17 13:31:30 +00:00
Konstantin Belousov
5a6d45d015 bhyve, bhyvectl: Add Hygon Dhyana support.
Submitted by:	Pu Wen <puwen@hygon.cn>
Reviewed by:	jhb
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D23554
2020-02-13 19:05:14 +00:00
Pedro F. Giffuni
66343a7bb2 Revert r357343:
services: Add PROFInet and EtherCAT.

Both are admitedly very niche features and no known users exist currently.
I am doing a further review/update of the services file (see D23621) and
both of these are not likely to be considered.
2020-02-13 15:42:14 +00:00
Alan Somers
f05cc0f136 sesutil: fix Coverity CIDs
* 1411604: file descriptor leak
* 1411586: memory leaks, null dereference on ENOMEM

Reported by:	Coverity Scan
Coverity CIDs:	1411604, 1411586
Reviewed by:	trasz
MFC after:	2 weeks
Sponsored by:	Axcient
Differential Revision:	https://reviews.freebsd.org/D23651
2020-02-13 15:28:56 +00:00
Vincenzo Maffione
66c662b005 bhyve: move virtio-net header processing to pci_virtio_net
This patch cleans up the API between the net frontends (e1000,
virtio-net) and the net backends (tap and netmap).
We move the virtio-net header stripping/prepending to the
virtio-net code, where this functionality belongs.
In this way, the netbe_send() and netbe_recv() signatures
can have const struct iov * rather than struct iov *.

Reviewed by:	grehan, bcr, aleksandr.fedorov@itglobal.com
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23342
2020-02-12 22:44:18 +00:00
Ed Maste
e5a2b63146 tag /etc/rmt symlink with pkgbase package
For historical reasons the "remote magtape protocol module" rmt gets
invoked as /etc/rmt, which is a symlink to /usr/sbin/rmt.  Put it in the
utilities package, as /usr/sbin/rmt is.

Sponsored by:	The FreeBSD Foundation
2020-02-12 17:30:09 +00:00
Kyle Evans
e9104c3142 backup-passwd: mask out all passwords in the diff
The previous expression borked if a username had a plus or hyphen in it.
This is needlessly restrictive- at leSt a hyphen in the middle is valid.
Instead of playing this game, let's just assume the username can't contain a
colon and mask out the second field.

Submitted by:	sigsys gmail com
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D23548
2020-02-11 06:12:02 +00:00
Warner Losh
5b2df92a39 Use __riscv instead of __riscv__
I misread arch(7) when I added this...

Noticed by: jhb@ and mhorne@
2020-02-10 18:28:02 +00:00
Warner Losh
0d3f465b5d Remove ifdefs for ia64 and sparc64.
Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593
2020-02-10 17:17:08 +00:00
Warner Losh
6666787858 Refresh architecture list with latest:
Remove: sparc, sparc64 (twice), ia64, alpha
Add: riscv64

Remove now-useless sparc64 ifdef

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593
2020-02-10 17:17:03 +00:00
Warner Losh
28e7a2a9f1 Remove sparc64 specific eeprom command
This command was only ever for sparc64, so remove it. Remove
usr.sbin/Makeiile.sparc64 as well since it only references ofwdump
(cross platform) and eeprom.

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593
2020-02-10 17:16:59 +00:00
Warner Losh
31719b4962 For valid arch values (really $MACHINE), remove references to alpha
and sparc64. Add references to arm64 and riscv

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593
2020-02-10 17:16:54 +00:00
Warner Losh
0d94b31ad3 Fix a comment for the SUN geom class.
Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593
2020-02-10 17:16:50 +00:00
Warner Losh
f8f33808c0 Fix comment. It mentioned sparc64 specifically, but alignment issues
are present elsewhere.

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593
2020-02-10 17:16:45 +00:00
Warner Losh
7047dceee3 Remove sparc64 ifdef
Now we default to setting the hardware clock to UTC
everywhere. sparc64 was the old odd-man out before.

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593
2020-02-10 17:16:41 +00:00
Warner Losh
d2299c69ff Remove sparc64 example.
Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593
2020-02-10 17:16:26 +00:00
Kyle Evans
1709a13c7c cron(8): rip out do_univ
This was an old Dynix hack, the function is a NOP on FreeBSD. We have no
need to retain this; Dynix was discontinued long ago.
2020-02-10 02:44:29 +00:00
Kyle Evans
9b36723388 cron(8): convert vfork() usage to fork()
vfork() is error-prone, and the usage here definitely grew to not be
clearly OK given vfork-semantics; e.g. setusercontext(3) within the child.

Rip out vfork() and the rest of the references to it. fork is heavier, but
it's unclear that the difference will be all that obvious.

Reported by:	Andrew Gierth and sigsys@gmail.com
2020-02-10 02:40:23 +00:00
Ed Maste
5aa0576b33 Miscellaneous typo fixes
Submitted by:	Gordon Bergling <gbergling_gmail.com>
Differential Revision:	https://reviews.freebsd.org/D23453
2020-02-07 19:53:07 +00:00
Scott Long
69e85eb8ae Advertise the MPI Message Version that's contained in the IOCFacts message
in the sysctl block for the driver.  mpsutil/mprutil needs this so it can
know how big of a buffer to allocate when requesting the IOCFacts from the
controller.  This eliminates the kernel console messages about wrong
allocation sizes.

Reported by:	imp
2020-02-07 12:15:39 +00:00
Scott Long
b041593ae7 Touch up some of the iocfacts fields 2020-02-07 11:48:26 +00:00
Mateusz Piotrowski
89be2c1ee3 Improve documentation of bootconfig and PARTITIONS
- Mention bootconfig target in TARGETS section.
- Document PARTITIONS variable, which is only mentioned in the examples,
  but doesn't have its own point.

Submitted by:	arrowd@
Reviewed by:	bcr
Approved by:	bcr (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D22927
2020-02-06 20:18:45 +00:00
Pedro F. Giffuni
9d529ed898 fstyp: sync HAMMER1/2 detection support with DragonFly BSD.
Submitted by:	Tomohiro Kusumi
PR:		243929
2020-02-06 18:04:15 +00:00
Luca Pizzamiglio
19bb4570ea mixer: call the cleanup function in a test
The set_empty_value test has a cleanup function, but is not called.
Fix it

Reviewed by:	0mp
Approved by:	kp
Differential Revision:	https://reviews.freebsd.org/D23498
2020-02-06 14:31:29 +00:00
Kyle Evans
7466dbd684 cron(8): set the environment variables of the user and/or login class
Prior to processing environment variable set in the crontab file as those
should be of higher precedent, pull in the user or login class environment.

This is another supporting feature for allowing one to configure system-wide
settings that may affect both regular cron jobs as well as services.

This is the final part of D21481.

Submitted by:	Andrew Gierth <andrew_tao173.riddles.org.uk>
2020-02-05 04:35:54 +00:00
Kyle Evans
736a5a6d1d service(8): set the environment of the "daemon" class before invoking
As mentioned in r357562, this gives the user a single place to configure
environment variables that need to be used for various services -- the
"daemon" class -- for, e.g., configuring a system-wide HTTP proxy.

This is a part of D21481.

Submitted by:	Andrew Gierth <andrew_tao173.riddles.org.uk>
2020-02-05 04:32:49 +00:00
Kyle Evans
504613f246 Remove simple_httpd
simple_httpd was granted a reprieve from the picobsd removal based on having
some reported user; it turns out this user isn't actually using the version
in base and merging their changes would be difficult at this point, so the
version in base will simply continue to rot. Retire it now, it may make a
comeback to ports with the improved version.

No notice issued because its current visibility has only been for ~3
months, and a notice has been previously issued about picobsd removal.
2020-02-04 21:27:39 +00:00
Pedro F. Giffuni
1cbd36ae1f services: Add PROFInet and EtherCAT.
Both are used in industrial networks.

MFC after:	1 week
2020-01-31 18:55:21 +00:00
Dimitry Andric
31868fab28 Merge r357339 from the clang1000-import branch:
Fix the following -Werror warning from clang 10.0.0 in bsnmpd:

usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1661:4: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                        return (-1);
                        ^
usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1658:5: note: previous statement is here
                } else
                  ^

The intent was to group the return statement with the previous syslog()
call.

MFC after:	3 days
2020-01-31 18:13:00 +00:00
Dimitry Andric
303c0aad7d Fix the following -Werror warning from clang 10.0.0 in bsnmpd:
usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1661:4: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                        return (-1);
                        ^
usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1658:5: note: previous statement is here
                } else
                  ^

The intent was to group the return statement with the previous syslog()
call.

MFC after:	3 days
2020-01-31 18:09:27 +00:00
Brooks Davis
10dd04d39f Fix an indentation bug in r357169. 2020-01-30 18:34:08 +00:00
Dimitry Andric
3fd49cf90e Fix the following -Werror warning from clang 10.0.0 in bsnmpd:
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c:1235:43: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
                            begemotBridgeStpPortEnable_enabled ||
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

Work around it by casting the enum values to the type of val->v.integer.

MFC after:	3 days
2020-01-29 21:40:35 +00:00
Conrad Meyer
446bb222fb ypldap(8): Fix absent va_end() in 'goto fail' path
In this path, we used va_start() without pairing it with va_end().  Add the
va_end().  (va_start() without paired va_end() is undefined behavior per the C
standard.)

"In many implementations, [va_end] is a do-nothing operation; but those
implementations that need it probably need it badly." - Rationale for the ANSI
C Programming Language, § 4.8.1.3.

Reported by:	Coverity
CID:		1340539
2020-01-29 05:59:22 +00:00
Ben Woods
595373dd64 bsdinstall: Provide help text for partitioning options
Includes commentary of when ZFS works well by default (>= 8GB RAM),
and where to go for information on ZFS tuning if required.

Also hoist the options text to the top of script as variables
(will help with future international translations).

Reviewed by:	philip, dteske, karels, imp, emaste
Approved by:	rgrimes
Differential Revision:	https://reviews.freebsd.org/D23224
2020-01-27 22:45:49 +00:00
Alex Richardson
162ae9c834 Allow bootstrapping makefs on older FreeBSD hosts and Linux/macOS
In order to do so we need to install the msdosfs headers to the bootstrap
sysroot and avoid includes of kernel headers that may not exist on every
host (e.g. sys/lockmgr.h). This change should allow bootstrapping of makefs
on FreeBSD 11+ as well as Linux and macOS.

We also have to avoid using the IO_SYNC macro since that may not be
available. In makefs it is only used to switch between calling
bwrite() and bdwrite() which both call the same function. Therefore we
can simply always call bwrite().

For our CheriBSD builds we always bootstrap makefs by setting
LOCAL_XTOOL_DIRS='lib/libnetbsd usr.sbin/makefs' and use the makefs binary
from the build tree to create a bootable disk image.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D23201
2020-01-27 12:02:41 +00:00
Adrian Chadd
ab95087a0e [ntp] Don't compile in the ssl routines into libevent if MK_OPENSSL is no
Most of ntpd still handles MK_OPENSSL ok, but the libevent import brought
in the SSL bufferevent routines without checking MK_OPENSSL.

This doesn't completely fix WITHOUT_CRYPTO=YES building, but hey, it's one
less broken thing.
2020-01-24 06:24:40 +00:00
Cy Schubert
5a00480bb9 Fix build when WITHOUT_WPA_SUPPLICANT_EAPOL option used.
The build failure was discoved by Michael Dexter's recent Build Options
Survey run, at https://callfortesting.org/results/bos-2020-01-16/\
WITHOUT_WPA_SUPPLICANT_EAPOL-small.txt.

Reported by:	Michael Dexter <editor@callfortesting.org> via emaste
MFC after:	2 weeks
2020-01-21 20:21:52 +00:00
Ben Woods
2d482628aa Fix regression in bsdinstall post r356740 - partedit errno(2) 21 EISDIR
This resulted in the partitioning step failing if either of the
"Auto (UFS)" or "Manual" options were selected.

Reason: partedit was attempting to open a directory (TMPDIR) read/write,
which resulted in errno(2) 21 - EISDIR - Is a directory.

Reported by:	Clay Daniels <clay.daniels.jr@gmail.com>
Reviewed by:	Ryan Moeller <ryan@freqlabs.com>
Approved by:	emaste, bcran
Differential Revision:	https://reviews.freebsd.org/D23232
2020-01-17 22:26:41 +00:00
Kristof Provost
d8ffc21c5c Fix pfdenied not returning any results
When _a is empty we end up with an invalid invocation of pfctl, and no output.
We must add quotes to make it clear to pfctl that we're passing an empty anchor
name.

PR:		224415
Submitted by:	sigsys AT gmail.com
MFC after:	2 weeks
2020-01-16 22:08:05 +00:00
Alan Somers
1137d1a7e5 setextattr: Increase stdin buffer size to 4096
Extended attribute values can potentially be quite large. One test for ZFS
is supposed to set a 200MB xattr. However, the buffer size for reading
values from stdin with setextattr -i is so small that the test times out
waiting for tiny chunks of data to be buffered and appended to an sbuf.

Increasing the buffer size should help alleviate some of the burden of
reallocating larger sbufs when writing large extended attributes.

Submitted by:	Ryan Moeller <ryan@freqlabs.com>
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D23211
2020-01-16 21:31:56 +00:00
Scott Long
92471f7ab7 Fix a spacing error from the previous commit for -ll mode. Add a little
more space padding to that mode to give the columns a consistent offset.
2020-01-15 16:47:44 +00:00
Ben Woods
d512033e2a bsdinstall: Change "default" (first) Partitioning method to ZFS
Reported by:	Ruben Schade (during his talk at linux.conf.au)
Approved by:	philip
Differential Revision:	https://reviews.freebsd.org/D23173
2020-01-15 07:47:52 +00:00
Rebecca Cran
a107ddbb83 bsdinstall: Use TMPDIR if set
Submitted by:	Ryan Moeller <ryan@freqlabs.com>
Reviewed by:	bcran, Nick Wolff <darkfiberiru@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D22979/
2020-01-15 00:45:05 +00:00
Eric van Gyzen
5a12815327 fstyp hammer2: remove dead code
best_i will always be >= 0, so remove code to test otherwise.

Reported by:	Coverity
CID:		1412244
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D23159
2020-01-13 22:36:29 +00:00
Eric van Gyzen
0ab52bd3eb fstyp hammer: use strlcpy
Use strlcpy to guarantee NUL termination.  Due to this, there is
no need for strncmp; simply use strcmp.

Reported by:	Coverity
CID:		1412242
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D23159
2020-01-13 22:33:48 +00:00
Cy Schubert
6692aa840c Unbound's config.h is manually maintained, using a ./configure produced
config.h as a guide. In practice contributed software maintains a copy
of config.h within its build directory tree containing its Makefile.
usr.sbin/unbound is the home for its config.h.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22983
2020-01-13 06:55:31 +00:00
Kyle Evans
6486ccfe2f camdd: initialize devs earlier
GCC9 points out that devs may be used initialized after the bailout label;
in-fact, if num_io_opts != 2 then it is. Move the initialization up a little
bit.

Reviewed by:	ken
MFC after:	3 days
2020-01-10 22:20:23 +00:00
Kyle Evans
525c896ba8 inetd: two more nits
Use __COPYRIGHT for copyright to simply either embed it via .ident or have
it properly marked __unused

Move an ipsec reference to IPSEC
2020-01-10 14:43:57 +00:00
Kyle Evans
36cac5570f inetd: free WITHOUT_INET6_SUPPORT build of warnings
If inetd is compiled without inet6 support, we need to error out on
rpc+inet6 services rather than attempting to call into rpc bits with an
uninitialized netid.

v4bind is only used with INET6 support, so move it under the proper #ifdefs
with v6bind.

Reported by:	Pavel Timofeev <timp87 gmail com>
MFC after:	3 days
2020-01-10 14:40:04 +00:00
Eugene Grosbein
693d381624 arp(8): avoid segfaulting due to out-of-bounds memory access
Fix obvious mistake that sometimes results in reading memory
past end of an array.

PR:		240825
MFC after:	1 week
2020-01-09 11:58:26 +00:00
Vincenzo Maffione
332eff95e3 bhyve: add wrapper for debug printf statements
Add printf() wrapper to use CR/CRLF terminators depending on whether
stdio is mapped to a tty open in raw mode.
Try to use the wrapper everywhere.
For now we leave the custom DPRINTF/WPRINTF defined by device
models, but we may remove them in the future.

Reviewed by:	grehan, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D22657
2020-01-08 22:55:22 +00:00
Maxim Konovalov
4a3c7e6718 o Spell "Redundancy" and "Remember" correctly.
PR:		243187
Submitted by:	mikael.urankar@gmail.com (partially)
2020-01-08 14:01:15 +00:00
Ed Maste
9a3e2f583f inetd: fix WITHOUT_TCP_WRAPPERS build after r356248
After increasing WARNS, building WITHOUT_TCP_WRAPPERS failed because of
some unused variables.

Reported by:	Cirrus-CI (against my WIP branch)
MFC with:	r356248
Sponsored by:	The FreeBSD Foundation
2020-01-03 15:29:32 +00:00
Scott Long
eb51967b50 Add a compact columnar output format, available by specifying a second '-l'
command line option.  Thanks to the removal of unnecessary information and
the organization into columns, this helps the output be more legible on
both 80 column displays and non-80 column displays.  imp@ provided the
idea on this.
2020-01-02 06:56:28 +00:00
Kyle Evans
705d79b4bd inetd: final round of trivial cleanup, NFC
Highlights:
- Use MAX() for maxsock raising; small readability improvement IMO
- malloc(3) + memset(3) -> calloc(3) where appropriate
- stop casting the return value of malloc(3)
- mallloc(3) -> reallocarray(3) where appropriate

A future change may enter capability mode when forking for some of the
built-in handlers.
2020-01-01 18:49:57 +00:00
Kyle Evans
c8863d0590 inetd: convert remaining bzero(3) to memset(3), NFC
This change is purely in the name of noise reduction from static analyzers
that want to complain that bzero(3) is obsolete in favor of memset(3).

With this, clang-analyze at least is now noise free. WARNS= 6 also appears
to have been OK for some time now, so drop the current setting and opt for
the default.
2020-01-01 04:29:08 +00:00
Kyle Evans
c53b0f40f3 inetd: track all child pids, regardless of maxchild spec
Currently, child pids are only tracked if maxchildren is specified. As a
consequence, without a maxchild limit we do not get a notice in syslog on
children aborting abnormally. This turns out to be a great debugging aide at
times.

Children are now tracked in a LIST; the management interface is decidedly
less painful when there's no upper bound on the number of entries we may
have at the cost of one small allocation per connection.

PR:		70335
2020-01-01 04:22:04 +00:00
Kyle Evans
d6272fce7c inetd: add some macros for checking child limits, NFC
The main point here is capturing the maxchild > 0 check. A future change to
inetd will start tracking all of the child pids so that it can give proper
and consistent notification of process exit/signalling.
2020-01-01 03:59:54 +00:00
Kyle Evans
a1cedb80c6 inetd: prefer strlcpy to strlen(3) check + strcpy(3), NFC
This is again functionally equivalent but more concise.
2019-12-31 04:53:50 +00:00
Kyle Evans
1c3b9acf2e inetd: prefer strtonum(3) to strspn(3)+atoi(3), NFC
strtonum(3) does effectively the same validation as we had, but it's more
concise.
2019-12-31 04:36:14 +00:00
Kyle Evans
f23df31975 inetd: knock out some clang analyze warnings
chargen_dg: clang-analyze is convinced that endring could be non-NULL at
entry, and thus wants to assume that rs == NULL. Just independently
initialize rs if it's NULL to appease the analyzer.

getconfigent: policy leaks on return

free_connlist: reorganize the loop to make it clear that we're not going to
access `conn` after it's been freed.

cpmip/hashval: left-shifts performed will result in UB as we take
signed 0xABC3D20F and left shift it by 5.
2019-12-31 04:00:24 +00:00
Kyle Evans
f930f30f60 inetd: don't leak policy on return
sep->se_policy gets a strdup'd version of policy, so we don't need it to
stick around afterwards.

While here, remove a couple of NULL checks prior to free(policy).

CID:		1006865
MFC after:	3 days
2019-12-30 15:54:36 +00:00
Mark Johnston
2a73387f1c powerd(8): Fix a memory leak when we fail to read frequency levels.
PR:		242967
Submitted by:	Hans Christian Woithe <chwoithe@yahoo.com>
MFC after:	3 days
2019-12-29 20:57:49 +00:00
Adrian Chadd
350bfebba9 Make this compile under external gcc toolchain if WITH_ICONV isn't defined.
This quietens a bunch of unused variable warnings that are treated as errors.
2019-12-29 06:59:09 +00:00
Hans Petter Selasky
fa6d8b65d3 Implement dump_stats command for usbconfig(8).
This command is useful when debugging USB device issues.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-12-27 20:37:14 +00:00
Kyle Evans
6795e26b8a cron(8): use proper variable to determine mailer process status
While the mailer is normally opened/set if the mailto is set, this is not
the case if the grandchild actually didn't produce any output. This change
corrects the situation to only attempt to kill/close the mail process if it
was actually opened in the first place.

The reporter initially stumbled on the -n (suppress mail on success) flag
leading to a SIGKILL of the process group, but simultaneously
discovered/reported the behavior with !-n jobs if MAILTO was set and no
output happened.

All of these places that are checking mailto should actually be checking
whether mail is set, so do that for consistency+correctness.

This set of bugs were introduced by r352668.

Submitted by:	sigsys@gmail.com
Reported by:	sigsys@gmail.com
2019-12-26 22:49:19 +00:00
Pedro F. Giffuni
509798ea65 sbin/fstyp: recgonize Dragonfly's hammer and hammer2.
This is based on DragonFly's implementation from about 2019-09-13. It
only contains the basic code and header information to identify the
disks.

Relnotes:		yes
Differential Revision:	https://reviews.freebsd.org/D13369
2019-12-24 19:00:20 +00:00
Conrad Meyer
5ab1cb52b2 fstyp(8): Fix WITHOUT_ICONV build
Reported by:	olivier
2019-12-23 20:23:02 +00:00
Conrad Meyer
e41d62768d fstyp(8): Detect APFS containers
APFS NXSBs are more like slices (or zvols?) than individual filesystem,
but go ahead and detect them nicely as well.
2019-12-23 05:43:18 +00:00
Conrad Meyer
50c59bbb53 fstyp(8): Detect HFS+ / HFSX volumes 2019-12-23 05:43:01 +00:00
Conrad Meyer
ec80d2eedd fstyp(8): Use iconv(3) to convert NTFS vol labels correctly
Rather than hackily extracting only the ASCII subset of UTF-16LE, go ahead
and convert the label to the user's locale correctly.
2019-12-23 02:41:13 +00:00
Conrad Meyer
85b4c344c8 fstyp(8): Show exFAT volume labels with -l flag
exfat is fundamentally the same design as fat32.  The superblock differs
marginally, and there are some additional optional features irrelevant to
fstype(8); the structure of dirents has changed slightly to enable, among
other things, larger files; the directory entries are no longer DOS 8.3
ASCII or local 8-bit encoding, but instead explicitly UCS-2-LE.

(As a result, this change uses iconv to convert a found exfat volume label
to the user's locale.)

Locating the volume label is identical to FAT32: locate the root directory
and walk through dirents until you find a volume label.  Like FAT32, follow
the FAT chain between root directory clusters as necessary.

PR:		242225
Reported by:	Victor Sudakov <vas AT sibptus.ru>
2019-12-22 03:19:17 +00:00
Rick Macklem
9449898858 Update the man page to reflect the addition of NFSv4.2 (r355677).
Update all the references to NFSv4.1, so that they apply to NFSv4.1 and
NFSv4.2. Also, change the MDS->DS mounts to use NFSv4.2, so that both
versions of the protocol can be used against the server with pNFS enabled.

This is a content change.
2019-12-20 21:45:20 +00:00
Rick Macklem
452588d3e5 Update the man page to reflect the addition of NFSv4.2 (r355677).
Include references to NFSv4.2 and Flexible File layout, plus clarify
when vfs.nfsd.flexlinuxhack needs to be set for Linux pNFS clients.
Also update the man page to reflect the addition of SpaceUsed to the
attributes stored in the extended attribute on the MDS (r354158).

This is a content change.
2019-12-20 21:41:33 +00:00
Rick Macklem
fa40c59d21 Update the man page to reflect the addition of NFSv4.2 (r355677).
Include references to NFSv4.2 and associated RFCs and note new features
present in NFSv4.2.

This is a content change.
2019-12-20 21:31:08 +00:00
Rick Macklem
1fd129c9ff Update the man page to reflect the addition of NFSv4.2 (r355677).
Include references to NFSv4.2 and associated RFCs.
Also clarify when a Linux client needs to set vfs.nfsd.flexlinuxhack if
a pNFS server is in use.

This is a content change.
2019-12-20 21:25:51 +00:00
John Baldwin
9b078661c4 Trim a spurious carriage return from the RFB signature string added in r355301.
Submitted by:	Yamagi <lists@yamagi.org>
2019-12-19 15:36:00 +00:00
Warner Losh
6ee8575cd7 Remove all the RELEASE_CRUNCH defines, they are useless.
RELEASE_CRUNCH has been broken for a very long time. Remove the
last remants from the tree.
2019-12-16 21:06:24 +00:00
Edward Tomasz Napierala
8ad16e5541 Add 'sesutil show' subcommand to show enclosure and its contents
in a user-friendly way.

Reviewed by:	allanjude, bcr (manpages)
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D22567
2019-12-14 10:58:06 +00:00
Scott Long
97faa4c470 Add accessors for the Vendor Specific Extended Capability (VSEC)
Parse out the VSEC.  If the user invokes a second -c command line option,
do a hex dump of the vendor data.

Reviewed by:	imp
MFC after:	3 days
Sponsored by:	Intel
Differential Revision:	http://reviews.freebsd.org/D22808
2019-12-13 23:46:59 +00:00
John Baldwin
cbd03a9df2 Support software breakpoints in the debug server on Intel CPUs.
- Allow the userland hypervisor to intercept breakpoint exceptions
  (BP#) in the guest.  A new capability (VM_CAP_BPT_EXIT) is used to
  enable this feature.  These exceptions are reported to userland via
  a new VM_EXITCODE_BPT that includes the length of the original
  breakpoint instruction.  If userland wishes to pass the exception
  through to the guest, it must be explicitly re-injected via
  vm_inject_exception().

- Export VMCS_ENTRY_INST_LENGTH as a VM_REG_GUEST_ENTRY_INST_LENGTH
  pseudo-register.  Injecting a BP# on Intel requires setting this to
  the length of the breakpoint instruction.  AMD SVM currently ignores
  writes to this register (but reports success) and fails to read it.

- Rework the per-vCPU state tracked by the debug server.  Rather than
  a single 'stepping_vcpu' global, add a structure for each vCPU that
  tracks state about that vCPU ('stepping', 'stepped', and
  'hit_swbreak').  A global 'stopped_vcpu' tracks which vCPU is
  currently reporting an event.  Event handlers for MTRAP and
  breakpoint exits loop until the associated event is reported to the
  debugger.

  Breakpoint events are discarded if the breakpoint is not present
  when a vCPU resumes in the breakpoint handler to retry submitting
  the breakpoint event.

- Maintain a linked-list of active breakpoints in response to the GDB
  'Z0' and 'z0' packets.

Reviewed by:	markj (earlier version)
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D20309
2019-12-13 19:21:58 +00:00
Conrad Meyer
15da83398e ntpd(8): Don't use OpenSSL's RAND API
The !USE_OPENSSL_CRYPTO_RAND path uses arc4random_buf() correctly.

In general, we should prefer to avoid things OpenSSL does poorly when a good
alternative exists in libc.
2019-12-13 05:54:38 +00:00
Conrad Meyer
6425a52feb keyserv(8): unifdef out __FreeBSD__ and KEYSERV_RANDOM
This doesn't appear to have some active upstream (and it's a steaming pile of
bad 90s crypto design).  Rip out the completely horrible bits and leave the
only mildly less horrible bits.  The whole thing should probably be deleted; to
the extent it purports to provide a security feature: it doesn't.
2019-12-13 04:03:05 +00:00
John Baldwin
976ba8c6b2 Document that the debug server supports writing to guest memory.
This was added in r348212.
2019-12-13 02:18:44 +00:00
John Baldwin
dd58314395 Fix a mismerge in r355683 and remove the local gdb_port from main. 2019-12-13 02:15:34 +00:00
John Baldwin
cd333f156c Don't call into the debug server if it isn't configured.
Reviewed by:	markj (as part of a larger diff)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D20309
2019-12-13 01:17:20 +00:00
Kyle Evans
5bff36fe81 usr.sbin/ntp: don't emit versions w/ make -s
<sys.mk> defines ECHO=echo when not using make -s, and ECHO=true when using
make -s.

export ECHO for ntp products and use it in the mkver script to echo the
version. This suppresses the output as appropriate. ECHO is given a default
value to make sure things still work as expected for anyone that isn't
redefining ECHO.

Reviewed by:	cy
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22101
2019-12-12 01:33:45 +00:00
John Baldwin
c7ba149dba Emulate reads of the PCI command register for passthrough devices.
VFs return zero for the memory enable bit even if it has been set by a
prior write.  After r348779 this caused the annoying behavior that a
guest OS would unintentionally disable memory decoding on a future
read-modify-write operation on the command register.  Instead, return
the shadow value of the command register for reads.  This ensures that
the guest will only toggle the state of the memory enable bit when it
specifically intends to do so.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2019-12-11 23:41:39 +00:00
Simon J. Gerraty
2c9a9dfc18 Update Makefile.depend files
Update a bunch of Makefile.depend files as
a result of adding Makefile.depend.options files

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22494
2019-12-11 17:37:53 +00:00
Simon J. Gerraty
5ab1c5846f Add Makefile.depend.options
Leaf directories that have dependencies impacted
by options need a Makefile.depend.options file
to avoid churn in Makefile.depend

DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc
can be set in local.dirdeps-options.mk
which can add to those set in Makefile.depend.options

See share/mk/dirdeps-options.mk

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22469
2019-12-11 17:37:37 +00:00
Ed Maste
29f64e28ba kbdmap: allow INDEX.keymaps to provide the dialog title
Previously kbdmap had a localized menu heading ("Choose your keyboard
layout") but not the dialog title ("Keyboard Menu").

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2019-12-11 17:19:36 +00:00
Warner Losh
f86e60008b Regularize my copyright notice
o Remove All Rights Reserved from my notices
o imp@FreeBSD.org everywhere
o regularize punctiation, eliminate date ranges
o Make sure that it's clear that I don't claim All Rights reserved by listing
  All Rights Reserved on same line as other copyright holders (but not
  me). Other such holders are also listed last where it's clear.
2019-12-04 16:56:11 +00:00
Cy Schubert
d48778bb2a Chase r352304. The default rlimit memlock is no memory locking.
Reported by:	egypcio@
MFC after:	3 days
2019-12-04 15:04:06 +00:00
Bryan Drewery
efdd39d20d Use full path to sysctl(8) since /sbin is not in PATH.
X-MFC-With:	r355379
MFC after:	2 weeks
2019-12-04 04:01:53 +00:00
Bryan Drewery
3701dbc859 Run make in parallel.
This is mostly targetting the 'installconfig' phase of 'distribution'
which does a full tree walk.

MFC after:	 2 weeks
2019-12-04 03:44:50 +00:00
Emmanuel Vadot
e213223c9b Remove "all rights reserved" from copyright for the file I own.
Some of the files have both me and Jared McNeill and he gave me
permission to remove it from his files too.
2019-12-03 21:00:45 +00:00
Vincenzo Maffione
79c1428ed6 bhyve: uniform printf format string newlines
Some of the printf statements only use LF to get a newline. However, a CR character is also required for the serial console to print debug logs in a nice way.
Fix those code locations that only use LF, by adding a CR character.

Reviewed by:	markj, aleksandr.fedorov@itglobal.com
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22552
2019-12-02 20:51:46 +00:00
Devin Teske
e19a2226fe Fix spurious error from sysrc
When using sysrc to modify a file, the file should be created silently.
However, with the introduction of SVN r335280, an error of "No such file
or directory" would appear despite everything else working as-expected.

The nature of this spurious error is that SVN r335280 did not check if
the file exists first, before trying to fixup the line-endings in the
file just prior to modification.

PR:		bin/240875
Reported by:	Jose Luis Duran
MFC after:	3 days
2019-12-02 05:24:16 +00:00
Edward Tomasz Napierala
2b2710a70b Fix typos.
MFC after:	2 weeks
Sponsored by:	Klara, Inc
2019-11-27 10:26:37 +00:00
Xin LI
1861313623 Update leap-seconds to leap-seconds.3676924800.
Obtained from:	ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800
MFC after:	3 days
2019-11-27 07:51:29 +00:00
Ravi Pokala
90e43b446d Add and document options to allow rpc.lockd and rpc.statd to run in the
foreground.

This allows a separate process to monitor when and how those programs exit.
That process can then restart them if needed.

Submitted by:	Alex Burlyga
Reviewed by:	bcr, imp
MFC after:	1 week
Sponsored by:	Panasas
Differential Revision:	https://reviews.freebsd.org/D22474
2019-11-22 16:53:30 +00:00
Cy Schubert
964c4a37b0 Chase r344883. ntp is 4.2.8p13.
MFC after:	3 days
2019-11-21 20:15:22 +00:00
Mateusz Piotrowski
6e02be63f4 bsdinstall.8: Fix description of DISTRIBUTIONS environment variable
Reviewed by:	bcr
Approved by:	bcr (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22478
2019-11-21 15:54:56 +00:00
Ed Maste
1da495d063 revert r354935 and apply fix for cleandir failure
This reapplies the RISC-V GNU ld workaround from r354896, r354899, and
354900, along with a fix for the build failure during cleandir.

LINKER_TYPE was not being set during cleandir, resulting in
Malformed conditional (${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv")
from Cirrus-CI.

PR:		242109
Sponsored by:	The FreeBSD Foundation
2019-11-21 13:56:16 +00:00
Glen Barber
fb1c294d47 Revert r354896, r354899, r354900:
Fix build.

Sponsored by:	Rubicon Communications, LLC (netgate.com)
2019-11-21 04:12:08 +00:00
Gleb Smirnoff
71f0077631 Remove sio(4).
It had been disconnected from build in r181233 in 2008.

Reviewed by:	imp
2019-11-21 01:24:49 +00:00
Mark Johnston
e7485a436b Avoid relying on pollution from libcasper.h.
Reported by:	sjg
Sponsored by:	The FreeBSD Foundation
2019-11-21 00:17:14 +00:00
Warner Losh
1cdb8eb8fe Add --esp/-E argument to print the currently booted ESP
Add code to decode the BootCurrent and BootXXXX variable it points at
to deduce the ESP used to boot the system. By default, it prints the
path to that device. With --unix-path (-p) it will instead print the
current mount point for the ESP, if any (or an error). With
--device-path (-d) it wil print the UEFI device path for the ESP.

Note: This is the best guess based on the UEFI variables. If the ESP
is part of a gmirror, etc, that won't be reported. If by some weird
chance there was a complicated series of chain boots, this may not be
what you want. For setups that don't add layers on top of the raw
devices, it is accurate.

Differential Revision: https://reviews.freebsd.org/D22432
2019-11-20 23:58:36 +00:00
Li-Wen Hsu
7cef5cac04 Use the correct variable, also limit the scope to bfd
PR:		242109
Reported by:	jhb
Sponsored by:	The FreeBSD Foundation
2019-11-20 16:54:21 +00:00
Li-Wen Hsu
f10ddee841 Limit the workaround to riscv only
PR:		242109
Sponsored by:	The FreeBSD Foundation
2019-11-20 16:35:58 +00:00
Li-Wen Hsu
53c772bbd7 Workaround riscv64 build when using binutils 2.33.1
PR:		242109
Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D22457
2019-11-20 16:20:49 +00:00
Vincenzo Maffione
d70b206955 bhyve: virtio-net: disable receive until features are negotiated
This patch fixes a race condition where the receive callback is called
while the device is being reset. Since the rx_merge variable may change
during reset, the receive callback may operate inconsistently with what
the guest expects.
Also, get rid of the unused rx_vhdrlen variable.

PR:	242023
Reported by:	aleksandr.fedorov@itglobal.com
Reviewed by:	markj, jhb
MFC with:	r354552
Differential Revision:	https://reviews.freebsd.org/D22440
2019-11-19 21:10:44 +00:00
Alex Richardson
21697a7a3a Fix error found by new clang operator precendence warning
error: operator '?:' has lower precedence than '|'; '|' will be evaluated first

I discovered this in CheriBSD after updating our fork of clang to the latest
upstream master.

Reviewed By:	ian
Differential Revision: https://reviews.freebsd.org/D22433
2019-11-17 19:04:02 +00:00
Alex Richardson
1e9f67e2e4 makefs: Also set UFS di_birthtime when building on Linux
Since st_birthtime doesn't exists on Linux (unless you use statx(2)), we
instead populate it with the st_ctime value.

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D22386
2019-11-15 18:34:30 +00:00
Alex Richardson
62a3510f1f Fix contents= being ignored in msdosfs makefs mtree
I noticed this while trying to build an EFI boot image

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D22387
2019-11-15 18:34:23 +00:00
Konstantin Belousov
7672c254eb cpucontrol: print more useful information when MSR access fails.
Instead of providing ioctl cmd value, which has no meaning to user,
print MSR number.  The later is what the user expects in this place
even.

Reported by:	pstef
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2019-11-13 22:43:11 +00:00
Alan Somers
9f96f106f8 sesutil: fix another memory leak
Instead of calloc()ing (and forgetting to free) in a tight loop, just put
this small array on the stack.

Reported by:	Coverity
Coverity CID:	1331665
MFC after:	2 weeks
Sponsored by:	Axcient
2019-11-12 23:57:57 +00:00
Alan Somers
a221b104de sesutil: fix some memory leaks
Reported by:	Coverity
Coverity CID:	1331665
MFC after:	2 weeks
Sponsored by:	Axcient
2019-11-12 23:09:55 +00:00
Alan Somers
691a834cb7 sesutil: fix an out-of-bounds array access
sesutil would allow the user to toggle an LED that was one past the maximum
element.  If he tried, ENCIOC_GETELMSTAT would return EINVAL.

Reported by:	Coverity
Coverity CID:	1398940
MFC after:	2 weeks
Sponsored by:	Axcient
2019-11-12 23:03:52 +00:00
Vincenzo Maffione
07b35f77c0 bhyve: rework mevent processing to fix a race condition
At the end of both mevent_add() and mevent_update(), mevent_notify()
is called to wakeup the I/O thread, that will call kevent(changelist)
to update the kernel.
A race condition is possible where the client calls mevent_add() and
mevent_update(EV_ENABLE) before the I/O thread has the chance to wake
up and call mevent_build()+kevent(changelist) in response to mevent_add().
The mevent_add() is therefore ignored by the I/O thread, and
kevent(fd, EV_ENABLE) is called before kevent(fd, EV_ADD), resuliting
in a failure of the kevent(fd, EV_ENABLE) call.

PR:	241808
Reviewed by:	jhb, markj
MFC with:	r354288
Differential Revision:	https://reviews.freebsd.org/D22286
2019-11-12 21:07:51 +00:00
Edward Tomasz Napierala
b5961be1ab Add GEOM attribute to report physical device name, and report it
via 'diskinfo -v'.  This avoids the need to track it down via CAM,
and should also work for disks that don't use CAM.  And since it's
inherited thru the GEOM hierarchy, in most cases one doesn't need
to walk the GEOM graph either, eg you can use it on a partition
instead of disk itself.

Reviewed by:	allanjude, imp
Sponsored by:	Klara Inc
Differential Revision:	https://reviews.freebsd.org/D22249
2019-11-09 17:30:19 +00:00
Vincenzo Maffione
d55e0373f1 bhyve: add support for virtio-net mergeable rx buffers
Mergeable rx buffers is a virtio-net feature that allows the hypervisor
to use multiple RX descriptor chains to receive a single receive packet.
Without this feature, a TSO-enabled guest is compelled to publish only
64K (or 32K) long chains, and each of these large buffers is consumed
to receive a single packet, even a very short one. This is a waste of
memory, as a RX queue has room for 256 chains, which means up to 16MB
of buffer memory for each (single-queue) vtnet device.
With the feature on, the guest can publish 2K long chains, and the
hypervisor will merge them as needed.

This change also enables the feature in the netmap backend, which
supports virtio-net offloads. We plan to add support for the
tap backend too.
Note that differently from QEMU/KVM, here we implement one-copy receive,
while QEMU uses two copies.

Reviewed by:    jhb
MFC after:      3 weeks
Differential Revision:	https://reviews.freebsd.org/D21007
2019-11-08 17:57:03 +00:00
Vincenzo Maffione
3e11768ee1 bhyve: add backend rx backpressure to virtio-net
If a VM is flooded with more ingress packets than the guest OS
can handle, the current virtio-net code will keep reading those
packets and drop most of them as no space is available in the
receive queue. This is an undesirable receive livelock, which
is a waste of CPU and memory resources and potentially opens to
DoS attacks.
With this change, virtio-net uses the new netbe_rx_disable()
function to disable ingress operation in the backend while the
guest is short on RX buffers. Once the guest makes more buffers
available to the RX virtqueue, ingress operation is enabled again
by calling netbe_rx_enable().

Reviewed by:	bryanv, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D20987
2019-11-03 19:02:32 +00:00
Vincenzo Maffione
14d726374b bhyve: fix mistake introduced by r352841
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20973
2019-11-03 18:53:42 +00:00
Vincenzo Maffione
c7c7805531 add valectl to the system commands
The valectl(4) program is used to manage vale(4) switches.
Add it to the system commands so that it can be used right away.
This program was previously called vale-ctl, and stored in
tools/tools/netmap

Reviewed by:	hrs, bcr, lwhsu, kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22146
2019-10-31 21:01:34 +00:00
Jung-uk Kim
412d13d559 Catch up with ACPICA 20191018.
PR:		241467
XMFC with:	r353764
2019-10-24 22:33:46 +00:00
Jung-uk Kim
a009b7dcab Merge ACPICA 20191018. 2019-10-19 14:56:44 +00:00
Scott Long
fe1c359603 Fix the botched field ordering in the last commit. While here, fix
whitespace, and also reorder the fields so they are easier to read on
an 80 column display (the lines wrapped even before these changes).
Also fix non-standard nomenclature in the Caps code, and update the
man page.

Reported by:	rpokala
2019-10-13 05:11:53 +00:00
Scott Long
635cfe5b81 Change from the non-standard nomenclature of "chip" and "card" to the
standard nomenclature of "device" and "vendor" with the "sub" variants.
This changes the printed format, so anything that scrapes and parses
this will need to be adapted.  No compatibility shims are provided,
but this will not be MFC'd.

Reviewed by:	jhb, emaste, gtetlow
Approved by:	jhb, emaste, gtetlow
2019-10-12 22:27:57 +00:00
Yuri Pankov
a89559c269 bsdinstall: fix ESP detection for auto ZFS layout
Pass the list of user selected disks from zfsboot to bootconfig so that
the latter doesn't rely on ESP autodetection that apparently fails for
some cases, e.g. memstick installation with nvme (boot) and sata drives.

While here, fix printing of debug messages in bootconfig.

Reviewed by:	bcran, imp, tsoome
Differential Revision:	https://reviews.freebsd.org/D21930
2019-10-09 05:28:10 +00:00
Brooks Davis
f189761366 Fix various -Wpointer-compare warnings
This warning (comparing a pointer against a zero character literal
rather than NULL) has existed since GCC 7.1.0, and was recently added to
Clang trunk.

Almost all of these are harmless, except for fwcontrol's str2node, which
needs to both guard against dereferencing a NULL pointer (though in
practice it appears none of the callers will ever pass one in), as well
as ensure it doesn't parse the empty string as node 0 due to strtol's
awkward interface.

Submitted by:	James Clarke <jtrc27@jrtc27.com>
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D21914
2019-10-08 21:14:09 +00:00
Glen Barber
48c8f7d454 Rework the logic for installing the pkg(8) configuration.
'quarterly' package sets do not exist for head, so explicitly
install the 'latest' configuration file there.  Otherwise,
fall back to the original conditional evaluation to determine
if the 'latest' or 'quarterly' configuration file should be
installed.

Reported by:	manu
Reviewed by:	manu
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2019-10-08 18:58:23 +00:00
Kyle Evans
94a5245c4c certctl(8): let one blacklist based on hashed filenames
It seems reasonable to allow, for instance:

$ certctl list
# reviews output -- ah, yeah, I don't trust that one
$ certctl blacklist ce5e74ef.0
$ certctl rehash

We can unambiguously determine what cert "ce5e74ef.0" refers to, and we've
described it to them in `certctl list` output -- I see little sense in
forcing another level of filesystem inspection to determien what cert file
this physically corresponds to.
2019-10-03 20:45:52 +00:00
Kyle Evans
fa0e0c0269 certctl(8): realpath the file before creating the symlink
Otherwise we end up creating broken relative symlinks in
/etc/ssl/blacklisted.
2019-10-03 20:05:46 +00:00
Andriy Gapon
5fda0d60c1 add ability to set watchdog timeout for a shutdown
This change allows to specify a watchdog(9) timeout for a system
shutdown.  The timeout is activated when the watchdogd daemon is
stopped.  The idea is to a prevent any indefinite hang during late
stages of the shutdown.  The feature is implemented in rc.d/watchdogd,
it builds upon watchdogd -x option.

Note that the shutdown timeout is not actiavted when the watchdogd
service is individually stopped by an operator.  It is also not
activated for the 'shutdown' to the single-user mode.  In those cases it
is assumed that the operator knows what they are doing and they have
means to recover the system should it hang.

Significant subchanges and implementation details:
- the argument to rc.shutdown, completely unused before, is assigned to
  rc_shutdown variable that can be inspected by rc scripts
- init(8) passes "single" or "reboot" as the argument, this is not
  changed
- the argument is not mandatory and if it is not set then rc_shutdown is
  set to "unspecified"
- however, the default jail management scripts and jail configuration
  examples have been updated to pass "jail" to rc.shutdown, just in case
- the new timeout can be set via watchdogd_shutdown_timeout rc option
- for consistency, the regular timeout can now be set via
  watchdogd_timeout rc option
- watchdogd_shutdown_timeout and watchdogd_timeout override timeout
  specifications in watchdogd_flags
- existing configurations, where the new rc options are not set, should
  keep working as before

I am not particularly wed to any of the implementation specifics.
I am open to changing or removing any of them as long as the provided
functionality is the same (or very close) to the proposed one.
For example, I think it can be implemented without using watchdogd -x,
by means of watchdog(1) alone.  In that case there would be a small
window between stopping watchdogd and running watchdog, but I think that
that is acceptable.

Reviewed by:	bcr (man page changes)
MFC after:	5 weeks
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D21221
2019-10-03 11:23:10 +00:00
Ian Lepore
b6fa976de2 Bump .Dd for earlier update (should have been part of r353024). 2019-10-02 23:19:34 +00:00
Ian Lepore
0ec0f10d66 Clarify how the -f option for daemon(8) interacts with other options
related to redirecting stdout and stderr.
2019-10-02 23:06:17 +00:00
Glen Barber
e7a71e6d1b Add a comment explaining why the opensolaris_load line in loader.conf
is explicitly added.

Requested by:	rgrimes
MFC after:	3 days
MFC with:	r353004
Sponsored by:	Rubicon Communications, LLC (Netgate)
2019-10-02 16:09:28 +00:00
Glen Barber
8cdae52ef6 Explicitly add opensolaris_load="YES" to loader.conf through the
installer when installing the system on a ZFS root filesystem.

For arm64, zfs_load="YES" does not add opensolaris.ko as a kld
dependency, so add it explicitly to prevent boot-time failures
out-of-box.

PR:		240478
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2019-10-02 13:30:17 +00:00
Kyle Evans
0da4b4089c Unbreak etcupdate(8) and mergemaster(8) after r352950
r352950 introduced improper case fall-through for shell scripts. Fix it with
a pipe.

Reported by:	lwhsu, David Wolfskill
2019-10-02 12:46:28 +00:00
Hans Petter Selasky
eff4361d88 Use size_t for byte_to_write variable when comparing to eeprom_info_out_len
which is also size_t in mlx5tool(8).

Submitted by:	slavash@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-10-02 10:58:27 +00:00
Hans Petter Selasky
133fc15cf3 Add the ability to query the EEPROM information in mlx5tool(8).
Submitted by:	slavash@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-10-02 10:19:17 +00:00
Kyle Evans
bbb8014f09 [3/3] etcupdate and mergemaster support for certctl
This commit add support for certctl in mergemaster and etcupdate. Both will
either rehash or prompt for rehash as new certificates are
trusted/blacklisted.

This work was done primarily by allanjude@, with minor contributions by
myself.

No objection from:	secteam
Differential Revision:	https://reviews.freebsd.org/D17389
2019-10-02 01:06:37 +00:00
Kyle Evans
ccdcb388ba [2/3] Add certctl(8)
This is a simple utility to hash all trusted on the system into
/etc/ssl/certs. It also allows the user to blacklist certificates they do
not trust.

This work was done primarily by allanjude@, with minor contributions by
myself.

No objection from:	secteam
Differential Revision:	https://reviews.freebsd.org/D16857
2019-10-02 01:05:53 +00:00
Kyle Evans
546d30b94b Move httpd to simple_httpd...
This avoids PATH conflicts with a real httpd, as a user will likely almost
always prefer the more fully-featured httpd. This also lines up with the
historical name of the program.
2019-10-01 18:14:37 +00:00
Kyle Evans
2d0a92c9ab Move simple_httpd out of picobsd, add HTTPD option (default OFF)
picobsd/tinyware has had this compact HTTPD server for a long time, and some
people do use it. Move it out into usr.sbin well in advance of any action
being taken on picobsd.

This has been gated behind an HTTPD option defaulted to *off*, primarily for
two reasons:
1.) This code likely needs a good audit, as it's been living off in picobsd
    land for a long time, and
2.) We don't currently ship an httpd and this may not be a welcome surprise.

Reviewed by:	eugen
Differential Revision:	https://reviews.freebsd.org/D21724
2019-10-01 14:55:16 +00:00
Vincenzo Maffione
d12c5ef640 bhyve: support for enabling/disabling the net backend
Extend the net backend interface with two functions, namely netbe_rx_disable()
and netbe_rx_enable(), which can be used by the net device emulators to stop
the backend from invoking the receive callback. This is useful for device
emulators, i.e., on hardware resets or to implement receive backpressure.
The mevent module has been extendede to support the addition of a disabled
event. To prevent race conditions, the net backends will start with receive
operation disabled. A follow-up patch will use the new functionalities in
the virtio-net device.

Reviewed by:	jhb, markj
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D20973
2019-09-28 12:02:43 +00:00
Yuri Pankov
736dcdb75a efibootmgr(8): fix markup and style issues
- split synopsis into separate options that can't be used together
- sort options
- fix (style) issues reported by mandoc lint

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D21710
2019-09-25 21:23:30 +00:00
Kyle Evans
5b80de237b cron: add log suppression and mail suppression for successful runs
This commit adds two new extensions to crontab, ported from OpenBSD:
- -n: suppress mail on succesful run
- -q: suppress logging of command execution

The -q option appears decades old, but -n is relatively new. The
original proposal by Job Snijder can be found here [1], and gives very
convincing reasons for inclusion in base.

This patch is a nearly identical port of OpenBSD cron for -q and -n
features. It is written to follow existing conventions and style of the
existing codebase.

Example usage:

# should only send email, but won't show up in log
* * * * * -q date

# should not send email
* * * * * -n date

# should not send email or log
* * * * * -n -q date

# should send email because of ping failure
* * * * * -n -q ping -c 1 5.5.5.5

[1]: https://marc.info/?l=openbsd-tech&m=152874866117948&w=2

PR:		237538
Submitted by:	Naveen Nathan <freebsd_t.lastninja.net>
Reviewed by:	bcr (manpages)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20046
2019-09-25 02:37:40 +00:00
Michael Gmelin
8cfda118cb freebsd-update: Add updatesready' and showconfig' commands
`freebsd-update updatesready' can be used to check if there are any pending
fetched updates that can be installed.

`freebsd-update showconfig' writes freebsd-update's configuration to
stdout.

This also changes the exit code of `freebsd-update install' to 2 in case
there are no updates pending to be installed and there wasn't a fetch phase
in the same invocation. This allows scripts to tell apart these error
conditions without breaking existing jail managers.

See freebsd-update(8) for details.

PR:		240757, 240177, 229346
Reviewed by:	manpages (bcr), sectam (emaste), yuripv
Differential Revision:	https://reviews.freebsd.org/D21473
2019-09-24 20:49:33 +00:00
Hiroki Sato
34302d266a - Revert WARNS to 2 because of mismatch between (xdrproc_t) and xdr_void().
- Add prototype of from_addr().
2019-09-21 13:34:06 +00:00
Hiroki Sato
aec74e0ce0 Fix warnings and set WARNS=6. 2019-09-21 12:33:41 +00:00
Hiroki Sato
685e059d94 Fix build errors of test.c, which had been broken for a long time.
This is a temporary fix and should be converted to a complete
test scenarios by using this tool.
2019-09-21 01:29:59 +00:00
Michael Gmelin
12294db4ac Fix src component detection
Reviewed by:	emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D21579
2019-09-19 21:13:51 +00:00
Glen Barber
5f6bb72e7f Apply r346792 (cperciva) from stable/12 to head. The original commit
message:

 On non-x86 systems, use "quarterly" packages.

 x86 architectures have "latest" package builds on stable/*, so keep using
 those (they'll get switched over to "quarterly" during releases).

The original commit was a direct commit to stable/12, as at the time it
was presumed it would not be necessary for head.  However, when it is time
to create a releng branch or switch from PRERELEASE/STABLE to BETA/RC, the
pkg(7) Makefile needs further adjusting.  This commit includes those
further adjustments, evaluating the BRANCH variable from release/Makefile
to determine the pkg(7) repository to use.

MFC after:	immediate (if possible)
Sponsored by:	Rubicon Communications, LLC (Netgate)
2019-09-19 16:43:12 +00:00
Cy Schubert
1e8687d261 Reduce calls to close(2) at startup through the use of closefrom(2).
Submitted by:	pawel.biernacki@gmail.com
Reviewed by:	mjg, cy
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D21715
2019-09-19 14:45:04 +00:00
Ed Maste
75cb6429f5 freebsd-update: make usage output consistent
Drop trailing . which appeared only on description of IDS.

Submitted by:	grembo
Event:		EuroBSDCon Norway FreeBSD DevSummit
2019-09-19 11:46:43 +00:00