]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agodiff(1): Implement -B/--ignore-blank-lines
kevans [Sun, 19 Aug 2018 03:57:20 +0000 (03:57 +0000)]
diff(1): Implement -B/--ignore-blank-lines

As noted by cem in r338035, coccinelle invokes diff(1) with the -B flag.
This was not previously implemented here, so one was forced to create a link
for GNU diff to /usr/local/bin/diff

Implement the -B flag and add some primitive tests for it. It is implemented
in the same fashion that -I is implemented; each chunk's lines are scanned,
and if a non-blank line is encountered then the chunk will be output.
Otherwise, it's skipped.

MFC after: 2 weeks

5 years agoExtending the delay cycles to give the codec more time to pump ADC data across the...
avatar [Sun, 19 Aug 2018 01:14:46 +0000 (01:14 +0000)]
Extending the delay cycles to give the codec more time to pump ADC data across the AC-link.

Without this patch, some CS4614 cards will need users to reload the driver manually or
the hardware won't be initialised properly. Something like:

# kldload snd_csa
# kldunload snd_csa
# kldload snd_csa

Tested with: Terratec SiXPack 5.1+

5 years agoBack out r338035 until Warner is finished churning GSoC PNP patches
cem [Sun, 19 Aug 2018 00:46:22 +0000 (00:46 +0000)]
Back out r338035 until Warner is finished churning GSoC PNP patches

I was not aware Warner was making or planning to make forward progress in
this area and have since been informed of that.

It's easy to apply/reapply when churn dies down.

5 years agoRemove unused and easy to misuse PNP macro parameter
cem [Sun, 19 Aug 2018 00:22:21 +0000 (00:22 +0000)]
Remove unused and easy to misuse PNP macro parameter

Inspired by r338025, just remove the element size parameter to the
MODULE_PNP_INFO macro entirely.  The 'table' parameter is now required to
have correct pointer (or array) type.  Since all invocations of the macro
already had this property and the emitted PNP data continues to include the
element size, there is no functional change.

Mostly done with the coccinelle 'spatch' tool:

  $ cat modpnpsize0.cocci
    @normaltables@
    identifier b,c;
    expression a,d,e;
    declarer MODULE_PNP_INFO;
    @@
     MODULE_PNP_INFO(a,b,c,d,
    -sizeof(d[0]),
     e);

    @singletons@
    identifier b,c,d;
    expression a;
    declarer MODULE_PNP_INFO;
    @@
     MODULE_PNP_INFO(a,b,c,&d,
    -sizeof(d),
     1);

  $ rg -l MODULE_PNP_INFO -- sys | \
    xargs spatch --in-place --sp-file modpnpsize0.cocci

(Note that coccinelle invokes diff(1) via a PATH search and expects diff to
tolerate the -B flag, which BSD diff does not.  So I had to link gdiff into
PATH as diff to use spatch.)

Tinderbox'd (-DMAKE_JUST_KERNELS).

5 years agoOops. r338030 didn't eliminate the unused arena argument from all of
alc [Sat, 18 Aug 2018 22:35:19 +0000 (22:35 +0000)]
Oops.  r338030 didn't eliminate the unused arena argument from all of
kmem_alloc_attr()'s callers.  Correct that mistake.

5 years agoReplace the TRIM consolodation framework originally added in -r337396
mckusick [Sat, 18 Aug 2018 22:21:59 +0000 (22:21 +0000)]
Replace the TRIM consolodation framework originally added in -r337396
driven by problems found with the algorithms being tested for TRIM
consolodation.

Reported by:  Peter Holm
Suggested by: kib
Reviewed by:  kib
Sponsored by: Netflix

5 years agoEliminate the unused arena parameter from kmem_alloc_attr().
alc [Sat, 18 Aug 2018 22:07:48 +0000 (22:07 +0000)]
Eliminate the unused arena parameter from kmem_alloc_attr().

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D16793

5 years agoRevert -r337396. It is being replaced with a revised interface that
mckusick [Sat, 18 Aug 2018 21:21:06 +0000 (21:21 +0000)]
Revert -r337396. It is being replaced with a revised interface that
resulted from testing and further reviews.

5 years agols(1): Gate the do_color_* definitions behind COLORLS
kevans [Sat, 18 Aug 2018 21:03:19 +0000 (21:03 +0000)]
ls(1): Gate the do_color_* definitions behind COLORLS

Pointy hat to: me

5 years agols(1): Support other aliases for --color arguments used by GNU ls(1)
kevans [Sat, 18 Aug 2018 20:55:20 +0000 (20:55 +0000)]
ls(1): Support other aliases for --color arguments used by GNU ls(1)

These aliases are supported and documented in the man page. For now, they
will not be mentioned in the error when an invalid argument is encountered,
instead keeping that list to the shorter 'preferred' names of each argument.

Reported by: rgrimes

5 years agoUse the size of one bge_devs element for the MODULE_PNP_INFO macro,
dim [Sat, 18 Aug 2018 20:41:43 +0000 (20:41 +0000)]
Use the size of one bge_devs element for the MODULE_PNP_INFO macro,
instead of the size of the whole bge_devs array.

This should stop kldxref searching beyond the end of .rodata when it
processes relocations, and emitting "unhandled relocation type" errors,
at least on i386.

5 years agoRudimentary AER reading code for ddb(4).
kib [Sat, 18 Aug 2018 20:35:19 +0000 (20:35 +0000)]
Rudimentary AER reading code for ddb(4).

This is very primitive code to inspect the PCI error state and AER
error state, dump the log and clear errors, from ddb.
pci_print_faulted_dev() is made external to allow calling it from
other places.  It was called from NMI handler but this chunk is not
included.

Also there is a tunable-controlled code to clear AER on device attach,
disabled by default.

All this code was useful to me when I debugged ACPI_DMAR failures (not
faults) long time ago.

Reviewed by: cem, imp (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D7813

5 years agoMake 'device crypto' lines more consistent.
jhb [Sat, 18 Aug 2018 20:32:08 +0000 (20:32 +0000)]
Make 'device crypto' lines more consistent.

- In configurations with a pseudo devices section, move 'device crypto'
  into that section.
- Use a consistent comment.  Note that other things common in kernel
  configs such as GELI also require 'device crypto', not just IPSEC.

Reviewed by: rgrimes, cem, imp
Differential Revision: https://reviews.freebsd.org/D16775

5 years agoFix casts between 64-bit physical addresses and pointers in EFI.
jhb [Sat, 18 Aug 2018 20:28:25 +0000 (20:28 +0000)]
Fix casts between 64-bit physical addresses and pointers in EFI.

Compiling FreeBSD/i386 with modern GCC triggers warnings for various
places that convert 64-bit EFI_ADDRs to pointers and vice versa.
- Cast pointers to uintptr_t rather than to uint64_t when assigning
  to a 64-bit integer.
- Cast 64-bit integers to uintptr_t before a cast to a pointer.

Reviewed by: kevans
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16586

5 years agoUse 'bool' instead of 'int' for various boolean flags.
jhb [Sat, 18 Aug 2018 20:23:53 +0000 (20:23 +0000)]
Use 'bool' instead of 'int' for various boolean flags.

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

5 years agores_find: Fix fallback logic
kevans [Sat, 18 Aug 2018 19:45:56 +0000 (19:45 +0000)]
res_find: Fix fallback logic

The fallback logic was broken if hints were found in multiple environments.
If we found a hint in either the loader environment or the static
environment, fallback would be incremented excessively when we returned to
the environment-selection bits. These checks should have also been guarded
by the fbacklvl checks. As a result, fbacklvl could quickly get to a point
where we skip either the static environment and/or the static hints
depending on which environments contained valid hints.

The impact of this bug is minimal, mostly affecting mips boards that use
static hints and may have hints in either the loader environment or the
static environment.

There may be better ways to express the searchable environments and
describing their characteristics (immutable, already searched, etc.) but
this may be revisited after 12 branches.

Reported by: Dan Nelson <dnelson_1901@yahoo.com>
Triaged by: Dan Nelson <dnelson_1901@yahoo.com>
MFC after: 3 days

5 years agoFix LORs between vn_start_write() and vn_lock() in nfsrv_copymr().
rmacklem [Sat, 18 Aug 2018 19:14:06 +0000 (19:14 +0000)]
Fix LORs between vn_start_write() and vn_lock() in nfsrv_copymr().

When coding the pNFS server, I added vn_start_write() calls in nfsrv_copymr()
done while the vnodes were locked, not realizing I had introduced LORs and
possible deadlock when an exported file system on the MDS is suspended.
This patch fixes the LORs by moving the vn_start_write() calls up to before
where the vnodes are locked. For "tvp", the vn_start_write() probaby isn't
necessary, because NFS mounts can't be suspended. However, I think doing
so is harmless.
Thanks go to kib@ for letting me know that I had introduced these LORs.
This patch only affects the behaviour of the pNFS server when pnfsdscopymr(8)
is used to recover a mirrored DS.

5 years agoEliminate the arena parameter to kmem_malloc_domain(). It is redundant.
alc [Sat, 18 Aug 2018 18:33:50 +0000 (18:33 +0000)]
Eliminate the arena parameter to kmem_malloc_domain().  It is redundant.
The domain and flags parameters suffice.  In fact, the related functions
kmem_alloc_{attr,contig}_domain() don't have an arena parameter.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D16713

5 years agoPrint L1D FLUSH feature.
kib [Sat, 18 Aug 2018 12:17:05 +0000 (12:17 +0000)]
Print L1D FLUSH feature.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agobsnmpd(8): fix and optimize interface description processing
eugen [Sat, 18 Aug 2018 10:58:44 +0000 (10:58 +0000)]
bsnmpd(8): fix and optimize interface description processing

* correctly prepare a buffer to obtain interface description from a kernel and
  truncate long description instead of dropping it altogether and
  spamming logs;
* skip calling strlen() for each description and each SNMP request
  for MIB-II/ifXTable's ifAlias.
* teach bsnmpd to allocate memory dynamically for interface descriptions
  to decrease memory usage for common case and not to break
  if long description occurs;

PR: 217763
Reviewed by: harti and others
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D16459

5 years agoWorkaround ECAPMODE for kernels between revision [331280, 337999)
delphij [Sat, 18 Aug 2018 08:32:21 +0000 (08:32 +0000)]
Workaround ECAPMODE for kernels between revision [331280, 337999)
where getrandom(2) is not available in capability mode.

5 years agoRegen after r337998.
delphij [Sat, 18 Aug 2018 06:33:51 +0000 (06:33 +0000)]
Regen after r337998.

5 years agogetrandom(2) should not be restricted in capability mode.
delphij [Sat, 18 Aug 2018 06:31:49 +0000 (06:31 +0000)]
getrandom(2) should not be restricted in capability mode.

5 years agoSplit arc4random_uniform into it's own file and sync with OpenBSD.
delphij [Sat, 18 Aug 2018 06:20:45 +0000 (06:20 +0000)]
Split arc4random_uniform into it's own file and sync with OpenBSD.

PR: 182610
Obtained from: OpenBSD
MFC after: 2 weeks

5 years agocxgbe(4): Replace T4_PKT_TIMESTAMP with something slightly less hackish.
np [Sat, 18 Aug 2018 04:23:51 +0000 (04:23 +0000)]
cxgbe(4): Replace T4_PKT_TIMESTAMP with something slightly less hackish.

5 years agolibbe(3): Move build goop back out of cddl/
kevans [Sat, 18 Aug 2018 03:20:59 +0000 (03:20 +0000)]
libbe(3): Move build goop back out of cddl/

Some background: in the GSoC project, libbe/Makefile lived in lib/libbe. I
created projects/bectl branch, maintained the above for all of five
minutes before I misread Makefile.inc1 and decided that it couldn't possibly
build outside of cddl/, so I kicked the Makefile out into the cddl/ build
and all was good. The misreading was of the bit where .WAIT is added to
SUBDIR after lib, libexec but prior to building bin and cddl *only during
the install targets*, which is the critical part.

Fast forward- buildworld was still broken in my branch unbeknownst to me
because I didn't nuke my OBJDIR. Combing through Makefile.inc1 eventually
revealed the necessary magic to make sure that libbe's dependencies are
specified well enough, and it becomes clear what needs done to make a
non-cddl/ build work. This is an interesting prospect, because the build
split is kind of annoying to work with.

IGNORE_PRAGMA is added to avoid dropping WARNS by one more. This was
previously pulled in via cddl/Makefile.inc.

5 years agolibbe(3): Remove -v from LDFLAGS
kevans [Sat, 18 Aug 2018 03:08:54 +0000 (03:08 +0000)]
libbe(3): Remove -v from LDFLAGS

-v is clearly not needed for linking, and it adds extra verbose information
that is not necessary.

5 years agobectl(8): Allow running a custom command in the 'jail' subcommand
kevans [Sat, 18 Aug 2018 01:12:44 +0000 (01:12 +0000)]
bectl(8): Allow running a custom command in the 'jail' subcommand

Instead of always running /bin/sh, allow the user to specify the command
to run. The jail is not removed when the command finishes. Meaning,
`bectl unjail` will still need to be run.

For example:

```
bectl jail newBE pkg upgrade
bectl ujail newBE
```

Submitted by: Shawn Webb
Obtained from: HardenedBSD (8b451014ab)

5 years agoPOSIX compliance improvements in the pthread(3) functions.
pfg [Sat, 18 Aug 2018 01:05:38 +0000 (01:05 +0000)]
POSIX compliance improvements in the pthread(3) functions.

This basically adds makes use of the C99 restrict keyword, and also
adds some 'const's to four threading functions: pthread_mutexattr_gettype(),
pthread_mutexattr_getprioceiling(), pthread_mutexattr_getprotocol(), and
pthread_mutex_getprioceiling. The changes are in accordance to POSIX/SUSv4-2018.

Hinted by: DragonFlyBSD

Relnotes: yes
MFC after: 1 month
Differential Revision: D16722

5 years agoMETALOG, unless manually overwritten, is defined as ${DESTDIR}/${DISTDIR}/METALOG
bz [Fri, 17 Aug 2018 21:19:18 +0000 (21:19 +0000)]
METALOG, unless manually overwritten, is defined as ${DESTDIR}/${DISTDIR}/METALOG

In the create-world-packages target we manually piece this together (unless
it is undefined), without the DISTDIR.  Normally DISTDIR is empty (unset) and
no one notices.  Now DISTDIR is a well known long-standing PORTS environment
variable and if that is set in the local environment the path to METALOG
is wrong as it no longer is ${DESTDIR}/METALOG.

Long-term we should start to avoid "publicly well known" names for global
variables, for now just piece ${DISTDIR} in as well.  This allows
create-world-packages to continue if DISTDIR is set in the env.

5 years agoFix LORs between vn_start_write() and vn_lock() in the pNFS server.
rmacklem [Fri, 17 Aug 2018 21:12:16 +0000 (21:12 +0000)]
Fix LORs between vn_start_write() and vn_lock() in the pNFS server.

When coding the pNFS server, I added several vn_start_write() calls done
while the vnode was locked, not realizing I had introduced LORs and
possible deadlock when an exported file system on the MDS is suspended.
This patch fixes this by removing the added vn_start_write() calls and
modifying the code so that the extant vn_start_write() call before the
NFS RPC/operation is done when needed by the pNFS server.
Flags are changed so that LayoutCommit and LayoutReturn now get a
vn_start_write() done for them.
When the pNFS server is enabled, the code now also changes the flags for
Getattr, so that the vn_start_write() is done for Getattr, since it may
need to do a vn_set_extattr(). The nfs_writerpc flag array was made global
to the NFS server and renamed nfsrv_writerpc, which is consistent naming
for globals in the NFS server.
Thanks go to kib@ for reporting that doing vn_start_write() while the vnode is
locked results in a LOR.
This patch only affects the behaviour of the pNFS server.

5 years agoCopy the boot loader from the new location for the co-existing
imp [Fri, 17 Aug 2018 20:41:50 +0000 (20:41 +0000)]
Copy the boot loader from the new location for the co-existing
loaders.

Reviewed by: gjb@

5 years agocxgbe(4): Adjust ntids to account for nhptids in the TOE case too.
np [Fri, 17 Aug 2018 20:28:31 +0000 (20:28 +0000)]
cxgbe(4):  Adjust ntids to account for nhptids in the TOE case too.
This should have been part of r337538.

5 years agocxgbe/tom: Put the ifnet or VLAN's PCP value in the 802.1Q tag of frames
np [Fri, 17 Aug 2018 19:22:46 +0000 (19:22 +0000)]
cxgbe/tom: Put the ifnet or VLAN's PCP value in the 802.1Q tag of frames
generated by the TOE.  Works with vid 0 (no VLAN, just priority) too.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agoFix sys/netipsec/tunnel tests after r337736
asomers [Fri, 17 Aug 2018 18:37:22 +0000 (18:37 +0000)]
Fix sys/netipsec/tunnel tests after r337736

Originally, these tests accidentally used broadcast addresses when they
should've used unicast addresses.  That the tests passed prior to r337736
was accidental.

Submitted by: ae
Reviewed by: olivier
MFC after: 2 weeks

5 years agoAdd pthread_get_name_np(3).
kib [Fri, 17 Aug 2018 18:34:07 +0000 (18:34 +0000)]
Add pthread_get_name_np(3).

The function retrieves the thread name previously set by
pthread_set_name_np(3). The name is cached in the process memory.

Requested by: Willem Jan Withagen <wjw@digiware.nl>
Man page update: Yuri Pankov <yuripv@yuripv.net>
Reviewed by: ian (previous version)
Discussed with: arichardson, bjk (man page)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D16702

5 years agoReorder alphabetically.
kib [Fri, 17 Aug 2018 18:24:11 +0000 (18:24 +0000)]
Reorder alphabetically.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16702

5 years agoAdd a man page for ratecheck(9) and ppsratecheck(9).
des [Fri, 17 Aug 2018 17:16:38 +0000 (17:16 +0000)]
Add a man page for ratecheck(9) and ppsratecheck(9).

5 years agoRework rtld's TLS Variant I implementation to match r326794
brooks [Fri, 17 Aug 2018 16:19:47 +0000 (16:19 +0000)]
Rework rtld's TLS Variant I implementation to match r326794

The above commit fixed handling overaligned TLS segments in libc's
TLS Variant I implementation, but rtld provides its own implementation
for dynamically-linked executables which lacks these fixes.  Thus,
port these changes to rtld.

Submitted by: James Clarke
Reviewed by: kbowling
Testing byL kbowling (powerpc64), br (riscv), kevans (armv7)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16510

5 years agoTypo.
markj [Fri, 17 Aug 2018 16:07:06 +0000 (16:07 +0000)]
Typo.

X-MFC with: r337974

5 years agoAdd INVARIANTS-only fences around lockless vnode refcount updates.
markj [Fri, 17 Aug 2018 15:41:01 +0000 (15:41 +0000)]
Add INVARIANTS-only fences around lockless vnode refcount updates.

Some internal KASSERTs access the v_iflag field without the vnode
interlock held after such a refcount update.  The fences are needed for
the assertions to be correct in the face of store reordering.

Reported and tested by: jhibbits
Reviewed by: kib, mjg
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16756

5 years agoAdd Modbus Application Protocol to /etc/services
asomers [Fri, 17 Aug 2018 15:18:57 +0000 (15:18 +0000)]
Add Modbus Application Protocol to /etc/services

IANA reassigned ports 502 and 802 on 2014-06-10

PR: 213276
Submitted by: Mark.Martinec@ijs.si
MFC after: 2 weeks

5 years ago9751 Allocation throttling misplacing ditto blocks
mav [Fri, 17 Aug 2018 15:17:09 +0000 (15:17 +0000)]
9751 Allocation throttling misplacing ditto blocks

Relax allocation throttling for ditto blocks.  Due to random imbalances
in allocation it tends to push block copies to one vdev, that looks
slightly better at the moment.  Slightly less strict policy allows both
improve data security and surprisingly write performance, since we don't
need to touch extra metaslabs on each vdev to respect the min distance.

Sponsored by: iXsystems, Inc.

5 years agopf tests: Verify that pf limits the number of fragments per packet
kp [Fri, 17 Aug 2018 15:02:58 +0000 (15:02 +0000)]
pf tests: Verify that pf limits the number of fragments per packet

Test the limitation on number of frames per packet introduced in pf in r337969.

Sponsored by: Klara Systems

5 years ago9738 Fix third block copy allocations, broken at 9112.
mav [Fri, 17 Aug 2018 15:00:41 +0000 (15:00 +0000)]
9738 Fix third block copy allocations, broken at 9112.

Use METASLAB_WEIGHT_CLAIM weight to allocate tertiary blocks.
Previous use of METASLAB_WEIGHT_SECONDARY for that caused errors
later on metaslab_activate_allocator() call, leading to massive
load of unneeded metaslabs and write freezes.

Reviewed by: Paul Dagnelie <pcd@delphix.com>

5 years agopf: Limit the maximum number of fragments per packet
kp [Fri, 17 Aug 2018 15:00:10 +0000 (15:00 +0000)]
pf: Limit the maximum number of fragments per packet

Similar to the network stack issue fixed in r337782 pf did not limit the number
of fragments per packet, which could be exploited to generate high CPU loads
with a crafted series of packets.

Limit each packet to no more than 64 fragments. This should be sufficient on
typical networks to allow maximum-sized IP frames.

This addresses the issue for both IPv4 and IPv6.

MFC after: 3 days
Security: CVE-2018-5391
Sponsored by: Klara Systems

5 years agoConsistently use NULL to terminate the argv; no functional changes.
trasz [Fri, 17 Aug 2018 14:57:13 +0000 (14:57 +0000)]
Consistently use NULL to terminate the argv; no functional changes.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoGPT is standard in x86 and arm64 land. Add it to DEFAULTS with the
imp [Fri, 17 Aug 2018 14:47:21 +0000 (14:47 +0000)]
GPT is standard in x86 and arm64 land. Add it to DEFAULTS with the
others.

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

5 years agoFix style nits.
oshogbo [Fri, 17 Aug 2018 14:37:13 +0000 (14:37 +0000)]
Fix style nits.

5 years agocapsicum: allow the setproctitle(3) function in capability mode
oshogbo [Fri, 17 Aug 2018 14:35:10 +0000 (14:35 +0000)]
capsicum: allow the setproctitle(3) function in capability mode

Capsicum in past allowed to change the process title.
This was broken with r335939.

PR: 230584
Submitted by: Yuichiro NAITO <naito.yuichiro@gmail.com>
Reported by: ian@niw.com.au
MFC after: 1 week

5 years agodtc(1): Update to 97d2d5715eeb45108cc60367fdf6bd5b2046b050
kevans [Fri, 17 Aug 2018 13:24:48 +0000 (13:24 +0000)]
dtc(1): Update to 97d2d5715eeb45108cc60367fdf6bd5b2046b050

Notable fixes:
- Overlays may now be generated properly without -@
- /__local_fixups__ were not including unit address in their structure
- The error reporting a magic token was misleading, reporting
  "Bad magic token in header.  Got d00dfeed expected 0xd00dfeed"
  if the token was missing. This has been split out into a separate message.

MFC after: 1 week

5 years agoDon't set a file's size for the MDS file of a pNFS service.
rmacklem [Fri, 17 Aug 2018 12:32:38 +0000 (12:32 +0000)]
Don't set a file's size for the MDS file of a pNFS service.

When a pNFS service is running, the size of the files created on the MDS
are normally 0, since the data is written to the data files on the DS(s).
However, without this patch, if a Setattr with a non-zero size was done by
a client, the MDS file was set to that size.  This was thought to be benign,
but it turns out that files with a non-zero size plus extended attributes
can cause a "ffs_truncate3" panic in UFS. Although the exact cause of this
panic() has not been isolated, this patch avoids the panic() and leaves
the MDS files in a consistent state of always having a size == 0.
Note that these MDS files never store data. The patch also includes an
unnecessary initialization of savsize in case some compiler or static
analyser complains it might not be initialized.
This patch only affects the NFS server when pNFS is enabled via the "-p"
command line option on nfsd.

5 years agoAdd the possibility to mark packets urgent based on their length.
n_hibma [Fri, 17 Aug 2018 10:18:45 +0000 (10:18 +0000)]
Add the possibility to mark packets urgent based on their length.

This allows preferring small (e.g. ACK) packets, in upload heavy
environments.

It was already possible to mark packets urgent based on destination
port. This option piggy backs on that feature.

5 years agobuild: skip the database check when generating install media
royger [Fri, 17 Aug 2018 07:27:15 +0000 (07:27 +0000)]
build: skip the database check when generating install media

There are several scripts and targets solely used to generate install
media, make sure DB_FROM_SRC is used in that case in order to prevent
checking the host database, which is irrelevant when generating
install binaries.

Sponsored by: Citrix Systems R&D
PR: 230459
Reviewed by: gjb
Differential revision: https://reviews.freebsd.org/D16638

5 years agocryptosoft: Reduce generality of supported algorithm composition
cem [Fri, 17 Aug 2018 04:40:01 +0000 (04:40 +0000)]
cryptosoft: Reduce generality of supported algorithm composition

Fix a regression introduced in r336439.

Rather than allowing any linked list of algorithms, allow at most two
(typically, some combination of encrypt and/or MAC).  Removes a WAITOK
malloc in an unsleepable context (classic LOR) by placing both software
algorithm contexts within the OCF-managed session object.

Tested with 'cryptocheck -a all -d cryptosoft0', which includes some
encrypt-and-MAC modes.

PR: 230304
Reported by: sef@

5 years agoAdd efidev(4)/efirt(9)
kevans [Fri, 17 Aug 2018 04:17:51 +0000 (04:17 +0000)]
Add efidev(4)/efirt(9)

Document efidev(4), provider of userland access to EFI Runtime Services. A link is created to efirtc(4), which handles the time-of-day clock side.

efirt(9) is the kernel side of this.

Reviewed by: imp, kib (earlier version)
Differential Revision: https://reviews.freebsd.org/D16696

5 years agols(1): Add --color=when
kevans [Fri, 17 Aug 2018 04:15:51 +0000 (04:15 +0000)]
ls(1): Add --color=when

--color may be set to one of: 'auto', 'always', and 'never'.

'auto' is the default behavior- output colors only if -G or COLORTERM are
set, and only if stdout is a tty.

'always' is a new behavior- output colors always. termcap(5) will be
consulted unless TERM is unset or not a recognized terminal, in which case
ls(1) will fall back to explicitly outputting ANSI escape sequences.

'never' to turn off any environment variable and -G usage.

Reviewed by: cem, 0mp (both modulo last-minute manpage changes
Differential Revision: https://reviews.freebsd.org/D16741

5 years agorandom: Add PowerPC 'darn' instruction entropy source
jhibbits [Fri, 17 Aug 2018 03:49:07 +0000 (03:49 +0000)]
random: Add PowerPC 'darn' instruction entropy source

Summary:
PowerISA 3.0 adds a 'darn' instruction to "deliver a random number".  This
driver was modeled after (rather, copied and gutted of) the Ivy Bridge
rdrand driver.

This uses the "Conditional Random Number" behavior to remove input bias.

From the ISA reference the 'darn' instruction, and the random number
generator backing it, conforms to the NIST SP800-90B and SP800-90C
standards, compliant to the extent possible at the time the hardware was
designed, and guarantees a minimum 0.5 bits of entropy per bit returned.

Reviewed By: markm, secteam (delphij)
Approved by: secteam (delphij)
Differential Revision: https://reviews.freebsd.org/D16552

5 years agosubr_prf: Don't write kern.boot_tag if it's empty
kevans [Fri, 17 Aug 2018 03:42:57 +0000 (03:42 +0000)]
subr_prf: Don't write kern.boot_tag if it's empty

This change allows one to set kern.boot_tag="" and not get a blank line
preceding other boot messages. While this isn't super critical- blank lines
are easy to filter out both mentally and in processing dmesg later- it
allows for a mode of operation that matches previous behavior.

I intend to MFC this whole series to stable/11 by the end of the month with
boot_tag empty by default to make this effectively a nop in the stable
branch.

5 years agobectl(8): Add batch mode to jail subcommand
kevans [Fri, 17 Aug 2018 01:59:19 +0000 (01:59 +0000)]
bectl(8): Add batch mode to jail subcommand

Adding batch mode to the jail `bectl(8)` subcommand enables jailing of
ZFS Boot Environments in a scriptable fashion.

Submitted by: Shawn Webb
Obtained from: HardenedBSD (9e72d1c59a and ef7b6d9e1c with minor edit)

5 years agoRiscv: Include crypto for IPSec
cem [Fri, 17 Aug 2018 01:08:22 +0000 (01:08 +0000)]
Riscv: Include crypto for IPSec

Similar to r337944.  I think this is the last configuration that includes IPsec
but not crypto.

5 years agoarm: Define crypto option on platforms that include IPsec
cem [Fri, 17 Aug 2018 01:04:02 +0000 (01:04 +0000)]
arm: Define crypto option on platforms that include IPsec

Missed in r337940.

(It's not like there are any crypto files IPsec doesn't pull in, so it is
unclear what not defining the crypto option was supposed to achieve.)

Reported by: np@

5 years agoif_vlan(4): A VLAN always has a PCP and its ifnet's if_pcp should be set
np [Fri, 17 Aug 2018 01:03:23 +0000 (01:03 +0000)]
if_vlan(4): A VLAN always has a PCP and its ifnet's if_pcp should be set
to the PCP value in use instead of IFNET_PCP_NONE.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agoAdd test cases for Poly1305 from RFC 7539
cem [Fri, 17 Aug 2018 00:32:00 +0000 (00:32 +0000)]
Add test cases for Poly1305 from RFC 7539

5 years agocrypto(4): Add cryptosoft, cryptodev support for Poly-1305
cem [Fri, 17 Aug 2018 00:31:06 +0000 (00:31 +0000)]
crypto(4): Add cryptosoft, cryptodev support for Poly-1305

5 years agoAdd xform-conforming auth_hash wrapper for Poly-1305
cem [Fri, 17 Aug 2018 00:30:04 +0000 (00:30 +0000)]
Add xform-conforming auth_hash wrapper for Poly-1305

The wrapper is a thin shim around libsodium's Poly-1305 implementation.  For
now, we just use the C algorithm and do not attempt to build the
SSE-optimized variant for x86 processors.

The algorithm support has not yet been plumbed through cryptodev, or added
to cryptosoft.

5 years agoBring in compatibility glue for libsodium
cem [Fri, 17 Aug 2018 00:27:56 +0000 (00:27 +0000)]
Bring in compatibility glue for libsodium

The idea is untouched upstream sources live in sys/contrib/libsodium.

sys/crypto/libsodium are support routines or compatibility headers to allow
building unmodified upstream code.

This is not yet integrated into the build system, so no functional change.

5 years agoBring in libsodium to sys/contrib
cem [Fri, 17 Aug 2018 00:23:50 +0000 (00:23 +0000)]
Bring in libsodium to sys/contrib

Bring in https://github.com/jedisct1/libsodium at
461ac93b260b91db8ad957f5a576860e3e9c88a1 (August 7, 2018), unmodified.

libsodium is derived from Daniel J. Bernstein et al.'s 2011 NaCl
("Networking and Cryptography Library," pronounced "salt") software library.
At the risk of oversimplifying, libsodium primarily exists to make it easier
to use NaCl.  NaCl and libsodium provide high quality implementations of a
number of useful cryptographic concepts (as well as the underlying
primitics) seeing some adoption in newer network protocols.

I considered but dismissed cleaning up the directory hierarchy and
discarding artifacts of other build systems in favor of remaining close to
upstream (and easing future updates).

Nothing is integrated into the build system yet, so in that sense, no
functional change.

5 years agoRename head from ALPHA1 to ALPHA2 in preparation for the next set
gjb [Thu, 16 Aug 2018 23:58:22 +0000 (23:58 +0000)]
Rename head from ALPHA1 to ALPHA2 in preparation for the next set
of snapshot builds.

Hashtag: MaximumEffort
Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

5 years agoFix sys/opencrypto/blake2_test when kern.cryptodevallowsoft=0
asomers [Thu, 16 Aug 2018 23:49:56 +0000 (23:49 +0000)]
Fix sys/opencrypto/blake2_test when kern.cryptodevallowsoft=0

Two of these testcases require software crypto to be enabled. Curiously, it
isn't by default.

PR: 230671
Reported by: Jenkins
Reviewed by: cem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16755

5 years agoAdd the ability to look up the 3b PCP of a VLAN interface. Use it in
np [Thu, 16 Aug 2018 23:46:38 +0000 (23:46 +0000)]
Add the ability to look up the 3b PCP of a VLAN interface.  Use it in
toe_l2_resolve to fill up the complete vtag and not just the vid.

Reviewed by: kib@
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D16752

5 years agoSpecify DB_FROM_SRC=yes when doing any installation target.
imp [Thu, 16 Aug 2018 22:13:43 +0000 (22:13 +0000)]
Specify DB_FROM_SRC=yes when doing any installation target.

We want to use the UIDs from the installed system, not the host
system, when installing things.

Sponsored by: Netflix

5 years agoRevert r337929
asomers [Thu, 16 Aug 2018 22:04:00 +0000 (22:04 +0000)]
Revert r337929

FreeBSD's mkstemp sets the temporary file's permissions to 600, and has ever
since mkstemp was added in 1987.  Coverity's warning is still relevant for
portable programs since OpenGroup does not require that behavior, and POSIX
didn't until 2008.  But none of these programs are portable.

5 years agoFix Coverity warnings about mkstemp in tests
asomers [Thu, 16 Aug 2018 21:36:19 +0000 (21:36 +0000)]
Fix Coverity warnings about mkstemp in tests

umask(2) should always be used prior to mkstemp(3) so the temporary file
won't be created with insecure permissions.

Reported by: Coverity
CID: 1331605 1347173 1375366 1339800 1331604 1296056 1296060
CID: 1296057 1296062
MFC after: 2 weeks

5 years agoFix build after r337852: Don't rebuild moduli based on unrelated moduli.c
bdrewery [Thu, 16 Aug 2018 19:48:07 +0000 (19:48 +0000)]
Fix build after r337852: Don't rebuild moduli based on unrelated moduli.c

Reported by: many, delphij (moduli.c issue)

5 years agoAdd ashldi3 and ashrdi3 to mips.
imp [Thu, 16 Aug 2018 19:39:02 +0000 (19:39 +0000)]
Add ashldi3 and ashrdi3 to mips.

Now that we're using -Os, mips needs these routines.

5 years agoAdd partial documentation for dtrace(1)'s -x configuration options.
markj [Thu, 16 Aug 2018 19:28:44 +0000 (19:28 +0000)]
Add partial documentation for dtrace(1)'s -x configuration options.

Some options are still missing descriptions, but they can be filled in
over time.

Submitted by: raichoo <raichoo@googlemail.com>
Reviewed by: 0mp (previous version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16671

5 years agoRevert r337922, except for some documention-only bits. This needs to wait
jamie [Thu, 16 Aug 2018 19:09:43 +0000 (19:09 +0000)]
Revert r337922, except for some documention-only bits.  This needs to wait
until user is changed to stop using jail(2).

Differential Revision: D14791

5 years agolibbe(3): Impose dataset length restrictions on boot env name validation
kevans [Thu, 16 Aug 2018 18:58:34 +0000 (18:58 +0000)]
libbe(3): Impose dataset length restrictions on boot env name validation

Previously, we only validated names for character restrictions. This is
helpful, but we should've also checked length restrictions- dataset names
must be restricted to MAXNAMELEN.

While here, move validation before doing a bunch of concatenations and fix
error handling in be_rename. It was previously setting the error state based
on return value from a libzfs function, which is wrong: libzfs errors don't
necessarily match cleanly to libbe errors. This would cause the assertion in
be_error to hit when the error was printed.

5 years agoMake vfs.zfs.zio.dva_throttle_enabled sysctl writable.
mav [Thu, 16 Aug 2018 18:44:50 +0000 (18:44 +0000)]
Make vfs.zfs.zio.dva_throttle_enabled sysctl writable.

Not sure what I thought originally, but as I see now runtime changes are
working fine, and the code seems like even designed for this.

5 years agoPut jail(2) under COMPAT_FREEBSD11. It has been the "old" way of creating
jamie [Thu, 16 Aug 2018 18:40:16 +0000 (18:40 +0000)]
Put jail(2) under COMPAT_FREEBSD11.  It has been the "old" way of creating
jails since FreeBSD 7.

Along with the system call, put the various security.jail.allow_foo and
security.jail.foo_allowed sysctls partly under COMPAT_FREEBSD11 (or
BURN_BRIDGES).  These sysctls had two disparate uses: on the system side,
they were global permissions for jails created via jail(2) which lacked
fine-grained permission controls; inside a jail, they're read-only
descriptions of what the current jail is allowed to do.  The first use
is obsolete along with jail(2), but keep them for the second-read-only use.

Differential Revision: D14791

5 years agolibbe(3): Prefer safer versions of strcat/strcpy
kevans [Thu, 16 Aug 2018 18:37:47 +0000 (18:37 +0000)]
libbe(3): Prefer safer versions of strcat/strcpy

Or, in the activate case, just use snprintf since that's effectively what
we're doing anyways.

5 years agoRevert r337419.
pfg [Thu, 16 Aug 2018 18:35:39 +0000 (18:35 +0000)]
Revert r337419.

The fix is only partial and causes an asymmetry which breaks a test in
multi_test.sh.

We should consider both parts of the issue found in OpenBSD[1], but for now
just revert the change.

[1] http://undeadly.org/cgi?action=article;sid=20180728110010

Reported by: asomers

5 years agosecurity.jail.enforce_statfs is handled by jail_set(2), so handling it in
jamie [Thu, 16 Aug 2018 18:30:49 +0000 (18:30 +0000)]
security.jail.enforce_statfs is handled by jail_set(2), so handling it in
userspace jail(8) is redundant.

Differential Revision: D14791

5 years agobectl(8): Kit-kat bar
kevans [Thu, 16 Aug 2018 18:27:43 +0000 (18:27 +0000)]
bectl(8): Kit-kat bar

5 years agobectl(8): Implement the 'create a snapshot' variant of create
kevans [Thu, 16 Aug 2018 18:26:43 +0000 (18:26 +0000)]
bectl(8): Implement the 'create a snapshot' variant of create

5 years agobectl(8): Appease clang-scan
kevans [Thu, 16 Aug 2018 17:59:49 +0000 (17:59 +0000)]
bectl(8): Appease clang-scan

Use strlcpy instead of a plain strcpy

5 years agolibbe(3)/bectl(8): Hit rewind on a bunch of off-by-ones
kevans [Thu, 16 Aug 2018 17:56:03 +0000 (17:56 +0000)]
libbe(3)/bectl(8): Hit rewind on a bunch of off-by-ones

While here, use sizeof() in some places that it makes sense to reduce room
for error and prefer strlcpy to strncpy

5 years agoInstall links for loader.efi.
imp [Thu, 16 Aug 2018 16:30:23 +0000 (16:30 +0000)]
Install links for loader.efi.

Submitted by: ben wilber

5 years agoFix a module Makefile error on amd64 so the IPMI HW interfaces are built.
ambrisko [Thu, 16 Aug 2018 15:59:02 +0000 (15:59 +0000)]
Fix a module Makefile error on amd64 so the IPMI HW interfaces are built.
When the module is being unloaded and no HW interfaces were created don't
clean up.  This was exposed by the amd64 module build issue.

5 years agoFix the sys/opencrypto/runtests test when aesni(4) is already loaded
asomers [Thu, 16 Aug 2018 15:44:48 +0000 (15:44 +0000)]
Fix the sys/opencrypto/runtests test when aesni(4) is already loaded

Apparently kldstat requires the full module name, including busname

Reported by: Jenkins
MFC after: 2 weeks

5 years agoFix typo.
trasz [Thu, 16 Aug 2018 14:46:49 +0000 (14:46 +0000)]
Fix typo.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agobuild(7): Document KERNCONFDIR - directory in which KERNCONF resides
kevans [Thu, 16 Aug 2018 13:42:08 +0000 (13:42 +0000)]
build(7): Document KERNCONFDIR - directory in which KERNCONF resides

MFC after: 1 week

5 years agoTidy up the ports.7 manual page.
0mp [Thu, 16 Aug 2018 13:29:23 +0000 (13:29 +0000)]
Tidy up the ports.7 manual page.

  - Use "Dq Li" for inline commands as we do in other manuals.
  - Pet "igor" and "mandoc -Tlint".
  - Reword some parts for clarity.
  - Add missing Xr macros.
  - Reformat SEE ALSO to make the section more readable.

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

5 years agoAllow the use of TCP instead of UDP for queries by setting options usevc
bz [Thu, 16 Aug 2018 13:18:40 +0000 (13:18 +0000)]
Allow the use of TCP instead of UDP for queries by setting options usevc
in resolv.conf which sets RES_USEVC.

Reviewed by: ume
MFC after: 17 days
Differential Revision: https://reviews.freebsd.org/D16607

5 years agoRemove the L1 and L2 xscale page defines and rename the generic macros to
andrew [Thu, 16 Aug 2018 10:00:51 +0000 (10:00 +0000)]
Remove the L1 and L2 xscale page defines and rename the generic macros to
the common name. While here move the macros to check these into pmap-v4.c
as they're only used there.

Sponsored by: DARPA, AFRL

5 years agosrc.conf.5: regen after r337899 WITH_LLD_IS_LD on armv7
emaste [Thu, 16 Aug 2018 09:36:59 +0000 (09:36 +0000)]
src.conf.5: regen after r337899 WITH_LLD_IS_LD on armv7

5 years agoProperly initialize IP version in IPv6 header. This was missed in r334673.
ae [Thu, 16 Aug 2018 09:19:06 +0000 (09:19 +0000)]
Properly initialize IP version in IPv6 header. This was missed in r334673.

Reported by: Lars Schotte <lars at gustik dot eu>

5 years agoEnable LLD_IS_LD by default on armv7
emaste [Thu, 16 Aug 2018 09:11:34 +0000 (09:11 +0000)]
Enable LLD_IS_LD by default on armv7

lld should now be a usable linker for armv7, and is already used as the
bootstrap linker (for linking the kernel and userland).  Also enable as
the system linker now (/usr/bin/ld) for further testing and evaluation.
(This change will be reverted in case of unexpected fallout.)

Approved by: manu
Sponsored by: The FreeBSD Foundation

5 years ago[pci_vendors] Update pci_vendors to 2018.08.12
eadler [Thu, 16 Aug 2018 07:34:10 +0000 (07:34 +0000)]
[pci_vendors] Update pci_vendors to 2018.08.12