]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoPull in r321994 from upstream llvm trunk (by Alexey Bataev):
Dimitry Andric [Fri, 12 Jan 2018 18:19:14 +0000 (18:19 +0000)]
Pull in r321994 from upstream llvm trunk (by Alexey Bataev):

  [SLP] Fix PR35777: Incorrect handling of aggregate values.

  Summary:
  Fixes the bug with incorrect handling of InsertValue|InsertElement
  instrucions in SLP vectorizer. Currently, we may use incorrect
  ExtractElement instructions as the operands of the original
  InsertValue|InsertElement instructions.

  Reviewers: mkuper, hfinkel, RKSimon, spatel

  Subscribers: llvm-commits

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

This should fix "Invalid InsertValueInst operands!" errors when building
certain parts of editors/libreoffice.

Reported by: jbeich
PR: 225086

6 years agoPull in r322264 from upstream lld trunk (by me):
Dimitry Andric [Fri, 12 Jan 2018 18:16:51 +0000 (18:16 +0000)]
Pull in r322264 from upstream lld trunk (by me):

  Fix thread race between SectionPiece's OutputOff and Live members

  Summary:
  As reported in bug 35788, rL316280 reintroduces a race between two
  members of SectionPiece, which share the same 64 bit memory location.

  To fix the race, check the hash before checking the Live member, as
  suggested by Rafael.

  Reviewers: ruiu, rafael

  Reviewed By: ruiu

  Subscribers: smeenai, emaste, llvm-commits

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

6 years agoPull in r322056 from upstream llvm trunk (by Serguei Katkov):
Dimitry Andric [Tue, 9 Jan 2018 17:41:34 +0000 (17:41 +0000)]
Pull in r322056 from upstream llvm trunk (by Serguei Katkov):

  [CGP] Fix Complex addressing mode for offset

  If the offset is differ in two addressing mode we can continue only
  if ScaleReg is not set due to we will use it as merge of different
  offsets.

  It should fix PR35799 and PR35805.

  Reviewers: john.brawn, reames
  Reviewed By: reames
  Subscribers: llvm-commits
  Differential Revision: https://reviews.llvm.org/D41227

This should fix "ScaledReg == nullptr" assertions when building the
graphics/xpx, mail/alpine and editors/pico-alpine ports.

Reported by: jbeich
PR: 224866, 224995

6 years agoPull in r322041 from upstream lld trunk (by Rui Ueyama):
Dimitry Andric [Tue, 9 Jan 2018 17:38:43 +0000 (17:38 +0000)]
Pull in r322041 from upstream lld trunk (by Rui Ueyama):

  Do not use parallelForEach to call maybeCompress().

  Currently LLVM's paralellForEach has a problem with reentracy.
  That caused https://bugs.llvm.org/show_bug.cgi?id=35788 (lld somtimes
  hangs while linking Ruby 2.4) because maybeCompress calls writeTo
  which uses paralellForEach.

  This patch is to avoid using paralellForEach to call maybeCompress to
  workaround the issue.

This should fix potential hangs when linking parts of ruby24.

6 years agoPull in r321986 from upstream lld trunk (by James Henderson):
Dimitry Andric [Tue, 9 Jan 2018 17:37:09 +0000 (17:37 +0000)]
Pull in r321986 from upstream lld trunk (by James Henderson):

  [ELF] Compress debug sections after assignAddresses and support
  custom layout

  Previously, in r320472, I moved the calculation of section offsets
  and sizes for compressed debug sections into maybeCompress, which
  happens before assignAddresses, so that the compression had the
  required information. However, I failed to take account of
  relocations that patch such sections. This had two effects:

  1. A race condition existed when a debug section referred to a
     different debug section (see PR35788).
  2. References to symbols in non-debug sections would be patched
     incorrectly.  This is because the addresses of such symbols are not
     calculated until after assignAddresses (this was a partial
     regression caused by r320472, but they could still have been
     broken before, in the event that a custom layout was used in a
     linker script).

  assignAddresses does not need to know about the output section size
  of non-allocatable sections, because they do not affect the value of
  Dot. This means that there is no longer a reason not to support
  custom layout of compressed debug sections, as far as I'm aware.
  These two points allow for delaying when maybeCompress can be called,
  removing the need for the loop I previously added to calculate the
  section size, and therefore the race condition. Furthermore, by
  delaying, we fix the issues of relocations getting incorrect symbol
  values, because they have now all been finalized.

This should fix thread race conditions when linking parts of ruby24.

6 years agoAdd explanatory comment for r327622: clang 6.0.0 and higher warn about
Dimitry Andric [Mon, 8 Jan 2018 18:42:40 +0000 (18:42 +0000)]
Add explanatory comment for r327622: clang 6.0.0 and higher warn about
the ACPI_ROOT_OBJECT and ACPI_TO_POINTER macros from acpica's actypes.h
header, that they use arithmetic on a null pointer treated as a cast
from integer to pointer, which is a GNU extension.  We turn off the
warning, because this is in contributed code.

Requested by: rakuco

6 years agoPull in r321963 from upstream libc++ trunk (by me):
Dimitry Andric [Sun, 7 Jan 2018 18:33:19 +0000 (18:33 +0000)]
Pull in r321963 from upstream libc++ trunk (by me):

  Add pre-C++11 is_constructible wrappers for 3 arguments

  Summary:
  After rL319736 for D28253 (which fixes PR28929), gcc cannot compile
  <memory> anymore in pre-C+11 modes, complaining:

  In file included from /usr/include/c++/v1/memory:648:0,
                   from test.cpp:1:
  /usr/include/c++/v1/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::make_shared(_A0&, _A1&, _A2&)':
  /usr/include/c++/v1/memory:4365:5: error: wrong number of template arguments (4, should be at least 1)
       static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" );
       ^
  In file included from /usr/include/c++/v1/memory:649:0,
                   from test.cpp:1:
  /usr/include/c++/v1/type_traits:3198:29: note: provided for 'template<class _Tp, class _A0, class _A1> struct std::__1::is_constructible'
   struct _LIBCPP_TEMPLATE_VIS is_constructible
                               ^~~~~~~~~~~~~~~~
  In file included from /usr/include/c++/v1/memory:648:0,
                   from test.cpp:1:
  /usr/include/c++/v1/memory:4365:5: error: template argument 1 is invalid
       static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" );
       ^
  /usr/include/c++/v1/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::allocate_shared(const _Alloc&, _A0&, _A1&, _A2&)':
  /usr/include/c++/v1/memory:4444:5: error: wrong number of template arguments (4, should be at least 1)
       static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" );
       ^
  In file included from /usr/include/c++/v1/memory:649:0,
                   from test.cpp:1:
  /usr/include/c++/v1/type_traits:3198:29: note: provided for 'template<class _Tp, class _A0, class _A1> struct std::__1::is_constructible'
   struct _LIBCPP_TEMPLATE_VIS is_constructible
                               ^~~~~~~~~~~~~~~~
  In file included from /usr/include/c++/v1/memory:648:0,
                   from test.cpp:1:
  /usr/include/c++/v1/memory:4444:5: error: template argument 1 is invalid
       static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" );
       ^

  This is also reported in https://bugs.freebsd.org/224946 (FreeBSD is
  apparently one of the very few projects that regularly builds
  programs against libc++ with gcc).

  The reason is that the static assertions are invoking
  is_constructible with three arguments, while gcc does not have the
  built-in is_constructible feature, and the pre-C++11 is_constructible
  wrappers in <type_traits> only provide up to two arguments.

  I have added additional wrappers for three arguments, modified the
  is_constructible entry point to take three arguments instead, and
  added a simple test to is_constructible.pass.cpp.

  Reviewers: EricWF, mclow.lists

  Reviewed By: EricWF

  Subscribers: krytarowski, cfe-commits, emaste

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

This should allow gcc to compile the libc++ 6.0.0 <memory> header
without problems, in pre-C++11 mode.

Reported by:    jbeich
PR:             224946

6 years agoMerge llvm, clang, lld, lldb, compiler-rt and libc++ release_60 r321788,
Dimitry Andric [Sat, 6 Jan 2018 23:44:14 +0000 (23:44 +0000)]
Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_60 r321788,
update build glue and version numbers.

6 years agoVendor import of lldb release_60 branch r321788:
Dimitry Andric [Sat, 6 Jan 2018 21:37:20 +0000 (21:37 +0000)]
Vendor import of lldb release_60 branch r321788:
https://llvm.org/svn/llvm-project/lldb/branches/release_60@321788

6 years agoVendor import of lld release_60 branch r321788:
Dimitry Andric [Sat, 6 Jan 2018 21:36:48 +0000 (21:36 +0000)]
Vendor import of lld release_60 branch r321788:
https://llvm.org/svn/llvm-project/lld/branches/release_60@321788

6 years agoVendor import of libc++ release_60 branch r321788:
Dimitry Andric [Sat, 6 Jan 2018 21:36:34 +0000 (21:36 +0000)]
Vendor import of libc++ release_60 branch r321788:
https://llvm.org/svn/llvm-project/libcxx/branches/release_60@321788

6 years agoVendor import of compiler-rt release_60 branch r321788:
Dimitry Andric [Sat, 6 Jan 2018 21:36:08 +0000 (21:36 +0000)]
Vendor import of compiler-rt release_60 branch r321788:
https://llvm.org/svn/llvm-project/compiler-rt/branches/release_60@321788

6 years agoVendor import of clang release_60 branch r321788:
Dimitry Andric [Sat, 6 Jan 2018 21:35:46 +0000 (21:35 +0000)]
Vendor import of clang release_60 branch r321788:
https://llvm.org/svn/llvm-project/cfe/branches/release_60@321788

6 years agoVendor import of llvm release_60 branch r321788:
Dimitry Andric [Sat, 6 Jan 2018 21:34:26 +0000 (21:34 +0000)]
Vendor import of llvm release_60 branch r321788:
https://llvm.org/svn/llvm-project/llvm/branches/release_60@321788

6 years agoMerge ^/head r327341 through r327623.
Dimitry Andric [Sat, 6 Jan 2018 16:13:17 +0000 (16:13 +0000)]
Merge ^/head r327341 through r327623.

6 years agomorse(6): update documentation
Eitan Adler [Sat, 6 Jan 2018 15:52:28 +0000 (15:52 +0000)]
morse(6): update documentation

- bump Dd
- use 'r' instead of 'D' from the original submission

6 years agoRevert r327338, undoing the changes to the ACPI_ADD_PTR and ACPI_SUB_PTR
Dimitry Andric [Sat, 6 Jan 2018 15:52:21 +0000 (15:52 +0000)]
Revert r327338, undoing the changes to the ACPI_ADD_PTR and ACPI_SUB_PTR
macros.  Instead, turn off clang 6.0.0 warnings about null pointer
arithmetic in usr.sbin/acpi/acpidb instead.

6 years agoMove syscon_generic to attach much later
Kyle Evans [Sat, 6 Jan 2018 14:21:32 +0000 (14:21 +0000)]
Move syscon_generic to attach much later

It still needs to be before if_awg at least in order to be available for
other operations, but it should not be attaching before interrupt
controllers at the very least.

This should make errors involving syscon register space colliding with other
devices a little more innocent, but these conflicts should really be tracked
down and resolved. One such conflict is with the Raspberry Pi 3 local
interrupt controller, noticed by tuexen@

Reported by: tuexen

6 years agoTentatively apply https://reviews.llvm.org/D41635:
Dimitry Andric [Sat, 6 Jan 2018 13:19:36 +0000 (13:19 +0000)]
Tentatively apply https://reviews.llvm.org/D41635:

  We normally want to ignore SHT_NOBITS sections when computing
  offsets. The sh_offset of section itself seems to be irrelevant and

  * If the section is in the middle of a PT_LOAD, it will make no
    difference on the computed offset of the followup section.
  * If it is in the end of a PT_LOAD, we want to avoid its alignment
    changing the offset of the followup sections.

  The issue is if it is at the start of the PT_LOAD. In that case we do
  have to align it so that the following sections have congruent
  address and offset module the page size. We were not handling this
  case.

  This should fix freebsd kernel link.

In particular, this fixes ctfmerge and/or objcopy throwing "Layout
constraint violation" errors when processing an lld-linked kernel.

6 years agoThe source strings are from the password database which guarantees
Warner Losh [Sat, 6 Jan 2018 12:46:04 +0000 (12:46 +0000)]
The source strings are from the password database which guarantees
that the data going into it is sane.  Out of an abundance of caution,
limit the string copies to prevent an overflow.

CID: 1019035

6 years agoSanity check sysconf return value to ensure it's positive before we
Warner Losh [Sat, 6 Jan 2018 12:45:59 +0000 (12:45 +0000)]
Sanity check sysconf return value to ensure it's positive before we
use it. Use proper cast to convert long to size_t (instead of
blksize_t) to preclude sign extension issues.

CID: 1193754

6 years agoSanity check media size and sector counts to ensure that we don't
Warner Losh [Sat, 6 Jan 2018 12:34:03 +0000 (12:34 +0000)]
Sanity check media size and sector counts to ensure that we don't
produce negative sector numbers in the testing algorithm.

CID: 1198994

6 years agoUnbreak build after r327614
Li-Wen Hsu [Sat, 6 Jan 2018 09:48:04 +0000 (09:48 +0000)]
Unbreak build after r327614

Approved by: mjg (on IRC)
Differential Revision: https://reviews.freebsd.org/D13782

6 years agomorse(6): minor nits
Eitan Adler [Sat, 6 Jan 2018 07:48:17 +0000 (07:48 +0000)]
morse(6): minor nits

- Use copyright comment header
- Make it easier to compile on !FreeBSD
- Diff reduction against DragonFlyBSD

6 years agomorse(6): implement support for decoding morse code
Eitan Adler [Sat, 6 Jan 2018 07:02:24 +0000 (07:02 +0000)]
morse(6): implement support for decoding morse code

- Use `-r` for "reverse" mode and to match DragonFlyBSD.
- Move defines around to clear up logic
- use `errx` instead of `fprintf` and `exit`

PR: 35109
Submitted By: philipp.mergenthaler@stud.uni-karlsruhe.de
Submitted on: 2002-02-19
Reviewed by: kevans

6 years agoInvent new #defines for the biospci_{read,write}_config function to
Warner Losh [Sat, 6 Jan 2018 06:00:45 +0000 (06:00 +0000)]
Invent new #defines for the biospci_{read,write}_config function to
specify the width and use them everywhere.

Sponsored by: Netflix

6 years agoThere's no need / benefit from deleting the variable before we set it.
Warner Losh [Sat, 6 Jan 2018 06:00:40 +0000 (06:00 +0000)]
There's no need / benefit from deleting the variable before we set it.

Sponsored by: Netflix

6 years agoFix usage strings. -d and -p were removed before this was committed to
Warner Losh [Sat, 6 Jan 2018 06:00:34 +0000 (06:00 +0000)]
Fix usage strings. -d and -p were removed before this was committed to
FreeBSD, but the strings weren't updated.

Sponsored by: Netflix

6 years agoFix a header inclusion missed in the previous commit.
Jung-uk Kim [Sat, 6 Jan 2018 03:41:35 +0000 (03:41 +0000)]
Fix a header inclusion missed in the previous commit.

Reported by: Michael Butler (imb at protected-networks dot net)

6 years agoHandle misconfigured/nonexistent pcidev for comconsole instead of BTX panic.
Sean Bruno [Fri, 5 Jan 2018 23:50:50 +0000 (23:50 +0000)]
Handle misconfigured/nonexistent pcidev for comconsole instead of BTX panic.

PR: 203319
Reviewed by: imp jhb
MFC after: 2 weeks
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D13776

6 years agoMerge ACPICA 20180105.
Jung-uk Kim [Fri, 5 Jan 2018 23:21:47 +0000 (23:21 +0000)]
Merge ACPICA 20180105.

6 years agoImport ACPICA 20180105.
Jung-uk Kim [Fri, 5 Jan 2018 23:02:12 +0000 (23:02 +0000)]
Import ACPICA 20180105.

6 years agoRevert r327599. I missed a new file.
Jung-uk Kim [Fri, 5 Jan 2018 22:59:03 +0000 (22:59 +0000)]
Revert r327599.  I missed a new file.

Pointyhat to: jkim

6 years agoImport ACPICA 20180105.
Jung-uk Kim [Fri, 5 Jan 2018 22:51:18 +0000 (22:51 +0000)]
Import ACPICA 20180105.

6 years agoRemove LINK_MAX.
John Baldwin [Fri, 5 Jan 2018 22:26:23 +0000 (22:26 +0000)]
Remove LINK_MAX.

After recent changes to change filesystems to use filesystem-specific
limits, LINK_MAX is no longer used in the base system.  Applications
should in theory be able to cope with a lack of LINK_MAX by using
pathconf().

PR: 224628 (exp-run)
Approved by: imp, kib
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D13658

6 years agoMake it possible to re-evaluate cpu_features.
Konstantin Belousov [Fri, 5 Jan 2018 21:06:19 +0000 (21:06 +0000)]
Make it possible to re-evaluate cpu_features.

Add cpuctl(4) ioctl CPUCTL_EVAL_CPU_FEATURES which forces re-read of
cpu_features, cpu_features2, cpu_stdext_features, and
std_stdext_features2.

The intent is to allow the kernel to see the changes in the CPU
features after micocode update.  Of course, the update is not atomic
across variables and not synchronized with readers.  See the man page
warning as well.

Reviewed by: imp (previous version), jilles
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D13770

6 years agoIn sendfile_iodone() both pru_abort and sorele need to be executed
Gleb Smirnoff [Fri, 5 Jan 2018 20:21:46 +0000 (20:21 +0000)]
In sendfile_iodone() both pru_abort and sorele need to be executed
with proper VNET context set.

Reported by: sbruno
MFC after: 2 weeks

6 years agoFix a couple of comments in AMD Virtual Machine Control Block structure
Andriy Gapon [Fri, 5 Jan 2018 19:15:24 +0000 (19:15 +0000)]
Fix a couple of comments in AMD Virtual Machine Control Block structure

MFC after: 1 week

6 years agoCorrect comment. procfs_doprocfile implements 'file', not 'self'.
John Baldwin [Fri, 5 Jan 2018 18:32:46 +0000 (18:32 +0000)]
Correct comment.  procfs_doprocfile implements 'file', not 'self'.

6 years agoAdd 64bit feature support.
Fedor Uporov [Fri, 5 Jan 2018 10:04:01 +0000 (10:04 +0000)]
Add 64bit feature support.

Reviewed by:    kevlo, pfg (mentor)
Approved by:    pfg (mentor)
MFC after:      6 months

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

6 years agoBuild service tests with Casper support.
Mariusz Zaborski [Fri, 5 Jan 2018 09:31:41 +0000 (09:31 +0000)]
Build service tests with Casper support.

6 years agoFix typo & build
Li-Wen Hsu [Fri, 5 Jan 2018 08:29:32 +0000 (08:29 +0000)]
Fix typo & build

Approved by: kevlo

6 years agoRemove dead code (comma is either 0 or 1 for sure, no need to test).
Warner Losh [Fri, 5 Jan 2018 07:29:02 +0000 (07:29 +0000)]
Remove dead code (comma is either 0 or 1 for sure, no need to test).
Close /dev/pci when we're done with it.

CID: 1007450100744910086151008614

6 years agobits is never null when we call ot. Add an assert to that effect and
Warner Losh [Fri, 5 Jan 2018 07:28:58 +0000 (07:28 +0000)]
bits is never null when we call ot. Add an assert to that effect and
remove test for NULL.

CID: 270774

6 years agoTag 'a' case as one we're intentionally falling through to
Warner Losh [Fri, 5 Jan 2018 07:28:48 +0000 (07:28 +0000)]
Tag 'a' case as one we're intentionally falling through to
the 'F' case.

CID: 1008176

6 years agounits(1): add missing ':' for two short arguments
Eitan Adler [Fri, 5 Jan 2018 07:24:43 +0000 (07:24 +0000)]
units(1): add missing ':' for two short arguments

PR: 209850
MFC After: 3 days

6 years agocam/da: QUIRK: Add 4K quirks for WD Red and Black MHDDs
Eitan Adler [Fri, 5 Jan 2018 07:14:39 +0000 (07:14 +0000)]
cam/da: QUIRK: Add 4K quirks for WD Red and Black MHDDs

PR: 188685
Submitted by: Jeremy Chadwick <jdc@koitsu.org>
Reported by: Martin Birgmeier <d8zNeCFG@aon.at>

6 years agoAdd a number of sanity checks to the data that we're handling from the
Warner Losh [Fri, 5 Jan 2018 07:09:40 +0000 (07:09 +0000)]
Add a number of sanity checks to the data that we're handling from the
CIS. Coverity has tagged it as tainted. While this data is more
trusted than your average data, we still need to do some basic
validation on it. Check ioctl return value to ensure we switch memory
targets between common and attribute as well as the lseek.

CID: 1210464100664010068681007292100909110098221009824

6 years agoNeed to convert '/' back to '\' when creating a path. Ideally, this
Warner Losh [Fri, 5 Jan 2018 07:09:29 +0000 (07:09 +0000)]
Need to convert '/' back to '\' when creating a path. Ideally, this
would be filesystem type dependent, but that's difficult to accomplish
and it's unclear how the UEFI firmware will cope. Be conservative and
make boot loaders cope instead.

Sponsored by: Netflix

6 years agoSet dp to NULL when we free it, and tree a NULL dp as an error
Warner Losh [Fri, 5 Jan 2018 07:09:24 +0000 (07:09 +0000)]
Set dp to NULL when we free it, and tree a NULL dp as an error
condition. This should prevent a double free. In addition, prevent a
leak by freeing dp each loop and when we're done.

CID: 1383577
Sponsored by: Netflix

6 years agoFree options before setting them. This will prevent us from leaking
Warner Losh [Fri, 5 Jan 2018 07:09:19 +0000 (07:09 +0000)]
Free options before setting them. This will prevent us from leaking
memory when we have multiple copies of the same option from being
specified.

Sponsored by: Netflix

6 years agoEnsure that we have a description string. When unspecified, default to "".
Warner Losh [Fri, 5 Jan 2018 07:09:09 +0000 (07:09 +0000)]
Ensure that we have a description string. When unspecified, default to "".

Sponsored by: Netflix

6 years agoDon't close fd twice. This line should have been deleted in r327279.
Warner Losh [Fri, 5 Jan 2018 05:34:20 +0000 (05:34 +0000)]
Don't close fd twice. This line should have been deleted in r327279.

CID: 1384015

6 years agoOnly call close if fd and fd1 are not -1.
Warner Losh [Fri, 5 Jan 2018 05:34:14 +0000 (05:34 +0000)]
Only call close if fd and fd1 are not -1.

CID: 13840181384017

6 years agoFix cut and paste error from devinfo.8 origin of this file
Warner Losh [Fri, 5 Jan 2018 05:02:09 +0000 (05:02 +0000)]
Fix cut and paste error from devinfo.8 origin of this file

Noticed by: kevans@

6 years agohexdump(1): Speed up -s flag on devices
Kyle Evans [Fri, 5 Jan 2018 01:46:41 +0000 (01:46 +0000)]
hexdump(1): Speed up -s flag on devices

Using the -s flag on devices is extraordinarily slow due to using fseek(3) a
little too conservatively. Address this by using fseek on character/block
devices as well, falling back to getchar(3) only if we fail to seek or we're
operating on tape drives, where fseek may succeed while not actually being
supported.

PR: 86485
Submitted by: arundel (originally; modified since then)
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D10939

6 years agoRevert r327360, which can cause boot problems on high-CPU-count (>60)
Nathan Whitehorn [Thu, 4 Jan 2018 23:07:51 +0000 (23:07 +0000)]
Revert r327360, which can cause boot problems on high-CPU-count (>60)
POWER8 and POWER9 systems, pending further analysis.

PR: 224841

6 years agofind: Speed up tests by using touch -d instead of sleep for timestamps
Jilles Tjoelker [Thu, 4 Jan 2018 22:59:24 +0000 (22:59 +0000)]
find: Speed up tests by using touch -d instead of sleep for timestamps

I have verified that the tests still detect the absence of the r327362 fix.

6 years agoif_awg: Use syscon prop if it exists
Kyle Evans [Thu, 4 Jan 2018 22:37:15 +0000 (22:37 +0000)]
if_awg: Use syscon prop if it exists

The emac bindings that are landing in Linux 4.15 specify a syscon property
on the emac node that point to /soc/syscon. Use this property if it's
specified, but maintain backwards compatibility with the old method.

The older method is still used for boards that we get .dtb from u-boot, such
as pine64, that did not yet have stable emac bindings.

Tested on: Banana Pi-M3 (a83t)
Tested on: Pine64 (a64)
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D13296

6 years agoAlways use atomic_fetchadd() when updating per-user accounting values.
John Baldwin [Thu, 4 Jan 2018 22:07:58 +0000 (22:07 +0000)]
Always use atomic_fetchadd() when updating per-user accounting values.

This avoids re-reading a variable after it has been updated via an
atomic op.  It is just a cosmetic cleanup as the read value was only
used to control a diagnostic printf that should rarely occur (if ever).

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D13768

6 years agoReport offset relative to the backing object for kinfo_vmentry structures.
John Baldwin [Thu, 4 Jan 2018 21:59:34 +0000 (21:59 +0000)]
Report offset relative to the backing object for kinfo_vmentry structures.

For the pathname reported in kinfo_vmentry structures (kve_path), the
sysctl handlers walk the object chain to find the bottom-most VM object.
This permits a COW mapping of a file with dirty pages to report the
pathname of the originally mapped file.  Do the same for the object
offset (kve_offset) computing a cumulative offset during the same object
walk so that the reported offset is relative to the reported pathname.

Note that ptrace(PT_VM_ENTRY) already returns a cumulative offset
rather than the raw offset of the VM map entry.

Note also that this does not affect procstat -v output (even structured
output) since that output does not include the kve_offset field.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D13767

6 years agoAllow timed waits with relative timeouts on locks and condvars.
Ed Schouten [Thu, 4 Jan 2018 21:57:37 +0000 (21:57 +0000)]
Allow timed waits with relative timeouts on locks and condvars.

Even though pthreads doesn't support this, there are various alternative
APIs that use this. For example, uv_cond_timedwait() accepts a relative
timeout. So does Rust's std::sync::Condvar::wait_timeout().

Though I personally think that relative timeouts are bad (due to
imprecision for repeated operations), it does seem that people want
this. Extend the existing futex functions to keep track of whether an
absolute timeout is used in a boolean flag.

MFC after: 1 month

6 years agoDisabled the use of flowid for lagg by default
Steven Hartland [Thu, 4 Jan 2018 20:05:47 +0000 (20:05 +0000)]
Disabled the use of flowid for lagg by default

Disabled the use of RSS hash from the network card aka flowid for
lagg(4) interfaces by default as it's currently incompatible with
the lacp and loadbalance protocols.

The incompatibility is due to the fact that the flowid isn't know
for the first packet of a new outbound stream which can result in
the hash calculation method changing and hence a stream being
incorrectly split across multiple interfaces during normal
operation.

This can be re-enabled by setting the following in loader.conf:
net.link.lagg.default_use_flowid="1"

Discussed with: kmacy
Sponsored by: Multiplay

6 years agobhnd(4): Add missing BCM4312 backplane clock speed entry.
Landon J. Fuller [Thu, 4 Jan 2018 19:47:01 +0000 (19:47 +0000)]
bhnd(4): Add missing BCM4312 backplane clock speed entry.

The default 80MHz clock speed returned by bhnd_pmu_si_clock() was already
correct; this just prevents the "No backplane clock specified" warning
printf from being emitted when querying backplane clock speed.

Sponsored by: The FreeBSD Foundation

6 years agoRestructure swapout tests after vm map locking was removed.
Konstantin Belousov [Thu, 4 Jan 2018 18:14:58 +0000 (18:14 +0000)]
Restructure swapout tests after vm map locking was removed.

Consolidate the regions covered by the process lock.
Combine similar conditions tests into one, e.g. all process flags can
be test with one logical operation.
Add check for in-exec state, since p_vmspace is dererenced.
Remove labels and goto by explicitly tracking state.
Update comments.

Reviewed by: alc, markj (previous version)
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D13693

6 years agoRemove myself from ports-secteam
Jason Unovitch [Thu, 4 Jan 2018 17:58:48 +0000 (17:58 +0000)]
Remove myself from ports-secteam

I will be moving on to other life commitments this year and will not have
the time to support contributions as a ports committer, if able, until life
settles at the end of the year.

Discussed with: portmgr

6 years agocap_unwrap should return a descriptor but also free the structure.
Mariusz Zaborski [Thu, 4 Jan 2018 08:23:23 +0000 (08:23 +0000)]
cap_unwrap should return a descriptor but also free the structure.

6 years agoCorrect function name in description block.
Cy Schubert [Thu, 4 Jan 2018 04:11:40 +0000 (04:11 +0000)]
Correct function name in description block.

MFC after: 3 days

6 years agoAdd missing macro in man page.
Mariusz Zaborski [Thu, 4 Jan 2018 04:04:29 +0000 (04:04 +0000)]
Add missing macro in man page.

Reported by: brueffer@

6 years agoOnce we have decided to swap out a process, don't delay the laundering of
Alan Cox [Thu, 4 Jan 2018 03:16:32 +0000 (03:16 +0000)]
Once we have decided to swap out a process, don't delay the laundering of
its per-thread kernel stack pages by making them pass through the inactive
queue first.  Instead, immediately place them in the laundry so that they
might be cleaned and made available for reclamation sooner.

Reviewed by: kib, markj
MFC after: 1 week

6 years agoThe recent bump of MAXDSIZ made 32-bit binary execution on 64-bit powerpc fail.
Andreas Tobler [Wed, 3 Jan 2018 20:20:43 +0000 (20:20 +0000)]
The recent bump of MAXDSIZ made 32-bit binary execution on 64-bit powerpc fail.
The data segement was too big.

Add a fix-up function like on ia32 for MAXDSIZ.

While here, bring also the MAXSSIZ closer to amd64 and add an equal fix-up
function for MAXSSIZ.

Reviewed by: jhibbits@
Obtained from:  jhibbits@
Differential Revision: https://reviews.freebsd.org/D13753

6 years agoath: fix possible memory disclosure in ioctl handler
Ed Maste [Wed, 3 Jan 2018 19:28:13 +0000 (19:28 +0000)]
ath: fix possible memory disclosure in ioctl handler

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC after: 1 week

6 years agocxgbe(4): Add a knob to enable/disable PCIe relaxed ordering. Disable it by
Navdeep Parhar [Wed, 3 Jan 2018 19:24:57 +0000 (19:24 +0000)]
cxgbe(4): Add a knob to enable/disable PCIe relaxed ordering.  Disable it by
default when running on Intel CPUs.

This is a crude fix for the performance issues alluded to in these Linux commits:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=87e09cdec4dae08acdb4aa49beb793c19d73e73e
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a99b646afa8a02571ea298bedca6592d818229cd

MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoath: revert accidental change committed with r327526
Ed Maste [Wed, 3 Jan 2018 19:24:21 +0000 (19:24 +0000)]
ath: revert accidental change committed with r327526

It will be recommitted with the correct commit message.

6 years agoembed_mfs: correctly test grep return value
Ed Maste [Wed, 3 Jan 2018 19:22:10 +0000 (19:22 +0000)]
embed_mfs: correctly test grep return value

Reported by: br
MFC with: r326992
Sponsored by: The FreeBSD Foundation

6 years agoAdd missing newlines to a couple of error messages.
Mark Johnston [Wed, 3 Jan 2018 18:19:47 +0000 (18:19 +0000)]
Add missing newlines to a couple of error messages.

Keep error messages on a single line so that they're easier to grep for.

Reported by: pho
MFC after: 1 week

6 years agoUse 'extern uint8_t' instead of 'extern void' for external symbols.
John Baldwin [Wed, 3 Jan 2018 17:40:51 +0000 (17:40 +0000)]
Use 'extern uint8_t' instead of 'extern void' for external symbols.

The beri boot loaders depend on symbols defined in linker scripts or
assembly files.  The boot loaders do not care about the type of these
symbols but just want to extract a pointer to them.  Older versions of
GCC permitted external symbols to be declared of type 'void' and then
'&foo' generated a void pointer to the memory at the symbol's address.
However, void objects are not valid C and newer versions of GCC error if
these are used.  Instead, declare these symbols as being bytes (or
an array of bytes in the cheri_sdcard_vaddr case).

Sponsored by: DARPA / AFRL

6 years agoDon't clobber system LDFLAGS for beri boot loaders.
John Baldwin [Wed, 3 Jan 2018 17:35:38 +0000 (17:35 +0000)]
Don't clobber system LDFLAGS for beri boot loaders.

Prior to r325114, bsd.init.mk was included after assignments to CFLAGS and
LDFLAGS in these Makefiles.  After r325114, bare assignments (= rather than
+=) lost system-assigned default values that are needed when compiling with
an external toolchain.  CFLAGS in both Makefiles already uses +=.  This
commit changes LDFLAGS to use +=.  While here, depend on the LDFLAGS update
in the parent Makefile.inc to set -nostdlib.

Sponsored by: DARPA / AFRL

6 years agoFix warnings from "mandoc -Tlint -Wwarning".
Edward Tomasz Napierala [Wed, 3 Jan 2018 17:28:01 +0000 (17:28 +0000)]
Fix warnings from "mandoc -Tlint -Wwarning".

Reported by: Yuri Pankov <yuripv at gmx.com>
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agomorse(6): fix two typod
Eitan Adler [Wed, 3 Jan 2018 17:04:13 +0000 (17:04 +0000)]
morse(6): fix two typod

6 years agoUse the new SDM-approved way to serialize x2APIC MSR writes.
Konstantin Belousov [Wed, 3 Jan 2018 11:23:47 +0000 (11:23 +0000)]
Use the new SDM-approved way to serialize x2APIC MSR writes.

SDM editions 64 and below stated that it is enough to use MFENCe or
LFENCE to serialize x2APIC register writes.  New edition 65 requires
either full serialization instruction or MFENCE;LFENCE sequence.  Use
the later, FreeBSD needs serialization to ensure that writes done
before IPI request are visible to the target IPI CPU.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoEliminate a paranthesis which is both unneeded and causing trouble.
Poul-Henning Kamp [Wed, 3 Jan 2018 09:33:59 +0000 (09:33 +0000)]
Eliminate a paranthesis which is both unneeded and causing trouble.

6 years agomorse(6): add a few missing characters
Eitan Adler [Wed, 3 Jan 2018 09:08:32 +0000 (09:08 +0000)]
morse(6): add a few missing characters

- add ñ, ', and _
- remove lint support
- add missing header for ioctl

6 years agoNLS data and tz can be cached using caspicum helpers.
Mariusz Zaborski [Wed, 3 Jan 2018 07:43:04 +0000 (07:43 +0000)]
NLS data and tz can be cached using caspicum helpers.

Using them we simplifies and unifies sandboxed code.

6 years agoAdd info about SW_WATCHDOG change to be dynamic in the common case.
Mike Karels [Wed, 3 Jan 2018 06:41:39 +0000 (06:41 +0000)]
Add info about SW_WATCHDOG change to be dynamic in the common case.

6 years agoDocument services which we have in libcasper.
Mariusz Zaborski [Wed, 3 Jan 2018 06:22:40 +0000 (06:22 +0000)]
Document services which we have in libcasper.

Reviewed by: bcr@
Differential Revision: https://reviews.freebsd.org/D13734

6 years agobsd-family-tree: revert r327333
Eitan Adler [Wed, 3 Jan 2018 03:46:28 +0000 (03:46 +0000)]
bsd-family-tree: revert r327333

bsd-family-tree should only contain projects that have had actual
releases.

Requested by: core

6 years agomake SW_WATCHDOG dynamic
Mike Karels [Wed, 3 Jan 2018 00:56:30 +0000 (00:56 +0000)]
make SW_WATCHDOG dynamic

Enable the hardclock-based watchdog previously conditional on the
SW_WATCHDOG option whenever hardware watchdogs are not found, and
watchdogd attempts to enable the watchdog. The SW_WATCHDOG option
still causes the sofware watchdog to be enabled even if there is a
hardware watchdog. This does not change the other software-based
watchdog enabled by the --softtimeout option to watchdogd.

Note that the code to reprime the watchdog during kernel core dumps is
no longer conditional on SW_WATCHDOG. I think this was previously a bug.

Reviewed by: imp alfred bjk
MFC after: 1 week
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D13713

6 years agokldxref: correct function names in warning messages
Ed Maste [Tue, 2 Jan 2018 21:31:54 +0000 (21:31 +0000)]
kldxref: correct function names in warning messages

Sponsored by: The FreeBSD Foundation

6 years agonctgpio: add new device id for the GPIO chip in PCEngines APU3
Oleksandr Tymoshenko [Tue, 2 Jan 2018 20:58:05 +0000 (20:58 +0000)]
nctgpio: add new device id for the GPIO chip in PCEngines APU3

PR: 224512
Submitted by: mike@sentex.net
MFC after: 2 weeks

6 years agoath: fix possible memory disclosures in ioctl handlers
Ed Maste [Tue, 2 Jan 2018 19:34:23 +0000 (19:34 +0000)]
ath: fix possible memory disclosures in ioctl handlers

Apply the fix from r327499 to additional ioctl handlers.

Reported by: Ilja van Sprundel <ivansprundel@ioactive.com>
MFC after: 1 week
MFC with: r327499
Sponsored by: The FreeBSD Foundation

6 years agoath: fix memory disclosure from ath_btcoex_ioctl
Ed Maste [Tue, 2 Jan 2018 19:29:30 +0000 (19:29 +0000)]
ath: fix memory disclosure from ath_btcoex_ioctl

The ath_btcoex_ioctl handler allocated a buffer without M_ZERO and
returned it to userland without writing to it.

The device has permissions only for root so this is not urgent, and the
fix can be MFCd and considered for a future EN.

Reported by: Ilja van Sprundel <ivansprundel@ioactive.com>
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
Reviewed by: adrian
MFC after: 1 week

6 years agohpt{nr,rr}: plug info leak in hpt_ioctl
Ed Maste [Tue, 2 Jan 2018 18:31:32 +0000 (18:31 +0000)]
hpt{nr,rr}: plug info leak in hpt_ioctl

The hpt{nr,rr} ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

The hpt27{nr,rr} device has permissions only for root so this is not urgent,
and the fix can be MFCd and considered for a future EN.

The same issue was reported in the hpt27xx driver by Ilja Van Sprundel.

Reviewed by: jhb, kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agohpt27xx: plug info leak in hpt_ioctl
Ed Maste [Tue, 2 Jan 2018 18:29:44 +0000 (18:29 +0000)]
hpt27xx: plug info leak in hpt_ioctl

The hpt27xx ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

The hpt27xx device has permissions only for root so this is not urgent,
and the fix can be MFCd and considered for a future EN.

Reported by: Ilja van Sprundel <ivansprundel@ioactive.com>
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com> (M_ZERO)
Reviewed by: jhb, kib
MFC after: 3 days
Security: info leak in root-only ioctl
Sponsored by: The FreeBSD Foundation

6 years agoFix some I/O ordering issues in gmirror.
Mark Johnston [Tue, 2 Jan 2018 18:11:54 +0000 (18:11 +0000)]
Fix some I/O ordering issues in gmirror.

- BIO_FLUSH requests were dispatched to the disks directly from
  g_mirror_start() rather than going through the mirror's I/O request
  queue, so they could have been reordered with preceding writes.
  Address this by processing such requests from the queue, avoiding
  direct dispatch.
- Handling for collisions with synchronization requests was too
  fine-grained and could cause reordering of writes. In particular,
  BIO_ORDERED was not being honoured. Address this by effectively
  freezing the request queue any time a collision with a synchronization
  request occurs. The queue is unfrozen once the collision with the
  first frozen request is over.
- The above-mentioned collision handling allowed reads to jump ahead
  of writes to the same offset. Address this by freezing all request
  types when a collision occurs, not just BIO_WRITEs and BIO_DELETEs.

Also add some more fail points for use in testing error handling.

Reviewed by: imp
MFC after: 3 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13559

6 years agorpcbind: Fix race in signal termination
Conrad Meyer [Tue, 2 Jan 2018 17:25:13 +0000 (17:25 +0000)]
rpcbind: Fix race in signal termination

If a signal was delivered while the main thread was not in poll(2) and after
check was performed, we could reenter poll and never detect termination. Fix
this with the pipefd trick.  (This race was introduced very recently, in
r327482.)

PR: 224503
Reported by: kib
Reviewed by: kib, markj
Sponsored by: Dell EMC Isilon

6 years agoRevert r326844
Baptiste Daroussin [Tue, 2 Jan 2018 16:50:57 +0000 (16:50 +0000)]
Revert r326844

There has been some fallout from the change. The change itself was not valueable
enough to spend time investigating the corner cases, let's just back it out.

Reported by: flo

6 years agoaw_sid: Add man page for this driver
Kyle Evans [Tue, 2 Jan 2018 14:54:54 +0000 (14:54 +0000)]
aw_sid: Add man page for this driver

Reviewed by: manu, bjk (both earlier version), brueffer (manpages)
Differential Revision: https://reviews.freebsd.org/D13720

6 years agoelfcopy: copy raw (untranslated) contents to binary output
Ed Maste [Tue, 2 Jan 2018 14:07:55 +0000 (14:07 +0000)]
elfcopy: copy raw (untranslated) contents to binary output

Previously elfcopy used elf_getdata to obtain data from ELF sections
being copied to binary output, but elf_getdata returns data that has
been translated - that is, data is in host byte order. When the host and
target differ in endianness (e.g., converting a big-endian MIPS ELF
object to binary on an x86 host) this resulted in byte-swapped data in
certain sections such as .dynamic.

Instead use elf_rawdata to keep data in the original, target endianness.

Reported by: Hiroki Mori <yamori83@yahoo.co.jp>, Bill Yuan
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoshutdown: Fix r327476 by adding init
Eitan Adler [Tue, 2 Jan 2018 09:02:42 +0000 (09:02 +0000)]
shutdown: Fix r327476 by adding init

Initialize maybe_today. While here sort.

PR: 32411
Additionally reported by: rgrimes, ian