Commit Graph

7911 Commits

Author SHA1 Message Date
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