]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoRemove the various build flag hacks for GCC cross-compile.
jhb [Thu, 28 Jun 2018 21:26:14 +0000 (21:26 +0000)]
Remove the various build flag hacks for GCC cross-compile.

The xtoolchain GCC packages have not required these flags since ports
commits r465416 and r466701.  The in-tree GCC 4.2.1 has also been patched
in r335716 and r335717 to correctly honor --sysroot when looking for
includes and libraries.

Reviewed by: bdrewery
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D16055

5 years ago[rpi] Add SDHOST device driver for Raspberry Pi
gonzo [Thu, 28 Jun 2018 21:14:33 +0000 (21:14 +0000)]
[rpi] Add SDHOST device driver for Raspberry Pi

SDHOST is another SD controller that is present on Raspberry Pi (the
other one is SDHC and handled by bcm2835_sdhci driver). Both
controllers are capable of providing interface to SD card, actual
configuration can be set in dtb file. At the moment custom DTBs for
RPi/RPi2 have sdhost node disabled. On RPi3 sdhost is disabled in
snapshot images by applying mmc.dtbo overlay. To enalbe both devices
user has to edit config.txt on FAT partition and remove or comment
"dtoverlay=mmc" line.

When no overlay applied on RPi3 SDHOST controls SD card and SDHC
interface can be used for SDIO. mmc.dtbo overlay disables SDHOST node
and switches SD card over to SDHC.  Likewise sdhost.dtbo overlay (not
currently included in snapshot image, but can be obtained from firmare
repo[1]) disabled SDHC node and switch SD card over to SDHOST.

[1] https://github.com/raspberrypi/firmware/tree/master/boot/overlays

Submitted by: Klaus P. Ohrhallinger <k@7he.at>
Differential Revision: https://reviews.freebsd.org/D14168

5 years agoFix compilation error in r335765 under gcc 4.2.1.
dab [Thu, 28 Jun 2018 20:37:17 +0000 (20:37 +0000)]
Fix compilation error in r335765 under gcc 4.2.1.

The anonymous object initialization introduced in r335765 was
acceptable to clang, but not gcc 4.2.1. Fix it for both.

Reported by: jhibbits@
Pointy Hat: myself
MFC after: 1 week
X-MFC-with: r335765
Sponsored by: Dell EMC

5 years agoAdd stub arm64 linuxulator VDSO ldscript
emaste [Thu, 28 Jun 2018 20:36:21 +0000 (20:36 +0000)]
Add stub arm64 linuxulator VDSO ldscript

This needs to be revisited with the VDSO implementation, but is
sufficient to allow the linux64 module to build on arm64 for testing
and development.

Sponsored by: Turing Robotic Industries

5 years agoRevert preference to be an int.
imp [Thu, 28 Jun 2018 19:42:10 +0000 (19:42 +0000)]
Revert preference to be an int.

While in base we use it as a boolean (of the wrong spelling), there's
at least one out of tree user that needs it to be int since priorirty
is a small int, not a 0/1. In deference to the time it's wasted me and
my team, push this up into FreeBSD for whatever short life boot1 may
have in the tree.

5 years agoSYSTEM_COMPILER/LINKER: Fix cross-build support after r335706.
bdrewery [Thu, 28 Jun 2018 19:01:53 +0000 (19:01 +0000)]
SYSTEM_COMPILER/LINKER: Fix cross-build support after r335706.

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

5 years agotinderbox: If the clang lookup fails fallback to the old default behavior.
bdrewery [Thu, 28 Jun 2018 18:22:20 +0000 (18:22 +0000)]
tinderbox: If the clang lookup fails fallback to the old default behavior.

This fixes errors from the MK_CLANG_BOOTSTRAP/MK_LLD_BOOTSTRAP lookups
to not force using XCC/XLD but to rather just build them as normal by
allowing their own bootstrap logic to work.

MFC after: 3 weeks
X-MFC-with: r335711 r335769
Sponsored by: Dell EMC

5 years agoInclude existing MAKE_PARAMS_<target> when determining the universe toolchain.
jhb [Thu, 28 Jun 2018 18:19:46 +0000 (18:19 +0000)]
Include existing MAKE_PARAMS_<target> when determining the universe toolchain.

This fixes a warning for each RISCV target during universe by passing in
the required CROSS_TOOLCHAIN setting which will in turn set
CROSS_BINUTILS_PREFIX correctly.  It also ensures that a tinderbox build
uses the correct compiler for riscv.  Previously it was using the shared
clang compiler instead of riscv64-gcc.

Reviewed by: bdrewery
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D16049

5 years agosigaction.2: Minor cleanups
cem [Thu, 28 Jun 2018 18:17:20 +0000 (18:17 +0000)]
sigaction.2: Minor cleanups

Add vertical space between struct definition and function prototype.

Use "NULL" to describe zero pointers, instead of "zero."

Remove perhaps unclear "can not" and replace.  Tag struct member names used
with appropriate tags.

5 years agoReflow one of the comments describing vm_phys_alloc_npages().
alc [Thu, 28 Jun 2018 17:52:06 +0000 (17:52 +0000)]
Reflow one of the comments describing vm_phys_alloc_npages().

5 years agoAdd missing MODULE_VERSION() and MODULE_DEPEND().
ian [Thu, 28 Jun 2018 17:07:20 +0000 (17:07 +0000)]
Add missing MODULE_VERSION() and MODULE_DEPEND().

5 years agoRemove potential identifier conflict in the EV_SET macro.
dab [Thu, 28 Jun 2018 17:01:04 +0000 (17:01 +0000)]
Remove potential identifier conflict in the EV_SET macro.

PR43905 pointed out a problem with the EV_SET macro if the passed
struct kevent pointer were specified with an expression with side
effects (e.g., "kevp++"). This was fixed in rS110241, but by using a
local block that defined an internal variable (named "kevp") to get
the pointer value once. This worked, but could cause issues if an
existing variable named "kevp" is in scope. To avoid that issue,
jilles@ pointed out that "C99 compound literals and designated
initializers allow doing this cleanly using a macro". This change
incorporates that suggestion, essentially verbatim from jilles@
comment on PR43905, except retaining the old definition for pre-C99 or
non-STDC (e.g., C++) compilers.

PR: 43905
Submitted by: Jilles Tjoelker (jilles@)
Reported by: Lamont Granquist <lamont@scriptkiddie.org>
Reviewed by: jmg (no comments), jilles
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=43905

5 years agoFix quoting in sending the NOMATCH event to devmatch
imp [Thu, 28 Jun 2018 15:00:18 +0000 (15:00 +0000)]
Fix quoting in sending the NOMATCH event to devmatch

The NOMATCH event was previously quoted to protect it from shell
expansion. However, that quoting now interferes with the quoting devd
is doing. Quote to protect just the ?.

5 years agoSimplify using bsd.endian.mk and have it provide CAP_MKDB_ENDIAN, since it is
brd [Thu, 28 Jun 2018 13:48:59 +0000 (13:48 +0000)]
Simplify using bsd.endian.mk and have it provide CAP_MKDB_ENDIAN, since it is
the most common usage.

Approved by: bapt (mentor)

5 years agoAdd NULL pointer check.
ae [Thu, 28 Jun 2018 11:39:27 +0000 (11:39 +0000)]
Add NULL pointer check.

encap_lookup_t method can be invoked by IP encap subsytem even if none
of gif/gre/me interfaces are exist. Hash tables are allocated on demand,
when first interface is created. So, make NULL pointer check before
doing access to hash table.

PR: 229378

5 years agoRemove extra "ipfw" from example.
ae [Thu, 28 Jun 2018 09:42:30 +0000 (09:42 +0000)]
Remove extra "ipfw" from example.

MFC after: 1 week

5 years agoifconfig(8): Attempt to render non-printable sequences w/ UTF-8 Environment
kevans [Thu, 28 Jun 2018 03:37:15 +0000 (03:37 +0000)]
ifconfig(8): Attempt to render non-printable sequences w/ UTF-8 Environment

Currently ifconfig(8) only prints the hex representation of ssid names
with non-ASCII characters. Many modern terminals are able to properly render
non-ASCII characters. This change checks if the terminal charmap is UTF-8,
and if so, will render the characters, rather than the hex value.

This behavior is circumvented by running ifconfig(8) in a non-UTF8 locale;
e.g. C or POSIX.

It was pointed out by kp@ during the review that APs have the option to
broadcast whether their SSIDs may be interpreted as UTF-8. Ideally, we would
honor this and only attempt this behavior if it's so-broadcasted by the AP.

However, a sample survey showed that hostapd will advertise this if
indicated in config but it doesn't seem to be so common in the AP market, so
this would be effectively useless as we'll rarely know if the SSID should be
renderable as UTF-8.

Despite this, it was decided to be OK with this anyways- there's a
straightforward path to doing it the right way based on advertisement by AP
if we need to go that route, and one can revert to old behavior easily
enough at runtime if we get it wrong.

Submitted by: Farhan Khan <khanzf@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D15922

5 years agoWe're not, yet, at C++11 capable on all our plaforms.
imp [Thu, 28 Jun 2018 01:45:53 +0000 (01:45 +0000)]
We're not, yet, at C++11 capable on all our plaforms.

Use a possibly slower, but C++98 compatibe way to iterate through the
string.

Noticed by: g++ 4.2.1 and Mark Millard

5 years agoSafely quote all variable expansions.
imp [Wed, 27 Jun 2018 23:44:37 +0000 (23:44 +0000)]
Safely quote all variable expansions.

When expanding a variable set by a message from the kernel, safely
quote all arguments expanded when creating a command line for the
shell.

Reviewd by: Shawn Webb, Oliver Pinter, brd@
Sponsored by: Netflix

5 years agoFix typo in top-level Makefile
dteske [Wed, 27 Jun 2018 22:15:50 +0000 (22:15 +0000)]
Fix typo in top-level Makefile

Submitted by: Ben Widawsky <ben.widawsky@intel.com>
MFC after: 3 days
X-MFC-to: stable/11 stable/10
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/P186

5 years agoCheck the inp_flags under inp lock. Looks like the race was hidden
glebius [Wed, 27 Jun 2018 22:01:59 +0000 (22:01 +0000)]
Check the inp_flags under inp lock. Looks like the race was hidden
before, the conversion of tcbinfo to CK_LIST have uncovered it.

5 years agoCorrect r335242. Use unsigned cast instead of abs(). Using abs() gives
glebius [Wed, 27 Jun 2018 22:00:50 +0000 (22:00 +0000)]
Correct r335242. Use unsigned cast instead of abs(). Using abs() gives
incorrect result when ticks has already wrapped, and are about to reach
the cr_ticks value (cr_ticks - ticks < hz).

Submitted by: bde

5 years agoLLVM_TARGET_ALL: Default LLVM_TARGET_ARM on for aarch64.
bdrewery [Wed, 27 Jun 2018 21:36:57 +0000 (21:36 +0000)]
LLVM_TARGET_ALL: Default LLVM_TARGET_ARM on for aarch64.

This is needed for -m32 support which is used in the kernel cloudabi32 module.

Tweak the style to make it easier to understand.

MFC after: 2 weeks
X-MFC-with: r335706
Reported by: Mark Millard
Sponsored by: Dell EMC

5 years agoStop building intermediate .o files.
bdrewery [Wed, 27 Jun 2018 21:36:49 +0000 (21:36 +0000)]
Stop building intermediate .o files.

These are not used to link the final tool anymore.  At some point in the past
the suffix rules changed to not link these in.  The original reason for this in
r19176 is unclear but seems to be related to mkdep.  The .depend handling is
still broken here as it is for all build tool patterns like this.

Sponsored by: Dell EMC

5 years agoDon't use CCACHE for linking.
bdrewery [Wed, 27 Jun 2018 19:29:15 +0000 (19:29 +0000)]
Don't use CCACHE for linking.

MFC after: 2 weeks
Sponsored by: Dell EMC

5 years agoFix description for the "autoconf" ifconfig(8) flag; it's an address
trasz [Wed, 27 Jun 2018 19:28:37 +0000 (19:28 +0000)]
Fix description for the "autoconf" ifconfig(8) flag; it's an address
property, not something you set for an interface.

MFC after: 2 weeks

5 years agoChase the pwd_mkdb endian changes.
brd [Wed, 27 Jun 2018 19:10:32 +0000 (19:10 +0000)]
Chase the pwd_mkdb endian changes.

Approved by: bapt (mentor)

5 years agoFollow-up r335706: Fix LLVM_TARGET_ALL handling to use TARGET_ARCH.
bdrewery [Wed, 27 Jun 2018 18:43:34 +0000 (18:43 +0000)]
Follow-up r335706: Fix LLVM_TARGET_ALL handling to use TARGET_ARCH.

Pointyhat to: bdrewery
MFC after: 2 weeks
X-MFC-with: r335706
Reported by: Mark Millard
Sponsored by: Dell EMC

5 years agoFix GCC 4.2.1 to honor --sysroot for includes.
jhb [Wed, 27 Jun 2018 18:14:33 +0000 (18:14 +0000)]
Fix GCC 4.2.1 to honor --sysroot for includes.

- Change the C++ directory entries to honor --sysroot if it is set.
- Don't define CROSS_INCLUDE_DIR for the cross compiler.  Instead, set
  TARGET_SYSTEM_ROOT to point to WORLDTMP and always define
  STANDARD_INCLUDE_DIR.
- Change STANDARD_INCLUDE_DIR and the C++ include directories to just
  start with "/usr" always.  The compiler will prepend the sysroot when
  doing cross-builds.  GCC_INCLUDE_DIR (which contains headers that ship
  with the compiler such as intrinsincs rather than OS-supplied headers)
  remains hardcoded to look in TOOLS_PREFIX.

Reviewed by: bdrewery (older version)
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D15127

5 years agoDon't hardcode the TOOLS_PREFIX for the startfiles directories.
jhb [Wed, 27 Jun 2018 18:11:47 +0000 (18:11 +0000)]
Don't hardcode the TOOLS_PREFIX for the startfiles directories.

GCC 4.2 prefixes these directories with --sysroot meaning that during
buildworld they have a double sysroot.

Reviewed by: bdrewery
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D14780

5 years agoAdd FreeBSD 11.2.
gjb [Wed, 27 Jun 2018 17:40:29 +0000 (17:40 +0000)]
Add FreeBSD 11.2.

Sponsored by: The FreeBSD Foundation

5 years agoRegenerate
bdrewery [Wed, 27 Jun 2018 17:18:12 +0000 (17:18 +0000)]
Regenerate

5 years agoPush users towards LLVM_TARGET_ALL.
bdrewery [Wed, 27 Jun 2018 17:13:36 +0000 (17:13 +0000)]
Push users towards LLVM_TARGET_ALL.

MFC after: 1 week

5 years agotinderbox: Only build clang/lld once if needed.
bdrewery [Wed, 27 Jun 2018 16:58:10 +0000 (16:58 +0000)]
tinderbox: Only build clang/lld once if needed.

Need to handle LLD_BOOTSTRAP separately (for archs like i386).
This would be much better off with an off-by-default option like
SHARED_TOOLCHAIN that universe force-enabled.  Then a normal buildworld
would store the toolchain there if enabled and otherwise in WORLDTMP
with only the 1 arch selected.

MFC after: 3 weeks
Sponsored by: Dell EMC

5 years agoCCACHE_BUILD: Don't try using ccache for compile-linking .c files.
bdrewery [Wed, 27 Jun 2018 16:58:07 +0000 (16:58 +0000)]
CCACHE_BUILD: Don't try using ccache for compile-linking .c files.

Without -c ccache just executes the real compiler.

MFC after: 2 weeks
Sponsored by: Dell EMC

5 years agoCCACHE_BUILD: Avoid ccache when looking up compiler metadata.
bdrewery [Wed, 27 Jun 2018 16:58:03 +0000 (16:58 +0000)]
CCACHE_BUILD: Avoid ccache when looking up compiler metadata.

MFC after: 2 weeks
Sponsored by: Dell EMC

5 years agotinderbox: Give details about kernel builds.
bdrewery [Wed, 27 Jun 2018 16:57:59 +0000 (16:57 +0000)]
tinderbox: Give details about kernel builds.

This is a bit noisy now but it was silent before leading to
wondering if it was doing anything.

MFC after: 1 week
Suggested by: rpokala
Sponsored by: Dell EMC

5 years agoClang: Only build needed target for bootstrap compiler.
bdrewery [Wed, 27 Jun 2018 16:57:56 +0000 (16:57 +0000)]
Clang: Only build needed target for bootstrap compiler.

This will disable the new LLVM_TARGET_ALL option which will only
enable the required target.

This only impacts the bootstrap compiler in WORLDTMP, not the target compiler
that will be installed.

MFC after: 2 weeks
Reviewed by: sbruno, dim (earlier version)
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D16021

5 years agoAdd LLVM_TARGET_ALL option.
bdrewery [Wed, 27 Jun 2018 16:57:51 +0000 (16:57 +0000)]
Add LLVM_TARGET_ALL option.

LLVM_TARGET_* will auto be set based on LLVM_TARGET_ALL and MK_CLANG.

If LLVM_TARGET_ALL is disabled, during a cross-build, then SYSTEM_COMPILER
and SYSTEM_LINKER are auto disabled.

This option should be used by users rather than the per-arch LLVM_TARGET
options as it is simpler to maintain for them should the supported
target list change.

MFC after: 2 weeks
Reviewed by: sbruno, dim
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D16020

5 years agoUse dependent options to auto enable _SUPPORT and CLANG_FULL options.
bdrewery [Wed, 27 Jun 2018 16:57:47 +0000 (16:57 +0000)]
Use dependent options to auto enable _SUPPORT and CLANG_FULL options.

MFC after: 1 week
Reviewed by: sbruno, dim
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D16018

5 years agoRework check for libclang_rt to see if the needed library exists.
bdrewery [Wed, 27 Jun 2018 16:56:46 +0000 (16:56 +0000)]
Rework check for libclang_rt to see if the needed library exists.

Currently libclang_rt is not provided for cross-building and as such
is not connected to cross-tools.  For building clang once in universe
it is likely that libclang_rt won't exist for the universe toolchain
but even if it did it would not support anything but the native arch.
So explicitly check for support before enabling h_raw.

MFC after: 1 week
Reviewed by: dim
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D16012

5 years agoaudit(4): fix Coverity issues
asomers [Wed, 27 Jun 2018 15:28:09 +0000 (15:28 +0000)]
audit(4): fix Coverity issues

Fix several incorrect buffer size arguments and a file descriptor leak.

Submitted by: aniketp
Reported by: Coverity
CID: 1393489 1393501 1393509 1393510 1393514 1393515 1393516
CID: 1393517 1393518 1393519
MFC after: 2 weeks
X-MFC-With: 335284
X-MFC-With: 335318
X-MFC-With: 335320
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16000

5 years agoSplit kern_break from sys_break and use it in linuxulator
emaste [Wed, 27 Jun 2018 14:45:13 +0000 (14:45 +0000)]
Split kern_break from sys_break and use it in linuxulator

Previously the linuxulator's linux_brk invoked the FreeBSD sys_break
syscall implementation directly.  Instead, move the bulk of the existing
implementation to kern_break, and call that from both sys_break and
linux_brk.

This also addresses a minor bug in linux_brk in that we now return the
actual (rounded up) break address, rather than the requested value.

Reviewed by: brooks (earlier version)
Sponsored by: Turing Robotic Industries
Differential Revision: https://reviews.freebsd.org/D16019

5 years agocxgbe/cxgbei: Fix harmful typo in the iSCSI offload driver.
np [Wed, 27 Jun 2018 14:29:13 +0000 (14:29 +0000)]
cxgbe/cxgbei: Fix harmful typo in the iSCSI offload driver.

Reported by: gcc8 (via mmacy@)
MFC after: 3 days
Sponsored by: Chelsio Communications

5 years agoImprove the kernel's USB descriptor reading function.
hselasky [Wed, 27 Jun 2018 12:08:12 +0000 (12:08 +0000)]
Improve the kernel's USB descriptor reading function.
Some USB devices does not allow a partial descriptor readout.

Found by: bz@
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoRevert Makefile@335696 that sneaked into the commit.
delphij [Wed, 27 Jun 2018 06:50:24 +0000 (06:50 +0000)]
Revert Makefile@335696 that sneaked into the commit.

X-MFC with: 335696
MFC after: 2 weeks

5 years agoDetect exFAT filesystems and abort if found and tighten BPB sanity
delphij [Wed, 27 Jun 2018 06:49:20 +0000 (06:49 +0000)]
Detect exFAT filesystems and abort if found and tighten BPB sanity
check.

Obtained from: Android https://android-review.googlesource.com/61827
MFC after: 2 weeks

5 years agoRemove devctl_safe_quote since it's now unused.
imp [Wed, 27 Jun 2018 04:11:19 +0000 (04:11 +0000)]
Remove devctl_safe_quote since it's now unused.

Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D16026

5 years agopccard: recode to use devctl_safe_quote_sb instead of devctl_safe_quote.
imp [Wed, 27 Jun 2018 04:11:14 +0000 (04:11 +0000)]
pccard: recode to use devctl_safe_quote_sb instead of devctl_safe_quote.

Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D16026

5 years agoFix devctl generation for core files.
imp [Wed, 27 Jun 2018 04:11:09 +0000 (04:11 +0000)]
Fix devctl generation for core files.

We have a problem with vn_fullpath_global when the file exists. Work
around it by printing the full path if the core file name starts with /,
or current working directory followed by the filename if not.

Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D16026

5 years agoCreate new devctl_safe_quote_sb to copy a source string into a struct
imp [Wed, 27 Jun 2018 04:10:48 +0000 (04:10 +0000)]
Create new devctl_safe_quote_sb to copy a source string into a struct
sbuf to make it safe. Callers are expected to add the " " around it,
if needed.

Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D16026

5 years ago- Added myself to committers-src.dot
miwi [Wed, 27 Jun 2018 03:50:11 +0000 (03:50 +0000)]
- Added myself to committers-src.dot

Approved by: araujo (mentor)
Differential Revision: https://reviews.freebsd.org/D16030

5 years agotop(1): increased the maximum length of command shown by "-a"
daichi [Wed, 27 Jun 2018 02:55:30 +0000 (02:55 +0000)]
top(1): increased the maximum length of command shown by "-a"

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

5 years agocxgbe(4): Do not leak the filters in the hashfilter table on module
np [Wed, 27 Jun 2018 01:51:17 +0000 (01:51 +0000)]
cxgbe(4): Do not leak the filters in the hashfilter table on module
unload.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agopowerd: correct ifdef check for ppc
eadler [Wed, 27 Jun 2018 01:28:09 +0000 (01:28 +0000)]
powerd: correct ifdef check for ppc

Reviewed by: jhibbits

5 years agoPartial revert of r335399 and r335400:
stevek [Tue, 26 Jun 2018 23:28:03 +0000 (23:28 +0000)]
Partial revert of r335399 and r335400:
Unhook the MAC/veriexec, fingerprint handlers, and veriexec modules from
the kernel modules Makefile.

Reviewed by: sjg

5 years agoRevert r335402
stevek [Tue, 26 Jun 2018 23:19:55 +0000 (23:19 +0000)]
Revert r335402

While useful as an example, veriexecctl, as it is, has very little practical
use, since there is nothing ensuring the integrity of the manifest of hashes.
A more appropriate set of utilities will replace it.

5 years agocxgbetool(8): Reject invalid VLAN values.
np [Tue, 26 Jun 2018 21:56:06 +0000 (21:56 +0000)]
cxgbetool(8): Reject invalid VLAN values.

Submitted by: Krishnamraju Eraparaju @ Chelsio
MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agoaudit(4): add tests for the process-control audit class
asomers [Tue, 26 Jun 2018 20:26:57 +0000 (20:26 +0000)]
audit(4): add tests for the process-control audit class

Tested syscalls include rfork(2), chdir(2), fchdir(2), chroot(2),
getresuid(2), getresgid(2), setpriority(2), setgroups(2), setpgrp(2),
setrlimit(2), setlogin(2), mlock(2), munlock(2), minherit(2), rtprio(2),
profil(2), ktrace(2), ptrace(2), fork(2), umask(2), setuid(2), setgid(2),
seteuid(2), and setegid(2).  The last six are only tested in the success
case, either because they're infalliable or a failure is difficult to cause
on-demand.

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

5 years ago[libcasper] Use explicit_bzero instead of memset to clear pwd struct
oshogbo [Tue, 26 Jun 2018 19:57:47 +0000 (19:57 +0000)]
[libcasper] Use explicit_bzero instead of memset to clear pwd struct

Submitted by: David Carlier <devnexen@gmail.com>
Differential Revision: https://reviews.freebsd.org/D16015

5 years agoaudit(4): add tests for pipe, posix_openpt, shm_open, and shm_unlink
asomers [Tue, 26 Jun 2018 19:26:07 +0000 (19:26 +0000)]
audit(4): add tests for pipe, posix_openpt, shm_open, and shm_unlink

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

5 years agoCorrect linprocfs/linsysfs arch check in r335672
emaste [Tue, 26 Jun 2018 19:13:49 +0000 (19:13 +0000)]
Correct linprocfs/linsysfs arch check in r335672

Pointy hat to: emaste

5 years agoFix file(1) dumpdate reporting for dump(8) files
gonzo [Tue, 26 Jun 2018 18:53:52 +0000 (18:53 +0000)]
Fix file(1) dumpdate reporting for dump(8) files

Magic file for dump(8) had this dump and previous dump dates reversed.
Fix order for all three flavours of the dump(8) format.
This fix was committed to upstream repo as magic/Magdir/dump,v 1.17
and will be merged during next vendor import.

PR: 223155
MFC after: 2 weeks

5 years agoUpdate the physical page selection strategy used by vm_page_import() so
alc [Tue, 26 Jun 2018 18:29:56 +0000 (18:29 +0000)]
Update the physical page selection strategy used by vm_page_import() so
that it does not cause rapid fragmentation of the free physical memory.

Reviewed by: jeff, markj (an earlier version)
Differential Revision: https://reviews.freebsd.org/D15976

5 years agogeli attach multiple providers
woodsb02 [Tue, 26 Jun 2018 18:07:16 +0000 (18:07 +0000)]
geli attach multiple providers

Allow attaching of multiple geli providers at once if they use same
passphrase and keyfiles.

This is helpful when the providers being attached are not used for boot,
and therefore the existing code to first try the cached password when
tasting the providers during boot does not apply.

Multiple providers with the same passphrase and keyfiles can be attached
at the same time during system start-up by adding the following to
rc.conf:
  geli_groups="storage backup"
  geli_storage_flags="-k /etc/geli/storage.keys"
  geli_storage_devices="ada0 ada1"
  geli_backup_flags="-j /etc/geli/backup.passfile -k /etc/geli/backup.keys"
  geli_backup_devices="ada2 ada3"

Reviewed by: wblock, delphij, jilles
Approved by: sobomax (src), bcr (doc)
Differential Revision: https://reviews.freebsd.org/D12644

5 years agoBuild linprocfs and linsysfs also on arm64
emaste [Tue, 26 Jun 2018 16:50:41 +0000 (16:50 +0000)]
Build linprocfs and linsysfs also on arm64

Sponsored by: Turing Robotic Industries

5 years agoatomic.9: Add missing MLINK for testandclear, thread_fence routines
cem [Tue, 26 Jun 2018 16:20:19 +0000 (16:20 +0000)]
atomic.9: Add missing MLINK for testandclear, thread_fence routines

Missed in r299912, r326982.

X-MFC-With: r299912, r326982
Sponsored by: Dell EMC Isilon

5 years agoImprove the userspace USB string reading function in LibUSB.
hselasky [Tue, 26 Jun 2018 16:00:16 +0000 (16:00 +0000)]
Improve the userspace USB string reading function in LibUSB.
Some USB devices does not allow a partial descriptor readout.

Found by: bz @
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoxen: obtain vCPU ID from CPUID
royger [Tue, 26 Jun 2018 15:00:54 +0000 (15:00 +0000)]
xen: obtain vCPU ID from CPUID

The Xen vCPU ID can be fetched from the cpuid instead of inferring it
from the ACPI ID.

Sponsored by: Citrix Systems R&D

5 years agoxen: limit the number of hypercall pages to 1
royger [Tue, 26 Jun 2018 14:39:27 +0000 (14:39 +0000)]
xen: limit the number of hypercall pages to 1

The interface already guarantees that the number of hypercall pages is
always going to be 1, see the comment in interface/arch-x86/cpuid.h

Sponsored by: Citrix Systems R&D

5 years agoUse the 'Updating from Source' Handbook section in UPDATING.
gjb [Tue, 26 Jun 2018 14:30:33 +0000 (14:30 +0000)]
Use the 'Updating from Source' Handbook section in UPDATING.

PR: 229345 (related)
Sponsored by: The FreeBSD Foundation

5 years agoxen-netback: fix LOR
royger [Tue, 26 Jun 2018 14:07:11 +0000 (14:07 +0000)]
xen-netback: fix LOR

lock order reversal: (sleepable after non-sleepable)
 1st 0xfffffe00357ff538 xnb_softc (xen netback softc lock) @ /usr/src/sys/dev/xen/netback/netback.c:1069
 2nd 0xffffffff81fdccb0 intrsrc (intrsrc) @ /usr/src/sys/x86/x86/intr_machdep.c:224

There's no need to hold the lock since the cleaning of the interrupt
cannot happen in parallel due to the XNBF_IN_SHUTDOWN flag being set.
Note that the locking in netback needs some improvement or
clarification.

While there also remove a double newline.

Sponsored by:   Citrix Systems R&D

5 years agoAdd missing MLINK.
markj [Tue, 26 Jun 2018 09:30:14 +0000 (09:30 +0000)]
Add missing MLINK.

MFC after: 3 days

5 years agoFix division by zero when reading boot block by postponing division
delphij [Tue, 26 Jun 2018 06:18:59 +0000 (06:18 +0000)]
Fix division by zero when reading boot block by postponing division
until it is necessary and after we validated bytes per sector is non-
zero.

Obtained from: Android https://android-review.googlesource.com/c/platform/external/fsck_msdos/+/36362
MFC after: 2 weeks

5 years agoconfig(8): part of patch disappeared, don't close ifp at the end
kevans [Tue, 26 Jun 2018 04:06:49 +0000 (04:06 +0000)]
config(8): part of patch disappeared, don't close ifp at the end

5 years agoconfig(8): Flip the order of concatenation for `hints` and `env`
kevans [Tue, 26 Jun 2018 04:02:25 +0000 (04:02 +0000)]
config(8): Flip the order of concatenation for `hints` and `env`

As previously noted, kernel's processing of these means that the first
appearance of a hint/variable wins. Flipping the order of concatenation
means that later variables override earlier variables, as expected when one
does:

hints x
hints y

Where perhaps x is:

hint.aw_sid.0.disable=1

and y is:

hint.aw_sid.0.disable=0

The expectation would be that a later appearing variable would override an
earlier appearing variable, such as with `device`/`nodevice`, device.hints,
and other similarly structured data files.

5 years agoconfig(8): Make 'env' files consistent with other file-accepting options
kevans [Tue, 26 Jun 2018 03:56:10 +0000 (03:56 +0000)]
config(8): Make 'env' files consistent with other file-accepting options

Previously, only one 'env' file could be specified. Later 'env' directives
would overwrite earlier 'env' directives. This is inconsistent with every
other file-accepting directives which process files in order, including
hints.

A caveat applies to both hints and env that isn't mentioned: they're
concatenated in the order of appearance, so they're not actually applied in
the way one might think by supplying:

hints x
hints y

Hints in x will take precedence over same-name hints in y due to how
the kernel processes them, stopping at the first line that matches the hint
we're searching for. Future work will flip the order of concatenation so
that later files may still properly override earlier files.

In practice, this likely doesn't matter at all due to the nature of the
beast.

5 years agoconfig(8): Set envmode if we accept an envvar
kevans [Tue, 26 Jun 2018 02:05:45 +0000 (02:05 +0000)]
config(8): Set envmode if we accept an envvar

X-MFC-With: r335642

5 years agoUse buf + strategy rather than bypassing geom_vfs layer
imp [Tue, 26 Jun 2018 00:39:38 +0000 (00:39 +0000)]
Use buf + strategy rather than bypassing geom_vfs layer

The reference counting that's done in the geom_vfs layer to prevent
delivery of requests to defunct devices only works if all requests go
through that layer. UFS was bypassing that layer for BIO_DELETE requests,
sending them to the geom_consumer directly with g_io_request. Allocate
a buf, fill it in, and call strategy on it instead.

Submitted by: Chuck Silvers
Reviewed by: scottl, imp, kirk
Sponsored by: Netflix
Differential: https://reviews.freebsd.org/D15456

5 years agoMake cpu_set_syscall_retval common between the existing FreeBSD ABI and
andrew [Mon, 25 Jun 2018 22:36:25 +0000 (22:36 +0000)]
Make cpu_set_syscall_retval common between the existing FreeBSD ABI and
the Linuxulator. We need to translate error values onto Linux errno values
and return them to userspace when a syscall fails. We also need to preserve
x1 as all registers are preserved other than the return value.

Reviewed by: emaste
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16008

5 years agoExpose stopped cpu contexts to ddb on PowerPC
jhibbits [Mon, 25 Jun 2018 22:05:33 +0000 (22:05 +0000)]
Expose stopped cpu contexts to ddb on PowerPC

Summary: In r220638, stoppcbs started being tracked. This never got exposed to
ddb though, so kdb_thr_ctx() didn't know how to look them up.

This allows switching to threads on stopped CPUs in kdb.

Submitted by: Brandon Bergren <git_bdragon.rkt0.net>
Differential Revision: https://reviews.freebsd.org/D15986

5 years agoAdd a file missed in r335645.
brd [Mon, 25 Jun 2018 21:54:39 +0000 (21:54 +0000)]
Add a file missed in r335645.

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

5 years agolinux64: add arm64 linuxulator build details
emaste [Mon, 25 Jun 2018 20:33:04 +0000 (20:33 +0000)]
linux64: add arm64 linuxulator build details

The arm64 linuxulator needs different arguments for the objcopy
invocation used to build the linux VDSO.  These arguments are both arch-
and OS-dependent, so I did not try to use some common setting for them.

Reviewed by: imp
Sponsored by: Turing Robotic Industries
Differential Revision: https://reviews.freebsd.org/D16011

5 years agoNormalize the g(eom,cache,part,...) build.
brooks [Mon, 25 Jun 2018 19:55:15 +0000 (19:55 +0000)]
Normalize the g(eom,cache,part,...) build.

Rather then combining hardlink creation for the geom(8) binary with
shared library build, move libraries to src/lib/geom so they are
built and installed normally.  Create a common Makefile.classes
which is included by both lib/geom/Makefile and sbin/geom/Makefile
so the symlink and libraries stay in sync.

The relocation of libraries allows libraries to be build for 32-bit
compat.  This also reduces the number of non-standard builds in
the system.

This commit is not sufficent to run a 32-bit /sbin/geom on a 64-bit
system out of the box as it will look in the wrong place for libraries
unless GEOM_LIBRARY_PATH is set appropriatly in the environment.

Reviewed by: bdrewery
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15360

5 years agoQuiet unused fn warning for linuxulator w/o legacy syscalls
emaste [Mon, 25 Jun 2018 19:24:50 +0000 (19:24 +0000)]
Quiet unused fn warning for linuxulator w/o legacy syscalls

Sponsored by: Turing Robotic Industries

5 years agoconfig(8): Add `envvar` support
kevans [Mon, 25 Jun 2018 17:17:47 +0000 (17:17 +0000)]
config(8): Add `envvar` support

envvar allows adding individual environment variables to the kernel's static
environment without the overhead of pulling in a full file. envvar in a
config looks like:

envvar some_var=5

All envvar-provided variables will be added after the env file is processed,
so envvar keys that exist in the previous env will be overwritten by
whatever value is set here in the kernel configuration directly.

As an aside, envvar lines are intentionally tokenized differently from
basically every other line. We used a named state when ENVVAR is encountered
to gobble up the rest of the line, which will later be cleaned and validated
in post-processing by sanitize_envline. This turns out to be the simplest
and cleanest way to allow the flexibility that kenv does while not
compromising on silly hacks.

Reviewed by: ian (also contributor of sanitize_envline rewrite)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D15962

5 years agoFix a stack overflow in mount_smbfs when hostname is too long.
brooks [Mon, 25 Jun 2018 16:42:49 +0000 (16:42 +0000)]
Fix a stack overflow in mount_smbfs when hostname is too long.

The local hostname was blindly copied into the to the nn_name array.
When the hostname exceeded 16 bytes, it would overflow.  Truncate the
hostname to 15 bytes plus a 0 terminator which is the "workstation name"
suffix.

Use defensive strlcpy() when filling nn_name in all cases.

PR: 228354
Reported by: donald.buchholz@intel.com
Reviewed by: jpaetzel,  ian (prior version)
Discussed with: Security Officer (gtetlow)
MFC after: 3 days
Security: Stack overflow with the hostname.
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15936

5 years agoInitial arm64 linuxulator linux_sysvec
emaste [Mon, 25 Jun 2018 14:12:33 +0000 (14:12 +0000)]
Initial arm64 linuxulator linux_sysvec

This is sufficient to run Linux arm64 'hello world' and other simple
binaries.

Reviewed by: andrew
Sponsored by: Turing Robotic Industries
Differential Revision: https://reviews.freebsd.org/D15834

5 years agorusers: modernize a bit
eadler [Mon, 25 Jun 2018 11:44:56 +0000 (11:44 +0000)]
rusers: modernize a bit

5 years agorup: compile with WARNS=6
eadler [Mon, 25 Jun 2018 11:44:53 +0000 (11:44 +0000)]
rup: compile with WARNS=6

5 years agousers(1): Use capsicum helpers for users
eadler [Mon, 25 Jun 2018 11:44:41 +0000 (11:44 +0000)]
users(1): Use capsicum helpers for users

In doing so also fix the libcasper.h header to work in C++.

5 years agoDo not leave stray qword on top of stack for interrupts and exceptions
kib [Mon, 25 Jun 2018 11:29:04 +0000 (11:29 +0000)]
Do not leave stray qword on top of stack for interrupts and exceptions
without error code.  Doing so it mis-aligned the stack.

Since the only consumer of the SSE instructions with the alignment
requirements is AES-NI module, and since the FPU context cannot be
accessed in interrupts, the only situation where the alignment matter
are the compat32 syscalls, as reported in the PR.

PR: 229222
Reported and tested by:  dewayne@heuristicsystems.com.au
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoDo not access ISA timer if BIOS reports that there is no legacy
kib [Mon, 25 Jun 2018 11:24:26 +0000 (11:24 +0000)]
Do not access ISA timer if BIOS reports that there is no legacy
devices present.

On at least one machine where it would matter since the ISA timer is
power gated when booted in the UEFI mode, BIOS still reports that the
legacy devices are present.  That is, user still have to manually
disable TSC calibration on such machines.  Hopefully it will be more
useful in the future.

Discussed with: Ben Widawsky <benjamin.widawsky@intel.com>
Reviewed by: royger
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D16004
MFC after: 1 week

5 years agoFix compilation.
kib [Mon, 25 Jun 2018 11:12:21 +0000 (11:12 +0000)]
Fix compilation.

Pointy hat to: me
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoProvide a helper function acpi_get_fadt_bootflags() to fetch the FADT
kib [Mon, 25 Jun 2018 11:01:12 +0000 (11:01 +0000)]
Provide a helper function acpi_get_fadt_bootflags() to fetch the FADT
x86 boot flags.

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

5 years agoAlways initialize the ignore local variable.
kib [Mon, 25 Jun 2018 10:52:41 +0000 (10:52 +0000)]
Always initialize the ignore local variable.

Reviewed by: royger
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D16004

5 years agovt: add option to ignore NO_VGA flag in ACPI
royger [Mon, 25 Jun 2018 09:39:16 +0000 (09:39 +0000)]
vt: add option to ignore NO_VGA flag in ACPI

To workaround buggy firmware that sets this flag when there's actually
a VGA present.

Reported and tested by: Yasuhiro KIMURA <yasu@utahime.org>
Sponsored by: Citrix Systems R&D
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D16003

5 years agoFix spelling of "reclamation".
ed [Mon, 25 Jun 2018 06:57:10 +0000 (06:57 +0000)]
Fix spelling of "reclamation".

5 years agodhclient: recorrect __progname to getprogname()
eadler [Mon, 25 Jun 2018 01:29:54 +0000 (01:29 +0000)]
dhclient: recorrect __progname to getprogname()

A more correct way to modernize code that uses __progname is to just
replace each occurance of it with a call to getprogname(3)

Reported by: ian
Reviewed by: imp

5 years ago[rpi] Fix compatiblity with upstream DTB for RPi 3B and 3B+
gonzo [Sun, 24 Jun 2018 23:19:31 +0000 (23:19 +0000)]
[rpi] Fix compatiblity with upstream DTB for RPi 3B and 3B+

Upstream dtb switched to using brcm,bcm2837 for platform
compatibility string. Patch platfrom and cpufreq compatiblity
data accordingly.

Submitted by: Sylvain Garrigues <sylgar@gmail.com>
Tested by: db@
Differential Revision: https://reviews.freebsd.org/D15998