Commit Graph

18194 Commits

Author SHA1 Message Date
Brad Davis
11f8f36fb9 Fix mergemaster after r347638 and the master.passwd / group move.
Check the legacy directory and use it instead if present.

Install these first if using beinstall.

UPDATING entry to follow.

Approved by:	allanjude (mentor, in person)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20279
2019-05-16 21:50:12 +00:00
Tycho Nightingale
b961c0f244 Allow loading the same DMA address multiple times without any prior
unload for the LinuxKPI.

Reviewed by:	kib, zeising
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D20181
2019-05-16 17:41:16 +00:00
Xin LI
65ec2ae389 Replace the leap-seconds file in r347488 from USNO with a
leap-seconds file from NIST at ftp://ftp.nist.gov/pub/time.

Future updates should use the NIST version of file, available
at ftp://ftp.nist.gov/pub/time/leap-seconds.list .

Requested by:   ian@
Obtained from:  ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800
MFC after:      3 days
2019-05-15 03:39:27 +00:00
Rick Macklem
711d44ee56 Replace global list for grouplist with list(s) for each exportlist element.
In mountd.c, the grouplist structures are linked into a single global
linked list headed by "grphead". The only use of this linked list is
to free all list elements when the exportlist elements are also all being
free'd at the time the exports are being reloaded.
This patch replaces this one global linked list head with a list head in
each exportlist structure, where the grouplist elements for that exported
file system are linked.
The only change is that now the grouplist elements are free'd with the
associated exportlist element as they are free'd instead of all grouplist
elements being free'd after the exportlist elements are free'd. This
change should have no effect in practice.
This is being done, since a future patch that will add a "-I" option for
incrementally updating the exports in the kernel needs to know which
grouplist elements are associated with each exported file system and
having them linked into a list headed by the exportlist element does that.

MFC after:	1 month
2019-05-14 22:00:47 +00:00
Rick Macklem
3e08dc749c Factor code into two new functions in preparation for a future commit.
Factor code into two functions.
read_exportfile() a functon  which reads the exports file(s) and calls
get_exportlist_one() to process each of them.
delete_export() a function which deletes the exports in the kernel for a file
system.
The contents of these functions is just the same code as was used to do the
operations, moved into separate functions. As such, there is no semantic change.
This is being done in preparation for a future commit that will add an
option to do incremental changes of kernel exports upon receiving SIGHUP.

MFC after:	1 month
2019-05-11 22:41:58 +00:00
Xin LI
7fa22f746b Update leap-seconds to leap-seconds.3757622400.
As per https://datacenter.iers.org/data/latestVersion/16_BULLETIN_C16.txt:

     INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)

SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE

SERVICE DE LA ROTATION TERRESTRE DE L'IERS
OBSERVATOIRE DE PARIS
61, Av. de l'Observatoire 75014 PARIS (France)
Tel.      : +33 1 40 51 23 35
e-mail    : services.iers@obspm.fr
http://hpiers.obspm.fr/eop-pc

                                              Paris, 07 January 2019

                                              Bulletin C 57

                                              To authorities responsible
                                              for the measurement and
                                              distribution of time

                          INFORMATION ON UTC - TAI

 NO leap second will be introduced at the end of June 2019.
 The difference between Coordinated Universal Time UTC and the
 International Atomic Time TAI is :

     from 2017 January 1, 0h UTC, until further notice : UTC-TAI = -37 s

 Leap seconds can be introduced in UTC at the end of the months of December
 or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
 six months, either to announce a time step in UTC, or to confirm that there
 will be no time step at the next possible date.

                                            Christian BIZOUARD
                                            Director
                                            Earth Orientation Center of IERS
					    Observatoire de Paris, France

Requested by:	rgrimes
Obtained from:	ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.3757622400
MFC after:	3 days
2019-05-11 14:22:21 +00:00
Rick Macklem
1a9a992fce Factor out some exportlist list operations into separate functions.
This patch moves the code that removes and frees all exportlist elements
out into a separate function called free_exports().
It does the same for the insertion of a new exportlist entry into a list.
It also adds a second argument to ex_search() for the list to use.
None of these changes have any semantic effect. They are being done to
prepare the code for future patches that convert the single linked list
for the exportlist to a hash table of lists and a patch that will do
incremental changes of exports in the kernel.
And it fixes the argument for SLIST_HEAD_INITIALIZER() to be a pointer,
which doesn't really matter, since SLIST_HEAD_INITIALIZER() doesn't use
the argument.

MFC after:	1 month
2019-05-10 23:52:17 +00:00
Emmanuel Vadot
67a5e53398 efibootmgr: Do not add the new boot entry in dry-run is specified
While here fix a typo.

Sponsored-by: Ampere Computing, LLC
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D20212
2019-05-10 16:44:35 +00:00
Mateusz Piotrowski
bc562d41f2 nfsd.8: Fix mandoc -Tlint and igor warnings
- Remove Tn macros
- Refernce sysctl(8) instead of sysctl(1)
- Start new sentences on new lines
- Capitalize NFS where needed
- Use Fx for FreeBSD
- Remove a list block (Bl) that was added to the manual page
  by accident in r335174

Reviewed by:	bcr
Approved by:	doc (bcr)
Differential Revision:	https://reviews.freebsd.org/D20215
2019-05-09 19:03:52 +00:00
Hans Petter Selasky
b4b75592d6 Ensure that only one command is specified at a time in mlx5tool(8).
Submitted by:	kib@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-05-08 11:05:30 +00:00
Hans Petter Selasky
998c9a2bbc Implement firmware reset from userspace in mlx5tool(8).
Submitted by:	kib@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-05-08 11:05:09 +00:00
Hans Petter Selasky
ff08edcb03 Document userspace firmware flash in mlx5tool(8) and mlx5io(4).
Submitted by:	kib@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-05-08 10:51:07 +00:00
Hans Petter Selasky
ea78f07b5e Implement userspace firmware update for ConnectX-4/5/6.
Submitted by:	kib@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-05-08 10:50:35 +00:00
Hans Petter Selasky
b255ca093a Rename mlx5_fwdump_addr to more neutral mlx5_tool_addr in mlx5core.
Submitted by:	kib@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-05-08 10:50:08 +00:00
Hans Petter Selasky
fc39af04df Fix typo.
Submitted by:	kib@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-05-08 10:43:35 +00:00
Hans Petter Selasky
db40c83fa7 Fix style.
Submitted by:	kib@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-05-08 10:42:51 +00:00
Enji Cooper
a6e9cd258c Fix clang -Wcast-qual issues
Remove unnecessary `char*` casting for arguments passed to `cget*(3)`, and
deconst `_PATH_PRINTCAP` before passing it to `cget*` via the `printcapdb`
variable.

This unblocks ^/projects/runtime-coverage-v2 from building cleanly on
universe13a.freebsd.org. I suspect the issue was introduced through some
changes to `bsd.*.mk` inclusion on the branch, which I will continue to
investigate/isolate.

MFC after:	1 week
Tested with:	clang 8 (arm64)
2019-05-04 02:09:30 +00:00
John Baldwin
8c74ade848 Increase the VirtIO segment count to support modern Windows guests.
The Windows virtio driver ignores the advertized seg_max field and
assumes the host can accept up to 67 segments in indirect descriptors,
triggering an assert in the bhyve process.

This brings back r282922 but with a couple of changes:
- It raises the block interface segment limit to 128 instead of 67.
- Linux's virtio driver assumes that the segment limit is no
  larger than the ring size.  To avoid breaking Linux guests,
  raise the VirtIO ring size to 128, and cap the VirtIO segment
  limit at ring size - 2 (effectively 126).

Reviewed by:	rgrimes, Patrick Mooney <pmooney@pfmooney.com>
Obtained from:	Joyent (Linux workaround)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D18831
2019-05-02 22:46:37 +00:00
Alexander Motin
eb1f7f43ca Respect quotes and escapes when splitting exports fields.
Without this r293305 was still unable to handle names with spaces.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2019-04-30 21:38:38 +00:00
Mark Johnston
180d54d009 Retry upon NET_RT_IFLIST sysctl failure.
Port the logic used by getifaddrs(3) to handle the case where
NET_RT_IFLIST returns ENOMEM, which can occur if the list size changes
between the buffer allocation and sysctl read.

PR:		195191
Submitted by:	Guy Yur <guyyur@gmail.com> (original version)
MFC after:	1 week
2019-04-30 14:44:39 +00:00
Rick Macklem
32e5d7a42e Add #ifdef INET6 around declaration of nbuf.
It was reported that without #ifdef INET6 around the declaration of "nbuf",
a build would report an unused variable. For some reason, I didn't see that
warning when I did a build, but it seems reasonable to add these #ifdef INET6's.

Submitted by:	dmitryluhtionov@gmail.com
MFC after:	1 week
2019-04-28 22:37:59 +00:00
Rodney W. Grimes
3facfc7560 Make bhyve SMBIOS table topology aware
When the CPU Topology was added to bhyve in r332298 the SMBIOS table was
missed, this table passes topology information to the system and was still
using the old concept of each vCPU is a socket with 1 core and 1 thread.
This code did not even try to use the old sysctl information to adjust
this data.

Correct that by building a proper SMBios table, mapping the > 254 cases to
0 per the SMBios 2.6 specification that is claimed by the structure.

Reviewed by:		Patrick Mooney <patrick.mooney@joyent.com>
Approved by:		bde and/or phk (mentor), jhb (maintainer)
MFC:			3 days
Differential Revision:	https://reviews.freebsd.org/D18998
2019-04-25 22:53:55 +00:00
Rodney W. Grimes
77be224862 Acpi MADT table correction for VM_MAXCPU > 21
The bhyve acpi MADT table was given a static space of 256 (0x100) bytes,
this is enough space to allow VM_MAXCPU to be 21, this patch changes that
so VM_MAXCPU can be of arbitrary value and not overflow the space by
actually calculating the space needed for the table.

PR:			212782
Reviewed by:		Patrick Mooney <patrick.mooney@joyent.com>
Approved by:		bde (mentor), jhb (maintainer)
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D18815
2019-04-25 22:52:44 +00:00
Rick Macklem
f736b5f9e9 Add support to nfsdumpstate for printing of INET6 addresses for locks.
r346190 added support for printing of INET6 addresses for the "-o" option
(all opens) but missed adding support for INET6 addresses for the "-l" option.
This patch adds that support.

PR:		223036
MFC after:	1 week
2019-04-25 21:25:32 +00:00
Emmanuel Vadot
9160989fc2 bsdinstall: up the interface before calling dhclient
MFC after:	1 week
2019-04-25 16:47:15 +00:00
John Baldwin
c1bba4445c Parse MIPS relocations to unbreak kldxref on MIPS.
Parse the R_MIPS_32 and R_MIPS_64 relocations.  Both Elf_Rel and
Elf_Rela relocations are handled since O32 MIPS uses Elf_Rel while N64
uses Elf_Rela.  Note that R_MIPS_32 is only handled for 32-bit mips
and R_MIPS_64 for 64-bit.  N32 is untested.

Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D19870
2019-04-24 23:35:10 +00:00
Colin Percival
0b18e008cc Keep two versions of the FreeBSD.conf pkg configuration file; one which
points at the "latest" branch and one which points at the "quarterly"
branch.  Install the "latest" version unless overridden via the newly
added PKGCONFBRANCH variable.

This does not change user-visible behaviour (assuming said vairable is
not set) but will make it easier to change the defaults in the future --
on stable branches we will want "latest" on x86 but "quarterly" elsewhere.

Discussed with:	gjb
MFC after:	3 days
X-MFC:		After MFCing this I'll make a direct commit to stable/* to
		switch non-x86 architectures to "quarterly".
2019-04-24 06:25:21 +00:00
Cy Schubert
4bc523382c MFV r346563:
Update wpa_supplicant/hostapd 2.7 --> 2.8

Upstream documents the following advisories:

- https://w1.fi/security/2019-1/sae-side-channel-attacks.txt
- https://w1.fi/security/2019-2/eap-pwd-side-channel-attack.txt
- https://w1.fi/security/2019-3/sae-confirm-missing-state-validation.txt
- https://w1.fi/security/2019-4/eap-pwd-missing-commit-validation.txt
- https://w1.fi/security/2019-5/eap-pwd-message-reassembly-issue-\
  with-unexpected-fragment.txt

Relnotes:	yes
MFC after:	1 week (or less)
Security:	CVE-2019-9494, VU#871675, CVE-2019-9495, CVE-2019-9496,
		CVE-2019-9497, CVE-2019-9498, CVE-2019-9499
2019-04-23 03:52:43 +00:00
Enji Cooper
da5069e1f7 Update the spelling of my name
Previous spellings of my name (NGie, Ngie) weren't my legal spelling. Use Enji
instead for clarity.

While here, remove "All Rights Reserved" from copyrights I "own".

MFC after:	1 week
2019-04-22 17:52:46 +00:00
Mark Johnston
d6ef759e5d Use separate descriptors in bhyve's stdio uart backend.
bhyve was previously using stdin for both reading and writing to the
console, which made it difficult to redirect console output.  Use
stdin for reading and stdout for writing.  This makes it easier to use
bhyve as a backend for syzkaller.

As a side effect, the change fixes a minor bug which would cause bhyve
to fail with ENOTCAPABLE if configured to use nmdm for com1 and stdio
for com2.

bhyveload already uses separate descriptors, as does the bvmcons driver.

Reviewed by:	jhb
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19788
2019-04-22 13:57:52 +00:00
Kyle Evans
bd6174f74c cron(8): schedule interval jobs that get loaded during execution
Jobs using the @<second> syntax currently only get executed if they exist
when cron is started. The simplest reproducer of this is:

echo '@20 root echo "Hello!"' >> /etc/cron.d/myjob

myjob will get loaded at the next second==0, but this echo job will not
run until cron restarts. These jobs are normally handled in
run_reboot_jobs(), which sets e->lastexit of INTERVAL jobs to the startup
time so they run 'n' seconds later.

Fix this by special-casing TargetTime > 0 in the database load. Preexisting
jobs will be handled at startup during run_reboot_jobs as normal, but if
we've reloaded a database during runtime we'll hit this case and set
e->lastexit to the current time when we process it. They will then run every
'n' seconds from that point, and a full restart of cron is no longer
required to make these jobs work.

Reported by:	Juraj Lutter (otis_sk.freebsd.org)
Reviewed by:	allanjude, bapt, bjk (earlier version), Juraj Lutter
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D19924
2019-04-20 02:54:20 +00:00
Emmanuel Vadot
91221f548e config: Only warn if duplicate option/device comes from the same file
This is useful for arm (possibly other arches too) where we want to have
a GENERIC kernel that only include files for the different SoC. Since
multiple SoCs/Board needs the same device we would need to do either :

    Include the device in a generic file
    Include the device in each file that really needs it

Option 1 works but if someone wants to create a specific kernel config
(which isn't uncommon for embedded system), he will need to add a lots
of nodevice to it.

Option 2 also works but produce a lots of warnings.

Reviewed by:	kevans
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D19424
2019-04-16 20:08:19 +00:00
Glen Barber
0135283d1b Remove INDEX-10 reference, as 10.x is now EoL.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2019-04-16 14:07:14 +00:00
Kyle Evans
aebda5bf06 config(8): replace opteq with a call to strcasecmp
This obscures the comparison slightly less; when option name appear in
files, they are case-insensitive.

MFC after:	1 week
2019-04-15 21:20:06 +00:00
Kyle Evans
12455a9e31 cron(8): Add MAILFROM ability for crontabs
This changes the sender mail address in a similar fashion to how MAILTO may
change the recipient. The default from address remains unchanged.

MFC after:	1 week
2019-04-15 18:53:28 +00:00
Chuck Tuffli
f0dfbcccf4 Revert r345171 pending review
Backing out commit pending further discussion on the PCIe version
supported by pseudo (i.e. emulated) devices. See Differential for
details.

Reviewed by:	imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D19580
2019-04-13 23:37:27 +00:00
Rick Macklem
11f0e011c8 Fix nfsdumpstate(8) so that it can print out INET6 callback addresses.
The patch adds support for printing of INET6 callback addresses.
It also adds the #ifdef INET, INET6 as requested by bz@.

PR:		223036
Reviewed by:	bz, rgrimes
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D19839
2019-04-13 21:45:45 +00:00
Alexander Motin
cfe60d67ae Fix thread name buffer overflow.
MFC after:	1 week
2019-04-12 18:13:57 +00:00
Edward Tomasz Napierala
1383afcb99 Fix segfault that could occur on "automount -LL".
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2019-04-10 16:09:06 +00:00
Bruce Evans
b96ab4102e Fix restoring the geometry when recovering from an error. Just restore the
previous geometry, and don't do extra work to calculate the default geometry
so as to reset to that.
2019-04-08 04:07:37 +00:00
Mark Johnston
1906d427c1 Stop compiling bhyve(8) with -O0.
DEBUG_FLAGS is always added to CFLAGS.  This setting appears to be
accidental and came in with r243327.

Reviewed by:	anish, emaste, jhb, rgrimes
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19787
2019-04-07 14:30:17 +00:00
Mark Johnston
76086f9c5a Fix indentation.
No functional change intended.

Reviewed by:	bcran, jhb, rgrimes
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19786
2019-04-07 14:28:02 +00:00
Rick Macklem
9d02d8da07 Delete the BUGS entry related to failing when jails are enabled.
r345994 has finally fixed the bug that caused the nfsuserd(8) daemon to
fail when jails were enabled, so delete the BUGS entry from the man page.

PR:		205193
MFC after:	2 weeks
2019-04-06 22:14:03 +00:00
Rick Macklem
ce78460aeb Fix nfsuserd so that it handles the mapped localhost address when jails
are enabled.

The nfsuserd(8) daemon does not function correctly when jails are enabled,
since localhost gets mapped to another IP address and, as such, the upcall
RPC fails.
This patch fixes the problem by doing a getsockname(2) of a socket mapped
to localhost to find out what the correct address is for the comparison
test with the upcall's from IP address.
This patch also adds INET6 support and the required #ifdef's for INET and
INET6. It now uses INET6 by default for the upcalls, if the kernel has
INET6 support and the daemon is also built with INET6 support.

Tested by:	freebsd@danielengel.com (earlier version)
PR:		205193
Reviewed by:	bz, rgrimes
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D19218
2019-04-06 22:05:51 +00:00
Konstantin Belousov
ca34d6aeda Fix gcc warning about shadowed global.
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
2019-04-05 20:12:19 +00:00
Konstantin Belousov
4fbf8e1c2e Implement devctl(8) command 'reset', using DEV_RESET /dev/devctl2 ioctl.
Reviewed by:	imp (previous version), jhb (previous version)
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D19646
2019-04-05 19:32:26 +00:00
Chuck Tuffli
a1daa3ae5e bhyve: Fix NVMe data structure copy to guest
bhyve's NVMe emulation was transferring Identify data back to the guest
incorrectly causing memory corruptions. These corruptions resulted in
core dumps and other system level errors in the guest.

In their simplest form, NVMe Physical Region Page (PRP) values in
commands indicate which physical pages to use for data transfer. The
first PRP value is not required to be page aligned but does not cross a
page boundary. The second PRP value must be page aligned, does not cross
a page boundary, and need not be contiguous with PRP1.

The code was copying Identify data past the end of PRP1. This happens to
work if PRP1 and PRP2 are physically contiguous but will corrupt guest
memory in unpredictable ways if they are not.

Fix is to copy the Identify data back to the guest piecewise (i.e. for
each PRP entry). Also fix a similarly wrong problem when copying back
Log page data.

Reviewed by:	imp (mentor), araujo, jhb, rgrimes, bhyve
Approved by:	imp (mentor), bhyve (jhb)
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D19695
2019-04-05 16:54:20 +00:00
Chuck Tuffli
fe1b713e2c bhyve: Fix NVMe BAR size calculation
The NVMe specification defines bits 13:4 of BAR0 as Reserved (i.e. 0x0).
Most drivers do not enforce this, but the Windows NVMe driver does and
will refuse to start the device (i.e. error 10) if any of these bits are
set.

The current BAR size calculation tries to minimize the amount of memory
the device reserves by scaling the BAR size by the maximum number of
queues supported by the device. But unless the device supports a large
number of queue pairs (over 1536), it will reserve too little memory.

The fix is to allocate a minimum of 16K bytes for BAR0.

Tested on Windows Server 2016 and 2019

Reviewed by:	imp (mentor), araujo, jhb, bhyve
Approved by:	imp (mentor), bhyve (jhb)
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D19676
2019-04-05 16:54:16 +00:00
Andrey V. Elsukov
04d1781439 Add IPv6 transport for bsnmp.
This patch adds a new table begemotSnmpdTransInetTable that uses the
InetAddressType textual convention and can be used to create listening
ports for IPv4, IPv6, zoned IPv6 and based on DNS names. It also supports
future extension beyond UDP by adding a protocol identifier to the table
index. In order to support this gensnmptree had to be modified.

Submitted by:   harti
MFC after:      1 month
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D16654
2019-04-02 12:50:01 +00:00
Jung-uk Kim
278f0de60d Merge ACPICA 20190329. 2019-03-29 20:21:28 +00:00
Enji Cooper
e8067928ff Standardize -std=c++* as CXXSTD`
CXXSTD was added as the C++ analogue to CSTD.

CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`,
otherwise for older versions of g++.

This change standardizes the CXXSTD variable, originally added to
googletest.test.inc.mk as part of r345203.

As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`.

Notes:

This value is not sanity checked in bsd.sys.mk, however, given the two
most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is
likely to work with both toolchains. This method will be refined in the future
to support more variants of C++, as not all versions of clang++ and g++ (for
instance) support C++14, C++17, etc.

Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD.
Example:

Before this commit:
```
CXXFLAGS+=	-std=c++14
```

After this commit:
```
CXXSTD=	c++14
```

Reviewed by:	asomers
Approved by:	emaste (mentor)
MFC after:	1 month
MFC with:	r345203, r345704, r345705
Relnotes:	yes
Tested with:	make tinderbox
Differential Revision:	https://reviews.freebsd.org/D19732
2019-03-29 18:45:27 +00:00
Enji Cooper
bdbf3440ce Revert r345706: the third time will be the charm
When a review is closed via Phabricator it updates the patch attached to the
review. I downloaded the raw patch from Phabricator, applied it, and repeated
my mistake from r345704 by accident mixing content from D19732 and D19738.

For my own personal sanity, I will try not to mix reviews like this in the
future.

MFC after:	1 month
MFC with:	r345706
Approved by:	emaste (mentor, implicit)
2019-03-29 18:43:46 +00:00
Enji Cooper
760b1a815b Standardize -std=c++* as CXXSTD`
CXXSTD was added as the C++ analogue to CSTD.

CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`,
otherwise for older versions of g++.

This change standardizes the CXXSTD variable, originally added to
googletest.test.inc.mk as part of r345203.

As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`.

Notes:

This value is not sanity checked in bsd.sys.mk, however, given the two
most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is
likely to work with both toolchains. This method will be refined in the future
to support more variants of C++, as not all versions of clang++ and g++ (for
instance) support C++14, C++17, etc.

Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD.
Example:

Before this commit:
```
CXXFLAGS+=	-std=c++14
```

After this commit:
```
CXXSTD=	c++14
```

Reviewed by:	asomers
Approved by:	emaste (mentor)
MFC after:	1 month
MFC with:	r345203, r345704, r345705
Relnotes:	yes
Tested with:	make tinderbox
Differential Revision:	https://reviews.freebsd.org/D19732
2019-03-29 18:31:48 +00:00
Enji Cooper
752cabaa1c Revert r345704
I accidentally committed code from two reviews. I will reintroduce the code to
bsd.progs.mk as part of a separate commit from r345704.

Approved by:	emaste (mentor, implicit)
MFC after:	2 months
MFC with:	r345704
2019-03-29 18:16:33 +00:00
Enji Cooper
9a41926bfb CXXSTD is the C++ analogue to CSTD.
CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`,
otherwise for older versions of g++.

This change standardizes the CXXSTD variable, originally added to
googletest.test.inc.mk as part of r345203.

As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`.

Notes:

This value is not sanity checked in bsd.sys.mk, however, given the two
most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is
likely to work with both toolchains. This method will be refined in the future
to support more variants of C++, as not all versions of clang++ and g++ (for
instance) support C++14, C++17, etc.

Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD.
Example:

Before this commit:
```
CXXFLAGS+=	-std=c++14
```

After this commit:
```
CXXSTD=	c++14
```

Reviewed by:	asomers
Approved by:	emaste (mentor)
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D19732
2019-03-29 18:13:44 +00:00
Edward Tomasz Napierala
f322b7b058 Reduce the precision of "MB/s" by one, making room for displaying
transfer rates larger 99MB/s.

MFC after:	2 weeks
2019-03-29 16:05:30 +00:00
Edward Tomasz Napierala
100b034530 Make the "KB/s" field one character shorter (by reducing the precision)
and use the space to make the "tps" one character longer.

It makes the iostat(8) output a bit less messed up.

Reviewed by:	allanjude
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D19710
2019-03-28 20:16:19 +00:00
Michael Gmelin
4f6714d53b Correct contradictory information on default syslog logging priority.
MFC after:	1 week
2019-03-25 21:14:51 +00:00
Ed Maste
286258a9a0 makefs: Fix "time" mtree attribute handling
When processing mtree(5) MANIFEST files, makefs(8) previously threw an
error if it encountered an entry whose "time" attribute contained a
non-zero subsecond component (e.g. time=1551620152.987220000).

Update the handling logic to properly assign the subsecond component if
built with nanosecond support, or silently discard it otherwise.

Also, re-enable the time attribute for the kyua tests.

PR:		194703
Submitted by:	Mitchell Horne <mhorne063@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D19627
2019-03-18 19:26:36 +00:00
Eugene Grosbein
fa707ac77f trim(8): emit more user-friendly error message in verbose mode.
If underlying driver provides no TRIM/UNMAP support and operation fails
due to this reason, state it clearly in verbose mode (default)
instead of writing standard message that may be too cryptic for a user:

	trim: ioctl(DIOCGDELETE) failed: nda0: Operation not supported

Now it would write:

	trim: nda0: TRIM/UNMAP not supported by driver

But still use previous format including errno value for quiet mode.

Small candelete() function borrowed from diskinfo(8) code.
This function was committed by Alan Somers <asomers@FreeBSD.org>,
so give him some credit.

Reported by:	chuck
2019-03-15 14:42:23 +00:00
Chuck Tuffli
2ba640758d Fix bhyve PCIe capability emulation
PCIe devices starting with version 1.1 must set the Role-Based Error
Reporting bit.

And while we're in the neighborhood, generalize the code assigning the
device type.

Reviewed by:	imp, araujo, rgrimes
Approved by:	imp (mentor)
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D19580
2019-03-15 02:11:28 +00:00
Chuck Tuffli
7bb1073842 Fix bhyve's NVMe Identify Namespace data
The NVMe Identify Namespace data structure's Number of LBA Formats
(NLBAF) field is a 0's based value (i.e. 0x0 means 1). Since the
emulation only supports a single format, set NLBAF to 0x0, not 1.

Reviewed by:	imp, araujo, rgrimes
Approved by:	imp (mentor)
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D19579
2019-03-15 02:11:27 +00:00
Conrad Meyer
55792380c3 bhyve(8): Fix uart emulation bug
THRE is always asserted in LSR reads, so REG_IER writes that raise
IER_ETXRDY must also set thre_int_pending.

Reported by:	Illumos, according to emaste@
		https://twitter.com/ed_maste/status/1106195949087584258
MFC after:	2 weeks
2019-03-14 21:08:48 +00:00
Mateusz Piotrowski
f0181db72e chroot.8: Add examples & clean up
- Sort arguments in synopsis.
- Clarify that it is possible to specify arguments to the command (and that
  they could be passed as further arguments to chroot(1)).
- Standardize the description of the flags.
- Improve formatting (e.g., do not use macros in strings specifying width).
- Add examples.

Reviewed by:	bcr
Approved by:	bcr (doc)
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D19582
2019-03-14 14:34:36 +00:00
Eugene Grosbein
7f65491576 trim(8): add another safety net
It is quite easy make a mistake and run something like this:

	trim -f /dev/da0 -r rfile

This would trim the whole device then emit an error on non-existing file -r.

Add another check to prevent this while allowing this form still
for real object names beginning from dash:

	trim -f -- /dev/da0 -r rfile

MFC after:	1 week
2019-03-14 12:25:16 +00:00
Pietro Cerutti
5654a00747 freebsd-update: restore old exit code when no updates are available locally
This unbreaks ezjail and iocell, which get into an endless loop trying to
figure out how many times "freebsd-update install" needs to be called.

PR:		229346
Submitted by:	Mike Cole <mcole36@gmail.com>
Approved by:	bapt
MFC after:	1 week
2019-03-12 08:31:43 +00:00
Alan Somers
809a8352dd Drop "All rights reserved" from the files I own
Also, add SPDX tags where needed.

MFC after:	2 weeks
2019-03-11 22:23:56 +00:00
Cy Schubert
052d159a8b MFV r344878:
4.2.8p12 --> 4.2.8p13

MFC after:	immediately
Security:	CVE-2019-8936
		VuXML: c2576e14-36e2-11e9-9eda-206a8a720317
Obtained from:	nwtime.org
2019-03-07 13:36:00 +00:00
Rebecca Cran
7b1f3e08d9 Document the efivar --load-option option
Reviewed by:	imp, kevans
Sponsored by:	Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D19263
2019-03-07 00:01:28 +00:00
John Baldwin
2e43efd0bb Drop "All rights reserved" from my copyright statements.
Reviewed by:	rgrimes
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D19485
2019-03-06 22:11:45 +00:00
Ed Maste
3f877103dd freebsd-update.8: update example to contemporary versions
PR:		235761
Reported by:	linimon
MFC after:	1 week
2019-03-05 19:17:24 +00:00
Hiroki Sato
9ae4c2a48d Fix grammar.
Submitted by:	Massimiliano Stucchi
2019-03-05 02:53:41 +00:00
Bjoern A. Zeeb
9784899d58 Fix compilation of world with WITHOUT_{INET,INET6}_SUPPORT or both set.
Buildworld failed when both WITHOUT_INET6_SUPPORT and INET equivalent were set.
Fix netstat and syslogd by applying appropriate #ifdef INET/INET6 to make world
compile again.

Reviewed by:		ngie, hrs, ume
Welcomed by:		Michael Dexter (D17040)
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D19418
2019-03-03 10:00:26 +00:00
Hiroki Sato
27a1e60984 Use struct addrinfo instead of struct sockaddr_storage
to store peer addresses.
2019-03-03 05:30:15 +00:00
Mark Johnston
ee74c3327a rtsol: Use vwarnx(3) to log messages to standard error.
This ensures that the program name is included in the output, which
makes it easy to identify the source of error messages printed
during boot.

MFC after:	1 week
2019-02-27 18:13:41 +00:00
Leandro Lupori
7e4520854c Fix kldxref on PowerPC64
When using kldxref on kernel modules built with clang8 + lld8,
kldxref would be unable to find the modules metadata information,
because PowerPC64 was using the ef_nop.c implementation of
ef_reloc().

When GNU LD was used, it was also relocating the metadata section of
the .ko file. LLD does not do this, but only generate dynamic
relocations for it. With minor changes, ef_powerpc.c can now work
for PowerPC64 too.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D19370
2019-02-27 13:24:42 +00:00
Mateusz Piotrowski
4f2f8d7d14 sysrc.8: Pet igor and mandoc
Reviewed by:	bcr
Approved by:	bcr (doc)
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D19348
2019-02-26 09:28:10 +00:00
Maxim Sobolev
781e78182d Improve error handling: bail out if one of the files scheduled
to go to the FS image we are making cannot be read (e.g. EPERM).
Current behaviour when we issue waring but still proceeed and
return success is definitely not correct: masking out error
condition as well as making a slighly inconsistent FS where
attempt to access the file in question ends up in EBADF. See
linked DR for details.

MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D18584
2019-02-25 23:45:36 +00:00
Ed Maste
e098c4fc55 Revert r344211: wlandebug: disable PIE to fix build failure
As of r344530 libifconfig is built as a standard INTERNALLIB and the
wlandebug PIE workaround from r344211 can be removed.
2019-02-25 18:27:19 +00:00
Hajimu UMEMOTO
22cd7e923f An IPv6 address matching should be fixed. Specifying an IPv6
address by the -a option was broken since r309933.

Reported by:	"O. Hartmann" <ohartmann [...] walstatt.org>
MFC after:	1 week
2019-02-24 03:41:05 +00:00
David Bright
1f641a35fd Fix several Coverity-detected issues in newsyslog.
- CID 1394815, CID 1305673: Dereference before null check - memory was
  allocated and the allocation checked for NULL with a call to errx()
  if it failed. Code below that was guaranteed that the pointer was
  non-NULL, but there was another check for NULL at the exit of the
  function (after the memory had already been referenced). Eliminate
  the useless NULL check.

- CID 1007452: Resource leak - Storage intended to be allocated and
  returned to the caller was never freed. This was the result of a
  regression in the function signature introduced in r208648 (2010)
  (thanks for that find, @cem!). Fixed by altering the function
  signature and passing the allocated memory to the caller as
  intended. This also fixes PR158794.

- CID 1008620: Logically dead code in newsyslog.c - This was a direct
  result of CID 1007452. Since the memory allocated as described there
  was not returned to the caller, a subsequent check for the memory
  having been allocated was dead code. Returning the memory
  re-animates the code that is the subject of this CID.

- CID 1006131: Unused value - in parsing a configuration file, a
  pointer to the end of the last field was saved, but not used after
  that. Rewrite to use the pointer value. This could have been fixed
  by avoiding the assignment altogether, but this solutions more
  closely follows the pattern used in the preceding code.

PR:		158794
Reported by:	Coverity, Ken-ichi EZURA <k.ezura@gmail.com> (PR158794)
Reviewed by:	cem, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D19105
2019-02-22 15:31:50 +00:00
David Bright
c7189f3694 Revert r344389 & r343906 - Fix Coverity errors in newsyslog
It was pointed out that a couple of the "memory leak" CIDs that I
fixed were arguably Coverity errors rather than errors in the
newsyslog code and the cure was worse than the disease. Revert both
changes. The first change, which included fixes for other Coverity
errors, will be re-worked to omit the troublesome changes and then
re-committed with the remaining fixes.

Reported by:	bde
Sponsored by:	Dell EMC Isilon
2019-02-22 14:59:40 +00:00
Bruce Evans
4138acc544 Oops, actually fix warnings from -Wpointer-sign. 2019-02-22 07:00:23 +00:00
Bruce Evans
15d64f4eaa Fix warnings from -Wpointer-sign. 2019-02-22 06:57:46 +00:00
Bruce Evans
d09131e044 Connect the restored dumb and sc terminal emulators to the kernel build.
Add or fix options to control static and dynamic configuration.  Keep
the default of scteken, but default to statically configuring all available
emulators (now 3 instead of 1).

The dumb emulator is almost usable.  libedit and libreadline handle
dumb terminals perfectly for at least shell history.  less(1) works
as well as possible except on exit.  But curses programs make messes.
The dumb emulator has strange color support, with 2 dumb colors for
normal output but fancy colorization for the cursor, mouse pointer and
(with a non-dumb initial emulator) for low-level console output.

Using the sc emulator instead of the default of scteken fixes at least
the following bugs:
- NUL is a printing character in cons25 but not in teken
- teken doesn't support fixed colors for "reverse" video.
- The best versions of sc are about 10 times faster than scteken (for
  printing to the frame buffer).  This version is only about 5 times
  faster.

Fix configuration features:
- make SC_DFLT_TERM (for setting the initial emulator) a normal option.

Add configuration features:
- negative options SC_NO_TERM_* for omitting emulators in the static config.
  Modules for emulators might work, but I don't know of any
- vidcontrol -e shows the available emulators
- vidcontrol -E <emulator> sets the active emulator.
2019-02-22 06:41:47 +00:00
Sean Eric Fagan
c0ca37d17b Fix the usage error I introduced in r344192.
Specifically, I put the new option line in the wrong place, and then fixed
up the rest without realizing it.  This puts the usage statement back to
what it was, with an additional line for the new -V option.

Reported by:	mav
Sponsored by:	iXsystems Inc.
2019-02-21 22:49:39 +00:00
Jung-uk Kim
f8c531e603 Catch up with ACPICA 20190215.
PR:		235922
2019-02-21 21:15:49 +00:00
Sean Eric Fagan
c6da8eb21f * Handle SIGPIPE in gssd
We've got some cases where the other end of gssd's AF_LOCAL socket gets
closed, resulting in an error (and SIGPIPE) when it tries to do I/O to it.
Closing without cleaning up means the next time nfsd starts up, it hangs,
unkillably; this allows gssd to handle that particular error.

* Limit the retry cound in gssd_syscall to 5.
The default is INT_MAX, which effectively means forever.  And it's an
uninterruptable RPC call, so it will never stop.

The two changes mitigate the problem.

Reviewed by:	macklem
MFC after:	2 weeks
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D19153
2019-02-21 01:30:37 +00:00
David Bright
2c3e626a0d Complete fix for CID 1007454, CID 1007453: Resource leak in newsyslog
The result of a strdup() was stored in a global variable and not freed
before program exit. This is a follow-up to r343906. That change
attempted to plug these resource leaks but managed to miss a code path
on which the leak still occurs. Plug the leak on that path, too.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2019-02-20 22:05:44 +00:00
Rebecca Cran
748f247a44 Add the unix path to the output of efivar --load-option
Reviewed by:	imp
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D19242
2019-02-20 05:19:16 +00:00
Ed Maste
df7e2e0d99 freebsd-update: Clarify help text
Improve help text to include example release numbers for reference
and clarify the -F option.

PR:		231185, 214619
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij, rgrimes
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18944
2019-02-19 17:38:24 +00:00
Andriy Voskoboinyk
e5cb99d5a2 snmp_hostres(3): fix a typo in sanity checks in handle_chunk()
PR:		204253
Submitted by:	David Binderman <dcb314@hotmail.com>
MFC after:	5 days
2019-02-18 03:23:10 +00:00
Andriy Voskoboinyk
994558c335 Fix memory / resource leaks in usr.sbin/rpc.ypupdated/update.c
Re-apply r343909 to this file to get the issue fixed.

PR:		204956
Reported by:	David Binderman <dcb314@hotmail.com>
MFC after:	5 days
2019-02-18 03:15:25 +00:00
Justin Hibbits
bc4d122db0 powerpc/boot: Move ubldr to /boot/uboot, and make this a separate filesystem
Summary:
Now that mpc85xx can boot via ubldr, move ubldr to a separate
filesystem, mounted on /boot/uboot, so that a fresh install can boot correctly.

Reviewed By: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D18709
2019-02-18 01:57:47 +00:00
Ed Maste
8323b6417c wlandebug: disable PIE to fix build failure
libifconfig is built as a static-only PRIVATELIB (and there is no _pie.a
version) so disable PIE in libifconfig's consumer.

Sponsored by:	The FreeBSD Foundation
2019-02-16 12:49:55 +00:00
Sean Eric Fagan
025816d9ce Add support for a virtual hostname to nfsd
Specifically, this allows (via "-V vhostname") telling nfsd what principal
to use, instead of the hostname.  This is used at iXsystems for fail-over in
HA systems.

Reviewed by:	macklem
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D19191
2019-02-16 00:15:54 +00:00
Rodney W. Grimes
11e67b92b5 In r340044 an attempt to quiet coverity warning cid 1357336
was incorrectly implemented leading to a possible double free.

It is possible for both the conditional free,
and the unconditional free added in r340044 to be done,
fix that by initializing uopt to NULL,
removing the conditional free,
and only using the unconditional free at the end.

Reported by:	Patrick Mooney (patrick.mooney@joyent.com)
Reviewed by:	jhb (maintainer), Patrick Mooney (joyent/illumos)
Approved by:	bde (mentor)
CID:		1357336
MFC after:	3 days
MFC with:	340044
Differential Revision:	https://reviews.freebsd.org/D19202
2019-02-15 16:48:15 +00:00
Rodney W. Grimes
85cf19adc5 In r340042 an attempt to quiet coverity warning cid 1305412 was overdone.
nopt is the only allocated space,
xopt and cp are aliases into that allocated space.
Remove the 2 unneeded free's

Reported by:	Patrick Mooney (@pmooney_pfmooney.com)
Reviewed by:	jhb (maintainer), Patrick Mooney (joyent/illumos)
Approved by:	bde (mentor)
CID:		1305412
MFC after:	3 days
MFC with:	340042
Differential Revision:	https://reviews.freebsd.org/D19200
2019-02-15 16:20:21 +00:00
Warner Losh
4def346d56 Revert r343077 until the license issues surrounding it can be resolved.
Approved by:	core@
2019-02-12 19:05:09 +00:00
Martin Cracauer
bc235bb54d Bump .Dd for today's edit.
Thank you Enji Cooper
2019-02-11 16:31:15 +00:00
Martin Cracauer
aa255a10b0 Clarify NFSv4 /etc/exports semantics, with working example.
The existing wording has been confusing users for years.
2019-02-11 15:51:28 +00:00
Benedict Reuschling
60c81cf107 Add an example to pw.8 about how to add an existing user to a group.
Instead of using pw to modify group membership, users often edit
/etc/group by hand, which is discouraged.  Provide an example of
adding a user to the wheel group, which is a common use case.
I'm using a different user here as in the previous example as that
deleted the user (although the examples don't necessarily have to
be followed in order).

Reviewed by:	rgrimes,0mp
Approved by:	0mp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D19123
2019-02-08 22:10:40 +00:00
David Bright
00c4df53b6 Fix several Coverity-detected issues in newsyslog.
- CID 1394815, CID 1305673: Dereference before null check - memory was
  allocated and the allocation checked for NULL with a call to errx()
  if it failed. Code below that was guaranteed that the pointer was
  non-NULL, but there was another check for NULL at the exit of the
  function (after the memory had already been referenced). Eliminate
  the useless NULL check.

- CID 1007454, CID 1007453: Resource leak - The result of a strdup()
  was stored in a global variable and not freed before program exit.

- CID 1007452: Resource leak - Storage intended to be allocated and
  returned to the caller was never freed. This was the result of a
  regression in the function signature introduced in r208648 (2010)
  (thanks for that find, @cem!). Fixed by altering the function
  signature and passing the allocated memory to the caller as
  intended. This also fixes PR158794.

- CID 1008620: Logically dead code in newsyslog.c - This was a direct
  result of CID 1007452. Since the memory allocated as described there
  was not returned to the caller, a subsequent check for the memory
  having been allocated was dead code. Returning the memory
  re-animates the code that is the subject of this CID.

- CID 1006131: Unused value - in parsing a configuration file, a
  pointer to the end of the last field was saved, but not used after
  that. Rewrite to use the pointer value. This could have been fixed
  by avoiding the assignment altogether, but this solutions more
  closely follows the pattern used in the preceding code.

PR:		158794
Reported by:	Coverity, Ken-ichi EZURA <k.ezura@gmail.com> (PR158794)
Reviewed by:	cem, markj
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2019-02-08 13:54:16 +00:00
Hans Petter Selasky
2d3a84f5b0 Improve Bluetooth device discovery support for Android and Microsoft devices.
Tested using the virtual_bt_speaker(8) tool from the virtual_oss(8)
project at github.com.

PR:			210089
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2019-02-08 13:10:45 +00:00
Yuri Pankov
d70ad055e0 pwm.8: fix markup in synopsis, add -f description
Reviewed by:	bcr, manu
Differential revision:	https://reviews.freebsd.org/D18829
2019-02-06 04:00:37 +00:00
Warner Losh
d3f1313287 Remove All Rights Reserved
Remove the all rights reserved clause from my copyright, and make
other minor tweaks needed where that might have created ambiguity.
2019-02-05 21:37:34 +00:00
Warner Losh
52467047aa Regularize the Netflix copyright
Use recent best practices for Copyright form at the top of
the license:
1. Remove all the All Rights Reserved clauses on our stuff. Where we
   piggybacked others, use a separate line to make things clear.
2. Use "Netflix, Inc." everywhere.
3. Use a single line for the copyright for grep friendliness.
4. Use date ranges in all places for our stuff.

Approved by: Netflix Legal (who gave me the form), adrian@ (pmc files)
2019-02-04 21:28:25 +00:00
Alexander Motin
fe74eaab7c Check element type before setting LEDs.
With r319610, sesutil started twiddling the bits of every SES device.
Not everything is a disk slot, there are also fan controllers, temperature
sensors, even power supplies, among other things controlled by SES.

Add a type check to make sure we are only operating on device slot and array
device slot elements.  Other type elements will be skipped, but it would be
simple to add additional cases for controlling the ident LEDs of other
element types (which are not necessarily the same bits).

Rather than doing raw bit manipulation of an unstructured byte array using
unnamed numeric constants, leverage existing code abstractions.

Submitted by:	Ryan Moeller <ryan@freqlabs.com>
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D19052
2019-02-04 01:24:10 +00:00
Doug Rabson
2335240c66 Reduce log spam from rpc.statd
This only reports failed attempts to contact hosts on the first attempt.
2019-02-03 08:15:26 +00:00
Marcelo Araujo
4edc7f418a Revert r343634:
Mostly a cosmetic change to replace strlen with strnlen.

Requested by:	kib and imp
2019-02-01 03:09:11 +00:00
Marcelo Araujo
7722142ba8 Mostly a cosmetic change to replace strlen with strnlen.
Obtained from:	Project ACRN
MFC after:	2 weeks
2019-01-31 23:32:19 +00:00
Ed Maste
9c812c8d4e freebsd-update: regenerate man page database after update
These are currently not reproducible because they're built by the
makewhatis on the freebsd-update build host, not the one in the tree.
Regenerate after update, and later we can avoid including it in
freebsd-update data.

PR:		214545, 217389
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10482
2019-01-30 19:19:14 +00:00
Andriy Voskoboinyk
602fa83239 ndiscvt(8): abort if no IDs were found during conversion.
Checked with Broadcom driver mentioned in PR 179285.

PR:		69268
Submitted by:	<darius@dons.net.au>
MFC after:	5 days
2019-01-30 12:32:47 +00:00
Hans Petter Selasky
21be80ae80 Add support for Audio Sink and Audio Source profiles to sdpd(8).
This allows user-space programs like virtual_oss(8) to act
as a Bluetooth speaker device.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2019-01-30 09:44:54 +00:00
Cy Schubert
7aef71382b Fix 32-bit buildworld broken by r343438. 2019-01-25 20:53:29 +00:00
Takanori Watanabe
877fc2e350 Use ACPI TPM2 table to probe tpmtis and tpmcrb device.
Differential Revision: https://reviews.freebsd.org/D18937
2019-01-25 16:16:10 +00:00
Enji Cooper
b882e02bc4 Fix a typo/wordsmith a description modified in r343407
r343407 accidentally introduced a typo (folling -> following). While
reading the change out loud, I realized that the original sentence was
wordy. almost sounding like a run-on sentence.

Improve the flow by splitting up the two thoughts into two distinct sentence
fragments.

PR:		194547, 208497
Reviewed by:	emaste
Approved by:	emaste (mentor)
MFC after:	1 month
MFC with:	r343407
Differential Revision: https://reviews.freebsd.org/D18947
2019-01-24 20:35:58 +00:00
Ed Maste
9e8c28fcc0 freebsd-update: Clarify unsupported upgrade message
PR:		204115
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18916
2019-01-24 18:51:15 +00:00
Ed Maste
ed1b6cec4f freebsd-update: fix style from r343271 change
PR:		234771
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
MFC with:	r343271
Sponsored by:	The FreeBSD Foundation
2019-01-24 18:48:15 +00:00
Ed Maste
ae97aa98ea freebsd-update: Stop installing empty component sets
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by:	rgrimes
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18927
2019-01-24 18:41:00 +00:00
Ed Maste
fc24ba59ee freebsd-update: open $PAGER only if necessary
PR:		194547, 208497
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2019-01-24 18:26:30 +00:00
Stefan Eßer
96329ce7e2 Silence Clang Scan warning about use of unitialized variable.
While the warning is a false positive, it is possible to clarify the code by
always initializing the variable. This does also allow to make the sending
of the "beep" control sequence depend on the validity of its parameters.

I have left the redundant assignment of 0 to the now initialized variables
in place since this makes the code simpler to understand and does not add
any run-time overhead (the compiler completely removes the "else if" test
and the assignments).

There was an embedded literal escape character in a string, which messes up
diplaying the source code on a terminal that interprets ANSI sequences. The
literal escape has been replaced by \e (non-standard, but supported by all
relevant compilers, and already used in other source files in base).

MFC after:	2 weeks
2019-01-23 10:05:27 +00:00
Stefan Eßer
5f81babdee Silence a CI warning regarding the use of strcpy().
While this is a false positive (a sufficiently large buffer has been
allocated in the line above), the use of strdup() simplifies and clarifies
the code.

MFC after:	2 weeks
2019-01-22 13:11:15 +00:00
Ed Maste
d308a8bf0f freebsd-update: Allow upgrade from pre-release builds
Update r343122 to include -ALPHA, -BETA and -RC releases as
upgrade-able via freebsd-update.

PR:		234771
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by:	delphij, des
Reviewed by:	delphij
MFC with:	r343122
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18881
2019-01-21 19:21:11 +00:00
Ed Maste
9b6591109e freebsd-update: Update /etc/passwd after password db changes
Add -p to pwd_mkdb in order to ensure password db changes are also
included in /etc/passwd.

PR:		165954, 232921, 229487
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	jilles
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18827
2019-01-21 19:04:37 +00:00
Ed Maste
b958d4b255 frebsd-update: fix --currently-running after r343122
PR:		234771
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by:	Brandon Schneider
MFC with:	r343122
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18896
2019-01-21 18:41:57 +00:00
Dmitry Morozovsky
be659d72bb Clarify error messages a bit.
X-Found-With:	r343112
MFC after:	1 month
2019-01-18 23:00:52 +00:00
Ed Maste
c075542050 freebsd-update.8: mandoc -Tlint fixes
PR:		185389
Reported by:	bcr
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2019-01-18 18:22:47 +00:00
Ed Maste
cfd9be9c1f freebsd-update: Use BASEDIR when checking for src component
src could potentially be installed under the based dir
and not under the root or vice versa.

PR:		224048
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18849
2019-01-18 17:41:45 +00:00
Ed Maste
0d5c5243af freebsd-update: Clarify unsupported release upgrade error message
Notify users that upgrading from -CURRENT or -STABLE is unsupported by
freebsd-update.

Also ensure --currently-running provides a correctly formatted release
(as done by -r).

PR:		234771
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by:	yuri
Reviewed by:	bcran
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18803
2019-01-17 21:38:57 +00:00
Edward Tomasz Napierala
50d503b781 Workaround for nscd(8) failure with large entries.
It fixes a case where eg a 2KB group entry would take several seconds
to complete with cache enabled in nsswitch.conf.

MFC after:	2 weeks
Sponsored by:	Chalmers University of Technology
Differential Revision:	https://reviews.freebsd.org/D18392
2019-01-17 20:01:06 +00:00
Eugene Grosbein
2b5691ee44 Re-add new small tool trim(8) to delete contents for blocks
on devices using wear-leveling algorithms as a few weeks passed
after review and discussion of trim(8) ceased and
we still have no utility to perform the job.

Reviewed by:	hackers@
MFC after:	2 weeks
2019-01-17 18:07:59 +00:00
Eugene Grosbein
bd24e861b4 jail(8): stop crashing with SIGSEGV inside run_command() function
while processing not entirely correct jail.conf(5) file
having something like "ip4.addr = 127.0.0.1;" and no "ip4 = ...;"
so extrap variable stays NULL.

Reported by:	marck
MFC after:	1 month
2019-01-17 14:09:55 +00:00
Marcelo Araujo
73f6ccd9e7 Fix broken uart on Win2016 guest.
Obtained from:	Joyent (commit/2bf1a940afbd1382faff159e7c93c72779ca10f4)
MFC after:	3 weeks.
2019-01-16 03:46:27 +00:00
Marcelo Araujo
abfa3c39e7 Use capsicum_helpers(3) that allow us to simplify the code and its functions
will return success when the kernel is built without support of
the capability mode.

It is important to note, that I'm taking a more conservative approach
with these changes and it will be done in small steps.

Reviewed by:	jhb
MFC after:	6 weeks
Differential Revision:	https://reviews.freebsd.org/D18744
2019-01-16 00:39:23 +00:00
Lars Engels
e1bd727904 This new version of bluetooth-config.sh tries to follow the style of other
shell scripts in base, removes the bogus "copyleft", adds the BeerWare license
header and uses rc.subr(8) new 'enable' keyword for adding entries in
rc.conf(5).

Submitted by:	erdgeist <erdgeist@erdgeist.org>
Approved by:	bapt
MFC after:	2 weeks
2019-01-14 08:23:47 +00:00
Baptiste Daroussin
baf46d717b Fix duplication.
The patch adding the manpage was probably applied twice, so it resulted
in duplication of the manpage
2019-01-11 16:18:23 +00:00
Lars Engels
0fc0faf846 Add bluetooth-config script to simplify setting up bluetooth connections to
devices like mice, keyboards, bt-audio, ...

This script currently allows scanning for nearby devices, adds one to
/etc/bluetooth/hosts, adds an entry to hcsecd's conf and if it is a HID, add an
entry to bthidd's configs, as well.

Submitted by:	erdgeist <erdgeist@erdgeist.org>
Approved by:	bapt
MFC after:	2 weeks
Differential Revision:	D3778
Reviewers:	bapt, emax
2019-01-11 15:52:09 +00:00
Rodney W. Grimes
7d9545fcc0 Fix spelling of identifier
Approved by:	phk (mentor)
MFC after:	3 days
2019-01-11 14:21:59 +00:00
Konstantin Belousov
e4e0dad424 cpucontrol: check for the supposed firmware file type and skip
non-regular entry.

do_update() skips entries with DT_DIR type.  This does not eliminate
other entries that might exist in the directory.  More, since NFS
might fill d_type with DT_UNKNOWN, dot and dotdot entries are not
skipped, then mmap(2) call failed for them when update microcode files
are located on NFS.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-01-11 08:35:49 +00:00
Andriy Voskoboinyk
5c81ba5ade powerd(8): allow to force a method of battery state query
This change allows to determine power source via sysctl or /dev/apm
when devd(8) is running (used by default).

Based on patch from PR; other changes on top of it:
- '-f' (force) -> '-s' (source) parameter renaming;
- allow 'apm' -> 'devd' transition when '-s devd' is set
(if APM is enabled);
- man page update.

Checked on amd64 with -s devd / sysctl and apm
(an extra build with forced USE_APM define set was done)

PR:		125707
Submitted by:	Konstantin Stepanov <milezv@yandex.ru>
Reviewed by:	bcr, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D18742
2019-01-06 02:39:03 +00:00
Mark Johnston
04e9edb544 Capsicumize rtsol(8) and rtsold(8).
These programs parse ND6 Router Advertisement messages; rtsold(8) has
required an SA, SA-14:20.rtsold, for a bug in this code.  Thus, they
are good candidates for sandboxing.

The approach taken is to run the main executable in capability mode
and use Casper services to provide functionality that cannot be
implemented within the sandbox.  In particular, several custom services
were required.

- A Casper service is used to send Router Solicitation messages on a
  raw ICMP6 socket.  Initially I took the approach of creating a
  socket for each interface upon startup, and connect(2)ing it to
  the all-routers multicast group for the interface.  This permits
  the use of sendmsg(2) in capability mode, but only works if the
  interface's link is up when rtsol(d) starts.  So, instead, the
  rtsold.sendmsg service is used to transmit RS messages on behalf
  of the main process.  One could alternately define a service
  which simply creates and connects a socket for each destination
  address, and returns the socket to the sandboxed process.  However,
  to implement rtsold's -m option we also need to read the ND6 default
  router list, and this cannot be done in capability mode.
- rtsold may execute resolvconf(8) in response to RDNSS and DNSSL
  options in received RA messages.  A Casper service is used to
  fork and exec resolvconf(8), and to reap the child process.
- A service is used to determine whether a given interface's
  link-local address is useable (i.e., not duplicated or undergoing
  DAD).  This information is supplied by getifaddrs(3), which reads
  a sysctl not available in capability mode.  The SIOCGIFCONF socket
  ioctl provides equivalent information and can be used in capability
  mode, but I decided against it for now because of some limitations
  of that interface.

In addition to these new services, cap_syslog(3) is used to send
messages to syslogd.

Reviewed by:	oshogbo
Tested by:	bz (previous versions)
MFC after:	2 months
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17572
2019-01-05 16:05:39 +00:00
Chuck Tuffli
fbac7e0ba2 Fix bhyve's NVMe Completion Queue entry values
The function which processes Admin commands was not returning the
Command Specific value in Completion Queue Entry, Dword 0 (CDW0). This
effects commands such as Set Features, Number of Queues which returns
the number of queues supported by the device in CDW0. In this case, the
host will only create 1 queue pair (Number of Queues is zero based).
This also masked a bug in the queue counting logic.

Reviewed by: imp, araujo
Approved by: imp (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18703
2019-01-04 15:03:35 +00:00
Chuck Tuffli
76e47b9420 Fix bhyve's NVMe queue bookkeeping
Many size / length parameters in NVMe are "0's based", meaning, a value
of 0x0 represents 1, 0x1 represents 2, etc.. While this leads to an
efficient encoding, it can lead to subtle bugs. With respect to queues,
these parameters include:
 - Maximum number of queue entries
 - Maximum number of queues
 - Number of Completion Queues
 - Number of Submission Queues

To be consistent, convert all 0's based values from the host to 1's
based value internally. Likewise, covert internal 1's based values to
0's based values when returned to the host. This fixes an off-by-one bug
when creating IO queues and simplifies some of the code. Note that this
bug is masked by another bug.

While in the neighborhood,
 - fix an erroneous queue ID check (checking CQ count when deleting SQ)
 - check for queue ID of 0x0 in a few places where this is illegal
 - clean up the Set Features, Number of Queues command and check for
   illegal values

Reviewed by: imp, araujo
Approved by: imp (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18702
2019-01-04 15:03:30 +00:00
Rebecca Cran
70de14d82f Update the efibootmgr(8) man page to document changes to options. 2019-01-01 04:57:46 +00:00
Rebecca Cran
7e02f8b30a Use the --activate efibootmgr(8) flag when creating entries in bootconfig
Sponsored by:	Netflix
2018-12-31 00:26:35 +00:00
Rebecca Cran
5fa62a9335 Fix ESP generation when using a gmirror, and when booting from RO medium
When using a gmirror, entries in /dev can be removed. So instead of using
kern.disks, get the list of disks from "gpart status -sg" instead.

We assume that any 'efi' partition that can't be mounted as msdosfs should
be used as an ESP. However, the ESP on the CD/DVD can't be mounted read-write
and so was being treated as if unformatted. Try the mount as read-only
instead, to catch cases like this.

Relnotes: yes
Sponsored by: Netflix
Differential Revision:	https://reviews.freebsd.org/D18645
2018-12-31 00:20:58 +00:00
Rebecca Cran
9ed0802914 Change the way efibootmgr works by specifying bootnum via -b parameter
Instead of passing the bootnum to each different parameter, require users
to specify -b when running operations that need a bootnum.

This allows activation of a new boot entry at the same time it's created
by adding -a onto the command line.

Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D18648
2018-12-31 00:09:45 +00:00
Rebecca Cran
557a5ad425 Improve the efibootmgr(8) man page
Fix formatting, typos, and attempt to improve the wording.

Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D18646
2018-12-28 21:26:45 +00:00
Chris Rees
488ded9168 There is no way of escaping literal $ signs in auto_master(5), which
makes for difficulty with hidden Samba shares; shares with $ at the end
of their name.  This enables the use of ${DOLLAR} to work around this.

Reviewed by:		bcr (man page)
Approved by:		trasz
Differential Revision:	https://reviews.freebsd.org/D7048
2018-12-28 15:11:22 +00:00