]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoSay a little more about the new protocol.
imp [Mon, 23 Jul 2018 22:15:36 +0000 (22:15 +0000)]
Say a little more about the new protocol.

Requested by: emaste@

5 years agoarch.7: fix whitespace from r336435
emaste [Mon, 23 Jul 2018 21:09:57 +0000 (21:09 +0000)]
arch.7: fix whitespace from r336435

Previously armeb's Final Release rendered as 'Ta 11.x'.

Sponsored by: The FreeBSD Foundation

5 years agoFinalize the boot manager protocol support for next-stage boot
imp [Mon, 23 Jul 2018 20:36:59 +0000 (20:36 +0000)]
Finalize the boot manager protocol support for next-stage boot
loading.

If we are booting in a conforming UEFI Boot Manager Environment, then
use the BootCurrent variable to find the BootXXXX we're using. Once we
find that, then if it contains more than one EFI_DEVICE_PATH in its
what to boot section, try to use the last one as the kernel to
load. This will also set the default root partition as well. If
there's only one path, or if there's an error along the way, assume
that nothing specific was specified and revert to the old
algorithm. If something was specified, but not found, then fail the
boot. Otherwise you that, specific thing. On FreeBSD, this can be set
using efibootmgr -l <loader> -k <kernel>. We try a few variations of
kernel to cope with the fact that UEFI comes from a DOS world where
paths might be upper case and/or contain back-slashes.

Note: In an ideal world, we'd work out where we are in chain loading
by looking at the passed-in image handle and doing name
matching. However, that's unreliable since at least boot1.efi booted
images don't have that, hence the assumption that loader.efi needs to
load the last thing on the list, if possible.

The reason we fail for something specific is so that we can fully
participate in the UEFI Boot Manager Protocol and fail over to the
next item in the list of BootOrder choices when something goes wrong
at this stage.

This implements was was talked about in freebsd-arch@ last year
https://docs.freebsd.org/cgi/getmsg.cgi?fetch=3576+0+archive/2017/freebsd-arch/20171022.freebsd-arch
and documented in full (after changed resulting from the discussion) in
https://docs.google.com/document/d/1aK9IqF-60JPEbUeSAUAkYjF2W_8EnmczFs6RqCT90Jg/edit#
although one or two minor details may have been modified in this
implementation to make it work, and the ZFS MEDIA PATH extension isn't
implemented. This does not yet move things to ESP:\efi\freebsd\loader.efi.

RelNotes: Yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16403

5 years agoImplement efiblk_get_pdinfo_by_device_path
imp [Mon, 23 Jul 2018 20:36:54 +0000 (20:36 +0000)]
Implement efiblk_get_pdinfo_by_device_path

Lookup a block device by it's device path. We use a 'loose' lookup
whereby we scan forward to the first Media Path portion of the device
path, then look at all our handles for one whose first Media Path
matches. This will also work if the device path pointed to has a
following file path (or paths) as that's ignored. It assumes that
there's only one media path node that describes the entire device,
which is true as of the latest UEFI spec (2.7 Errata A) as far as I've
been able to determine.

Sponsored by: Netflix

5 years agoImplement efi_devpath_length
imp [Mon, 23 Jul 2018 20:36:50 +0000 (20:36 +0000)]
Implement efi_devpath_length

Return the total length, in bytes, of the device path (including the
terminating node at the end).

Sponsored by: Netflix

5 years agoImplement efi_devpath_match_node
imp [Mon, 23 Jul 2018 20:36:45 +0000 (20:36 +0000)]
Implement efi_devpath_match_node

Returns true if the first node pointed to by devpath1 is identical to
the first node pointed to by devpath2, with care taken to not read
past the end of the valid parts of either devpath1 or
devpath2. Otherwise, returns false.

Sponsored by: Netflix

5 years agoStore the number of handles we get back in efipart_nhandles rather
imp [Mon, 23 Jul 2018 20:36:41 +0000 (20:36 +0000)]
Store the number of handles we get back in efipart_nhandles rather
than the number of bytes. Don't divide by the element size every time
we have to iterate. Eliminate now-unused variables.

Sponsored by: Netflix

5 years agoImplement efi_devpath_to_media_path
imp [Mon, 23 Jul 2018 20:36:25 +0000 (20:36 +0000)]
Implement efi_devpath_to_media_path

Takes a generic device path as its input. Scans through it to find the
first media_path node in it and returns a pointer to it. If none is
found, NULL is returned.

Sponsored by: Netflix

5 years agoUse __riscv to determine building for RISC-V
lwhsu [Mon, 23 Jul 2018 19:49:54 +0000 (19:49 +0000)]
Use __riscv to determine building for RISC-V

Reviewed by: br
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16398

5 years agoarch.7: Clarify architecture-specific macro use
emaste [Mon, 23 Jul 2018 19:39:20 +0000 (19:39 +0000)]
arch.7: Clarify architecture-specific macro use

Compilers may define multiple variants of architecture-specific macros
(for example, both __x86_64 and __x86_64__).  Add a note that the macros
documented in arch.7 are the preferred ones for FreeBSD.

Sponsored by: The FreeBSD Foundation

5 years agoNow that we set the busy_detect bit in the bas to support setting it
imp [Mon, 23 Jul 2018 19:27:11 +0000 (19:27 +0000)]
Now that we set the busy_detect bit in the bas to support setting it
for the console, set our override in the bas as well.

Tested by: emaste@

5 years agoSupport compressed crash dumps in crashinfo(8).
jhb [Mon, 23 Jul 2018 18:08:56 +0000 (18:08 +0000)]
Support compressed crash dumps in crashinfo(8).

Temporarily decompress a copy of a crash dump compressed with either
gzip or zstd and run various tools against the decompressed copy while
generating the crash information.  The uncompressed copy is deleted when
the script exits.

Note that crashinfo is enabled by default, so this will attempt to
decompress the most recent compressed crash dump after a crash that
generates a compressed crash dump.  Users who wish to only do offline
analysis of compressed crash dumps can disable crashinfo in rc.conf.

Tested by: ler
Reviewed by: markj
MFC after: 2 weeks

5 years agoRevert r336619, it appears to cause problems with ssh, and probably other
ian [Mon, 23 Jul 2018 17:26:38 +0000 (17:26 +0000)]
Revert r336619, it appears to cause problems with ssh, and probably other
things which use pw_scan().

5 years agofix incorrect operator in the AUDITPIPE_SET_QLIMIT bounds check
avg [Mon, 23 Jul 2018 16:56:49 +0000 (16:56 +0000)]
fix incorrect operator in the AUDITPIPE_SET_QLIMIT bounds check

PR: 229983
Submitted by: Aniket Pandey <aniketp@iitk.ac.in>
Reported by: Aniket Pandey <aniketp@iitk.ac.in>
MFC after: 1 week

5 years agoAdd the initial DIRS infrastructure for creating directories with the
brd [Mon, 23 Jul 2018 16:11:03 +0000 (16:11 +0000)]
Add the initial DIRS infrastructure for creating directories with the
necessary owner, group, mode and flags.

Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D16405

5 years agofollow-up to r336635, update TAILQ to CK_SLIST for ie_handlers
avg [Mon, 23 Jul 2018 15:36:55 +0000 (15:36 +0000)]
follow-up to r336635, update TAILQ to CK_SLIST for ie_handlers

arm, mips and sparc64 were affected.

5 years agoRevert r336625 until I figure out why it worked with simple testing but
ian [Mon, 23 Jul 2018 14:58:44 +0000 (14:58 +0000)]
Revert r336625 until I figure out why it worked with simple testing but
reportedly fails the kyua tests and causes other real-world problems.

Reported by: cy@ asomers@

5 years agochange interrupt event's list of handlers from TAILQ to CK_SLIST
avg [Mon, 23 Jul 2018 12:51:23 +0000 (12:51 +0000)]
change interrupt event's list of handlers from TAILQ to CK_SLIST

The primary reason for this commit is to separate mechanical and nearly
mechanical code changes from an upcoming fix for unsafe teardown of
shared interrupt handlers that have only filters (see D15905).

The technical rationale is that SLIST is sufficient.  The only operation
that gets worse performance -- O(n) instead of O(1) is a removal of a
handler,  but it is not a critical operation and the list is expected to
be rather short.

Additionally, it is easier to reason about SLIST when considering the
concurrent lock-free access to the list from the interrupt context and
the interrupt thread.

CK_SLIST is used because the upcoming change depends on the memory order
provided by CK_SLIST insert and the fact that CL_SLIST remove does not
trash the linkage in a removed element.

While here, I also fixed a couple of whitespace issues, made code under
ifdef notyet compilable, added a lock assertion to ithread_update() and
made intr_event_execute_handlers() static as it had no external callers.

Reviewed by: cem (earlier version)
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D16016

5 years agoMFV CK@r336629: Import CK as of commit 1c1f9901c2dea7a883342cd03d3906a1bc482583
avg [Mon, 23 Jul 2018 11:21:43 +0000 (11:21 +0000)]
MFV CK@r336629: Import CK as of commit 1c1f9901c2dea7a883342cd03d3906a1bc482583

This adds CK_SLIST_INSERT_PREVPTR and CK_SLIST_REMOVE_PREVPTR macros
as well as ck_pr_dec_is_zero family of functions.

MFC after: 3 weeks

5 years agoFix setjmp for RISC-V:
br [Mon, 23 Jul 2018 09:54:28 +0000 (09:54 +0000)]
Fix setjmp for RISC-V:
o The correct value for _JB_SIGMASK is 27.
o The storage size for double-precision floating
  point register is 8 bytes.

Submitted by: "James Clarke" <jrtc4@cam.ac.uk>
Reviewed by: markj@
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16344

5 years agoUpdate modify counter when setting a mixer control.
hselasky [Mon, 23 Jul 2018 09:16:23 +0000 (09:16 +0000)]
Update modify counter when setting a mixer control.

PR: 229969
MFC after: 1 week

5 years agoRemove duplicated entry
uqs [Mon, 23 Jul 2018 08:52:57 +0000 (08:52 +0000)]
Remove duplicated entry

5 years agoepair(4): make sure we do not duplicate MAC addresses
eugen [Mon, 23 Jul 2018 07:11:58 +0000 (07:11 +0000)]
epair(4): make sure we do not duplicate MAC addresses
in case of reused if_index.

PR: 229957
Tested by: O. Hartmann <ohartmann@walstatt.org>
Approved by: avg (mentor)

5 years agoFix the attempt to see if we're overriding the console in the command
imp [Mon, 23 Jul 2018 06:38:48 +0000 (06:38 +0000)]
Fix the attempt to see if we're overriding the console in the command
line args. I had thought console would be NULL, but it's efi. Set it
to efi (as a clue) before we initialize the console, then test it to
see if it changed on the command line to do the automatic
override. This gets my serial console back.

5 years agoOlder zfs boot blocks don't support symlinks. install the link to
imp [Mon, 23 Jul 2018 06:04:05 +0000 (06:04 +0000)]
Older zfs boot blocks don't support symlinks. install the link to
zfsloader as a hard link. While newer ones do, the whole point of the
link was to transition to the new world order smoothly. A hard link is
less flexible, but it works and will result in fewer bumps. Adjust
UPDATING entry to match.

5 years agoMake pw(8) showuser work the same with or without -R <path> for non-root
ian [Sun, 22 Jul 2018 23:41:40 +0000 (23:41 +0000)]
Make pw(8) showuser work the same with or without -R <path> for non-root
users.  Without -R, pw(8) uses getpwnam(3), which will open master.passwd
for the root user or passwd for non-root users.  With -R <path> pw(8) was
always opening <path>/master.passwd, which would fail for a non-root user,
then falsely claim the userid you're trying to show doesn't exist.

Now for a non-root user it opens <path>/passwd and zeroes out the 3 fields
that aren't available in the passwd file, which duplicates the behavior of
getpwnam(3).  The net effect is that the showuser output is identical
whether using -R or not.

5 years agofix use of empty in Makefile.ec2
mmacy [Sun, 22 Jul 2018 23:33:48 +0000 (23:33 +0000)]
fix use of empty in Makefile.ec2

empty() takes a variable name - not the expanded value

Reported by: sjg

5 years agoAdd busy detect quirk to list of console options
mmacy [Sun, 22 Jul 2018 23:32:21 +0000 (23:32 +0000)]
Add busy detect quirk to list of console options

This change allows one to set the busy_detect flag
required by the synopsys UART at the loader prompt.
This is needed by the EPYC 3000 SoC.

This will give users a working console up to the point where getty is required:
hw.uart.console="mm:0xfedc9000,rs:2,bd:1"

Reviewed by: imp
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D16399

5 years agoCorrectly reference SRCTOP, avoid multiple invocations of svn
mmacy [Sun, 22 Jul 2018 23:20:24 +0000 (23:20 +0000)]
Correctly reference SRCTOP, avoid multiple invocations of svn

Reported by: sjg

5 years agofix build non-svn checkouts post r336593
mmacy [Sun, 22 Jul 2018 22:57:52 +0000 (22:57 +0000)]
fix build non-svn checkouts post r336593

The change made in r336593 assumes that the build is happening in a
svn checkout resulting in misleading debug output. Check that we're
actually working in an svn checkout before proceeding to call svn.

5 years agoAdd udma_barrier definitions for RISC-V
lwhsu [Sun, 22 Jul 2018 22:35:17 +0000 (22:35 +0000)]
Add udma_barrier definitions for RISC-V

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

5 years agoSet the pw_class field to NULL when scanning the non-master passwd file.
ian [Sun, 22 Jul 2018 22:34:20 +0000 (22:34 +0000)]
Set the pw_class field to NULL when scanning the non-master passwd file.
This avoids a null pointer deref in pw_dup(), which assumes that all
pointers are either NULL or valid.

5 years agoTemporarily disable the sys/acl/00 and sys/acl/02 tests
asomers [Sun, 22 Jul 2018 21:00:11 +0000 (21:00 +0000)]
Temporarily disable the sys/acl/00 and sys/acl/02 tests

These tests are failing due to PR 229930.  Unfortunately, TAP tests can't be
marked as expected failures.

PR: 229930
Reported by: Jenkins

5 years agoFix a potential use after free in getsockopt() access to inp_options
mmacy [Sun, 22 Jul 2018 20:02:14 +0000 (20:02 +0000)]
Fix a potential use after free in getsockopt() access to inp_options

Discussed with: jhb
Reviewed by: sbruno, transport
MFC after: 2 weeks
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14621

5 years agoUse the right buffer size when calling snprintf().
markj [Sun, 22 Jul 2018 18:31:15 +0000 (18:31 +0000)]
Use the right buffer size when calling snprintf().

PR: 229952

5 years agoAdd a regression test for PR 131876.
markj [Sun, 22 Jul 2018 18:07:08 +0000 (18:07 +0000)]
Add a regression test for PR 131876.

PR: 131876
MFC after: 1 week

5 years agoauditd(8): Log a better error when no hostname is set in audit_control
asomers [Sun, 22 Jul 2018 18:06:42 +0000 (18:06 +0000)]
auditd(8): Log a better error when no hostname is set in audit_control

Cherry-pick from https://github.com/openbsm/openbsm/commit/01ba03b

Reviewed by: cem
Obtained from: OpenBSM
MFC after: 2 weeks
Pull Request: https://github.com/openbsm/openbsm/pull/38

5 years agoUse the maximum of isc_tx_{nsegments,tso_segments_max} for MAX_TX_DESC.
marius [Sun, 22 Jul 2018 17:51:11 +0000 (17:51 +0000)]
Use the maximum of isc_tx_{nsegments,tso_segments_max} for MAX_TX_DESC.
Since r336313, TSO support for LEM-class devices is removed again as it
was before the conversion of {l,}em(4) to iflib(4) in r311849 and as a
result, isc_tx_tso_segments_max is 0 for LEM-class devices now. Thus,
inappropriate watermarks were used for this class.

This is really only a band-aid, though, because so far iflib(9) doesn't
fully take into account that DMA engines can support different maxima
of segments for transfers of TSO and non-TSO packets. For example, the
DESC_RECLAIMABLE macro is based on isc_tx_nsegments while MAX_TX_DESC
used isc_tx_tso_segments_max only. For most in-tree consumers that
doesn't make a difference as the maxima are the same for both kinds of
transfers (that is, apart from the fact that TSO may require up to 2
sentinel descriptors but also not with every MAC supported). However,
isc_tx_nsegments is 8 but isc_tx_tso_segments_max is 85 by default
with ixl(4).

5 years ago- Given that the controlling expression of the receive loop in iflib_rxeof()
marius [Sun, 22 Jul 2018 17:45:44 +0000 (17:45 +0000)]
- Given that the controlling expression of the receive loop in iflib_rxeof()
  tests for avail > 0, avail can never be 0 within that loop. Thus, move
  decrementing avail and budget_left into the loop and before the code which
  checks for additional descriptors having become available in case all the
  previous ones have been processed but there still is budget left so the
  latter code works as expected. [1]
- In iflib_{busdma_load_mbuf_sg,parse_header}(), remove dead stores to m
  and n respectively. [2, 3]
- In collapse_pkthdr(), ensure that m_next isn't NULL before dereferencing
  it. [4]
- Remove a duplicate assignment of segs in iflib_encap().

Reported by: Coverity
CID: 1356027 [1], 1356047 [2], 1368205 [3], 1356028 [4]

5 years agoo In em_if_update_admin_status():
marius [Sun, 22 Jul 2018 17:40:13 +0000 (17:40 +0000)]
o In em_if_update_admin_status():
  - Don't bother calling if_setbaudrate(9) as iflib_link_state_change(9)
    takes care of that,
  - correctly check for E1000_CTRL_EXT_LINK_MODE_GMII in E1000_CTRL_EXT [1],
  - properly convert the uint16_t link_speed to a uint64_t baudrate by
    using IF_Mbps() which contains an appropriate cast [2],
  - remove the duplicate link down announcement when bootverbose isn't
    zero and bring the remaining one in line with the other link state
    messages.
o Remove a dead store to rid in em_if_msix_intr_assign(). [3]
o Or in the DMA coalescing Rx threshold so the other bits set in E1000_DMACR
  remain intact as intended in igb_init_dmac(). [4]

Reported by: Coverity
CID: 1378464 [1], 1368765 [2], 1381681 [3], 1304929 [4]

5 years agoFix several Coverity warnings in tftp
asomers [Sun, 22 Jul 2018 17:10:12 +0000 (17:10 +0000)]
Fix several Coverity warnings in tftp

Some of the changes are in the libexec/tftpd directory, but to functions that
are only used by tftp(1) (they share some code).

* strcpy => strlcpy (1006793100679410067961006741)
* Unchecked return value and TOCTTOU (1009314)
* NULL pointer dereference (10180351018036)

Reported by: Coverity
CID: 100679310067941006796100674110093141018035
CID: 1018036
MFC after: 2 weeks

5 years agoAlpha-sort the list of user/group IDs to check at install time.
ian [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 [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 [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)
asomers [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
asomers [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 [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
woodsb02 [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.
pstef [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
manu [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
manu [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
manu [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.
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
mmacy [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.
asomers [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
asomers [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
cperciva [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.
markj [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.
markj [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.
mav [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.
alc [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
asomers [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
asomers [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
asomers [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).
0mp [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.
0mp [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 [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
asomers [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
brd [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)
asomers [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)
asomers [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 [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.
wulf [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.
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.
rmacklem [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
brd [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.
kib [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.
kib [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
kib [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.
kib [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
0mp [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.
kib [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
asomers [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
asomers [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
dim [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 [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
lwhsu [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.
shurd [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
shurd [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.
markj [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.
alc [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.
markj [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
jhibbits [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
jhibbits [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 [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.
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.
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.
trasz [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 [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 [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