Commit Graph

7990 Commits

Author SHA1 Message Date
Ed Maste
2b8c81f1b9 lld: Improve LMARegion handling.
This fixes the crash reported at [LLVM] PR36083.

The issue is that we were trying to put all the sections in the same
PT_LOAD and crashing trying to write past the end of the file.

This also adds accounting for used space in LMARegion, without it all
3 PT_LOADs would have the same physical address.

Obtained from:	LLVM r323449 by Rafael Espindola
2018-01-29 13:52:42 +00:00
Ed Maste
5a2ea37829 lld: Simplify. NFC.
Obtained from:	LLVM r323440 by Rafael Espindola
2018-01-29 13:51:13 +00:00
Ed Maste
6fcb8605ef lld: Remove MemRegionOffset. NFC.
We can just use a member variable in MemoryRegion.

Obtained from:	LLVM r323399 by Rafael Espindola
2018-01-29 13:50:28 +00:00
Ed Maste
70bad66509 lld: Only lookup LMARegion once. NFC.
This is similar to how we handle MemRegion.

Obtained from:	LLVM r323396 by Rafael Espindola
2018-01-29 13:49:10 +00:00
Ed Maste
032c24abe6 lld: Use lookup instead of find. NFC, just simpler.
Obtained from:	LLVM r323395 by Rafael Espindola
2018-01-29 13:48:15 +00:00
Pedro F. Giffuni
d54cfbd18e ftp(1): Use closefrom() instead of individual close()s.
Use closefrom(3) instead of manually closing all file descriptors
between 3 and 19.

Obtained from:	OpenBSD (CVS 1.80)
2018-01-29 01:05:57 +00:00
Dimitry Andric
48d95fd235 Pull in r322245 from upstream clang trunk (by Craig Topper):
[X86] Make -mavx512f imply -mfma and -mf16c in the frontend like it
  does in the backend.

  Similarly, make -mno-fma and -mno-f16c imply -mno-avx512f.

  Withou this  "-mno-sse -mavx512f" ends up with avx512f being enabled
  in the frontend but disabled in the backend.

Reported by:	pawel
PR:		225488
2018-01-28 16:10:40 +00:00
Pedro F. Giffuni
a645f2a50a Revert r328492:
"Fix gcc80 -Wsizeof-pointer-memaccess warning."

The warning is bogus: GCC8 only looks at the size of the destination.
We shouldn't be fixing imaginary problems, so perhaps its better to deal
with this later on by disabling such warnings.

Pointed out by:	ed, bde
2018-01-28 03:16:54 +00:00
Pedro F. Giffuni
e28c47b570 Fix gcc80 -Wsizeof-pointer-memaccess warning.
Obtained from:	DragonFlyBSD (git 56267d362d5769c8df07bf26d5e322610e0d24b4)
2018-01-27 22:16:19 +00:00
Michael Tuexen
51eff8efd9 When using SCTP for sending probe packets, use INIT chunks for payloads
larger than or equal to 32 bytes. For smaller probe packets, keep using
SHUTDOWN-ACK chunks, possibly bundled with a PAD chunk.
Packets with INIT chunks more likely pass through firewalls. Therefore,
use them when possible.

MFC after:	1 week
2018-01-27 19:23:42 +00:00
Warner Losh
919cf86c87 Gross hack to omit printing hex floating point when the lua number
type is int64. While lua is setup for the representation, it's not
setup to properly print the numbers as ints. This is the least-gross
way around that, and won't affect the bootloader where we do this.
2018-01-26 17:56:20 +00:00
Warner Losh
18dd077da6 Preserve the original luaconf.h in a convenient place. Clients will
almost certainly need to override this, so reinforce that. If that's
not hte case, clients can always do a #include luaconf.h.dist.
2018-01-26 17:24:25 +00:00
Dimitry Andric
042b1c2ef5 Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r323338).

MFC after:	3 months
X-MFC-With:	r327952
PR:		224669
2018-01-24 22:35:00 +00:00
Martin Matuska
a2a3407c7e MFV r328323,328324:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #893: delete dead ppmd7 alloc callbacks
  PR #904: Fix archive freeing bug in bsdcat
  PR #961: Fix ZIP format names
  PR #962: Don't modify attributes for existing directories
           when ARCHIVE_EXTRACT_NO_OVERWRITE is set
  PR #964: Fix -Werror=implicit-fallthrough= for GCC 7
  PR #970: zip: Allow backslash as path separator

MFC after:	1 week
2018-01-24 14:24:17 +00:00
Philip Paeps
afb91be3c9 Import tzdata 2018c
Changes: https://github.com/eggert/tz/blob/2018c/NEWS

MFC after:	3 days
2018-01-24 06:48:42 +00:00
Ed Maste
da1eeb70d3 lld: Don't mark a shared library as needed because of a lazy symbol.
Obtained from:	LLVM r323221 by Rafael Espíndola
2018-01-23 17:54:39 +00:00
Alan Somers
76f9d2759b mlock(2): correct documentation for error conditions.
The man page is years out of date regarding errors. Our implementation _does_
allow unaligned addresses, and it _does_not_ check for negative lengths,
because the length is unsigned. It checks for overflow instead.

Update the tests accordingly.

Reviewed by:	bcr
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D13826
2018-01-22 21:45:54 +00:00
Andrey V. Elsukov
7e03e18104 Rename "index" variable to "idx" since gcc complains that it shadows
index(3) function declaration.

Reported by:	lwhsu
MFC after:	2 weeks
2018-01-19 20:33:47 +00:00
Andrey V. Elsukov
f3afd27f5f Add to bsnmpd(1) ability to specify multiple community strings with
different access rights.

By default there are two community strings with index 1 and 2, one for
read-only access and second for read-write access:

  begemotSnmpdCommunityString.0.1 = $(read)
  begemotSnmpdCommunityString.0.2 = $(write)

Now it is possible to define additional community strings using different
indexes:

  begemotSnmpdCommunityString.0.3 = "SomeString1"
  begemotSnmpdCommunityPermission.0.3 = 1
  begemotSnmpdCommunityString.0.4 = "SomeString2"
  begemotSnmpdCommunityPermission.0.4 = 2
  begemotSnmpdCommunityString.0.5 = "SomeString3"
  begemotSnmpdCommunityString.0.6 = "SomeString4"

New attribute begemotSnmpdCommunityPermission can be used to specify access
rights: 1 means "read-only" access, 2 means "read-write" access. If
attribute is not specified for some index this means "read-only" rights.

Community strings must be unique, i.e. must not be the same for different
indexes.

Obtained from:		Yandex LLC
MFC after:		2 weeks
Sponsored by:		Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D13785
2018-01-19 08:48:14 +00:00
Dimitry Andric
024469e429 Pull in r322106 from upstream llvm trunk (by Alexey Bataev):
[COST]Fix PR35865: Fix cost model evaluation for shuffle on X86.

  Summary:
  If the vector type is transformed to non-vector single type, the
  compile may crash trying to get vector information about non-vector
  type.

  Reviewers: RKSimon, spatel, mkuper, hfinkel

  Subscribers: llvm-commits

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

This should fix "Not a vector MVT!" errors when building the
games/dhewm3 port.

Reported by:	jbeich
PR:		225271
2018-01-18 21:46:09 +00:00
Dimitry Andric
6bee06efd1 Pull in r322016 from upstream llvm trunk (by Sanjay Patel):
[ValueTracking] remove overzealous assert

  The test is derived from a failing fuzz test:
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5008

  Credit to @rksimon for pointing out the problem.

This should fix "Bad flavor while matching min/max" errors when building
the graphics/libsixel and science/kst2 ports.

Reported by:	jbeich
PR:		225268, 225269
2018-01-18 21:44:07 +00:00
Ed Maste
62de8f4add lld: Fix incorrect physical address on self-referencing AT command.
When a section placement (AT) command references the section itself,
the physical address of the section in the ELF header was calculated
incorrectly due to alignment happening right after the location
pointer's value was captured.

The problem was diagnosed and the first version of the patch written
by Erick Reyes.

Obtained from:	LLVM r322421 by Rafael Espindola
2018-01-18 21:39:59 +00:00
Ed Maste
cc877d7c33 lld: Handle parsing AT(ADDR(.foo-bar)).
The problem we had with it is that anything inside an AT is an
expression, so we failed to parse the section name because of the - in
it.

Requested by:	royger
Obtained from:	LLVM r322801 by Rafael Espindola
2018-01-18 21:39:19 +00:00
Ed Maste
d3f08be7dc lld: Fix for ld.lld does not accept "AT" syntax for declaring LMA region
AT> lma_region expression allows to specify the memory region
for section load address.

Should fix [upstream LLVM] PR35684.

LLVM review: https://reviews.llvm.org/D41397

Obtained from:	LLVM r322359 by George Rimar
2018-01-18 21:38:21 +00:00
Dimitry Andric
d23c4359df Pull in r322623 from upstream llvm trunk (by Andrew V. Tischenko):
Allow usage of X86-prefixes as separate instrs.
  Differential Revision: https://reviews.llvm.org/D42102

This should fix parse errors when x86 prefixes (such as 'lock' and
'rep') are followed by various non-mnemonic tokens, e.g. comments, .byte
directives and labels.

PR:		224669,225054
2018-01-17 17:11:55 +00:00
Philip Paeps
f2fcff28d0 Import tzdata 2018a
Changes: https://github.com/eggert/tz/blob/2018a/NEWS

MFC after:	3 days
2018-01-16 18:36:25 +00:00
Dimitry Andric
a7264ff541 Pull in r322473 from upstream llvm trunk (by Andrei Elovikov):
[LV] Don't call recordVectorLoopValueForInductionCast for
  newly-created IV from a trunc.

  Summary:
  This method is supposed to be called for IVs that have casts in their
  use-def chains that are completely ignored after vectorization under
  PSE. However, for truncates of such IVs the same InductionDescriptor
  is used during creation/widening of both original IV based on PHINode
  and new IV based on TruncInst.

  This leads to unintended second call to
  recordVectorLoopValueForInductionCast with a VectorLoopVal set to the
  newly created IV for a trunc and causes an assert due to attempt to
  store new information for already existing entry in the map. This is
  wrong and should not be done.

  Fixes PR35773.

  Reviewers: dorit, Ayal, mssimpso

  Reviewed By: dorit

  Subscribers: RKSimon, dim, dcaballe, hsaito, llvm-commits, hiraditya

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

This should fix "Vector value already set for part" assertions when
building the net/iodine and sysutils/daa2iso ports.

Reported by:	jbeich
PR:		224867,224868
2018-01-15 18:20:15 +00:00
Dimitry Andric
72bfb31a82 Merge ^/head r327886 through r327930. 2018-01-13 17:52:55 +00:00
Dimitry Andric
55f46b3c87 Pull in r314499 from upstream clang trunk (by Daniel Marjamäki):
[Sema] Suppress warnings for C's zero initializer

  Patch by S. Gilles!

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

Pull in r314838 from upstream clang trunk (by Richard Smith):

  Suppress -Wmissing-braces warning when aggregate-initializing a
  struct with a single field that is itself an aggregate.

  In C++, such initialization of std::array<T, N> types is guaranteed
  to work by the standard, is completely idiomatic, and the "suggested"
  alternative from Clang was technically invalid.

Together, these suppress unneeded "suggest braces around initialization
of subobject" warnings for C++11 initializer lists.

MFC after:	3 days
2018-01-13 17:47:34 +00:00
Ed Maste
982fabe12e Revert r280909 "unwind-d2 build workaround for arm64"
We no longer try to build unwind-dw2.c on arm64 so no need for this
workaround.

Sponsored by:	The FreeBSD Foundation
2018-01-12 20:03:24 +00:00
Dimitry Andric
c79126f2e4 Merge ^/head r327624 through r327885. 2018-01-12 18:23:35 +00:00
Dimitry Andric
782f2e69ab 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
2018-01-12 18:19:14 +00:00
Dimitry Andric
83ae25da0f 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
2018-01-12 18:16:51 +00:00
Dimitry Andric
76401e35e3 Pull in r316581 from upstream llvm trunk (by John Baldwin):
Don't try to use a non-existent header on FreeBSD/mips.

  Reviewers: dim

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

Requested by:	jhb
MFC after:	3 days
2018-01-11 21:12:23 +00:00
Alan Somers
324efdfba2 Add Pull Request to the Subversion commit template
Reviewed by:	emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D13178
2018-01-09 21:02:39 +00:00
Dimitry Andric
66f8bb86f8 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
2018-01-09 17:41:34 +00:00
Dimitry Andric
18a7633888 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.
2018-01-09 17:38:43 +00:00
Dimitry Andric
53743bd4bb 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.
2018-01-09 17:37:09 +00:00
Dimitry Andric
687571a78b 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
2018-01-07 18:33:19 +00:00
Dimitry Andric
30785c0e2b Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_60 r321788,
update build glue and version numbers.
2018-01-06 23:44:14 +00:00
Dimitry Andric
4b49587c3d Merge ^/head r327341 through r327623. 2018-01-06 16:13:17 +00:00
Dimitry Andric
a1ba34d4a7 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.
2018-01-06 13:19:36 +00:00
Ed Maste
aadb68849f 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
2018-01-02 14:07:55 +00:00
Dimitry Andric
4fc74049d2 Merge ^/head r327169 through r327340. 2017-12-29 12:51:26 +00:00
Dimitry Andric
fe4fed2e4d Merge llvm, clang, lld, lldb, compiler-rt and libc++ trunk r321545,
update build glue and version numbers, add new intrinsics headers, and
update OptionalObsoleteFiles.inc.
2017-12-29 00:56:15 +00:00
Ed Maste
7003cfb386 readelf: report byte size for DT_PREINIT_ARRAYSZ
Sponsored by:	The FreeBSD Foundation
2017-12-26 18:10:34 +00:00
Dimitry Andric
a6c6e8627e Merge ^/head r327150 through r327164. 2017-12-24 16:53:55 +00:00
Dimitry Andric
34f4d02c2f Fix clang 6.0.0 compiler warnings in binutils
Latest clang git has a warning -Wnull-pointer-arithmetic which will
trigger a -Werror failure. Addition and subtraction from a null pointer
is undefined behaviour and could be optimized into anything.

Furthermore, using the difference between two pointers and casting the
result back to a pointer is not portable since the size of ptrdiff_t
does not necessary have to be the same as size of void* (this happens
e.g. on CHERI). Using intptr_t instead fixes this portability issue and
the compiler warning.

Submitted by;	Alexander Richardson
Obtained from:	CheriBSD
Differential Revision: https://reviews.freebsd.org/D12928
MFC after:	3 days
2017-12-24 16:51:59 +00:00
Dimitry Andric
0e56f9238c For our lldb customizations, instead of commenting out lines, use #ifdef
LLDB_ENABLE_ALL / #endif preprocess directives instead, so our diffs
against upstream only consist of added lines.
2017-12-24 13:39:32 +00:00
Dimitry Andric
39f349c2ce Merge libc++ trunk r321414 to contrib/libc++. 2017-12-24 01:16:28 +00:00
Dimitry Andric
5d5f867805 Merge compiler-rt trunk r321414 to contrib/compiler-rt. 2017-12-24 01:15:12 +00:00
Dimitry Andric
3863851369 Merge lldb trunk r321414 to contrib/llvm/tools/lldb. 2017-12-24 01:12:46 +00:00
Dimitry Andric
8ca4c80b1b Merge lld trunk r321414 to contrib/llvm/tools/lld. 2017-12-24 01:11:19 +00:00
Dimitry Andric
13ddaa8416 Merge clang trunk r321414 to contrib/llvm. 2017-12-24 01:08:34 +00:00
Dimitry Andric
da09e106ef Merge llvm trunk r321414 to contrib/llvm. 2017-12-24 01:04:58 +00:00
Dimitry Andric
b2c7081bd7 Merge libc++ trunk r321017 to contrib/libc++. 2017-12-20 19:16:11 +00:00
Dimitry Andric
8a51db9c42 Merge compiler-rt trunk r321017 to contrib/compiler-rt. 2017-12-20 19:12:15 +00:00
Dimitry Andric
acac075be8 Merge lldb trunk r321017 to contrib/llvm/tools/lldb. 2017-12-20 18:06:09 +00:00
Dimitry Andric
10dc89a5a7 Merge lld trunk r321017 to contrib/llvm/tools/lld. 2017-12-20 15:50:21 +00:00
Dimitry Andric
9a199699c2 Merge clang trunk r321017 to contrib/llvm/tools/clang. 2017-12-20 14:26:54 +00:00
Dimitry Andric
2cab237b5d Merge llvm trunk r321017 to contrib/llvm. 2017-12-20 14:16:56 +00:00
Ed Maste
a5d5fd9ffd lld: Don't write preemptible symbol values to the .got.
It is not necessary and matches what bfd and gold do.

This was a regression from [LLVM] r315658.

Obtained from:	LLVM r321023 by Rafael Espíndola
2017-12-19 03:15:20 +00:00
Dimitry Andric
5bf0d7ad74 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
2017-12-16 18:06:30 +00:00
Ed Maste
e10e2b23bf 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
2017-12-16 14:26:11 +00:00
Dimitry Andric
e3e18337bf 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
2017-12-15 18:58:21 +00:00
Ed Maste
df1f0f9b90 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
2017-12-15 18:56:12 +00:00
Dimitry Andric
f134051fcf 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
2017-12-13 19:03:48 +00:00
Alan Somers
25b86f88e3 less(1): diff reduction vs upstream
No functional change.

MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-12-12 17:34:35 +00:00
Dimitry Andric
9ce629675f Pull in r320396 from upstream clang trunk (by Malcolm Parsons):
[Sema] Fix crash in unused-lambda-capture warning for VLAs

  Summary:
  Clang was crashing when diagnosing an unused-lambda-capture for a VLA
  because From.getVariable() is null for the capture of a VLA bound.
  Warning about the VLA bound capture is not helpful, so only warn for
  the VLA itself.

  Fixes: PR35555

  Reviewers: aaron.ballman, dim, rsmith

  Reviewed By: aaron.ballman, dim

  Subscribers: cfe-commits

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

This fixes a segfault when building recent audio/zynaddsubfx port
versions.

Reported by:	hps
MFC after:	3 days
2017-12-11 20:04:40 +00:00
Konstantin Belousov
b258727e79 ofed: Define barriers for mips and arm.
I used the strongest barriers available on the architectures, so if
the future analysis show that it is excessive, the barriers could be
relaxed. Still, it is unlikely that it is meaningful to run IB on 32bit
ARM or current MIPS machines, so the change is to make WITH_OFED to pass
tinderbox.

Sponsored by:	Mellanox Technologies
Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D13329
2017-12-11 11:59:45 +00:00
Konstantin Belousov
0521e6e192 ofed: Remove duplicated symbols from the version file.
ld.bfd accepts multiple listing of the same symbol in the version script.
lld is stricter and errors out.  Since arm64 and sometimes amd64 use lld,
we should correct this cosmetic issue.

Sponsored by:	Mellanox Technologies
Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D13329
2017-12-11 11:57:46 +00:00
Michal Meloun
d65a63e3aa Relax too restrictive assert.
The problem has been reported to upstream and similar change will
be included in next jemalloc release.

Submitted by:	David Goldblatt <davidtgoldblatt@gmail.com>
MFC after: 	2 weeks
2017-12-10 09:17:21 +00:00
Michal Meloun
e7dad90fe5 Revert r326740. I committed wrong diff. 2017-12-10 09:15:37 +00:00
Michal Meloun
3ee2fe0199 Relax too restrictive assert.
The problem has been reported to upstream and similar change will
be included in next jemalloc release.

Submitted by:	David Goldblatt <davidtgoldblatt@gmail.com>
MFC after: 	2 weeks
2017-12-10 08:55:48 +00:00
Hans Petter Selasky
656371d7c1 Correctly define the unordered_map namespace in ofed/libibnetdisc .
This should fix ofed/libibnetdisc compilation with C-compilers
different from clang and GCC v4.2.1.

Submitted by:	kib
Sponsored by:	Mellanox Technologies
2017-12-08 21:01:09 +00:00
Baptiste Daroussin
b0b2d05fd0 Split body of mails not respecting RFC2822
For mails which has a body not respecting RFC2822 (which often happen with
crontabs) try to split by words finding the last space before 1000's character

If no spaces are found then consider the mail to be malformed anyway

PR:		208261
2017-12-06 22:08:35 +00:00
Stephen J. Kiernan
b32f189046 The function make_relative_prefix_1 does not properly free locally
allocated memory when it returns early.

Free the memory associated with the variables full_programe, bin_dirs,
prog_dirs, and prefix_dirs when the function returns early.

Submitted by:	Tom Rix <trix@juniper.net>
Reviewed by:	jhibbits, emaste
Approved by:	sjg (mentor)
Obtained from:	Juniper Networks, Inc.
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D9691
2017-12-06 21:18:45 +00:00
Ed Maste
0bff6a5af8 Update tcpdump to 4.9.2
It contains many fixes, including bounds checking, buffer overflows (in
SLIP and bittok2str_internal), buffer over-reads, and infinite loops.

One other notable change:
  Do not use getprotobynumber() for protocol name resolution.
  Do not do any protocol name resolution if -n is specified.

Submitted by:	gordon
Reviewed by:	delphij, emaste, glebius
MFC after:	1 week
Relnotes:	Yes
Security:	CVE-2017-11108, CVE-2017-11541, CVE-2017-11542
Security:	CVE-2017-11543, CVE-2017-12893, CVE-2017-12894
Security:	CVE-2017-12895, CVE-2017-12896, CVE-2017-12897
Security:	CVE-2017-12898, CVE-2017-12899, CVE-2017-12900
Security:	CVE-2017-12901, CVE-2017-12902, CVE-2017-12985
Security:	CVE-2017-12986, CVE-2017-12987, CVE-2017-12988
Security:	CVE-2017-12989, CVE-2017-12990, CVE-2017-12991
Security:	CVE-2017-12992, CVE-2017-12993, CVE-2017-12994
Security:	CVE-2017-12995, CVE-2017-12996, CVE-2017-12997
Security:	CVE-2017-12998, CVE-2017-12999, CVE-2017-13000
Security:	CVE-2017-13001, CVE-2017-13002, CVE-2017-13003
Security:	CVE-2017-13004, CVE-2017-13005, CVE-2017-13006
Security:	CVE-2017-13007, CVE-2017-13008, CVE-2017-13009
Security:	CVE-2017-13010, CVE-2017-13011, CVE-2017-13012
Security:	CVE-2017-13013, CVE-2017-13014, CVE-2017-13015
Security:	CVE-2017-13016, CVE-2017-13017, CVE-2017-13018
Security:	CVE-2017-13019, CVE-2017-13020, CVE-2017-13021
Security:	CVE-2017-13022, CVE-2017-13023, CVE-2017-13024
Security:	CVE-2017-13025, CVE-2017-13026, CVE-2017-13027
Security:	CVE-2017-13028, CVE-2017-13029, CVE-2017-13030
Security:	CVE-2017-13031, CVE-2017-13032, CVE-2017-13033
Security:	CVE-2017-13034, CVE-2017-13035, CVE-2017-13036
Security:	CVE-2017-13037, CVE-2017-13038, CVE-2017-13039
Security:	CVE-2017-13040, CVE-2017-13041, CVE-2017-13042
Security:	CVE-2017-13043, CVE-2017-13044, CVE-2017-13045
Security:	CVE-2017-13046, CVE-2017-13047, CVE-2017-13048
Security:	CVE-2017-13049, CVE-2017-13050, CVE-2017-13051
Security:	CVE-2017-13052, CVE-2017-13053, CVE-2017-13054
Security:	CVE-2017-13055, CVE-2017-13687, CVE-2017-13688
Security:	CVE-2017-13689, CVE-2017-13690, CVE-2017-13725
Differential Revision:	https://reviews.freebsd.org/D12404
2017-12-06 02:21:11 +00:00
Jilles Tjoelker
965f7130a9 mdoc(7): Update .Dd for previous commit 2017-12-05 23:06:15 +00:00
Jilles Tjoelker
6c144446e9 mdocml: Add IEEE Std 1003.1-2008, 2016 edition
Also document IEEE Std 1003.1-2008, 2013 edition in mdoc(7) (as well as the
2016 edition).

Submitted by:	Yuri Pankov
Reviewed by:	bjk
Differential Revision:	https://reviews.freebsd.org/D13349
2017-12-05 23:00:41 +00:00
Warner Losh
c87d5a5826 Since this is contrib code, create an upstreamable version of my
change. Now on FreeBSD and NetBSD if _STANDALONE is defined, we
include the kernel version with alloances for the quirky differences
between the two.

Sponsored by: Netflix
2017-12-05 22:24:20 +00:00
Warner Losh
52634ec581 This isn't NetBSD specific code. Include these for any kernel /
standalone use. Tweak for FreeBSD's quirky limits.h stuff.

Sponsored by: Netflix
2017-12-05 21:38:10 +00:00
Hans Petter Selasky
be28698cf2 Correctly prefix the infiniband include directory for buildworld. This fixes
the OFED buildworld target, WITH_OFED=YES, when the include files are not
already installed locally, but only in the temporary object directory.

Found by:	kib
Sponsored by:	Mellanox Technologies
2017-12-05 08:25:17 +00:00
Ed Maste
a6aca65caf lld: make -v behave similarly to GNU ld.bfd
Previously, lld exited with an error status if the only option given to
the command was -v. GNU linkers gracefully exit in that case. This patch
makes lld behave like GNU.

Note that even with this patch, lld's -v and --version options behave
slightly differently than GNU linkers' counterparts. For example,
if you run ld.bfd -v -v, the version string is printed out twice.
But that is an edge case that I don't think we need to take care of.

Fixes https://bugs.llvm.org/show_bug.cgi?id=31582

Obtained from:	LLVM r319717
MFC after:	1 week
2017-12-05 01:47:41 +00:00
Baptiste Daroussin
2c7292e5b4 Properly name the 2013 edition
Reported by:	ed
2017-12-04 09:58:38 +00:00
Baptiste Daroussin
ec5c474feb Add Posix 2013 référence for manpages
PR:		223930
Reported by:	Mateusz Piotrowski <mpp302@gmail.com>
MFC after:	2 days
2017-12-04 09:48:55 +00:00
Andrey V. Elsukov
49ba44e765 Fix format string warning with enabled DEBUGGING.
MFC after:	1 week
2017-12-04 09:17:28 +00:00
Dimitry Andric
d4419f6fa8 Upgrade our copies of clang, llvm, lldb and libc++ to r319231 from the
upstream release_50 branch.  This corresponds to 5.0.1 rc2.

MFC after:	2 weeks
2017-12-03 12:14:34 +00:00
Warner Losh
8e3e3a7ae8 Import lua 5.3.4 to contrib 2017-11-29 00:46:36 +00:00
Brooks Davis
ff88ef4183 Update vis(3) the latest from NetBSD.
This adds VIS_DQ for compatiblity with OpenBSD.

Correct by an off-by-one error and a read buffer overflow detected using
asan.

MFC after:	1 day
2017-11-28 01:35:28 +00:00
Hans Petter Selasky
8a53e1340f Merge ^/head r326132 through r326161. 2017-11-24 12:13:27 +00:00
Hans Petter Selasky
e833305789 Simplify the build dependencies when building the OFED libraries.
Suggested by:	bdrewery@
Sponsored by:	Mellanox Technologies
2017-11-24 09:01:08 +00:00
Ed Maste
b452493a3d bfd: avoid crash on corrupt binaries
From binutils commits 5a4b0ccc20ba30caef53b01bee2c0aaa5b855339 and
7e1e19887abd24aeb15066b141cdff5541e0ec8e, made available under GPLv2
by Nick Clifton.

PR:		198824
MFC after:	1 week
Security:	CVE-2014-8501
Security:	CVE-2014-8502
2017-11-23 16:04:52 +00:00
Ed Maste
bd036e101c bfd: fix segfault in the ihex parser on malformed ihex file
From binutils commit 0102ea8cec5fc509bba6c91df61b7ce23a799d32, made
available under GPLv2 by Nick Clifton.

PR:		198824
MFC after:	1 week
Security:	CVE-2014-8503
2017-11-23 14:30:41 +00:00
Hans Petter Selasky
82725ba9bf Merge ^/head r325999 through r326131. 2017-11-23 14:28:14 +00:00
Xin LI
b2ea244070 MFV r326007: less v529.
MFC after:	2 weeks
2017-11-20 08:52:33 +00:00
Hans Petter Selasky
d39ec9aea1 There is no need to depend on libthr.
Suggested by:	bdrewery@
Sponsored by:	Mellanox Technologies
2017-11-19 12:29:50 +00:00
Hans Petter Selasky
0b12d33c3c Fix compilation of libibnetdisc using in-base GCC v4.2.1.
Sponsored by:	Mellanox Technologies
2017-11-17 15:23:42 +00:00
Hans Petter Selasky
7093892ca0 Fix compilation for libsysdecode.
Don't install the ib_user_mad.h header file into user-space,
because it conflicts with umad.h from libibumad.h when building
libsysdecode.

Sponsored by:	Mellanox Technologies
2017-11-16 15:18:36 +00:00
Hans Petter Selasky
f04e941e25 Remove conflicting uint definition.
Already defined by sys/types.h

Sponsored by:	Mellanox Technologies
2017-11-16 15:16:53 +00:00
Hans Petter Selasky
55b1c6e7e4 Merge ^/head r325663 through r325841. 2017-11-15 11:28:11 +00:00
Warner Losh
0c16b53773 Move zstd from contrib to sys/contrib so it can be used in the
kernel. Adjust the Makefiles that referenced it to the new path.

Sponsored by: Netflix
OK'd by: cem@ and AllanJude@
2017-11-14 05:03:38 +00:00
Hans Petter Selasky
e110d0774b Fix OFED library dependencies.
Sponsored by:	Mellanox Technologies
2017-11-13 12:36:36 +00:00
Hans Petter Selasky
d388615314 Remove no longer needed TESTBUILD defines from OFED Makefiles.
Sponsored by:	Mellanox Technologies
2017-11-13 11:36:22 +00:00
Baptiste Daroussin
1abf619a8a Update to zstd 1.3.2 2017-11-11 13:54:37 +00:00
Baptiste Daroussin
653667f9dc import zstd 1.3.2 2017-11-09 15:38:02 +00:00
Navdeep Parhar
5c2bacde58 Update the iw_cxgbe bits in the projects branch.
Submitted by:	Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
2017-11-07 23:52:14 +00:00
Hans Petter Selasky
c2c014f24c Merge ^/head r323559 through r325504. 2017-11-07 08:39:14 +00:00
Ed Maste
cdf46f9946 lld: accept EINVAL to indicate posix_fallocate is unsupported
As of r325320 posix_fallocate on a ZFS filesystem returns EINVAL to
indicate that the operation is not supported. (I think this is a strange
choice of errno on the part of POSIX.)

PR:		223383, 223440
Reported by:	Mark Millard
Tested by:	Mark Millard
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-11-05 00:51:53 +00:00
Simon J. Gerraty
e22fef7dc1 Update to bmake-20171028
Ignore empty MAKEOBJDIR[PREFIX]

Reported by:	bdrewery
2017-11-02 20:08:00 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Philip Paeps
8d7edd1726 Import tzdata 2017c
Changes: https://mm.icann.org/pipermail/tz-announce/2017-October/000047.html

MFC after:	2 days
2017-10-28 18:54:45 +00:00
Ed Maste
8448a47dcb dma: fix use-after-free
Sponsored by:	The FreeBSD Foundation
2017-10-27 20:21:09 +00:00
Dimitry Andric
cc718496a9 After jemalloc was updated to version 5.0.0 in r319971, i386 executables
linked with AddressSanitizer (even those linked on earlier versions of
FreeBSD, or with external versions of clang) started failing with errors
similar to:

  ==14688==AddressSanitizer CHECK failed:
  /usr/src/contrib/compiler-rt/lib/asan/asan_poisoning.cc:36
  "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)

This is because AddressSanitizer expects all the TLS data in the program
to be aligned to at least 8 bytes.

Before the jemalloc 5.0.0 update, all the TLS data in the i386 version
of libc.so added up to 80 bytes (a multiple of 8), but 5.0.0 made this
grow to 2404 bytes (not a multiple of 8).  This is due to added caching
data in jemalloc's internal struct tsd_s.

To fix AddressSanitizer, ensure this struct is aligned to at least 16
bytes, which can be done unconditionally for all architectures.  (An
earlier version of the fix aligned the struct to 8 bytes, but only for
ILP32 architectures.  This was deemed unnecessarily complicated.)

PR:		221337
X-MFC-With:	r319971
2017-10-23 21:31:04 +00:00
Dimitry Andric
738eacb46b Pull in r316035 from upstream llvm trunk (by Tim Northover):
AArch64: account for possible frame index operand in compares.

  If the address of a local is used in a comparison, AArch64 can fold
  the address-calculation into the comparison via "adds".
  Unfortunately, a couple of places (both hit in this one test) are not
  ready to deal with that yet and just assume the first source operand
  is a register.

This should fix an assertion failure while building the test suite of
www/firefox for AArch64.

PR:		223048
MFC after:	3 days
2017-10-21 19:14:45 +00:00
Gordon Tetlow
a2063804a2 Update wpa_supplicant/hostapd for 2017-01 vulnerability release.
hostapd: Avoid key reinstallation in FT handshake
Prevent reinstallation of an already in-use group key
Extend protection of GTK/IGTK reinstallation of WNM-Sleep Mode cases
Fix TK configuration to the driver in EAPOL-Key 3/4 retry case
Prevent installation of an all-zero TK
Fix PTK rekeying to generate a new ANonce
TDLS: Reject TPK-TK reconfiguration
WNM: Ignore Key Data in WNM Sleep Mode Response frame if no PMF in use
WNM: Ignore WNM-Sleep Mode Response if WNM-Sleep Mode has not been used
WNM: Ignore WNM-Sleep Mode Response without pending request
FT: Do not allow multiple Reassociation Response frames
TDLS: Ignore incoming TDLS Setup Response retries

Submitted by:	jhb
Obtained from:	https://w1.fi/security/2017-01/ (against later version)
Security:	FreeBSD-SA-17:07
Security:	CERT VU#228519
Security:	CVE-2017-13077
Security:	CVE-2017-13078
Security:	CVE-2017-13079
Security:	CVE-2017-13080
Security:	CVE-2017-13081
Security:	CVE-2017-13082
Security:	CVE-2017-13086
Security:	CVE-2017-13087
Security:	CVE-2017-13088
Differential Revision:	https://reviews.freebsd.org/D12693
2017-10-17 17:22:36 +00:00
Ed Maste
2be6126d2a libunwind: use upstream patch to disable executable stacks
arm uses '@' as a comment character, and cannot use @progbits in the
.section directive. Apply the upstream noexec stach change which avoids
this issue.

Obtained from:	LLVM r277868
2017-10-11 19:26:39 +00:00
Justin Hibbits
7a174c3469 Do exception offset computations in 64 bits, not 32.
This fixes clang-built binaries on a gcc powerpc64 world.  Gets us one step
closer to a clang-built world.  The same change was made in later upstream
binutils.

Submitted by:	rdivacky
MFC after:	2 weeks
2017-10-11 02:39:20 +00:00
Baptiste Daroussin
1e515e9434 Import mandoc 1.14.3
MFC after:	1 week
2017-10-06 12:31:55 +00:00
Baptiste Daroussin
8194a60137 Revert r324358, some cruft when in with it, it will be
properly reimported in another commit
2017-10-06 12:30:54 +00:00
Baptiste Daroussin
dcfb9248ec Import 1.14.3
MFC after:	1 week
2017-10-06 11:48:09 +00:00
Mariusz Zaborski
b01988a5f5 Partially revert r323866.
Using HAVE_* is a internal tcpdump style standard.
We want to be consistent with the standard to upstream those changes in
the future.

Requested by: glebius@
2017-10-04 21:05:44 +00:00
Martin Matuska
5c831a5bd6 MFV r324145,324147:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #905: Support for Zstandard read and write filters
  PR #922: Avoid overflow when reading corrupt cpio archive
  Issue #935: heap-based buffer overflow in xml_data (CVE-2017-14166)
  OSS-Fuzz 2936: Place a limit on the mtree line length
  OSS-Fuzz 2394: Ensure that the ZIP AES extension header is large enough
  OSS-Fuzz 573: Read off-by-one error in RAR archives (CVE-2017-14502)

MFC after:	1 week
Security:	CVE-2017-14166, CVE-2017-14502
2017-10-01 00:40:23 +00:00
Martin Matuska
533ab3c53e Update vendor/libarchive to git 92366744a52f3fa83c3899e375e415a5080a05f2
Relevant vendor changes:
  PR #905: Support for Zstandard read and write filters
  PR #922: Avoid overflow when reading corrupt cpio archive
  Issue #935: heap-based buffer overflow in xml_data (CVE-2017-14166)
  OSS-Fuzz 2936: Place a limit on the mtree line length
  OSS-Fuzz 2394: Ensure that the ZIP AES extension header is large enough
  OSS-Fuzz 573: Read off-by-one error in RAR archives (CVE-2017-14502)

Security: CVE-2017-14166, CVE-2017-14502
2017-09-30 23:33:19 +00:00
Ian Lepore
996a93432a Fix the return value from _Unwind_Backtrace() on arm.
If unwinding stops due to hitting the end of the call chain, the return
value is supposed to be _URC_END_OF_STACK; other values indicate internal
errors.  The return value from get_eit_entry() is now returned without
translating it to _URC_FAILURE, so that callers can see _URC_END_OF_STACK
when it happens.
2017-09-25 23:50:10 +00:00
Ian Lepore
237d41f89e Fix handling of uncaught exceptions in a std::terminate() handler on arm.
When raising an exception, the unwinder searches for a catch handler and if
none is found it should invoke std::terminate() with the uncaught exception
as the "current" exception.  Before this change, the terminate handler was
invoked with no exception as current (abi::__cxa_current_exception_type()
returned NULL), because the return value from the unwinder indicated an
internal failure in unwinding.  It turns out that was because all errors
from get_eit_entry() were translated to _URC_FAILURE.  Now the error is
returned untranslated, which allows _URC_END_OF_STACK to percolate upwards
to throw_exception() in libcxxrt.  When it sees that return status it
properly calls std::terminate() with the uncaught exception installed
as the current exception, allowing custom terminate handlers to work
with it.
2017-09-25 23:24:41 +00:00
Warner Losh
d12420d872 Don't display empty error context.
Context extraction didn't handle this case and showed uninitialized memory.

Obtained from: OpenBSD lib.c 1.21
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12379
2017-09-24 05:04:06 +00:00
Warner Losh
8e537f8ae0 Fix %c for floating values that become 0 when coerced to int.
Obtained from: OpenBSD run.c 1.36 (From Jeremy Devenport)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12379
2017-09-24 05:04:02 +00:00
Warner Losh
547f34cace Fix uninitialized variable
echo | awk 'BEGIN {i=$1; print i}' prints a boatload of stack
garbage. NUL terminate the memory returned from malloc to prevent it.

Obtained from: OpenBSD run.c 1.40
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12379
2017-09-24 05:03:57 +00:00
Mariusz Zaborski
2560d18180 We use a few different ifdef's names to check if we are using Casper or not,
let's standardize this. Now we are always use WITH_CASPER name.

Discussed with:	emaste@
MFC after:	1 month
2017-09-21 14:41:41 +00:00
Gordon Tetlow
40427cca7a MFV r323678: file 5.32
Approved by:	emaste (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D12400
2017-09-17 19:14:38 +00:00
John Baldwin
9fb35c8d7b Add missing newline after unknown MIPS-specific dynamic entries.
Reviewed by:	emaste
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D12384
2017-09-15 22:56:39 +00:00
John Baldwin
369bd05bc6 Recognize NT_PTLWPINFO and NT_ARM_VFP in FreeBSD ELF cores.
Reviewed by:	emaste
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D12371
2017-09-14 16:41:24 +00:00
Warner Losh
73f7ff91b2 Implement gawk multiple-arg extension to and, or, and xor.
gawk allows multiple arguemnts to bit-wiste and, or and xor
functions. Implement an arbitrary number of arguments for these
functions. Also, use NULL in preference to 0 to match rest of file.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12361
2017-09-14 05:48:23 +00:00
Warner Losh
69679fc10f Bring in bit operation functions, ala gawk.
These are from OpenBSD:
>>> Extend awk with bitwise operations. This is an extension to the awk
>>> spec and documented as such, but comes in handy from time to time.
>>> The prototypes make it compatible with a similar GNU awk extension.
>>>
>>> ok millert@, enthusiasm from deraadt@

Edited to fix cut and paste in error messages, as well as
using tabs instead of spaces after #defines added.

Obtained From: OpenBSD awk.h 1.12, lex.c 1.10, run.c 1.29
Differential Revision: https://reviews.freebsd.org/D12361
Sponsored by: Netflix
2017-09-14 05:47:55 +00:00
Navdeep Parhar
b754c27916 MFH @ r323558. 2017-09-13 19:12:28 +00:00
Marius Strobl
f47cbbee8a MFV: r323381
Permit a deflateParams() parameter change as soon as possible.

This change fixes compression errors seen when the embedded Tomcat
web server of a UniFi Controller zlib compresses responses. Given
that Tomcat just uses Java/OpenJDK which in turn employs zlib for
its compression/decompression support, this bug might very well
affect other applications, too.

PR:	222136
2017-09-10 01:25:15 +00:00
Gordon Tetlow
367cf59651 Fix an incorrectly used conditional causing a stack buffer overflow.
Reported by:	Thomas Jarosch of Intra2net AG
Reviewed by:	emaste, jhb
Security:	CVE-2017-1000249
2017-09-07 18:54:54 +00:00
Dimitry Andric
c891abb2ae Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
5.0.0 release (upstream r312559).

Release notes for llvm, clang and lld will be available here soon:
<http://releases.llvm.org/5.0.0/docs/ReleaseNotes.html>
<http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html>
<http://releases.llvm.org/5.0.0/tools/lld/docs/ReleaseNotes.html>

Relnotes:	yes
MFC after:	1 month
X-MFC-with:	r321369
2017-09-06 21:21:13 +00:00
Ryan Libby
1a11bb8f76 gnu binutils: FSGSBASE assembly/disassembly
Enable the in-tree binutils to assemble and disassemble amd64 FSGSBASE
instructions (rdfsbase, rdgsbase, wrfsbase, wrgsbase), used in the base
system since r322763.

This gives one last gasp for in-tree gcc, and provides a small
enhancement for in-tree binutils objdump.

Reviewed by:	dim, kib
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12222
2017-09-05 19:04:07 +00:00
Dimitry Andric
3ea909cc76 Upgrade our copies of clang, llvm, lldb and compiler-rt to r312293 from
the upstream release_50 branch.  This corresponds to 5.0.0 rc4.

As of this version, the cad/stepcode port should now compile in a more
reasonable time on i386 (see bug 221836 for more information).

PR:		221836
MFC after:	2 months
X-MFC-with:	r321369
2017-09-01 18:53:36 +00:00
Dag-Erling Smørgrav
e8a699bb6e Merge upstream r4302 to support multiple concurrently valid anchors.
If an unpatched unbound-anchor is run without a preexisting root anchor
between 2017-09-11 and 2017-10-11, it will fail and Unbound will not be
able to start unless the validator is disabled.  An EN will be issued
with patches for existing systems and information on how to work around
the issue on new installations.
2017-08-31 12:02:14 +00:00
Andrew Turner
8657387683 Work around a bug in QEMU when loading data with a load pair instruction
where the source register is also the first destination register.

If this is the case, and we raise an exception in the middle of the
instruction, for example the load is across two pages and the second page
isn't mapped, QEMU will have overwritten the address with invalid data.

This is a valid behaviour in most cases, with the exception of when a
destination register is also use in address generation. As such switch
the order of the registers to ensure the address register is second so it
will be written to second, after any exceptions have happened.

This has been acknowledged in upstream QEMU, however as the workaround is
simple also handle it here.

Sponsored by:	DARPA, AFRL
2017-08-26 15:08:27 +00:00
John Baldwin
a9f6545f43 Extend the workaround for LLVM bug 11663 to MIPS N32.
This fixes infinite recursion in /sbin/init for MIPS N32.

Submitted by:	Robert M. Kovacsics <rmk35@cam.ac.uk>
MFC after:	1 week
Sponsored by:	DARPA / AFRL
2017-08-26 00:17:57 +00:00
Dimitry Andric
0fa4377182 Upgrade our copies of clang, llvm, lldb and compiler-rt to r311606 from
the upstream release_50 branch.

As of this version, lib/msun's trig test should also work correctly
again (see bug 220989 for more information).

PR:		220989
MFC after:	2 months
X-MFC-with:	r321369
2017-08-24 20:19:27 +00:00
Kyle Evans
c552f48b6f bsdgrep: add some additional tests for fgrep
Previously added tests only check that fgrep is somewhat sane and works. Add
some more tests that check that the implementation is basically functional
and not producing incorrect results with various flags.

Reviewed by:	cem, emaste, ngie
Approved by:	emaste (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D12056
2017-08-24 01:20:52 +00:00
Ed Maste
726e8d8884 top: use __mips__ and __NetBSD__ for consistency
r322767 fixed the mips64 build failure with Clang with a minimal change
to use __FreeBSD__ instead of FreeBSD in a #if test.  For consistency
and to facilitate possible upstreaming change the other macros in the
test to their canonical form.

Discussed with:	jhb
2017-08-23 17:56:55 +00:00
Baptiste Daroussin
e6a4cfc37b Import zstandard 1.3.1 2017-08-22 11:11:49 +00:00
John Baldwin
8cf606a4d6 Fix FreeBSD-presence macro to fix the build on mips with clang.
GCC doesn't define 'mips' which is why it doesn't trip over this.

Sponsored by:	DARPA / AFRL
2017-08-21 17:52:09 +00:00
Hans Petter Selasky
1409e715e6 Merge ^/head r322398 through r322746. 2017-08-21 11:56:47 +00:00