]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agosu(1): build with WARNS=6
eadler [Fri, 22 Jun 2018 09:10:50 +0000 (09:10 +0000)]
su(1): build with WARNS=6

Tested with full make universe

6 years agoepoch.9: bump Dd
eadler [Fri, 22 Jun 2018 06:05:19 +0000 (06:05 +0000)]
epoch.9: bump Dd

ref D15961

6 years agoepoch.9: fix some style and speeling issues
eadler [Fri, 22 Jun 2018 06:04:22 +0000 (06:04 +0000)]
epoch.9: fix some style and speeling issues

Reported by: Yutaro Hayakawa <yhayakawa3720@gmail.com> (spelling)
Differential Revision: https://reviews.freebsd.org/D15961

6 years agoEliminate gcc "shadowed declaration" warnings by using idx rather than
ian [Fri, 22 Jun 2018 03:40:03 +0000 (03:40 +0000)]
Eliminate gcc "shadowed declaration" warnings by using idx rather than
index as a variable name.

Reported by: manu@

6 years agoaudit(4): add tests for Sys V semaphore operations
asomers [Fri, 22 Jun 2018 02:56:03 +0000 (02:56 +0000)]
audit(4): add tests for Sys V semaphore operations

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

6 years agoAdd spi(8), a utility for communicating with a device on a SPI bus from
ian [Fri, 22 Jun 2018 01:59:19 +0000 (01:59 +0000)]
Add spi(8), a utility for communicating with a device on a SPI bus from
userland, conceptually similar to what i2c(8) provides for i2c devices.

Submitted by: Bob Frazier
Differential Revision: https://reviews.freebsd.org/D15029

6 years agoLet -s actually work.
bdrewery [Fri, 22 Jun 2018 01:10:05 +0000 (01:10 +0000)]
Let -s actually work.

MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agoAdd a counter to limit the number of disabled DSs for a mirrored pNFS MDS.
rmacklem [Fri, 22 Jun 2018 00:55:39 +0000 (00:55 +0000)]
Add a counter to limit the number of disabled DSs for a mirrored pNFS MDS.

This patch adds a counter that limits the number of disabled mirrored DSs
to mirror level - 1.  It also makes a small change that keeps a Write that
has failed with EACCES when attempted by a client to a DS from disabling
the DS.
This patch only affects the pNFS server.

6 years agoepoch(9): make non-preemptible variant work early boot
mmacy [Fri, 22 Jun 2018 00:47:18 +0000 (00:47 +0000)]
epoch(9): make non-preemptible variant work early boot

6 years agotop(1): behave as documented for -t
eadler [Fri, 22 Jun 2018 00:02:36 +0000 (00:02 +0000)]
top(1): behave as documented for -t

Show top itself by default, unless -t is specified.

6 years agoFix output of linprocfs stat entry
chuck [Fri, 22 Jun 2018 00:02:05 +0000 (00:02 +0000)]
Fix output of linprocfs stat entry

The Linux /proc/stat entry has grown over time

 v2.5.41 <
   user, nice, system, idle
 v2.5.41
   user, nice, system, idle, iowait, irq
 v2.6.11
   user, nice, system, idle, iowait, irq, softirq, steal
 v2.6.24
   user, nice, system, idle, iowait, irq, softirq, steal, guest
 v2.6.32 >
   user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice

Some applications (e.g. nodejs) depend on the correct number of entries
and will abort otherwise.

Fix is to print the correct number of entries based on the value of
osrelease set either in sysctl or the jail settings. Change is similar
to approach used by illumos.

Reviewed by: emaste, imp (mentor)
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D15858

6 years agoFix the Linux kernel version number calculation
chuck [Fri, 22 Jun 2018 00:02:03 +0000 (00:02 +0000)]
Fix the Linux kernel version number calculation

The Linux compatibility code was converting the version number (e.g.
2.6.32) in two different ways and then comparing the results.

The linux_map_osrel() function converted MAJOR.MINOR.PATCH similar to
what FreeBSD does natively. I.e. where major=v0, minor=v1, and patch=v2
    v = v0 * 1000000 + v1 * 1000 + v2;

The LINUX_KERNVER() macro, on the other hand, converted the value with
bit shifts. I.e. where major=a, minor=b, and patch=c
    v = (((a) << 16) + ((b) << 8) + (c))

The Linux kernel uses the later format via the KERNEL_VERSION() macro in
include/generated/uapi/linux/version.h

Fix is to use the LINUX_KERNVER() macro in linux_map_osrel() as well as
in the .trans_osrel functions.

PR: 229209
Reviewed by: emaste, cem, imp (mentor)
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D15952

6 years agosubr_hints: Fix acpi unit hinting (at the very least)
kevans [Thu, 21 Jun 2018 21:50:00 +0000 (21:50 +0000)]
subr_hints: Fix acpi unit hinting (at the very least)

The refactoring in r335479 overlooked the fact that the dynamic kenv can
also be switched to if hintmode == 0. This is problematic because the
checkmethod bits are only ever ran once, but it worked previously because
the use_kenv was a global state and the first lookup would enable it if
occurring after the dynamic environment has been setup.

Extending our local definition of use_kenv to include all non-STATIC
hintmodes as long as the dynamic_kenv is setup fixes this. We still have
potential issues if the dynamic kenv comes up while we're doing an anchored
search through the environment, but this is not much of a concern right now
because:

1.) The dynamic environment comes up super early in boot, just after kmem

2.) This is going to get rewritten to provide a safer mechanism for the
anchored searches, ensuring that we continue using the same environment
chain (dynamic env or static fallback) for all anchored search invocations

Reported by: mmamcy
X-MFC-With: r335479

6 years agoIncorporate bus and chip select numbers into spigen(4) cdev names. Rather
ian [Thu, 21 Jun 2018 21:16:26 +0000 (21:16 +0000)]
Incorporate bus and chip select numbers into spigen(4) cdev names.  Rather
than assigning spigen device names in order of creation, this uses a device
name that corresponds to the owning spibus and chip-select index.

Example: /dev/spigen0.1 would be a child of spibus0, and use cs = 1

The intent is for systems like Raspberry Pi to have a consistent way of
using an SPI interface with a specific cs value from a user application.
Otherwise, there is no consistent way of knowing which cs pin will be
assigned to a particular spigen device. The alternative is to specify
everything in "the right order" in an overlay file, which is less than
ideal. Additionally, this duplicates (to some extent) the way Linux handles
a similar situation with their 'spidev' device, so it would be somewhat
familiar to those who also use Linux.

A new kernel config option, SPIGEN_LEGACY_CDEVNAME, causes the driver to
also create /dev/spigenN device name aliases, with N incrementing in the
order of device instantiation.  This is provided to ease the transition
for existing systems using the original naming convention (particularly
when these changes are MFC'd to stable branches).

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

6 years agolinux_clone_thread: mark new thread as TDB_BORN.
kib [Thu, 21 Jun 2018 21:15:04 +0000 (21:15 +0000)]
linux_clone_thread: mark new thread as TDB_BORN.

So that the ptrace code will catch it and report it to attached
debugger.  Enables debugging of threaded Linux binaries with FreeBSD
debugger.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D15880

6 years agofork: avoid endless wait with PTRACE_FORK and RFSTOPPED.
kib [Thu, 21 Jun 2018 21:12:49 +0000 (21:12 +0000)]
fork: avoid endless wait with PTRACE_FORK and RFSTOPPED.

An RFSTOPPED thread can't clean TDB_STOPATFORK, which is done in the
fork_return() in its context, so parent is stuck forever.  Triggered
when trying to ptrace linux process.  Instead of waiting for the new
thread to clear TDB_STOPATFORK, tag it as traced and reparent to the
debugger in do_fork(), and let it only notify the debugger when run.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
Reviewed by: jhb
MFC after: 1 week
X-MFC-Note: keep p_dbgwait placeholder intact
Differential revision: https://reviews.freebsd.org/D15857

6 years agoUpdate proc->p_ptevents annotation to reflect the actual locking.
kib [Thu, 21 Jun 2018 21:07:25 +0000 (21:07 +0000)]
Update proc->p_ptevents annotation to reflect the actual locking.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
Reviewed by: jhb
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D15954

6 years agoThis adds in an optimization so that we only walk one
rrs [Thu, 21 Jun 2018 21:03:58 +0000 (21:03 +0000)]
This adds in an optimization so that we only walk one
time through the mbuf chain during copy and TSO limiting.
It is used by both Rack and now the FreeBSD stack.
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D15937

6 years agoraw_ip: validate inp in both loops
mmacy [Thu, 21 Jun 2018 20:18:23 +0000 (20:18 +0000)]
raw_ip: validate inp in both loops

Continuation of r335497. Also move the lock acquisition up to
validate before referencing inp_cred.

Reported by: pho

6 years agoin_pcblookup_hash: validate inp before return
mmacy [Thu, 21 Jun 2018 18:40:15 +0000 (18:40 +0000)]
in_pcblookup_hash: validate inp before return

Post r335356 it is possible to have an inpcb on the hash lists that is
partially torn down. Validate before using. Also as a side effect of this
change the lock ordering issue between hash lock and inpcb no longer exists
allowing some simplification.

Reported by: pho@

6 years agoSync strlcpy with userland version, again
cem [Thu, 21 Jun 2018 17:35:13 +0000 (17:35 +0000)]
Sync strlcpy with userland version, again

No functional change.

Please remember to update libkern copies of libc functions when you update
libc.

Sponsored by: Dell EMC Isilon

6 years agoraw_ip: validate inp
mmacy [Thu, 21 Jun 2018 17:24:10 +0000 (17:24 +0000)]
raw_ip: validate inp

Post r335356 it is possible to have an inpcb on the hash lists that is
partially torn down. Validate before using.

Reported by: pho

6 years agoMinor comment fix d_namelen -> d_namlen
bdrewery [Thu, 21 Jun 2018 16:40:07 +0000 (16:40 +0000)]
Minor comment fix d_namelen -> d_namlen

6 years agoino64 uses 8 byte padding now.
bdrewery [Thu, 21 Jun 2018 16:39:38 +0000 (16:39 +0000)]
ino64 uses 8 byte padding now.

6 years agoFix the build post-PMCR addition.
jhibbits [Thu, 21 Jun 2018 15:59:05 +0000 (15:59 +0000)]
Fix the build post-PMCR addition.

Submitted by: lwhsu

6 years agoxen: check if there are clients waiting in gnttab_end_foreign_access_references
royger [Thu, 21 Jun 2018 15:47:47 +0000 (15:47 +0000)]
xen: check if there are clients waiting in gnttab_end_foreign_access_references

Without a call to check_free_callbacks() clients waiting for grant
references would not be woken up even when there are sufficient grant
references available.

The check was likely left out as a mistake when the function was first
added.

Note that other functions used to free grant references already call
check_free_callbacks.

Submitted by: pratyush
Reviewed by: royger
Differential review: https://reviews.freebsd.org/D15899

6 years agoAdd some words clarifying that rename(2) does nothing when the 'from' and
ian [Thu, 21 Jun 2018 15:21:17 +0000 (15:21 +0000)]
Add some words clarifying that rename(2) does nothing when the 'from' and
'to' args are the same file.  Wording borrowed from POSIX.1-2017, but
the freebsd code to implement this behavior was added in 2002 (r103180).

6 years agoAdd a note about using option VERBOSE_SYSINIT=0 to get the verbose code
ian [Thu, 21 Jun 2018 14:59:23 +0000 (14:59 +0000)]
Add a note about using option VERBOSE_SYSINIT=0 to get the verbose code
compiled in but disabled by default.

6 years agoAdd the rest of the files for r335481
jhibbits [Thu, 21 Jun 2018 14:30:14 +0000 (14:30 +0000)]
Add the rest of the files for r335481

Missed hooking PMCR cpufreq(4) to the build, and adding the SPR to the header.

6 years agoRename usr.bin/elfcopy to usr.bin/objcopy
emaste [Thu, 21 Jun 2018 14:28:20 +0000 (14:28 +0000)]
Rename usr.bin/elfcopy to usr.bin/objcopy

We always install ELF Tool Chain's elfcopy as objcopy, so to avoid
confusion rename the src directory containing our reach-over Makefile
to match.

Requested by: jhb
Sponsored by: The FreeBSD Foundation

6 years agoIntroduce PMCR-based cpufreq(4) driver, for IBM POWER8 and POWER9 systems
jhibbits [Thu, 21 Jun 2018 14:26:43 +0000 (14:26 +0000)]
Introduce PMCR-based cpufreq(4) driver, for IBM POWER8 and POWER9 systems

Summary: POWER8 and POWER9 use a single CPU register, per core, to change clock
speed.  Everything else is handled by the on-chip controller.  This change
necessitates a change to the cpufreq global kernel driver to bump supported
levels, as the device tree for these systems can have theoretically 256
different options.  On my POWER9 Talos, the list consists of 100 items.  At
16.67MHz intervals, that allows for a change of roughly 1.67GHz between lowest
and highest.

This has only been tested on the POWER9.  However, since they're similar, this
should work on POWER8 as well.

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

6 years agosubr_hints: simplify a little bit
kevans [Thu, 21 Jun 2018 14:04:02 +0000 (14:04 +0000)]
subr_hints: simplify a little bit

Some complexity exists in these bits that isn't needed. The sysctl handler,
upon change to '2', runs through the current set of hints and sets them in
the kenv.

However, this isn't at all necessary if we're pulling hints from the kenv,
static or dynamic, as the former will get added to the latter in
init_dynamic_kenv (see: kern_environment.c). We can reduce this
configuration to just adding static_hints to the kenv if we were previously
using them.

The changes in res_find are minimal and based on the observation that once
use_kenv gets set to '1' it will never be reset to '0', and it gets set to
'1' as soon as we hit fallback mode. Later work will refactor res_find a
little bit and eliminate this now-local, because it's become clear that
there's some funkiness revolving around use_kenv=1 and it being used to
imply that we're certainly looking at the dynamic_kenv.

Reviewed by: ray
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D15940

6 years agoPLIC driver was sponsored by ECATS contract, not CTSRD one.
br [Thu, 21 Jun 2018 11:52:09 +0000 (11:52 +0000)]
PLIC driver was sponsored by ECATS contract, not CTSRD one.

6 years agoAdd MMCCAM support to AllWinner MMC driver
kibab [Thu, 21 Jun 2018 11:49:21 +0000 (11:49 +0000)]
Add MMCCAM support to AllWinner MMC driver

Using MMCCAM on AllWinner boards is now possible, reaching highest
possible data transfer speed.

For now, MMCCAM doesn't scan cards on boot. This means that scanning
has to be done manually and that it's not possible to mount root FS
from MMC/SD card since there is no block device at the boot time.

For manually scanning the cards, run:
# camcontrol rescan X:0:0
Where X is the bus number (look at camcontrol devlist to determine
bus number assigned to the MMC controller).

Reviewed by: manu
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D15891

6 years agoFix uma_zalloc_pcpu_arg() operation in case of !SMP build.
br [Thu, 21 Jun 2018 11:43:54 +0000 (11:43 +0000)]
Fix uma_zalloc_pcpu_arg() operation in case of !SMP build.

Reviewed by: mjg
Sponsored by: DARPA, AFRL

6 years ago"Kernel APIs" is a misnomer; use the proper name instead.
trasz [Thu, 21 Jun 2018 08:19:11 +0000 (08:19 +0000)]
"Kernel APIs" is a misnomer; use the proper name instead.

Suggested by: kib@, ian@
MFC after: 2 weeks

6 years agoDon't leak tmpstr.
delphij [Thu, 21 Jun 2018 07:42:28 +0000 (07:42 +0000)]
Don't leak tmpstr.

MFC after: 2 weeks

6 years agoudp_ctlinput: don't refer to unpcb after we drop the lock
mmacy [Thu, 21 Jun 2018 06:10:52 +0000 (06:10 +0000)]
udp_ctlinput: don't refer to unpcb after we drop the lock

Reported by: pho@

6 years agoDon't remove loader.conf(5) when built WITHOUT_FORTH
kevans [Thu, 21 Jun 2018 05:28:00 +0000 (05:28 +0000)]
Don't remove loader.conf(5) when built WITHOUT_FORTH

The new stand/ structure installs loader.conf(5) and defaults/loader.conf
regardless of interpreter. The only thing gating installation now is
MK_BOOT.

Reported by: eadler

6 years agoMakefile.inc1: rename build metadata file to toolchain-metadata.mk
emaste [Thu, 21 Jun 2018 02:15:50 +0000 (02:15 +0000)]
Makefile.inc1: rename build metadata file to toolchain-metadata.mk

The metadata file contains more than just compiler metadata.

Discussed with: bdrewery

6 years agoixl(4): Fix gcc build errors
erj [Wed, 20 Jun 2018 22:16:46 +0000 (22:16 +0000)]
ixl(4): Fix gcc build errors

By removing redundant function declarations.

Reported by: ci.freebsd.org via Mark Millard <marklmi@yahoo.com>
MFC after: 1 month

6 years agoPermit the kernel environment to set an array of numeric values for a single
hselasky [Wed, 20 Jun 2018 20:04:20 +0000 (20:04 +0000)]
Permit the kernel environment to set an array of numeric values for a single
sysctl(9) node.

Reviewed by: kib@, imp@, jhb@
Differential Revision: https://reviews.freebsd.org/D15802
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoOnly look for NOTES as needed.
bdrewery [Wed, 20 Jun 2018 19:45:04 +0000 (19:45 +0000)]
Only look for NOTES as needed.

Sponsored by: Dell EMC

6 years agoacpidump.8: include NFIT in the man page list of tables
emaste [Wed, 20 Jun 2018 19:40:54 +0000 (19:40 +0000)]
acpidump.8: include NFIT in the man page list of tables

Was missed in r321298.

Reported by: Ben Widawsky (in review D15931)
MFC after: 1 week

6 years agoAdd debug.verbose_sysinit tunable for VERBOSE_SYSINIT
kevans [Wed, 20 Jun 2018 19:23:56 +0000 (19:23 +0000)]
Add debug.verbose_sysinit tunable for VERBOSE_SYSINIT

VERBOSE_SYSINIT is currently an all-or-nothing option. debug.verbose_sysinit
adds an option to have the code compiled in but quiet by default so that
getting this information from a device in the field doesn't necessarily
require distributing a recompiled kernel.

Its default is VERBOSE_SYSINIT's value as defined in the kernconf. As such,
the default behavior for simply omitting or including this option is
unchanged.

MFC after: 1 week

6 years agoCorrect path to removed asf(8) binary.
jhb [Wed, 20 Jun 2018 19:22:33 +0000 (19:22 +0000)]
Correct path to removed asf(8) binary.

6 years agoImprove wording.
trasz [Wed, 20 Jun 2018 19:16:51 +0000 (19:16 +0000)]
Improve wording.

MFC after: 2 weeks

6 years agousr.bin/ar: use standard 2-Clause FreeBSD license
emaste [Wed, 20 Jun 2018 18:43:17 +0000 (18:43 +0000)]
usr.bin/ar: use standard 2-Clause FreeBSD license

Many licenses on ar files contained small variations from the standard
FreeBSD license text. To avoid license proliferation switch to the usual
2-clause FreeBSD license after obtaining permission from all copyright
holders.

Approved by: jkoshy, kaiw, kientzle
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14561

6 years agoReduce exec and fstat overhead for non-build targets.
bdrewery [Wed, 20 Jun 2018 17:20:39 +0000 (17:20 +0000)]
Reduce exec and fstat overhead for non-build targets.

This is mostly targetting 'make showconfig' and 'make test-system-*' for
the benefit of makeman and universe-one-clang work.

Sponsored by: Dell EMC

6 years agoRegenerate for SYSTEM_LINKER
bdrewery [Wed, 20 Jun 2018 16:15:03 +0000 (16:15 +0000)]
Regenerate for SYSTEM_LINKER

6 years agoAdd WITH_SYSTEM_LINKER, on by default, that avoids building lld when possible.
bdrewery [Wed, 20 Jun 2018 16:10:14 +0000 (16:10 +0000)]
Add WITH_SYSTEM_LINKER, on by default, that avoids building lld when possible.

This works similar to WITH_SYSTEM_COMPILER added in r300354.  It only
supports lld via WITH_LLD_BOOTSTRAP.

When both SYSTEM_COMPILER and SYSTEM_LINKER logic passes then libclang
will not build in cross-tools.  If either check fails though then
libclang is built.

The .info is reworked to notify when libclang will be built since if
either clang or lld needs to be rebuilt, but not the other, the
notification can lead to confusion on why "clang is building".

-fuse-ld= is not used with this method so some combinations of compiler
and linker are expected to fail.

A new 'make test-system-linker' target is added to see the logic results.

Makefile.inc1:
  CROSS_BINUTILS_PREFIX support had to be moved higher up so that XLD
  could be set and MK_LLD_BOOTSTRAP disabled before checking SYSTEM_LINKER
  logic as done with SYSTEM_COMPILER.  This also required moving where
  bsd.linker.mk was read since XLD needs to be set before parsing it.  This
  creates a situation where src.opts.mk can not test LINKER_FEATURES or
  add LLD_BOOTSTAP to BROKEN_OPTIONS.

Reviewed by: emaste (earlier version)
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D15894

6 years agoFix sources needed for lld.
bdrewery [Wed, 20 Jun 2018 16:10:10 +0000 (16:10 +0000)]
Fix sources needed for lld.

lld always needs these DWARF sources, as well as other default and extra
tools. XDL seems to be the best fit list.

Remove MK_LLD_IS_LD check from SRCS_MIW which is now reduced to just a
few files for llvm-objdump.

Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D15915

6 years agoRework WITHOUT_LLD/TOOLCHAIN fix from r327892 for cross-tools.
bdrewery [Wed, 20 Jun 2018 16:10:07 +0000 (16:10 +0000)]
Rework WITHOUT_LLD/TOOLCHAIN fix from r327892 for cross-tools.

MK_LLD is for the installed lld while MK_LLD_BOOTSTRAP is for the build
tool.  For WITH_SYSTEM_LINKER it is necesarry to separate the logic of
these two.  When building libllvm TOOLS_PREFIX will be defined and
MK_LLD_BOOTSTRAP should be checked instead.

Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D15837

6 years agoRework how the ld link is handled in WORLDTMP from r322811.
bdrewery [Wed, 20 Jun 2018 16:10:02 +0000 (16:10 +0000)]
Rework how the ld link is handled in WORLDTMP from r322811.

LLD_BOOTSTRAP (build) is independent of LLD_IS_LD (installed) so they
should not be based on each other.

This is related to upcoming WITH_SYSTEM_LINKER work.

Reviewed by: emaste
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D15836

6 years agoAdd pmap_mapdev_attr for arm64
manu [Wed, 20 Jun 2018 16:07:35 +0000 (16:07 +0000)]
Add pmap_mapdev_attr for arm64

This is needed for efifb.
arm and ricv pmap (the two arch with arm64 that uses subr_devmap) have very
different implementation so for now only add this for arm64.

Tested with efifb on Pine64 with a few other patches.

Reviewed by: cognet
Differential Revision: https://reviews.freebsd.org/D15294

6 years agoif_rk_dwc: Disable setting delays for now
manu [Wed, 20 Jun 2018 15:27:09 +0000 (15:27 +0000)]
if_rk_dwc: Disable setting delays for now

The values for tx/rx delays differs accross the different DTS.
Mainline Linux set it to 0x24/0x18
Mostly-Vendor u-boot (the one maintained and developped) to 0x18/0x18
Mostly-Vendor linux (the one maintained and developped) to 0x26/0x11

By experience only 0x18/0x18 works so until the issue is resolved rely on
the bootloader settings.

6 years agork_gpio: Read the correct register for gpio read
manu [Wed, 20 Jun 2018 14:46:07 +0000 (14:46 +0000)]
rk_gpio: Read the correct register for gpio read

Reported by: jmcneill

6 years agoif_rk_dwc: Fix delays handling
manu [Wed, 20 Jun 2018 14:45:26 +0000 (14:45 +0000)]
if_rk_dwc: Fix delays handling

The property are named {t,r}x_delay and not {t,r}-delay.
The upper bits of the register are a mask of which bits is allowed
to be written, set it otherwise we write nothing.
OF_getencprop returns <0 = for an error.

Pointy Hat: myself
Reported by: jmcneill (delay and mask bits)

6 years agoAttach dev.cpu nodes on powerpc SMT cores, using only the first found thread
jhibbits [Wed, 20 Jun 2018 13:30:35 +0000 (13:30 +0000)]
Attach dev.cpu nodes on powerpc SMT cores, using only the first found thread

Summary: In order to use cpufreq(4), a dev.cpu attachment must be created.  If
the IBM property is found denoting SMT, attach only to the first thread setup,
so that a cpufreq device can bind.

Reviewed by: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D15921

6 years agoInstead of using hand-rolled loops where not needed switch them
bz [Wed, 20 Jun 2018 11:42:06 +0000 (11:42 +0000)]
Instead of using hand-rolled loops where not needed switch them
to FOREACH_PROC_IN_SYSTEM() to have a single pattern to look for.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D15916

6 years agoMove the SYSINIT to allow userspace access to the ARM generic timer later
andrew [Wed, 20 Jun 2018 11:13:10 +0000 (11:13 +0000)]
Move the SYSINIT to allow userspace access to the ARM generic timer later
in the boot. It doesn't need to be early, so move it to the SI_ORDER_ANY
stage of SI_SUB_SMP.

Sponsored by: DARPA, AFRL

6 years agoMove the SMCCC SYSINIT later in the boot so the psci driver has attached.
andrew [Wed, 20 Jun 2018 10:57:29 +0000 (10:57 +0000)]
Move the SMCCC SYSINIT later in the boot so the psci driver has attached.

Sponsored by: DARPA, AFRL

6 years agoFix the SMCCC signatures, they are all 32-bit calls. This fixes SMCCC
andrew [Wed, 20 Jun 2018 10:02:50 +0000 (10:02 +0000)]
Fix the SMCCC signatures, they are all 32-bit calls. This fixes SMCCC
version detection.

Sponsored by: DARPA, AFRL

6 years agoSometimes it is helpful to get the path for a vnode.
bz [Wed, 20 Jun 2018 08:34:29 +0000 (08:34 +0000)]
Sometimes it is helpful to get the path for a vnode.
Implement a ddb function walking the namecache to do this.

Reviewed by: jhb, mjg
Inspired by: gdb macro from jhb (old version)
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D14898

6 years agoFix build breakage in veriexec for 32-bit architectures.
stevek [Wed, 20 Jun 2018 06:54:38 +0000 (06:54 +0000)]
Fix build breakage in veriexec for 32-bit architectures.

fsid_t and ino_t are 64-bit entities, use uintmax_t typecast to ensure we
can print it on 32-bit or 64-bit architectures by using the %ju format for
prints.

Obtained from: Juniper Networks, Inc.

6 years agosort(1): Fix -m when only implicit stdin is used for input
kevans [Wed, 20 Jun 2018 03:31:19 +0000 (03:31 +0000)]
sort(1): Fix -m when only implicit stdin is used for input

Observe:

printf "a\nb\nc\n" > /tmp/foo
# Next command results in no output
cat /tmp/foo | sort -m
# Next command results in proper output
cat /tmp/foo | sort -m -
# Also works:
sort -m /tmp/foo

Some const'ification was done to simplify the actual solution of adding "-"
explicitly to the file list if we didn't have any file arguments left over.

PR: 190099
MFC after: 1 week

6 years agosort(1): Add bits to allow easy checking against NetBSD tests
kevans [Wed, 20 Jun 2018 03:10:49 +0000 (03:10 +0000)]
sort(1): Add bits to allow easy checking against NetBSD tests

I'm looking at sort(1) failures, for better or worse.

6 years agoThis application (veriexecctl) handles reading a fingerprints file
stevek [Wed, 20 Jun 2018 01:08:54 +0000 (01:08 +0000)]
This application (veriexecctl) handles reading a fingerprints file
containing paths, fingerprints, and optional option flags which in turn
get pushed into the MAC/veriexec meta-data store via the veriexec device.

The format of the fingerprints file is as follows:
path type fingerprint options

The type of fingerprint supported depends on what MAC/veriexec fingerprint
modules have been loaded into the system. The veriexecctl application is
able to determine which ones are available by consulting the
security.mac.veriexec.algorithms sysctl.

The following options are currently supported in MAC/veriexec and by the
veriexecctl application:

indirect
  If this option is set then the executable cannot be invoked directly, it
  can only be used as an interpreter in shell scripts.
file
  Indicates that the fingerprint is associated with a file, not an
  executable. Files have their fingerprints verified during open(2) and are
  automatically made read only. This option may be used to verify shared
  libraries have not been tampered with.
no_ptrace
  If this option is set then the executable cannot be traced with the
  ptrace(2) process tracing and debugging call.
trusted
  If this option is set then the executable is allowed to write to the
  mem(4) devices. By default, when verified execution is enforced, no
  process is allowed to write to the mem(4) devices.

The options are not case sensitive.

Reviewed by: jtl, wblock
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D8575

6 years agoThis library allows for user space applications to check file descriptors
stevek [Wed, 20 Jun 2018 00:55:18 +0000 (00:55 +0000)]
This library allows for user space applications to check file descriptors
or paths to see if they can be verified by MAC/veriexec.

Reviewed by: jtl, wblock
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D8562

6 years agoDevice for user space to interface with MAC/veriexec.
stevek [Wed, 20 Jun 2018 00:48:46 +0000 (00:48 +0000)]
Device for user space to interface with MAC/veriexec.

The veriexec device features the following ioctl commands:

VERIEXEC_ACTIVE
  Activate veriexec functionality
VERIEXEC_DEBUG_ON
  Enable debugging mode and increment or set the debug level
VERIEXEC_DEBUG_OFF
  Disable debugging mode
VERIEXEC_ENFORCE
  Enforce veriexec fingerprinting (and acitvate if not already)
VERIEXEC_GETSTATE
  Get current veriexec state
VERIEXEC_LOCK
  Lock changes to veriexec meta-data store
VERIEXEC_LOAD
  Load veriexec fingerprint if secure level is not raised (and passes the
  checks for VERIEXEC_SIGNED_LOAD)
VERIEXEC_SIGNED_LOAD
  Load veriexec fingerprints from loader that supports signed manifest
  (and thus we can be more lenient about secure level being raised.)
  Fingerprints can be loaded if the meta-data store is not locked. Also
  securelevel must not have been raised or some fingerprints must have
  already been loaded, otherwise it would be dangerous to allow loading.
  (Note: this assumes that the fingerprints in the meta-data store at
         least cover the fingerprint loader.)

Reviewed by: jtl
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D8561

6 years agoMAC/veriexec implements a verified execution environment using the MAC
stevek [Wed, 20 Jun 2018 00:41:30 +0000 (00:41 +0000)]
MAC/veriexec implements a verified execution environment using the MAC
framework.

The code is organized into a few distinct pieces:

* The meta-data store (in veriexec_metadata.c) which maps a file system
  identifier, file identifier, and generation key tuple to veriexec
  meta-data record.

* Fingerprint management (in veriexec_fingerprint.c) which deals with
  calculating the cryptographic hash for a file and verifying it. It also
  manages the loadable fingerprint modules.

* MAC policy implementation (in mac_veriexec.c) which implements the
  following MAC methods:

mpo_init
  Initializes the veriexec state, meta-data store, fingerprint modules,
  and registers mount and unmount EVENTHANDLERs

mpo_syscall
  Implements the following per-policy system calls:
  MAC_VERIEXEC_CHECK_FD_SYSCALL
    Check a file descriptor to see if the referenced file has a valid
    fingerprint.
  MAC_VERIEXEC_CHECK_PATH_SYSCALL
    Check a path to see if the referenced file has a valid fingerprint.

mpo_kld_check_load
  Check if loading a kld is allowed. This checks if the referenced vnode
  has a valid fingerprint.

mpo_mount_destroy_label
  Clears the veriexec slot data in a mount point label.

mpo_mount_init_label
  Initializes the veriexec slot data in a mount point label.
  The file system identifier is saved in the veriexec slot data.

mpo_priv_check
  Check if a process is allowed to write to /dev/kmem and /dev/mem
  devices.
  If a process is flagged as trusted, it is allowed to write.

mpo_proc_check_debug
  Check if a process is allowed to be debugged. If a process is not
  flagged with VERIEXEC_NOTRACE, then debugging is allowed.

mpo_vnode_check_exec
  Check is an exectuable is allowed to run. If veriexec is not enforcing
  or the executable has a valid fingerprint, then it is allowed to run.
  NOTE: veriexec will complain about mismatched fingerprints if it is
  active, regardless of the state of the enforcement.

mpo_vnode_check_open
  Check is a file is allowed to be opened. If verification was not
  requested, veriexec is not enforcing, or the file has a valid
  fingerprint, then veriexec will allow the file to be opened.

mpo_vnode_copy_label
  Copies the veriexec slot data from one label to another.

mpo_vnode_destroy_label
  Clears the veriexec slot data in a vnode label.

mpo_vnode_init_label
  Initializes the veriexec slot data in a vnode label.
  The fingerprint status for the file is stored in the veriexec slot data.

* Some sysctls, under security.mac.veriexec, for setting debug level,
  fetching the current state in a human-readable form, and dumping the
  fingerprint database are implemented.

* The MAC policy implementation source file also contains some utility
  functions.

* A set of fingerprint modules for the following cryptographic hash
  algorithms:
  RIPEMD-160, SHA1, SHA2-256, SHA2-384, SHA2-512

* Loadable module builds for MAC/veriexec and fingerprint modules.

 WARNING: Using veriexec with NFS (or other network-based) file systems is
          not recommended as one cannot guarantee the integrity of the files
          served, nor the uniqueness of file system identifiers which are
          used as key in the meta-data store.

Reviewed by: ian, jtl
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D8554

6 years agoRevert r335276
allanjude [Wed, 20 Jun 2018 00:14:54 +0000 (00:14 +0000)]
Revert r335276

This was causing issues for people booting.
I will likely bring this back as an optional feature, similar to
boot0sio, like gptboot-serial or something.

PR: 221526
Reported by: O. Hartmann <ohartmann@walstatt.org>, Thomas Laus <lausts@acm.org>

6 years agoUse capsicum helpers to cache NLS data.
oshogbo [Wed, 20 Jun 2018 00:13:09 +0000 (00:13 +0000)]
Use capsicum helpers to cache NLS data.

6 years agoTARGET_TRIPLE is needed much earlier now for CROSS_BINUTILS_PREFIX check.
bdrewery [Tue, 19 Jun 2018 23:57:12 +0000 (23:57 +0000)]
TARGET_TRIPLE is needed much earlier now for CROSS_BINUTILS_PREFIX check.

This was missed in r335394 since the check became exists(/usr/local) in
my testing.

X-MFC-With: r335394
MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agoConvert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.
oshogbo [Tue, 19 Jun 2018 23:43:14 +0000 (23:43 +0000)]
Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.

No functional change intended.

6 years agoFix detection for binutils bootstrap package.
bdrewery [Tue, 19 Jun 2018 23:40:42 +0000 (23:40 +0000)]
Fix detection for binutils bootstrap package.

The path was changed recently in the port to be the full target triple.

MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agoLet CROSS_BINUTILS_PREFIX work without a trailing slash.
bdrewery [Tue, 19 Jun 2018 23:40:39 +0000 (23:40 +0000)]
Let CROSS_BINUTILS_PREFIX work without a trailing slash.

Reported by: jhb
MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agoSYSTEM_COMPILER: Should use X_ vars for comparing wanted version.
bdrewery [Tue, 19 Jun 2018 23:40:36 +0000 (23:40 +0000)]
SYSTEM_COMPILER: Should use X_ vars for comparing wanted version.

It is XCC used during the build of target binaries that replaces the
bootstrap compiler.

Also slightly tweak style.

MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agoFix X_COMPILER_* and X_LINKER_* not being passed to installworld environment.
bdrewery [Tue, 19 Jun 2018 23:39:55 +0000 (23:39 +0000)]
Fix X_COMPILER_* and X_LINKER_* not being passed to installworld environment.

This could lead to 'sh: head: not found' warnings which were a symptom
of running 'ld --version' during installworld.  This was only happening
with XCC or XLD set.  It is intended that cc and ld do not run during
installworld.  The metadata for these are already stored in
compiler-metadata.mk added in r316794.

This also removes redundant CROSSENV additions that were for
WITH_SYSTEM_COMPILER, WITHOUT_CROSS_COMPILER, and WITHOUT_TOOLCHAIN
which all don't have a cc or ld in their PATH during install.

Reported by: Mark Millard
MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agotop(1): fix top -mio
eadler [Tue, 19 Jun 2018 23:30:55 +0000 (23:30 +0000)]
top(1): fix top -mio

6 years agoFix typo.
oshogbo [Tue, 19 Jun 2018 22:19:42 +0000 (22:19 +0000)]
Fix typo.

6 years agoFix typo noticed by pstef@.
imp [Tue, 19 Jun 2018 21:58:04 +0000 (21:58 +0000)]
Fix typo noticed by pstef@.

6 years agolinuxulator: handle V3 capget/capset
emaste [Tue, 19 Jun 2018 21:26:23 +0000 (21:26 +0000)]
linuxulator: handle V3 capget/capset

Linux 2.6.26 introduced 64-bit capability sets.  Extend our stub
implementation to handle both 32- and 64-bit.  (We still report no
capabilities in capget, and disallow any in capset.)

Reviewed by: chuck
Sponsored by: Turing Robotic Industries Inc.
Differential Revision: https://reviews.freebsd.org/D15887

6 years agoMK_EFI - Add uefisign and friends to this knob and ensure that we don't
sbruno [Tue, 19 Jun 2018 21:07:25 +0000 (21:07 +0000)]
MK_EFI - Add uefisign and friends to this knob and ensure that we don't
try to build them if MK_OPENSSL is unset.

Reviewed by: emaste imp kevans
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15211

6 years agoFix setting RCA for MMC cards
kibab [Tue, 19 Jun 2018 20:02:03 +0000 (20:02 +0000)]
Fix setting RCA for MMC cards

Unlike SD cards, that publish RCA in response to CMD3,
MMC cards expect the host to set RCA itself.

Since we don't support multiple MMC cards on the bus,
just assign a static RCA of 2 to the attached MMC card.

Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D13063

6 years agoDocument the new ${name}_env_file feature
feld [Tue, 19 Jun 2018 19:27:37 +0000 (19:27 +0000)]
Document the new ${name}_env_file feature

Approved by: bcr
MFH: 3 days
Differential Revision: https://reviews.freebsd.org/D15578

6 years agoReally fix the style.
lwhsu [Tue, 19 Jun 2018 18:43:02 +0000 (18:43 +0000)]
Really fix the style.

Approved by: oshogbo
Sponsored by: The FreeBSD Foundation

6 years agotop(1): Fix Coverity warning
asomers [Tue, 19 Jun 2018 18:32:06 +0000 (18:32 +0000)]
top(1): Fix Coverity warning

Don't call strerror on negative errnos

Reported by: Coverity
CID: 976708
Reviewed by: eadler
Differential Revision: https://reviews.freebsd.org/D15909

6 years agostyle(9) fix, I was also going to silence gcc.
lwhsu [Tue, 19 Jun 2018 18:25:43 +0000 (18:25 +0000)]
style(9) fix, I was also going to silence gcc.

Approved by: emaste, oshogbo
Sponsored by: The FreeBSD Foundation

6 years agoSet prev to NULL so its garaunteed to have a value of some kind and
sbruno [Tue, 19 Jun 2018 18:09:15 +0000 (18:09 +0000)]
Set prev to NULL so its garaunteed to have a value of some kind and
gcc doesn't explode.  Feel free to fix this correctly or whatever for
gcc builds.

This *should* quiesce tinderbox after r335347 for the gcc builds.

6 years agoaudit(4): add tests for sendmsg, recvmsg, shutdown, and sendfile
asomers [Tue, 19 Jun 2018 17:41:46 +0000 (17:41 +0000)]
audit(4): add tests for sendmsg, recvmsg, shutdown, and sendfile

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

6 years agousr.bin/ar: remove incorrect SPDX tags
emaste [Tue, 19 Jun 2018 17:30:11 +0000 (17:30 +0000)]
usr.bin/ar: remove incorrect SPDX tags

Three ar files have a non-standard variation of the BSD license, so
remove their SPDX tags.

Sponsored by: The FreeBSD Foundation

6 years agousr.bin/ar: use standard 2-Clause FreeBSD license
emaste [Tue, 19 Jun 2018 17:28:05 +0000 (17:28 +0000)]
usr.bin/ar: use standard 2-Clause FreeBSD license

Many licenses on ar files contained small variations from the standard
FreeBSD license text. To avoid license proliferation switch to the usual
standard 2-clause FreeBSD license for those files where I have obtained
permission from all of the listed copyright holders.

Approved by: jkoshy, kaiw
Differential Revision: https://reviews.freebsd.org/D14561

6 years agoaudit(4): add tests for utimes(2) and friends, mprotect, and undelete
asomers [Tue, 19 Jun 2018 16:55:39 +0000 (16:55 +0000)]
audit(4): add tests for utimes(2) and friends, mprotect, and undelete

Includes utimes(2), futimes(2), lutimes(2), futimesat(2), mprotect(2), and
undelete(2).  undelete, for now, is tested only in failure mode.

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

6 years agoMove common GIC interrupt numbers to the common header. These are the same
andrew [Tue, 19 Jun 2018 16:14:23 +0000 (16:14 +0000)]
Move common GIC interrupt numbers to the common header. These are the same
across the GICv2 and GICv3 drivers so we only need a single copy of them.

Sponsored by: Turing Robotic Industries

6 years agoRemove "diff" line indicator. Next to see if this code works or not.
sbruno [Tue, 19 Jun 2018 15:55:21 +0000 (15:55 +0000)]
Remove "diff" line indicator.  Next to see if this code works or not.

Submitted by: mmacy
Sponsored by: Limelight Networks

6 years agolualoader: Correct kernel_options handling
kevans [Tue, 19 Jun 2018 15:05:31 +0000 (15:05 +0000)]
lualoader: Correct kernel_options handling

`kernel_options` were being passed as flags to load, rather than to the
kernel being loaded. This is the kernel_options counterpart to r335009.

6 years agoo Implement unw_getcontext()
br [Tue, 19 Jun 2018 14:46:59 +0000 (14:46 +0000)]
o Implement unw_getcontext()
o Restore floating-point registers in jumpto()

These are required to native cross build GCC and GDB
(both do require libc++ and libunwind).

These are not tested.

Sponsored by: DARPA, AFRL

6 years agoDon't use TARGET_ARCH in this file, use MACHINE_ARCH instead.
br [Tue, 19 Jun 2018 13:28:02 +0000 (13:28 +0000)]
Don't use TARGET_ARCH in this file, use MACHINE_ARCH instead.

TARGET_ARCH is not defined when building ports/packages.

Sponsored by: DARPA, AFRL

6 years agoshare/misc/organization.dot: updates
pi [Tue, 19 Jun 2018 12:16:19 +0000 (12:16 +0000)]
share/misc/organization.dot: updates

- add krion, philip to postmaster@
- remove trhodes from donations@, email bounces

Approved by: remko