Commit Graph

18456 Commits

Author SHA1 Message Date
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