Commit graph

234170 commits

Author SHA1 Message Date
Alex Richardson 53ed3b32ae Fix missing files in METALOG with -DNO_ROOT
By using INSTALL_LINK instead of calling ln during install the files
end up in the METALOG file as well if we use -DNO_ROOT and will be
included in a disk image when using makefs with METALOG as the input.
The other file that was not included in METALOG was /var/db/services.db
which is now also included for -DNO_ROOT.

Approved By:	brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D15665
2018-06-29 21:15:17 +00:00
Justin Hibbits 341679e1f2 Support multiple OPAL consoles, and don't crash if uart is not stdout
Summary: If the chosen console is not the OPAL uart, but OPAL uart devices
exist, the console device doesn't attach properly, and faults in the interrupt
handler, with a NULL pointer dereference.  To fix this, and as a byproduct, also
support multiple OPAL consoles, refactor to have the console getc callback use
the appropriate softc instead of the global console_sc, which may be NULL in the
case of a different device being the console.

Reviewed by:	nwhitehorn
Differential Revision: https://reviews.freebsd.org/D16071
2018-06-29 19:35:25 +00:00
Ed Maste 030efb3cc6 newvers.sh: avoid possibly invalid relative directory
Previously newvers.sh passed --work-tree=${VCSDIR}/.. when invoking git.
When using git worktree .git is actually a file, not a directory, and
.git/.. is not a valid path.  Although it appears git handles this
internally (perhaps it normalizes the path first), it is simple enough
for the script to store both the working tree top-level directory and
the VCS (.git) directory, so do so.

Sponsored by:	The FreeBSD Foundation
2018-06-29 18:45:29 +00:00
Dimitry Andric 6ccc06f6cb Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.1 release (upstream r335540).

Relnotes:	yes
MFC after:	2 weeks
2018-06-29 17:51:35 +00:00
Brooks Davis fa8c921e3f Correct link metadata created when installing with -DNO_ROOT.
Explicitly specify owner/group/mode metadata when creating links.

More consistently use INSTALL_SYMLINK to install symlinks.

Reviewed by:	bdrewery
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11231
2018-06-29 16:07:56 +00:00
Ed Maste 5b2b45a421 r335795 build fix: make static functions static
-Werror,-Wmissing-prototypes makes this an error otherwise.

MFC with:	335795
Sponsored by:	The FreeBSD Foundation
2018-06-29 14:51:36 +00:00
Andrey V. Elsukov 52b3619f45 Make debug output produced by setkey -x command a more human readable.
Add text names of SADB message types and extension headers to the output.

Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D16036
2018-06-29 13:59:33 +00:00
Rick Macklem 1aabf3fd5e Fix the pNFS server for a case where mirror level equals number of DSs.
If a pNFS service was set up where the number of DSs equals the mirror level
and then a DS was disabled, the service would create files with duplicate
entries for the same DS. This bug occurred because I didn't realize that
TAILQ_FOREACH_FROM() would start at the beginning of the list when the
inital value of the variable was NULL.
This patch also changes the pNFS server DS file creation code so that it
creates entrie(s) with 0.0.0.0 IP address when it cannot create mirror level
files due to lack of DSs.
The patch only affects the pNFS service and only when it was created with
a number of DSs equal to the mirror level and mirroring is enabled.
2018-06-29 12:41:36 +00:00
Ruslan Bukin a08232301d Include UART driver since it is now provided in QEMU.
Sponsored by:	DARPA, AFRL
2018-06-29 10:55:42 +00:00
Alan Somers af045bbfd7 audit(4): add tests for several more administrative syscalls
Includes ntp_adjtime, auditctl, acct, auditon, and clock_settime.  Includes
quotactl, mount, nmount, swapon, and swapoff in failure mode only.  Success
tests for those syscalls will follow.  Also includes reboot(2) in failure
mode only.  That one can't be tested in success mode.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15898
2018-06-29 04:52:27 +00:00
Alan Somers 18ba95c24a audit(4): add tests for setsid, wait4, wait6, and kill
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D16035
2018-06-29 04:46:15 +00:00
Alan Cox 9161b4de54 Three changes to vm_phys_alloc_seg_contig():
1. Optimize the order computation.

2. Update the pool for all of the chunks that are removed from the free
   page lists, and not just the first chunk.

3. Simplify the code for returning excess pages to the free page lists.

Reviewed by:	Doug Moore <dougm@rice.edu>
2018-06-29 04:08:14 +00:00
Bryan Drewery 8706983ff6 Fix unknown target check after r335450.
X-MFC-with:	r335450
Pointyhat to:	bdrewery
Sponsored by:	Dell EMC
2018-06-28 22:24:16 +00:00
Ian Lepore 795c4eaa37 When being verbose about various leapfile versions, also mention expiration.
The expiration date is actually more of a version number than the version
date, because expiration changes twice a year, whereas the version only
changes when actual leap second events occur (except in USNO leapfiles,
which inappropriately bump the version with every expiration date change).
2018-06-28 22:13:32 +00:00
Ian Lepore b5a278bcf4 Rename variable ntp_tmp_leapfile to have a leading underbar, to distinguish
it from variables with similar names which are set in rc.conf.  This will
make more sense as the script grows more similar-name local variables in
some upcoming changes.
2018-06-28 22:05:29 +00:00
Eitan Adler a0d30ad6a1 iwn: Correct Centrino Advanced-N 6235 constants
The iwn 6235 is a 2x2 device (see
https://ark.intel.com/products/66890/Intel-Centrino-Advanced-N-6235-Dual-Band)

Reviewed by:	adrian, kevans
Obtained from:	Haiku
2018-06-28 21:59:45 +00:00
Mark Johnston 1253de1eb6 Invalidate the mapping before updating its physical address.
Doing so ensures that all threads sharing the pmap have a consistent
view of the mapping.  This fixes the problem described in the commit
log messages for r329254 without the overhead of an extra fault in the
common case.  Once other pmap_enter() implementations are similarly
modified, the workaround added in r329254 can be removed, reducing the
overhead of CoW faults.

With this change we can reuse the PV entry from the old mapping,
potentially avoiding a call to reclaim_pv_chunk().  Otherwise, there is
nothing preventing the old PV entry from being reclaimed.  In rare
cases this could result in the PTE's page table page being freed,
leading to a use-after-free of the page when the updated PTE is written
following the allocation of the PV entry for the new mapping.

Reported and tested by:	pho
Reviewed by:	alc, kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D16005
2018-06-28 21:40:31 +00:00
John Baldwin a0399b42a5 Support 2GB of memory on Malta systems with FreeBSD/mips.
When 2GB of memory is enabled for QEMU's Malta emulation, the physical
memory ends at an address of 2^32 - 1.  This causes an integer overflow
to zero when computing the upper bound of the second phys_avail[] range.
As a result, FreeBSD/mips kernels were only using the first 256MB of
RAM and ignoring the remaining 1.75GB.  To work around this, truncate
the extended memory size to 2GB minus one page for 32-bit mips kernels.

Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D16027
2018-06-28 21:27:34 +00:00
John Baldwin 151578dc5f 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
2018-06-28 21:26:14 +00:00
Oleksandr Tymoshenko 9e28e9855f [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
2018-06-28 21:14:33 +00:00
David Bright 11f8e2efa8 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
2018-06-28 20:37:17 +00:00
Ed Maste d01c382e91 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
2018-06-28 20:36:21 +00:00
Warner Losh b77bd037a1 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.
2018-06-28 19:42:10 +00:00
Bryan Drewery 52b7824bde SYSTEM_COMPILER/LINKER: Fix cross-build support after r335706.
X-MFC-With:	r335706
MFC after:	2 weeks
Sponsored by:	Dell EMC
2018-06-28 19:01:53 +00:00
Bryan Drewery b38b45af2f 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
2018-06-28 18:22:20 +00:00
John Baldwin 32cec12c75 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
2018-06-28 18:19:46 +00:00
Conrad Meyer e02d32f72e 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.
2018-06-28 18:17:20 +00:00
Alan Cox 32d81f21b9 Reflow one of the comments describing vm_phys_alloc_npages(). 2018-06-28 17:52:06 +00:00
Ian Lepore 1bf1d84a53 Add missing MODULE_VERSION() and MODULE_DEPEND(). 2018-06-28 17:07:20 +00:00
David Bright 240e9dcde1 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
2018-06-28 17:01:04 +00:00
Warner Losh 0a463958e7 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 ?.
2018-06-28 15:00:18 +00:00
Brad Davis f59e535254 Simplify using bsd.endian.mk and have it provide CAP_MKDB_ENDIAN, since it is
the most common usage.

Approved by:	bapt (mentor)
2018-06-28 13:48:59 +00:00
Andrey V. Elsukov 6e081509db 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
2018-06-28 11:39:27 +00:00
Andrey V. Elsukov 0df37a208c Remove extra "ipfw" from example.
MFC after:	1 week
2018-06-28 09:42:30 +00:00
Kyle Evans af74661403 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
2018-06-28 03:37:15 +00:00
Warner Losh 95cbefb3bf 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
2018-06-28 01:45:53 +00:00
Warner Losh 54aa407625 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
2018-06-27 23:44:37 +00:00
Devin Teske 37e29448ea 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
2018-06-27 22:15:50 +00:00
Gleb Smirnoff b8ab659396 Check the inp_flags under inp lock. Looks like the race was hidden
before, the conversion of tcbinfo to CK_LIST have uncovered it.
2018-06-27 22:01:59 +00:00
Gleb Smirnoff 95dce07dea 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
2018-06-27 22:00:50 +00:00
Bryan Drewery 4e2a44900d 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
2018-06-27 21:36:57 +00:00
Bryan Drewery d717a1d4bc 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
2018-06-27 21:36:49 +00:00
Bryan Drewery 96a0acc4ce Don't use CCACHE for linking.
MFC after:	2 weeks
Sponsored by:	Dell EMC
2018-06-27 19:29:15 +00:00
Edward Tomasz Napierala a6c0b9d085 Fix description for the "autoconf" ifconfig(8) flag; it's an address
property, not something you set for an interface.

MFC after:	2 weeks
2018-06-27 19:28:37 +00:00
Dimitry Andric a22edcd8cb Vendor import of lldb 6.0.1 release r335540:
https://llvm.org/svn/llvm-project/lldb/tags/RELEASE_601/final@335540
2018-06-27 19:15:13 +00:00
Dimitry Andric 384e0a667a Vendor import of lld 6.0.1 release r335540:
https://llvm.org/svn/llvm-project/lld/tags/RELEASE_601/final@335540
2018-06-27 19:15:02 +00:00
Dimitry Andric 04505aa466 Vendor import of libc++ 6.0.1 release r335540:
https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_601/final@335540
2018-06-27 19:14:54 +00:00
Dimitry Andric 70d5b95606 Vendor import of compiler-rt 6.0.1 release r335540:
https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_601/final@335540
2018-06-27 19:14:44 +00:00
Dimitry Andric 1f031ccac5 Vendor import of clang 6.0.1 release r335540:
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_601/final@335540
2018-06-27 19:14:32 +00:00
Dimitry Andric eb1edd4d59 Vendor import of llvm 6.0.1 release r335540:
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_601/final@335540
2018-06-27 19:14:09 +00:00