]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agouefi.8: note that UEFI and EFI are used interchangeably
emaste [Wed, 24 Jan 2018 21:20:24 +0000 (21:20 +0000)]
uefi.8: note that UEFI and EFI are used interchangeably

6 years agouefi.8: update HISTORY and remove incomplete AUTHORS
emaste [Wed, 24 Jan 2018 21:11:35 +0000 (21:11 +0000)]
uefi.8: update HISTORY and remove incomplete AUTHORS

- EFI support appeared in 5.0 for ia64
- arm64 UEFI support added in 11.0

The AUTHORS section included the folks responsible for the bulk of the
work to bring UEFI support to amd64, but missed those who did the
original work on ia64, the initial port to i386, the ports to arm64 and
arm, and have generally maintained and improved general UEFI support
since then.  It's unwieldly to include everyone and would quickly become
outdated again anyhow, so just remove the AUTHORS section.

Reviewed by: manu
Discussed with: jhb
Differential Revision: https://reviews.freebsd.org/D14033

6 years agoStore IV in output buffer in GCM software fallback when requested.
jhb [Wed, 24 Jan 2018 20:16:48 +0000 (20:16 +0000)]
Store IV in output buffer in GCM software fallback when requested.

Properly honor the lack of the CRD_F_IV_PRESENT flag in the GCM
software fallback case for encryption requests.

Submitted by: Harsh Jain @ Chelsio
Sponsored by: Chelsio Communications

6 years agoDon't read or generate an IV until all error checking is complete.
jhb [Wed, 24 Jan 2018 20:15:49 +0000 (20:15 +0000)]
Don't read or generate an IV until all error checking is complete.

In particular, this avoids edge cases where a generated IV might be
written into the output buffer even though the request is failed with
an error.

Sponsored by: Chelsio Communications

6 years agoExpand the software fallback for GCM to cover more cases.
jhb [Wed, 24 Jan 2018 20:14:57 +0000 (20:14 +0000)]
Expand the software fallback for GCM to cover more cases.

- Extend ccr_gcm_soft() to handle requests with a non-empty payload.
  While here, switch to allocating the GMAC context instead of placing
  it on the stack since it is over 1KB in size.
- Allow ccr_gcm() to return a special error value (EMSGSIZE) which
  triggers a fallback to ccr_gcm_soft().  Move the existing empty
  payload check into ccr_gcm() and change a few other cases
  (e.g. large AAD) to fallback to software via EMSGSIZE as well.
- Add a new 'sw_fallback' stat to count the number of requests
  processed via the software fallback.

Submitted by: Harsh Jain @ Chelsio (original version)
Sponsored by: Chelsio Communications

6 years agoClamp DSGL entries to a length of 2KB.
jhb [Wed, 24 Jan 2018 20:13:07 +0000 (20:13 +0000)]
Clamp DSGL entries to a length of 2KB.

This works around an issue in the T6 that can result in DMA engine
stalls if an error occurs while processing a DSGL entry with a length
larger than 2KB.

Submitted by: Harsh Jain @ Chelsio
Sponsored by: Chelsio Communications

6 years agoFail crypto requests when the resulting work request is too large.
jhb [Wed, 24 Jan 2018 20:12:00 +0000 (20:12 +0000)]
Fail crypto requests when the resulting work request is too large.

Most crypto requests will not trigger this condition, but a request
with a highly-fragmented data buffer (and a resulting "large" S/G
list) could trigger it.

Sponsored by: Chelsio Communications

6 years agoDon't discard AAD and IV output data for AEAD requests.
jhb [Wed, 24 Jan 2018 20:11:00 +0000 (20:11 +0000)]
Don't discard AAD and IV output data for AEAD requests.

The T6 can hang when processing certain AEAD requests if the request
sets a flag asking the crypto engine to discard the input IV and AAD
rather than copying them into the output buffer.  The existing driver
always discards the IV and AAD as we do not need it.  As a workaround,
allocate a single "dummy" buffer when the ccr driver attaches and
change all AEAD requests to write the IV and AAD to this scratch
buffer.  The contents of the scratch buffer are never used (similar to
"bogus_page"), and it is ok for multiple in-flight requests to share
this dummy buffer.

Submitted by: Harsh Jain @ Chelsio (original version)
Sponsored by: Chelsio Communications

6 years agoReject requests with AAD and IV larger than 511 bytes.
jhb [Wed, 24 Jan 2018 20:08:10 +0000 (20:08 +0000)]
Reject requests with AAD and IV larger than 511 bytes.

The T6 crypto engine's control messages only support a total AAD
length (including the prefixed IV) of 511 bytes.  Reject requests with
large AAD rather than returning incorrect results.

Sponsored by: Chelsio Communications

6 years agoAlways set the IV location to IV_NOP.
jhb [Wed, 24 Jan 2018 20:06:02 +0000 (20:06 +0000)]
Always set the IV location to IV_NOP.

The firmware ignores this field in the FW_CRYPTO_LOOKASIDE_WR work
request.

Submitted by: Harsh Jain @ Chelsio
Sponsored by: Chelsio Communications

6 years agoAlways store the IV in the immediate portion of a work request.
jhb [Wed, 24 Jan 2018 20:04:08 +0000 (20:04 +0000)]
Always store the IV in the immediate portion of a work request.

Combined authentication-encryption and GCM requests already stored the
IV in the immediate explicitly.  This extends this behavior to block
cipher requests to work around a firmware bug.  While here, simplify
the AEAD and GCM handlers to not include always-true conditions.

Submitted by: Harsh Jain @ Chelsio
Sponsored by: Chelsio Communications

6 years agoAdopt revision 1.76 and 1.77 from NetBSD:
ae [Wed, 24 Jan 2018 19:48:25 +0000 (19:48 +0000)]
Adopt revision 1.76 and 1.77 from NetBSD:
  Fix a vulnerability in IPsec-IPv6-AH, that allows an attacker to remotely
  crash the kernel with a single packet.

  In this loop we need to increment 'ad' by two, because the length field
  of the option header does not count the size of the option header itself.

  If the length is zero, then 'count' is incremented by zero, and there's
  an infinite loop. Beyond that, this code was written with the assumption
  that since the IPv6 packet already went through the generic IPv6 option
  parser, several fields are guaranteed to be valid; but this assumption
  does not hold because of the missing '+2', and there's as a result a
  triggerable buffer overflow (write zeros after the end of the mbuf,
  potentially to the next mbuf in memory since it's a pool).

  Add the missing '+2', this place will be reinforced in separate commits.

Reported by: Maxime Villard <maxv at NetBSD.org>
MFC after: 1 week

6 years agomalloc(9): Change nominal size to size_t to match standard C
cem [Wed, 24 Jan 2018 19:37:18 +0000 (19:37 +0000)]
malloc(9): Change nominal size to size_t to match standard C

No functional change -- size_t matches unsigned long on all platforms.

Reported by: bde
Discussed with: jhb
Sponsored by: Dell EMC Isilon

6 years agoMerge revision 1.35 from NetBSD:
ae [Wed, 24 Jan 2018 19:06:44 +0000 (19:06 +0000)]
Merge revision 1.35 from NetBSD:
  fix pointer/offset mistakes in handling of IPv4 options

Reported by: Maxime Villard <maxv at NetBSD.org>
MFC after: 1 week

6 years agoMake the trivial imx_soc_family() function an inline in imx_machdep.h.
ian [Wed, 24 Jan 2018 18:10:11 +0000 (18:10 +0000)]
Make the trivial imx_soc_family() function an inline in imx_machdep.h.

The imx_machdep.c file is on the fast path to non-existance and this would
be the only thing left in it after some watchdog changes are completed.

6 years agotest-system-compiler: Display X_ variants for compiler/linker.
bdrewery [Wed, 24 Jan 2018 18:09:44 +0000 (18:09 +0000)]
test-system-compiler: Display X_ variants for compiler/linker.

Sponsored by: Dell EMC

6 years agoX_COMPILER_* may not be defined.
bdrewery [Wed, 24 Jan 2018 18:08:37 +0000 (18:08 +0000)]
X_COMPILER_* may not be defined.

Sponsored by: Dell EMC

6 years agoext2fs|ufs:Unsign some values related to allocation.
pfg [Wed, 24 Jan 2018 17:58:48 +0000 (17:58 +0000)]
ext2fs|ufs:Unsign some values related to allocation.

When allocating memory through malloc(9), we always expect the amount of
memory requested to be unsigned as a negative value would either stand for
an error or an overflow.
Unsign some values, found when considering the use of mallocarray(9), to
avoid unnecessary casting. Also consider that indexes should be of
at least the same size/type as the upper limit they pretend to index.

MFC after: 2 weeks

6 years agoReformat indentation to match other imx5/6 register definition headers, and
ian [Wed, 24 Jan 2018 17:52:06 +0000 (17:52 +0000)]
Reformat indentation to match other imx5/6 register definition headers, and
tweak some comments.  No functional changes.

6 years agoMark the unused argument to continue_thread() as such.
jhb [Wed, 24 Jan 2018 17:46:20 +0000 (17:46 +0000)]
Mark the unused argument to continue_thread() as such.

clang in HEAD and 11 does not warn about this, but clang in 10 does.

6 years agotime(1): use clock_gettime(2) instead of gettimeofday(2)
asomers [Wed, 24 Jan 2018 17:12:34 +0000 (17:12 +0000)]
time(1): use clock_gettime(2) instead of gettimeofday(2)

This is a prerequisite to adding support for the monotonic clock

Reviewed by: ken, imp
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D14030

6 years agoAdd SPDX identifiers to linux_ptrace.c and cfumass.c.
trasz [Wed, 24 Jan 2018 17:04:01 +0000 (17:04 +0000)]
Add SPDX identifiers to linux_ptrace.c and cfumass.c.

MFC after: 2 weeks

6 years agoAdd SPDX tags to iscsi(4).
trasz [Wed, 24 Jan 2018 16:58:26 +0000 (16:58 +0000)]
Add SPDX tags to iscsi(4).

MFC after: 2 weeks

6 years agoRevert r327781, r328093, r328056:
pfg [Wed, 24 Jan 2018 16:44:57 +0000 (16:44 +0000)]
Revert r327781,  r328093, r328056:
ufs|ext2fs: Revert uses of mallocarray(9).

These aren't really useful: drop them.
Variable unsigning will be brought again later.

6 years agoAdd SPDX tags to autofs(5).
trasz [Wed, 24 Jan 2018 16:40:26 +0000 (16:40 +0000)]
Add SPDX tags to autofs(5).

MFC after: 2 weeks

6 years agoAdd SPDX tags for automount(8) et al.
trasz [Wed, 24 Jan 2018 16:39:02 +0000 (16:39 +0000)]
Add SPDX tags for automount(8) et al.

MFC after: 2 weeks

6 years agoAdd missing SPDX tags for ctld(8).
trasz [Wed, 24 Jan 2018 16:37:29 +0000 (16:37 +0000)]
Add missing SPDX tags for ctld(8).

MFC after: 2 weeks

6 years agoAdd missing SPDX identifier in iscsid(8).
trasz [Wed, 24 Jan 2018 16:34:37 +0000 (16:34 +0000)]
Add missing SPDX identifier in iscsid(8).

MFC after: 2 weeks

6 years agoAdd SPDX identifiers for uefisign(8) sources.
trasz [Wed, 24 Jan 2018 16:33:33 +0000 (16:33 +0000)]
Add SPDX identifiers for uefisign(8) sources.

MFC after: 2 weeks

6 years agoMFV r328323,328324:
mm [Wed, 24 Jan 2018 14:24:17 +0000 (14:24 +0000)]
MFV r328323,328324:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #893: delete dead ppmd7 alloc callbacks
  PR #904: Fix archive freeing bug in bsdcat
  PR #961: Fix ZIP format names
  PR #962: Don't modify attributes for existing directories
           when ARCHIVE_EXTRACT_NO_OVERWRITE is set
  PR #964: Fix -Werror=implicit-fallthrough= for GCC 7
  PR #970: zip: Allow backslash as path separator

MFC after: 1 week

6 years agoSupport configuring arbitrary limits(1) for any daemon in rc.conf
amdmi3 [Wed, 24 Jan 2018 14:15:06 +0000 (14:15 +0000)]
Support configuring arbitrary limits(1) for any daemon in rc.conf

Usage is ${name}_limits, and the argument is any flags accepted by
limits(1), such as `-n 100' (e.g. only allow 100 open files).

Approved by: cy
Differential Revision: https://reviews.freebsd.org/D14015

6 years agoReverting r328320
wma [Wed, 24 Jan 2018 13:57:01 +0000 (13:57 +0000)]
Reverting r328320

6 years agoProperly implement the "id" callback argument in the "idr_for_each" function
hselasky [Wed, 24 Jan 2018 13:37:07 +0000 (13:37 +0000)]
Properly implement the "id" callback argument in the "idr_for_each" function
in the LinuxKPI. The old implementation assumed only one IDR layer was present.
Take additional IDR layers into account when computing the "id" value.

MFC after: 1 week
Found by: Karthik Palanichamy <karthikp@chelsio.com>
Tested by: Karthik Palanichamy <karthikp@chelsio.com>
Sponsored by: Mellanox Technologies

6 years agoWhen IPv6 packet is handled by O_REJECT opcode, convert ICMP code
ae [Wed, 24 Jan 2018 12:40:28 +0000 (12:40 +0000)]
When IPv6 packet is handled by O_REJECT opcode, convert ICMP code
specified in the arg1 into ICMPv6 destination unreachable code according
to RFC7915.

Obtained from: Yandex LLC
MFC after: 2 weeks
Sponsored by: Yandex LLC

6 years agoPPC: Add KASSERT in intrcnt_add which checks for buffer overflow
wma [Wed, 24 Jan 2018 12:01:32 +0000 (12:01 +0000)]
PPC: Add KASSERT in intrcnt_add which checks for buffer overflow

Authored by:           Patryk Duda <pdk@semihalf.com>
Submitted by:          Wojciech Macek <wma@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies

6 years agovendor/libarchive/dist: Add new files missing in r328323
mm [Wed, 24 Jan 2018 11:03:18 +0000 (11:03 +0000)]
vendor/libarchive/dist: Add new files missing in r328323

6 years agoUpdate libarchive to git 2d9156bb3ad92c43c1e81546f4a2c21549ba248f
mm [Wed, 24 Jan 2018 11:01:12 +0000 (11:01 +0000)]
Update libarchive to git 2d9156bb3ad92c43c1e81546f4a2c21549ba248f

Relevant vendor changes:
  PR #893: delete dead ppmd7 alloc callbacks
  PR #904: Fix archive freeing bug in bsdcat
  PR #961: Fix ZIP format names
  PR #962: Don't modify attributes for existing directories
           when ARCHIVE_EXTRACT_NO_OVERWRITE is set
  PR #964: Fix -Werror=implicit-fallthrough= for GCC 7
  PR #970: zip: Allow backslash as path separator

6 years agoAdded missing CTLFLAG_VNET to lacp default_strict_mode
smh [Wed, 24 Jan 2018 10:13:14 +0000 (10:13 +0000)]
Added missing CTLFLAG_VNET to lacp default_strict_mode

Added CTLFLAG_VNET to net.link.lagg.lacp.default_strict_mode which was missed
in r290450.

Reported by: julian@
MFC after: 1 week
Sponsored by: Multiplay

6 years agoULE: provide defaults to ts_cpu
wma [Wed, 24 Jan 2018 07:54:05 +0000 (07:54 +0000)]
ULE: provide defaults to ts_cpu

Fix a bug when the system has no CPU 0. When created, threads were implicitly assigned to CPU 0.
This had no practical effect since a real CPU was chosen immediately by the scheduler. However,
on systems without a CPU 0, sched_ule attempted to access the scheduler queue of the "old" CPU
when assigned the initial choice of the old one. This caused an attempt to use illegal memory
and a crash (or, more usually, a deadlock). Fix this by assigned new threads to the BSP
explicitly and add some asserts to see that this problem does not recur.

Authored by:           Nathan Whitehorn <nwhitehorn@freebsd.org>
Submitted by:          Wojciech Macek <wma@semihalf.com>
Obtained from:         Semihalf
Differential revision: https://reviews.freebsd.org/D13932

6 years agom4: add annotations to various functions
eadler [Wed, 24 Jan 2018 07:01:44 +0000 (07:01 +0000)]
m4: add annotations to various functions

Explain to the compiler that several functions are either noreturn or
take printf like arguments

Discussed with: swildner@DragonFlyBSD.org

6 years agoImport tzdata 2018c
philip [Wed, 24 Jan 2018 06:48:42 +0000 (06:48 +0000)]
Import tzdata 2018c

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

MFC after: 3 days

6 years agoImport tzdata 2018c
philip [Wed, 24 Jan 2018 06:45:03 +0000 (06:45 +0000)]
Import tzdata 2018c

6 years agocxgb(4): Validate offset/len in the GET_EEPROM ioctl.
np [Wed, 24 Jan 2018 05:16:11 +0000 (05:16 +0000)]
cxgb(4): Validate offset/len in the GET_EEPROM ioctl.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>

6 years agoDo not generate illegal mbuf chains during IP fragment reassembly. Only
np [Wed, 24 Jan 2018 05:09:21 +0000 (05:09 +0000)]
Do not generate illegal mbuf chains during IP fragment reassembly.  Only
the first mbuf of the reassembled datagram should have a pkthdr.

This was discovered with cxgbe(4) + IPSEC + ping with payload more than
interface MTU.  cxgbe can generate !M_WRITEABLE mbufs and this results
in m_unshare being called on the reassembled datagram, and it complains:

panic: m_unshare: m0 0xfffff80020f82600, m 0xfffff8005d054100 has M_PKTHDR

PR: 224922
Reviewed by: ae@
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D14009

6 years agopf: States have at least two references
kp [Wed, 24 Jan 2018 04:29:16 +0000 (04:29 +0000)]
pf: States have at least two references

pf_unlink_state() releases a reference to the state without checking if
this is the last reference. It can't be, because pf_state_insert()
initialises it to two. KASSERT() that this is always the case.

CID: 1347140

6 years agoFollow changes in r328307 by using new IIC_RECURSIVE flag.
ian [Wed, 24 Jan 2018 03:09:56 +0000 (03:09 +0000)]
Follow changes in r328307 by using new IIC_RECURSIVE flag.

The driver now ensures only one thread at a time is running in the API
functions (clock_gettime() and clock_settime()) by specifically requesting
ownership of the i2c bus without using IIC_RECURSIVE, then it does all IO
using IIC_RECURSIVE so that each individual IO operation doesn't try to
re-acquire the bus.

The other IO done by the driver happens at attach or intr_config_hooks time,
when there can't be multiple threads running with the same device instance.
So, the IIC_RECURSIVE flag can be safely ORed into the wait flags for all IO
done by the driver, because it's all either done in a single-threaded
environment, or protected within a block bounded by explict
iicbus_acquire_bus() and iicbus_release_bus() calls.

6 years agoFollow changes in r328307 by using new IIC_RECURSIVE flag.
ian [Wed, 24 Jan 2018 03:09:41 +0000 (03:09 +0000)]
Follow changes in r328307 by using new IIC_RECURSIVE flag.

The driver now ensures only one thread at a time is running in the API
functions (clock_gettime() and clock_settime()) by specifically requesting
ownership of the i2c bus without using IIC_RECURSIVE, then it does all IO
using IIC_RECURSIVE so that each individual IO operation doesn't try to
re-acquire the bus.

The other IO done by the driver happens at attach or intr_config_hooks time,
when there can't be multiple threads running with the same device instance.
So, the IIC_RECURSIVE flag can be safely ORed into the wait flags for all IO
done by the driver, because it's all either done in a single-threaded
environment, or protected within a block bounded by explict
iicbus_acquire_bus() and iicbus_release_bus() calls.

6 years agoFix a bug introduced with recursive bus ownership support in r321584.
ian [Tue, 23 Jan 2018 23:30:19 +0000 (23:30 +0000)]
Fix a bug introduced with recursive bus ownership support in r321584.

The recursive ownership support added in r321584 was unconditionally in
effect all the time -- whenever a given i2c slave device instance tried to
lock the i2c bus for exclusive use when it already owned the bus, the call
returned immediately without waiting.  However, many i2c slave drivers use
bus ownership to enforce that only a single thread at a time can be using
the slave device.  The recursive locking changes broke this use case.

Now there is a new flag, IIC_RECURSIVE, which can be mixed in with the
other flags passed to iicbus_acquire_bus() to allow drivers to indicate
when recursive locking is desired.  Using the flag implies that the driver
is managing concurrent access to the device by different threads in some way.

This immediately fixes all existing i2c slave drivers except for the two
i2c RTC drivers which use the recursive locking feature; those will be
fixed in a followup commit.

6 years agoRemove some KSE references from ps(1).
jhb [Tue, 23 Jan 2018 22:48:06 +0000 (22:48 +0000)]
Remove some KSE references from ps(1).

- Simplify the description of -H to assume 1:1 threading.
- Drop 'process' from description of 'lwp' field and the corresponding
  XO field name.
- Do add an expansion of LWP in the description of 'lwp' and 'nlwps'.
- Add 'tid' as an alias for the 'lwp' field.

Reviewed by: imp, kib (older version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14021

6 years agolibcxxrt: Move mangled symbols out of extern "C++" in Version.map
emaste [Tue, 23 Jan 2018 22:41:13 +0000 (22:41 +0000)]
libcxxrt: Move mangled symbols out of extern "C++" in Version.map

r260553 added a number of mangled C++ symbols to Version.map inside of
an existing `extern "C++"` block.

ld.bfd 2.17.50 treats `extern "C++"` permissively and will match both
mangled and demangled symbols against the strings in the version map
block.  ld.lld interprets `extern "C++"` strictly, and matches only
demangled symbols.

I believe lld's behaviour is correct.  Contemporary versions of ld.bfd
also behave as lld does, so move the mangled symbols out of the
`extern "C++"` block.

PR: 225128, 185663
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoIn the C library, the setting up of the group array by various
mckusick [Tue, 23 Jan 2018 22:18:45 +0000 (22:18 +0000)]
In the C library, the setting up of the group array by various
utilities is done by calling gr_addgid() for each group to be
added (usually found by traversing /etc/group) then calling the
setgroups() system call after the group set has been created.
The gr_addgid() function (helpfully?) deduplicates the addition
of group members. So, if you call it to add a group member that
already exists, it is just dropped. Because group[0] is the
effective group-ID and is over-written when a setgid program
is run, The value in group[0] is usually duplicated so that
group value is not lost when a setgid program is run.

Historically this happened because the group value indicated
in the password file also appears in /etc/group (e.g., if you
are group staff in the password file, you will also appear in
the staff line in /etc/group). But, with the addition of the
deduplication, the attempt to add group staff was lost because
it already appeared in group[0]. So, the fix is to deduplicate
starting from group[1] which allows a duplicate of the entry in
group[0], but not in later entries.

There is some confusion about the setgroups system call because in
BSD it has (always) set the entire group including the egid group
(in group[0]). However, in Linux, it skips over group[0] and starts
setting from group[1]. See this comment from linux_setgroups:

      /*
       * cr_groups[0] holds egid. Setting the whole set from
       * the supplied set will cause egid to be changed too.
       * Keep cr_groups[0] unchanged to prevent that.
       */

To make it clear what the BSD setgroups system call does, I
added the following paragraph to the setgroups(2) manual page:

   The first entry of the group array (gidset[0]) is used as the effective
   group-ID for the process.  This entry is over-written when a setgid
   program is run.  To avoid losing access to the privileges of the
   gidset[0] entry, it should be duplicated later in the group array.
   By convention, this happens because the group value indicated in the
   password file also appears in /etc/group.  The group value in the
   password file is placed in gidset[0] and that value then gets added a
   second time when the /etc/group file is scanned to create the group set.

Reported by: Paul McMath  paulm at tetrardus.net
Reviewed by: kib
MFC after:   2 weeks

6 years agoSwitch to using the bcd_clocktime conversion functions that validate the BCD
ian [Tue, 23 Jan 2018 21:36:26 +0000 (21:36 +0000)]
Switch to using the bcd_clocktime conversion functions that validate the BCD
data without panicking, and have common code for handling AM/PM mode.

6 years agoSwitch to using the bcd_clocktime conversion functions that validate the BCD
ian [Tue, 23 Jan 2018 21:31:43 +0000 (21:31 +0000)]
Switch to using the bcd_clocktime conversion functions that validate the BCD
data without panicking, and have common code for handling AM/PM mode.

6 years agoSwitch to using the bcd_clocktime conversion functinos that validate the BCD
ian [Tue, 23 Jan 2018 21:18:15 +0000 (21:18 +0000)]
Switch to using the bcd_clocktime conversion functinos that validate the BCD
data without panicking, and have common code for handling AM/PM mode.

6 years agocopyright.h: Update license text to 'THE AUTHOR'
emaste [Tue, 23 Jan 2018 20:38:03 +0000 (20:38 +0000)]
copyright.h: Update license text to 'THE AUTHOR'

This matches the license text at
https://www.freebsd.org/copyright/freebsd-license.html

Sponsored by: The FreeBSD Foundation

6 years agoUse BSD-2-Clause-FreeBSD license on linux_support.s
emaste [Tue, 23 Jan 2018 20:35:43 +0000 (20:35 +0000)]
Use BSD-2-Clause-FreeBSD license on linux_support.s

These files previously had a 3-clause license and 'THE REGENTS' text.
Switch to standard 2-clause text with kib's approval, and add the SPDX
tag.

Approved by: kib

6 years agoDon't escape '?'s in protocol output.
brooks [Tue, 23 Jan 2018 20:07:51 +0000 (20:07 +0000)]
Don't escape '?'s in protocol output.

This isn't required by mandoc and is nonfunctional in groff.

PR: 224632
Reported by: w.schwarzenfeld@utanet.at
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D13779

6 years agosys/netinet6: fix typos in comments. No functional change.
asomers [Tue, 23 Jan 2018 19:40:05 +0000 (19:40 +0000)]
sys/netinet6: fix typos in comments.  No functional change.

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agostand/fdt: Fallback to `name` + ".dtbo" if we fail to load `name`
kevans [Tue, 23 Jan 2018 18:03:13 +0000 (18:03 +0000)]
stand/fdt: Fallback to `name` + ".dtbo" if we fail to load `name`

This behavior also matches a Linux-ism by allowing fdt_overlays to specify
names of overlays without an extension, e.g. fdt-overlays="sunxi-h3-h5-emac"

If we fail to load the file given by a name in fdt_overlays, try again with
".dtbo" appended to it. This still allows overlays to lack .dtbo extension
if user prefers it and just adds a fallback cushion.

Future work could move this from a hard-coded ".dtbo" to a loader.conf(5)
configuration option.

Reviewed by: gonzo
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13968

6 years agoThere's no tainted data here, tag it as such to avoid the slew of
imp [Tue, 23 Jan 2018 18:01:40 +0000 (18:01 +0000)]
There's no tainted data here, tag it as such to avoid the slew of
false positives. The files the boot loader reads are assumed to be
good.

CID: 1006663,1006665,12650131265014 (possibly more)
Sponsored by: Netflix

6 years agogetenv does not return tainted data in the boot loader. Attempt to
imp [Tue, 23 Jan 2018 18:01:36 +0000 (18:01 +0000)]
getenv does not return tainted data in the boot loader. Attempt to
clue Coverity into that fact.

Sponsored by: Netflix

6 years agoOn malloc failure, be sure to close the include file that triggered
imp [Tue, 23 Jan 2018 18:01:32 +0000 (18:01 +0000)]
On malloc failure, be sure to close the include file that triggered
it.

CID: 1007775
Sponsored by: Netflix

6 years agoDon't leak memory when displaying help.
imp [Tue, 23 Jan 2018 18:01:27 +0000 (18:01 +0000)]
Don't leak memory when displaying help.

Right now, we'll leak memory when we display a help topic because we
don't free t, s, d that we've just used when breaking out of the loop.
NB: coverity just reported t, but s and d also leak.

CID: 1007776

6 years agoFix some resource leaks.
imp [Tue, 23 Jan 2018 18:01:17 +0000 (18:01 +0000)]
Fix some resource leaks.

Always free dev and fstyp before strduping new values to assign to
them. Free them at the end of the loop. This keeps them from leaking
for mal-formed /etc/fstab lines.

CID: 100777710077781007779
Sponsored by: Netflix

6 years agoAdd /boot/overlays to runtime pkg, fix distrib-dirs METALOG generation
kevans [Tue, 23 Jan 2018 17:59:06 +0000 (17:59 +0000)]
Add /boot/overlays to runtime pkg, fix distrib-dirs METALOG generation

/boot/overlays was recently added without belonging to a package. It's only
used by bootloaders at the moment, so add it to the 'runtime' package to get
added with ubldr and friends.

Fix distrib-dirs METALOG generation while we're here. History elsewhere
seems to indicate that bapt@ fixed this to pull in all attributes from
mtrees while generating the METALOG. This fix got clobbered somewhere later,
so restore it.

Reviewed by: bapt, gjb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13996

6 years agolld: Don't mark a shared library as needed because of a lazy symbol.
emaste [Tue, 23 Jan 2018 17:54:39 +0000 (17:54 +0000)]
lld: Don't mark a shared library as needed because of a lazy symbol.

Obtained from: LLVM r323221 by Rafael EspĂ­ndola

6 years agoBump Copyright year following r328283.
gjb [Tue, 23 Jan 2018 16:48:31 +0000 (16:48 +0000)]
Bump Copyright year following r328283.

MFC after: 3 days
MFC with: r328283
Sponsored by: The FreeBSD Foundation

6 years agoWhen CHROOTBUILD_SKIP is set, evaluate the existence of /bin/sh
gjb [Tue, 23 Jan 2018 16:41:31 +0000 (16:41 +0000)]
When CHROOTBUILD_SKIP is set, evaluate the existence of /bin/sh
within the CHROOTDIR.  If it does not exist, unset CHROOTBUILD_SKIP
to prevent build failures.

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

6 years agoFill in ut_id. While it's not relevant to the {OLD,NEW}_TIME entries,
imp [Tue, 23 Jan 2018 15:34:34 +0000 (15:34 +0000)]
Fill in ut_id. While it's not relevant to the {OLD,NEW}_TIME entries,
we shouldn't leak stack garbage into the field.

Sponsored by: Netflix

6 years agosockstat: add break that was forgot in 328279
manu [Tue, 23 Jan 2018 14:33:19 +0000 (14:33 +0000)]
sockstat: add break that was forgot in 328279

Reported by: garga@
MFC after: 1 week
X-MFC With: 328279
Sponsored by: Gandi.net

6 years agoextfs: Remove unused variables.
pfg [Tue, 23 Jan 2018 14:17:04 +0000 (14:17 +0000)]
extfs: Remove unused variables.

Found by: scan-build
Reviewed by: fsu
Differential Revision: https://reviews.freebsd.org/D14017

6 years agosockstat: Add -q option to suppress the header line
manu [Tue, 23 Jan 2018 13:03:47 +0000 (13:03 +0000)]
sockstat: Add -q option to suppress the header line

MFC after: 1 week
Sponsored by: Gandi.net

6 years agoPowerNV: send MSI_EOI always after MSI unmask
wma [Tue, 23 Jan 2018 08:07:00 +0000 (08:07 +0000)]
PowerNV: send MSI_EOI always after MSI unmask

MSI/MSI-x interrupts are edge-triggered. If an interrupt
arrives when IRQ line is masked, it will be lost and will
never recover. Perform MSI_EOI always after unmask to give
a chance for PHB/XICS to send an interrupt again if MSI/MSI-x
pending bit is set in MSI/MSI-x BAR space.

Submitted by:          Wojciech Macek <wma@semihalf.org>
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies

6 years agoDocument how to load nmdm(4) from a kernel module.
delphij [Tue, 23 Jan 2018 03:36:49 +0000 (03:36 +0000)]
Document how to load nmdm(4) from a kernel module.

Submitted by: kevlo
MFC after: 2 weeks

6 years agoIncrement the route table gen count after a modify
rstone [Tue, 23 Jan 2018 03:15:44 +0000 (03:15 +0000)]
Increment the route table gen count after a modify

Increment the route table generation count after modifying a
route.  This signals back to TCP connections that they need to
update their L2 caches as the gateway for their route may have
changed.  This is a heavier hammer than is needed, strictly
speaking, but route changes will be unlikely enough that the
performance effects of invalidating all connection route caches
should be negligible.

MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13990
Reviewed by: karels

6 years agoReduce code duplication for inpcb route caching
rstone [Tue, 23 Jan 2018 03:15:39 +0000 (03:15 +0000)]
Reduce code duplication for inpcb route caching

Add a new macro to clear both the L3 and L2 route caches, to
hopefully prevent future instances where only the L3 cache was
cleared when both should have been.

MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13989
Reviewed by: karels

6 years agoInvalidate inpcb LLE cache if cached route is invalidated
rstone [Tue, 23 Jan 2018 03:15:39 +0000 (03:15 +0000)]
Invalidate inpcb LLE cache if cached route is invalidated

When the inpcb route cache is invalidated after a change to the
routing tables, we need to invalidate the LLE cache as well.
Previous to this change packets for the connection would continue
to use the old L2 information from the old L3 gateway, and the
packets for the connection would likely be blackholed.

MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13988
Reviewed by: karels

6 years agoFix 64-bit booke kernel builds after the ldscript changes
jhibbits [Tue, 23 Jan 2018 02:52:12 +0000 (02:52 +0000)]
Fix 64-bit booke kernel builds after the ldscript changes

Commits r326203 and r326978 broke 64-bit booke kernels by introducing a 1MB
zero-pad between the ELF header and the start of the kernel.  This didn't
cause a build failure, but caused kernels to need to be loaded into memory
1MB lower, which could easily break scripts expecting previous behavior.
This change matches the similar change made to AIM in r327358.

6 years agomlock(2): correct documentation for error conditions.
asomers [Mon, 22 Jan 2018 21:45:54 +0000 (21:45 +0000)]
mlock(2): correct documentation for error conditions.

The man page is years out of date regarding errors. Our implementation _does_
allow unaligned addresses, and it _does_not_ check for negative lengths,
because the length is unsigned. It checks for overflow instead.

Update the tests accordingly.

Reviewed by: bcr
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D13826

6 years agoixv(4): Stop setting editing ifnet flags in ixv_if_init()
erj [Mon, 22 Jan 2018 20:56:21 +0000 (20:56 +0000)]
ixv(4): Stop setting editing ifnet flags in ixv_if_init()

In iflib, the device-specific init() function isn't supposed to edit
the struct ifnet driver flags. If it does, it'll cause an MPASS() assert
in iflib to fail.

PR: 225312
Reported by: bhughes@

6 years agoFix compat32 for sysctl net.PF_ROUTE...NET_RT_IFLISTL.
kib [Mon, 22 Jan 2018 20:49:17 +0000 (20:49 +0000)]
Fix compat32 for sysctl net.PF_ROUTE...NET_RT_IFLISTL.

Route messages are aligned to the host long type alignment, which
breaks 32bit.

Reported and tested by: lwhsu
Diagnosed by: Yuri Pankov <yuripv@icloud.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agolibregex: Add a symbol map
kevans [Mon, 22 Jan 2018 18:40:19 +0000 (18:40 +0000)]
libregex: Add a symbol map

kib points out that trying to re-use symbol versioning from libc is dirty
and wrong. The implementation in libregex is incompatible by design with the
implementation in libc. Using the symbol versions from libc can and likely
will cause confusions for linkers and bring unexpected behavior for
consumers that unwillingly (transitively) link against libregex.

Reported by: kib

6 years agoThis comment is bogus. This is a legit release.
imp [Mon, 22 Jan 2018 17:47:49 +0000 (17:47 +0000)]
This comment is bogus. This is a legit release.

Reviewed by: scottl@, ken@
Sponsored by: Netflix

6 years agodrm2: Basic use of mallocarray(9).
pfg [Mon, 22 Jan 2018 15:55:51 +0000 (15:55 +0000)]
drm2: Basic use of mallocarray(9).

These functions deal the same type of overflows we do with mallocarray(9).
Using our mallocarray will panic, which different from the previous
behavior (returning NULL), but neither behavior is more correct.

As a sidenote, drm_calloc_large() is not currently used at all.

Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D13835

6 years agoForgot to add the skeleton BCM283x Clock Manager
phk [Mon, 22 Jan 2018 08:33:59 +0000 (08:33 +0000)]
Forgot to add the skeleton BCM283x Clock Manager

Reminded by: lwhsu

6 years agoAdd skeleton manual page for bcm283x_pwm
phk [Mon, 22 Jan 2018 07:43:54 +0000 (07:43 +0000)]
Add skeleton manual page for bcm283x_pwm

(Feel free to improve this)

6 years agoForgot to edit copy&pasted copyright blurb.
phk [Mon, 22 Jan 2018 07:15:24 +0000 (07:15 +0000)]
Forgot to edit copy&pasted copyright blurb.

6 years agoAdd a skeleton Clock Manager for RPi2/3, and use that from pwm
phk [Mon, 22 Jan 2018 07:10:30 +0000 (07:10 +0000)]
Add a skeleton Clock Manager for RPi2/3, and use that from pwm
instead of frobbing the registers directly.

As a hack the bcm2835_pwm kmod presently ignores the 'status="disabled"'
in the RPI3 DTB, assuming that if you load the kld you probably
want the PWM to work.

6 years agoMFV r328255: 8972 zfs holds: In scripted mode, do not pad columns with spaces
mav [Mon, 22 Jan 2018 06:00:45 +0000 (06:00 +0000)]
MFV r328255: 8972 zfs holds: In scripted mode, do not pad columns with spaces

illumos/illumos-gate@e9b7d6e7f7a6477679a35b73eb3934b096b3dd39

https://www.illumos.org/issues/8972:
'zfs holds -H' does not properly output content in scripted mode. It uses a
tab instead of two spaces, but it still pads column widths with spaces when
it should not.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Allan Jude <allanjude@freebsd.org>

6 years agoMFV r328253: 8835 Speculative prefetch in ZFS not working for misaligned reads
mav [Mon, 22 Jan 2018 05:57:14 +0000 (05:57 +0000)]
MFV r328253: 8835 Speculative prefetch in ZFS not working for misaligned reads

illumos/illumos-gate@5cb8d943bc8513c6230589aad5a409d58b0297cb

https://www.illumos.org/issues/8835:
Sequential reads not aligned to block size are not detected by ZFS
prefetcher as sequential, killing prefetch and severely hurting
performance.  It is caused by dmu_zfetch() in case of misaligned
sequential accesses being called with overlap of one block.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Allan Jude <allanjude@freebsd.org>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Alexander Motin <mav@FreeBSD.org>

6 years agoMFV r328251: 8652 Tautological comparisons with ZPROP_INVAL
mav [Mon, 22 Jan 2018 05:52:39 +0000 (05:52 +0000)]
MFV r328251: 8652 Tautological comparisons with ZPROP_INVAL

illumos/illumos-gate@4ae5f5f06c6c2d1db8167480f7d9e3b5378ba2f2

https://www.illumos.org/issues/8652:
Clang and GCC prefer to use unsigned ints to store enums. With Clang, that
causes tautological comparison warnings when comparing a zfs_prop_t or
zpool_prop_t variable to the macro ZPROP_INVAL. It's likely that error
handling code is being silently removed as a result.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Alan Somers <asomers@gmail.com>

6 years agoMFV r328249:
mav [Mon, 22 Jan 2018 04:37:04 +0000 (04:37 +0000)]
MFV r328249:
8641 "zpool clear" and "zinject" don't work on "spare" or "replacing" vdevs

illumos/illumos-gate@2ba5f978a4f9b02da9db1b8cdd9ea5498eb00ad9

https://www.illumos.org/issues/8641:
"zpool clear" and "zinject -d" can both operate on specific vdevs, either
leaf or interior. However, due to an oversight, neither works on a "spare"
or "replacing" vdev. For example:

sudo zpool create foo raidz1 c1t5000CCA000081D61d0 c1t5000CCA000186235d0 spare c
1t5000CCA000094115d0
sudo zpool replace foo c1t5000CCA000186235d0 c1t5000CCA000094115d0
$ zpool status foo pool: foo
state: ONLINE
scan: resilvered 81.5K in 0h0m with 0 errors on Fri Sep 8 10:53:03 2017
config:

NAME                         STATE     READ WRITE CKSUM
        foo                          ONLINE       0     0     0
          raidz1-0                   ONLINE       0     0     0
            c1t5000CCA000081D61d0    ONLINE       0     0     0
            spare-1                  ONLINE       0     0     0
              c1t5000CCA000186235d0  ONLINE       0     0     0
              c1t5000CCA000094115d0  ONLINE       0     0     0
        spares
          c1t5000CCA000094115d0      INUSE     currently in use
$ sudo zinject -d spare-1 -A degrade foo
cannot find device 'spare-1' in pool 'foo'
$ sudo zpool clear foo spare-1
cannot clear errors for spare-1: no such device in pool

Even though there was nothing to clear, those commands shouldn't have
reported an error. by contrast, trying to clear "raidz1-0" works just fine:
$ sudo zpool clear foo raidz1-0

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Alan Somers <asomers@gmail.com>

6 years agoMFV r328247: 8959 Add notifications when a scrub is paused or resumed
mav [Mon, 22 Jan 2018 04:31:48 +0000 (04:31 +0000)]
MFV r328247: 8959 Add notifications when a scrub is paused or resumed

illumos/illumos-gate@301fd1d6f25595cd8c6d6795f39c72d97aff8cd9

Reviewed by: Alek Pinchuk <pinchuk.alek@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Sean Eric Fagan <sef@ixsystems.com>

6 years agoMFV r328245: 8856 arc_cksum_is_equal() doesn't take into account ABD-logic
mav [Mon, 22 Jan 2018 04:23:48 +0000 (04:23 +0000)]
MFV r328245: 8856 arc_cksum_is_equal() doesn't take into account ABD-logic

illumos/illumos-gate@01a059ee0cdece49f47fd4d70086dd5bc7d0b0ff

https://www.illumos.org/issues/8856:
arc_cksum_is_equal() calls zio_push_transform() that requires abd_t*
(second arg), but a void* is passed.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Roman Strashkin <roman.strashkin@nexenta.com>

6 years agousr.sbin/service: Fix -j to not be order dependant
kevans [Mon, 22 Jan 2018 03:38:10 +0000 (03:38 +0000)]
usr.sbin/service: Fix -j to not be order dependant

The introduced -j option is highly dependant on the ordering of arguments,
and it exhibited broken behavior in some other circumstances. Fix these
issues, and simplify the feature by removing the unneessary double parsing
of options.

Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D13952

6 years agolibregex: Drop WARNS to 2 to match libc
kevans [Mon, 22 Jan 2018 03:12:26 +0000 (03:12 +0000)]
libregex: Drop WARNS to 2 to match libc

It's become clear that my armv7 builds didn't catch all of the warnings that
other builds are picking up, drop WARNS to 2 to match libc until they're all
caught.

6 years agoAdd missing patch from r328240
kevans [Mon, 22 Jan 2018 02:58:33 +0000 (02:58 +0000)]
Add missing patch from r328240

regcomp uses some libc internal collation bits that are not available in the
libregex context. It's easy enough to bring in the needed parts that can
work in a libregex world, so do so.

Pointy hat to: me

6 years agoAdd libregex, connect it to the build
kevans [Mon, 22 Jan 2018 02:44:41 +0000 (02:44 +0000)]
Add libregex, connect it to the build

libregex is a regex(3) implementation intended to feature GNU extensions and
any other non-POSIX compliant extensions that are deemed worthy.

These extensions are separated out into a separate library for the sake of
not cluttering up libc further with them as well as not deteriorating the
speed (or lack thereof) of the libc implementation.

libregex is implemented as a build of the libc implementation with LIBREGEX
defined to distinguish this from a libc build. The reasons for
implementation like this are two-fold:

1.) Maintenance- This reduces the overhead induced by adding yet another
regex implementation to base.

2.) Ease of use- Flipping on GNU extensions will be as simple as linking
against libregex, and POSIX-compliant compilations can be guaranteed with a
REG_POSIX cflag that should be ignored by libc/regex and disables extensions
in libregex. It is also easier to keep REG_POSIX sane and POSIX pure when
implemented in this fashion.

Tests are added for future functionality, but left disconnected for the time
being while other testing is done.

Reviewed by: cem (previous version)
Differential Revision: https://reviews.freebsd.org/D12934

6 years agoForgot to sort here in r328238.
pfg [Mon, 22 Jan 2018 02:26:10 +0000 (02:26 +0000)]
Forgot to sort here in r328238.

6 years agoUnsign some values related to allocation.
pfg [Mon, 22 Jan 2018 02:08:10 +0000 (02:08 +0000)]
Unsign some values related to allocation.

When allocating memory through malloc(9), we always expect the amount of
memory requested to be unsigned as a negative value would either stand for
an error or an overflow.
Unsign some values, found when considering the use of mallocarray(9), to
avoid unnecessary casting. Also consider that indexes should be of
at least the same size/type as the upper limit they pretend to index.

MFC after: 3 weeks