Commit Graph

17920 Commits

Author SHA1 Message Date
Matt Macy
0a87e3ff64 pmcstat: add usage strings for -L and -I 2018-05-24 07:18:49 +00:00
Matt Macy
4bd2a4b58e pmcstat top mode + -I - use fully qualified address 2018-05-24 06:47:04 +00:00
Matt Macy
357405d985 pmcstat: don't compare signed and unsigned 2018-05-24 04:43:40 +00:00
Matt Macy
e98bbcf9ca libpmcstat: compile in events based on json description 2018-05-24 04:30:06 +00:00
Matt Macy
95104040a3 pmc: bump PMC major version to reflect ABI breakage and make warning not require verbose 2018-05-23 19:55:47 +00:00
Matt Macy
0b5dc7f64f hwpmc: add thread id field to callchain and context switch records to allow filtering
on thread in post-processing.

To generate stacks for just ${THREADID}:

pmcstat -R ${PREFIX}.pmcstat -L ${THREADID} -z100 -G ${PREFIX}.stacks

Sponsored by:	Limelight Networks
2018-05-23 17:25:00 +00:00
Eitan Adler
c739854c38 mpsutil: correct style
Reported by:	bapt
2018-05-23 09:46:21 +00:00
Marcelo Araujo
5f4c83abf5 pthread_rwlock_unlock(3) returns 0 if successful, otherwise an error number
will be returned to indicate the error, so I'm applying an assert(3) to do
a sanity check of the return value.

Reported by:	Coverity CID: 1391235, 1193654 and 1193651
Reviewed by:	grehan
MFC after:	4 weeks.
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D15533
2018-05-23 09:34:51 +00:00
Eitan Adler
9059c77ef2 mpsutil: add missing braces
Obtained from:	DragonFly (c5d53f11a9510c5c79e196857a1200925fffacc8)
2018-05-23 07:38:58 +00:00
Marcelo Araujo
92046bf113 Revert: r334016
Revert for now this change, it in somehow breaks init_pci.
2018-05-22 06:02:11 +00:00
Marcelo Araujo
2d03aa5999 Include atkbdc header where there are declared the prototype functions
atkbdc_event and atkbdc_init.

MFC after:	4 weeks.
Sponsored by:	iXsystems Inc.
2018-05-22 05:21:53 +00:00
Matt Macy
821a352a77 pmcstat: add option to not decode the leaf function in top mode
-I will allow the user to see the hot instruction in question
as opposed getting the name of the function
2018-05-22 04:45:46 +00:00
Marcelo Araujo
b5e3928d6d We must free the variable str.
Spotted by:	clang's static analyzer
Submitted by:	Tom Rix <trix_juniper.net>
Reviewed by:	grehan
MFC after:	4 weeks
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D10009
2018-05-22 04:08:08 +00:00
Eitan Adler
d67c790d71 mtest: build with WARNS=3 2018-05-19 20:57:22 +00:00
Nathan Whitehorn
fb4f0dcae9 Use sysrc(8) in the documentation rather than echoing things to rc.conf
in order to encourage good habits.

PR:		228325
Submitted by:	Mateusz Piotrowski
MFC after:	2 weeks
2018-05-18 17:46:40 +00:00
Nathan Whitehorn
8c7de243f4 Fix math error in the computation of the free space after the last partition
on a disk. This resulted in one sector always remaining free at the end.

PR:		bin/228322
Submitted by:	Rikiya Yonemoto
MFC after:	2 weeks
2018-05-18 17:43:15 +00:00
Andrew Gallatin
b4cc08389a Teach pmcannotate about $TMPDIR and _PATH_TMP
Convert pmcannotate to using $TMPDIR and _PATH_TMP rather than hard
coding /tmp for temporary files.  Pmcannotate sometimes needs quite a
lot of space to store the output from objdump, and will fail in odd
ways if that output is truncated due to lack of space in /tmp.

Reviewed by:	jtl
Sponsored by:	Netflix
2018-05-18 14:14:04 +00:00
Rodney W. Grimes
d96ee3e017 Add missing newline to end of -c usage string .
Pointy hat:	me
Submitted by:	novel
Approved by:	bde(mentor), grehan (maintainer)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D15421
2018-05-17 12:18:41 +00:00
Ed Maste
ab6f27aac1 makefs: ANSIfy 2018-05-16 02:58:05 +00:00
Ed Maste
4fa9985611 Sort mlx5tool correctly in usr.sbin/Makefile 2018-05-16 02:51:30 +00:00
Marcelo Araujo
bc1019a238 vq_getchain() can return -1 if some descriptor(s) are invalid and prints
a diagnostic message. So we do a sanity checking on the return value
of vq_getchain().

Spotted by:	gcc49
Reviewed by:	avg
MFC after:	4 weeks
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D15388
2018-05-15 05:55:29 +00:00
Navdeep Parhar
36ea2fe3bf cxgbetool(8): Provide user interface for hashfilters, hardware NAT, and
other filtering related features that were recently added to the driver.

Sponsored by:	Chelsio Communications
2018-05-15 04:31:11 +00:00
Dag-Erling Smørgrav
202ec22078 If the sole non-option command line argument is "none", remove any
pre-existing forwarder configuration and set Unbound up to recurse.

PR:		222902
MFC after:	1 week
2018-05-12 18:07:53 +00:00
Dag-Erling Smørgrav
b70d78d6e8 Rename all Unbound binaries and man pages from unbound* to local-unbound*.
PR:		222902
2018-05-12 17:10:36 +00:00
Ed Maste
09e24fbe18 cpucontrol: improve Intel microcode revision check
According to the Intel SDM (Volme 3, 9.11.7) the BIOS signature MSR
should be zeroed before executing cpuid (although in practice it does
not seem to matter).

PR:		192487
Submitted by:	Dan Lukes
Reported by:	Henrique de Moraes Holschuh
MFC after:	3 days
2018-05-12 15:34:35 +00:00
Dag-Erling Smørgrav
65b390aa03 Upgrade Unbound to 1.6.2. More to follow. 2018-05-12 14:15:39 +00:00
Dag-Erling Smørgrav
d7d1dffb61 Upgrade Unbound to 1.6.1. More to follow. 2018-05-12 14:04:30 +00:00
Stephen Hurd
71cf0564f8 Fix mld6query(8) and add a new -g option
The mld6query command relies on KAME behaviour which allows the
ipv6mr_multiaddr member of the request object in a IPV6_JOIN_GROUP
setsockopt() call to be INADDR6_ANY. The FreeBSD stack doesn't allow
this, so mld6query has been non-functional.

Also, add a -g option which sends a General Query (query INADDR6_ANY)

Reviewed by:	sbruno, mmacy
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15384
2018-05-11 19:37:18 +00:00
Dag-Erling Smørgrav
6bff85ff9a Reduce <sys/queue.h> pollution.
While <sys/sysctl.h> includes <sys/queue.h> unconditionally, it is only
actually used in code which is conditional on _KERNEL.  Make the #include
itself conditional as well, and fix userland code that uses <sys/queue.h>
for other purposes but relied on <sys/sysctl.h> to bring it in.

MFC after:	1 week
2018-05-11 00:01:43 +00:00
Xin LI
b6f7731dba Remove "All rights reserved" from my files.
See r333391 for the rationale.

MFC after:	1 week
2018-05-10 06:41:08 +00:00
Marcelo Araujo
8951f05525 Rework CTL frontend & backend options to use nv(3), allow creating multiple
ioctl frontend ports.

This revision introduces two changes to CTL:
- Changes the way options are passed to CTL_LUN_REQ and CTL_PORT_REQ ioctls.
  Removes ctl_be_arg structure and associated logic and replaces it with
  nv(3)-based logic for passing in and out arguments.
- Allows creating multiple ioctl frontend ports using either ctladm(8) or
  ctld(8).
  New frontend ports are represented by /dev/cam/ctl<pp>.<vp> nodes, eg /dev/cam/ctl5.3.
  Those device nodes respond only to CTL_IO ioctl.

New command-line options for ctladm:
# creates new ioctl frontend port with using free pp and vp=0
ctladm port -c
# creates new ioctl frontend port with pp=10 and vp=0
ctladm port -c -O pp=10
# creates new ioctl frontend port with pp=11 and vp=12
ctladm port -c -O pp=11 -O vp=12
# removes port with number 4 (it's a "targ_port" number, not pp number)
ctladm port -r -p 4

New syntax for ctl.conf:
target ... {
    port ioctl/<pp>
    ...
}

target ... {
    port ioctl/<pp>/<vp>
    ...

Note: Most of this work was made by jceel@, thank you.

Submitted by:	jceel
Reworked by:	myself
Reviewed by:	mav (earlier versions and recently during the rework)
Obtained from:  FreeNAS and TrueOS
Relnotes:	Yes
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D9299
2018-05-10 03:50:20 +00:00
Niclas Zeising
480e017cc8 Remove "all rights reserved" on files where I have copyright.
According to r333391 it is not needed any more.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D15370
2018-05-09 17:06:52 +00:00
Sean Bruno
57b4936514 nxge(4):
Remove nxge(4) and associated man page and tools in FreeBSD 12.0.

Submitted by:	kbowling
Reviewed by:	brooks
Relnotes:	yes
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D1529
2018-05-08 21:14:29 +00:00
Warner Losh
83caf7e590 Remove ignored command line options
The --device and --part command line options were planned for Linux
compatibility mode. However, that mode will never happen, so remove
them as last vestiges of a false start.

Submitted by: Vlad Movchan
2018-05-08 20:02:44 +00:00
Warner Losh
39c0a13bc7 efibootmgr.8: fix example
The example given was for the old, and now deleted, Linux
compatibility mode. Update the example for the current code.

Submitted by: Vlad Movchan
2018-05-08 20:02:39 +00:00
Warner Losh
51922c697b Improve printing the boot variables.
Print the boot variables in the order in the BootOrder variable, if it
exists, and then in verbose mode print any unreferneced BootXXXX
variables. If BootOrder isn't set, fall back to printing all the
variables.

Sponsored by: Netflix
2018-05-08 19:43:57 +00:00
Warner Losh
12f409ff75 Inline print_order(). It's used one palce. 2018-05-08 18:25:37 +00:00
Jamie Gritton
0e5c6bd436 Make it easier for filesystems to count themselves as jail-enabled,
by doing most of the work in a new function prison_add_vfs in kern_jail.c
Now a jail-enabled filesystem need only mark itself with VFCF_JAIL, and
the rest is taken care of.  This includes adding a jail parameter like
allow.mount.foofs, and a sysctl like security.jail.mount_foofs_allowed.
Both of these used to be a static list of known filesystems, with
predefined permission bits.

Reviewed by:	kib
Differential Revision:	D14681
2018-05-04 20:54:27 +00:00
Peter Grehan
51688c129f Allow arbitrary numbers of columns for VNC server screen resolution.
The prior code only allowed multiples of 32 for the
numbers of columns. Remove this restriction to allow
a forthcoming UEFI firmware update to allow arbitrary
x,y resolutions.

(the code for handling rows already supported non mult-32 values)

Reviewed by:	Leon Dang (original author)
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D15274
2018-05-04 01:36:49 +00:00
Michael Tuexen
44aaf08ba7 Fix in the documentation that the default hop limit is not 30, but
the value of the sysctl variable net.inet6.ip6.hlim.
This is true since
https://svnweb.freebsd.org/base?view=revision&revision=122574
The default of 30 (which was correct up to r122574) was incorrectly
documented in
https://svnweb.freebsd.org/base?view=revision&revision=130268

Thanks to Timo Voelker for makeing me aware of the inconsistency
between to code and the documentation.

MFC after:	3 days
2018-05-02 19:36:46 +00:00
Sean Bruno
2695c9c109 Retire ixgb(4)
This driver was for an early and uncommon legacy PCI 10GbE for a single
ASIC, Intel 82597EX. Intel quickly shifted to the long lived ixgbe family.

Submitted by:	kbowling
Reviewed by:	brooks imp jeffrey.e.pieper@intel.com
Relnotes:	yes
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15234
2018-05-02 15:59:15 +00:00
Ed Maste
e6a376d196 Retire lmc(4)
This driver supports legacy, 32-bit PCI devices, and had an ambiguous
license.  Supported devices were already reported to be rare in 2003
(when an earlier version of the driver was removed in r123201).

Reviewed by:	rgrimes
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D15245
2018-05-01 16:30:48 +00:00
John Baldwin
cd377eb369 Initial debug server for bhyve.
This commit adds a new debug server to bhyve.  Unlike the existing -g
option which provides an efficient connection to a debug server
running in the guest OS, this debug server permits inspection and
control of the guest from within the hypervisor itself without
requiring any cooperation from the guest.  It is similar to the debug
server provided by qemu.

To avoid conflicting with the existing -g option, a new -G option has
been added that accepts a TCP port.  An IPv4 socket is bound to this
port and listens for connections from debuggers.  In addition, if the
port begins with the character 'w', the hypervisor will pause the
guest at the first instruction until a debugger attaches and
explicitly continues the guest.  Note that only a single debugger can
attach to a guest at a time.

Virtual CPUs are exposed to the remote debugger as threads.  General
purpose register values can be read for each virtual CPU.  Other
registers cannot currently be read, and no register values can be
changed by the debugger.

The remote debugger can read guest memory but not write to guest
memory.  To facilitate source-level debugging of the guest, memory
addresses from the debugger are treated as virtual addresses (rather
than physical addresses) and are resolved to a physical address using
the active virtual address translation of the current virtual CPU.
Memory reads should honor memory mapped I/O regions, though the debug
server does not attempt to honor any alignment or size constraints
when accessing MMIO.

The debug server provides limited support for controlling the guest.
The guest is suspended when a debugger is attached and resumes when a
debugger detaches.  A debugger can suspend a guest by sending a Ctrl-C
request (e.g. via Ctrl-C in GDB).  A debugger can also continue a
suspended guest while remaining attached.  Breakpoints are not yet
supported.  Single stepping is supported on Intel CPUs that support
MTRAP VM exits, but is not available on other systems.

While the current debug server has limited functionality, it should
at least be usable for basic debugging now.  It is also a useful
checkpoint to serve as a base for adding additional features.

Reviewed by:	grehan
Differential Revision:	https://reviews.freebsd.org/D15022
2018-05-01 15:17:46 +00:00
Ed Maste
c20dbeb676 pwd_mkdb: retire legacy v3 db support (-l option)
pwd_mkdb has emitted v4 password database records since 2003 (r113596)
in addition to v3, and as of r283981 by default it emitted only v4.
As described in r283981, retire the -l legacy option.

The -B and -L options were originally added to set the endianness of v3
records emitted by pwd_mkdb, but they also set the db hash endiannes and
so have been retained temporarily.

Announced on the FreeBSD-Current and FreeBSD-Stable lists.  In stable/11
the man page contains a deprecation notice, and pwd_mkdb will emit a
deprecation notice if the -l option is specified.

Reviewed by:	delphij, lidl, rgrimes
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D15144
2018-05-01 00:53:46 +00:00
Vladimir Kondratyev
44af5666d9 bthidd(8): Add evdev protocol support for bluetooth keyboards and mouses
User-visible changes:

"-u" is added to to list of command line options supported by bthidd.
Use it to enable evdev support. uinput and evdev modules should be
kld-loaded or compiled into the kernel in that case.

bthidd_evdev_support rc.conf variable is added to control enabling of
evdev support in bthidd startup script. Possible values are: "YES", "NO",
"AUTO"(default). Setting bthidd_evdev_support to "AUTO" inserts "-u" option
if kernel is compiled with EVDEV_SUPPORT option enabled.

Support for consumer HID usage page keyboard events is implemented. Most of
them are available only through evdev protocol.

kern.evdev.rcpt_mask sysctl is checked, so "sysctl kern.evdev.rcpt_mask=12"
should be executed if EVDEV_SUPPORT is compiled into kernel.

It is recommended to regenerate bthidd.conf entries with bthidcontrol(8)
"Query" command to set user-friendly names of bluetooth devices.

Reviewed by:	emax, gonzo, wblock (docs), bcr (docs, early version)
Differential Revision:	https://reviews.freebsd.org/D13456
2018-04-30 12:16:54 +00:00
Vladimir Kondratyev
e650806966 bthidd(8): Add internal support for user-friendly name of remote devices.
Extend bthidd.conf format to store name of remote Bluetooth HID devices and
implement querying of this information with bthidcontrol(8) "Query" command.

Reviewed by:		emax
Differential Revision:	https://reviews.freebsd.org/D13456
2018-04-30 10:49:29 +00:00
Edward Tomasz Napierala
41adbaa596 Clean up the EXAMPLES section of usbconfig(8). This removes parts that
become redundant after documenting all the subcommands, and switches
to the new syntax, without the '-d'.

Reviewed by:	hselasky@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-04-29 10:45:09 +00:00
Pedro F. Giffuni
e2ec2f75f2 makefs: Use ENODATA instead of ENOMSG as a translation for missing ENOATTR.
This is consistent with what some linux filesystems do and has been
adopted in our linuxulator.

MFC after:	3 days
2018-04-25 02:43:53 +00:00
Xin LI
703a6a3b14 Use calloc() instead of malloc+bzero.
Reviewed by:	ken, emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D15166
2018-04-24 04:07:51 +00:00
Ed Maste
e936bb9f69 pwd_mkdb: default to network (big) endian hash order
For cross-architecture reproducibility.  The db(3) functions work with
hashes of either endianness, and the current (v4) version password db
entries already store integers in network order.  Do so with the hash as
well so that identical password databases can be created on big- and
little-endian hosts.

The -B and -L flags exist to set the endianness for legacy (v3) entries
when the -l flag is used, and they will still control hash endianness
(at least until the backwards compatibility infrastructure is removed).

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-04-24 01:22:57 +00:00
Xin LI
5992da2c7b Correct size for allocation and bzero of fdsr.
MFC after:	2 weeks
2018-04-23 07:15:49 +00:00
Ed Maste
60dd682329 pwd_mkdb: add deprecation notice in manpage too
Followon to r332789; as reported on the -current and -stable lists and
in review D15144 the -l option will be removed before FreeBSD 12.0.
2018-04-22 23:10:37 +00:00
Ed Maste
daddfa7cc7 makefs: tidy up reach-over source
- cd9660 relies on an #include "iso.h" but does not build any .c files
  out of source, so remove reach-over .PATH
- ffs does not rely on any sys/ headers, so remove -I from CFLAGS.
- ffs_tables from sys/ is used by ffs; move the SRCS entry from the top-
  level Makefile to ffs' Makefile.inc.

Sponsored by:	The FreeBSD Foundation
2018-04-20 22:23:38 +00:00
Ed Maste
97303f37f8 pwd_mkdb: warn that legacy support is deprecated (if specified)
r283981 switched pwd_mkdb to emit only v4 database entries by default,
and introduced a -l (legacy) option emit v3 entries in addition.  The
commit message claims that legacy support will be removed in 12.0, so
emit a warning now if it is used.
2018-04-19 20:25:19 +00:00
Allan Jude
0484aa6d85 Make iostat -xC print CPU information on its own line
Requested by:	mahrens
Reviewed by:	kenm (maintainer), mahrens
MFC after:	1 week
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D15076
2018-04-18 02:25:03 +00:00
Edward Tomasz Napierala
912280b4b4 Make it possible to pass the ugenX.Y to usbconfig(8) without using "-d",
eg "usbconfig ugen1.2 dump_all_desc".

Reviewed by:	hselasky@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-04-17 19:39:47 +00:00
Andriy Gapon
020d6f96e3 mountd: fix a crash when getgrouplist reports too many groups
Previously the code only warned about the condition and then happily
proceeded to use the too large value resulting in the array
out-of-bounds access.

Obtained from:	Panzura (Chuanbo Zheng)
MFC after:	10 days
Sponsored by:	Panzura
2018-04-16 09:17:36 +00:00
Ian Lepore
c1ee3587a1 Fix cut-and-pasted line to have the right option letter.
Reported by:	0mp@
Pointy hat:	ian@
2018-04-16 03:35:43 +00:00
Ian Lepore
37820b8746 Add an option to daemon(8) to specify a delay between restarts of a
supervised program.  The existing -r option has a hard-coded delay of one
second.  This change adds a -R option which takes a delay in seconds.  This
can be used to prevent log spam and rapid restarts, similar to init(8)'s
behavior of adding a delay between rapid restarts when it's supervising a
program.
2018-04-15 21:46:08 +00:00
Navdeep Parhar
0d7404ba76 Fix typo in cxgbetool.8. 2018-04-15 19:23:37 +00:00
Ed Schouten
5caf54c7a4 Use proper alphabetic sorting of options. 2018-04-15 08:44:26 +00:00
Ed Schouten
1a874a126a Add RFC 5424 syslog message output to syslogd.
- Move all of the code responsible for transmitting log messages into a
  separate function, fprintlog_write().
- Instead of manually modifying a list of iovecs, add a structure
  iovlist with some helper functions.
- Alter the F_FORW (UDP message forwarding) case to also use iovecs like
  the other cases. Use sendmsg() instead of sendto().
- In the case of F_FORW, truncate the message to a size dependent on the
  address family (AF_INET, AF_INET6), as proposed by RFC 5426.
- Move all traditional message formatting into fprintlog_bsd(). Get rid
  of some of the string copying and snprintf()'ing. Simply emit more
  iovecs to get the job done.
- Increase ttymsg()'s limit of 7 iovecs to 32. Add a definition for this
  limit, so it can be reused by iovlist.
- Add fprintlog_rfc5424() to emit RFC 5424 formatted log entries.
- Add a "-O" command line option to enable RFC 5424 formatting. It would
  have been nicer if we supported "-o rfc5424", just like on NetBSD.
  Unfortunately, the "-o" flag is already used for a different purpose
  on FreeBSD.
- Don't truncate hostnames in the RFC 5424 case, as suggested by that
  specific RFC.

For people interested in using this, this feature can be enabled by
adding the following line to /etc/rc.conf:

  syslogd_flags="-s -O rfc5424"

Differential Revision:	https://reviews.freebsd.org/D15011
2018-04-15 08:34:16 +00:00
Navdeep Parhar
1131c927c4 cxgbe(4): Add support for Connection Offload Policy (aka COP).
COP allows fine-grained control on whether to offload a TCP connection
using t4_tom, and what settings to apply to a connection selected for
offload.  t4_tom must still be loaded and IFCAP_TOE must still be
enabled for full TCP offload to take place on an interface.  The
difference is that IFCAP_TOE used to be the only knob and would enable
TOE for all new connections on the inteface, but now the driver will
also consult the COP, if any, before offloading to the hardware TOE.

A policy is a plain text file with any number of rules, one per line.
Each rule has a "match" part consisting of a socket-type (L = listen,
A = active open, P = passive open, D = don't care) and a pcap-filter(7)
expression, and a "settings" part that specifies whether to offload the
connection or not and the parameters to use if so.  The general format
of a rule is: [socket-type] expr => settings

Example.  See cxgbetool(8) for more information.
[L] ip && port http => offload
[L] port 443 => !offload
[L] port ssh => offload
[P] src net 192.168/16 && dst port ssh => offload !nagle !timestamp cong newreno
[P] dst port ssh => offload !nagle ecn cong tahoe
[P] dst port http => offload
[A] dst port 443 => offload tls
[A] dst net 192.168/16 => offload !timestamp cong highspeed

The driver processes the rules for each new listen, active open, or
passive open and stops at the first match.  There is an implicit rule at
the end of every policy that prohibits offload when no rule in the
policy matches:
[D] all => !offload

This is a reworked and expanded version of a patch submitted by
Krishnamraju Eraparaju @ Chelsio.

Sponsored by:	Chelsio Communications
2018-04-14 19:07:56 +00:00
Baptiste Daroussin
8e877d85dc pkg: accept -y and --yes from arguments
By popular demand, pkg now walks thought the arguments passed and
if it finds -y or --yes it does accept those as equivalent of
ASSUME_ALWAYS_YES env var.

Requested by:	many
MFC after:	1 week
2018-04-13 18:25:00 +00:00
Kyle Evans
a97c64453d cron(8): Correct test sense
We're about to use the result of fstat(2) either way, so don't do that if it
fails...

X-MFC-With: r332429
2018-04-12 14:32:26 +00:00
Kyle Evans
1cb7491a3f cron(8): Reload database if an existing job in cron.d changed as well
Directory mtime will only change if a file is added or removed, not
modified. For /var/cron/tabs, this is fine because of how crontab(1) manages
it using temp files so all crontab(1) changes will trigger a reload of the
database.

For /etc/cron.d and /usr/local/etc/cron.d, this is not necessarily the case.
Instead of checking their mtime, we should descend into them and check mtime
on all jobs also.

Reported by:	des
Reviewed by:	bapt
MFC after:	1 week
2018-04-12 13:52:55 +00:00
Edward Tomasz Napierala
53ed4b300e Strip trailing whitespace.
MFC after:	2 weeks
2018-04-10 08:14:31 +00:00
Rodney W. Grimes
01d822d33b Add the ability to control the CPU topology of created VMs
from userland without the need to use sysctls, it allows the old
sysctls to continue to function, but deprecates them at
FreeBSD_version 1200060 (Relnotes for deprecate).

The command line of bhyve is maintained in a backwards compatible way.
The API of libvmmapi is maintained in a backwards compatible way.
The sysctl's are maintained in a backwards compatible way.

Added command option looks like:
bhyve -c [[cpus=]n][,sockets=n][,cores=n][,threads=n][,maxcpus=n]
The optional parts can be specified in any order, but only a single
integer invokes the backwards compatible parse.  [,maxcpus=n] is
hidden by #ifdef until kernel support is added, though the api
is put in place.

bhyvectl --get-cpu-topology option added.

Reviewed by:	grehan (maintainer, earlier version),
Reviewed by:	bcr (manpages)
Approved by:	bde (mentor), phk (mentor)
Tested by:	Oleg Ginzburg <olevole@olevole.ru> (cbsd)
MFC after:	1 week
Relnotes:	Y
Differential Revision:	https://reviews.freebsd.org/D9930
2018-04-08 19:24:49 +00:00
Ed Schouten
671d700167 Fix enough warnings that we can build syslogd on all targets at WARNS=6.
This also fixes the build on MIPS.

Reported by:	cy (MIPS build failure)
2018-04-07 09:03:51 +00:00
Ed Schouten
b484e3fee4 Push RFC 5424 message format from logmsg() into fprintlog().
Now that all of parsemsg() parses both RFC 3164 and 5424 messages and
hands them to logmsg(), alter the latter to properly forward all RFC
5424 message attributes to fprintlog(). While there, make some minor
cleanups to this code:

- Instead of extending the existing code that compares hostnames and
  message bodies for deduplication, print all of the relevant message
  fields into a single string that we can compare ('saved').

- No longer let the behaviour of fprintflog() depend on whether
  'msg == NULL' to print repetition messages, Simply decompose this
  function into fprintlog_first() and fprintlog_successive(). This
  makes the interpretation of function arguments less magical and also
  allows us to get consistent behaviour across RFC 3164 and 5424 when
  adding support for the RFC 5424 output format.

- As RFC 5424 syslog messages have a dedicated application name field,
  alter the repetition messages to be printed on behalf of syslogd on
  the current system. Change these messages to use the local hostname,
  so that it's obvious which syslogd instance detected the repetition.
  Remove f_prevhost, as it has now become unnecessary.

- Remove a useless strdup(). Deconsting the message string is safe in
  this specific case.
2018-04-06 17:16:50 +00:00
Ed Schouten
228e9d5bd8 Remove some places where error messages are prefixed with "syslogd".
Due to using RFC 5424, the application name is stored in a dedicated
field. It can simply be passed as an argument to logmsg() now.
2018-04-06 16:26:46 +00:00
Ed Schouten
10b154332d Properly respect the passed in hostname for RFC 5424 messages.
Only override the hostname in case none is provided or when remote
hostnames should be ignored.
2018-04-06 16:24:03 +00:00
Ed Schouten
77f0ef9a96 Add RFC 5424 syslog message parsing to syslogd.
Syslogd currently uses the RFC 3164 format for its log messages.One
limitation of RFC 3164 is that it cannot be used to log entries with
sub-second precision timestamps. One of our users has expressed a desire
for doing this for doing some basic performance measurements.

This change attempts to make a first cut at switching to RFC 5424 based
logging. The first step is to alter syslogd's input path to properly
parse such messages. It alters the logmsg() prototype to match the
fields of RFC 5424. The parsemsg() function is extended to parse both
RFC 3164 and 5424 messages and call into logmsg() accordingly.

Additional changes include:

- Introducing proper parsing of timestamps, so that they can be printed
  in any desired output format. This means we need to infer the year and
  timezone for RFC 3164 timestamps.
- Removing ISKERNEL. This can now be realised by simply providing an
  APP-NAME (== "kernel").
- Extending RFC 3164 parsing to trim off the TAG prefix and using that
  to derive APP-NAME and PROCID.
- Increase MAXLINE. RFC 5424 mentions we should support 2k messages.

Differential Revision:	https://reviews.freebsd.org/D14926
2018-04-06 12:57:01 +00:00
Benno Rice
756e49c303 Synchronise with NetBSD's version of EFI handling for El Torito images.
When I implemented my EFI support I failed to check if the upstream version
of makefs in NetBSD had done the same. Override my version with theirs to
make it easier to stay in sync with them in the future.

Reviewed by:	imp, mav
Obtained from:	NetBSD
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D14913
2018-03-31 15:04:41 +00:00
Ed Maste
c93ff841aa makefs: sync fragment and block size with newfs
r222319 in newfs raised the default blocksize for UFS/FFS filesystems
from 16K to 32K and the default fragment size from 2K to 4K, with a
rationale that most disks were now running with 4K sectors.

MFC after:	2 weeks
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2018-03-30 03:38:08 +00:00
Brooks Davis
69f0fecbd6 Remove infrastructure for token-ring networks.
Reviewed by:	cem, imp, jhb, jmallett
Relnotes:	yes
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14875
2018-03-28 23:33:26 +00:00
Conrad Meyer
811d25e014 wpa_supplicant.conf.5: Document minimal eduroam configuration
PR:		226939
Submitted by:	Mateusz Piotrowski (0mp@)
Sponsored by:	Dell EMC Isilon
2018-03-26 22:10:20 +00:00
John-Mark Gurney
3762b440dc minor work smithing... 2018-03-24 04:21:22 +00:00
Benno Rice
633cb765d8 Don't try to modify El Torito section headers if there aren't any.
MFC after:	1 week
2018-03-23 22:59:45 +00:00
Benno Rice
ebf1c08960 Correctly mark the last El Torito section header.
Reported by:	Thomas Schmitt <scdbackup@gmx.net>
Reviewed by:	emaste, imp
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D14812
2018-03-23 22:52:26 +00:00
Benno Rice
8dbc390581 Allow makefs to properly tag UEFI El Torito boot images. Use them in amd64 ISOs.
UEFI booting requires an EFI System Partition (ESP). On most storage devices
this will be in a specific partition type. To allow booting from CD/ISO
filesystems, UEFI will look for an ESP in the form of a FAT filesystem image
embedded in the image. Historically FreeBSD has added one of these to its
amd64 ISO images but marked it as simply another i386 boot image. Luckily for
us most UEFI implementations are rather forgiving and work this out for us.

This change adds the ability to mark a boot image as being a UEFI image. It
also modifies our ISO generation to use this marking for the UEFI image we
embed.

Reported by:	Thomas Schmitt <scdbackup@gmx.net>
Reviewed by:	emaste, imp
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D14809
2018-03-23 20:56:18 +00:00
Gleb Smirnoff
c176562d38 Fix whitespace issues in r330034. No functional changes. 2018-03-20 22:00:58 +00:00
Xin LI
3e09403f77 Plug a possible memory leak.
MFC after:	2 weeks
2018-03-19 05:49:26 +00:00
Ed Maste
d8ba45e213 Revert r313780 (UFS_ prefix) 2018-03-17 12:59:55 +00:00
Ed Maste
1e2b9afca9 Prefix UFS symbols with UFS_ to reduce namespace pollution
Followup to r313780.  Also prefix ext2's and nandfs's versions with
EXT2_ and NANDFS_.

Reported by:	kib
Reviewed by:	kib, mckusick
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9623
2018-03-17 01:48:27 +00:00
Warner Losh
3fcd5d6e92 Make not getting BootOrder a warning, not a fatal error when printing.
Sponsored by: Netflix
2018-03-16 18:16:31 +00:00
Devin Teske
5d8a56406b Use full month in dpv(3), figpar(3), and bsdconfig(8) manuals
Reported by:	maxim
2018-03-14 19:09:06 +00:00
Navdeep Parhar
ae9b401786 cxgbetool(8): Add the ability to decode hardware TCBs.
Obtained from:	Chelsio Communications
MFC after:	1 week
Sponsored by:	Chelsio Communications
2018-03-14 00:04:58 +00:00
Edward Tomasz Napierala
cd1fd29c26 Add "usbconfig dump_all_desc", a subcommand to dump all device and config
descriptors.

Reviewed by:	hselasky@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-03-13 19:49:06 +00:00
Scott Long
b3995bb872 Add a new 'debug' command tree and 'dump_reqs' command to grab and parse
command and chain frames of in-flight I/O from the driver.

Sponsored by:	Netflix
2018-03-12 05:03:32 +00:00
Garance A Drosehn
02e8b7b2e7 Fix the resource leak of a 'FILE *' which could happen in routine
ctl_readcf() if a call to malloc failed.

PR:		204955
Reported by:	David Binderman
2018-03-12 01:41:16 +00:00
Peter Grehan
a2d14dcac5 Add CR2 get/set support.
Reported/Tested by:  Fabian Freyer
Reviewed by:	araujo
Differential Revision:	https://reviews.freebsd.org/D14648
MFC after:	3 weeks
2018-03-11 08:27:11 +00:00
Hans Petter Selasky
f3365f07a3 Check that the address is specified in mlx5tool(8).
Submitted by:	kib@
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2018-03-08 15:28:13 +00:00
Hans Petter Selasky
e808190a59 Add kernel and userspace code to dump the firmware state of supported
ConnectX-4/5 devices in mlx5core.

The dump is obtained by reading a predefined register map from the
non-destructive crspace, accessible by the vendor-specific PCIe
capability (VSC). The dump is stored in preallocated kernel memory and
managed by the mlx5tool(8), which communicates with the driver using a
character device node.

The utility allows to store the dump in format
    <address> <value>
into a file, to reset the dump content, and to manually initiate the
dump.

A call to mlx5_fwdump() should be added at the places where a dump
must be fetched automatically. The most likely place is right before a
firmware reset request.

Submitted by:	kib@
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2018-03-08 15:21:56 +00:00
Alan Somers
66a981f278 spray: fix the spelling in an output string
MFC after:	3 weeks
2018-03-05 16:13:29 +00:00
Hiroki Sato
7ef6eb24c9 - Remove extra NULL check before free().
- Fix null pointer dereference in netbuffree() and use netbuffree()
  where applicable.
2018-03-05 03:38:31 +00:00
Hiroki Sato
c5814cf61c Partially back out changes in r327464. stdlib.h is used when
RPCBIND_DEBUG is enabled.
2018-03-05 03:34:01 +00:00
David Bright
32bd1c2bb3 Allow the "@" and "!" characters in passwd file GECOS fields.
Two PRs (152084 & 210187) request allowing the "@" and/or "!"
characters in the passwd file GECOS field. The man page for pw does
not mention that those characters are disallowed, Linux supports those
characters in this field, and the "@" character in particular would be
useful for storing email addresses in that field.

PR:		152084, 210187
Submitted by:	jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Reported by:	jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Reviewed by:	delphij (secteam), vangyzen
MFC after:	1 week
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D14519
2018-03-01 17:47:28 +00:00
Xin LI
0910025859 MFV r330102: ntp 4.2.8p11 2018-02-28 07:59:55 +00:00
David Bright
9176635592 Fix two memory leaks in syslogd
A memory leak in syslogd for processing of forward actions was
reported. This modification adapts the patch submitted with that bug
to fix the leak. While testing the modification, another leak was also
found and fixed.

PR:		198385
Submitted by:	Sreeram <sreeramabs@yahoo.com>
Reported by:	Sreeram <sreeramabs@yahoo.com>
Reviewed by:	hrs
MFC after:	1 week
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D14510
2018-02-26 19:27:59 +00:00
Alan Somers
93b9f3b114 Delete copypasta
Reported by:	rpokala
MFC after:	20 days
X-MFC-With:	329845
Sponsored by:	Spectra Logic Corp
2018-02-23 17:20:53 +00:00
Alan Somers
b1d757bc1d libifconfig: multiple feature additions
Added the ability to:

* Create virtual interfaces
* Create vlan interfaces
* Get interface fib
* Get interface groups
* Get interface status
* Get nd6 info
* Get media status
* Get additional ifaddr info in a convenient struct
* Get vhids
* Get carp info
* Get lagg and laggport status
* Iterate over all interfaces and ifaddrs

And add more examples, too.

Note that this is a backwards-incompatible change. But that's ok, because it's
a private library.

MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D14463
2018-02-23 03:11:43 +00:00
Alan Somers
d68b76a9de Fix numerous Coverity issues in mptutil
Most are memory or file descriptor leaks. Three were unannotated
fallthroughs in a switch/case statement. One was an integer overflow before
widen.

Reported by:	Coverity
CID:		1007463 1007462 1007461 1007460 1007459 1007458 1007457
CID:		1006855 1006854 1006853 1006852 1006851 1006850 1006849
CID:		1006848 1006845 1006844 1006843 1006842 1006841 1006840
CID:		1006839 1006838 1006837 1006836 1006835 1006834 1006833
CID:		1006832 1006831 1006831 1006830 1006829 1008334 1008170
CID:		1008169 1008168
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D11013
2018-02-23 00:17:50 +00:00
Ravi Pokala
b235f015f8 mountd: Return proper errno values in a few error paths
When attempting to mount a non-directory which exists, return ENOTDIR instead
of ENOENT. If stat() or statfs() failed, don't pass part of the invalid
(struct statfs) to ex_search(). In that same case, preserve the value of "bad"
rather than overwriting with EACCES.

Submitted by:	Bruce Leverett (Panasas)
Reviewed by:	rmacklem
MFC after:	1 week
Sponsored by:	Panasas
Differential Revision:	https://reviews.freebsd.org/D14438
2018-02-21 00:19:02 +00:00
Warner Losh
a35ddacab7 Fixup minor nits in the PNP_INFO protocol.
Sponsored by: Netflix
2018-02-17 06:57:03 +00:00
Conrad Meyer
9531d560cf trpt(8): Clean up build hack to detect ancient compiler
Detect ancient GCC specifically, rather than using target architecture as a
crude heuristic.

Side note: compilers should really ignore -Wno- and -Wno-error= flags they
don't recognize.  Seems like modern compilers produce warnings instead of
errors.  Though, with -Werror they turn into errors.  Clang's error can be
disabled with -Wno-error=unknown-warning-option, but GCC doesn't seem to
have a named method to disable the specific warning.

Submitted by:	rpokala@ (earlier version)
Suggested by:	rpokala@
Reviewed by:	tinderbox
Sponsored by:	Dell EMC Isilon
2018-02-16 20:46:44 +00:00
Conrad Meyer
648905e629 trpt(8): Work around GCC4 shenanigans
Reduce warns to known good value and do not add -Wno- flag the ancient GCC4
does not understand.

Reported by:	jhibbits
Sponsored by:	Dell EMC Isilon
2018-02-16 04:30:57 +00:00
Conrad Meyer
808c12715c trpt(8): Sprinkle style(9) and adddress warnings
Update function definitions to post-ISO style; remove deprecated "register"
keyword.  Correct indentation.  Sprinkle 'static' on file-local variables.

Appease warnings at WARNS=6, for both Clang and GCC.

Sponsored by:	Dell EMC Isilon
2018-02-15 21:06:56 +00:00
Conrad Meyer
54b4d5e106 trpt(8): Fully remove and undocument '-t' option disabled in 1999
The relevant code was commented out in r50680.

PR:		57045
Submitted by:	Fernando Apesteguía <fernando.apesteguia AT gmail.com>
2018-02-15 18:26:45 +00:00
Warner Losh
590682b6e6 Move devmatch to sbin from usr/sbin.
Since we want to use devmatch in context before a split /,/usr system
has mounted /usr, move devmatch to /sbin.

Sponsored by: Netflix
2018-02-12 14:44:21 +00:00
Eugene Grosbein
6cd3353ba3 ppp(8): fix code producing debugging logs
Fix several cases when long buffer is copied to shorter one
using snprintf that results in contents truncation and
clobbering unsaved errno value and creation of misleading logs.

PR:		218517
Approved by:	avg (mentor)
MFC after:	1 month
2018-02-10 17:09:51 +00:00
Jung-uk Kim
ff879b0799 MFV: r329072
Merge ACPICA 20180209.
2018-02-09 21:49:38 +00:00
Pedro F. Giffuni
2614eccf45 su_data: correct macro expansion.
Protect su_data() users from strange macro expansion.

Obtained from:	linux libtirpc
2018-02-08 14:53:34 +00:00
Conrad Meyer
354fce2869 mountd(8): Produce vaguely meaningful error messages
Sponsored by:	Dell EMC Isilon
2018-02-08 01:34:35 +00:00
Allan Jude
229c92e7a8 Add the ThinkPad X1 (sandybridge) to the bsdinstall blacklist
MFC after:	2 weeks
Sponsored by:	FOSDEM IllumOS Table
2018-02-04 12:16:36 +00:00
Eitan Adler
a184696e5a newsyslog: fix typeo for 'zstd'
Reported by:	swildner@DragonFlyBSD.org
MFC After:	1 week
2018-02-03 20:53:21 +00:00
Brooks Davis
46b59ac82b Check for cd9660 support before attempting to mount created images
This extends the set in r316028 to allow all tests to pass or be skipped
on a system without cd9660 support.

A better approach using tar is possible, but this works today.

Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10516
2018-02-02 23:34:33 +00:00
Pedro F. Giffuni
d282086dec pppctl88) Avoid strcpy() copies on overlapping string.
This may lead to unpredicatable behaviour on different platforms or C
library implementations. Use an intermediate variable.

Obtained from:	DragonFlyBSD (git a861a526)
2018-01-29 14:23:44 +00:00
Michael Tuexen
51eff8efd9 When using SCTP for sending probe packets, use INIT chunks for payloads
larger than or equal to 32 bytes. For smaller probe packets, keep using
SHUTDOWN-ACK chunks, possibly bundled with a PAD chunk.
Packets with INIT chunks more likely pass through firewalls. Therefore,
use them when possible.

MFC after:	1 week
2018-01-27 19:23:42 +00:00
Maxim Konovalov
53c2c7918d o A command line flag for the syslog_facility fixed in the SYNOPSIS.
PR:		225441
2018-01-26 08:52:28 +00:00
Kirk McKusick
dffce2150e Refactoring of reading and writing of the UFS/FFS superblock.
Specifically reading is done if ffs_sbget() and writing is done
in ffs_sbput(). These functions are exported to libufs via the
sbget() and sbput() functions which then used in the various
filesystem utilities. This work is in preparation for adding
subperblock check hashes.

No functional change intended.

Reviewed by: kib
2018-01-26 00:58:32 +00:00
Ed Maste
4a8b3e41f5 bsdinstall: enable SUJ by default (revert r327890)
fsck should be fixed as of r328092.

PR:		225110
Tested by:	dumbbell, Arshan Khanifar <arshankhanifar gmail.com>
2018-01-25 19:57:21 +00:00
Edward Tomasz Napierala
abdd394564 Add SPDX tags for automount(8) et al.
MFC after:	2 weeks
2018-01-24 16:39:02 +00:00
Edward Tomasz Napierala
8eebe1bf66 Add missing SPDX tags for ctld(8).
MFC after:	2 weeks
2018-01-24 16:37:29 +00:00
Edward Tomasz Napierala
827904b134 Add missing SPDX identifier in iscsid(8).
MFC after:	2 weeks
2018-01-24 16:34:37 +00:00
Edward Tomasz Napierala
1aa6f9aea2 Add SPDX identifiers for uefisign(8) sources.
MFC after:	2 weeks
2018-01-24 16:33:33 +00:00
Kyle Evans
d5b15ddbfc usr.sbin/service: Fix -j to not be order dependant
The introduced -j option is highly dependant on the ordering of arguments,
and it exhibited broken behavior in some other circumstances. Fix these
issues, and simplify the feature by removing the unneessary double parsing
of options.

Reviewed by:	jilles
Differential Revision:	https://reviews.freebsd.org/D13952
2018-01-22 03:38:10 +00:00
John Baldwin
66f8917bea Adjust format string to fix build. 2018-01-18 00:24:05 +00:00
John Baldwin
449af04fc9 Tidy some whitespace. 2018-01-18 00:23:11 +00:00
John Baldwin
65eefbe422 Save and restore guest debug registers.
Currently most of the debug registers are not saved and restored
during VM transitions allowing guest and host debug register values to
leak into the opposite context.  One result is that hardware
watchpoints do not work reliably within a guest under VT-x.

Due to differences in SVM and VT-x, slightly different approaches are
used.

For VT-x:

- Enable debug register save/restore for VM entry/exit in the VMCS for
  DR7 and MSR_DEBUGCTL.
- Explicitly save DR0-3,6 of the guest.
- Explicitly save DR0-3,6-7, MSR_DEBUGCTL, and the trap flag from
  %rflags for the host.  Note that because DR6 is "software" managed
  and not stored in the VMCS a kernel debugger which single steps
  through VM entry could corrupt the guest DR6 (since a single step
  trap taken after loading the guest DR6 could alter the DR6
  register).  To avoid this, explicitly disable single-stepping via
  the trace flag before loading the guest DR6.  A determined debugger
  could still defeat this by setting a breakpoint after the guest DR6
  was loaded and then single-stepping.

For SVM:
- Enable debug register caching in the VMCB for DR6/DR7.
- Explicitly save DR0-3 of the guest.
- Explicitly save DR0-3,6-7, and MSR_DEBUGCTL for the host.  Since SVM
  saves the guest DR6 in the VMCB, the race with single-stepping
  described for VT-x does not exist.

For both platforms, expose all of the guest DRx values via --get-drX
and --set-drX flags to bhyvectl.

Discussed with:	avg, grehan
Tested by:	avg (SVM), myself (VT-x)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D13229
2018-01-17 23:11:25 +00:00
Ed Maste
559d4a5216 kldxref: additional sytle(9) cleanup
Reported by:	kib (via comments in D13957)
Sponsored by:	The FreeBSD Foundation
2018-01-17 20:43:30 +00:00
Ed Maste
e2d0802c6b kldxref: improve style(9)
Address style issues including some previously raised in D13923.

- Use designated initializers for structs
- Always use bracketed return style
- No initialization in declarations
- Align function prototype names
- Remove old commented code/unused includes

Submitted by:	Mitchell Horne <mhorne063@gmail.com>
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13943
2018-01-17 19:59:43 +00:00
Fabien Thomas
cb43ed2815 Only call flush in pipe mode.
It fixes a crash with a socket in top mode.

Ex:
# pmcstat -R 127.0.0.1:8080 -T -w1
then
# pmcstat -n1 -Sclock.prof -Slock.failed -O 127.0.0.1:8080

MFC after:	1 week
Sponsored by:	Stormshield
2018-01-17 16:55:35 +00:00
Alex Richardson
5f40118235 Allow xinstall and makefs to be crossbuilt on Linux and Mac
I need these tools in order to install the crossbuilt FreeBSD and create a
disk image. Linux does not have a st_flags in struct stat so unfortunately
I need a bunch of ugly ifdefs. The resulting binaries allow me to
sucessfully install a MIPS64 world and create a disk-image that boots.

Reviewed By:	brooks, bdrewery, emaste
Approved By:	jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D13307
2018-01-16 21:43:46 +00:00
Kyle Evans
a6f9024f20 service(8): Reset OPTIND properly now that we're parsing args twice
r328032 introduced a second round of argument parsing to proxy the request
through to a jail as needed, but failed to reset OPTIND before getting to
the second round of parsing to allow other flags to be set.

Reported by:	Oleg Ginzburg <olevole olevole ru>
2018-01-16 20:14:31 +00:00
Ed Maste
da67e6e62c kldxref: handle modules with md_cval at the end of allocated sections
Attempting to retrieve an md_cval string from a kernel module with
kldxref would throw a offset error for modules created using lld, since
this value would be placed at the end of all allocated sections.

Add an ef_read_seg_string method to the ef interface, to allow reading
strings of varying size without attempting to read beyond the segment's
bounds.

PR:		224875
Submitted by:	Mitchell Horne <mhorne063@gmail.com>
Reviewed by:	cem, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13923
2018-01-16 18:20:12 +00:00
John Baldwin
7de32ca317 Sort the list of flags in newsyslog.conf entries.
Move the 'X' and 'Y' entries into their sorted location in the list
of flags just above 'Z'.

Reviewed by:	bcr
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D13904
2018-01-16 00:47:53 +00:00
Kyle Evans
65136f65bd service(8): Add support for interfacing with services in jails
Provide a -j option that can take a jail name or id. If -j is specified,
check that the jail exists and proxy the service request through to
service(8) in the jail.

This allows for cleaner workflows when updating services in a jail, turning
the following:

pkg -j dns upgrade
jexec dns service named restart

into:

pkg -j dns upgrade
service -j dns named restart

PR:		223325
Submitted by:	David O'Rourke (with slight changes)
MFC after:	2 weeks
2018-01-15 22:24:11 +00:00
Dimitry Andric
e04518a677 Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r321788).  Upstream has branched for the
6.0.0 release, which should be in about 6 weeks.  Please report bugs and
regressions, so we can get them into the release.

Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
support to build; see UPDATING for more information.

MFC after:	3 months
2018-01-14 00:08:34 +00:00
Eitan Adler
c0848584c3 timed: slave is an infinite loop, mark it as such 2018-01-13 20:35:32 +00:00
Dimitry Andric
72bfb31a82 Merge ^/head r327886 through r327930. 2018-01-13 17:52:55 +00:00
Ed Maste
643139e5b1 bsdinstall: disable SUJ by default
SUJ + cg checksums produce spurious warnings after an unclean shutdown
(e.g. a crash).  For now disable SUJ for UFS installs so installing from
a FreeBSD 12 snapshot results in a usable filesystem, until this can be
fixed.

PR:		225110
Submitted by:	Arshan Khanifar <arshankhanifar gmail.com>
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13890
2018-01-12 20:25:57 +00:00
Dimitry Andric
c79126f2e4 Merge ^/head r327624 through r327885. 2018-01-12 18:23:35 +00:00
Warner Losh
018caaaed0 Fix error in determining the next available boot slot.
Sponsored by: Netflix
2018-01-12 15:30:48 +00:00
Warner Losh
bdd31a5287 Remove vestiges of digi(4) driver, first attempted in r305235 with
more in r317426. There's nothing in the tree that references digiio.h
(apart from digictl(8)), so no driver implements it. Since digictl(8)
was only used to control digi(4) devices, it too should go.
2018-01-10 14:58:58 +00:00
Dimitry Andric
de82c38b72 Add explanatory comment for r327622: clang 6.0.0 and higher warn about
the ACPI_ROOT_OBJECT and ACPI_TO_POINTER macros from acpica's actypes.h
header, that they use arithmetic on a null pointer treated as a cast
from integer to pointer, which is a GNU extension.  We turn off the
warning, because this is in contributed code.

Requested by:	rakuco
2018-01-08 18:42:40 +00:00
Dimitry Andric
4b49587c3d Merge ^/head r327341 through r327623. 2018-01-06 16:13:17 +00:00
Dimitry Andric
ec2bf1e7b1 Revert r327338, undoing the changes to the ACPI_ADD_PTR and ACPI_SUB_PTR
macros.  Instead, turn off clang 6.0.0 warnings about null pointer
arithmetic in usr.sbin/acpi/acpidb instead.
2018-01-06 15:52:21 +00:00
Warner Losh
1723a6e523 Sanity check media size and sector counts to ensure that we don't
produce negative sector numbers in the testing algorithm.

CID: 1198994
2018-01-06 12:34:03 +00:00
Warner Losh
cac7bbe16a There's no need / benefit from deleting the variable before we set it.
Sponsored by: Netflix
2018-01-06 06:00:40 +00:00
Warner Losh
af9d0c273f Fix usage strings. -d and -p were removed before this was committed to
FreeBSD, but the strings weren't updated.

Sponsored by: Netflix
2018-01-06 06:00:34 +00:00
Konstantin Belousov
0530a9360f Make it possible to re-evaluate cpu_features.
Add cpuctl(4) ioctl CPUCTL_EVAL_CPU_FEATURES which forces re-read of
cpu_features, cpu_features2, cpu_stdext_features, and
std_stdext_features2.

The intent is to allow the kernel to see the changes in the CPU
features after micocode update.  Of course, the update is not atomic
across variables and not synchronized with readers.  See the man page
warning as well.

Reviewed by:	imp (previous version), jilles
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D13770
2018-01-05 21:06:19 +00:00
Li-Wen Hsu
be5f9a5a5d Fix typo & build
Approved by:	kevlo
2018-01-05 08:29:32 +00:00
Warner Losh
e96d5d7bb3 Remove dead code (comma is either 0 or 1 for sure, no need to test).
Close /dev/pci when we're done with it.

CID: 1007450, 1007449, 1008615, 1008614
2018-01-05 07:29:02 +00:00
Warner Losh
65273b4808 bits is never null when we call ot. Add an assert to that effect and
remove test for NULL.

CID: 270774
2018-01-05 07:28:58 +00:00
Warner Losh
6dc0176690 Tag 'a' case as one we're intentionally falling through to
the 'F' case.

CID: 1008176
2018-01-05 07:28:48 +00:00
Warner Losh
5066eaeb75 Add a number of sanity checks to the data that we're handling from the
CIS. Coverity has tagged it as tainted. While this data is more
trusted than your average data, we still need to do some basic
validation on it. Check ioctl return value to ensure we switch memory
targets between common and attribute as well as the lseek.

CID: 1210464, 1006640, 1006868, 1007292, 1009091, 1009822, 1009824
2018-01-05 07:09:40 +00:00
Warner Losh
167b7a41ff Set dp to NULL when we free it, and tree a NULL dp as an error
condition. This should prevent a double free. In addition, prevent a
leak by freeing dp each loop and when we're done.

CID: 1383577
Sponsored by: Netflix
2018-01-05 07:09:24 +00:00
Warner Losh
63b5669494 Free options before setting them. This will prevent us from leaking
memory when we have multiple copies of the same option from being
specified.

Sponsored by: Netflix
2018-01-05 07:09:19 +00:00
Warner Losh
da15338df8 Ensure that we have a description string. When unspecified, default to "".
Sponsored by: Netflix
2018-01-05 07:09:09 +00:00
Warner Losh
53584cf69c Don't close fd twice. This line should have been deleted in r327279.
CID: 1384015
2018-01-05 05:34:20 +00:00
Warner Losh
b98c751962 Fix cut and paste error from devinfo.8 origin of this file
Noticed by: kevans@
2018-01-05 05:02:09 +00:00
Edward Tomasz Napierala
49f053978d Fix warnings from "mandoc -Tlint -Wwarning".
Reported by:	Yuri Pankov <yuripv at gmx.com>
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-01-03 17:28:01 +00:00
Ed Maste
f68e716ffe kldxref: correct function names in warning messages
Sponsored by:	The FreeBSD Foundation
2018-01-02 21:31:54 +00:00
Conrad Meyer
35f85edc80 rpcbind: Fix race in signal termination
If a signal was delivered while the main thread was not in poll(2) and after
check was performed, we could reenter poll and never detect termination. Fix
this with the pipefd trick.  (This race was introduced very recently, in
r327482.)

PR:		224503
Reported by:	kib
Reviewed by:	kib, markj
Sponsored by:	Dell EMC Isilon
2018-01-02 17:25:13 +00:00
Baptiste Daroussin
8b081eaa55 Revert r326844
There has been some fallout from the change. The change itself was not valueable
enough to spend time investigating the corner cases, let's just back it out.

Reported by:	flo
2018-01-02 16:50:57 +00:00
Nathan Whitehorn
8befcf7be1 Add installer support for PS3 and PowerNV systems, also laying the
foundation for invoking efibootmgr as part of new-style EFI booting on
x86. On PS3 and PowerNV, which are booted using Linux kexec from petitboot
rather than by loader(8), install the kernel and the rest of /boot to a
FAT partition and set up the appropriate petitboot configuration file
there.

The new bootconfig installer stage can do platform-dependent modifications
more complex than partition layout and installation of boot blocks and can
be used to (as here) set up some special configuration files, run efibootmgr,
or boot0cfg.

MFC after:	1 month
2018-01-02 05:27:24 +00:00
Nathan Whitehorn
a5837f2c26 Skip errors from being unable to set modification and creation times. If
one of the directories in the filesystem hierarchy is a FAT mountpoint,
settings its times will fail, which would cause installation to abort.
Instead, make this a best-effort thing.

Handling this error is a hack and a better internal scheme for handling
this should be added to libarchive.
2018-01-02 05:22:54 +00:00
Conrad Meyer
b545252a16 rpcbind: Fix build
Add missed unistd.h include.  Not sure where it was lost; I believe it
compiled before I submitted the change.

PR:		224503
Reported by:	Cy Schubert <Cy.Schubert AT komquats.com>
Sponsored by:	Dell EMC Isilon
2018-01-02 01:48:11 +00:00
Conrad Meyer
055569f608 rpcbind: Do not use signal-unsafe functions in SIGTERM handler
syslog(3), routines used in write_warmstart(), and exit(3) are all
signal-unsafe.  Instead, set a signal-safe flag and check the flag in the
rpcbind main loop to shutdown safely.

PR:		224503
Reviewed by:	kib, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D13728
2018-01-02 00:48:19 +00:00
Eitan Adler
88791bd8f6 bsdinstall: inform users that typing will not be visible
Some users, especially those that are new, might be confused when passwd
does not echo anything. Inform users that the password will not be
visible.

PR:		196113
Submitted by:	Byron Grobe <grobe0ba@gmail.com>
2018-01-01 22:10:21 +00:00
Xin LI
c3fc0d96f3 Remove unused includes. 2018-01-01 09:41:18 +00:00
Eitan Adler
df76ac9951 newsyslog: implement 'p' flag
Implement the 'p' flag for newsyslog from NetBSD. This flag results in
the first log file for a given file to not be compressed.

While here, don't change file attributes during a no-op run

PR:		162798
Submitted by:	heas@shrubbery.net
MFC After:	1 month
2017-12-31 22:01:36 +00:00
Nathan Whitehorn
9f7602f019 Teach bsdinstall partedit/sade how to format FAT partitions on GPT, which
have the partition type code "ms-basic-data".

MFC after:	2 weeks
2017-12-31 03:13:45 +00:00
Edward Tomasz Napierala
2e07d451f9 Improve usbconfig(8) manual page by adding descriptions for subcommands.
Reviewed by:	hselasky
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13445
2017-12-30 12:56:50 +00:00
Konstantin Belousov
7028c31d21 Style. Remove useless return.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-12-28 13:01:27 +00:00
Konstantin Belousov
298321a2e9 Complete r327264 by fixing yet another return without cleanup.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-12-28 12:59:48 +00:00
Warner Losh
d8dfc65f43 Close fd when we're done dv-sending the file.
CID: 978413
2017-12-28 05:34:38 +00:00
Warner Losh
80c3f90ed4 Don't leak outfile. Free it before we return from bincvt.
CID: 273685
2017-12-28 05:34:14 +00:00
Warner Losh
7790c87b71 Free zbuf when kflag is true too.
CID: 273376
2017-12-28 05:34:04 +00:00
Warner Losh
d79dc9b482 Use proper failure path rather than just returning.
CID: 1199354, 1006894, 1006893, 1006892
2017-12-28 05:33:24 +00:00
Warner Losh
1987e300d0 Explicitly ignore return value from remove. We wouldn't do anything
differently if we can't unlink the temporary file. Also, free the
temporary file name when we set it to NULL.

CID: 1006909, 719448
2017-12-28 05:33:19 +00:00
Warner Losh
829ec26617 Don't leak resources on duplicate -m or -M arguments. Last one wins.
CID: 1204385, 1204384
2017-12-28 05:32:59 +00:00
Eitan Adler
837fe32558 Fix a few more speelling errors
Reviewed by:		bjk
Reviewed by:		jilles (incl formal "accept")
Differential Revision:	https://reviews.freebsd.org/D13650
2017-12-28 01:31:28 +00:00
Nathan Whitehorn
6134b18696 Fix bug introduced in r326674, in which efi boot partitions created by
the installer but not mounted (i.e. with boot1.efifat dd'ed to them
rather than the forthcoming proper filesystem) would get newfs_msdos run
on them immediately after the boot code was copied. This would overwrite
the bootstrap code, causing the EFI system partition to be blanked and
resulting in an unbootable system.

PR:		224562
2017-12-28 01:21:30 +00:00
Warner Losh
f77a6187eb Use strl* here too.
CID: 1383969
2017-12-27 20:33:37 +00:00
Warner Losh
3888260471 Fix a bunch of issues (and a few non-issues but appeasement is easier
than arguing) Coverity found:

o Use open + fstat rather than stat + open to avoid any races for a
  file that's static for the life of the system. This will prevent any
  problems should someone insert a new device while installing a
  kernel in the future.
o Use strlcpy instead of strcpy as a failsafe to knowing that the
  strings can't possibly be larger than the buffer due to data
  source limits (though in the future these limits might be more
  dynamic).
o If we can't find the hints file, return rather than dereference
  a NULL pointer.
o Check for lastmod before calling strcmp in case a PNP entry
  comes before a module entry. That's not allowed, but within the
  realm of crazy things programmers do.
o Free lastmod before exiting search_hints() to avoid a leak.

CID: 1383971, 1383970, 1383969, 1383965, 1383963, 1383960
2017-12-27 18:30:24 +00:00
Eitan Adler
dae3a64fb9 userland: Fix several typos and minor errors
- duplicate words
- typos
- references to old versions of FreeBSD

Reviewed by:	imp, benno
2017-12-27 03:23:01 +00:00
Jilles Tjoelker
2fe0ea7324 nandtool: Add missing mode for open() with O_CREAT
If O_CREAT is given, open() needs a mode argument. Follow the umask by
passing 0666.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D13607
2017-12-26 16:20:38 +00:00
Warner Losh
d383021fa7 Fix typo 2017-12-26 04:07:18 +00:00
Warner Losh
4f7afd4f37 Doh! Never test in one tree and commit from another:
Fix typo: devmath -> devmatch

Sponsored by: Krampus! Carting off naughty committers for millennia
2017-12-25 19:08:39 +00:00
Warner Losh
d9aed21ce3 Match unattached devices on the system to potential kernel modules.
devmatch(8) matchs up devices in the system device tree with drivers
that may match them. For each unattached device in the system, it
tries to find matching PNP info in the linker hints and prints modules
to load to claim the devices.

In --unbound mode, devmatch can look for drivers that have attached to
devices in the device tree and have plug and play information, but for
which no PNP info exists. This helps find drivers that haven't been
converted yet that are in use on this system.

In addition, the ability to dump out linker.hints is provided.

Future commits will add hooks to devd.conf and rc.d to fully automate
using this information.
2017-12-25 18:56:08 +00:00
Alexander Kabaev
96289d0961 Remove write-only opt and useless optlen variables.
This squashes the warning gebnerated by GCC 6.x. Since
variables that are now removed had come documentation
value, put relevant bits in comment, so they can be
resurrected from there when actually needed.
2017-12-24 16:39:57 +00:00
Warner Losh
b68de8941f When -v is specified with -p dev, print the same verbose output as
when listing the whole tree. The list, however, is from the requested
device to the root (so it backwards from the normal tree).

Sponsored by: Netflix
2017-12-21 19:19:43 +00:00
Warner Losh
3ca6eb9faf Fix markup and bump .Dd. 2017-12-21 18:58:14 +00:00
Warner Losh
3386009737 Implement "-p dev" to print the path to the given device back to the
nexus. With redirection, could also be used to test if the device
exists in the device tree.

Sponsored by: Netflix
2017-12-21 18:51:47 +00:00
Pedro F. Giffuni
33d72c30f1 Revert r327005 - SPDX tags for license similar to BSD-2-Clause.
After consultation with SPDX experts and their matching guidelines[1],
the licensing doesn't exactly match the BSD-2-Clause. It yet remains to be
determined if they are equivalent or if there is a recognized license that
matches but it is safer to just revert the tags.

Let this also be a reminder that on FreeBSD, SPDX tags are only advisory
and have no legal value (but IANAL).

Pointyhat to:	pfg
Thanks to:	Rodney Grimes, Gary O'Neall

[1] https://spdx.org/spdx-license-list/matching-guidelines
2017-12-20 20:25:28 +00:00
Pedro F. Giffuni
d17aef79bb SPDX: These are fundamentally BSD-2-Clause.
They just omit the introductory line and numbering.
2017-12-19 22:40:16 +00:00
Baptiste Daroussin
64874a795e newsyslog: Fix issues after r326616
When building the command to execute for compression, newsyslog was modifying
the generic arguments array instead of its own copy.
Meaning on the second file to compress with the same arguments, the command line
was not the one expected.
Fix it by creating one copy of the arguments per execution and modifying that
copy.

While here, print the command line executed in verbose mode.

Reported by:	many
2017-12-18 09:35:04 +00:00
Mark Johnston
3836e3592e Fix a logic bug in makefs lazy inode initialization.
We may need to initialize multiple inode blocks before writing a given
inode. makefs(8) was only initializing a single block at a time, so
certain inode allocation patterns could lead to a situation where it
wrote an inode to an uninitialized block. That inode might be clobbered
by a later initialization, resulting in a filesystem image containing
directory entries that point to a seemingly unused inode.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D13505
2017-12-16 20:19:00 +00:00
Eugene Grosbein
a2c08ce75b pw(8): r326738 broke expiration arithmetic in case of `-D' flag not supplied.
Fix it and rename misnamed time_t variables `expire_days, password_days'
(always holding absolute time) to `expire_time, password_time'.

Add a comment for a case of overloading `cmdcnf->password_days'
and `cmdcnf->expire_days' with absolute time.

Reported by:	markj
Approved by:	mav (mentor)
MFC after:	1 week
2017-12-15 06:05:16 +00:00
Baptiste Daroussin
b37b09244c Replace usage of fparselen(3) by a getline(3)
This allow to remove the dependency on libutil
2017-12-14 08:57:37 +00:00
Pedro F. Giffuni
9b10f59a10 SPDX: mostly fixes to previous changes.
Introduce the recently approved BSD-1-Clause and replace 0BSD which
never did fit well our use cases.
2017-12-13 16:13:17 +00:00
Warner Losh
155b183ad2 Actually insert the free(d) call missed in r326802.
Noticed by: rpokala@
2017-12-12 19:45:24 +00:00
Warner Losh
96723f5a89 Iniailize str so ucs2_to_utf8 won't free stack garbage.
CID: 1381037
Sponsored by: Netflix
2017-12-12 19:26:28 +00:00
Warner Losh
af934ea3ba Add sanity testing against maximum sane lengths for device paths for
loader and kernel.

CID: 1383608
Sponsored by: Netflix
2017-12-12 19:26:24 +00:00
Warner Losh
a6b6f888b5 Free load_opt_buf after we're done with it.
CID: 1383607
Sponsored by: Netflix
2017-12-12 19:26:19 +00:00
Warner Losh
8354d13d9b Fix resource leak. Free converted description after printing it.
Also minor style sort of local vars.

CID: 1383606
Sponsored by: Netflix
2017-12-12 19:26:15 +00:00
Warner Losh
3af42ca7c1 Don't leak new_data.
CID: 1383605
Sponsored by: Netflix
2017-12-12 19:26:10 +00:00
Warner Losh
c66805a5d5 Check return value for set_bootvar and give a good error message.
CID: 1383601
Sponsored by: Netflix
2017-12-12 19:25:54 +00:00
Warner Losh
6604afe9c7 Unbreak gcc build by using (void) for functions that take no args.
Sponsored by: Netflix
2017-12-11 16:17:53 +00:00
Eugene Grosbein
d30f122fa6 pw(8): correct expiration period handling and command line overrides
to preconfigured values for -e, -p and -w flags.

Use non-negative symbols instead of magic values
in passwd_val/pw_password functions.

PR:		223431
Submitted by:	Yuri Pankov (in part, patch for the manual)
Reported by:	mav (mentor)
MFC after:	3 days
Relnotes:	yes
2017-12-09 23:34:00 +00:00
Niclas Zeising
fba6127915 Improve options and error handling.
Improve options handling and error out if multiple mutually exclusive
options are passed to acpiconf.  Switch from using atoi() to strtol() for
argument parsing, and add error checking and handling, instead of blindly
trusting that the integer conversion is OK.
Cange err() to errx() in once case, the errno value was garbage there.

Reviewed by:	emaste
Approved by:	emaste
Differential Revision:	D13430
2017-12-09 15:59:10 +00:00
Warner Losh
a2aa66719e Indent multiple device path entries correctly.
Sponsored by: Netflix
2017-12-09 07:44:00 +00:00
Warner Losh
1127aea3e7 Remove vestiges of -d and -p commands.
Fix two core dumps when optional data isn't specified.

Sponsored by: Netflix
2017-12-09 07:43:55 +00:00
Warner Losh
a3e6c4a6fc Forgotten in 326725
Release Notes: Yes
2017-12-09 06:57:19 +00:00
Warner Losh
1285bcc833 Import Netflix's efibootmgr to help manage UEFI boot variables
efibootmgr manages the UEFI BootXXXX variables that implement the UEFI
Boot Manager protocol defined in the UEFI standards. It is modeled
after the Linux program of the same name with a mostly compatible set
of command line options. Since there's a fair amount of OS specifioc
code due to differeing names and methods of doing things, the
compatibility isn't 100%.

Basic functionality is implemented, though the more advanced next boot
functionality that's been defined elsewhere is unimplemented.

Submitted by: Matt Williams (with unix / efi path xlate by me)
Sponsored by: Netflix
2017-12-09 06:52:20 +00:00
Nathan Whitehorn
52f39da1f8 Support mounted boot partitions in the installer. This allows the platform
layer, for example, to specify that the EFI boot partition should be
mounted at /efi and formatted normally with newfs_msdos rather than
splatted to from /boot/boot1.efifat.

This commit adds only the API for this; actual platform use will come later.
2017-12-08 00:57:13 +00:00
Baptiste Daroussin
6f80848e09 Really fix typo and improve wording of the comment 2017-12-06 10:47:50 +00:00
Baptiste Daroussin
69f0fc7877 Fix typo
Reported by:	danfe
2017-12-06 10:20:01 +00:00
Baptiste Daroussin
307845dff2 Allow newsyslog to execute compression commands which
have a semantic different than the traditional gzip(1)

This is done to allow to use zstd(1) as a compression tool without
having to patch it to change its default behavior.
2017-12-06 09:44:35 +00:00
Warner Losh
cb37fc82b1 De-const to match changes in userboot.h
Sponsored by: Netflix
2017-12-06 05:18:52 +00:00
Warner Losh
e8e6a5f920 Make putenv and getenv match the userland definition of these
functions, tweak man page and one variable that shouldn't be const
anymore.

Sponsored by: Netflix
2017-12-06 02:00:00 +00:00
Gleb Smirnoff
50387adce2 When parsing remote messages, require them to have standard timestamp
field, and support properly parse out the hostname as described by RFC3164,
which wasn't done before.  However, don't discard message if it doesn't
have hostname, for compatibility.

Enable logging of the message supplied hostname instead of real hostname
with -H switch.

PR:		200933
Reported by:	Konstantin Pavlov <thresh nginx.com>
MFC after:	2 months
2017-12-05 19:54:55 +00:00
Cy Schubert
4451f1426c fdformat is a sysadmin command and thus its man page should be in
volume 8 instead of volume 1.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D13370
2017-12-05 05:02:46 +00:00
Warner Losh
a2bb1fffdf Add forgotten libgeom.
Sponsored by: Netflix
2017-12-02 15:25:45 +00:00
Warner Losh
693ba58ff6 Add -u (--to-unix) and -e (--to-efi) to convert unix or efi paths to
the other.

Sponsored by: Netflix
2017-12-02 07:29:24 +00:00
Warner Losh
64f77f095e Read multiple lines when parsing the data. Allow multiple device paths
to be read when formatting device paths. Set the upper limit to 64k
(most of these paths are < 64 bytes).

Sponsored by: Netflix
2017-12-02 07:29:07 +00:00
Pedro F. Giffuni
64de3fdd58 SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
Pedro F. Giffuni
8820ecc040 SPDX: Fix some cases wrongly attributed to MIT.
In the cases of BSD-style license variants without clauses, use 0BSD for
the time being in lack of a better description.
2017-11-30 15:10:11 +00:00
Gleb Smirnoff
eb7ec39704 Revert r325558 as it is incorrect. 2017-11-28 19:25:01 +00:00
Gleb Smirnoff
09f876612c Fix obvious NULL pointer dereference from r310350. 2017-11-28 19:18:00 +00:00
Alan Somers
18e980c0e0 diskinfo(8): Delete dead code in slog test
Reported by:	Coverity
CID:		1377556
Reviewed by:	mav
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D13275
2017-11-27 21:10:50 +00:00
Alexander Motin
31c6d7311e Fix integer overflow in SLOG test.
MFC after:	1 week
2017-11-27 20:01:43 +00:00
Ed Maste
f4d8e4954d efivar: add missing getopt 'u' option 2017-11-27 19:35:21 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Pedro F. Giffuni
f0cfa1b168 share and pc-sysinstall: adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Commit these apart because compile testing doesn't guarantee I didn't made
some nasty mistake. No functional change intended.
2017-11-27 15:28:26 +00:00
Edward Tomasz Napierala
7acc357f58 .Xr pmcstat(8) from kgmon(8) and gprof(1).
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-11-27 12:37:14 +00:00
Edward Tomasz Napierala
7ef789791e Revert r326125.
It turns out kgmon(8) still works, and provides some functionality that's
not provided by pmcstat(8).

Reported by:	bde@
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-11-27 12:34:23 +00:00
Xin LI
483825ed9a Don't assign rs as we will assign it later.
MFC after:	2 weeks
2017-11-27 04:15:03 +00:00
Edward Tomasz Napierala
dd62bb6aeb Mark kgmon(8) obsolete, redirecting users to pmcstat(8).
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12574
2017-11-23 12:41:05 +00:00
Emmanuel Vadot
20d40a56cb bsdinstall: Add ntpdate option
When you install a computer for the first time, the date in the CMOS sometimes
not accurate and you need to ntpdate as ntpd will fail a the time difference
is too big.
Add an option in bsdinstall to enable ntpdate that will do that for us.

Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D13149
2017-11-22 15:27:47 +00:00
Ed Maste
850b25abab Fix indentation in bsdinstall-created wpa_supplicant.conf
r309934 cleaned up some cases in bsdinstall to use heredocs but broke
the indentation of the generated output, because <<- heredocs strip
leading tabs.

PR:		221982
Reviewed by:	allanjude, dteske
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13190
2017-11-22 15:18:11 +00:00
Ed Maste
f6e2146105 freebsd-update: do not duplicate patchlist entries
PR:		221079
Submitted by:	Masachika ISHIZUKA
Submitted by:	ota@j.email.ne.jp
Reviewed by:	cperciva
MFC after:	1 week
2017-11-22 01:50:23 +00:00
Ed Maste
82edb108da vidcontrol: correct history size error message
`vidcontrol -h 0` is acceptable, so be explicit that it's less than zero
that is not allowed.

Reported by:	Siva Mahadevan
Sponsored by:	The FreeBSD Foundation
2017-11-21 13:55:10 +00:00
Warner Losh
c0a0f12f9b This program is more useful if it skips leading whitespace when
parsing a textual UEFI Device Path, since otherwise it things the
passed in path is a filename. While here, reduce the repetition of
8192.

Sponsored by: Netflix
2017-11-21 07:35:29 +00:00
Warner Losh
1c3a0e1a46 Document what the command line arguments actually do. List some of the
size limitations.

Sponsored by: Netflix
2017-11-21 07:35:24 +00:00
Alan Somers
8394104312 periodic: fix exit status for nonexistent arguments
When called with an absolute pathname, periodic should attempt to execute
every script in that directory. If the directory does not exist, it should
print an error and exit 1. Due to a copy/paste mistake in r231568, it exits
0 in that case.

Reported by:	devel/hs-ShellCheck
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D13070
2017-11-20 23:51:51 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Andriy Voskoboinyk
e989c74331 wlandebug(8): allow fallback to old behavior + improve name checks.
- Treat passed interface name as original if ifconfig_get_orig_name() fails.
- Reject interface name if it does not start from "wlan".
2017-11-19 20:13:11 +00:00
Pedro F. Giffuni
df57947f08 spdx: initial adoption of licensing ID tags.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes:	yes
Differential Revision:	https://reviews.freebsd.org/D13133
2017-11-18 14:26:50 +00:00
Bryan Drewery
1bf59a71c7 Fix 'local' to not look in the source tree for the file.
Usually 'local' is used along with other rules such as 'no-implicit-rule' or
'dependency' which avoids this problem.  It's possible to need to use 'local'
while relying on the default rules though for a file which is not in the source
tree nor generated in the kernel.

Sponsored by:	Dell
Differential Revision:	https://reviews.freebsd.org/D13125
2017-11-17 18:34:14 +00:00
Warner Losh
1cbb58886a Remove build system support for lint.
Differential Revision: https://reviews.freebsd.org/D13124
2017-11-17 18:16:46 +00:00
Warner Losh
ca987d4641 Move sys/boot to stand. Fix all references to new location
Sponsored by:	Netflix
2017-11-14 23:02:19 +00:00
Bartek Rutkowski
569aaa3b97 bhyve: avoid applying capsicum capabilities to file that was not opened
When using -l option targeting file that can't be opened (ie. nmdm module
is not loaded and /dev/nmdm* is specified) bhyve tries to apply capsicum
capabilities to a file that was not opened.

Enclose that code in an if statement and only run it on correctly opened
descriptor also providing meaningful message in case of an error.

Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Reviewed by:	grehan, emaste
Sponsoied by:	Mysterious Code Ltd.
Differential Revision:	D12985
2017-11-11 22:50:14 +00:00
Warner Losh
831bec1163 Simplify the efivar interface a little.
We started out having Linux compatible libefivar interfaces. This was
in anticipation of porting the GPL'd efibootmgr to FreeBSD via a
port. However, since we need that functionality in the base, that port
isn't going to happened. It also appears that efivar is a private
library that's not used much outside a command line util and
efibootmgr. Reduce compatibility with the Linux version a little by
removing the mode parameter to efi_set_variable (which was unused on
FreeBSD, and not set to something useful in the code we'd
written). Also remove some efi error routines that were never
implemented and existed only to placate early GPL efibootmgr porting
experiments.

Suggested by: Matt Williams
Sponsored by: Netflix
2017-11-10 23:30:23 +00:00
Ed Maste
72130735d8 Strip EOL whitespace in usr.sbin/{jail,jexec} 2017-11-10 14:53:16 +00:00
Warner Losh
c1d0ef846c Remove useless .if. The whole point of SUBDIR.yes was so that we
didn't need this construct.

Sponsored by: Netflix
2017-11-09 14:31:25 +00:00
Gleb Smirnoff
b9a63e5c3a When parsing UDP messages skip optional hostname as described by
RFC 3164.

PR:		200933
Submitted by:	maxim
Reported by:	Konstantin Pavlov <thresh nginx.com>
MFC after:	2 weeks
2017-11-08 16:45:53 +00:00
Konstantin Belousov
93b09f581a Remove badsect(8).
Failure modes of the modern (that is, produced in the last 25 years)
hard drives and SSDs made the utility outdated.  Since the kernel
interface to support it was removed in r324853, cut the userspace
remnants as well.

Discussed with:	bde (who does not like the removal)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-11-05 22:00:54 +00:00
Edward Tomasz Napierala
74864a1eaa Use proper naming in a debug message.
MFC after:	2 weeks
2017-11-04 14:13:58 +00:00
Andriy Voskoboinyk
7d41856e52 pmcstat(8): unbreak build with LDFLAGS+=-Wl,--as-needed
libpmcstat.a requires libelf.so; reorder them accordingly.
2017-11-03 00:12:32 +00:00
Eitan Adler
1888bce26a Remove 'adding_user.7'
Not to be confused with adduser.
Not to be confused with useful information.

Differential Revision: https://reviews.freebsd.org/D12848
2017-11-01 01:22:33 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Bryan Drewery
04760bd70d These values already set by src.libnames.mk.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-31 00:03:25 +00:00
Vladimir Kondratyev
c9eb7bf7a0 bthidd(8): Generate button release event after virtual T-axis button press
Apply PR/213957 (r308165, Make sure the virtual T-axis buttons generate button
release event(s) for continuous tilting) to bluetooth mouse support.

Reviewed by:		emax, gonzo
Approved by:		gonzo (mentor)
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D12672
2017-10-30 20:58:57 +00:00
Eugene Grosbein
81a5dbd52c ppp(8): style(9) fix after r325157
Approved by:	mav (mentor)
2017-10-30 15:19:28 +00:00
Eugene Grosbein
538abeb18d Fix ppp(8) to add RTF_HOST flag to created host route.
Reported by:	Mike Tancsa <mike@sentex.net>
Approved by:	avg (mentor)
MFC After:	1 week
2017-10-30 15:02:42 +00:00
Eitan Adler
a2aef24aa3 Update several more URLs
- Primarily http -> https
- Primarily FreeBSD project URLs
2017-10-29 08:17:03 +00:00
Pedro F. Giffuni
7e7315b542 bsnmpd: Only refresh devtree if devd event is a new or removed device.
It makes sense to refresh the tree only when a device is inserted or
removed, otherwise bsnmpd wastes lot of CPU.

PR:		209368
MFC after:	1 week
2017-10-28 21:26:49 +00:00
Jeremie Le Hen
0696540011 Update manpage date to when the deprecation notice was removed.
Reported by:	bcr
2017-10-27 21:48:02 +00:00
Ruslan Bukin
d27927f731 Extract a set of pmcstat functions and interfaces to the new internal
library -- libpmcstat.

This includes PMC logging module, symbols lookup functions,
ELF parsing, process management, PMC attachment, etc.

This allows to reuse code while building new hwpmc(4)-based applications.

Also add pmcstat_symbol_search_by_name() function that allows to find
mapped IP range for a given function name.

Reviewed by:	kib
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12718
2017-10-24 16:28:00 +00:00
Vladimir Kondratyev
12df521311 bthidd: Fix leds on multireport keyboards broken after r297217
Reviewed by:		emax, gonzo
Approved by:		gonzo (mentor)
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D12214
2017-10-19 20:42:46 +00:00
Benjamin Kaduk
72cc0b3d93 Adopt jail.8 to our brave new bsdinstall world
Submitted by:	Steve Kargl
MFC after:	3 days
2017-10-18 22:56:46 +00:00
Andriy Voskoboinyk
3ce85fa36b wlandebug(8): add a sanity check. 2017-10-16 07:15:50 +00:00
Andriy Voskoboinyk
238c9eb65a wlandebug(8): obtain original interface name via ifconfig_get_orig_name() 2017-10-16 07:01:27 +00:00
Baptiste Daroussin
a6aeb2b6e4 Fix ctld segfaulting when using ucl conf file format and having duplicated
lun or target

Submitted by:	Nikita Kozlov <nikita.kozlov at blade-group.com>
MFC after:	3 days
Sponsored by:	blade
Differential Revision:	https://reviews.freebsd.org/D12646
2017-10-15 08:03:14 +00:00
Andriy Gapon
668f9cbec0 i2c(8): clean up and clarify read operation
The code went to a lot of trouble to issue either a start+stop condition
or a repeated start condition only to follow it with a stop condition
and a read(2) call that issues a new start condition.
So, fix the read in I2C_MODE_REPEATED_START mode by using I2CREAD ioctl
within the running transaction.  This obviously requires that the slave
address has the read bit set which was not required before.

Another problem was with width parameter of zero and
I2C_MODE_REPEATED_START mode.  In that case we issued a repeated start
without any preceding start.

While here, remove the redundant (unused) argument to I2CSTOP throughout
the program.
Also, clarify the meaning of -w option, especially "-w 0", in the manual
page.

Reviewed by:	no one
Differential Revision: https://reviews.freebsd.org/D12331
2017-10-13 09:21:41 +00:00
Jung-uk Kim
67d9aa4422 Merge ACPICA 20170929 (take 2). 2017-10-10 19:33:24 +00:00
Navdeep Parhar
497e8a6bf0 cxgbetool(8): Do not close uninitialized fd on malloc failure.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-10-09 18:00:40 +00:00
Guangyuan Yang
33bd05c318 Fix freebsd-update(8) erroneous message and exit status when "fetch install" used.
PR:		190660
Reviewed by:	allanjude
Approved by:	emaste
Differential Revision:	https://reviews.freebsd.org/D12037
2017-10-09 16:33:37 +00:00
Navdeep Parhar
313a64359d cxgbetool(8): Do not create a large file devoid of useful content when
the dumpstate ioctl fails.  Make the file world-readable while here.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-10-07 01:20:30 +00:00
Mariusz Zaborski
b01988a5f5 Partially revert r323866.
Using HAVE_* is a internal tcpdump style standard.
We want to be consistent with the standard to upstream those changes in
the future.

Requested by: glebius@
2017-10-04 21:05:44 +00:00
Alan Somers
27f0f2ec5f Display rotation rate and TRIM/UNMAP support in diskinfo(8)
Bump __FreeBSD_version due to the expansion of struct diocgattr_arg.

Reviewed by:	mav, allanjude, imp
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D12578
2017-10-04 15:09:49 +00:00
Emmanuel Vadot
1da3e8b097 mountd: Convert mountlist to SLIST
Use SLIST from sys/queue.h instead of homebrew linked list for mountlist.

Reviewed by:	bapt, rmacklem
MFC after:	1 week
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D12504
2017-10-04 08:48:05 +00:00
Emmanuel Vadot
c9ac0f714c mountd: Convert exportlist to SLIST
Use SLIST from sys/queue.h instead of homebrew linked list for the exportlist.

Reviewed by:	bapt, rmacklem
MFC after:	1 week
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D12502
2017-10-04 08:43:56 +00:00
Alan Somers
780dc32b31 Fix copy/paste error in diskinfo.8 from r320555
MFC after:	1 week
Sponsored by:	Spectra Logic Corp
2017-10-03 17:00:01 +00:00
Conrad Meyer
af3b49ef41 ppp(8): Fix various bugs in NOPAM section of auth_CheckPasswd
* pw is not initialized before use
* success is returned if crypt(3) errors

These bugs were introduced in r231994, which attempted to adopt DragonflyBSD
f4a9869feb646aafe72de6e5d61051a023a02676.  The original author of the
Dragonfly change also noticed these mistakes and filed the PR.

PR:		222620
Submitted by:	Lubos Boucek <bouceklubos AT gmail.com>
Obtained from:	DragonflyBSD f4a9869feb646aafe72de6e5d61051a023a02676
2017-10-02 23:14:29 +00:00
Allan Jude
f78bd12d6d bsdinstall(8) hardening menu: Utilize new kern.randompid=1 behaviour
Enabling the PID randomization option in bsdinstall(8)'s hardening menu
now randomizes the effective value of kern.randompid on each boot.

Previous behaviour:
When kern.randompid was enabled via the the bsdinstall(8) hardening menu,
a random value was generated and placed in the systems /etc/sysctl.conf as
kern.randompid=value
This makes the value of kern.randompid static across reboots.

New behaviour:
When kern.randompid is enabled via the bsdinstall(8) hardening menu, the
line kern.randompid=1 is placed in the systems /etc/sysctl.conf.
This takes advantage of a new kernel feature and makes the value of
kern.randompid be randomized by the kernel on each reboot.

Submitted by:	Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Reviewed by:	des
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D12433
2017-10-02 14:19:31 +00:00
Alexander Motin
e975a1aba0 Align test I/O buffer to page boundary.
This is more alike to typical kernel behavior, that can be useful from
benchmarking point of view.

MFC after:	1 week
2017-10-01 16:59:02 +00:00
Jung-uk Kim
d7bbccdd82 Revert r324109. This commit broke a number of systems.
Reported by:	lwhsu, kib
Requested by:	ngie
2017-09-30 20:28:50 +00:00
Michael Tuexen
d55fae0299 Fix reporting of probing size. This bug was introduced in r324119.
MFC after:	4 weeks
2017-09-30 12:30:05 +00:00
Michael Tuexen
9d8b46c89c Add SCTP and TCP as protocols for sending probe packets.
MFC after:	4 weeks
2017-09-30 11:45:33 +00:00
Michael Tuexen
aa96470cc9 * Update function definitions.
* Ensure that the datalen always describes the length after the IPv6
  header consistently, not matter which protocol us used for probes..
* Document that the default length is 20, not 12.
* Don't send inormation in probe packets which is not needed or
  even checked when the responses are processed.
* Address CID 978587.

This is mainly a cleanup preparing the addition of SCTP and TCP
as possible probe packet protocols.

MFC after:	4 weeks
2017-09-30 11:40:18 +00:00
Konstantin Belousov
4b06638f20 Update cpucontrol(8).
Mention new -n flag.
Remove optional -h from the operation list lines, -h would cause the
utility to exit without performing the action.
Explain the default path behavior, list default path.
Correct example of update performed from the non-default path,
it needs -n and the trailing slash is redundand.
Remove useless BUGS section.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-09-30 10:03:42 +00:00
Konstantin Belousov
0539c17353 Allow to disable default microcode updates search path with the new
'-n' option.

Look for updates in the default locations only after user-supplied
locations are tried.

If newer microcode files are put into non-standard path, both measures
allow to avoid situation where older update loaded from the default
path first, and then the second update is applied from non-standard
path.  Applying intermediate updates might be undesirable.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-09-30 09:59:32 +00:00
Jung-uk Kim
c39c15e23f Merge ACPICA 20170929. 2017-09-29 23:02:49 +00:00
Alexander Motin
75b2ed47b7 Alike to ZFS disable cache flush after first ENOTSUP error.
MFC after:	1 week
2017-09-28 15:58:41 +00:00
Nick Hibma
cc5cd33264 Typo in filename in comment. 2017-09-28 12:43:25 +00:00
Mateusz Guzik
cfcabed65f Whack procctl(8)
It was supposed to provide a recovery mechanism against bugs in procfs's
long deprecated tracing capabilities.

Remove the tool as a prerequisite to axing the kernel side.

The tracing facility to use is ptrace(2).

MFC after:	2 weeks
2017-09-27 01:03:00 +00:00
Emmanuel Vadot
92e73ccc73 mountd: Avoid memory leak by freeing dp_dirp
Introduced in r324007, the data alloced by strdup was never free'ed.
While here, remove cast to caddr_t when freeing dp.

Reported by:	bde
MFC after:	1 week
X MFC With:	r324007
2017-09-26 12:15:13 +00:00
Emmanuel Vadot
89b859e39a mountd: Remove unneeded cast
Reported by:	kib
MFC after:	1 week
X MFC With:	r324007
2017-09-26 11:11:17 +00:00
Emmanuel Vadot
380a3fcd05 mountd: Replace malloc+strcpy to strdup
Reviewed by:	bapt
MFC after:	1 week
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D12503
2017-09-26 09:18:18 +00:00
Mariusz Zaborski
2560d18180 We use a few different ifdef's names to check if we are using Casper or not,
let's standardize this. Now we are always use WITH_CASPER name.

Discussed with:	emaste@
MFC after:	1 month
2017-09-21 14:41:41 +00:00
Gordon Tetlow
eb039c2661 Revert tcpdump to using the source manpage instead of having a copy here.
This helps future maintainability of tcpdump so we don't forget to update
the manpage (like we have previously).

Stolen from:	usr.bin/file/Makefile
Reviewed by:	jilles
Approved by:	delphij (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D12403
2017-09-18 16:42:13 +00:00
Michael Tuexen
7c9470c075 Remove empty line accidently introduced in r323626. 2017-09-15 20:41:12 +00:00
Michael Tuexen
c3c1d365de Add references. Suggested by Maxim Konovalov.
Sponsored by:	Netflix, Inc.
2017-09-15 20:34:52 +00:00
Scott Long
ed26c389bf Add support for parsing the Watchdog Descriptor Table (WDDT)
Sponsored by:	Netflix
2017-09-15 15:41:07 +00:00
Michael Tuexen
507a9c432b Bump date missed in r323596. Trim trailing whitespace.
Sponsored by:	Netflix, Inc.
2017-09-14 20:42:19 +00:00
Michael Tuexen
314e8196ea Add a description how tcpdrop handles the case of specifying the
-s and the -S option.

Sponsored by:		Netflix, Inc.
2017-09-14 18:50:40 +00:00
Ryan Libby
6a6b7210d7 zic: -Wno-error=strict-overflow
Reviewed by:	emaste
Sponsored by:	Dell EMC Isilon
X-Differential Revision:	https://reviews.freebsd.org/D12284
2017-09-14 03:39:42 +00:00
Gordon Tetlow
4572fb3faf Deorbit catman. The tradeoff of disk for performance has long since tipped
in favor of just rendering the manpage instead of relying on pre-formatted
catpages. Note, this does not impede the ability to use existing catpages,
it just removes the utility to generate them.

Reviewed by:	imp, allanjude
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D12317
2017-09-13 16:35:16 +00:00
Navdeep Parhar
7f7a2bce78 cxgbetool(8): mode must be specified when creating the dump file.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-09-13 00:37:42 +00:00
Ravi Pokala
40f0d8dc4a When doing a non-interactive installation, don't display an interactive
warning about a filesystem which doesn't have a mountpoint. Presumably, the
person who wrote the install script knew what they were doing.

Submitted by:	Brian Mueller <bmueller@panasas.com>
MFC after:	1 month
Sponsored by:	Panasas
Differential Revision:	https://reviews.freebsd.org/D12346
2017-09-12 22:19:21 +00:00
Ryan Stone
7c1b51d6dc Fix incorrect error message in iovctl
If the iovctl command was invoked with only the -C flag, the user would
receive a message claiming that they needed to also supply either the
-d flag or the -f flag.  However, in the case of the -C mode, only the
-f flag is acceptable.  Correct this error message in this case.

PR:		222050
Submitted by:	Heinz N. Gies
Reported by:	Heinz N. Gies
MFC after:	1 week
2017-09-12 21:12:04 +00:00
Michael Tuexen
e1418fa5ef Allow TCP connections to be filtered by stack and state.
Choose the command line options to be consistent with the ones of
sockstat.

Sponsored by:	Netflix, Inc.
2017-09-12 13:39:44 +00:00
Ian Lepore
c3c16dce19 Make i2c -s (device scan) work on hardware that supports only full xfers.
The existing scan code is based on sending an i2c START condition and if
there is no error it assumes there is a device at that i2c address.  Some
i2c controllers don't support sending individual start/stop signals on the
bus, they can only perform complete data transfers with start/stop handled
in the silicon.

This adds a fallback mechanism that attempts to read a single byte from each
i2c address.  It's less reliable than looking for an an ACK repsonse to a
start, because some devices will NAK an attempt to read that isn't preceeded
by a write of a register address.  Writing to devices to probe them is too
dangerous to even consider.  The user is told that a less-reliable scan is
being done, so even if the read-scan comes up empty too, it's still a vast
improvement over the old situation where it would just claim there were no
devices on the bus even though the devices were there and working fine.

If the i2c controller responds with a proper ENODEV (device doesn't support
operation) or an almost-proper EOPNOTSUPP, the START/STOP scan is switched
to a read-scan right away.  Most controllers respond with ENXIO or EIO if
they don't support START/STOP, so no quick-out is available.  For those,
if a scan of all 127 addresses and come up empty, the scan is re-done using
the read method.

Reported by:	Maxim Filimonov <che@bein.link>
2017-09-11 21:49:38 +00:00
Ed Maste
c12530ca4c Ignore error return from newaliases(1)
This was originally added as "exit $SUCCESS" but with nothing to set the
SUCCESS variable. Thus it became an exit with no argument, which just
exits with the status of the preceding command.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-09-11 17:39:21 +00:00
Gordon Tetlow
5f16669804 The purge option hasn't been implemented since 1994 when we imported this
code. I think it is safe to say it's not going to be. I'm also working to
de-orbit catman, so remove the reference in the manpage.

Reviewed by:	allanjude
2017-09-09 03:09:02 +00:00
Ryan Libby
e881ec1646 crunchgen: quiet -Wmissing-prototypes
Reviewed by:	emaste (previous version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12107
2017-09-07 17:20:47 +00:00
Warner Losh
5709a4b5a1 Create efi utility printing routines
Split out asciidump, utf8dump, bindump, and hexdump into a separate
file efiutil.c. Implement new efi_print_load_option for printing out
the EFI_LOADER_OPTION data structure used to specify different options
to the UEFI boot manager.

Sponsored by: Netflix
2017-09-07 07:30:19 +00:00
Justin Hibbits
9cede44051 Correct the binmiscctl(8) man page for powerpc64
Magic for powerpc64 erroneously specified ELFCLASS32 instead of ELFCLASS64.

Submitted by:	luca.pizzamiglio _AT_ gmail DOT com
MFC after:	3 days
2017-09-04 20:57:38 +00:00
Benjamin Kaduk
fe8b4983b4 Fix mdoc typo in auto_master.5
There needs to be a space after the no-space macro in order for it
to be interpreted.

PR:		221986
Submitted by:	Paul Townsend <pt@zendware.com>
2017-09-01 22:04:45 +00:00
Jung-uk Kim
2f6a1a81bb Merge ACPICA 20170831. 2017-08-31 22:47:04 +00:00
Warner Losh
b0da7c79f1 Add UCS2->UTF8 option.
Many UEFI variables are UCS2 strings (some NUL terminated, others
not). Add --utf8 (-u) to convert UCS2 strings to UTF8 before printing.

Sponsored by: Netflix
2017-08-31 17:53:50 +00:00
Alexander Motin
d4c2de2e0b Fix flags field decoding in ACPI_NFIT_CONTROL_REGION.
It looked like incomplete copy/paste, printing absolute garbage.

While there, print ValidFields field ax hex, since it is a bitmask.

MFC after:	3 days
2017-08-31 09:08:06 +00:00
Benno Rice
88e2cc9eb5 Replace makefs' hand-rolled unescaping with strunvis
mtree path names and link attributes are encoded, generally using strvis. Newer
versions of mtree will use C-style escapes but previously the accepted form was
octal escapes. makefs' mtree code spots the C-style escapes but fails to deal
with octal escapes correctly.

Remove mtree's escape-decoding code (except for a few instances where it's
needed) and instead pass pathnames and link targets through strunvis prior to
use.

Reviewed by:	marcel
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12104
2017-08-25 16:10:16 +00:00
Bruce Evans
9bc7c36337 Support setting the colors of cursors for the VGA renderer.
Advertise this by changing the defaults to mostly red.  If you don't like
this, change them (almost) back using:
   vidcontrol -c charcolors,base=7,height=0
   vidcontrol -c mousecolors,base=0[,height=15]

The (graphics mode only) mouse cursor colors were hard-coded to a black
border and lightwhite interior.  Black for the border is the worst
possible default, since it is the same as the default black background
and not good for any dark background.  Reversing this gives the better
default of X Windows.  Coloring everything works better still.  Now
the coloring defaults to a lightwhite border and red interior.

Coloring for the character cursor is more complicated and mode
dependent.  The new coloring doesn't apply for hardware cursors.  For
non-block cursors, it only applies in graphics mode.  In text mode,
the cursor color was usually a hard-coded (dull)white for the background
only, unless the foreground was white when it was a hard-coded black
for the background only, unless the foreground was white and the
background was black it was reverse video.  In graphics mode, it was
always reverse video for the block cursor.  Reverse video is worse,
especially over cutmarking regions, since cutmarking still uses simple
reverse video (nothing better is possible in text mode) and double
reverse video for the cursor gives normal video.  Now, graphics mode
uses the same algorithm as the best case for text mode in all cases
for graphics mode.  The hard-coded sequence { white, black, } for the
background is now { red, white, blue, } where the first 2 colors can
be configured.  The blue color at the end is a sentinel which prevents
reverse video being used in most cases but breaks the compatibility
setting for white on black and black on white characters.  This will
be fixed later.  The compatibility setting is most needed for mono modes.

The previous commit to syscons.c changed sc_cnterm() to be more careful.
It followed null pointers in some cases.  But sc_cnterm() has been
unreachable for 15+ years since changes for multiple consoles turned
off calls to the the cnterm destructor for all console drivers.  Before
them, it was only called at boot time.  So no driver with an attached
console has ever been unloadable and not even the non-console destructors
have been tested much.
2017-08-25 07:04:41 +00:00
Kenneth D. Merry
2d73f7e208 Fix a resource leak in an error case in camdd_buf_sg_create().
Submitted by:	Coverity
CID:		1341622
MFC after:	3 days
Sponsored by:	Spectra Logic
2017-08-23 17:52:49 +00:00
Benno Rice
8e7cd863dd Correct typo in usage string.
Submitted by:	peterpakos (GitHub username)
MFC after:	1 day
2017-08-22 23:55:09 +00:00
Glen Barber
ce5dff88a9 Revert part of r322770 in usr.sbin/chown/tests/chown_test.sh,
which incorrectly adds atf_expect_fail() where there is no
failure case.

MFC after:	3 days
MFC with:	r322770
Sponsored by:	The FreeBSD Foundation
2017-08-22 17:23:29 +00:00
Kenneth D. Merry
988bd0d72b Restructure camdd(8) slightly to make it easier to add support for
additional protocols.

Submitted by:	Chuck Tuffli <chuck@tuffli.net>
MFC after:	1 week
Differential Revision:	D11230
2017-08-22 13:08:22 +00:00
Glen Barber
6e810e514a Apply changes from bin/chmod/tests/chmod_test.sh (r321949, r321950,
and r322101), adding atf_expect_fail() before chflags(8) is invoked
if the filesystem is ZFS, which does not support UF_IMMUTABLE.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-08-21 20:23:05 +00:00
Bruce Evans
dd51fceb15 Reduce complexity and backwards compatibilty a little by removing new aliases
and repurposing "blink".  Improve accuracy of documentation of historical
mistakes and other bugs.

"blink" now means "set the blink attribute for the target(s)" instead of
"set the blink attribute and clear other attributes [and control flags]".
It was even more confusing to use "blinking" for the single attribute to
keep the old meaning for "blink".

"destructive" is not as historically broken or gone as the previous version
said.

The bugs involving resetting from defaults are now understood and partly
documented (the defaults are mis-initialized).
2017-08-19 12:14:46 +00:00
Ed Maste
8d2dbd281f pw useradd: Validate the user name before creating the entry
Previouly it was possible to create users with spaces in the name with:
pw useradd -u 1234 -g 1234 -n 'test user'

The "-g 1234" is relevant, without it the name was already rejected
as expected:

[fk@test ~]$ sudo pw useradd -u 1234 -n 'test user'
pw: invalid character ` ' at position 4 in userid/group name

Bug unintentionally found with a salt config without explicit name entry:

test user:
  user.present:
    - uid: 1234
    - gid: 1234
    - fullname: Test user
    - shell: /usr/local/bin/bash
    - home: /home/test
    - groups:
      - wheel
      - salt

"Luckily" salt modules rarely bother with input validation either ...

PR:		221416
Submitted by:	Fabian Keil
Obtained from:	ElectroBSD
MFC after:	1 week
2017-08-19 00:32:26 +00:00
Ed Maste
3dc869c257 pw usermod: Properly deal with empty secondary group lists (-G '')
"pw usermod someuser -G ''" is supposed make sure that someuser
doesn't have any secondary group memberships.

Previouly it was a nop because split_groups() only intitialised
"groups" if at least one group was specified. As a result the
existing secondary group memberships were kept.

PR:		221417
Submitted by:	Fabian Keil
Obtained from:	ElectroBSD
MFC after:	1 week
Relnotes:	yes
2017-08-19 00:19:23 +00:00
Enji Cooper
c78c36cd9c Don't leak bpf on early return when YP isn't defined (NIS support)
MFC after:	1 week
Reported by:	cppcheck
2017-08-17 20:41:28 +00:00
Enji Cooper
c354522292 Fix WARNS
- Remove ad hoc inet_ntoa prototype declaration; it's already handled
  by the included headers.
- De-K&Rify the function prototypes for eachres_whoami(..),
  eachres_getfile(..), and main(..).

MFC after:	1 week
PR:		71667
Tested with:	clang (5.0), gcc (4.2.1, 5)
2017-08-17 20:37:01 +00:00
Bruce Evans
eb4fa1ad8c I misplaced a newline in the previous commit. Fix this, and move line
breaks in the vt case to the same places that the man(1) puts then in
the SYNOPSIS.  This was already done for the syscons case.  Man pages
can't depend on the driver, and the SYNOPSIS is hard-coded for syscons
except for -f where it is hard-coded for vt.  The usage message reverses
this for sc.  The only other differences are whitespace and removing
-[dL] and -l for vt.
2017-08-17 20:25:50 +00:00
Bruce Evans
92dedf1b1b Update vidcontrol -c to support all cursor appearance setting
capabilities.

Most of the capabilities (all of the arcane ones) were in FreeBSD-2.0.5,
but were harder to use then, and vidcontrol didn't try.  FreeBSD-4.1.0
added per-vty support, fixed the destructivness of the "destructive"
cursor, and improved APIs.  Start using the new APIs, support all of
their capabilities, and document all of the capabilities and some of
the historical mistakes.

vt doesn't support any of this before or after the change.

Fix minor unrelated bitrot in the usage message for the syscons case.
2017-08-17 18:08:45 +00:00
Bruce Evans
03096857fd Fix setting of the border color. Teken doesn't support syscons' escape
sequence "ESC [ %d A" for this although that was used here.  I will fix
teken later, but use the more portable ioctl KDSBORDER here.

The ioctl is also much easier to use if you check that it works.  For
-b, check it and complain and exit if it failed, so that it is more
obvious that that vt doesn't support border colors.  Don't check it
when restoring the border color in revert(), since revert() is used
on vt for handling other errors.

Fix nearby error handling and style.  For the error of an invalid
color, revert() and print a specific error message using err() instead
of not revert()ing and printing spam using usage().
2017-08-16 15:14:46 +00:00
Enji Cooper
188e46ab03 Add supporting changes for Add limited sandbox capability to "make check"
Non-tests/... changes:
- Add HAS_TESTS= to Makefiles with libraries and programs to enable iteration
  and propagate the appropriate environment down to *.test.mk.

tests/... changes:
- Add appropriate support Makefile.inc's to set HAS_TESTS in a minimal manner,
  since tests/... is a special subdirectory tree compared to the others.

MFC after:	2 months
MFC with:	r322511
Reviewed by:	arch (silence), testing (silence)
Differential Revision:	D12014
2017-08-14 19:21:37 +00:00
Konstantin Belousov
32cb21c90b Remove confusion in the line explaining syntax of the msr read.
Specify words order in the display.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2017-08-14 11:19:31 +00:00
Vladimir Kondratyev
a9a8884bf9 bthidd(8): Add support for Apple's magic mouse
Note: Mouse's bthidd.conf record should contain vendor and device IDs
to make proper device detection. If it does not contain IDs,
regenerate record with "Query" command of recent bthidcontrol(8).

Submitted by:		Dirk Engling <erdgeist@erdgeist.org>
Reviewed by:		emax
Approved by:		bapt (mentor), gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D3702
2017-08-12 21:23:33 +00:00
Vladimir Kondratyev
6032284eb9 bthidd(8): Add support for vendor_id, product_id and version.
Extend bthidd.conf format to store vendor and product IDs of remote
Bluetooth HID devices to make possible implementation of device
specific quirks inside bthidd(8).
Add support for querying of this information from device's SDP records
with bthidcontrol(8) "Query" command.

Submitted by:		Dirk Engling <erdgeist@erdgeist.org>
Reviewed by:		emax
Approved by:		bapt (mentor), gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D3702
2017-08-12 21:20:51 +00:00
Ed Maste
a230b8a753 bsdinstall: record DHCP config after obtaining lease
Previously we added an ifconfig_$INTERFACE line to rc.conf for each
unsuccessful DCHP attempt.

PR:		219515
Reviewed by:	allanjude
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11967
2017-08-10 20:26:07 +00:00
Alexander Motin
fb1cf2a9e5 Add two NFIT fields missed in r321298.
MFC after:	2 weeks
2017-08-10 10:59:05 +00:00
Jeremie Le Hen
ac0ced90e0 rwho/ruptime/rwhod shouldn't be gated by RCMDS.
As peter@ points out in pr/220953:
"rwho, rwhod and ruptime are not part of the remote login suite (rsh, rlogin
etc).

They should *not* be in the rcmds package which is disabled by default.  We
rely on rwho/rwhod/ruptime in the freebsd.org cluster."

This commit is a re-commit of r322029 and r322031 with a better commit log, as
pointed out by ngie@.

This also includes the necesary changes to OptionalObsoleteFiles.inc, as
requested by jhb@.

PR:		220953
Reported by:	peter@, jhb@
Differential Revision:	https://reviews.freebsd.org/D11743
2017-08-08 20:17:07 +00:00
Jeremie Le Hen
eba789dcca Revert r322029 and r322031 so as to recommit them with a better commit log.
PR:		220953
Reported by:	ngie@
2017-08-08 20:07:08 +00:00
Marius Strobl
eabfbad050 Revert the parts of r322097 related to /etc/wall_cmos_clock handling as
the previous behavior actually is required for setting up configurations
in which the RTC is using UTC but the timezone is not. Still, besides
uniform error handling, that file should get the same treatment in the
non-interactive variants supported by tzsetup(8).
2017-08-07 21:38:10 +00:00
Andriy Voskoboinyk
c69b68f502 rfcomm_pppd.8: fix a typo (SPD -> SDP).
MFC after:	3 days
2017-08-06 21:54:43 +00:00
Marius Strobl
4b38286169 - Move creation and unlinking of /etc/wall_cmos_clock from the handling
of the initial UTC dialog to install_zoneinfo() so that file gets the
  necessary treatment also when that dialog is skipped via "-s", when
  selecting UTC from the time zone menu or on the command-line instead
  etc.
- Make the initial UTC dialog actually work by giving the relevant files
  the necessary treatment and then exit when choosing "Yes" there instead
  of moving on to the time zone menu regardless.
- Since r301131, /etc/localtime is also installed when selecting UTC in
  interactive configurations (which previously meant only via the time
  zone menu, though). Thus, the code added in r230298 which treats a
  NULL zone file name as UTC and removes /etc/localtime in that case can
  go again.
- Consistently refer to "could not delete" (as chosen by the oldest such
  code in here) when unlink(2) fails instead of a to mixture of "delete"
  and "unlink" in error messages.
2017-08-05 12:59:03 +00:00
Konstantin Belousov
e28f262a86 Fix off by one in calculation of the number of buckets for the pc
addresses.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D11864
2017-08-04 18:02:54 +00:00
Enji Cooper
7921075587 MFhead@r322057 2017-08-04 17:41:49 +00:00
Jeremie Le Hen
4542ad8688 Remove deprecation notice for ruptime/rwho/rwhod.
PR:		220953
Reported by:	peter
2017-08-03 21:37:57 +00:00
Jeremie Le Hen
881d286b1d rwho/ruptime/rwhod shouldn't be gated by RCMDS.
PR:		220953
Reported by:	peter@
Differential Revision:	https://reviews.freebsd.org/D11743
2017-08-03 21:30:12 +00:00
Enji Cooper
f2381beb2c MFhead@r322021 2017-08-03 17:43:26 +00:00
Navdeep Parhar
f856f099cb cxgbe(4): Initial import of the "collect" component of Chelsio unified
debug (cudbg) code, hooked up to the main driver via an ioctl.

The ioctl can be used to collect the chip's internal state in a
compressed dump file.  These dumps can be decoded with the "view"
component of cudbg.

Obtained from:	Chelsio Communications
MFC after:	2 months
Sponsored by:	Chelsio Communications
2017-08-03 14:43:30 +00:00
Enji Cooper
86cc58dc96 MFhead@r321960 2017-08-02 22:28:12 +00:00
Enji Cooper
d2435d7c28 Require strings(1) with :o_flag_preparer and :o_flag_publisher
strings(1) might not be installed on the system, e.g., if MK_TOOLCHAIN == no

MFC after:	1 week
2017-08-02 20:42:39 +00:00
Enji Cooper
d511b20a69 Add HAS_TESTS to all Makefiles that are currently using the
`SUBDIR.${MK_TESTS}+= tests` idiom.

This is a follow up to r321912.
2017-08-02 08:50:42 +00:00
Enji Cooper
4b330699f8 Convert traditional ${MK_TESTS} conditional idiom for including test
directories to SUBDIR.${MK_TESTS} idiom

This is being done to pave the way for future work (and homogenity) in
^/projects/make-check-sandbox .

No functional change intended.

MFC after:	1 weeks
2017-08-02 08:35:51 +00:00
Marcelo Araujo
4271417a84 Log when we have finished pushing users and groups.
Obtained from:	OpenBSD (rev 1.4)
MFC after:	3 weeks.
2017-08-01 05:26:20 +00:00
Ed Maste
e39a96781e bsdinstall: default to UEFI-only boot on arm64
Reviewed by:	allanjude
Sponsored by:	The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D11721
2017-07-30 23:15:30 +00:00
Ed Schouten
4f6a15dd39 Be a bit more liberal about sysctl naming.
On the systems on which I tested this exporter, I never ran into metrics
that were named in such a way that they couldn't be exported to
Prometheus metrics directly. Now it turns out that on systems with NUMA,
the sysctl tree contains metrics named dev.${driver}.${index}.%domain.
For these metrics, the % in the name is problematic, as Prometheus
doesn't allow this symbol to be used.

Remove the assertions that were originally put in place to prevent the
exporter from generating malformed output and add code to deal with it
accordingly. For metric names, convert any unsupported character to an
underscore. For label values, perform string escaping.

PR:		https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221035
Reported by:	lifanov@
2017-07-29 08:35:07 +00:00
Jung-uk Kim
5f9b24fa43 Merge ACPICA 20170728. 2017-07-28 22:23:29 +00:00
Ryan Libby
07451638fa bhyve/vga.c: fix atc_color_select_67 bit shift
Gcc noticed that the result of the bit shift is always zero.  Shift so
that the ATC_CS_C67 bits end up in bits 6 & 7.

Reviewed by:	grehan, tychon
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D11775
2017-07-28 21:47:10 +00:00
Ryan Libby
558e4950b3 bhyve/pci_e82545.c: squelch gcc warning for noreturn procedure
Gcc complained that e82545_tx_thread has a return type declared but
doesn't return anything.  Annotate the procedure with _Noreturn.

Reviewed by:	grehan
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D11774
2017-07-28 21:42:59 +00:00
Sean Bruno
4b5e2f8ea0 binmiscctl should use modfind instead of kldfind
kldfind() only matches kernel modules, so if you link imgact_binmisc directly
into the kernel, binmiscctl can't find it, tries to load it, and errors
out with:
  Can't load imgact_binmisc kernel module: File exists

A quick search of other base commands shows that the correct procedure is to
call modfind(), and then try kldload() if that fails.

PR:		218593
Submitted by:	Dan Nelson <dnelson_1901@yahoo.com>
MFC after:	1 week
2017-07-28 18:11:53 +00:00
Scott Long
99cc4d5177 Fix some broken logic used in obtaining the certain config pages. I'm
surprised that this even pretended to work.

PR:		215793
Submitted by:	longwitz@incore.de
2017-07-27 05:31:48 +00:00
Bartek Rutkowski
391aafd7ab Remove stack guard option from hardening menu.
Since kib's change the stack guard is now ON by default,
this option in hardening menu of bsdinstall is no longer needed.

Submitted by:	Bartlomiej Rutkowski <robak@FreeBSD.org>
Reviewed by:	bapt
Approved by:	bapt
MFC after:	1 day
Sponsored by:	Pixeware LTD
Differential Revision:	https://reviews.freebsd.org/D11686
2017-07-21 08:50:22 +00:00
Ed Maste
cebb7b191c acpidump: add GIC ITS srat type
From ACPI 6.2, 5.2.16.5

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2017-07-20 17:36:17 +00:00
Ed Maste
340c00225f acpidump: add ACPI NFIT (NVDIMM Firmware Interface Table)
Submitted by:	Guangyuan Yang <yzgyyang@outlook.com>
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11479
2017-07-20 17:31:27 +00:00
Ed Maste
27941afae6 acpidump: use C99 designated initializers
Submitted by:	Guangyuan Yang <yzgyyang@outlook.com>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11659
2017-07-20 15:52:36 +00:00
Enji Cooper
b024603382 Clean up leading whitespace (convert single column spaces to hard tabs)
MFC after:	now
2017-07-20 00:40:03 +00:00
Rick Macklem
6242e8c886 Update the nfsv4 man page to reflect recent changes to support
the newer RFCs (5661 and 7530). The main man changes are for the
case of "numbers in strings" for user/groups that RFC7530 allows
and avoids use of nfsuserd(8).

This is a content change.

Reviewed by:	trasz (earlier version)
MFC after:	1 week
2017-07-19 20:57:41 +00:00
Enji Cooper
d7938e0594 cron(8) manpage updates
- Document /etc/cron.d and /usr/local/etc/cron.d under FILES.
- Reword documentation for -n: add appropriate soft-stop and remove
  contraction to appease igor.

MFC after:	3 days
2017-07-19 19:53:07 +00:00
Enji Cooper
4555b2ad92 Fix trivial whitespace bug introduced in usage message changes for -n
support (r304570).

MFC after:	now
2017-07-19 19:38:25 +00:00
Mark Johnston
5a3924b985 Allow matches of truncated version strings.
Long objdir paths make it easy to hit the version string length limit in
kernel dump headers. The build number and timestamp are unlikely to be
truncated and ought to be sufficient to protect against false positives.

Discussed with:	jhb
MFC after:	1 week
2017-07-19 18:41:16 +00:00
Ed Maste
2775c1d7d5 bsdinstall: improve checksum mismatch error for snapshots
The usual case of a mismatched checksum for installer snapshots
(e.g., -CURRENT, -ALPHA*) is that a newer snapshot has been built and
the old install sets have been replaced.  Provide a specific error
message for checksum mismatches there that suggests looking for a newer
snapshot.

Submitted by:	Guangyuan Yang <yzgyyang@outlook.com>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11641
2017-07-19 18:25:52 +00:00
Ed Maste
9acc904146 bsdinstall: remove EOL whitespace 2017-07-18 23:35:19 +00:00
Navdeep Parhar
8f82718fb2 cxgbetool(8): Add loadboot and loadboot-cfg subcommands to install or
remove bootrom and boot config.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-07-18 03:58:59 +00:00
Benedict Reuschling
4718651cb3 The ctladm man page incorrectly duplicated the text for the
delete subcommand in the modify section. Rewrite the
modify description text in two places to say modify/modified
instead of remove/removed.

PR:		220710
Submitted by:	sseekamp@risei.net
Reviewed by:	mav@
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D11608
2017-07-15 17:59:28 +00:00
Bryan Drewery
7c2f06da87 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-07-10 23:52:04 +00:00
Rick Macklem
3ab05e8674 Document the changes done to nfsuserd by r320757.
This is a content change.
2017-07-06 22:34:34 +00:00
Rick Macklem
77193c0508 Modify the nfsuserd daemon so that it uses an AF_LOCAL socket for upcalls.
This patch modifies the nfsuserd daemon so that it uses an AF_LOCAL socket
for upcalls by default. This should fix the problem with using a UDP
socket upcall to 127.0.0.1 when jails are used.
The AF_LOCAL socket case only supports a single server daemon, since hangs
were observed by the original problem reporter when multiple daemons
were used.
The patch adds a command line option called "-use-udpsock" which makes
the daemon revert to its prepatched behaviour.

Suggested by:	dfr
PR:		205193
Relnotes:	yes
2017-07-06 22:04:37 +00:00
Ed Maste
f5d0a8f7c7 acpidump: warn and exit loop on invalid subtable length
Submitted by:	Guangyuan Yang <yzgyyang@outlook.com>
Sponsored by:	The FreeBSD Foundation
2017-07-06 14:35:47 +00:00
Bartek Rutkowski
2669f7ebf1 usr.sbin/bsdinstall/scripts/hardening: fix options numbers
Submitted by:	Bartek Rutkowski <robak@FreeBSD.org>
Reviewed by:	bapt
Approved by:	bapt
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D11505
2017-07-06 12:19:15 +00:00
Alexander Motin
321728cef1 Report device descr in addition to ident.
Serial number without device model is somewhat less useful.

MFC after:	2 weeks
2017-07-06 09:05:38 +00:00
Enji Cooper
01df7d10a5 Remove SUBDIR ordering/uniquifying in *bin/Makefile
After the addition of SUBDIR.yes, uniquifying/ordering the SUBDIRs doesn't
make a whole lot of sense, and it's in effect a half measure.

Ordering SUBDIR (after adding SUBDIR.yes to it) in bsd.subdir.mk is a
separate change that warrants more discussion/testing, because while
the SUBDIR_PARALLEL work largely fixed dependency ordering for SUBDIRs,
there might be downstream FreeBSD consumers that rely on the SUBDIR
ordering.

MFC after:	2 months
Reviewed by:	bdrewery
Differential Revision:	D11398
2017-07-06 04:15:30 +00:00
Alexander Motin
1a01f934bf Add naive benchmark for SSDs in ZFS SLOG role.
ZFS SLOGs have very specific access pattern with many cache flushes,
which none of benchmarks I know can simulate.  Since SSD vendors rarely
specify cache flush time, this measurement can be useful to explain why
some ZFS pools are slower then expected.  This test writes data chunks
of different size followed by cache flush, alike to what ZFS SLOG does,
and measures average time.

To illustrate, here is result for 6 years old SATA Intel 710 Series SSD:

Synchronous random writes:
         0.5 kbytes:    138.3 usec/IO =      3.5 Mbytes/s
           1 kbytes:    137.7 usec/IO =      7.1 Mbytes/s
           2 kbytes:    151.1 usec/IO =     12.9 Mbytes/s
           4 kbytes:    158.2 usec/IO =     24.7 Mbytes/s
           8 kbytes:    175.6 usec/IO =     44.5 Mbytes/s
          16 kbytes:    210.1 usec/IO =     74.4 Mbytes/s
          32 kbytes:    274.2 usec/IO =    114.0 Mbytes/s
          64 kbytes:    416.5 usec/IO =    150.1 Mbytes/s
         128 kbytes:    776.6 usec/IO =    161.0 Mbytes/s
         256 kbytes:   1503.1 usec/IO =    166.3 Mbytes/s
         512 kbytes:   2968.7 usec/IO =    168.4 Mbytes/s
        1024 kbytes:   5866.8 usec/IO =    170.5 Mbytes/s
        2048 kbytes:  11696.6 usec/IO =    171.0 Mbytes/s
        4096 kbytes:  23329.6 usec/IO =    171.5 Mbytes/s
        8192 kbytes:  46779.5 usec/IO =    171.0 Mbytes/s

, and much newer and supposedly much faster NVMe Samsung 950 PRO SSD:

Synchronous random writes:
         0.5 kbytes:   2092.9 usec/IO =      0.2 Mbytes/s
           1 kbytes:   2013.1 usec/IO =      0.5 Mbytes/s
           2 kbytes:   2014.8 usec/IO =      1.0 Mbytes/s
           4 kbytes:   2090.7 usec/IO =      1.9 Mbytes/s
           8 kbytes:   2044.5 usec/IO =      3.8 Mbytes/s
          16 kbytes:   2084.8 usec/IO =      7.5 Mbytes/s
          32 kbytes:   2137.1 usec/IO =     14.6 Mbytes/s
          64 kbytes:   2173.4 usec/IO =     28.8 Mbytes/s
         128 kbytes:   2923.9 usec/IO =     42.8 Mbytes/s
         256 kbytes:   3085.3 usec/IO =     81.0 Mbytes/s
         512 kbytes:   3112.2 usec/IO =    160.7 Mbytes/s
        1024 kbytes:   2430.6 usec/IO =    411.4 Mbytes/s
        2048 kbytes:   3788.9 usec/IO =    527.9 Mbytes/s
        4096 kbytes:   6198.0 usec/IO =    645.4 Mbytes/s
        8192 kbytes:  10764.9 usec/IO =    743.2 Mbytes/s

While the first one obviously has maximal throughput limitations, the
second one has so high cache flush latency (about 2 millisecond), that
it makes one almost useless in SLOG role, despite of its good throughput
numbers.  Power loss protection is out of scope of this test, but I
suspect it can be related.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2017-07-05 16:20:22 +00:00
Bartek Rutkowski
82ec242f2e Add option to bsdinstall to disable insecure console, update stack guard option
This patch adds new bsdinstall option to hardening section that allows users
to change this behaviour to secure one and updates stack guard option so it
would set the value of relevant sysctl to 512 (2MB)

Submitted by:	Bartek Rutkowski
Reviewed by:	adrian, bapt, emaste
Approved by:	bapt, emaste
MFC after:	1 day
Sponsored by:	Pixeware LTD
Differential Revision:	https://reviews.freebsd.org/D9700
2017-07-05 13:37:27 +00:00
Rick Macklem
2ced567240 Add a Bugs section that indicates that the nfsuserd doesn't work
when jails are being used on the system.
It is hoped that the patches in PR#205193 will someday get tested/debugged
so that they can be committed to fix this.

This is a content change.

PR:		205193
MFC after:	2 weeks
2017-07-04 22:20:30 +00:00
Allan Jude
1f3f7ac7ba Add deprecation notices for all rcmd tools
Submitted by:	bcr
Reviewed by:	emaste, bapt, jhl
MFC after:	immediate
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D11471
2017-07-04 15:44:30 +00:00
Allan Jude
875a1f776c diskinfo(8): correct typo in man page
Reported by:	N.J. Mann <njm@njm.me.uk>
2017-07-02 16:20:49 +00:00
Allan Jude
278a04f5c8 Add -s (serial) and -p (physpath) to diskinfo
Return the bare requested information, intended for scripting.

The serial number of a SAS/SCSI device can be returned with
'camcontrol inquiry disk -S', but there is no similar switch for SATA.

This provides a way to get this information from both SAS and SATA disks

the -s and -p flags are mutually exclusive, and cannot be used with any
other flags.

Reviewed by:	rpokala, wblock
MFC after:	1 month
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D7828
2017-07-01 21:34:57 +00:00
Baptiste Daroussin
d25c1ff64f Add libxo(3) support to sesutil(8)
This is useful to simplify parsing "sesutil map"

Submitted by:	nikita.kozlov@blade-group.com
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	blade
2017-06-29 18:52:36 +00:00
Steve Wills
d8061eff49 Add hardening menu item for security.bsd.see_jail_proc
Approved by:		allanjude
Differential Revision:	https://reviews.freebsd.org/D11283
2017-06-29 16:39:55 +00:00
Xin LI
97e832c1da Chase malloc() change by removing lg_chunk malloc_conf settings.
In jemalloc 5, there are no longer chunks, and as configured on
FreeBSD (the "retain" option defaults to false), the mmap()
requests are precisely sized for the specific needs, which means
the virtual memory overhead should be lower for small applications.

Reviewed by:	jasone, ian
Differential Revision:	https://reviews.freebsd.org/D11366
2017-06-28 04:19:54 +00:00
Ed Maste
0661ef2af2 makefs: add copies of NetBSD makefs msdos source files
We do not treat makefs as contrib code.  Import copies of makefs msdos
files from NetBSD so that we can track our changes to these files.

These are copied from NetBSD, with only a change to use __FBSDID and
$FreeBSD$ instead of __KERNEL_RCSID and $NetBSD$.  A copy of the
original $NetBSD$ tag remains in each source file.

These two files were missed in r320212.  Also remove a stray blank line
added in msdosfs_vfsops.c.

Submitted by:	Siva Mahadevan
Sponsored by:	The FreeBSD Foundation
2017-06-23 18:58:28 +00:00