dragonfly.git
6 years agodrm/i915: Backport fix for a bad bitmask.
zrj [Sat, 20 Jan 2018 19:32:42 +0000 (21:32 +0200)]
drm/i915: Backport fix for a bad bitmask.

No-op, we explictly disable stolen memory in i915_gem_init_stolen().

6 years agocpdup - Additional fixes for -X absolute_path
Matthew Dillon [Sun, 21 Jan 2018 06:51:38 +0000 (22:51 -0800)]
cpdup - Additional fixes for -X absolute_path

* When an absolute path is specified the file is connsidered
  to be local to the machine and is not opened on a remote
  source.

6 years agohammer2 - Correct ip->cluster.nchains gap filler
Matthew Dillon [Sun, 21 Jan 2018 05:51:48 +0000 (21:51 -0800)]
hammer2 - Correct ip->cluster.nchains gap filler

* Fix a bug where gaps in the cluster array were not being
  properly filled.  This is only applicable to clusters
  consisting of more than one element, which we do not
  officially support yet.

Reported-by: zrj (gcc80 found it)
6 years agocpdup - Enhance -X operation
Matthew Dillon [Sun, 21 Jan 2018 05:47:01 +0000 (21:47 -0800)]
cpdup - Enhance -X operation

* Enhance -X operation.  When the cpignore file is specified as an
  absolute path, it may contain wildcards which match against the
  concatenated source path and directory element (as specified in the
  source), instead of just match against directory elements.

* Thus an absolute cpignore file may contain full paths and wildcards.
  For example, if you:

  cpdup -X $cwd/mycpignore /tmp /fubar

  And $cwd/mycpignore (specified with an absolute path) contains:

      /tmp/xyz/swap*

  Then cpdup will not copy files that match against /tmp/xyz/swap*.

  If you specify a relative path for the cpignore file, or use the
  -x option (instead of -X cpignorefile), operation remains as before
  and only matches against the directory element.

6 years ago{bs,quiz}(6): Compare pointers with NULL, not '\0'.
Sascha Wildner [Sat, 20 Jan 2018 23:22:27 +0000 (00:22 +0100)]
{bs,quiz}(6): Compare pointers with NULL, not '\0'.

6 years agodrm/radeon: Disable few unused const arrays.
zrj [Sat, 20 Jan 2018 17:26:41 +0000 (19:26 +0200)]
drm/radeon: Disable few unused const arrays.

No functional change.

6 years agoLINT64: Cleanup for -Wunused-const-variable.
zrj [Sat, 20 Jan 2018 17:22:13 +0000 (19:22 +0200)]
LINT64: Cleanup for -Wunused-const-variable.

6 years agosound/hda: Disable hdac_pcie_snoop struct.
zrj [Sat, 20 Jan 2018 17:17:25 +0000 (19:17 +0200)]
sound/hda: Disable hdac_pcie_snoop struct.

It is currently unused.

6 years agokernel/mpt: Fix evaluation of args in macro.
zrj [Sat, 20 Jan 2018 17:15:45 +0000 (19:15 +0200)]
kernel/mpt: Fix evaluation of args in macro.

6 years agokernel/ncr: Remove unused variable.
zrj [Sat, 20 Jan 2018 17:08:09 +0000 (19:08 +0200)]
kernel/ncr: Remove unused variable.

6 years agokernel/isp: Minor cleanup.
zrj [Sat, 20 Jan 2018 17:06:01 +0000 (19:06 +0200)]
kernel/isp: Minor cleanup.

Remove unused string and use 'rqo' only if ISP_TARGET_MODE.

6 years ago<sys/ktr.h>: Use empty macros for non KTR case.
zrj [Sat, 20 Jan 2018 16:59:46 +0000 (18:59 +0200)]
<sys/ktr.h>: Use empty macros for non KTR case.

Cleans up the gcc80 -Wunused-const-variable warnings.

6 years agokernel/pf: Remove an unused variable.
Sascha Wildner [Sat, 20 Jan 2018 18:58:51 +0000 (19:58 +0100)]
kernel/pf: Remove an unused variable.

6 years agoterminfo: Add xterm-termite to Makefile.entries
Markus Pfeiffer [Sat, 20 Jan 2018 13:59:53 +0000 (13:59 +0000)]
terminfo: Add xterm-termite to Makefile.entries

6 years agotermcap: Add xterm-termite
Markus Pfeiffer [Sat, 20 Jan 2018 11:58:18 +0000 (11:58 +0000)]
termcap: Add xterm-termite

6 years agodrm/linux: Improve linux/log2.h
zrj [Sat, 20 Jan 2018 10:29:06 +0000 (12:29 +0200)]
drm/linux: Improve linux/log2.h

With newer GCC compilers it is no longer possible to easily detect bad
cases of ilog2() usage in drm shim, see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785

There is just a single use case of this macro in drm/radeon/radeon_device.c
for radeon_vm_size, it is already checked to be positive 2^N small number.
So simplify macro and just return 0 for n < 2.

While there, adjust logic to use proper fls(3) and flsll(3) functions
based on integer size (previously both cases where calling flsl(3)).

6 years agoFix few typos.
zrj [Sat, 20 Jan 2018 09:17:16 +0000 (11:17 +0200)]
Fix few typos.

Spotted-by: swildner
6 years agolimits(1): Add missing 'break'.
Sascha Wildner [Sat, 20 Jan 2018 10:48:46 +0000 (11:48 +0100)]
limits(1): Add missing 'break'.

6 years agoktrdump(8): Fix wrongly placed 'break' for floating point unpacking.
Sascha Wildner [Sat, 20 Jan 2018 10:37:04 +0000 (11:37 +0100)]
ktrdump(8): Fix wrongly placed 'break' for floating point unpacking.

6 years agogzip(1): Add some __attribute__((__noreturn__)).
Sascha Wildner [Sat, 20 Jan 2018 10:28:22 +0000 (11:28 +0100)]
gzip(1): Add some __attribute__((__noreturn__)).

6 years agopam_exec(8): Raise WARNS to 3.
Sascha Wildner [Sat, 20 Jan 2018 09:05:45 +0000 (10:05 +0100)]
pam_exec(8): Raise WARNS to 3.

6 years agofsdb(8): Fix some -Wformat warnings and raise WARNS to 2.
Sascha Wildner [Sat, 20 Jan 2018 08:37:51 +0000 (09:37 +0100)]
fsdb(8): Fix some -Wformat warnings and raise WARNS to 2.

6 years agoumount(8): Add missing braces.
Sascha Wildner [Sat, 20 Jan 2018 08:07:57 +0000 (09:07 +0100)]
umount(8): Add missing braces.

6 years agomfiutil(8): Remove -fno-builtin-strftime from CFLAGS.
Sascha Wildner [Fri, 19 Jan 2018 19:13:06 +0000 (20:13 +0100)]
mfiutil(8): Remove -fno-builtin-strftime from CFLAGS.

We don't need this.

6 years agoProvide __{printf,scanf,strfmon,strftime}like() for builtin functions too.
Sascha Wildner [Fri, 19 Jan 2018 19:11:33 +0000 (20:11 +0100)]
Provide __{printf,scanf,strfmon,strftime}like() for builtin functions too.

We want our formats checked in -fno-builtin builds as well.

6 years agobsd.sys.mk: Set -Werror only for compilers that have the warnings fixed.
Sascha Wildner [Fri, 19 Jan 2018 12:23:47 +0000 (13:23 +0100)]
bsd.sys.mk: Set -Werror only for compilers that have the warnings fixed.

This reverts part of b399af1115fa4d2d29e5b5e59eb3a5c3087dccda.

6 years agobsd.{sys,kern}.mk: Apply warning restrictions for future GCCs.
Sascha Wildner [Mon, 31 Jul 2017 19:28:21 +0000 (21:28 +0200)]
bsd.{sys,kern}.mk: Apply warning restrictions for future GCCs.

6 years agoAdd __attribute__((__noreturn__)) to a number of usage() like functions.
Sascha Wildner [Fri, 19 Jan 2018 10:16:52 +0000 (11:16 +0100)]
Add __attribute__((__noreturn__)) to a number of usage() like functions.

These were not caught in the -Wsuggest-attribute=noreturn cleanup
because they were already static at that point. There are likely
more such cases but I don't know how to find them systematically.

6 years agoed(1): Add three __attribute__((__noreturn__)).
Sascha Wildner [Fri, 19 Jan 2018 09:19:26 +0000 (10:19 +0100)]
ed(1): Add three __attribute__((__noreturn__)).

I had missed them in a31274954f5c10e5a80969dcfc719d665f36a26c.

6 years agopfctl(8): Fix two wrong conditions.
Sascha Wildner [Fri, 19 Jan 2018 09:09:09 +0000 (10:09 +0100)]
pfctl(8): Fix two wrong conditions.

Caught by gcc80's -Wtautological-compare option.

6 years agolibthread_xu: Fix issues detected by gcc80.
Sascha Wildner [Fri, 19 Jan 2018 08:55:59 +0000 (09:55 +0100)]
libthread_xu: Fix issues detected by gcc80.

The changes to <pthread.h> all deal with -Wnonnull-compare warnings,
which are issued when a function has a NULL check for a parameter that
at the same time is marked with __attribute__((nonnull(...))), aka
__nonnull(...).

Such __nonnull() decoration only ever catches those cases where NULL is
passed directly to the function, but not any more indirect ways. What
makes matters worse is that in higher optimization levels (-O >= 2),
GCC will happily optimize out any NULL checks within the function for
these parameters.

This means that __nonnull() is generally inferior to a direct NULL check
in the function itself and if we have both, which newer GCCs warn about
with -Wnonnull-compare (that is part of -Wall), we should remove the
__nonnull().

This commit does that for all parameters which our libthread_xu checks
directly in the function. What remains are __nonnull() for parameters
which are _not_ checked in the functions, to at least catch cases where
NULL is passed directly. We should think about adding real checks for
those parameters too.

While here, add a "/* FALLTHROUGH */" comment in thr_printf.c which
fixes a -Wimplicit-fallthrough warning.

6 years agomfiutil(8): Use MAN instead of MAN8.
Sascha Wildner [Thu, 18 Jan 2018 17:34:30 +0000 (18:34 +0100)]
mfiutil(8): Use MAN instead of MAN8.

6 years agoRevert "bsd.sys.mk: support -Wunused-local-typedef"
Sascha Wildner [Thu, 18 Jan 2018 13:35:43 +0000 (14:35 +0100)]
Revert "bsd.sys.mk: support -Wunused-local-typedef"

This reverts commit 14683bdb9c1d41c0d62dc7d11f3fd535973ad258.

It is no longer needed after 6954d52dca31dc7773729c0bf92e14fb1dab5aae.

6 years agogcc50: Move out manpage version handling.
zrj [Thu, 18 Jan 2018 05:27:51 +0000 (07:27 +0200)]
gcc50: Move out manpage version handling.

The Makefile.cco should only affect global ones.

6 years agogcc47: Move out manpage version handling.
zrj [Thu, 18 Jan 2018 05:26:06 +0000 (07:26 +0200)]
gcc47: Move out manpage version handling.

The Makefile.cco should only affect global ones.

6 years agocorepower - Add kabylake support
Matthew Dillon [Wed, 17 Jan 2018 21:30:57 +0000 (13:30 -0800)]
corepower - Add kabylake support

* Add kabylake support (just the id needed)

6 years agoetc/remote: Fix ucom[234].
Sascha Wildner [Wed, 17 Jan 2018 12:30:12 +0000 (13:30 +0100)]
etc/remote: Fix ucom[234].

6 years agokernel/evdev: Whitespace correction in input-event-codes.h
Peeter Must [Wed, 17 Jan 2018 09:32:13 +0000 (11:32 +0200)]
kernel/evdev: Whitespace correction in input-event-codes.h

6 years agokernel/evdev: Update input-event-codes.h
Peeter Must [Wed, 17 Jan 2018 08:48:52 +0000 (10:48 +0200)]
kernel/evdev: Update input-event-codes.h

Taken-from: Linux

6 years agoipfw: Add icmpcodes support.
Sepherosa Ziehau [Tue, 16 Jan 2018 05:07:14 +0000 (13:07 +0800)]
ipfw: Add icmpcodes support.

6 years agokernel - Fix busdma allocation bug
Matthew Dillon [Tue, 16 Jan 2018 00:42:00 +0000 (16:42 -0800)]
kernel - Fix busdma allocation bug

* Fix a bug where kmalloc() could be used to allocate DMA memory
  that the caller intends to be non-cacheable.

  If a non-cacheable tag is specified, bus_dma now uses contigmalloc.

* Use the bus_dmamap_t pointer to differentiate between kmalloc
  and contigmalloc allocated memory, instead of running tag tests.

  This is a bit of a hack, but its the easiest solution.

6 years agokernel - xhci cleanup, lock attach
Matthew Dillon [Tue, 16 Jan 2018 00:40:31 +0000 (16:40 -0800)]
kernel - xhci cleanup, lock attach

* Lock xhci during attach to avoid spurious interrupts from
  hitting the interrupt routine too early.

* Install interrupt after controller startup, but before
  the main usb code begins querying it.

* Cleanup syntax

6 years agokernel - Add a global priority hack for ACPI
Matthew Dillon [Tue, 16 Jan 2018 00:37:35 +0000 (16:37 -0800)]
kernel - Add a global priority hack for ACPI

* Allows ACPI to fully probe and attach all acpi devices before
  attaching any non-ACPI devices.

* May improve device attach stability.

* Currently only implemented at the top-level of the acpi
  device tree.

6 years agokernel - Handle ig4 controller startup errors
Matthew Dillon [Tue, 16 Jan 2018 00:34:06 +0000 (16:34 -0800)]
kernel - Handle ig4 controller startup errors

* Fail the attach on controller startup errors.  For some reason the
  dell xps 13 says there's I2C controller, but the controller appears
  to be permanente disabled and will refuse to enable.

6 years agocpucontrol - Add amd10h support
Matthew Dillon [Tue, 16 Jan 2018 00:28:21 +0000 (16:28 -0800)]
cpucontrol - Add amd10h support

* Add support for ryzen and later microcodes.

* Adds general support for AMD microcodes in their
  packed format.  No need to unpack AMD microcode any
  more, cpucontrol will parse the distribution file
  from AMD.

Taken-from: FreeBSD

6 years agokernel: Add acpi and a number of related drivers to our default config.
Sascha Wildner [Mon, 15 Jan 2018 18:43:39 +0000 (19:43 +0100)]
kernel: Add acpi and a number of related drivers to our default config.

These are: gpio_acpi, gpio_intel, smbus and smbacpi. Leave
ichiic (aka ig4) commented out for now because it seems to have
issues with latest generation Intel CPUs.

Adjust the manual page a bit and remove an obsolete comment in LINT64.

In-discussion-with: dillon, ivadasz

6 years agosbin/mount_autofs: Change include path from fs/ to vfs/
Tomohiro Kusumi [Mon, 15 Jan 2018 17:23:55 +0000 (19:23 +0200)]
sbin/mount_autofs: Change include path from fs/ to vfs/

/usr/include/fs seems to exist as a symlink to vfs/,
but change include path to vfs.

6 years agosbin/mount_autofs: Port mount_autofs(8) from NetBSD
Tomohiro Kusumi [Mon, 15 Jan 2018 15:37:53 +0000 (17:37 +0200)]
sbin/mount_autofs: Port mount_autofs(8) from NetBSD

Christos added this to NetBSD, so why not for DragonFly.
One will write something simlar to this when porting autofs,
until autofs(5)/automount(8)/automountd(8) become usable enough.

While I try to minimize diff from FreeBSD for autofs userspace
by not making trivial style fixes, new things from NetBSD are
appreciated.

-o getargs support is dropped since unsupported on DragonFly.

6 years agokernel/ath_hal: Add missing header to fix build with -Wundef.
Sascha Wildner [Mon, 15 Jan 2018 10:04:15 +0000 (11:04 +0100)]
kernel/ath_hal: Add missing header to fix build with -Wundef.

6 years agokernel/my: Fix -Wundef.
Sascha Wildner [Mon, 15 Jan 2018 09:58:10 +0000 (10:58 +0100)]
kernel/my: Fix -Wundef.

6 years agos/NO_MAN/NOMAN/ in various Makefiles.
Sascha Wildner [Mon, 15 Jan 2018 08:42:53 +0000 (09:42 +0100)]
s/NO_MAN/NOMAN/ in various Makefiles.

6 years agoSimplify some Makefiles.
Sascha Wildner [Mon, 15 Jan 2018 08:31:30 +0000 (09:31 +0100)]
Simplify some Makefiles.

If there is just one source file that is named ${PROG}.c, SRCS does
not need to be set.

6 years agoRemove test/dsched*. This doesn't build anymore after 3573cf7bf66147.
Sascha Wildner [Mon, 15 Jan 2018 07:55:34 +0000 (08:55 +0100)]
Remove test/dsched*. This doesn't build anymore after 3573cf7bf66147.

6 years agoUpdate the pciconf(8) database.
Sascha Wildner [Mon, 15 Jan 2018 06:56:04 +0000 (07:56 +0100)]
Update the pciconf(8) database.

January 14, 2018 snapshot from http://pciids.sourceforge.net/

6 years agosys/vfs/autofs: prevent assert on unmount.
Tomohiro Kusumi [Sun, 14 Jan 2018 14:14:46 +0000 (16:14 +0200)]
sys/vfs/autofs: prevent assert on unmount.

Bring in below commit from NetBSD/autofs. This hasn't existed in
FreeBSD and DragonFly. This at least avoids potential panic via
assertion failure on unmount like PR 3062. Note that the assertion
in autofs_node_delete() is good. There might be mkdir related bug.

The GitHub link below may not be a valid URL in the future.

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/fs/autofs/autofs_vfsops.c.diff?r1=1.2&r2=1.3
(https://github.com/NetBSD/src/commit/59fdd9b6d94c045e89f22f06c9a6f6d6c0fd60f2)

6 years agokernel: Fix some -Wundef warnings in oce(4) and mps(4).
Sascha Wildner [Sat, 13 Jan 2018 22:37:38 +0000 (23:37 +0100)]
kernel: Fix some -Wundef warnings in oce(4) and mps(4).

__FreeBSD_version is not defined in DragonFly, so make it clearer
which path we take.

6 years agosyscons - Skip drawing of the border, when switching to a graphics vty.
Imre Vadász [Sat, 13 Jan 2018 20:37:40 +0000 (21:37 +0100)]
syscons - Skip drawing of the border, when switching to a graphics vty.

* When the target vty in a vty switch is in graphics mode, and we have
  a dumb framebuffer (sc->fbi != NULL), we definitely don't need to
  call sc_set_border().

6 years agosyscons - Use COL and ROW #define constants.
Imre Vadász [Sat, 13 Jan 2018 20:11:40 +0000 (21:11 +0100)]
syscons - Use COL and ROW #define constants.

6 years agoAdd __attribute__((__noreturn__)) to various function prototypes in usr.sbin/.
Sascha Wildner [Sat, 13 Jan 2018 20:37:56 +0000 (21:37 +0100)]
Add __attribute__((__noreturn__)) to various function prototypes in usr.sbin/.

This general cleanup is useful in various ways. It helps the compiler
optimize better and it also helps later GCCs detect better when to give
-Wimplicit-fallthrough warnings and when not.

Found-with: -Wsuggest-attribute=noreturn

6 years agoftp-proxy(8): exit_daemon() never returns, do do not pretend it does.
Sascha Wildner [Fri, 12 Jan 2018 14:02:59 +0000 (15:02 +0100)]
ftp-proxy(8): exit_daemon() never returns, do do not pretend it does.

6 years agodntpd(8): client_main() never returns, so do not pretend it does.
Sascha Wildner [Thu, 11 Jan 2018 10:19:17 +0000 (11:19 +0100)]
dntpd(8): client_main() never returns, so do not pretend it does.

6 years agoautofs: main_auto{,un}mountd() never return, so do not pretend they do.
Sascha Wildner [Wed, 10 Jan 2018 08:09:12 +0000 (09:09 +0100)]
autofs: main_auto{,un}mountd() never return, so do not pretend they do.

6 years agowatchdogd(8): Staticize.
Sascha Wildner [Sat, 13 Jan 2018 12:28:22 +0000 (13:28 +0100)]
watchdogd(8): Staticize.

6 years agotraceroute6(8): Staticize and remove unused variables/functions.
Sascha Wildner [Sat, 13 Jan 2018 12:25:43 +0000 (13:25 +0100)]
traceroute6(8): Staticize and remove unused variables/functions.

6 years agotraceroute(8): Staticize.
Sascha Wildner [Sat, 13 Jan 2018 12:20:06 +0000 (13:20 +0100)]
traceroute(8): Staticize.

6 years agotimed(8): slave() never returns, so don't pretend it does.
Sascha Wildner [Sat, 13 Jan 2018 12:10:47 +0000 (13:10 +0100)]
timed(8): slave() never returns, so don't pretend it does.

6 years agotimed(8): master() never returns, so don't pretend it does.
Sascha Wildner [Sat, 13 Jan 2018 12:08:16 +0000 (13:08 +0100)]
timed(8): master() never returns, so don't pretend it does.

6 years agosensorsd(8): Staticize.
Sascha Wildner [Sat, 13 Jan 2018 11:37:07 +0000 (12:37 +0100)]
sensorsd(8): Staticize.

6 years agorwhod(8): Staticize.
Sascha Wildner [Sat, 13 Jan 2018 11:33:10 +0000 (12:33 +0100)]
rwhod(8): Staticize.

6 years agoroute6d(8): Staticize and remove unused variables/functions.
Sascha Wildner [Sat, 13 Jan 2018 10:35:54 +0000 (11:35 +0100)]
route6d(8): Staticize and remove unused variables/functions.

While here, use __printflike(), fix a va_end() after exit() case and
print strerror() in fatal() only if errno is actually set (this last
one was taken from FreeBSD).

6 years agomld6query(8): Staticize and raise WARNS to 6.
Sascha Wildner [Sat, 13 Jan 2018 09:57:06 +0000 (10:57 +0100)]
mld6query(8): Staticize and raise WARNS to 6.

6 years agomld6query(8): Rename mld6.c -> mld6query.c
Sascha Wildner [Sat, 13 Jan 2018 09:53:53 +0000 (10:53 +0100)]
mld6query(8): Rename mld6.c -> mld6query.c

6 years agogifconfig(8): Staticize and remove some unused variables.
Sascha Wildner [Sat, 13 Jan 2018 09:26:23 +0000 (10:26 +0100)]
gifconfig(8): Staticize and remove some unused variables.

6 years agousr.sbin/autofs: Make automount(8) call chdir("/") before create_directory()
Tomohiro Kusumi [Fri, 12 Jan 2018 19:46:53 +0000 (21:46 +0200)]
usr.sbin/autofs: Make automount(8) call chdir("/") before create_directory()

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224601

Unlike automountd where the daemon is daemonized or lesser-daemonized,
an automount process isn't necessarily at /, and this results in
creating unneeded directories at the current directory.

In the example below, mounting autofs on /mnt/media fails because the
command mkdirs mnt/media instead of /mnt/media. If /mnt/media already
exists the command can mount autofs on /mnt/media, but it still mkdirs
unneeded directories mnt/media.

Calling chdir("/") before creation and restoring the directory after
creation avoids this.

--
[root@]~# automount -L
/mnt/media                -nosuid               -media               # indirect map referenced at /etc/auto_master:8
[root@]~# ls mnt
ls: mnt: No such file or directory
[root@]~# automount
automount: cannot mount map -media on /mnt/media: No such file or directory
[root@]~# mount | grep autofs
[root@]~# ls mnt
media
[root@]~# tree mnt
mnt
`-- media

6 years agobsd-family-tree: Sync yet again with FreeBSD.
Sascha Wildner [Fri, 12 Jan 2018 12:59:06 +0000 (13:59 +0100)]
bsd-family-tree: Sync yet again with FreeBSD.

6 years agosys/vfs/autofs: Cleanup autofs_mount()
Tomohiro Kusumi [Thu, 11 Jan 2018 21:19:20 +0000 (23:19 +0200)]
sys/vfs/autofs: Cleanup autofs_mount()

Drop unneeded local char[MAXPATHLEN] variable.
Bring in comments I've added to NetBSD/autofs for better readability.

6 years agokernel - Implement spectre mitigations part 4 (cleanup)
Matthew Dillon [Thu, 11 Jan 2018 20:50:31 +0000 (12:50 -0800)]
kernel - Implement spectre mitigations part 4 (cleanup)

* Cleanup the detection code a bit.  Do not turn on global
  spectre_*_supported flags unless all cpus agree.

6 years agokernel - Implement spectre mitigations part 3 (stabilization)
Matthew Dillon [Thu, 11 Jan 2018 20:48:18 +0000 (12:48 -0800)]
kernel - Implement spectre mitigations part 3 (stabilization)

* Fix a bug in the system call entry code.  The wrong stack pointer
  was being loaded for KMMUENTRY_SYSCALL and KMMUENTRY_SYSCALL was
  using an offset that did not exist in certain situations.

* Load the correct stack pointer, but also change KMMUENTRY_CORE
  to not use stack-relative loads and stores.  Instead it uses
  the trampframe directly via %gs:BLAH

Reported-by: zrj
6 years agofdcontrol(8): Staticize and bump WARNS to 6.
Sascha Wildner [Thu, 11 Jan 2018 10:22:52 +0000 (11:22 +0100)]
fdcontrol(8): Staticize and bump WARNS to 6.

6 years agoclog(8): Staticize.
Sascha Wildner [Thu, 11 Jan 2018 09:57:39 +0000 (10:57 +0100)]
clog(8): Staticize.

6 years agoclog: Use standard MAN variable.
Sascha Wildner [Thu, 11 Jan 2018 09:54:07 +0000 (10:54 +0100)]
clog: Use standard MAN variable.

6 years agocdcontrol(8): Staticize and remove a wrong prototype.
Sascha Wildner [Thu, 11 Jan 2018 09:44:58 +0000 (10:44 +0100)]
cdcontrol(8): Staticize and remove a wrong prototype.

6 years agoburncd(8): Staticize.
Sascha Wildner [Thu, 11 Jan 2018 09:37:06 +0000 (10:37 +0100)]
burncd(8): Staticize.

6 years agobtconfig(8): Staticize.
Sascha Wildner [Wed, 10 Jan 2018 08:47:21 +0000 (09:47 +0100)]
btconfig(8): Staticize.

6 years agokernel/sysv: Fix wrong assignment.
zrj [Wed, 10 Jan 2018 07:07:54 +0000 (09:07 +0200)]
kernel/sysv: Fix wrong assignment.

Pointed-by: dillon
6 years agokernel - Implement spectre mitigations part 2
Matthew Dillon [Wed, 10 Jan 2018 22:59:47 +0000 (14:59 -0800)]
kernel - Implement spectre mitigations part 2

* NOTE: The last few commits may have said 'IBPB' but they really
  meant 'IBRS.  The last few commits addde IBRS support, this one
  cleans that up and adds IBPB support.

* Intel says for IBRS always-on mode (mode 2), SPEC_CTRL still has
  to be poked on every user->kernel entry as a barrier, even though
  the value is not being changed.  So make this change.  This actually
  somewhat improves performance a little on Skylake and later verses
  when I just set it globally and left it that way.

* Implement IBPB detection and support on Intel.  At the moment
  we default to turning it off because the performance hit is pretty
  massive.  Currently the work on linux is only using IBPB for
  VMM related operations and not for user->kernel entry.

* Enhance the machdep.spectre_mitigation sysctl to print out
  what the mode matrix is whenever you change it, in human
  readable terms.

  0 IBRS disabled IBPB disabled
  1 IBRS mode 1 (kernel-only) IBPB disabled
  2 IBRS mode 2 (at all times) IBPB disabled

  4 IBRS disabled IBPB enabled
  5 IBRS mode 1 (kernel-only) IBPB enabled
  6 IBRS mode 2 (at all times) IBPB enabled

  Currently we default to (1) instead of (5) when we detect that
  the microcode detects both features.  IBPB is not turned on by default
  (you can see why below).

* Haswell and Skylake performance loss matrix using the following
  test.  This tests a high-concurrency compile, which is approximately
  a 5:1 user:kernel test with high concurrency.

  The haswell box is:  i3-4130 CPU @ 3.40GHz  (2-core/4-thread)
  The skylake box is:  i5-6500 CPU @ 3.20GHz  (4-core/4-thread)

  This does not include MMU isolation losses, which will add another
  3-4% or so in losses.

  (/usr/obj on tmpfs)
  time make -j 8 nativekernel NO_MODULES=TRUE

    PERFORMANCE LOSS MATRIX
       HASWELL                 SKYLAKE
    IBPB=0  IBPB=1          IBPB=0  IBPB=1
    IBRS=0     0%    12%              0%     17%
    IBRS=1   >12%<   21%           >2.4%<    15%
    IBRS=2    58%    60%             23%     32%

  Note that the automatic default when microcode support is detected
  is IBRS=1, IBPB=0 (12% loss on Haswell and 2.4% loss on Skylake
  for this test).  If we add 3-4% or so for MMU isolation, a Haswell
  cpu loses around 16% and a Skylake cpu loses around 6% or so in
  performance.

    PERFORMANCE LOSS MATRIX
      (including 3% MMU isolation losses)
       HASWELL                 SKYLAKE
    IBPB=0  IBPB=1          IBPB=0  IBPB=1
    IBRS=0     3%    15%              3%     20%
    IBRS=1   >15%<   24%           >5.4%<    18%
    IBRS=2    61%    63%             26%     35%

6 years agosys/vfs/autofs: Drop AUTOFSDONE101
Tomohiro Kusumi [Wed, 10 Jan 2018 21:21:46 +0000 (23:21 +0200)]
sys/vfs/autofs: Drop AUTOFSDONE101

This ioctl was never needed by DragonFly which was ported in 2016.
The ioctl implementation was kept in kernel side for no reason,
while automountd never used this in DragonFly.

NetBSD also dropped this ioctl when they recently merged autofs
to -current.
https://github.com/NetBSD/src/blob/trunk/sys/fs/autofs/autofs_ioctl.h

6 years agokernel - Implement spectre mitigations part 1
Matthew Dillon [Wed, 10 Jan 2018 05:36:18 +0000 (21:36 -0800)]
kernel - Implement spectre mitigations part 1

* Implement machdep.spectre_mitigation.  This can be set as a tunable
  or sysctl'd later.  The tunable is only applicable if the BIOS has
  the appropriate microcode, otherwise you have to update the microcode
  first and then use sysctl to set the mode.

  This works similarly to Linux's IBRS support.

  mode 0 - Spectre IBPB MSRs disabled

  mode 1 - Sets IBPB MSR on USER->KERN transition and clear it
   on KERN->USER.

  mode 2 - Leave IBPB set globally.  Do not toggle on USER->KERN or
   KERN->USER transitions.

* Retest spectre microcode MSRs on microcode update.

* Spectre mode 1 is enabled by default if the microcode supports it.
  (we might change this to disabled by default, I'm still mulling it
  over).

* General performance effects (not counting the MMU separation mode,
  which is machdep.meltdown_mitigation and adds another 3% in overhead):

  Skylake loses around 5% for mode 1 and 12% for mode 2, verses mode 0.
  Haswell loses around 12% for mode 1 and 53% for mode 2, verses mode 0.

  Add another 3% if MMU separation is also turned on (aka
  machdep.meltdown_mitigation).

* General system call overhead effects on Skylake:

  machdep.meltdown_mitigation=0, machdep.spectre_mitigation=0 103ns
  machdep.meltdown_mitigation=1, machdep.spectre_mitigation=0 360ns
  machdep.meltdown_mitigation=1, machdep.spectre_mitigation=1 848ns
  machdep.meltdown_mitigation=1, machdep.spectre_mitigation=2 404ns

  Note that mode 1 has better overall performance for mixed user+kernel
  workloads despite having a much higher system call overhead, whereas
  mode 2 has lower system call overhead but generally lower overall
  performance because IBPB is enabled in usermode.

6 years agokernel - Rename machdep.isolated_user_pmap to meltdown_mitigation
Matthew Dillon [Wed, 10 Jan 2018 01:17:04 +0000 (17:17 -0800)]
kernel - Rename machdep.isolated_user_pmap to meltdown_mitigation

* Rename machdep.isolated_user_pmap to
  machdep.meltdown_mitigation.

6 years agokernel - Increase microcode size limit from 32KB to 4MB
Matthew Dillon [Tue, 9 Jan 2018 19:56:08 +0000 (11:56 -0800)]
kernel - Increase microcode size limit from 32KB to 4MB

* Increase the microcode size limit to 4MB.  Newer microcodes exceed
  the previous 32KB limit.  e.g. the latest Skylake microcode is 97KB.

* Fixes cpucontrol -u operations on newer cpus.

Taken-from: FreeBSD

6 years agoboot/efi: Include just Uefi.h instead of Uefi{BaseType,Spec}.h
Sascha Wildner [Tue, 9 Jan 2018 07:31:55 +0000 (08:31 +0100)]
boot/efi: Include just Uefi.h instead of Uefi{BaseType,Spec}.h

6 years agoboot/efi: Bring in an additional TianoCore EDK II header.
Sascha Wildner [Tue, 9 Jan 2018 07:22:33 +0000 (08:22 +0100)]
boot/efi: Bring in an additional TianoCore EDK II header.

Taken from the MdePkg of the UDK2017 branch of the
git://github.com/tianocore/edk2 repository.
All I modified was killing CRs using 'tr -d "\015"'.

This is a work in progress.

6 years agosys/vfs/autofs: Cleanups
Tomohiro Kusumi [Sun, 7 Jan 2018 16:51:52 +0000 (18:51 +0200)]
sys/vfs/autofs: Cleanups

6 years agoldconfig(8): clean up manual page
Eitan Adler [Sun, 7 Jan 2018 06:28:58 +0000 (22:28 -0800)]
ldconfig(8): clean up manual page

- describe "-s"
- add newlines to sentence ends
- clarify file usage

Reviewed-by: swildner

6 years agoarp(8): Staticize.
Sascha Wildner [Sun, 7 Jan 2018 06:19:32 +0000 (07:19 +0100)]
arp(8): Staticize.

6 years agoac(8): Staticize and raise WARNS to 6.
Sascha Wildner [Sun, 7 Jan 2018 06:19:18 +0000 (07:19 +0100)]
ac(8): Staticize and raise WARNS to 6.

While here, put a CONSOLE_TTY specific prototype in a corresponding
#ifdef.

6 years agoxtr(1) clean up
Eitan Adler [Sun, 7 Jan 2018 05:21:56 +0000 (21:21 -0800)]
xtr(1)  clean up

- clean usage of comma operator
- use char instead of int
- add brackets

Reviewed-by: dillon
6 years agoetc/autofs: Sync with FreeBSD commits
Tomohiro Kusumi [Sat, 6 Jan 2018 18:37:53 +0000 (20:37 +0200)]
etc/autofs: Sync with FreeBSD commits

Bring in below from FreeBSD@GitHub in 1 commit.

64382aa4e68 Add /etc/autofs/include_nis, a non-rewriting NIS map.
a5ff2845f3f Rename /etc/autofs/include_nis to /etc/autofs/include_nis_nullfs, to indicate that this script provides nullfs map rewriting for local mounts.
759e1781cc0 Change formatting; no functional changes.

6 years agoetc/autofs: Cleanup trailing whitespaces
Tomohiro Kusumi [Sat, 6 Jan 2018 18:28:14 +0000 (20:28 +0200)]
etc/autofs: Cleanup trailing whitespaces

This generates diff between these and FreeBSD scripts.

6 years agousr.sbin/fstyp: Remove local MIN() definition
Tomohiro Kusumi [Sat, 6 Jan 2018 18:16:46 +0000 (20:16 +0200)]
usr.sbin/fstyp: Remove local MIN() definition

This isn't needed.
Having local MIN() also broke compilation on NetBSD with ZFS support,
due to ZFS headers already included sys/param.h.