]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMerge lldb trunk r321017 to contrib/llvm/tools/lldb.
dim [Wed, 20 Dec 2017 18:06:09 +0000 (18:06 +0000)]
Merge lldb trunk r321017 to contrib/llvm/tools/lldb.

6 years agoMerge lld trunk r321017 to contrib/llvm/tools/lld.
dim [Wed, 20 Dec 2017 15:50:21 +0000 (15:50 +0000)]
Merge lld trunk r321017 to contrib/llvm/tools/lld.

6 years agoMerge clang trunk r321017 to contrib/llvm/tools/clang.
dim [Wed, 20 Dec 2017 14:26:54 +0000 (14:26 +0000)]
Merge clang trunk r321017 to contrib/llvm/tools/clang.

6 years agoMerge llvm trunk r321017 to contrib/llvm.
dim [Wed, 20 Dec 2017 14:16:56 +0000 (14:16 +0000)]
Merge llvm trunk r321017 to contrib/llvm.

6 years agoVendor import of lldb trunk r321017:
dim [Mon, 18 Dec 2017 20:12:36 +0000 (20:12 +0000)]
Vendor import of lldb trunk r321017:
https://llvm.org/svn/llvm-project/lldb/trunk@321017

6 years agoVendor import of lld trunk r321017:
dim [Mon, 18 Dec 2017 20:12:21 +0000 (20:12 +0000)]
Vendor import of lld trunk r321017:
https://llvm.org/svn/llvm-project/lld/trunk@321017

6 years agoVendor import of clang trunk r321017:
dim [Mon, 18 Dec 2017 20:11:37 +0000 (20:11 +0000)]
Vendor import of clang trunk r321017:
https://llvm.org/svn/llvm-project/cfe/trunk@321017

6 years agoVendor import of llvm trunk r321017:
dim [Mon, 18 Dec 2017 20:10:56 +0000 (20:10 +0000)]
Vendor import of llvm trunk r321017:
https://llvm.org/svn/llvm-project/llvm/trunk@321017

6 years agoAvoid CPU migration in dtrace_gethrtime() on x86.
markj [Mon, 18 Dec 2017 17:26:24 +0000 (17:26 +0000)]
Avoid CPU migration in dtrace_gethrtime() on x86.

dtrace_gethrtime() may be called outside of probe context, and in
particular, from the DTRACEIOC_BUFSNAP handler.

Disable interrupts rather than using sched_pin() to help ensure that
we don't call any external functions when in probe context.

PR: 218452
MFC after: 1 week

6 years agoAlso forgotten in the previous that removed the permanent double mapping
bde [Mon, 18 Dec 2017 14:29:48 +0000 (14:29 +0000)]
Also forgotten in the previous that removed the permanent double mapping
of low physical memory:

Update the comment about leaving the permanent mapping in place.  This
also improves the wording of the comment.  PTD 0 is still left alone
because it is fairly important that it was unmapped earlier, and the
comment now describes the unmapping of the other low PTDs that the code
actually does.

Reviewed by: kib

6 years agoRemove the permanent double mapping of low physical memory and replace
bde [Mon, 18 Dec 2017 13:53:22 +0000 (13:53 +0000)]
Remove the permanent double mapping of low physical memory and replace
it by a transient double mapping for the one instruction in ACPI wakeup
where it is needed (and for many surrounding instructions in ACPI resume).
Invalidate the TLB as soon as convenient after undoing the transient
mapping.  ACPI resume already has the strict ordering needed for this.

This fixes the non-trapping of null pointers and other garbage pointers
below NBPDR (except transiently).  NBPDR is quite large (4MB, or 2MB for
PAE).

This fixes spurious traps at the first instruction in VM86 bioscalls.
The traps are for transiently missing read permission in the first
VM86 page (physical page 0) which was just written to at KERNBASE in
the kernel.  The mechanism is unknown (it is not simply PG_G).

locore uses a similar but larger transient double mapping and needs
it for 2 instructions instead of 1.  Unmap the first PDE in it after
the 2 instructions to detect most garbage pointers while bootstrapping.
pmap_bootstrap() finishes the unmapping.

Remove the avoidance of the double mapping for a recently fixed special
case.  ACPI resume could use this avoidance (made non-special) to avoid
any problems with the transient double mapping, but no such problems
are known.

Update comments in locore.  Many were for old versions of FreeBSD which
tried to map low memory r/o except for special cases, or might have
allowed access to low memory via physical offsets.  Now all kernel
maps are r/w, and removal of of the double map disallows use of physical
offsets again.

6 years agoFix the undersupported option KERNLOAD, part 2: fix crashes in locore
bde [Mon, 18 Dec 2017 11:57:05 +0000 (11:57 +0000)]
Fix the undersupported option KERNLOAD, part 2: fix crashes in locore
when KERNLOAD is smaller than NBPDR (not the default) and PG_G is
enabled (the default if the CPU supports it).  This case has relatively
minor problems with coherency of the permanent double mapping, but the
fix in r167869 to improve coherency creates page tables with 3 different
errors so never worked.

The permanent double mapping is fundamentally broken and will be removed
soon.  It fundamentally breaks trapping for null pointers and requires
complications to avoid cache coherency bugs.  It is currently used for
only a single instruction in ACPI resume,

Many fixes VM86 and/or ACPI and/or the double map were attempted near
r1200000.  r167869 attempted to fix cache coherency bugs in an unusual
case, but the bugs were unreachable because older errors in page tables
caused a crash first.

This commit just makes r167869 work as intended.  Part 1 of these fixes
fixed the other errors, but also stopped mapping the PDE for KERNBASE
as a large page, so double mapping of this PDE only causes the same
problems as when KERNLOAD is the default.  Except for the problem of
trapping null pointers, r167869 could be used to fix these problems,
but it is inactive in usual cases.  The only known other problem is
that incoherent permissions for page 0 cause spurious traps in VM86
BIOS calls.

Reviewed by: kib

6 years agonewsyslog: Fix issues after r326616
bapt [Mon, 18 Dec 2017 09:35:04 +0000 (09:35 +0000)]
newsyslog: Fix issues after r326616

When building the command to execute for compression, newsyslog was modifying
the generic arguments array instead of its own copy.
Meaning on the second file to compress with the same arguments, the command line
was not the one expected.
Fix it by creating one copy of the arguments per execution and modifying that
copy.

While here, print the command line executed in verbose mode.

Reported by: many

6 years agoFix the undersupported option KERNLOAD, part 1: fix crashes in locore
bde [Mon, 18 Dec 2017 09:32:56 +0000 (09:32 +0000)]
Fix the undersupported option KERNLOAD, part 1: fix crashes in locore
when KERNLOAD is not a multiple of NBPDR (not the default) and PSE is
enabled (the default if the CPU supports it).  Addresses in PDEs must
be a multiple of NBPDR in the PSE case, but were not so in the crashing
case.

KERNLOAD defaults to NBPDR.  NBPDR is 4 MB for !PAE and 2 MB for PAE.
The default can be changed by editing i386/include/vmparam.h or using
makeoptions.  It can be changed to less than NBPDR to save real and
virtual memory at a small cost in time, or to more than NBPDR to waste
real and virtual memory.  It must be larger than 1 MB and a multiple of
PAGE_SIZE.  When it is less than NBPDR, it is necessarily not a multiple
of NBPDR.  This case has much larger bugs which will be fixed in part 2.

The fix is to only use PSE for physical addresses above <KERNLOAD
rounded _up_ to an NBPDR boundary>.  When the rounding is non-null,
this leaves part of the kernel not using large pages.  Rounding down
would avoid this pessimization, but would break setting of PAT bits
on i/o pages if it goes below 1MB.  Since rounding down always goes
below 1MB when KERNLOAD < NBPDR and the KERNLOAD > NBPDR case is not
useful, never round down.

Fix related style bugs (e.g., wrong literal values for NBPDR in comments).

Reviewed by: kib

6 years agolibficl is only ever used in a loader (never a boot) program. Move it
imp [Mon, 18 Dec 2017 04:51:45 +0000 (04:51 +0000)]
libficl is only ever used in a loader (never a boot) program. Move it
to loader.mk.

Sponsored by: Netflix

6 years agoMove loader help file definitions to being 100% inside of loader.mk.
imp [Mon, 18 Dec 2017 04:51:34 +0000 (04:51 +0000)]
Move loader help file definitions to being 100% inside of loader.mk.

HELP_FILES is a loader only thing, so move it to loader.mk. Only
generate the help file if HELP_FILES is defined. Adjust Makefiles to
new convention. Fix a few cases where ${.CURDIR}/ was missing
resulting in missing bits from the help files.

Sponsored by: Netflix

6 years agoDo not attempt to refill the TX fifo if there is no data left to transfer.
ian [Mon, 18 Dec 2017 02:34:37 +0000 (02:34 +0000)]
Do not attempt to refill the TX fifo if there is no data left to transfer.

A comment in bcm_bsc_fill_tx_fifo() even lists sc_totlen > 0 as a
precondition for calling the routine.   I apparently forgot to make the
code do what my comment said.

6 years agoFix debugging output, fallout from something like s/read/readctl/g
ian [Mon, 18 Dec 2017 00:15:53 +0000 (00:15 +0000)]
Fix debugging output, fallout from something like s/read/readctl/g
while renaming variables in a previous change.

6 years agoUnregister the ARC lowmem event handler earlier in arc_fini().
markj [Sun, 17 Dec 2017 18:21:40 +0000 (18:21 +0000)]
Unregister the ARC lowmem event handler earlier in arc_fini().

Otherwise a poorly timed lowmem event may attempt to acquire a destroyed
lock. Unregister the handler before destroying the ARC reclaim thread.

Reported by: gjb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13480

6 years agoMove loader-only defines to loader.mk from defs.mk
imp [Sat, 16 Dec 2017 21:33:21 +0000 (21:33 +0000)]
Move loader-only defines to loader.mk from defs.mk

Produces the same .o's, verified with md5.

Sponsored by: Netflix

6 years agoSync with NetBSD's /usr/share/dict/words, with the exception of quim
imp [Sat, 16 Dec 2017 20:25:50 +0000 (20:25 +0000)]
Sync with NetBSD's /usr/share/dict/words, with the exception of quim
due to its vulgar nature.

Submitted by: sevan@
Differential Revision: https://reviews.freebsd.org/D13510

6 years agoFix a logic bug in makefs lazy inode initialization.
markj [Sat, 16 Dec 2017 20:19:00 +0000 (20:19 +0000)]
Fix a logic bug in makefs lazy inode initialization.

We may need to initialize multiple inode blocks before writing a given
inode. makefs(8) was only initializing a single block at a time, so
certain inode allocation patterns could lead to a situation where it
wrote an inode to an uninitialized block. That inode might be clobbered
by a later initialization, resulting in a filesystem image containing
directory entries that point to a seemingly unused inode.

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13505

6 years agoMake truss(8) work for i686-unknown-cloudabi binaries on FreeBSD/amd64.
ed [Sat, 16 Dec 2017 19:40:28 +0000 (19:40 +0000)]
Make truss(8) work for i686-unknown-cloudabi binaries on FreeBSD/amd64.

This change copies the existing amd64_cloudabi64.c to amd64_cloudabi32.c
and reimplements the functions for fetching system call arguments and
return values to use the same scheme as used by the vDSO that is used
when running cloudabi32 executables.

As arguments are automatically padded to 64-bit words by the vDSO in
userspace, we can copy the arguments directly into the array used by
truss(8) internally.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D13516

6 years agolibsysdecode: Add a new ABI type, SYSDECODE_ABI_CLOUDABI32.
ed [Sat, 16 Dec 2017 19:37:55 +0000 (19:37 +0000)]
libsysdecode: Add a new ABI type, SYSDECODE_ABI_CLOUDABI32.

In order to let truss(8) support tracing of 32-bit CloudABI
applications, we need to add a new ABI type to libsysdecode. We can
reuse the existing errno mapping table. Also link in the cloudabi32
system call table to translate system call names.

While there, remove all of the architecture ifdefs. There are not
needed, as the CloudABI data types and system call tables build fine on
any architecture. Building this unconditionally will make it easier to
do tracing for different compat modes, emulation, etc.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D13516

6 years agoUpgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
dim [Sat, 16 Dec 2017 18:06:30 +0000 (18:06 +0000)]
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
5.0.1 release (upstream r320880).

Relnotes: yes
MFC after: 2 weeks

6 years agorevert r322589: force use of ld.bfd for linking i386 libc
emaste [Sat, 16 Dec 2017 15:17:54 +0000 (15:17 +0000)]
revert r322589: force use of ld.bfd for linking i386 libc

As of r326897 ld.lld can link a working i386 libc.so, so we no longer
need to force use of ld.bfd.

Sponsored by: The FreeBSD Foundation

6 years agoVendor import of lld 5.0.1 release r320880:
dim [Sat, 16 Dec 2017 14:46:38 +0000 (14:46 +0000)]
Vendor import of lld 5.0.1 release r320880:
https://llvm.org/svn/llvm-project/lld/tags/RELEASE_501/final@320880

6 years agoVendor import of clang 5.0.1 release r320880:
dim [Sat, 16 Dec 2017 14:45:37 +0000 (14:45 +0000)]
Vendor import of clang 5.0.1 release r320880:
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_501/final@320880

6 years agoVendor import of llvm 5.0.1 release r320880:
dim [Sat, 16 Dec 2017 14:44:35 +0000 (14:44 +0000)]
Vendor import of llvm 5.0.1 release r320880:
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_501/final@320880

6 years agoFix possible memory leak.
ae [Sat, 16 Dec 2017 14:36:21 +0000 (14:36 +0000)]
Fix possible memory leak.

vxlan_ftable entries are sorted in ascending order, due to wrong arguments
order it is possible to stop search before existing element will be found.
Then new element will be allocated in vxlan_ftable_update_locked() and can
be inserted in the list second time or trigger MPASS() assertion with
enabled INVARIANTS.

PR: 224371
MFC after: 1 week

6 years agolld: Slightly simplify code and add comment.
emaste [Sat, 16 Dec 2017 14:26:11 +0000 (14:26 +0000)]
lld: Slightly simplify code and add comment.

Cherry-pick lld r315658 by Rui Ueyama:
    This is not a mechanical transformation. Even though I believe this
    patch is correct, I'm not 100% sure if lld with this patch behaves
    exactly the same way as before on all edge cases. At least all tests
    still pass.

    I'm submitting this patch because it took almost a day to understand
    this function, and I don't want to lose it.

This fixes jemalloc assertion failures observed at startup with i386
binaries and an lld-linked libc.so.

Reviewed by: dim
Obtained from: LLVM r315658
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13503

6 years agoRemove white space at EOL.
schweikh [Sat, 16 Dec 2017 12:23:59 +0000 (12:23 +0000)]
Remove white space at EOL.

6 years agoCorrect a typo; remove white space at EOL.
schweikh [Sat, 16 Dec 2017 11:49:30 +0000 (11:49 +0000)]
Correct a typo; remove white space at EOL.

6 years agobhnd(4): Fix the pa0itssit/pa1itssit NVRAM variable type definitions
landonf [Sat, 16 Dec 2017 05:22:16 +0000 (05:22 +0000)]
bhnd(4): Fix the pa0itssit/pa1itssit NVRAM variable type definitions
required by bwn(4); idle TSSI target values are expressed as signed
integers.

Sponsored by: The FreeBSD Foundation

6 years agobhndb(4): Enable addrext support on DMA64 devices, and fix an incorrect DMA
landonf [Sat, 16 Dec 2017 04:35:37 +0000 (04:35 +0000)]
bhndb(4): Enable addrext support on DMA64 devices, and fix an incorrect DMA
DMA boundary constraint applied in bhndb_dma_tag_create().

Sponsored by: The FreeBSD Foundation

6 years agoNote GELI-enabled zfsboot issues have been solved. Flip the switch
imp [Fri, 15 Dec 2017 23:19:49 +0000 (23:19 +0000)]
Note GELI-enabled zfsboot issues have been solved. Flip the switch
back to enabling GELI in boot and loader builds.

Sponsored by: Netflix

6 years agoRemove the 'mini libstand in libstand' that util.[ch] provided. These
imp [Fri, 15 Dec 2017 23:16:53 +0000 (23:16 +0000)]
Remove the 'mini libstand in libstand' that util.[ch] provided. These
weren't needed, and their existance interfered with things in subtle
ways. One of these subtle ways was that malloc could be different
based on what files were included when (even within the same .c file,
it turns out). Move to a single malloc implementation as well by
adding the calls to setheap() to gptboot.c and zfsboot.c. Once upon a
time, these boot loaders strove to not use libstand. However, with the
proliferation of features, that striving is too hard for too little
gain and lead to stupid mistakes.

This fixes the GELI-enabled (but not even using) boot environment. The
geli routines were calling libstand malloc but zfsboot.c and gptboot.c
were using the mini libstand malloc, so this failed when we tried to
probe for GELI partitions. Subtle changes in build order when moving
to self-contained stand build in r326593 toggled what it used from one
type to another due to odd nesting of the zfs implementation code that
differed subtly between zfsloader and zfsboot.

Sponsored by: Netflix

6 years agoPanic in sbrk if setheap hasn't been called yet. This is preferable to
imp [Fri, 15 Dec 2017 23:16:47 +0000 (23:16 +0000)]
Panic in sbrk if setheap hasn't been called yet. This is preferable to
a mysterious crash.

Sponsored by: Netflix

6 years agoUse -h -D in preference to -D so that the serial port gets the
imp [Fri, 15 Dec 2017 23:16:42 +0000 (23:16 +0000)]
Use -h -D in preference to -D so that the serial port gets the
interactive console rather than the video port. qemu has issues with X
on my mac at the moment and this is the easiest path forward.

Sponsored by: Netflix

6 years agoBe a little verbose and list the loader files we're putting on the
imp [Fri, 15 Dec 2017 23:16:37 +0000 (23:16 +0000)]
Be a little verbose and list the loader files we're putting on the
drive when making zfs roots as a sanity check for what's on there.

6 years agoFor now, make the gpart commands verbose so we know exactly what's
imp [Fri, 15 Dec 2017 23:16:27 +0000 (23:16 +0000)]
For now, make the gpart commands verbose so we know exactly what's
being installed.

Fix problem with gpt + zfs installing the wrong loader...

Sponsored by: Netflix

6 years agoGive a couple of predication functions a bool return type.
markj [Fri, 15 Dec 2017 19:14:21 +0000 (19:14 +0000)]
Give a couple of predication functions a bool return type.

No functional change intended.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoTypo.
markj [Fri, 15 Dec 2017 19:03:03 +0000 (19:03 +0000)]
Typo.

MFC after: 1 week

6 years agoPull in r320755 from upstream clang trunk (by me):
dim [Fri, 15 Dec 2017 18:58:21 +0000 (18:58 +0000)]
Pull in r320755 from upstream clang trunk (by me):

  Don't trigger -Wuser-defined-literals for system headers

  Summary:
  In D41064, I proposed adding `#pragma clang diagnostic ignored
  "-Wuser-defined-literals"` to some of libc++'s headers, since these
  warnings are now triggered by clang's new `-std=gnu++14` default:

  $ cat test.cpp
  #include <string>

  $ clang -std=c++14 -Wsystem-headers -Wall -Wextra -c test.cpp
  In file included from test.cpp:1:
  In file included from /usr/include/c++/v1/string:470:
  /usr/include/c++/v1/string_view:763:29: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string_view<char> operator "" sv(const char *__str, size_t __len)
                              ^
  /usr/include/c++/v1/string_view:769:32: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string_view<wchar_t> operator "" sv(const wchar_t *__str, size_t __len)
                                 ^
  /usr/include/c++/v1/string_view:775:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string_view<char16_t> operator "" sv(const char16_t *__str, size_t __len)
                                  ^
  /usr/include/c++/v1/string_view:781:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string_view<char32_t> operator "" sv(const char32_t *__str, size_t __len)
                                  ^
  In file included from test.cpp:1:
  /usr/include/c++/v1/string:4012:24: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string<char> operator "" s( const char *__str, size_t __len )
                         ^
  /usr/include/c++/v1/string:4018:27: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len )
                            ^
  /usr/include/c++/v1/string:4024:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len )
                             ^
  /usr/include/c++/v1/string:4030:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
      basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len )
                             ^
  8 warnings generated.

  Both @aaron.ballman and @mclow.lists felt that adding this workaround
  to the libc++ headers was the wrong way, and it should be fixed in
  clang instead.

  Here is a proposal to do just that.  I verified that this suppresses
  the warning, even when -Wsystem-headers is used, and that the warning
  is still emitted for a declaration outside of system headers.

  Reviewers: aaron.ballman, mclow.lists, rsmith

  Reviewed By: aaron.ballman

  Subscribers: mclow.lists, aaron.ballman, andrew, emaste, cfe-commits

  Differential Revision: https://reviews.llvm.org/D41080

This will allow to compile some of the libc++ headers in C++14 mode
(which is the default for gcc 6 and higher, and will be the default for
clang 6.0.0 and higher), with -Wsystem-headers and -Werror enabled.

Reported by: andrew
MFC after: 3 days

6 years agolld: Simplify a boolean expression by De Morgan's laws.
emaste [Fri, 15 Dec 2017 18:56:12 +0000 (18:56 +0000)]
lld: Simplify a boolean expression by De Morgan's laws.

Cherry-pick lld r315653 by Rui Ueyama:
    I don't really understand what exactly this expression means,
    but at least I can mechanically transform it.

Obtained from: LLVM r315653
MFC after: 1 week

6 years agoMark uctf/err.user64mode.ksh as EXFAIL for now.
markj [Fri, 15 Dec 2017 18:09:23 +0000 (18:09 +0000)]
Mark uctf/err.user64mode.ksh as EXFAIL for now.

MFC after: 1 week

6 years agoSkip gnop tests if the corresponding kernel module isn't available.
markj [Fri, 15 Dec 2017 17:10:51 +0000 (17:10 +0000)]
Skip gnop tests if the corresponding kernel module isn't available.

Reviewed by: asomers
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13500

6 years agoFollow the RFC6980 and silently ignore following IPv6 NDP messages
ae [Fri, 15 Dec 2017 12:37:32 +0000 (12:37 +0000)]
Follow the RFC6980 and silently ignore following IPv6 NDP messages
that had the IPv6 fragmentation header:
 o  Neighbor Solicitation
 o  Neighbor Advertisement
 o  Router Solicitation
 o  Router Advertisement
 o  Redirect

Introduce M_FRAGMENTED mbuf flag, and set it after IPv6 fragment reassembly
is completed. Then check the presence of this flag in correspondig ND6
handling routines.

PR: 224247
MFC after: 2 weeks

6 years agoAdd missing of=/dev/${dev}s${s} when installing zfsboot.
imp [Fri, 15 Dec 2017 06:44:11 +0000 (06:44 +0000)]
Add missing of=/dev/${dev}s${s} when installing zfsboot.

6 years agoScript to generate minimal boot images for each of the 24 supported
imp [Fri, 15 Dec 2017 06:34:27 +0000 (06:34 +0000)]
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).

At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.

These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.

At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).

Sponsored by: Netflix

6 years agoScript that knows how to put boot blocks onto a device. Eventually,
imp [Fri, 15 Dec 2017 06:34:11 +0000 (06:34 +0000)]
Script that knows how to put boot blocks onto a device.  Eventually,
this will be installed into /usr/sbin, but for now it's just used for
the boot loader regression script. It's still a bit green, and likely
will get edge cases wrong still. It's also x86 centric at the moment,
but will be enhanced shortly for u-boot, CHRP PowerPC and other
methods.

Sponsored by: Netflix

6 years agopw(8): r326738 broke expiration arithmetic in case of `-D' flag not supplied.
eugen [Fri, 15 Dec 2017 06:05:16 +0000 (06:05 +0000)]
pw(8): r326738 broke expiration arithmetic in case of `-D' flag not supplied.

Fix it and rename misnamed time_t variables `expire_days, password_days'
(always holding absolute time) to `expire_time, password_time'.

Add a comment for a case of overloading `cmdcnf->password_days'
and `cmdcnf->expire_days' with absolute time.

Reported by: markj
Approved by: mav (mentor)
MFC after: 1 week

6 years agobhnd(4)/bwn(4): Fix a number of small issues reported by Coverity.
landonf [Fri, 15 Dec 2017 04:51:47 +0000 (04:51 +0000)]
bhnd(4)/bwn(4): Fix a number of small issues reported by Coverity.

- Fix reference of uninitialized error value in bhndb_generic_resume() if
  the dynamic window count is 0.

- Fix incorrect bhnd_pmu(4) UPTME_MASK and PLL0_PC2_WILD_INT_MASK
  constants.

- Variable definitions referenced by our generated SPROM layouts will never
  be NULL, but add explicit asserts to make that clear.

- Add missing variable initialization in bhnd_nvram_sprom_ident().

- Fix leak of driver array in bhnd_erom_probe_driver_classes().

- Fix zero-length memset() in bhndb_pci_eio_init().

- Fix an off-by-one error and potential invalid OOBSEL bit shift operation
  in bcma_dinfo_init_intrs().

- Remove dead code in siba_suspend_hw().

- Fix duplicate call to bhnd_pmu_enable_regulator() in both the enable and
  disable code paths of bhnd_compat_cc_pmu_set_ldoparef().

Reported by: Coverity
CIDs: 135519413620201362022137311413665631373115,
13815691381579138355513835661383571
Sponsored by: The FreeBSD Foundation

6 years agoHandle the Facility Unavailable exception as a SIGILL
jhibbits [Fri, 15 Dec 2017 04:11:20 +0000 (04:11 +0000)]
Handle the Facility Unavailable exception as a SIGILL

Currently Facility Unavailable is absent and once an application
tries to use or access a register from a feature disabled in the
CPU it causes a kernel panic.

A simple test-case is:

int main() { asm volatile ("tbegin.;"); }

which will use TM (Hardware Transactional Memory) feature which
is not supported by the kernel and so will trigger the following
kernel panic:

----

fatal user trap:

    exception       = 0xf60 (unknown)
    srr0            = 0x10000890
    srr1            = 0x800000000000f032
    lr              = 0x100004e4
    curthread       = 0x5f93000
    pid = 1021, comm = htm

panic: unknown trap
cpuid = 40
KDB: stack backtrace:
Uptime: 3m18s
Dumping 10 MB (3 chunks)
    chunk 0: 11MB (2648 pages) ... ok
    chunk 1: 1MB (24 pages) ... ok
    chunk 2: 1MB (2 pages)panic: IOMMU mapping error: -4

cpuid = 40
Uptime: 3m18s

----

Since Hardware Transactional Memory is not yet supported by FreeBSD, treat
this as an illegal instruction.

PR: 224350
Submitted by: Gustavo Romero <gromero_AT_ibm_DOT_com>
MFC after: 2 weeks

6 years agobsd-family-tree: add dfly 5.0.[12]
eadler [Fri, 15 Dec 2017 03:46:52 +0000 (03:46 +0000)]
bsd-family-tree: add dfly 5.0.[12]

6 years agobsd-family-tree: Add NetBSD 7.0.2
eadler [Fri, 15 Dec 2017 03:36:48 +0000 (03:36 +0000)]
bsd-family-tree: Add NetBSD 7.0.2

Pulled directly from NetBSD

6 years agoMinor cleanups found while fixing a bug involving double mapping of low
bde [Fri, 15 Dec 2017 03:05:14 +0000 (03:05 +0000)]
Minor cleanups found while fixing a bug involving double mapping of low
memory:

Load the kernel eflags less magically, as in locore.  The magic increased
when I removed eflags from the pcb in r305899.

Remove a jump to low memory that became garbage when the i386 version was
mostly replaced by the amd64 version in r235622.

The amd64 version is very similar.  It still loads the flags magically,
but is not missing comments about using the special page table.

Reviewed by: kib

6 years agoMFC: r326864
jkim [Thu, 14 Dec 2017 23:21:31 +0000 (23:21 +0000)]
MFC: r326864

Merge ACPICA 20171214.

6 years agoBelatedly add syncwait.
markj [Thu, 14 Dec 2017 22:15:46 +0000 (22:15 +0000)]
Belatedly add syncwait.

X-MFC with: r326861

6 years agoMake indentation consistent with other tests, and use syncwait.
markj [Thu, 14 Dec 2017 22:14:07 +0000 (22:14 +0000)]
Make indentation consistent with other tests, and use syncwait.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoAdd some basic tests for gmirror read and write error handling.
markj [Thu, 14 Dec 2017 22:11:35 +0000 (22:11 +0000)]
Add some basic tests for gmirror read and write error handling.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoPlug an ifaddr leak when changing a route's src
rstone [Thu, 14 Dec 2017 20:48:50 +0000 (20:48 +0000)]
Plug an ifaddr leak when changing a route's src

If a route is modified in a way that changes the route's source
address (i.e. the address used to access the gateway), then a
reference on the ifaddr representing the old source address will
be leaked if the address type does not have an ifa_rtrequest
method defined.  Plug the leak by releasing the reference in
all cases.

Differential Revision: https://reviews.freebsd.org/D13417
Reviewed by: ae
MFC after: 3 weeks
Sponsored by: Dell

6 years agoAdd identifier for POWER9 CPU to CPU list
jhibbits [Thu, 14 Dec 2017 20:01:04 +0000 (20:01 +0000)]
Add identifier for POWER9 CPU to CPU list

Without the identifier in the list booting FreeBSD results in printing the
following (from a PowerKVM boot):

cpu0: Unknown PowerPC CPU revision 0x1201, 2550.00 MHz

For now, add the same feature list as POWER8.  As new capabilities are added to
support POWER9 specific features, they will be added to this.

PR: 224344
Submitted by: Breno Leitao <breno_DOT_leitao_AT_gmail_DOT_com>

6 years agoRevert r326855: Cargo cut a fix for the regressions r326585 caused.
imp [Thu, 14 Dec 2017 18:57:17 +0000 (18:57 +0000)]
Revert r326855: Cargo cut a fix for the regressions r326585 caused.

This was an experiment that landed in the wrong branch and was pushed
accidentally. It's best if it is ignored because the difference was
due to vers.o being different, not float.o... And it was confirmed to
not fix anything...

Pointy Hat to: imp

6 years agoTurn loader GELI support in the boot loaders off by default as a
imp [Thu, 14 Dec 2017 17:00:24 +0000 (17:00 +0000)]
Turn loader GELI support in the boot loaders off by default as a
temporary workaround. This fixes zfs booting generally, but breaks all
GELI booting by default. Add note to UPDATING to this effect. When the
GELI issues are resolved, this will be reverted.

6 years agoFix comments after bump in size.
imp [Thu, 14 Dec 2017 16:51:43 +0000 (16:51 +0000)]
Fix comments after bump in size.

6 years agoCargo cut a fix for the regressions r326585 caused.
imp [Thu, 14 Dec 2017 16:51:26 +0000 (16:51 +0000)]
Cargo cut a fix for the regressions r326585 caused.

We need to include ficl.h after the standard includes, rather than
before them. It changes the generated code in ways that haven't been
completely analyized. This restores the old code generation (as
verified by md5 changing back for zfsloader).

This should restore GPT + ZFS and GPT + ZFS + GELI booting that was
broken in r326585 (or would have been if r326584 hadn't broken the
build).

Sponsored by: Netflix

6 years agolibefi: make efichar.h more usable in stand code
tsoome [Thu, 14 Dec 2017 16:41:52 +0000 (16:41 +0000)]
libefi: make efichar.h more usable in stand code

Use _STANDALONE for guard expression in efichar.[ch] and add efi_char typedef.
clean up boot1.c, and replace for loop in efipart.c with ucs2len().

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D13488

6 years agodhclient(8): raise WARNS to 3
asomers [Thu, 14 Dec 2017 15:41:32 +0000 (15:41 +0000)]
dhclient(8): raise WARNS to 3

Mostly had to fix a lot of signed/unsigned comparison warnings

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agoRe-add spaces lost in r326436.
markj [Thu, 14 Dec 2017 15:40:03 +0000 (15:40 +0000)]
Re-add spaces lost in r326436.

X-MFC with: r326436

6 years agoIn devfs_lookupx() dotdot lookup case, avoid dereferencing
kib [Thu, 14 Dec 2017 13:41:11 +0000 (13:41 +0000)]
In devfs_lookupx() dotdot lookup case, avoid dereferencing
dvp->v_mount after dvp is unlocked.

The vnode might be reclaimed after unlock, so v_mount becomes NULL.
Cache the struct mount pointer before the unlock, the struct is
type-stable.

Note that devfs_allocv() reads mp->mnt_data but does not operate on it
further when dirent is doomed.  The unmount cannot proceed until all
dirents are reclaimed.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoAdd the virtualisation special register definitions.
andrew [Thu, 14 Dec 2017 13:19:43 +0000 (13:19 +0000)]
Add the virtualisation special register definitions.

Submitted by: Mihai Carabas <mihai.carabas@gmail.com>
Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D11846

6 years agoFix mbuf leak when TCPMD5_OUTPUT() method returns error.
ae [Thu, 14 Dec 2017 12:54:20 +0000 (12:54 +0000)]
Fix mbuf leak when TCPMD5_OUTPUT() method returns error.

PR: 223817
MFC after: 1 week

6 years agoReplace usage of fparselen(3) by a getline(3)
bapt [Thu, 14 Dec 2017 08:57:37 +0000 (08:57 +0000)]
Replace usage of fparselen(3) by a getline(3)

This allow to remove the dependency on libutil

6 years agoAdd basic bwn(4) support for the (BCMA-based) BCM43224 and BCM43225.
landonf [Thu, 14 Dec 2017 06:45:04 +0000 (06:45 +0000)]
Add basic bwn(4) support for the (BCMA-based) BCM43224 and BCM43225.

- Add the BCM4322X D11 core revision and missing BCM43224 PCI device ID to
  our device tables.
- Disable the DMA engine parity check (rather than adding parity support
  to the to-be-replaced bwn(4) DMA implementation).

Currently, N-PHY support in bwn(4) is GPL licensed, and is not included by
default. Until this is replaced with Broadcom's ISC-licensed N-PHY
implementation, bwn(4) must be rebuilt to enable N-PHY support.

To build bwn(4) with N-PHY support, add the following lines to your kernel
configuration file and rebuild the kernel (and modules):

options BWN_GPL_PHY

To test bwn(4) with a BCM43224/BCM43225 device, install the firmware from
the net/bwn-firmware-kmod port, and place the following lines in
loader.conf(5):

hw.bwn_pci.preferred="1"

if_bwn_pci_load="YES
bwn_v4_ucode_load="YES"
bwn_v4_n_ucode_load="YES"
bwn_v4_lp_ucode_load="YES"

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agoAllow bman-portals and qman-portals to attach to simple-bus
jhibbits [Thu, 14 Dec 2017 04:41:07 +0000 (04:41 +0000)]
Allow bman-portals and qman-portals to attach to simple-bus

Official Linux dts's put the individual portals under a simple-bus, rather
than under a '*-portals' grouping.  This adds a hack to permit that, which
gets us closer to using stock device trees for DPAA-based devices.

6 years agobhndb(4): Fix two register window overcommit bugs introduced in r326297:
landonf [Thu, 14 Dec 2017 03:41:12 +0000 (03:41 +0000)]
bhndb(4): Fix two register window overcommit bugs introduced in r326297:

- The window target must always be updated when stealing a register window.
- Fix missing initialization of bhndb(4) region alloc_flags when
  registering statically mapped port regions (caught by scan-build).

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agobhnd_chipc(4): Correct typo in flag macros that broke clearing of GPIO
landonf [Thu, 14 Dec 2017 03:12:05 +0000 (03:12 +0000)]
bhnd_chipc(4): Correct typo in flag macros that broke clearing of GPIO
pin flags.

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agobhnd(4): Add missing enclosing parentheses to the bhnd bus space macros to
landonf [Thu, 14 Dec 2017 03:03:08 +0000 (03:03 +0000)]
bhnd(4): Add missing enclosing parentheses to the bhnd bus space macros to
avoid precedence bugs.

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agobhnd(4): Include board_devid in the bhnd_board_info structure, and populate
landonf [Thu, 14 Dec 2017 01:58:05 +0000 (01:58 +0000)]
bhnd(4): Include board_devid in the bhnd_board_info structure, and populate
the expected default board_vendor value on MIPS SoCs.

This is required by bwn(4) to differentiate between single-band and
dual-band device variants that otherwise share a common chip ID.

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agoReduce size of several on-stack string buffers.
mav [Wed, 13 Dec 2017 21:17:00 +0000 (21:17 +0000)]
Reduce size of several on-stack string buffers.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

6 years agodhclient(8): Don't shift through the sign bit of a signed int
asomers [Wed, 13 Dec 2017 20:48:20 +0000 (20:48 +0000)]
dhclient(8): Don't shift through the sign bit of a signed int

PR: 208007
Submitted by: Michael McConville <mmcco@mykolab.com>
MFC after: 3 weeks

6 years agonetmap pkt-gen tool: Fix memset(3) argument order
cem [Wed, 13 Dec 2017 19:36:29 +0000 (19:36 +0000)]
netmap pkt-gen tool: Fix memset(3) argument order

Submitted by: Michael McConville <mmcco AT mykolab.com>
Sponsored by: Dell EMC Isilon

6 years agoPull in r315334 from upstream lld trunk (by Rafael Espindola):
dim [Wed, 13 Dec 2017 19:03:48 +0000 (19:03 +0000)]
Pull in r315334 from upstream lld trunk (by Rafael Espindola):

  Don't create a dummy __tls_get_addr.

  We just don't need one with the current setup.

  We only error on undefined references that are used by some
  relocation.

  If we managed to relax all uses of __tls_get_addr, no relocation uses
  it and we don't produce an error.

  This is less code and fixes the case were we fail to relax. Before we
  would produce a broken output, but now we produce an error.

Pull in r320390 from upstream lld trunk (by Rafael Espindola):

  Create reserved symbols early so they can be versioned.

  This fixes pr35570.

  We were creating these symbols after parsing version scripts, so they
  could not be versioned.

  We cannot move the version script parsing later because we need it for
  lto.

  One option is to move both addReservedSymbols and
  createSyntheticSections earlier. The disadvantage is that some
  sections created by createSyntheticSections replace other input
  sections. For example, gdb index replaces .debug_gnu_pubnames, so it
  wants to run after gc sections so that it can set S->Live to false.

  What this patch does instead is to move just the ElfHeader creation
  early.

Pull in r320412 from upstream lld trunk (by Rafael Espindola):

  Handle symbols pointing to output sections.

  Now that gc sections runs after linker defined symbols are added it
  can see symbols that point to an OutputSection.

  Should fix a bot failure.

Pull in r320431 from upstream lld trunk (by Peter Collingbourne):

  ELF: Do not follow relocation edges to output sections during GC.

  This fixes an assertion error introduced by r320390.

  Differential Revision: https://reviews.llvm.org/D41095

Together these fix handling of reserved symbols, in particular _end,
which is needed to make brk(2) and sbrk(2) work correctly.  This
unbreaks the emacs ports on amd64, and also appears to unbreak most of
world on i386.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13466

6 years agoCleaup, no functional change.
tuexen [Wed, 13 Dec 2017 17:11:57 +0000 (17:11 +0000)]
Cleaup, no functional change.

6 years agoSPDX: some uses of the RSA-MD license.
pfg [Wed, 13 Dec 2017 16:30:39 +0000 (16:30 +0000)]
SPDX: some uses of the RSA-MD license.

6 years agoFix kernel build if MAC is not defined.
fsu [Wed, 13 Dec 2017 16:14:38 +0000 (16:14 +0000)]
Fix kernel build if MAC is not defined.

Reported by:    Ravi Pokala, Andrew Turner
Approved by:    pfg (mentor)
MFC after:      1 week

6 years agoSPDX: mostly fixes to previous changes.
pfg [Wed, 13 Dec 2017 16:13:17 +0000 (16:13 +0000)]
SPDX: mostly fixes to previous changes.

Introduce the recently approved BSD-1-Clause and replace 0BSD which
never did fit well our use cases.

6 years agoReplace homemade equivalent of tolower(3) by towlower(3)
bapt [Wed, 13 Dec 2017 16:09:00 +0000 (16:09 +0000)]
Replace homemade equivalent of tolower(3) by towlower(3)

This will help in the futur making diff -i works with multibyte

6 years agoTone down the description for the growfs "-y" flag.
trasz [Wed, 13 Dec 2017 14:08:33 +0000 (14:08 +0000)]
Tone down the description for the growfs "-y" flag.

MFC after: 2 weeks

6 years agoUse ataio ccb instead of general ccb to avoid excessice stack usage.
imp [Wed, 13 Dec 2017 07:07:27 +0000 (07:07 +0000)]
Use ataio ccb instead of general ccb to avoid excessice stack usage.

6 years agofind(1): remove unused variable
eadler [Wed, 13 Dec 2017 03:36:33 +0000 (03:36 +0000)]
find(1): remove unused variable

6 years agoFollow-up to r325967, which removed /etc/casper, by also removing it
dim [Tue, 12 Dec 2017 22:21:20 +0000 (22:21 +0000)]
Follow-up to r325967, which removed /etc/casper, by also removing it
from BSD.root.dist, so it does not get created again on installworld.

6 years agoMFV r326785: 8880 improve DTrace error checking
markj [Tue, 12 Dec 2017 22:08:34 +0000 (22:08 +0000)]
MFV r326785: 8880 improve DTrace error checking

illumos/illumos-gate@2cf374268f3e1c9e9be6367466b183d27632583a
https://github.com/illumos/illumos-gate/commit/2cf374268f3e1c9e9be6367466b183d27632583a

https://www.illumos.org/issues/8880

Reviewed by: Tim Kordas <tim.kordas@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Jerry Jelinek <jerry.jelinek@joyent.com>

MFC after: 1 week

6 years agoRevert r326792, r326784, r326772, r326712
imp [Tue, 12 Dec 2017 22:06:22 +0000 (22:06 +0000)]
Revert r326792, r326784, r326772, r326712

Something subtle is creating problems for disk access on ubldr. Back
it out unti that can be sorted out.

Sponsored by: Netflix

6 years agoCorrect initialization of pc on powerpc.
markj [Tue, 12 Dec 2017 20:41:11 +0000 (20:41 +0000)]
Correct initialization of pc on powerpc.

PR: 224293
Submitted by: Breno Leitao <breno.leitao@gmail.com>
X-MFC with: r326774
Pointy hat: markj

6 years ago1k objects on the stack are a bad idea. While it's likely safe in this
imp [Tue, 12 Dec 2017 20:22:09 +0000 (20:22 +0000)]
1k objects on the stack are a bad idea. While it's likely safe in this
context, it's also safe to allocate the memory and free it instead.

Noticed by: Eugene Grosbein's script

6 years agoMove buffer size checks outside of the vnode locks.
fsu [Tue, 12 Dec 2017 20:15:57 +0000 (20:15 +0000)]
Move buffer size checks outside of the vnode locks.

Reviewed by:    kib, cem, pfg (mentor)
Approved by:    pfg (mentor)
MFC after:      1 weeks

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

6 years agoFix extattr getters in case of neither uio nor buffer was not passed to VOP_*.
fsu [Tue, 12 Dec 2017 20:02:48 +0000 (20:02 +0000)]
Fix extattr getters in case of neither uio nor buffer was not passed to VOP_*.

Approved by:    pfg (mentor)
MFC after:      2 weeks

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

6 years agoActually insert the free(d) call missed in r326802.
imp [Tue, 12 Dec 2017 19:45:24 +0000 (19:45 +0000)]
Actually insert the free(d) call missed in r326802.

Noticed by: rpokala@