]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoPermit local kernel modules to be built as part of a kernel build.
John Baldwin [Tue, 30 Oct 2018 00:23:37 +0000 (00:23 +0000)]
Permit local kernel modules to be built as part of a kernel build.

Add support for "local" modules.  By default, these modules are
located in LOCALBASE/sys/modules (where LOCALBASE defaults to
/usr/local).  Individual modules can be built along with a kernel by
defining LOCAL_MODULES to the list of modules.  Each is assumed to be
a subdirectory containing a valid Makefile.  If LOCAL_MODULES is not
specified, all of the modules present in LOCALBASE/sys/modules are
built and installed along with the kernel.

This means that a port that installs a kernel module can choose to
install its source along with a suitable Makefile to
/usr/local/sys/modules/<foo>.  Future kernel builds will then include
that kernel module using the kernel configuration's opt_*.h headers
and install it into /boot/kernel along with other kernel-specific
modules.

This is not trying to solve the issue of folks running GENERIC release
kernels, but is instead aimed at folks who build their own kernels.
For those folks this ensures that kernel modules from ports will
always be using the right KBI, etc.  This includes folks running any
KBI-breaking kernel configs (such as PAE).

There are still some kinks to be worked out with cross-building (we
probably shouldn't include local modules in cross-built kernels by
default), but this is a sufficient starting point.

Reviewed by: imp
MFC after: 3 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D16966

5 years agoHave gconcat advertise delete support if one of its disks does.
Mark Johnston [Tue, 30 Oct 2018 00:22:14 +0000 (00:22 +0000)]
Have gconcat advertise delete support if one of its disks does.

This follows the example set by other multi-disk GEOM classes.

PR: 232676
Tested by: noah.bergbauer@tum.de
MFC after: 1 month

5 years agoMake battery emptying rate available as sysctl variable.
John Baldwin [Tue, 30 Oct 2018 00:19:44 +0000 (00:19 +0000)]
Make battery emptying rate available as sysctl variable.

Curiously, the in-kernel routines always use the design voltage to
convert from mA to mW, but acpiconf in userland uses the current
voltage.  As a result, this can report a different mW rate than
acpiconf.

Submitted by: Manuel Stühn <freebsdnewbie@freenet.de>
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D17077

5 years agoConvert amd64_get/set_fs/gsbase to ifunc.
Konstantin Belousov [Tue, 30 Oct 2018 00:11:30 +0000 (00:11 +0000)]
Convert amd64_get/set_fs/gsbase to ifunc.

Note that this is the first use of ifuncs in our userspace.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

5 years agoRemove rtld use of libc amd64_set_fsbase().
Konstantin Belousov [Mon, 29 Oct 2018 23:59:26 +0000 (23:59 +0000)]
Remove rtld use of libc amd64_set_fsbase().

One less non-trivial dependency of rtld on libc.  Also,
amd64_set_fsbase() is to be converted to ifunc, which I do not want to
support inside rtld.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoInitialize ifunc calling machinery earlier.
Konstantin Belousov [Mon, 29 Oct 2018 23:56:39 +0000 (23:56 +0000)]
Initialize ifunc calling machinery earlier.

In particular, do it before the first call to allocate_initial_tls(),
which contains MD parts to set the initial thread' TLS pointer.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoamd64: Use ifuncs to select suitable implementation of set_pcb_flags().
Konstantin Belousov [Mon, 29 Oct 2018 23:52:31 +0000 (23:52 +0000)]
amd64: Use ifuncs to select suitable implementation of set_pcb_flags().

There is no reason to check for PCB_FULL_IRET if FSGSBASE instructions
are not supported.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoTeach procstat -x about the AT_EHDRFLAGS ELF auxiliary vector.
John Baldwin [Mon, 29 Oct 2018 23:48:20 +0000 (23:48 +0000)]
Teach procstat -x about the AT_EHDRFLAGS ELF auxiliary vector.

Submitted by: Shawn Webb <lattera@gmail.com>
Reviewed by: brooks
Obtained from: HardenedBSD (bb71e9889d1362df01c2e5162e84cd7a4fc029c8)
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D17067

5 years agoStyle.
Konstantin Belousov [Mon, 29 Oct 2018 23:45:17 +0000 (23:45 +0000)]
Style.

Wrap long lines, use +4 spaces for continuation indent.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoClarify explanation of VFCF_SBDRY.
Konstantin Belousov [Mon, 29 Oct 2018 23:43:17 +0000 (23:43 +0000)]
Clarify explanation of VFCF_SBDRY.

Requested by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agocxgbe/iw_cxgbe: Install the socket upcall before calling soconnect to
Navdeep Parhar [Mon, 29 Oct 2018 22:35:46 +0000 (22:35 +0000)]
cxgbe/iw_cxgbe: Install the socket upcall before calling soconnect to
ensure that it always runs when soisconnected does.

Submitted by: Krishnamraju Eraparaju @ Chelsio
MFC after: 1 month
Sponsored by: Chelsio Communications

5 years agoAdd support for "plain" (non-HMAC) SHA digests.
John Baldwin [Mon, 29 Oct 2018 22:24:31 +0000 (22:24 +0000)]
Add support for "plain" (non-HMAC) SHA digests.

MFC after: 2 months
Sponsored by: Chelsio Communications

5 years agoAdd a note that epoch(9) may change, to untie our hands for any future MFCs.
Gleb Smirnoff [Mon, 29 Oct 2018 22:10:52 +0000 (22:10 +0000)]
Add a note that epoch(9) may change, to untie our hands for any future MFCs.

5 years agorping(1): Make sure the socket address defaults to something reasonable
Navdeep Parhar [Mon, 29 Oct 2018 21:46:05 +0000 (21:46 +0000)]
rping(1): Make sure the socket address defaults to something reasonable
when running as the server.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Reviewed by: hselasky@, np@
MFC after: 1 month
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D17707

5 years agoExpose some netdump configuration parameters through sysctl.
Mark Johnston [Mon, 29 Oct 2018 21:16:26 +0000 (21:16 +0000)]
Expose some netdump configuration parameters through sysctl.

Reviewed by: cem
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D17755

5 years agoFix get_maxfds() in jevents
Alex Richardson [Mon, 29 Oct 2018 21:08:34 +0000 (21:08 +0000)]
Fix get_maxfds() in jevents

If RLIM_INFINITY == -1ULL (such as on macOS) the min() call will result
in a value of less than 1 being returned. This causes nftw() to fail
with EINVAL.

While touching this file also fix includes to work on Linux/macOS and don't
declare snprintf since it may have different attributes in the system
headers there.

Reviewed By: mmacy
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17682

5 years agortld-elf: fix more warnings to allow compiling with WARNS=6
Alex Richardson [Mon, 29 Oct 2018 21:08:28 +0000 (21:08 +0000)]
rtld-elf: fix more warnings to allow compiling with WARNS=6

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17154

5 years agortld-elf: compile with WANRS=4 warnings other than -Wcast-align
Alex Richardson [Mon, 29 Oct 2018 21:08:19 +0000 (21:08 +0000)]
rtld-elf: compile with WANRS=4 warnings other than -Wcast-align

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17153

5 years agortld-elf: make it compile with WARNS=3
Alex Richardson [Mon, 29 Oct 2018 21:08:11 +0000 (21:08 +0000)]
rtld-elf: make it compile with WARNS=3

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17150

5 years agortld: set obj->textsize correctly
Alex Richardson [Mon, 29 Oct 2018 21:08:02 +0000 (21:08 +0000)]
rtld: set obj->textsize correctly

With lld-generated binaries the first PT_LOAD will usually be a read-only
segment unless you pass --no-rosegment. For those binaries the textsize is
determined by the next PT_LOAD. To allow both LLD and bfd 2.17 binaries to
be parsed correctly use the end of the last PT_LOAD that is marked as
executable instead.

I noticed that the value was wrong while adding some debug prints for some rtld
changes for CHERI binaries. `obj->textsize` only seems to be used by PPC so the
effect is untested. However, the value before was definitely wrong and the new
result matches the phdrs.

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17117

5 years agoPass _BRANCH in the reldoc target to ensure the correct
Glen Barber [Mon, 29 Oct 2018 21:03:43 +0000 (21:03 +0000)]
Pass _BRANCH in the reldoc target to ensure the correct
src branch is used when generating the hardware.html page.

MFC after: 3 days
MFC before: 12.0-BETA3
MFC with: r339873
Sponsored by: The FreeBSD Foundation

5 years agoSet OPTIONS_UNSET in the argument list to env(1), and add
Glen Barber [Mon, 29 Oct 2018 20:53:05 +0000 (20:53 +0000)]
Set OPTIONS_UNSET in the argument list to env(1), and add
AVAHI to the list.  This fixes the textproc/docproj build
seemingly following FLAVORS being added.

Specifically, the problem with the dependency chain here is:
- textproc/docproj depends on print/cups, which sets AVAHI=on
  by default;
- net/avahi-app depends on devel/gobject-introspection, which
  requires python3+;
- graphics/netpbm depends on graphics/mesa-libs, which can
  only be built with python2.7;
- textproc/docproj depends on a number of graphics ports for
  font rendering, etc.

MFC after: 3 days
MFC before: 12.0-BETA3
Sponsored by: The FreeBSD Foundation

5 years agoInsert a .El line accidently committed in r339869.
Michael Tuexen [Mon, 29 Oct 2018 19:25:30 +0000 (19:25 +0000)]
Insert a .El line accidently committed in r339869.

Reported by: gjb@
MFC after: 3 days

5 years agoFix a nit
Michael Tuexen [Mon, 29 Oct 2018 19:14:56 +0000 (19:14 +0000)]
Fix a nit

Reported by: gjb@
MFC after: 3 days

5 years agoImplement dma_pool_zalloc() in the LinuxKPI.
Hans Petter Selasky [Mon, 29 Oct 2018 19:02:36 +0000 (19:02 +0000)]
Implement dma_pool_zalloc() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 3 days
Sponsored by: Mellanox Technologies

5 years agoMake the .ctors, .dtors, and .jcr markers as static. They shouldn't be
Andrew Turner [Mon, 29 Oct 2018 17:55:26 +0000 (17:55 +0000)]
Make the .ctors, .dtors, and .jcr markers as static. They shouldn't be
accessible from out of the files they are defined in.

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoInclude the csu test directories in BSD.tests.dist
Andrew Turner [Mon, 29 Oct 2018 17:13:12 +0000 (17:13 +0000)]
Include the csu test directories in BSD.tests.dist

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoCheck __dso_handle is NULL in non-DSO objects. It should only be non-NULL
Andrew Turner [Mon, 29 Oct 2018 17:03:20 +0000 (17:03 +0000)]
Check __dso_handle is NULL in non-DSO objects. It should only be non-NULL
when accessed from a shared object.

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoDrain grouptaskqueue of the gtask before detaching it.
Stephen Hurd [Mon, 29 Oct 2018 14:36:03 +0000 (14:36 +0000)]
Drain grouptaskqueue of the gtask before detaching it.

taskqgroup_detach() would remove the task even if it was running or
enqueued, which could lead to panics (see D17404). With this change,
taskqgroup_detach() drains the task and sets a new flag which prevents the
task from being scheduled again.

I've added grouptask_block() and grouptask_unblock() to allow control
over the flag from other locations as well.

Reviewed by: Jeffrey Pieper <jeffrey.e.pieper@intel.com>
MFC after: 1 week
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D17674

5 years agolualoader: Fix try_include error handling
Kyle Evans [Mon, 29 Oct 2018 02:58:30 +0000 (02:58 +0000)]
lualoader: Fix try_include error handling

The previous iteration of try_include attempted to be 'friendly' and error()
out if we hit an error that wasn't ENOENT. This was semi-OK, but fragile as
it relied on pattern matching the error message.

Move the responsibility for handling failure to the caller. Following
a common lua pattern, we'll return the return value of the underlying
require() on success, or false and an error message.

Reported by: bcran
MFC after: 3 days

5 years agoImport tzdata 2018g
Philip Paeps [Sun, 28 Oct 2018 23:54:05 +0000 (23:54 +0000)]
Import tzdata 2018g

Changes: https://github.com/eggert/tz/blob/2018g/NEWS

MFC after: 3 days

5 years agoImport tzdata 2018g
Philip Paeps [Sun, 28 Oct 2018 23:50:24 +0000 (23:50 +0000)]
Import tzdata 2018g

5 years agoSort i18n messages in bsdinstall zfsboot
Devin Teske [Sun, 28 Oct 2018 22:09:18 +0000 (22:09 +0000)]
Sort i18n messages in bsdinstall zfsboot

No functional change.

Sponsored by: Smule, Inc.

5 years agoFix dialog autosizing to accomodate for hline
Devin Teske [Sun, 28 Oct 2018 19:29:07 +0000 (19:29 +0000)]
Fix dialog autosizing to accomodate for hline

dialog will conditionally ignore the --hline option if not enough space
was available to accomodate for the text width. Traditionally the width
of the widget had to be 10 wider than the text. Recent updates to dialog
have changed the requirement to be at least 12 wider than the hline text
else the hline text is not rendered at the bottom of the widget.

Sponsored by: Smule, Inc.

5 years agoFix jail examples in jib, jng, README
Devin Teske [Sun, 28 Oct 2018 18:32:47 +0000 (18:32 +0000)]
Fix jail examples in jib, jng, README

The provided example jail configs do not work for multiple interfaces.
Multiple interfaces need to be specified as a comma separated list or
using multiple += lines in jail.conf. In the given example, a space-
separated string is used, which doesn't work with multiple interfaces.

Also added a note to the README about VIMAGE being built-in by default
on amd64 in FreeBSD 12, with appropriate instructions for loading the
necessary netgraph ether module (ng_ether) since it is neither built-
in nor autoloads.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Reported by: Ryan Moeller <ryan@freqlabs.com>
MFC after: 3 days
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/D17697

5 years agotruss: Fix display of shm_open(SHM_ANON, ...).
Thomas Munro [Sun, 28 Oct 2018 10:59:49 +0000 (10:59 +0000)]
truss: Fix display of shm_open(SHM_ANON, ...).

Currently truss(1) shows shm_open(SHM_ANON, ...) as shm_open("(null)", ...).
Detect the special value and display it by name.

Reviewed by:    jhb, allanjude, tuexen
Approved by:    mjg (mentor)
MFC with:       r339224
Differential Revision:  https://reviews.freebsd.org/D17461

5 years agopfctl test: Add a test for macro names with a space in it
Kristof Provost [Sun, 28 Oct 2018 05:50:04 +0000 (05:50 +0000)]
pfctl test: Add a test for macro names with a space in it

5 years agopfctl: Do not allow whitespace in macro names
Kristof Provost [Sun, 28 Oct 2018 05:41:13 +0000 (05:41 +0000)]
pfctl: Do not allow whitespace in macro names

i.e. "this is" = "a variable" is not valid. It was accepted by the
parser, but the variable could not be used afterwards.

Obtained from: OpenBSD

5 years agopf tests: Test ':0' ignoring link-local addresses
Kristof Provost [Sun, 28 Oct 2018 05:37:15 +0000 (05:37 +0000)]
pf tests: Test ':0' ignoring link-local addresses

PR: 201695

5 years agopf: Make ':0' ignore link-local v6 addresses too
Kristof Provost [Sun, 28 Oct 2018 05:32:50 +0000 (05:32 +0000)]
pf: Make ':0' ignore link-local v6 addresses too

When users mark an interface to not use aliases they likely also don't
want to use the link-local v6 address there.

PR: 201695
Submitted by: Russell Yount <Russell.Yount AT gmail.com>
Differential Revision: https://reviews.freebsd.org/D17633

5 years agoBump .Dd forgotten in last commit.
Warner Losh [Sun, 28 Oct 2018 03:02:09 +0000 (03:02 +0000)]
Bump .Dd forgotten in last commit.

5 years agoNote that the kenrel doesn't keep track daylight savings time, nor
Warner Losh [Sun, 28 Oct 2018 02:58:22 +0000 (02:58 +0000)]
Note that the kenrel doesn't keep track daylight savings time, nor
timezone offset. These values are generally zero.

While one still theoreticall could set these values, that's almost
never done. Users wishing to have an offset between the time of day
clock hardware and UTC use adjkerntz(8) instead.

localtime(3) should be used to find these values for the current
timezone.

5 years agoftime appeared in 7th Edition Unix to replace gtime.
Warner Losh [Sun, 28 Oct 2018 02:58:15 +0000 (02:58 +0000)]
ftime appeared in 7th Edition Unix to replace gtime.
Note that the timezone and dst entries are always returned as 0.

5 years agoMove LUA_ROOT to /boot/lua
Warner Losh [Sun, 28 Oct 2018 02:57:50 +0000 (02:57 +0000)]
Move LUA_ROOT to /boot/lua

While this is mostly unused today, this is a better place than
/usr/local/lua.

5 years agoAdjust for 80-columns.
Devin Teske [Sun, 28 Oct 2018 00:58:39 +0000 (00:58 +0000)]
Adjust for 80-columns.

No functional change.

Sponsored by: Smule, Inc.

5 years agolocaledef: define characters in "space" class also as "print", except
Yuri Pankov [Sat, 27 Oct 2018 23:31:42 +0000 (23:31 +0000)]
localedef: define characters in "space" class also as "print", except
for the known conflicts ("control" characters can't be "print"able).
POSIX doesn't explicitly forbid this, and actually includes <space>
character in "print".

PR: 225692
Reviewed by: bapt, cem (previous version), pfg (previous version)
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D17467

5 years agoProvide basic descriptions for VMX exit reason (from "Intel 64 and IA-32
Yuri Pankov [Sat, 27 Oct 2018 21:24:28 +0000 (21:24 +0000)]
Provide basic descriptions for VMX exit reason (from "Intel 64 and IA-32
Architectures Software Developer’s Manual Volume 3").  Add the document
to SEE ALSO in bhyve.8 (and pet manlint here a bit).

Reviewed by: jhb, rgrimes, 0mp
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D17531

5 years agoevdev: disable evdev if it is invoked from KDB or panic context
Vladimir Kondratyev [Sat, 27 Oct 2018 21:04:34 +0000 (21:04 +0000)]
evdev: disable evdev if it is invoked from KDB or panic context

This allow to prevent deadlock on entering KDB if one of evdev locks is
already taken by userspace process.

Also this change discards all but LED console events produced by KDB as
unrelated to userspace.

Tested by: dumbbell (as part of D15070)
Objected by: bde (as 'KDB lock an already locked mutex' problem solution)
MFC after: 1 month

5 years agoevdev: Use console lock as evdev lock for all supported keyboard drivers.
Vladimir Kondratyev [Sat, 27 Oct 2018 20:22:41 +0000 (20:22 +0000)]
evdev: Use console lock as evdev lock for all supported keyboard drivers.

Now evdev part of keyboard drivers does not take any locks if corresponding
input/eventN device node is not opened by userland consumers.

Do not assert console lock inside evdev to handle the cases when keyboard
driver is called from some special single-threaded context like shutdown
thread.

5 years agosh: Use exitstatus instead of exerrno to pass EXEXEC status
Jilles Tjoelker [Sat, 27 Oct 2018 20:17:57 +0000 (20:17 +0000)]
sh: Use exitstatus instead of exerrno to pass EXEXEC status

No functional change is intended.

5 years agoUse M_WAITOK in init_hwpmc().
Mark Johnston [Sat, 27 Oct 2018 18:48:49 +0000 (18:48 +0000)]
Use M_WAITOK in init_hwpmc().

No functional change intended.

MFC after: 2 weeks

5 years agoEliminate typically pointless calls to vm_fault_prefault() on soft, copy-
Alan Cox [Sat, 27 Oct 2018 17:49:46 +0000 (17:49 +0000)]
Eliminate typically pointless calls to vm_fault_prefault() on soft, copy-
on-write faults.  On a page fault, when we call vm_fault_prefault(), it
probes the pmap and the shadow chain of vm objects to see if there are
opportunities to create read and/or execute-only mappings to neighoring
pages.  For example, in the case of hard faults, such effort typically pays
off, that is, mappings are created that eliminate future soft page faults.
However, in the the case of soft, copy-on-write faults, the effort very
rarely pays off.  (See the review for some specific data.)

Reviewed by: kib, markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D17367

5 years agorcorder(8): add support for /etc/rc.resume, so it calls "rcorder -k resume"
Eugene Grosbein [Sat, 27 Oct 2018 17:21:13 +0000 (17:21 +0000)]
rcorder(8): add support for /etc/rc.resume, so it calls "rcorder -k resume"
and runs scripts containing "KEYWORD: resume" with single "resume" argument.

Working example is the port sysutils/cpupdate that defines
extra_commands="resume" to reload CPU microcode cleared
by suspend/resume sequence.

This change does nothing for a system having no scripts with KEYWORD: resume.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D15247

5 years agomakewhatis: do not try to operate on read-only mounted directories
Eugene Grosbein [Sat, 27 Oct 2018 17:15:58 +0000 (17:15 +0000)]
makewhatis: do not try to operate on read-only mounted directories
just to fail later.

MFC after: 1 month

5 years agomount_msdosfs: do not fail mounts requiring locale name conversion table
Eugene Grosbein [Sat, 27 Oct 2018 16:41:34 +0000 (16:41 +0000)]
mount_msdosfs: do not fail mounts requiring locale name conversion table
that is already present in a kernel statically.

For example, the command "mount_msdosfs -L ru_RU.KOI8-R" fails with error
"mount_msdosfs: msdosfs_iconv: File exists" for a kernel having
options LIBICONV and MSDOSFS_ICONV. After this change, it mounts successfully.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D16951

5 years agoExtend stripeoffset and stripesize of GEOMs from u_int to off_t
Eugene Grosbein [Sat, 27 Oct 2018 16:14:42 +0000 (16:14 +0000)]
Extend stripeoffset and stripesize of GEOMs from u_int to off_t

GEOM's stripeoffset overflows at 4 gigabyte margin (2^32)
because of its u_int type. This leads to incorrect data in the output
generated by "sysctl kern.geom.confxml" command, "graid list" etc.
when GEOM array has volumes larger than 4G, for example.

This change does not affect ABI but changes KBI. No MFC planned.

Differential Revision: https://reviews.freebsd.org/D13426

5 years agorandom(4): Match enabled sources mask to build options
Conrad Meyer [Sat, 27 Oct 2018 15:09:35 +0000 (15:09 +0000)]
random(4): Match enabled sources mask to build options

r287023 and r334450 added build option mechanisms to permanently disable
spammy and/or low quality entropy sources.

Follow-up those changes by updating the 'enabled' sources mask to match.
When sources are compile-time disabled, represent them as disabled in the
source mask, and prevent users from modifying that, like pure sources.
(Modifying the mask bit would have no effect, but users might think it did
if it was not prevented.)

Mostly a cosmetic change.

Reviewed by: markm
Approved by: secteam (gordon)
X-MFC-With: 334450
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D17252

5 years agoAdd default value for local_unbound_tls + fix nearby style bugs.
Dag-Erling Smørgrav [Sat, 27 Oct 2018 09:34:33 +0000 (09:34 +0000)]
Add default value for local_unbound_tls + fix nearby style bugs.

Reported by: bcran@
MFC after: 3 days

5 years agoroute(8): correctly return exit status when "-q" flag is used.
Eugene Grosbein [Sat, 27 Oct 2018 07:59:19 +0000 (07:59 +0000)]
route(8): correctly return exit status when "-q" flag is used.

Previously, route returned 1 in case of error  properly signalling failure
but "route -q" it returned 0 for same case. Fix it.

PR: 186333
MFC after: 1 month

5 years agoipfw: implement ngtee/netgraph actions for layer-2 frames.
Eugene Grosbein [Sat, 27 Oct 2018 07:32:26 +0000 (07:32 +0000)]
ipfw: implement ngtee/netgraph actions for layer-2 frames.

Kernel part of ipfw does not support and ignores rules other than
"pass", "deny" and dummynet-related for layer-2 (ethernet frames).
Others are processed as "pass".

Make it support ngtee/netgraph rules just like they are supported
for IP packets. For example, this allows us to mirror some frames
selectively to another interface for delivery to remote network analyzer
over RSPAN vlan. Assuming ng_ipfw(4) netgraph node has a hook named "900"
attached to "lower" hook of vlan900's ng_ether(4) node, that would be
as simple as:

ipfw add ngtee 900 ip from any to 8.8.8.8 layer2 out xmit igb0

PR: 213452
MFC after: 1 month
Tested-by: Fyodor Ustinov <ufm@ufm.su>

5 years agocxgbetool(8): Add a subaction (tcbrss <n>) that can be used with "pass"
Navdeep Parhar [Sat, 27 Oct 2018 05:26:09 +0000 (05:26 +0000)]
cxgbetool(8): Add a subaction (tcbrss <n>) that can be used with "pass"
action to distribute traffic using the half of the VI's RSS indirection
table.

The value specified should either be the start of the VI's RSS slice
(available at dev.<ifname>.<inst>.rss_base since r339700) or the
midpoint (rss_base + rss_size/2).  The traffic that hits the filter will
use the first or second half of the indirection table respectively.
The indirection table can be populated in different ways to achieve
different kinds of traffic/load distributions.  For example, r339749
allows a netmap interface to have half the rx queues in the first half
of the table and the rest in the other.

Sponsored by: Chelsio Communications

5 years agoPrevent ip_input() from panicing due to unprotected access to INADDR_HASH.
Eugene Grosbein [Sat, 27 Oct 2018 04:59:35 +0000 (04:59 +0000)]
Prevent ip_input() from panicing due to unprotected access to INADDR_HASH.

PR: 220078
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12457
Tested-by: Cassiano Peixoto and others

5 years agoPrevent multicast code from panicing due to unprotected access to INADDR_HASH.
Eugene Grosbein [Sat, 27 Oct 2018 04:53:25 +0000 (04:53 +0000)]
Prevent multicast code from panicing due to unprotected access to INADDR_HASH.

PR: 220078
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12457
Tested-by: Cassiano Peixoto and others

5 years agoPrevent stf(4) from panicing due to unprotected access to INADDR_HASH.
Eugene Grosbein [Sat, 27 Oct 2018 04:45:28 +0000 (04:45 +0000)]
Prevent stf(4) from panicing due to unprotected access to INADDR_HASH.

PR: 220078
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12457
Tested-by: Cassiano Peixoto and others

5 years agolualoader: Always return a proper dictionary for blacklist
Kyle Evans [Sat, 27 Oct 2018 04:10:42 +0000 (04:10 +0000)]
lualoader: Always return a proper dictionary for blacklist

If module_blacklist isn't specified, we have an empty blacklist; effectively
the same as if module_blacklist="" were specified in loader.conf(5).

This was reported when switching to a BE that predated the module_blacklist
introduction, but the problem is valid all the same and likely to be tripped
over in other scenarios.

Reported by: bwidawsk
MFC after: 3 days

5 years agoRestore backward compatibility for "attach" verb.
Xin LI [Sat, 27 Oct 2018 03:37:14 +0000 (03:37 +0000)]
Restore backward compatibility for "attach" verb.

In r332361 and r333439, two new parameters were added to geli attach
verb using gctl_get_paraml, which requires the value to be present.
This would prevent old geli(8) binary from attaching geli(4) device
as they have no knowledge about the new parameters.

Restore backward compatibility by treating the absense of these two
values as seeing the default value supplied by userland.

PR: 232595
Reviewed by: oshogbo
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D17680

5 years agoFix pointer arithmetic
Warner Losh [Fri, 26 Oct 2018 23:44:50 +0000 (23:44 +0000)]
Fix pointer arithmetic

Pointer math to find the size in bytes only works with char types.
Use correct pointer math to determine if we have enough of a header to
look at or not.

MFC After: 3 days
X-MFX-With: r339800
Noticed by: jhb@
Sponsored by: Netflix, Inc

5 years agoFix pointer arithmetic botch.
Warner Losh [Fri, 26 Oct 2018 23:44:39 +0000 (23:44 +0000)]
Fix pointer arithmetic botch.

Pointer subtraction to find size only works with char pointers.

Noticed by: jhb@
Sponsored by: Netflix, Inc

5 years agoEnsure we have a full EFI_DEVICE_PATH header before we try to look at
Warner Losh [Fri, 26 Oct 2018 23:08:22 +0000 (23:08 +0000)]
Ensure we have a full EFI_DEVICE_PATH header before we try to look at
its length. Some BIOSes pad the length of the device path to an even
amount. When we had a device path that was somehow an odd length, we'd
wind up having 1 byte left that we were bogusly interpreting as a full
device path. We'd then dereference 2 bytes into that to get a length
of the node, which had undefined (and quite undesired) effects.

Sponsored by: Netflix, Inc
MFC After: 3 days

5 years agoEnsure that the device path is sane before trying to decode and print
Warner Losh [Fri, 26 Oct 2018 22:49:36 +0000 (22:49 +0000)]
Ensure that the device path is sane before trying to decode and print
it.

Sponsored by: Netflix, Inc

5 years agoRequire that we have at least a device path header before
Warner Losh [Fri, 26 Oct 2018 22:49:25 +0000 (22:49 +0000)]
Require that we have at least a device path header before
trying to decode the next device path.

Sponsored by: Netflix, Inc

5 years agoImplenent --fromfile to read variable values when printing variables
Warner Losh [Fri, 26 Oct 2018 22:13:40 +0000 (22:13 +0000)]
Implenent --fromfile to read variable values when printing variables

So

./efivar --fromfile Boot0001.bin --print --load-option

will take the value from Boot0001.bin file and then decode it as if it
were a load-option. This is useful for debugging handling of such
variables that may be hanging the boot for some people.

Sponsored by: Netflix, Inc

5 years agoSimplify the EFI delay() function by calling BS->Stall()
Rebecca Cran [Fri, 26 Oct 2018 21:57:22 +0000 (21:57 +0000)]
Simplify the EFI delay() function by calling BS->Stall()

Differential Revision: https://reviews.freebsd.org/D16753

5 years agoAdd a very basic regression test for setfacl -R with NFSv4 ACLs.
Mark Johnston [Fri, 26 Oct 2018 21:20:04 +0000 (21:20 +0000)]
Add a very basic regression test for setfacl -R with NFSv4 ACLs.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoMFV r339792:
Martin Matuska [Fri, 26 Oct 2018 21:17:50 +0000 (21:17 +0000)]
MFV r339792:
Sync libarchive with vendor.

Relevant vendor changes:
  RAR5 reader: more maybe-uninitialized size_t fixes for riscv64
               FreeBSD build

MFC after: 1 month

5 years agoDon't set NFSv4 ACL inheritance flags on non-directories.
Mark Johnston [Fri, 26 Oct 2018 21:17:06 +0000 (21:17 +0000)]
Don't set NFSv4 ACL inheritance flags on non-directories.

They only make sense in the context of directory ACLs, and attempting
to set them on regular files results in errors, causing a recursive
setfacl invocation to abort.

This is derived from patches by Shawn Webb <shawn.webb@hardenedbsd.org>
and Mitchell Horne <mhorne063@gmail.com>.

PR: 155163
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D15061

5 years agoUpdate vendor/libarchive/dist to git d661131393def793a9919d1e3fd54c9992888bd6
Martin Matuska [Fri, 26 Oct 2018 21:15:36 +0000 (21:15 +0000)]
Update vendor/libarchive/dist to git d661131393def793a9919d1e3fd54c9992888bd6

Relevant vendor changes:
  RAR5 reader: more maybe-uninitialized size_t fixes for riscv64
               FreeBSD build

5 years agoAdd initial descriptions for SCTP related MIB variable.
Michael Tuexen [Fri, 26 Oct 2018 21:04:17 +0000 (21:04 +0000)]
Add initial descriptions for SCTP related MIB variable.
This work was mostly done by Marie-Helene Kvello-Aune.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D3583

5 years agoFortuna: Add failpoints to simulate initial seeding conditions
Conrad Meyer [Fri, 26 Oct 2018 21:03:57 +0000 (21:03 +0000)]
Fortuna: Add failpoints to simulate initial seeding conditions

Set debug.fail_point.random_fortuna_pre_read=return(1) and
debug.fail_point.random_fortuna_seeded=return(1) to return to unseeded
status (sort of).  See the Differential URL for more detail.

The goal is to reproduce e.g. Lev's recent CURRENT report[1] about failing
newfs arc4random(3) usage (fixed in r338542).

No functional change when failpoints are not set.

[1]: https://lists.freebsd.org/pipermail/freebsd-current/2018-September/071067.html

Reported by: lev
Reviewed by: delphij, markm
Approved by: secteam (delphij)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D17047

5 years agofortuna: Drop global lock to zero stack variables
Conrad Meyer [Fri, 26 Oct 2018 21:00:26 +0000 (21:00 +0000)]
fortuna: Drop global lock to zero stack variables

Also drop explicit zeroing of hash context -- hash finish() operation is
expected to do this.

PR: 230877
Suggested by: delphij@
Reviewed by: delphij, markm
Approved by: secteam (delphij)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D16986

5 years agoFortuna: fix a correctness issue in reseed (fortuna_pre_read)
Conrad Meyer [Fri, 26 Oct 2018 20:55:01 +0000 (20:55 +0000)]
Fortuna: fix a correctness issue in reseed (fortuna_pre_read)

'i' counts the number of pools included in the array 's'.  Passing 'i+1' to
reseed_internal() as the number of blocks in 's' is a bogus overrun of the
initialized portion of 's' -- technically UB.

I found this via code inspection, referencing §9.5.2 "Pools" of the Fortuna
chapter, but I would expect Coverity to notice the same issue.
Unfortunately, it doesn't appear to.

Reviewed by: markm
Approved by: secteam (gordon)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D16985

5 years agorijndael (AES): Avoid leaking sensitive data on kernel stack
Conrad Meyer [Fri, 26 Oct 2018 20:53:01 +0000 (20:53 +0000)]
rijndael (AES): Avoid leaking sensitive data on kernel stack

Noticed this investigating Fortuna.  Remove useless duplicate stack copies
of sensitive contents when possible, or if not possible, be sure to zero
them out when we're finished.

Approved by: secteam (gordon)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D16935

5 years agopoll: Unify userspace pollfd pointer name
Conrad Meyer [Fri, 26 Oct 2018 20:07:46 +0000 (20:07 +0000)]
poll: Unify userspace pollfd pointer name

Some of the poll code used 'fds' and some used 'ufds' to refer to the
uap->fds userspace pointer that was passed around to subroutines.  Some of
the poll code used 'fds' to refer to the kernel memory pollfd arrays, which
seemed unnecessarily confusing.

Unify on 'ufds' to refer to the userspace pollfd array.

Additionally, 'bits' is not an accurate description of the kernel pollfd
array in kern_poll, so rename that to 'kfds'.  Finally, clean up some logic
with mallocarray() and nitems().

No functional change.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D17670

5 years agodumpon.8: Significantly revamp page
Conrad Meyer [Fri, 26 Oct 2018 20:03:59 +0000 (20:03 +0000)]
dumpon.8: Significantly revamp page

Start with a short summary and cover the options in a standard list style.

Organize sections by common focus and prioritize more useful information
closer to the top.

Flesh out authors, history, caveats, and security considerations sections.

Reviewed by: markj, eadler (previous version)
Differential Revision: https://reviews.freebsd.org/D17679

5 years agodumpon(8): Provide seatbelt against weak RSA keys
Conrad Meyer [Fri, 26 Oct 2018 19:53:59 +0000 (19:53 +0000)]
dumpon(8): Provide seatbelt against weak RSA keys

The premise of dumpon -k foo.pem is that dump contents will be confidential
except to anyone holding the corresponding RSA private key.

This guarantee breaks down when weak RSA keys are used.  Small RSA keys
(e.g. 512 bits) can be broken on a single personal computer in tractible
time.  Marginal RSA keys (768 bits) can be broken by EC2 and a few dollars.
Even 1024 bit keys can probably be broken by sophisticated and wealthy
attackers.

NIST SP800-57 (2016) recommends a minimum of 2048 bit RSA keys, and
estimates this provides 112 bits of security.

It would also be good to protect users from weak values of 'e' (i.e., 3) and
perhaps sanity check that their public key .pem does not accidentally
contain their private key as well.  These considerations are left as future
work.

Reviewed by: markj, darius AT dons.net.au (previous version)
Discussed with: bjk
Differential Revision: https://reviews.freebsd.org/D17678

5 years agoAdd blank line after each item in "ngctl ls -l"
Devin Teske [Fri, 26 Oct 2018 19:16:17 +0000 (19:16 +0000)]
Add blank line after each item in "ngctl ls -l"

The output of "ngctl ls -l" is hard to read. To make it easier, add a blank
line after each listed item much how traditional "ls -l" does when listing
the contents of multiple directories.

Sponsored by: Smule, Inc.

5 years agoUpdate and re-enable ACL tests following r332396 and r339781.
Mark Johnston [Fri, 26 Oct 2018 19:03:30 +0000 (19:03 +0000)]
Update and re-enable ACL tests following r332396 and r339781.

PR: 229930
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoDon't print pathconf() errors if the target file doesn't exist.
Mark Johnston [Fri, 26 Oct 2018 19:01:52 +0000 (19:01 +0000)]
Don't print pathconf() errors if the target file doesn't exist.

The subsequent acl_get_file(3) call will simply echo the same error.

PR: 229930
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoAvoid leaking memory in error paths.
Mark Johnston [Fri, 26 Oct 2018 18:56:58 +0000 (18:56 +0000)]
Avoid leaking memory in error paths.

CID: 1390906
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoMove 32-bit compat support for FIODGNAME to the right place.
Brooks Davis [Fri, 26 Oct 2018 17:59:25 +0000 (17:59 +0000)]
Move 32-bit compat support for FIODGNAME to the right place.

ioctl(2) commands only have meaning in the context of a file descriptor
so translating them in the syscall layer is incorrect.

The new handler users an accessor to retrieve/construct a pointer from
the last member of the passed structure and relies on type punning to
access the other member which requires no translation.

Unlike r339174 this change supports both places FIODGNAME is handled.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17475

5 years agoRemove empty directories after r339776.
Warner Losh [Fri, 26 Oct 2018 16:34:19 +0000 (16:34 +0000)]
Remove empty directories after r339776.

git svn won't remove empty directories without --rmdir which I
forgot in r339776.

5 years agoAdd statistics for TRIM comands
Warner Losh [Fri, 26 Oct 2018 16:23:51 +0000 (16:23 +0000)]
Add statistics for TRIM comands

Add a counter for the LBAs, Ranges and hardware commands so that we
can provide additional color to the statistics we provide to vendors.

Sponsored by: Netflix, Inc

5 years agoRedo r339563: Remove joy(4) driver.
Warner Losh [Fri, 26 Oct 2018 16:03:30 +0000 (16:03 +0000)]
Redo r339563: Remove joy(4) driver.

This driver was marked as gone in 12. We're at 13 now. Remove it.
Data from nycbug's dmesg cache shows only one potential user,
suggesting it never was used much. However, even though this device
has been obsolete for 15 years at least, sys/joystick.h is included in
a number of graphics packages still, so that remains. A full exprun
is needed before that can be removed.

RelNotes: yes
Differential Revision: https://reviews.freebsd.org/D17629

5 years agoPut a workaround in for command timeout malfunctioning
Warner Losh [Fri, 26 Oct 2018 14:27:37 +0000 (14:27 +0000)]
Put a workaround in for command timeout malfunctioning

At least one NVMe drive has a bug that makeing the Command Time Out
PCIe feature unreliable. The workaround is to disable this
feature. The driver wouldn't deal correctly with a timeout anyway.
Only do this for drives that are known bad.

Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D17708

5 years agoo Add pmap lock around pmap_fault_fixup() to ensure other thread will not
Ruslan Bukin [Fri, 26 Oct 2018 12:27:07 +0000 (12:27 +0000)]
o Add pmap lock around pmap_fault_fixup() to ensure other thread will not
  modify l3 pte after we loaded old value and before we stored new value.
o Preset A(accessed), D(dirty) bits for kernel mappings.

Reported by: kib
Reviewed by: markj
Discussed with: jhb
Sponsored by: DARPA, AFRL

5 years agoAdd __dso_handle to the BSD crtbegin. This is used to identify shared
Andrew Turner [Fri, 26 Oct 2018 11:53:20 +0000 (11:53 +0000)]
Add __dso_handle to the BSD crtbegin. This is used to identify shared
objects.

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoDrop the csu tests WARNS to 5 to fix the powerpc64 build.
Andrew Turner [Fri, 26 Oct 2018 08:12:28 +0000 (08:12 +0000)]
Drop the csu tests WARNS to 5 to fix the powerpc64 build.

MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agoAdjust bsdinstall zfsboot code to 80-columns and whitespace fixes
Devin Teske [Fri, 26 Oct 2018 05:25:22 +0000 (05:25 +0000)]
Adjust bsdinstall zfsboot code to 80-columns and whitespace fixes

No functional changes.

Sponsored by: Smule, Inc.

5 years agoRemove #warning since it breaks libsysdecode
Warner Losh [Fri, 26 Oct 2018 04:53:29 +0000 (04:53 +0000)]
Remove #warning since it breaks libsysdecode

5 years agoBump to 1300002 for sys/joystick.h removal reversion.
Warner Losh [Fri, 26 Oct 2018 04:13:56 +0000 (04:13 +0000)]
Bump to 1300002 for sys/joystick.h removal reversion.