]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoAlpha-sort the list of user/group IDs to check at install time.
Ian Lepore [Sun, 22 Jul 2018 16:51:11 +0000 (16:51 +0000)]
Alpha-sort the list of user/group IDs to check at install time.

5 years agoRemove the .if ${MK_FOO} wrappers around the user/group ID checks. These
Ian Lepore [Sun, 22 Jul 2018 16:42:22 +0000 (16:42 +0000)]
Remove the .if ${MK_FOO} wrappers around the user/group ID checks.  These
names are referenced in mtree files without any conditional logic, so the
users/groups must exist even if the corresponding tool(s) are disabled.

5 years agoAdd ntpd to the list of users not allowed to log into ftp.
Ian Lepore [Sun, 22 Jul 2018 16:17:45 +0000 (16:17 +0000)]
Add ntpd to the list of users not allowed to log into ftp.

5 years agoFix multiple Coverity warnings in tftpd(8)
Alan Somers [Sun, 22 Jul 2018 16:14:30 +0000 (16:14 +0000)]
Fix multiple Coverity warnings in tftpd(8)

* Initialize uninitialized variable (CID 1006502)
* strcpy => strlcpy (CID 100679210067911006790)
* Check function return values (CID 100944210094411009440)
* Delete dead code in receive_packet (not reported by Coverity)
* Remove redundant alarm(3) in receive_packet (not reported by Coverity)

Reported by: Coverity
CID: 1006502100679210067911006790100944210094411009440
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D11287

5 years agoFix audit of chflagsat, lgetfh, and setfib
Alan Somers [Sun, 22 Jul 2018 14:11:52 +0000 (14:11 +0000)]
Fix audit of chflagsat, lgetfh, and setfib

These syscalls were always supposed to have been auditted, but due to
oversights never were.

PR: 228374
Reported by: aniketp
Reviewed by: aniketp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16388

5 years agodtb/allwinner: Build sun8i-h2-plus-orangepi-r1.dts
Ganbold Tsagaankhuu [Sun, 22 Jul 2018 14:01:49 +0000 (14:01 +0000)]
dtb/allwinner: Build sun8i-h2-plus-orangepi-r1.dts
We have a u-boot port for this board so add the dtb to the build.

5 years agogeli attach: Fix exit codes and errors not being printed after r335673
Ben Woods [Sun, 22 Jul 2018 13:40:52 +0000 (13:40 +0000)]
geli attach: Fix exit codes and errors not being printed after r335673

Now that multiple providers can be attached at once, exit codes and
error messages must be handled correctly if there are failures in on
any of the providers.

Reported by: asomers (Kyua test failures via continuous integration)
Reviewed by: asomers
Approved by: allanjude
Differential Revision: https://reviews.freebsd.org/D16386

5 years agoRemove old Kyua test files for indent(1) after a rename.
Piotr Pawel Stefaniak [Sun, 22 Jul 2018 12:45:02 +0000 (12:45 +0000)]
Remove old Kyua test files for indent(1) after a rename.

This continues work in r334944.

Reported by: asomers

5 years agorelease: Add rpi firmware dtb and mmc overlays for RPI-B and RPI2
Emmanuel Vadot [Sun, 22 Jul 2018 12:04:21 +0000 (12:04 +0000)]
release: Add rpi firmware dtb and mmc overlays for RPI-B and RPI2

This is needed with new u-boot that uses the rpi-firmware dtbs.

Reviewed by: gjb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D16240

5 years agorelease: Add arm_install_boot to install the commit boot bits
Emmanuel Vadot [Sun, 22 Jul 2018 12:03:17 +0000 (12:03 +0000)]
release: Add arm_install_boot to install the commit boot bits

This reduce the per-board arm_install_uboot to just install u-boot.
While here remove the installation of rpi.dtb and rpi2.dtb as we load
them from the UFS partition via ubldr.

Reviewed by: gjb, imp (older version)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D16239

5 years agorelease: Uniform release arm image size
Emmanuel Vadot [Sun, 22 Jul 2018 12:02:07 +0000 (12:02 +0000)]
release: Uniform release arm image size

Create a 50m fat16 for all boards.

Reviewed by: gjb
Differential Revision: https://reviews.freebsd.org/D16238

5 years agoImprove TCP related tests for dtrace.
Michael Tuexen [Sun, 22 Jul 2018 10:50:59 +0000 (10:50 +0000)]
Improve TCP related tests for dtrace.

Ensure that the TCP connections are terminated gracefully as expected
by the test. Use appropriate numbers for sent/received packets.
In addition, enable tst.localtcpstate.ksh, which should pass, but
doesn't until https://reviews.freebsd.org/D16369 is committed.

Reviewed by: markj@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16288

5 years agoNULL out cc_data in pluggable TCP {cc}_cb_destroy
Matt Macy [Sun, 22 Jul 2018 05:37:58 +0000 (05:37 +0000)]
NULL out cc_data in pluggable TCP {cc}_cb_destroy

When ABE was added (rS331214) to NewReno and leak fixed (rS333699) , it now has
a destructor (newreno_cb_destroy) for per connection state. Other congestion
controls may allocate and free cc_data on entry and exit, but the field is
never explicitly NULLed if moving back to NewReno which only internally
allocates stateful data (no entry contstructor) resulting in a situation where
newreno_cb_destory might be called on a junk pointer.

 -    NULL out cc_data in the framework after calling {cc}_cb_destroy
 -    free(9) checks for NULL so there is no need to perform not NULL checks
     before calling free.
 -    Improve a comment about NewReno in tcp_ccalgounload

This is the result of a debugging session from Jason Wolfe, Jason Eggleston,
and mmacy@ and very helpful insight from lstewart@.

Submitted by: Kevin Bowling
Reviewed by: lstewart
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D16282

5 years agoSkip the pftcl(8) tests if pf isn't loaded.
Alan Somers [Sun, 22 Jul 2018 03:58:01 +0000 (03:58 +0000)]
Skip the pftcl(8) tests if pf isn't loaded.

Previously, they would simply fail.

MFC after: 2 weeks

5 years agoFix tmpfs detection in the sys/fs/tmpfs tests
Alan Somers [Sat, 21 Jul 2018 23:54:40 +0000 (23:54 +0000)]
Fix tmpfs detection in the sys/fs/tmpfs tests

This code was originally written for NetBSD.  r306031 tried to adapt it to
FreeBSD, but didn't correctly handle the case that tmpfs was available, but
not already loaded.  Fix the logic to load the module if necessary.  The
tmpfs tests shouldn't be skipped anymore.

Also, fix a comment that was dislocated by r306031.

Reported by: Jenkins
MFC after: 2 weeks

5 years agoUse svn or svnlite, or ${SVN_CMD} if set, for extracting the SVN branch
Colin Percival [Sat, 21 Jul 2018 22:54:43 +0000 (22:54 +0000)]
Use svn or svnlite, or ${SVN_CMD} if set, for extracting the SVN branch
and revision number announced in SNS notifications about new EC2 AMIs.

While I'm here, incorporate that information into the AMI "description"
fields, since it's more useful than simply echoing the information
already provided via the AMI "name".

Approved by: gjb

5 years agoTake the mapping's segment offset into account when resolving symbols.
Mark Johnston [Sat, 21 Jul 2018 22:15:48 +0000 (22:15 +0000)]
Take the mapping's segment offset into account when resolving symbols.

Reported by: Jenkins, via asomers
MFC after: 2 weeks

5 years agoDisable optimization of the libproc test program.
Mark Johnston [Sat, 21 Jul 2018 22:10:28 +0000 (22:10 +0000)]
Disable optimization of the libproc test program.

Dead code elimination may remove symbols that are required by the tests.

Reported by: Jenkins, via asomers
MFC after: 1 week

5 years agoStop further SCSI recovery attempts after one has failed.
Alexander Motin [Sat, 21 Jul 2018 21:34:10 +0000 (21:34 +0000)]
Stop further SCSI recovery attempts after one has failed.

We've got a set of probably damaged hard disks, reporting 0x04,0x02
("Logical unit not ready, initializing command required") in response
to READ CAPACITY(16), where attempts to use START STOP UNIT for recovery
results in 0x44,0x00 ("Internal target failure") after ~1 second delay.
As result of all recovery retries, device open attempt took ~3 seconds
before finally reporting to GEOM that device is opened, but has no media.
If the open was for writing and since it hasn't formally failed, following
close triggered GEOM retaste, opening device few more times with respective
delays.

This change reduces whole time of this cycle from ~12 seconds to ~3 by
giving up on recovery after the first failure.

Reviewed by: ken
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

5 years agoEliminate a comment that doesn't apply to this pmap implementation.
Alan Cox [Sat, 21 Jul 2018 21:26:38 +0000 (21:26 +0000)]
Eliminate a comment that doesn't apply to this pmap implementation.

Coalesce the variable definitions for PV entry management.

MFC after: 3 weeks

5 years agoFix sys.fs.tmpfs.mknod_test.{char, block} by reverting r321967
Alan Somers [Sat, 21 Jul 2018 20:14:01 +0000 (20:14 +0000)]
Fix sys.fs.tmpfs.mknod_test.{char, block} by reverting r321967

In r321967 ngie "fixed" these tests by changing their expectations to match
the device numbers produced by the new ino64 code.  But it wasn't the tests
that were broken, it was the kernel.  bde fixed the kernel in r335053.

Reported by: Jenkins
MFC after: Never (only applies to >= 12)

5 years agotftpd(8): when completing an WRQ, flush the file before acknowleding receipt
Alan Somers [Sat, 21 Jul 2018 19:48:31 +0000 (19:48 +0000)]
tftpd(8): when completing an WRQ, flush the file before acknowleding receipt

tftpd(8) should flush a newly written file to disk before ACKing the final DATA
packet.  Otherwise there is a narrow race window when a subsequent read may not
see the file.  This is somewhat related to r330710, but the race window is much
smaller.  Hopefully this will fix the intermittent tests in Jenkins.

Reported by: Jenkins
MFC after: 2 weeks

5 years agoClear expected failures for aesni_aes_gcm tests
Alan Somers [Sat, 21 Jul 2018 19:28:07 +0000 (19:28 +0000)]
Clear expected failures for aesni_aes_gcm tests

These tests were fixed by r335584

PR: 228094
PR: 201447
MFC after: 2 weeks
X-MFC-With: 335584

5 years agoUse the correct DOT language syntax for an ID with a leading digit (0mp).
Mateusz Piotrowski [Sat, 21 Jul 2018 19:16:38 +0000 (19:16 +0000)]
Use the correct DOT language syntax for an ID with a leading digit (0mp).

It turns out that my username (0mp) is not a valid ID in the DOT language
because it starts with a digit. The easiest way to fix it is to put my
username in double quotes.

Reported by: pstef
Reviewed by: krion (mentor)
Approved by: krion (mentor)
Differential Revision: https://reviews.freebsd.org/D16372

5 years agoMention the Linux compatibility layer instead of the Linux emulator in the BUGS section.
Mateusz Piotrowski [Sat, 21 Jul 2018 19:09:29 +0000 (19:09 +0000)]
Mention the Linux compatibility layer instead of the Linux emulator in the BUGS section.

linux(4) explicitly states that it is not an emulator.

While here, pet mandoc and igor.

Reviewed by: mat (mentor), rpokala
Approved by: manpages (rpokala), mat (mentor)
Differential Revision: https://reviews.freebsd.org/D16375

5 years agoAdd option MAC to armv6 and armv7 kernels by default, it needs to be
Ian Lepore [Sat, 21 Jul 2018 18:54:24 +0000 (18:54 +0000)]
Add option MAC to armv6 and armv7 kernels by default, it needs to be
compiled-in to allow loading policy modules at runtime.

5 years agomakefs(8): add test case for PR 229929
Alan Somers [Sat, 21 Jul 2018 17:24:14 +0000 (17:24 +0000)]
makefs(8): add test case for PR 229929

Fix two failing makefs test cases by adding "-M 1m", which was already used
for every other FFS test case.  Add a new test case for the underlying
issue: with no -M, -m, or -s options, makefs can underestimate image size.

PR: 229929
Reported by: Jenkins
MFC after: 2 weeks

5 years agoRevert r336572 and wrap them in machine checks so they are only installed on
Brad Davis [Sat, 21 Jul 2018 17:13:39 +0000 (17:13 +0000)]
Revert r336572 and wrap them in machine checks so they are only installed on
i386.

Approved by: allanjude (mentor), imp
Differential Revision: https://reviews.freebsd.org/D16380

5 years agoaudit(4): add test cases for chflagsat(2), lgetfh(2), setfib(2)
Alan Somers [Sat, 21 Jul 2018 16:34:38 +0000 (16:34 +0000)]
audit(4): add test cases for chflagsat(2), lgetfh(2), setfib(2)

These three syscalls aren't currently audited correctly, so the tests are
marked as expected failures.

PR: 228374
Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16379

5 years agoaudit(4): add more test cases for auditon(2)
Alan Somers [Sat, 21 Jul 2018 16:26:00 +0000 (16:26 +0000)]
audit(4): add more test cases for auditon(2)

auditon(2) is an ioctl-like syscall with several different variants, each of
which has a distinct audit event.  This commit tests the remaining variants
that weren't tested in r336564.

Submitted by: aniketp
MFC after: 2 weeks
X-MFC-With: 336564
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16381

5 years agorun(4): Support the D-Link DWA-125 rev A3
Gavin Atkinson [Sat, 21 Jul 2018 14:56:15 +0000 (14:56 +0000)]
run(4): Support the D-Link DWA-125 rev A3

Submitted by: Ali Mashtizadeh
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D16029

5 years agoRaise "Report Count" value limit in HID descriptor parser.
Vladimir Kondratyev [Sat, 21 Jul 2018 14:20:17 +0000 (14:20 +0000)]
Raise "Report Count" value limit in HID descriptor parser.

This fixes usage/report size calculation of Microsoft`s "Touch Hardware
Quality Assurance" certificate blob found in many touchscreens.

While here, join several "c->flags = dval" lines in to single line.

Reviewed by: hselasky
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16357

5 years agoSet the IPv4 version in the IP header for UDP and UDPLite.
Michael Tuexen [Sat, 21 Jul 2018 02:14:13 +0000 (02:14 +0000)]
Set the IPv4 version in the IP header for UDP and UDPLite.

5 years agoSet CLSET_TIMEOUT on TCP connections to pNFS DSs.
Rick Macklem [Sat, 21 Jul 2018 01:33:07 +0000 (01:33 +0000)]
Set CLSET_TIMEOUT on TCP connections to pNFS DSs.

Use CLSET_TIMEOUT to set the timeout for connections to DSs instead of
specifying a timeout on each RPC. This is done so that SO_SNDTIMEO
is set on the TCP socket as well as specifying a time limit when
waiting for an RPC reply.  Useful if the send queue for the TCP
connection has become constipated, due to a failed DS.
The choice of lease_duration / 4 is fairly arbitrary, but seems to work
ok, with a lower bound of 10sec.
For client connections to a DS, set the retry limit to vfs.nfsd.dsretries,
which is 2 by default.
This patch should only affect pNFS connections to DSs.
This patch requires r336542.

MFC after: 2 weeks

5 years agoPurge some old apmd files
Brad Davis [Sat, 21 Jul 2018 00:12:41 +0000 (00:12 +0000)]
Purge some old apmd files

Approved by: allanjude
Differential Revision: https://reviews.freebsd.org/D16373

5 years agoRegenerate src.conf.5.
Konstantin Belousov [Fri, 20 Jul 2018 23:55:47 +0000 (23:55 +0000)]
Regenerate src.conf.5.

Sponsored by: Mellanox Technologies

5 years agoEnable OFED build (without extras) by default.
Konstantin Belousov [Fri, 20 Jul 2018 23:53:20 +0000 (23:53 +0000)]
Enable OFED build (without extras) by default.

Reviewed by: bdrewery, hselasky (previous version)
Sponsored by: Mellanox Technologies
MFC after: 2 weeks
Release notes: yes
Differential revision: https://reviews.freebsd.org/D16230

5 years agoMove mostly useless examples binaries from OFED, as well as the Subnet
Konstantin Belousov [Fri, 20 Jul 2018 23:52:11 +0000 (23:52 +0000)]
Move mostly useless examples binaries from OFED, as well as the Subnet
Manager, under the new option WITH_OFED_EXTRA, disabled by default.

Reviewed by: bdrewery, hselasky (previous version)
Sponsored by: Mellanox Technologies
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D16230

5 years agoMove OFED libraries libmlx5.so.1 and libibverbs.so.1 to /lib.
Konstantin Belousov [Fri, 20 Jul 2018 23:49:57 +0000 (23:49 +0000)]
Move OFED libraries libmlx5.so.1 and libibverbs.so.1 to /lib.

The is required because libpcap.so depends on the libraries when OFED
is enabled.

Reviewed by: bdrewery, hselasky
Sponsored by: Mellanox Technologies
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D16230

5 years agoImprove the binmiscctl manual page
Mateusz Piotrowski [Fri, 20 Jul 2018 22:50:21 +0000 (22:50 +0000)]
Improve the binmiscctl manual page

- Use "Fl -" instead of "Cm --" for long options.
- Sort options alphabetically.
- Pet "mandoc -Tlint".
- Clean up the description of the "--interpreter" option.
- Clean up the description of the first example in the examples section.
- Use ".Bd -literal -offset indent" for all example code blocks for consistency.
- Use "Nm" instead of "Cm binmiscctl".
- Indent all examples for consistency.

Reviewed by: allanjude
Approved by: mat (mentor)
Differential Revision: https://reviews.freebsd.org/D15589

5 years agoRegenerate src.conf.5 after several accumulated changes.
Konstantin Belousov [Fri, 20 Jul 2018 22:37:25 +0000 (22:37 +0000)]
Regenerate src.conf.5 after several accumulated changes.

The larger is the removal of arm/armeb architecture.  Also noted is
the addition of WITHOUT_SERVICESDB and default change for WITH_CXX.

Sponsored by: Mellanox Technologies

5 years agoAllow mounting FUSE filesystems in jails
Alan Somers [Fri, 20 Jul 2018 21:35:31 +0000 (21:35 +0000)]
Allow mounting FUSE filesystems in jails

Reviewed by: jamie
MFC after: 2 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D16371

5 years agoSeparate the audit(4) tests for auditon(2)'s individual commands
Alan Somers [Fri, 20 Jul 2018 18:59:48 +0000 (18:59 +0000)]
Separate the audit(4) tests for auditon(2)'s individual commands

auditon(2) is an ioctl-like syscall with several different variants, each of
which has a distinct audit event.  Write separate audit(4) tests for each
variant.

Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16255

5 years agoRecommit r336497: Fix powl, cpow, cpowf, and cpowl imports from OpenBSD
Dimitry Andric [Fri, 20 Jul 2018 18:27:30 +0000 (18:27 +0000)]
Recommit r336497: Fix powl, cpow, cpowf, and cpowl imports from OpenBSD

This is a follow-up to r336299.

* lib/msun/Makefile:
  . Remove polevll.c

* lib/msun/ld80/e_powl.c:
  . Copy contents of polevll.c to here.  This is the only consumer of
    these functions.  Make functions 'static inline'.
  . Make reducl a 'static inline' function.

* lib/msun/man/exp.3:
  . Remove BUGS section that no longer applies.

* lib/msun/src/math_private.h:
  . Remove prototypes of __p1evll() and __polevll()

* lib/msun/src/s_cpow.c:
* lib/msun/src/s_cpowf.c:
* lib/msun/src/s_cpowl.c
  . Include math_private.h.
  . Use the CMPLX macro from either C99 or math_private.h (depends on
    compiler support) instead of the problematic use of complex I.

Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu>
PR: 229876
MFC after: 1 week

5 years agoAdd a note about the new 'ntpd' userid, and the fact that rc.d/ntpd now
Ian Lepore [Fri, 20 Jul 2018 18:02:52 +0000 (18:02 +0000)]
Add a note about the new 'ntpd' userid, and the fact that rc.d/ntpd now
automatically runs the daemon as that user if it can.

5 years agoFix `make` in sys/modules/spigen
Li-Wen Hsu [Fri, 20 Jul 2018 17:46:55 +0000 (17:46 +0000)]
Fix `make` in sys/modules/spigen

Reviewed by: ian
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16368

5 years agoAdd knob to control tx ring abdication.
Stephen Hurd [Fri, 20 Jul 2018 17:45:26 +0000 (17:45 +0000)]
Add knob to control tx ring abdication.

r323954 changed the mp ring behaviour when 64-bit atomics were
available to abdicate the TX ring rather than having one become a
consumer thereby running to completion on TX. The consumer of the mp
ring was then triggered in the tx task rather than blocking the TX call.
While this significantly lowered the number of RX drops in small-packet
forwarding, it also negatively impacts TX performance.

With this change, the default behaviour is reverted, causing one TX ring
to become a consumer during the enqueue call. A new sysctl,
dev.X.Y.iflib.tx_abdicate is added to control this behaviour.

Reviewed by: gallatin
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D16302

5 years agoImprove netmap TX handling when TX IRQs are not used/supported
Stephen Hurd [Fri, 20 Jul 2018 17:24:45 +0000 (17:24 +0000)]
Improve netmap TX handling when TX IRQs are not used/supported

Use the timer to poll for TX completions when there are
outstanding TX slots. Track when the last driver timer was called
to prevent overcalling it. Also clean up some kring vs NIC ring
usage.

Reviewed by: marius, Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D16300

5 years agoAdd support for pmap_enter(psind = 1) to the arm64 pmap.
Mark Johnston [Fri, 20 Jul 2018 16:37:04 +0000 (16:37 +0000)]
Add support for pmap_enter(psind = 1) to the arm64 pmap.

See the commit log messages for r321378 and r336288 for descriptions of
this functionality.

Reviewed by: alc
Differential Revision: https://reviews.freebsd.org/D16303

5 years agoAnnotate a parameter as unused.
Alan Cox [Fri, 20 Jul 2018 16:31:25 +0000 (16:31 +0000)]
Annotate a parameter as unused.

X-MFC with: r336288

5 years agoInitialize the L3 page's wire count correctly after a L2 entry demotion.
Mark Johnston [Fri, 20 Jul 2018 16:31:08 +0000 (16:31 +0000)]
Initialize the L3 page's wire count correctly after a L2 entry demotion.

Reviewed by: alc
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D16303

5 years agovt/ofwfb: Fix brain-o from r336514, use the correct form of /chosen/stdout-path
Justin Hibbits [Fri, 20 Jul 2018 16:18:24 +0000 (16:18 +0000)]
vt/ofwfb: Fix brain-o from r336514, use the correct form of /chosen/stdout-path

/chosen/stdout-path is a string, not ihandle.  Treat it as such.

With this, ofwfb now starts correctly on a POWER9 system when launched from
the local console (not serial).

5 years agovt/ofwfb: Check that /chosen/stdout is valid before using it in initialization
Justin Hibbits [Fri, 20 Jul 2018 16:08:14 +0000 (16:08 +0000)]
vt/ofwfb: Check that /chosen/stdout is valid before using it in initialization

The FDT implementation of OF_instance_to_package() backend checks the
cross-reference to get the node.  On failure, this returns the input handle
unchanged.  In the case of ofwfb attachment, if /chosen/stdout property does not
exist, sc->sc_handle is either garbage or 0, which then gets propagated to node.
This will prevent "screen" from being used, resulting in not properly attaching.
Correct this by matching the code in ofwfb_probe().

5 years agoApply some late-arriving markup suggestions from the phab review, and add a
Ian Lepore [Fri, 20 Jul 2018 16:06:44 +0000 (16:06 +0000)]
Apply some late-arriving markup suggestions from the phab review, and add a
paragraph that mentions the possibility of starting ntpd as a non-root user
rather than starting it as root and using its '-u' option to drop root privs
after startup.

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

5 years agoTest that the dtrace UDP receive probe fires.
Michael Tuexen [Fri, 20 Jul 2018 15:37:29 +0000 (15:37 +0000)]
Test that the dtrace UDP receive probe fires.

This test ensures that the fix committed in
https://svnweb.freebsd.org/changeset/base/336551
actually works.

Reviewed by: dteske@, markj@, rrs@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16046

5 years agoAdd missing dtrace probes for received UDP packets.
Michael Tuexen [Fri, 20 Jul 2018 15:32:20 +0000 (15:32 +0000)]
Add missing dtrace probes for received UDP packets.

Fire UDP receive probes when a packet is received and there is no
endpoint consuming it. Fire the probe also if the TTL of the
received packet is smaller than the minimum required by the endpoint.

Clarify also in the man page, when the probe fires.

Reviewed by: dteske@, markj@, rrs@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16046

5 years agoDocument kernel/signal/crashdump devd(8) notification.
Edward Tomasz Napierala [Fri, 20 Jul 2018 14:32:36 +0000 (14:32 +0000)]
Document kernel/signal/crashdump devd(8) notification.

Discussed with: kib@
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16323

5 years agoSupport installing manpages for multiple or alternate architecture(s).
Ian Lepore [Fri, 20 Jul 2018 14:23:01 +0000 (14:23 +0000)]
Support installing manpages for multiple or alternate architecture(s).

Some section-4 manpages are architecture-specific, and the build process
currently generates only the pages for the MACHINE_CPUARCH being built.
man(1) supports a '-m' option to find manpages belonging to an arbitrary
architecture other than the MACHINE_[CPU]ARCH, but we have no way to
generate and install alternate-arch pages right now.

This change adds a new make.conf variable, MAN_ARCH, which can be a list of
one or more MACHINE_ARCH or MACHINE_CPUARCH values. All arch-specific
manpages that exist for the named arches will be installed. If unset, it
continues the behavior of installing just the MACHINE_CPUARCH being built.

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

5 years agoAutomatically run ntpd as non-root when possible.
Ian Lepore [Fri, 20 Jul 2018 13:59:29 +0000 (13:59 +0000)]
Automatically run ntpd as non-root when possible.

Ntpd needs only a subset of full root privileges to do its job. Specifically
it needs the ability to manipulate system time, and to re-bind to a
privileged UDP port after interface changes. The mac_ntpd(4) policy module
(see r336525) can grant these privs.

These changes detect the availability of mac_ntpd(4). If enabled, and if the
ntpd configuration is fairly vanilla, it automatically runs ntpd as the
non-root user 'ntpd' (uid 123). "Vanilla" means the config doesn't include
command line or ntp.conf options changing the location of files or using any
files/dirs likely to be inaccessible to user ntpd.  Ntpd can still run as
non-root when using such options, but the admin must ensure all required
files and dirs are accessible, and then set ntpd_user=ntpd in rc.conf.

Note that these changes also address PR 199127 by using the command_args
technique suggested in the patch. They also tangentially address PR 113552,
which is primarily about inconsistent filenames in documentation, but some
of the inconsistancy was caused by old code in rc.d/ntpd which is leftover
from the intial import from netbsd. There was code to do chroot setup which
required the use of the netbsd clockctl(4) device; that code never had any
effect on freebsd, because we lack that device and don't build ntpd with the
options that would allow using it.

PR: 113552 199127
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D16050

5 years agoAdd SPDX tags to example manual pages and POSIX copyright.
Mateusz Piotrowski [Fri, 20 Jul 2018 13:45:09 +0000 (13:45 +0000)]
Add SPDX tags to example manual pages and POSIX copyright.

Reviewed by: eadler
Approved by: mat (mentor)
Differential Revision: https://reviews.freebsd.org/D14958

5 years agoCentralize the complications for special efficient rounding to integers.
Bruce Evans [Fri, 20 Jul 2018 12:42:24 +0000 (12:42 +0000)]
Centralize the complications for special efficient rounding to integers.

This was open-coded in range reduction for trig and exp functions.  Now
there are 3 static inline functions rnint[fl]() that replace open-coded
expressions, and type-generic irint() and i64rint() macros that hide the
complications for efficiently using non-generic irint() and irintl()
functions and casts.

Special details:

ld128/e_rem_pio2l.h needs to use i64rint() since it needs a 46-bit integer
result.  Everything else only needs a (less than) 32-bit integer result so
uses irint().

Float and double cases now use float_t and double_t locally instead of
STRICT_ASSIGN() to avoid bugs in extra precision.

On amd64, inline asm is now only used for irint() on long doubles.  The SSE
asm for irint() on amd64 only existed because the ifdef tangles made the
correct method of simply casting to int for this case non-obvious.

5 years agoSet SO_SNDTIMEO in the client side krpc when CLSET_TIMEOUT is done.
Rick Macklem [Fri, 20 Jul 2018 12:03:16 +0000 (12:03 +0000)]
Set SO_SNDTIMEO in the client side krpc when CLSET_TIMEOUT is done.

During testing of the pNFS client, it was observed that an RPC could get
stuck in sosend() for a very long time if the network connection to a DS
had failed. This is fixed by setting SO_SNDTIMEO on the TCP socket.
This is only done when CLSET_TIMEOUT is done and this is not done by any
use of the krpc currently in the source tree, so there should be no effect
on extant uses.
A future patch will use CLSET_TIMEOUT for TCP connections to DSs.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16293

5 years agolibcrypt: There is no need to clear message digest context after they
Xin LI [Fri, 20 Jul 2018 07:16:28 +0000 (07:16 +0000)]
libcrypt: There is no need to clear message digest context after they
are finialized after r336539, so do not do it.

Submitted by: David CARLIER <devnexen gmail com>
MFC after: 1 month (after r336539)
Differential Revision: https://reviews.freebsd.org/D16059

5 years agoGet rid of unused variables.
Xin LI [Fri, 20 Jul 2018 07:07:27 +0000 (07:07 +0000)]
Get rid of unused variables.

copied_key and copied_salt are assigned with NULL and never used
otherwise. Remove the two variables and related code.

Reviewed by: pfg
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16314

5 years agolibmd: Always erase context in _Final method, and when doing
Xin LI [Fri, 20 Jul 2018 07:01:28 +0000 (07:01 +0000)]
libmd: Always erase context in _Final method, and when doing
it, consistently use explicit_bzero().

Update manual pages to match the behavior.

Reviewed by: pfg, allanjude, jmg
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D16316

5 years agoBump version to 1200075 for zfsloader being folded into loader.
Warner Losh [Fri, 20 Jul 2018 05:34:02 +0000 (05:34 +0000)]
Bump version to 1200075 for zfsloader being folded into loader.

As an aside: 1200074 should be used as the last version with big
endian arm support, should that be needed. it was actually removed
a day later, but no bump was made until now.

5 years agoMention zfsloader being folded into loader in UPDATING.
Warner Losh [Fri, 20 Jul 2018 05:26:36 +0000 (05:26 +0000)]
Mention zfsloader being folded into loader in UPDATING.

5 years agoRemove three stray instances of zfsloader.
Warner Losh [Fri, 20 Jul 2018 05:26:14 +0000 (05:26 +0000)]
Remove three stray instances of zfsloader.

5 years agoHoist EFI_TARGET and SOURCE_DATE_EPOCH up into efi/Makefile.inc
Warner Losh [Fri, 20 Jul 2018 05:18:03 +0000 (05:18 +0000)]
Hoist EFI_TARGET and SOURCE_DATE_EPOCH up into efi/Makefile.inc

5 years agoNM and OBJCOPY are already defined for all builds. There's no need to
Warner Losh [Fri, 20 Jul 2018 05:17:56 +0000 (05:17 +0000)]
NM and OBJCOPY are already defined for all builds. There's no need to
conditionally define them here.

5 years agoEliminate zfsloader man page.
Warner Losh [Fri, 20 Jul 2018 05:17:49 +0000 (05:17 +0000)]
Eliminate zfsloader man page.

Remove all cross references to zfsloader.8 and /boot/zfsloader.
Move ZFS specific info into loader.8.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16361

5 years agoCollapse zfsloader functionality back down into loader.
Warner Losh [Fri, 20 Jul 2018 05:17:37 +0000 (05:17 +0000)]
Collapse zfsloader functionality back down into loader.

We no longer really need a separate zfsloader. It was useful when we
were first supporting ZFS and had limited ability to properly boot off
of ZFS without the special boot loader. Now that the boot loader has
matured, go the way loader.efi pioneered and just build one
binary. Change the name of the loader to load in the secondary boot
blocks to be just /boot/loader. Provide a symbolic link from zfsloader
to loader so people who have not upgraded their boot blocks are not
affected. This has the happy benefit of making coexistence easier as
well (fewer binaries in the matrix).

Discussed with: allanjude@, kevans@
RelNotes: Yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16361

5 years agoRemove a redundant declaration.
Cy Schubert [Fri, 20 Jul 2018 02:25:39 +0000 (02:25 +0000)]
Remove a redundant declaration.

While at it add a blank line, conforming with the convention
used in this file.

X-MFC-with: r336203

5 years agoTo reduce our diff between our sources and our upline, sync up
Cy Schubert [Fri, 20 Jul 2018 02:17:19 +0000 (02:17 +0000)]
To reduce our diff between our sources and our upline, sync up
with upline. Also making it easier to read.

Obtained from: diffing base with ports
X-MFC-with: r336203

5 years agoMFV: r336486
Cy Schubert [Fri, 20 Jul 2018 02:04:10 +0000 (02:04 +0000)]
MFV: r336486

Prevent reinstallation of an already in-use group key.
Upline git commit cb5132bb35698cc0c743e34fe0e845dfc4c3e410.

Obtained from: https://w1.fi/security/2017-1/\
rebased-v2.6-0002-Prevent-reinstallation-\
of-an-already-in-use-group-ke.patch
X-MFC-with: r336203

5 years agoRevert r336501. It was a of the wrong rev from the vendor branch.
Cy Schubert [Fri, 20 Jul 2018 01:53:28 +0000 (01:53 +0000)]
Revert r336501. It was a of the wrong rev from the vendor branch.

5 years agocryptocheck: Correct mismatch between OpenSSL use and OCF Blake2
Conrad Meyer [Fri, 20 Jul 2018 01:51:05 +0000 (01:51 +0000)]
cryptocheck: Correct mismatch between OpenSSL use and OCF Blake2

This corrects a mistake introduced to the cryptocheck tool in r331418.

Our CRYPTO_BLAKE2B and CRYPTO_BLAKE2S algorithms refer to either the plain,
unkeyed hashes (specified with cri_klen = 0), or a Blake2-specific keyed MAC
(when a cri_key is provided).

In contrast, OpenSSL's Blake2 algorithms only provide the plain hash.
Cryptocheck's T_HMAC corresponds to OpenSSL's HMAC() routine, which is the
ordinary HMAC construction applied to any plain, unkeyed hash.  We don't
have any HMAC-Blake2 cipher modes in OCF, so fix the test to only test
Blake2 as a plain hash.

(Ideally we would test keyed Blake2 as well, but that is left as future
work.)

PR: 229795

5 years agoAdd ntpd to the list of users/groups to check before installing.
Ian Lepore [Fri, 20 Jul 2018 00:44:04 +0000 (00:44 +0000)]
Add ntpd to the list of users/groups to check before installing.

5 years agoMake it possible to run ntpd as a non-root user, add ntpd uid and gid.
Ian Lepore [Thu, 19 Jul 2018 23:55:29 +0000 (23:55 +0000)]
Make it possible to run ntpd as a non-root user, add ntpd uid and gid.

Code analysis and runtime analysis using truss(8) indicate that the only
privileged operations performed by ntpd are adjusting system time, and
(re-)binding to privileged UDP port 123. These changes add a new mac(4)
policy module, mac_ntpd(4), which grants just those privileges to any
process running with uid 123.

This also adds a new user and group, ntpd:ntpd, (uid:gid 123:123), and makes
them the owner of the /var/db/ntp directory, so that it can be used as a
location where the non-privileged daemon can write files such as the
driftfile, and any optional logfile or stats files.

Because there are so many ways to configure ntpd, the question of how to
configure it to run without root privs can be a bit complex, so that will be
addressed in a separate commit. These changes are just what's required to
grant the limited subset of privs to ntpd, and the small change to ntpd to
prevent it from exiting with an error if running as non-root.

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

5 years agoNote big endian arm removal.
Warner Losh [Thu, 19 Jul 2018 23:54:18 +0000 (23:54 +0000)]
Note big endian arm removal.

5 years agoarm64: Add vt_efifb to GENERIC
Emmanuel Vadot [Thu, 19 Jul 2018 21:59:52 +0000 (21:59 +0000)]
arm64: Add vt_efifb to GENERIC

We can now have efifb being setup correctly.
Enjoy video output on some boards when you couldn't before.

Tested-On:  Pine64
Tested-On:  Pine64-LTS
Tested-On:  Pinebook

5 years agoRaise the size of L3 table for early devmap on arm64
Emmanuel Vadot [Thu, 19 Jul 2018 21:58:06 +0000 (21:58 +0000)]
Raise the size of L3 table for early devmap on arm64

Some driver (like efifb) needs to map more than the current L2_SIZE
Raise the size so we can map the framebuffer setup by the bootloader.

Reviewed by: cognet

5 years agoRevert r336509. Fails buildworld.
Justin Hibbits [Thu, 19 Jul 2018 21:06:58 +0000 (21:06 +0000)]
Revert r336509.  Fails buildworld.

I had naively assumed that building kernel would be sufficient to test that
the header is sane.  However, it turns out this now needs -fms-extensions to
build.  Rather than sprinkling -fms-extensions all over the place, revert
for now, and revisit with a better fix.

5 years agoofwfb: Check for /chosen/stdout-path in addition to /chosen/stdout
Justin Hibbits [Thu, 19 Jul 2018 20:22:46 +0000 (20:22 +0000)]
ofwfb: Check for /chosen/stdout-path in addition to /chosen/stdout

Some platforms use /chosen/stdout-path as the property containing the path to
the stdout node, not /chosen/stdout.

5 years agoWhitespace changes due to changes in ident.
Michael Tuexen [Thu, 19 Jul 2018 20:16:33 +0000 (20:16 +0000)]
Whitespace changes due to changes in ident.

5 years agoMerge the md_page structs for AIM and Book-E into a single unioned struct
Justin Hibbits [Thu, 19 Jul 2018 20:13:33 +0000 (20:13 +0000)]
Merge the md_page structs for AIM and Book-E into a single unioned struct

Summary:
Ports like sysutils/lsof troll through kernel structures, and
therefore include kernel headers and all the dirty secrets involved.  struct
vm_page includes the struct md_page inline, which currently is only defined
if AIM or BOOKE is defined.  Thus, by default, sysutils/lsof cannot build,
due to the struct md_page having an incomplete type.  Fix this by merging
the two struct definitions into an anonymous struct-union.

A similar change could be made to unify the pmap structures as well.

Reviewed By: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D16232

5 years agoRevert https://svnweb.freebsd.org/changeset/base/336503
Michael Tuexen [Thu, 19 Jul 2018 20:11:14 +0000 (20:11 +0000)]
Revert https://svnweb.freebsd.org/changeset/base/336503
since I also ran the export script with different parameters.

5 years agoDelete an XXX comment addressed by r336505.
Mark Johnston [Thu, 19 Jul 2018 20:11:08 +0000 (20:11 +0000)]
Delete an XXX comment addressed by r336505.

X-MFC with: r336505
Sponsored by: The FreeBSD Foundation

5 years agoMFV r336490:
Cy Schubert [Thu, 19 Jul 2018 20:10:34 +0000 (20:10 +0000)]
MFV r336490:

Prevent installation of an all-zero TK.
This is also upline git commit 53bb18cc8b7a4da72e47e4b3752d0d2135cffb23.

Obtained from: https://w1.fi/security/2017-1/\
rebased-v2.6-0004-Prevent-installation-\
of-an-all-zero-TK.patch
X-MFC-with: r336203

5 years agoHave preload_delete_name() free pages backing preloaded data.
Mark Johnston [Thu, 19 Jul 2018 20:00:28 +0000 (20:00 +0000)]
Have preload_delete_name() free pages backing preloaded data.

On i386 and amd64, add a vm_phys segment for physical memory used to
store the kernel binary and other preloaded data.  This makes it
possible to free such memory back to the system once it is no longer
needed, e.g., when a preloaded kernel module is unloaded.  Previously,
it would have remained unused.

Reviewed by: kib, royger
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16330

5 years agoProvide the full module path to preload_delete_name().
Mark Johnston [Thu, 19 Jul 2018 19:50:42 +0000 (19:50 +0000)]
Provide the full module path to preload_delete_name().

The basename will never match against the preload metadata, so these
calls previously had no effect.

Reviewed by: kib, royger
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16330

5 years agoWhitespace changes due to change if ident.
Michael Tuexen [Thu, 19 Jul 2018 19:33:42 +0000 (19:33 +0000)]
Whitespace changes due to change if ident.

5 years agoMFV: r336486
Cy Schubert [Thu, 19 Jul 2018 19:22:26 +0000 (19:22 +0000)]
MFV: r336486

Prevent reinstallation of an already in-use group key.
Upline git commit cb5132bb35698cc0c743e34fe0e845dfc4c3e410.

Obtained from: https://w1.fi/security/2017-1/\
rebased-v2.6-0002-Prevent-reinstallation-\
of-an-already-in-use-group-ke.patch
X-MFC-with: r336203

5 years agoRevert r336497 for now, as it breaks on architectures using gcc, with:
Dimitry Andric [Thu, 19 Jul 2018 19:07:25 +0000 (19:07 +0000)]
Revert r336497 for now, as it breaks on architectures using gcc, with:

cc1: warnings being treated as errors
/usr/src/lib/msun/src/s_cpow.c: In function 'cpow':
/usr/src/lib/msun/src/s_cpow.c:63: warning: implicit declaration of function 'CMPLX'

5 years agoMFV: r336485
Cy Schubert [Thu, 19 Jul 2018 19:04:30 +0000 (19:04 +0000)]
MFV: r336485

Address: hostapd: Avoid key reinstallation in FT handshake

Obtained from: https://w1.fi/security/2017-1/\
rebased-v2.6-0001-hostapd-Avoid-key-\
reinstallation-in-FT-handshake.patch
X-MFC-with: r336203

5 years agoWhen reporting an error, print the errno value.
Konstantin Belousov [Thu, 19 Jul 2018 19:03:18 +0000 (19:03 +0000)]
When reporting an error, print the errno value.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoFix powl, cpow, cpowf, and cpowl imports from OpenBSD
Dimitry Andric [Thu, 19 Jul 2018 18:44:10 +0000 (18:44 +0000)]
Fix powl, cpow, cpowf, and cpowl imports from OpenBSD

This is a follow-up to r336299.

* lib/msun/Makefile:
  . Remove polevll.c

* lib/msun/ld80/e_powl.c:
  . Copy contents of polevll.c to here.  This is the only consumer of
    these functions.  Make functions 'static inline'.
  . Make reducl a 'static inline' function.

* lib/msun/man/exp.3:
  . Remove BUGS section that no longer applies.

* lib/msun/src/math_private.h:
  . Remove prototypes of __p1evll() and __polevll()

* lib/msun/src/s_cpow.c:
* lib/msun/src/s_cpowf.c:
* lib/msun/src/s_cpowl.c
  . Use the CMPLX macro from either C99 or math_private.h (depends of
    compiler support) instead of the problematic use of complex I.

Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu>
PR: 229876
MFC after: 1 week

5 years agoStop writing past the end of the buffer in the msgget_limit test. The value
Andrew Turner [Thu, 19 Jul 2018 17:13:46 +0000 (17:13 +0000)]
Stop writing past the end of the buffer in the msgget_limit test. The value
in i is already correct to write to the last item in the buf array.

Obtained from: CheriBSD
Sponsored by: DARPA, AFRL

5 years agoRevert r329254. The underlying cause for the copy-on-write problem in
Alan Cox [Thu, 19 Jul 2018 17:01:10 +0000 (17:01 +0000)]
Revert r329254.  The underlying cause for the copy-on-write problem in
multithreaded programs that was addressed by r329254 was in the
implementation of pmap_enter() on some architectures, notably, amd64.
kib@, markj@ and I have audited all of the pmap_enter() implementations,
and fixed the broken ones, specifically, amd64 (r335784, r335971), i386
(r336092), mips (r336248), and riscv (r336294).

To be clear, the reason to address the problem within pmap_enter() and
revert r329254 is not just a matter of principle.  An effect of r329254
was that a copy-on-write fault actually entailed two page faults, not
one, even for single-threaded programs.  Now, in the expected case for
either single- or multithreaded programs, we are back to a single page
fault to complete a copy-on-write operation.  (In extremely rare
circumstances, a multithreaded program could suffer two page faults.)

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

5 years agoImport upline security patch: Prevent installation of an all-zero TK
Cy Schubert [Thu, 19 Jul 2018 16:58:20 +0000 (16:58 +0000)]
Import upline security patch: Prevent installation of an all-zero TK
This is also upline git commit 53bb18cc8b7a4da72e47e4b3752d0d2135cffb23.

Obtained from: https://w1.fi/security/2017-1/\
rebased-v2.6-0004-Prevent-installation-\
of-an-all-zero-TK.patch