Commit Graph

8587 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
366b94c4a9 Vendor import of Unbound 1.9.2. 2019-06-30 15:01:11 +00:00
Dag-Erling Smørgrav
4713c21a1a Vendor import of Unbound 1.9.1. 2019-06-30 14:56:56 +00:00
Xin LI
b7780dbe98 MFV r349535: less v551.
MFC after:	2 weeks
Relnotes:	yes
2019-06-29 18:41:40 +00:00
Martin Matuska
74e515127c MFV r349454:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1217: RAR5 reader - fix ARM filter going beyond window buffer boundary
            (OSS-Fuzz 15431)
  PR #1218: Fixes to sparse file handling

MFC after:	1 week
2019-06-28 22:41:17 +00:00
Leandro Lupori
857e20a273 [PowerPC64] readelf: print description for 'e_flags' in ELF header (ABI type)
This prints out description text with the meaning of 'Flags' value in PowerPC64.

Example:

$ readelf -h ~/tmp/t1-Flag2
ELF Header:

Magic:   7f 45 4c 46 02 02 01 09 00 00 00 00 00 00 00 00
Class:                             ELF64
Data:                              2's complement, big endian
Version:                           1 (current)
OS/ABI:                            FreeBSD
ABI Version:                       0
Type:                              EXEC (Executable file)
Machine:                           PowerPC 64-bit
Version:                           0x1
Entry point address:               0x10010000
Start of program headers:          64 (bytes into file)
Start of section headers:          209368 (bytes into file)
Flags:                             0x2, OpenPOWER ELF V2 ABI
Size of this header:               64 (bytes)
Size of program headers:           56 (bytes)
Number of program headers:         10
Size of section headers:           64 (bytes)
Number of section headers:         34
Section header string table index: 31

Submitted by:	 alfredo.junior_eldorado.org.br
Reviewed by:	luporl
Differential Revision:	https://reviews.freebsd.org/D20782
2019-06-28 16:00:55 +00:00
Leandro Lupori
c4e127e24d [PowerPC64] Add ABI flags to 'file' magic
The distinction between ELF header version and OpenPOWER ELF ABI version is
confusing for most of people, so this adds text to "file" output to make it
clear about which OpenPOWER ELF ABI version binary was built for.

The strings used in this change are based on "64-Bit ELF V2 ABI
Specification/3.1. ELF Header" document available at
http://openpowerfoundation.org/wp-content/uploads/resources/leabi/content/dbdoclet.50655241_97607.html

Example:

$ file t1-Flag2 -m -m contrib/file/magic/Magdir/elf t1-Flag2: ELF 64-bit MSB
executable, 64-bit PowerPC or cisco 7500, OpenPOWER ELF V2 ABI, version 1
(FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD
13.0 (1300033), FreeBSD-style, not stripped

Submitted by:	alfredo.junior_eldorado.org.br
Reviewed by:	luporl
Differential Revision:	https://reviews.freebsd.org/D20771
2019-06-28 15:52:40 +00:00
Xin LI
b88cc53d4d Upgrade to Bzip2 version 1.0.7.
MFC after:	3 days
2019-06-28 05:11:02 +00:00
Cy Schubert
9aa0318d3c Fix a typo.
PR:		238816
MFC after:	1 week
X-MFC with:	r349503
2019-06-28 04:52:24 +00:00
Cy Schubert
76af5effde Document the -B, binary logfile, and the -C config file options.
Reference the ipmon.5 man page and ipmon.conf.

PR:		238816
MFC after:	1 week
2019-06-28 04:28:32 +00:00
Mitchell Horne
e16ea34016 libelftc: add RISC-V bfd targets
This adds the following targets: elf32-riscv, elf64-riscv, elf64-riscv-freebsd

Reviewed by:	emaste, markj, jkoshy@users.sourceforge.net
Approved by:	markj (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D20768
2019-06-28 00:14:12 +00:00
Mitchell Horne
b00841809e readelf: Add support for RISC-V specific e_flags
Reviewed by:	markj
Approved by:	markj (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D20767
2019-06-28 00:10:26 +00:00
Cy Schubert
358e680a67 Return a return code scripts might expect. I missed this while
reviewing and rewriting a patch in PR/238816.

PR:		238816
Reported by:	rgrimes@
Pointy hat to:	cy@
MFC after:	1 week
X-MFC with:	r349450
2019-06-27 03:50:13 +00:00
Cy Schubert
accc4633db Update usage() to refect the current state of ipmon.
PR:		238816
MFC after:	1 week
2019-06-27 02:43:30 +00:00
Cy Schubert
797a7db05a Fix a typo.
PR/238816 initially addressed updates to usage() however it has now
become a shopping list of fixes to ipmon man pages and usage().

PR:		238816
MFC after:	3 days
2019-06-27 02:42:56 +00:00
Mark Johnston
ab69795fcd libdwarf: Use the cached strtab pointer when reading string attributes.
Previously we would perform a linear search of the DWARF section
list for ".debug_str".  However, libdwarf always caches a pointer to
the strtab image in its debug descriptor.  Using it gives a modest
performance improvement when iterating over the attributes of each
DIE.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20759
2019-06-26 16:38:30 +00:00
Mark Johnston
c8b057f4a7 elfcopy: Provide a size hint when creating the section string table.
Use the input file's .shstrtab size as the hint if it exists.  This
gives a small performance improvement when processing files with
many sections.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20544
2019-06-26 16:35:37 +00:00
Mark Johnston
9810827a3a libelftc: Fix the documented prototype for elftc_string_table_destroy().
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-06-26 16:32:41 +00:00
Mark Johnston
b90eaf941f libelftc: Consistently use size_t for string table offsets and sizes.
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20702
2019-06-26 16:31:50 +00:00
Mark Johnston
70b0aff9a1 libelftc: Micro-optimize string table insertion.
The string's length is already known, so use memcpy() instead of
strcpy() to add it to the string table image.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20760
2019-06-26 16:30:14 +00:00
Justin Hibbits
e861dab451 powerpc: Transition to Secure-PLT, like most other OSs (Toolchain part)
Summary:
Toolchain follow-up to r349350.  LLVM patches will be submitted upstream for
9.0 as well.

The bsd.cpu.mk change is required because GNU ld assumes BSS-PLT if it
cannot determine for certain that it needs Secure-PLT, and some binaries do
not compile in such a way to make it know to use Secure-PLT.

Reviewed By: nwhitehorn, bdragon, pfg
Differential Revision: https://reviews.freebsd.org/D20598
2019-06-25 02:35:22 +00:00
Justin Hibbits
f62da49b2f powerpc: Transition to Secure-PLT, like most other OSs
Summary:
PowerPC has two PLT models: BSS-PLT and Secure-PLT.  BSS-PLT uses runtime
code generation to generate the PLT stubs.  Secure-PLT was introduced with
GCC 4.1 and Binutils 2.17 (base has GCC 4.2.1 and Binutils 2.17), and is a
more secure PLT format, using a read-only linkage table, with the dynamic
linker populating a non-executable index table.

This is the libc, rtld, and kernel support only.  The toolchain and build
parts will be updated separately.

Reviewed By: nwhitehorn, bdragon, pfg
Differential Revision: https://reviews.freebsd.org/D20598
MFC after:	1 month
2019-06-25 00:40:44 +00:00
Michael Tuexen
592bbe54d9 The variable names in the description of the port number usage is
inconsistent. This patch fixes that and improves the precision of
the description.
Thanks to Tom Marcoen for reporting the issue and providing an
initial patch, on which this change is based.

PR:			237723
Reviewed by:		bcr@
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D20708
2019-06-20 12:38:41 +00:00
Martin Matuska
7d8ec1b79d MFV r349134:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1212: RAR5 reader - window_mask was not updated correctly
            (OSS-Fuzz 15278)
  OSS-Fuzz 15120: RAR reader - extend use after free bugfix

MFC after:	1 week (together with r348993)
2019-06-17 11:46:37 +00:00
Dimitry Andric
efc5c4420a Upgrade our copies of clang, llvm, lld, lldb, compiler-rt, libc++,
libunwind and openmp to the upstream release_80 branch r363030
(effectively, 8.0.1 rc2).  The 8.0.1 release should follow this within a
week or so.

MFC after:	2 weeks
2019-06-12 21:10:37 +00:00
Martin Matuska
fae5c36e4c MFV r348971,r348977:
Sync libarchive with vendor.

Relevant vendor changes:
  - check_symlinks_fsobj() without chdir() and fchdir()
  - bsdtar.1 manpage fixes
  - patches from OpenBSD to libarchive_fe/passphrase.c
  - version bumped to 3.4.0

MFC after:	2 weeks
2019-06-12 13:34:12 +00:00
Martin Matuska
e3586989c2 Update vendor/libarchive/dist to git 614110e76d9dbb9ed3e159a71cbd75fa3b23efe3
Relevant vendor changes (release 3.4.0):
  - check_symlinks_fsobj() without chdir() and fchdir()
  - bsdtar.1 manpage fixes
  - patches from OpenBSD to libarchive_fe/passphrase.c
2019-06-11 23:16:13 +00:00
Christian S.J. Peron
ca3075599a Teach readelf about some OpenBSD ELF program headers
- Add constants for OpenBSD wxneeded, bootdata and randomize to the
  FreeBSD elf_common.h file. This is the file that gets used by the
  elftoolchain library.
- Update readelf and elfdump utilities to decode these program headers
  if they are encountered.

Note: FreeBSD has it's own version of elfdump(1), which will be updated
in a subsequent commit. I am adding it here anyway because this diff is
going to be submitted upstream.

Discussed with:	emaste
Reviewed by:	imp
MFC afer:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D20548

M    contrib/elftoolchain/elfdump/elfdump.c
M    contrib/elftoolchain/readelf/readelf.c
M    sys/sys/elf_common.h
2019-06-07 14:51:55 +00:00
Mark Johnston
bc589b723e elfcopy: Use libelftc's string table routines to build .shstrtab.
This replaces some hand-rolled routines and is substantially faster
since libelftc uses a hash table for lookups and insertions, whereas
elfcopy would perform a linear scan of the table.

PR:		234949
Reviewed by:	emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20473
2019-06-04 18:34:05 +00:00
Mark Johnston
0d951ba85c libelftc: Fix some minor style bugs.
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20472
2019-06-04 18:31:08 +00:00
Mark Johnston
dc2282fc8b elfcopy: Use elf_getscn() instead of iterating over all sections.
When removing a section, we would loop over all sections looking for
a corresponding relocation section.  With r348652 it is much faster
to just use elf_getscn().

PR:		234949
Reviewed by:	emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20471
2019-06-04 18:29:08 +00:00
Mark Johnston
8c953901bf libelf: Use a red-black tree to manage the section list.
The tree is indexed by section number.  This speeds up elf_getscn()
and its callers, which previously had to traverse a linked list. In
particular, since .shstrtab is often the last section in a file,
elf_strptr() would have to traverse the entire list.

PR:		234949
Reviewed by:	emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20443
2019-06-04 18:26:29 +00:00
Warner Losh
d9e8cf281b Another partial revert of r301289.
In this case, a change was made in one-true-awk from *FS to
getsval(fsloc) in a line just after one of the lines that had the 0 ->
NULL change. It works both ways as far as I can tell.  It looks like a
bug fix, but I've not tried to track down which ancient version of
one-true-awk it was in (github starts too late for tracking this
down). Before and after the changes the regression suite is passes
100% relative to the un-modified one-true-awk.
2019-06-03 05:25:22 +00:00
Warner Losh
31d232c2a3 Fix mismerge that crept into r301289.
The conversion of 0 -> NULL required a rebase at some point, as noted
in r301289 when pfg commited it. In that rebase, three lines remained
that had been removed in a prior version of awk, and one of them had a
0 -> NULL change causing a conflict. The conflict should have been
resolved by removing the three lines, but wasn't. This introduces a
regression into f.split3 test which prior to this commit we were
failing, but a pure onetrueawk wasn't. Remove the offending 3 lines.
2019-06-03 05:25:16 +00:00
Warner Losh
adb46ac4c0 Revert r348518
It should not have happened. The change is actually in upstream and I misread the diffs.
2019-06-02 20:52:21 +00:00
Warner Losh
2675e1b91d Reapply r301691:
Revert r301689 - one-true-awk: Avoid a NULL dereference.

I got this wrong and the coverity report doesn't match the NetBSD change,
which was thought for a different version.

The change wouldn't hurt but let's wait until upstream figures this out.
2019-06-02 20:47:15 +00:00
Warner Losh
06d1e65393 Reapply r315426 by pfg:
|    MFV r315425: one-true-awk: have calloc(3) do the multiplication.
2019-06-02 16:30:53 +00:00
Warner Losh
10ce5b990f Reapply r301289 by pfg:
|    MFV r300961: one-true-awk: replace 0 with NULL for pointers
|    Also remove a redundant semicolon.
|    Also had to rebase on upstream pull.
2019-06-02 16:28:20 +00:00
Warner Losh
b525355729 Merge from upstream at 4189ef5d from https://github.com/onetrueawk/awk.git
Note: this backs out a number of changes we've made to awk because
they aren't upstream, but are on the vendor branch. Those will be
reapplied. svn makes it needlessly difficult to know which ones, but
at least r315426, r301289, and maybe r301691, though there may be
others too. None of these are critical, so bisecting through this
point is safe for all but awk regression tests :).
2019-06-02 16:25:07 +00:00
Mark Johnston
718699be16 readelf: Make -t imply -S, for compatibility with GNU binutils.
Reported by:	jhb
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20475
2019-05-30 18:54:34 +00:00
Mark Johnston
0281687075 elfcopy: Optimize for insertions at the end of the section list.
This is the common case when strip(1) is creating the output file.
The change provides a significant speedup when running on ELF files with
many sections.

PR:		234949
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20444
2019-05-30 15:28:48 +00:00
Mark Johnston
5405b282e1 elfcopy: Remove an unneeded memset.
Reviewed by:	emaste, trasz
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20445
2019-05-30 15:26:39 +00:00
Justin Hibbits
d9a48fc632 Add missing powerpc64 relocation support to libdwarf
Summary:
Due to missing relocation support in libdwarf for powerpc64, handling of dwarf
info on unlinked objects was bogus.

Examining raw dwarf data on objects compiled on ppc64 with a modern compiler
(in-tree gcc tends to hide the issue, since it only rarely generates relocations
in .debug_info and uses DW_FORM_str instead of DW_FORM_strp for everything), you
will find that the dwarf data appears corrupt, with repeated references to the
compiler version where things like types and function names should appear.

This happens because the 0 offset of .debug_str contains the compiler version,
and without applying the relocations, *all* indirect strings in .dwarf_info will
end up pointing to it.

This corruption then propogates to the CTF data, as ctfconvert relies on
libdwarf to read the dwarf info, for every compiled object (when building a
kernel.)

However, if you examine the dwarf data on a compiled executable, it will appear
correct, because during final link the relocations get applied and baked in by
the linker.

Submitted by:	Brandon Bergren
Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D20367
2019-05-29 02:02:56 +00:00
Dimitry Andric
0b30b98f26 Pull in r361696 from upstream llvm trunk (by Sanjay Patel):
[SelectionDAG] soften assertion when legalizing narrow vector FP ops

  The test based on PR42010:
  https://bugs.llvm.org/show_bug.cgi?id=42010

  ...may show an inaccuracy for PPC's target defs, but we should not be
  so aggressive with an assert here. There's no telling what
  out-of-tree targets look like.

This fixes an assertion when building the graphics/mesa-dri port for
PowerPC64.

Reported by:	Mark Millard <marklmi26-fbsd@yahoo.com>
PR:		238082
MFC after:	3 days
2019-05-26 15:44:58 +00:00
Martin Matuska
52c2bb7516 MFV r347989:
Sync libarchive with vendor.

Relevant vendor changes:
  Issue #795: XAR - do not try to add xattrs without an allocated name
  PR #812: non-recursive option for extract and list
  PR #958: support reading metadata from compressed files
  PR #999: add --exclude-vcs option to bsdtar
  Issue #1062: treat empty archives with a GNU volume header as valid
  PR #1074: Handle ZIP files with trailing 0s in the extra fields
            (Android APK archives)
  PR #1109: Ignore padding in Zip extra field data (Android APK archives)
  PR #1167: fix problems related to unreadable directories
  Issue #1168: fix handling of strtol() and strtoul()
  PR #1172: RAR5 - fix invalid window buffer read in E8E9 filter
  PR #1174: ZIP reader - fix of MSZIP signature parsing
  PR #1175: gzip filter - fix reading files larger than 4GB from memory
  PR #1177: gzip filter - fix memory leak with repeated header reads
  PR #1180: ZIP reader - add support for Info-ZIP Unicode Path Extra Field
  PR #1181: RAR5 - fix merge_block() recursion
            (OSS-Fuzz 12999, 13029, 13144, 13478, 13490)
  PR #1183: fix memory leak when decompressing ZIP files with LZMA
  PR #1184: fix RAR5 OSS-Fuzz issues 12466, 14490, 14491, 12817
    OSS-Fuzz 12466: RAR5 - fix buffer overflow when parsing huffman tables
    OSS-Fuzz 14490, 14491: RAR5 - fix bad shift-left operations
    OSS-Fuzz 12817: RAR5 - handle a case with truncated huffman tables
  PR #1186: RAR5 - fix invalid type used for dictionary size mask
            (OSS-Fuzz 14537)
  PR #1187: RAR5 - fix integer overflow (OSS-Fuzz 14555)
  PR #1190: RAR5 - RAR5 don't try to unpack entries marked as directories
            (OSS-Fuzz 14574)
  PR #1196: RAR5 - fix a potential SIGSEGV on 32-bit builds
  OSS-Fuzz 2582: RAR - fix use after free if there is an invalid entry
  OSS-Fuzz 14331: RAR5 - fix maximum owner name length
  OSS-Fuzz 13965: RAR5 - use unsigned int for volume number + range check

  Additional RAR5 reader changes:
    - support symlinks, hardlinks, file owner, file group, versioned files
    - change ARCHIVE_FORMAT_RAR_V5 to 0x100000
    - set correct mode for readonly directories
    - support readonly, hidden and system Windows file attributes

MFC after:	2 weeks
2019-05-20 12:57:39 +00:00
Martin Matuska
8e97bbedae Update vendor/libarchive/dist to git b5818e39e128eca4951e2ab10467d4d850a2ba57
Relevant vendor changes:
Issue #795: XAR - do not try to add xattrs without an allocated name
PR #812: non-recursive option for extract and list
PR #958: support reading metadata from compressed files
PR #999: add --exclude-vcs option to bsdtar
Issue #1062: treat empty archives with a GNU volume header as valid
PR #1074: Handle ZIP files with trailing 0s in the extra fields
          (Android APK archives)
PR #1109: Ignore padding in Zip extra field data (Android APK archives)
PR #1167: fix problems related to unreadable directories
Issue #1168: fix handling of strtol() and strtoul()
PR #1172: RAR5 - fix invalid window buffer read in E8E9 filter
PR #1174: ZIP reader - fix of MSZIP signature parsing
PR #1175: gzip filter - fix reading files larger than 4GB from memory
PR #1177: gzip filter - fix memory leak with repeated header reads
PR #1180: ZIP reader - add support for Info-ZIP Unicode Path Extra Field
PR #1181: RAR5 - fix merge_block() recursion
          (OSS-Fuzz 12999, 13029, 13144, 13478, 13490)
PR #1183: fix memory leak when decompressing ZIP files with LZMA
PR #1184: fix RAR5 OSS-Fuzz issues 12466, 14490, 14491, 12817
  OSS-Fuzz 12466: RAR5 - fix buffer overflow when parsing huffman tables
  OSS-Fuzz 14490, 14491: RAR5 - fix bad shift-left operations
  OSS-Fuzz 12817: RAR5 - handle a case with truncated huffman tables
PR #1186: RAR5 - fix invalid type used for dictionary size mask
          (OSS-Fuzz 14537)
PR #1187: RAR5 - fix integer overflow (OSS-Fuzz 14555)
PR #1190: RAR5 - RAR5 don't try to unpack entries marked as directories
          (OSS-Fuzz 14574)
PR #1196: RAR5 - fix a potential SIGSEGV on 32-bit builds
OSS-Fuzz 2582: RAR - fix use after free if there is an invalid entry
OSS-Fuzz 14331: RAR5 - fix maximum owner name length
OSS-Fuzz 13965: RAR5 - use unsigned int for volume number + range check

Additional RAR5 reader changes:
  - support symlinks, hardlinks, file owner, file group, versioned files
  - change ARCHIVE_FORMAT_RAR_V5 to 0x100000
  - set correct mode for readonly directories
  - support readonly, hidden and system Windows file attributes

NOTE: a version bump of libarchive will happen in the following days
2019-05-20 12:32:00 +00:00
Cy Schubert
e1c50020af The driver list prints "(null)" for the NDIS driver when -h (help) or
an unknown switch is passed outputting the command usage. This is
because the NDIS driver is uninitialized when usage help is printed.
To resolve this we initialize the driver prior to the possibility of
printing the usage help message.

Obtained from:	The wpa_supplicant port
MFC after:	1 week
2019-05-16 02:41:25 +00:00
Mark Johnston
54a3a11421 Provide separate accounting for user-wired pages.
Historically we have not distinguished between kernel wirings and user
wirings for accounting purposes.  User wirings (via mlock(2)) were
subject to a global limit on the number of wired pages, so if large
swaths of physical memory were wired by the kernel, as happens with
the ZFS ARC among other things, the limit could be exceeded, causing
user wirings to fail.

The change adds a new counter, v_user_wire_count, which counts the
number of virtual pages wired by user processes via mlock(2) and
mlockall(2).  Only user-wired pages are subject to the system-wide
limit which helps provide some safety against deadlocks.  In
particular, while sources of kernel wirings typically support some
backpressure mechanism, there is no way to reclaim user-wired pages
shorting of killing the wiring process.  The limit is exported as
vm.max_user_wired, renamed from vm.max_wired, and changed from u_int
to u_long.

The choice to count virtual user-wired pages rather than physical
pages was done for simplicity.  There are mechanisms that can cause
user-wired mappings to be destroyed while maintaining a wiring of
the backing physical page; these make it difficult to accurately
track user wirings at the physical page layer.

The change also closes some holes which allowed user wirings to succeed
even when they would cause the system limit to be exceeded.  For
instance, mmap() may now fail with ENOMEM in a process that has called
mlockall(MCL_FUTURE) if the new mapping would cause the user wiring
limit to be exceeded.

Note that bhyve -S is subject to the user wiring limit, which defaults
to 1/3 of physical RAM.  Users that wish to exceed the limit must tune
vm.max_user_wired.

Reviewed by:	kib, ngie (mlock() test changes)
Tested by:	pho (earlier version)
MFC after:	45 days
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D19908
2019-05-13 16:38:48 +00:00
Li-Wen Hsu
b056a52947 Fix expected output after r347207
While phil is working on fixing in libxo general test parts, updating these
files to stop the test failure warnings

Approved by:	phil
MFC with:	r347207
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20188
2019-05-08 18:46:12 +00:00
Hans Petter Selasky
13a2290c66 Add ConnectX-6 DX HCA ID to libmlx5.
In addition, add "ConnectX family mlx5Gen Virtual Function" device ID.
Every new HCA VF will be identified with this device ID.

Submitted by:	slavash@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-05-08 11:04:09 +00:00
Hans Petter Selasky
daceb33617 Add support for 200Gbit speeds to libibverbs.
Submitted by:	slavash@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-05-08 10:56:22 +00:00
Xin LI
c9083b850a Move contrib/zlib to sys/contrib/zlib so that we can use it in kernel.
This is a prerequisite of unifying kernel zlib instances.

Submitted by:	Yoshihiro Ota <ota at j.email.ne.jp>
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D20191
2019-05-08 08:43:15 +00:00
Dimitry Andric
6889af8687 Pull in r360099 from upstream llvm trunk (by Eli Friedman):
[ARM] Glue register copies to tail calls.

  This generally follows what other targets do. I don't completely
  understand why the special case for tail calls existed in the first
  place; even when the code was committed in r105413, call lowering
  didn't work in the way described in the comments.

  Stack protector lowering breaks if the register copies are not glued
  to a tail call: we have to insert the stack protector check before
  the tail call, and we choose the location based on the assumption
  that all physical register dependencies of a tail call are adjacent
  to the tail call. (See FindSplitPointForStackProtector.) This is sort
  of fragile, but I don't see any reason to break that assumption.

  I'm guessing nobody has seen this before just because it's hard to
  convince the scheduler to actually schedule the code in a way that
  breaks; even without the glue, the only computation that could
  actually be scheduled after the register copies is the computation of
  the call address, and the scheduler usually prefers to schedule that
  before the copies anyway.

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

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

This should fix several instances of "Bad machine code: Using an
undefined physical register", when compiling ports such as
multimedia/vlc, audio/alsa-lib and devel/avro-c for armv6, with
-fstack-protector-strong.

Reported by:	jbeich
PR:		237074, 237783, 237784
MFC after:	3 days
2019-05-08 05:45:00 +00:00
Phil Shafer
5e203a9ddb Import libxo-1.0.4:
- Avoid NULL deref in xo_xml_leader_len (replacing local fix in rS345967)
- update copyright dates
- update test cases
- fix uncommitted version change

Submitted by:	phil
MFC after:	2 weeks
2019-05-06 20:20:21 +00:00
Cy Schubert
02273ca832 MFV r347136:
Update sqlite3-3.27.2 (3270200) --> sqlite3-3.28.0 (3280000)

MFC after:	3 days
Security:	CVE-2019-9937, CVE-2019-9936
2019-05-05 04:14:17 +00:00
Cy Schubert
4bc523382c MFV r346563:
Update wpa_supplicant/hostapd 2.7 --> 2.8

Upstream documents the following advisories:

- https://w1.fi/security/2019-1/sae-side-channel-attacks.txt
- https://w1.fi/security/2019-2/eap-pwd-side-channel-attack.txt
- https://w1.fi/security/2019-3/sae-confirm-missing-state-validation.txt
- https://w1.fi/security/2019-4/eap-pwd-missing-commit-validation.txt
- https://w1.fi/security/2019-5/eap-pwd-message-reassembly-issue-\
  with-unexpected-fragment.txt

Relnotes:	yes
MFC after:	1 week (or less)
Security:	CVE-2019-9494, VU#871675, CVE-2019-9495, CVE-2019-9496,
		CVE-2019-9497, CVE-2019-9498, CVE-2019-9499
2019-04-23 03:52:43 +00:00
Cy Schubert
de2a04f2e2 MFV r346450:
Update sqlite3-3.27.1 (3270100) --> sqlite3-3.27.2 (3270200)

MFC after:	11 days
2019-04-20 23:18:19 +00:00
Ed Maste
cb12a6901a readelf: use size_t for object counts
PR:		212539
Reported by:	cem
Sponsored by:	The FreeBSD Foundation
2019-04-17 17:50:44 +00:00
Ed Maste
9817bae932 readelf: speed up readelf -wo
Use an array instead of STAILQ, and sort at the end instead of while
adding new elements.

PR:		212539
Submitted by:	Bora Özarslan <borako.ozarslan@gmail.com>
Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2019-04-17 17:00:16 +00:00
Ed Maste
d76eef3430 cap_fileargs: chase r346315, update fileargs_init in consumers
Reported by:	ci.freebsd.org (8 times so far)
MFC after:	3 weeks
MFC with:	r346315
Sponsored by:	The FreeBSD Foundation
2019-04-17 16:18:14 +00:00
Mariusz Zaborski
42668853c0 tcpdump: disable Capsicum if -E option is provided.
The -E is used to provide a secret for decrypting IPsec.
The secret may be provided through command line or as the file.
The problem is that tcpdump doesn't support yet opening files in capability mode
and the file may contain a list of the files to open.

As a workaround, for now, let's just disable capsicum if the -E
the option is provided.

PR:		236819
MFC after:	2 weeks
2019-04-16 04:12:41 +00:00
Baptiste Daroussin
7295610f5d Update mandoc to 1.14.5
MFC after:	2 weeks
2019-04-12 10:13:17 +00:00
Cy Schubert
bca4681bf8 MFV r345988:
Update sqlite3-3.26.0 (3260000) --> sqlite3-3.27.1 (3270100)

MFC after:	2 weeks
2019-04-06 23:35:23 +00:00
Phil Shafer
c703b76e38 Emergency fix for NULL deref in xo_xml_leader_len 2019-04-05 19:42:54 +00:00
Mariusz Zaborski
6d395deba1 strings: capsicumize it
Reviewed by:	cem
Discussed with: emaste
Differential Revision:	https://reviews.freebsd.org/D18038
2019-04-04 16:32:27 +00:00
Phil Shafer
406a584d7e Import libxo-1.0.2
from 1.0.0:
    Add "continuation" flag, to allow multiple "xo" invocations in a single line of output (#58)
    Add --top-wrap to make top-level JSON wrappers
    Add --{open,close}-{list,instace} options
    Add xo_xml_leader(), to detect use of some bogus XML tags. It's still bad form, but it's a little safer now
    Avoid call to xo_write before xo_flush, since the latter calls the former
    Check return code from xo_flush_h properly (<0) (FreeBSD Bug 236935)
    For JSON output, avoid newline before a container's close brace (#62)
    Merge branch 'text_only' of https://github.com/zvr/libxo into zvr-text_only
    Use XO_USE_INT_RETURN_CODES, not USE_INT_RETURN_CODES
    add docs for --continuation
    add docs for --not-first
    call xo_state_set_flags before values and close containers; add XOIF_MADE_OUTPUT flag to track state; make proper empty JSON objects in xo_finish
    color_map code has to be #ifdef'd out, since the struct definition
    correct xo_flush_func_t (doesn't use xo_ssize_t)
    make depth change for --top-wrap only for JSON
    fix to handle --top-wrap in "xo" by being more consistent with handling trailing newlines
    fix to handle text-only version #64 (from zvr)
    fix xo_buf_has_room for round up to the next XO_BUFSIZ, not just add XO_BUFSIZ to the size (FreeBSD Bug 236937)
    update docs for new "xo" options
    update functions to use xo_ssize_t
    update test cases
from 1.0.1:
    Add EINTEGRITY to .pot files under test/gettext/ (fix from FreeBSD)
from 1.0.2:
    handle failure from xo_vnsprintf; don't add -1 to "rc"

PR:		236937, 236935
Submitted by:	phil
Reported by:	Alfonso S. Siciliano <alfix86@gmail.com>
MFC after:	2 weeks
2019-04-03 21:55:39 +00:00
Andrey V. Elsukov
48e091f99d Follow the declared behaviour that specifies server string format in
bsnmpclient(3).

snmp_parse_server() function accepts string where some fields can be
omitted: [trans::][community@][server][:port]

"trans" field can be "udp", "udp6", "dgram" and "stream".
"community" can be empty string, if it is omitted, the default value
will be used. For read_community it is "public", for write_comminity
it is "private". "server" field can be hostname, IPv4 address or IPv6
address. IPv6 address should be specified in brackets "[]".
If port is omitted, the default value "snmp" will be used for "udp"
and "udp6" transports. So, now for bsnmpget(1) and bsnmwalk(1) it is
not required to specify all fields in argument of '-s' option. E.g.

  # bsnmpget -s 127.1 sysName.0
  # bsnmpget -s "udp::127.1" sysName.0
  # bsnmpget -s "udp::public@127.1" sysName.0
  # bsnmpget -s "udp::public@127.1:161" sysName.0
  # bsnmpget -s "udp::[::1]" sysName.0
  # bsnmpget -s "udp6::[::1]" sysName.0
  # bsnmpget -s "[fe80::1%lo0]" sysName.0

PR:		236664
Reported by:	olivier
MFC after:	1 month
2019-04-03 12:47:49 +00:00
Dimitry Andric
d705ee60a2 Pull in r357362 from upstream clang trunk (by David Chisnall):
[objc-gnustep] Use .init_array not .ctors when requested.

  This doesn't make a difference most of the time but FreeBSD/ARM
  doesn't run anything in the .ctors array.

This should help with updating the libobjc2 port for armv7.

Requested by:	theraven
Upstream PR:	https://github.com/gnustep/libobjc2/issues/83
MFC after:	3 days
2019-04-02 17:51:28 +00:00
Andrey V. Elsukov
8581fc9ad5 Create 64bit mibII counters for all interfaces.
PR:		157015
Obtained from:	Yandex LLC
MFC after:	1 month
2019-04-02 13:38:00 +00:00
Andrey V. Elsukov
04d1781439 Add IPv6 transport for bsnmp.
This patch adds a new table begemotSnmpdTransInetTable that uses the
InetAddressType textual convention and can be used to create listening
ports for IPv4, IPv6, zoned IPv6 and based on DNS names. It also supports
future extension beyond UDP by adding a protocol identifier to the table
index. In order to support this gensnmptree had to be modified.

Submitted by:   harti
MFC after:      1 month
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D16654
2019-04-02 12:50:01 +00:00
Enji Cooper
8ac5aef8f3 Integrate capsicum-test into the FreeBSD test suite
This change takes capsicum-test from upstream and applies some local changes to make the
tests work on FreeBSD when executed via Kyua.

The local modifications are as follows:
1. Make `OpenatTest.WithFlag` pass with the new dot-dot lookup behavior in FreeBSD 12.x+.
2. capsicum-test references a set of helper binaries: `mini-me`, `mini-me.noexec`, and
   `mini-me.setuid`, as part of the execve/fexecve tests, via execve, fexecve, and open.
   It achieves this upstream by assuming `mini-me*` is in the current directory, however,
   in order for Kyua to execute `capsicum-test`, it needs to provide a full path to
   `mini-me*`. In order to achieve this, I made `capsicum-test` cache the executable's
   path from argv[0] in main(..) and use the cached value to compute the path to
   `mini-me*` as part of the execve/fexecve testcases.
3. The capsicum-test test suite assumes that it's always being run on CAPABILITIES enabled
   kernels. However, there's a chance that the test will be run on a host without a
   CAPABILITIES enabled kernel, so we must check for the support before running the tests.
   The way to achieve this is to add the relevant `feature_present("security_capabilities")`
   check to SetupEnvironment::SetUp() and skip the tests when the support is not available.
   While here, add a check for `kern.trap_enotcap` being enabled. As noted by markj@ in
   https://github.com/google/capsicum-test/issues/23, this sysctl being enabled can trigger
   non-deterministic failures. Therefore, the tests should be skipped if this sysctl is
   enabled.

All local changes have been submitted to the capsicum-test project
(https://github.com/google/capsicum-test) and are in various stages of review.
Please see the following pull requests for more details:
1. https://github.com/google/capsicum-test/pull/35
2. https://github.com/google/capsicum-test/pull/41
3. https://github.com/google/capsicum-test/pull/42

Reviewed by:	asomers
Discussed with:	emaste, markj
Approved by:	emaste (mentor)
MFC after:	2 months
Differential Revision: https://reviews.freebsd.org/D19758
2019-04-01 21:24:50 +00:00
Enji Cooper
e9e2022e74 Import proof-of-concept for handling GTEST_SKIP() in Environment::SetUp
Per the upstream pull-request [1]:

```
  gtest prior to this change would completely ignore `GTEST_SKIP()` if
  called in `Environment::SetUp()`, instead of bailing out early, unlike
  `Test::SetUp()`, which would cause the tests themselves to be skipped.
  The only way (prior to this change) to skip the tests would be to
  trigger a fatal error via `GTEST_FAIL()`.

  Desirable behavior, in this case, when dealing with
  `Environment::SetUp()` is to check for prerequisites on a system
  (example, kernel supports a particular featureset, e.g., capsicum), and
  skip the tests. The alternatives prior to this change would be
  undesirable:

  - Failing sends the wrong message to the test user, as the result of the
    tests is indeterminate, not failed.
  - Having to add per-test class abstractions that override `SetUp()` to
    test for the capsicum feature set, then skip all of the tests in their
    respective SetUp fixtures, would be a lot of human and computational
    work; checking for the feature would need to be done for all of the
    tests, instead of once for all of the tests.

  For those reasons, making `Environment::SetUp()` handle `GTEST_SKIP()`,
  by not executing the testcases, is the most desirable solution.

  In order to properly diagnose what happened when running the tests if
  they are skipped, print out the diagnostics in an ad hoc manner.

  Update the documentation to note this change and integrate a new test,
  gtest_skip_in_environment_setup_test, into the test suite.

  This change addresses #2189.

  Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
```

The goal with my merging in this change is to avoid requiring extensive
refactoring/retesting of test suites when ensuring prerequisites are met,
e.g., checking for a CAPABILITIES-enabled kernel before running capsicum-test
(see D19758 for more details).

The proof-of-concept is being imported before accepted by the upstream
project due to the fact that the upstream project is undergoing a potential
development freeze and the maintainers aren't responding to my PR.

1. https://github.com/google/googletest/pull/2203

Reported by:	asomers (https://github.com/google/googletest/issues/2189)
Reviewed by:	asomers
Approved by:	emaste (mentor)
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D19765
2019-04-01 18:07:48 +00:00
Andrey V. Elsukov
e95923a228 Correct a port number assignment.
PR:		236930
MFC after:	1 week
2019-04-01 12:14:45 +00:00
Ed Maste
77f552e221 readelf: add newline after dumping dynamic FLAGS / FLAGS_1
All three dump_flags() callers need a newline after printing the flags.

Sponsored by:	The FreeBSD Foundation
2019-03-28 17:30:47 +00:00
Ed Maste
0fd1597549 Revert other accidentally committed part of r345625 2019-03-28 13:27:34 +00:00
Ed Maste
09b47fc1c2 revert r341429 "disable BIND_NOW in libc, libthr, and rtld"
r345620 by kib@ fixed the rtld issue that caused a crash at startup
during resolution of libc's ifuncs with BIND_NOW.

PR:		233333
Sponsored by:	The FreeBSD Foundation
2019-03-28 02:12:32 +00:00
Mark Johnston
1fc6236006 Prepend DW_AT_comp_dir to relative line number directory table entries.
Relative directories may appear in the line number program for a CPU if
files were included via a relative path, for instance with "-I.".
Previously, dwarf_srclines(3) and dwarf_srcfiles(3) would return the
relative path, so addr2line, for instance, would do the same.  However,
we can get an absolute path by prepending the compilation directory, so
change libdwarf to do that to improve compatibility with GNU binutils
and since it is more useful in general.

Reviewed by:	jhb
Discussed with:	emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19705
2019-03-27 19:32:21 +00:00
Philip Paeps
ad48359a65 Import tzdata 2019a
Changes: https://github.com/eggert/tz/blob/2019a/NEWS

MFC after:	3 days
2019-03-26 08:10:51 +00:00
Kyle Evans
79483833d0 MFV r345515: netbsd-tests: import memory bump for libc/regex/t_exhaust
MFC after:	3 days
2019-03-26 02:21:09 +00:00
Martin Matuska
df422cb404 MFV r345495:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1153: fixed 2 bugs in ZIP reader [1]
  PR #1143: ensure archive_read_disk_entry_from_file() uses ARCHIVE_READ_DISK
  Changes to file flags code, support more file flags on FreeBSD:
    UF_OFFLINE, UF_READONLY, UF_SPARSE, UF_REPARSE, UF_SYSTEM
    UF_ARCHIVE is not supported by intention (yet)

PR:		236300
MFC after:	2 weeks
2019-03-25 11:49:57 +00:00
Dimitry Andric
94e9dcf224 Pull in r356809 from upstream llvm trunk (by Eli Friedman):
[ARM] Don't form "ands" when it isn't scheduled correctly.

  In r322972/r323136, the iteration here was changed to catch cases at
  the beginning of a basic block... but we accidentally deleted an
  important safety check.  Restore that check to the way it was.

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

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

This should fix "Assertion failed: (LiveCPSR && "CPSR liveness tracking
is wrong!"), function UpdateCPSRUse" errors when building the devel/xwpe
port for armv7.

PR:		236062, 236568
MFC after:	1 month
X-MFC-With:	r344779
2019-03-23 14:10:05 +00:00
Mariusz Zaborski
55d3f888de strings: return an error code and the char value separately
If we returning 32 bits value it's hard to distinguish if the returned value
is a valid one or if its an error (in case of EOF). For that reason separate
exit code of the function from the returned character.

Reported by:	cem, se
2019-03-23 02:17:07 +00:00
Mariusz Zaborski
1194c3cb57 In case of ENCODING_8BIT the EOF code will be pass to putchar.
EOF check should be done before (uint8_t)c > 127 test.

Reported by:	cem
2019-03-21 06:31:14 +00:00
Mariusz Zaborski
cee114a82f Fix powerpc and arm builds after r345361.
Reported by:	jenkins
2019-03-21 06:20:33 +00:00
Mariusz Zaborski
4cb07cba1b strings: do not continue if getc or getcharacter returns EOF
Reported by:	cem
2019-03-21 05:24:44 +00:00
Mariusz Zaborski
61d994f1cd strings: do not depend on stdin
Instead of depending on one stdin FILE structure and use freopen(3), pass to
the functions appropriate FILE structure.

Reviewed by:	cem
Discussed with:	emaste
Differential Revision:	https://reviews.freebsd.org/D18037
2019-03-21 05:00:24 +00:00
Alan Somers
bda54b8f96 googletest: backport GTEST_SKIP to googletest 1.8.1
This commit backports revisions 00938b2b228f3b70d3d9e51f29a1505bdad43f1e and
59f90a338bce2376b540ee239cf4e269bf6d68ad from googletest's master branch to
our included version of googletest, which is based on 1.8.1. It adds the
GTEST_SKIP feature, which is very useful for a project like FreeBSD where
some tests depend on particular system configurations.

Reviewed by:	ngie
Obtained from:	github.com/google/googletest
MFC after:	2 months
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/rS345331
2019-03-20 23:15:58 +00:00
Dimitry Andric
c3e6b9d390 Pull in r352826 from upstream lld trunk (by Fangrui Song):
[ELF] Support --{,no-}allow-shlib-undefined

  Summary:
  In ld.bfd/gold, --no-allow-shlib-undefined is the default when
  linking an executable. This patch implements a check to error on
  undefined symbols in a shared object, if all of its DT_NEEDED entries
  are seen.

  Our approach resembles the one used in gold, achieves a good balance
  to be useful but not too smart (ld.bfd traces all DSOs and emulates
  the behavior of a dynamic linker to catch more cases).

  The error is issued based on the symbol table, different from
  undefined reference errors issued for relocations. It is most
  effective when there are DSOs that were not linked with -z defs (e.g.
  when static sanitizers runtime is used).

  gold has a comment that some system libraries on GNU/Linux may have
  spurious undefined references and thus system libraries should be
  excluded (https://sourceware.org/bugzilla/show_bug.cgi?id=6811). The
  story may have changed now but we make --allow-shlib-undefined the
  default for now. Its interaction with -shared can be discussed in the
  future.

  Reviewers: ruiu, grimar, pcc, espindola

  Reviewed By: ruiu

  Subscribers: joerg, emaste, arichardson, llvm-commits

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

Pull in r352943 from upstream lld trunk (by Fangrui Song):

  [ELF] Default to --no-allow-shlib-undefined for executables

  Summary:
  This follows the ld.bfd/gold behavior.

  The error check is useful as it captures a common type of ld.so
  undefined symbol errors as link-time errors:

      // a.cc => a.so (not linked with -z defs)
      void f(); // f is undefined
      void g() { f(); }

      // b.cc => executable with a DT_NEEDED entry on a.so
      void g();
      int main() { g(); }

      // ld.so errors when g() is executed (lazy binding) or when the program is started (-z now)
      // symbol lookup error: ... undefined symbol: f

  Reviewers: ruiu, grimar, pcc, espindola

  Reviewed By: ruiu

  Subscribers: llvm-commits, emaste, arichardson

  Tags: #llvm

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

Together, these add support for --no-allow-shlib-undefined, and make it
the default for executables, so they will fail to link if any symbols
from needed shared libraries are undefined.

Reported by:	jbeich
PR:		236062, 236141
MFC after:	1 month
X-MFC-With:	r344779
2019-03-20 20:57:11 +00:00
Dimitry Andric
fb7e42b9fd Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
8.0.0 final release r356365.  There were no functional changes since the
most recent merge, of 8.0.0 rc5.

Release notes for llvm, clang, lld and libc++ 8.0.0 are now available:

https://llvm.org/releases/8.0.0/docs/ReleaseNotes.html
https://llvm.org/releases/8.0.0/tools/clang/docs/ReleaseNotes.html
https://llvm.org/releases/8.0.0/tools/lld/docs/ReleaseNotes.html
https://llvm.org/releases/8.0.0/projects/libcxx/docs/ReleaseNotes.html

PR:		236062
MFC after:	1 month
X-MFC-With:	r344779
2019-03-20 19:18:26 +00:00
Alan Somers
da1a9eb08c googletest: backport GTEST_SKIP to googletest 1.8.1
This commit backports revisions 00938b2b228f3b70d3d9e51f29a1505bdad43f1e and
59f90a338bce2376b540ee239cf4e269bf6d68ad from googletest's master branch to
our included version of googletest, which is based on 1.8.1.  It adds the
GTEST_SKIP feature, which is very useful for a project like FreeBSD where
some tests depend on particular system configurations.

Obtained from:	github.com/google/googletest
Sponsored by:	The FreeBSD Foundation
2019-03-20 17:11:25 +00:00
Dimitry Andric
eccf47f57a Enable building libomp.so for 32-bit x86. This is done by selectively
enabling the functions that save and restore MXCSR, since access to this
register requires SSE support.

Note that you may run into other issues with OpenMP on i386, since this
*not* yet supported upstream, and certainly not extensively tested.

PR:		236062, 236582
MFC after:	1 month
X-MFC-With:	r344779
2019-03-18 21:04:28 +00:00
Kurt Lidl
ff92380399 Fixup syslog() call that should have used logging function pointer
PR:		236614
Submitted by:	Helge Oldach <freebsd@oldach.net>
2019-03-18 15:45:06 +00:00
Dimitry Andric
4f7e044e54 Add openmp __kmp_gettid() wrapper, using pthread_getthreadid_np(3).
This has also been submitted upstream.

PR:           236062
MFC after:    1 month
X-MFC-With:   r344779
2019-03-16 13:45:14 +00:00
Dimitry Andric
cc471ead66 Merge openmp release_80 branch r356034 (effectively, 8.0.0 rc5).
PR:		236062
MFC after:	1 month
X-MFC-With:	r344779
2019-03-16 13:43:07 +00:00
Dimitry Andric
b603a4c616 Add LLVM openmp trunk r351319 (just before the release_80 branch point)
to contrib/llvm.  This is not yet connected to the build, the glue for
that will come in a follow-up commit.

PR:		236062
MFC after:	1 month
X-MFC-With:	r344779
2019-03-16 13:40:27 +00:00
Enji Cooper
5193fcde8d Initial googlemock/googletest integration into the build/FreeBSD test suite
This initial integration takes googlemock/googletest release 1.8.1, integrates
the library, tests, and sample unit tests into the build.

googlemock/googletest's inclusion is optionally available via `MK_GOOGLETEST`.
`MK_GOOGLETEST` is dependent on `MK_TESTS` and is enabled by default when
built with a C++11 capable toolchain.

Google tests can be specified via the `GTESTS` variable, which, in comparison
with the other test drivers, is more simplified/streamlined, as Googletest only
supports C++ tests; not raw C or shell tests (C tests can be written in C++
using the standard embedding methods).

No dependent libraries are assumed for the tests. One must specify `gmock`,
`gmock_main`, `gtest`, or `gtest_main`, via `LIBADD` for the program.

More information about googlemock and googletest can be found on the
Googletest [project page](https://github.com/google/googletest), and the
[GoogleMock](https://github.com/google/googletest/blob/v1.8.x/googlemock/docs/Documentation.md)
and
[GoogleTest](https://github.com/google/googletest/tree/v1.8.x/googletest/docs)
docs.

These tests are originally integrated into the build as plain driver tests, but
will be natively integrated into Kyua in a later version.

Known issues/Errata:
* [WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD](https://github.com/google/googletest/issues/2172)

Reviewed by:	asomers
Approved by:	emaste (mentor)
MFC after:	2 months
Differential Revision: https://reviews.freebsd.org/D19551
2019-03-15 21:43:52 +00:00
Dimitry Andric
2352f97079 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, and lldb
release_80 branch r356034 (effectively, 8.0.0 rc5), resolve conflicts,
and bump version numbers.

PR:		236062
MFC after:	1 month
X-MFC-With:	r344779
2019-03-14 19:52:12 +00:00
Dimitry Andric
4cc79e8968 Revert r308867 (which was originally committed in the clang390-import
project branch):

  Work around LLVM PR30879, which is about a bad interaction between
  X86 Call Frame Optimization on i386 and libunwind, by disallowing the
  optimization for i386-freebsd12.

  This should fix some instances of broken exception handling when
  frame pointers are omitted, in particular some unittests run during
  the build of editors/libreoffice.

  This hack will be removed as soon as upstream has implemented a more
  permanent fix for this problem.

And indeed, after r345018 and r345019, which updated LLVM libunwind to
the most recent version, the above workaround is no longer needed.  The
upstream commit which fixed this is:

  https://llvm.org/viewvc/llvm-project?view=revision&revision=292723

Specifically, 32 bit (i386-freebsd) executables optimized with omitted
frame pointers and Call Frame Optimization should now behave correctly
when a C++ exception is thrown, and the stack is unwound.

Upstream PR:	https://llvm.org/bugs/show_bug.cgi?id=30879
PR:		236062
MFC after:	1 month
X-MFC-With:	r344779
2019-03-12 18:19:44 +00:00
John Baldwin
c8a048a4a3 Move libunwind out of contrib/llvm/projects.
Move LLVM's libunwind to its own contrib/ directory similar to other
runtime libraries like libc++ and libcxxrt.

Reviewed by:	dim, emaste
Differential Revision:	https://reviews.freebsd.org/D19534
2019-03-12 16:41:17 +00:00
Enji Cooper
eb1761b004 MFhead@r345025 2019-03-11 21:00:58 +00:00
Dimitry Andric
e6ec44cf36 Pull in r355854 from upstream llvm trunk (by Jonas Paulsson):
[RegAlloc]  Avoid compile time regression with multiple copy hints.

  As a fix for https://bugs.llvm.org/show_bug.cgi?id=40986 ("excessive
  compile time building opencollada"), this patch makes sure that no
  phys reg is hinted more than once from getRegAllocationHints().

  This handles the case were many virtual registers are assigned to the
  same physreg. The previous compile time fix (r343686) in
  weightCalcHelper() only made sure that physical/virtual registers are
  passed no more than once to addRegAllocationHint().

  Review: Dimitry Andric, Quentin Colombet
  https://reviews.llvm.org/D59201

This should fix a hang when compiling certain generated .cpp files in
the graphics/opencollada port.

PR:		236313
MFC after:	1 month
X-MFC-With:	r344779
2019-03-11 19:15:57 +00:00
Dimitry Andric
66c4b4f1ce Merge LLVM libunwind release_80 branch r355677 (effectively, 8.0.0 rc4).
PR:		236062
MFC after:	1 month
X-MFC-With:	r344779
2019-03-11 18:56:04 +00:00
Dimitry Andric
30622d9f9e Merge LLVM libunwind trunk r351319, from just before upstream's
release_80 branch point.  Afterwards, we will merge the rest of the
changes in the actual release_80 branch.

PR:		236062
MFC after:	1 month
X-MFC-With:	r344779
2019-03-11 18:45:36 +00:00
Enji Cooper
ff511f1f39 MFhead@r344996 2019-03-11 03:02:58 +00:00
Enji Cooper
b7d75bb75c Expect WhenDynamicCastToTest.AmbiguousCast to fail on FreeBSD
Casting `AmbiguousCastTypes::DerivedSub1` to `Base` currently succeeds, when
it's expected to fail.

See https://github.com/google/googletest/issues/2172 for more details.
2019-03-11 02:57:00 +00:00
Dimitry Andric
b3ed818e2d Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r355677 (effectively, 8.0.0 rc4), resolve conflicts, and bump version
numbers.

PR:		236062
MFC after:	1 month
X-MFC-With:	r344779
2019-03-09 00:27:50 +00:00
Mark Johnston
b16150ea90 Have pthread_cond_destroy() return EBUSY if the condvar has waiters.
This is not required of a compliant implementation, but it's easy to
check for and helps improve compatibility with other common
implementations.  Moreover, it's consistent with our
pthread_mutex_destroy().

PR:		234805
Reviewed by:	jhb, kib, ngie
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19496
2019-03-08 21:07:08 +00:00
Dimitry Andric
5d3c30e56c Pull in r354937 from upstream clang trunk (by Jörg Sonnenberger):
Fix inline assembler constraint validation

  The current constraint logic is both too lax and too strict. It fails
  for input outside the [INT_MIN..INT_MAX] range, but it also
  implicitly accepts 0 as value when it should not. Adjust logic to
  handle both correctly.

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

Pull in r355491 from upstream clang trunk (by Hans Wennborg):

  Inline asm constraints: allow ICE-like pointers for the "n"
  constraint (PR40890)

  Apparently GCC allows this, and there's code relying on it (see bug).

  The idea is to allow expression that would have been allowed if they
  were cast to int. So I based the code on how such a cast would be
  done (the CK_PointerToIntegral case in
  IntExprEvaluator::VisitCastExpr()).

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

These should fix assertions and errors when using the inline assembly
"n" constraint in certain ways.

In case of devel/valgrind, a pointer was used as the input for the
constraint, which lead to "Assertion failed: (isInt() && "Invalid
accessor"), function getInt".

In case of math/secp256k1, a very large integer value was used as input
for the constraint, which lead to "error: value '4624529908474429119'
out of range for constraint 'n'".

PR:             236216, 236194
MFC after:      1 month
X-MFC-With:     r344779
2019-03-07 19:33:39 +00:00
Cy Schubert
052d159a8b MFV r344878:
4.2.8p12 --> 4.2.8p13

MFC after:	immediately
Security:	CVE-2019-8936
		VuXML: c2576e14-36e2-11e9-9eda-206a8a720317
Obtained from:	nwtime.org
2019-03-07 13:36:00 +00:00
John Baldwin
2e43efd0bb Drop "All rights reserved" from my copyright statements.
Reviewed by:	rgrimes
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D19485
2019-03-06 22:11:45 +00:00
Dimitry Andric
01c21ea0a7 Put in a temporary workaround for what is likely a gcc 6 bug (it does
not occur with gcc 7 or later).  This should prevent the following error
from breaking the head-amd64-gcc CI builds:

In file included from /workspace/src/contrib/llvm/tools/lldb/source/API/SBMemoryRegionInfo.cpp:14:0:
/workspace/src/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h:128:54: error: 'template<class _InputIterator> lldb_private::MemoryRegionInfos::MemoryRegionInfos(_InputIterator, _InputIterator, const allocator_type&)' inherited from 'std::__1::vector<lldb_private::MemoryRegionInfo>'
   using std::vector<lldb_private::MemoryRegionInfo>::vector;
                                                      ^~~~~~
/workspace/src/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h:128:54: error: conflicts with version inherited from 'std::__1::vector<lldb_private::MemoryRegionInfo>'

Reported by:	CI
2019-03-06 18:19:27 +00:00
Justin Hibbits
bc2b9c015f Fix binutils compilation error with Clang 8
Summary:
This change fixes the following compilation error when using clang 8 to cross
compile base to powerpc64:

```
/usr/src/gnu/usr.bin/binutils/libopcodes/../../../../contrib/binutils/opcodes/ppc-dis.c💯35:
error: arithmetic on a null pointer treated as a cast from integer to pointer is
a GNU extension [-Werror,-Wnull-pointer-arithmetic]
  info->private_data = (char *) 0 + dialect;
		       ~~~~~~~~~~ ^
1 error generated.
*** [ppc-dis.o] Error code 1

make[6]: stopped in /usr/src/gnu/usr.bin/binutils/libopcodes
1 error
```

Test Plan:
- buildworld for x86_64 (native)
- buildworld for powerpc64 (cross)
- buildworld for powerpc64 (native)

Submitted by:	alfredo.junior_eldorado.org.br
Reviewed By:	emaste, pfg, brooks
Differential Revision:	https://reviews.freebsd.org/D19235
2019-03-05 04:16:50 +00:00
Enji Cooper
b18a4ccab9 MFhead@r344786 2019-03-05 01:00:38 +00:00
Dimitry Andric
844fc3e907 Merge ^/head r344549 through r344775. 2019-03-04 19:14:32 +00:00
Dimitry Andric
3087b115d4 Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r355313, resolve conflicts, and bump version numbers.
2019-03-04 19:06:51 +00:00
Navdeep Parhar
01869797b7 libcxgb4: Don't spam stderr. Write combining is not enabled by default
by the FreeBSD driver.
2019-02-27 06:50:24 +00:00
Simon J. Gerraty
0957b409a9 Add libbearssl
Disabled by default, used by loader and sbin/veriexec

Reviewed by:	emaste
Sponsored by:	Juniper Networks
Differential Revision: D16334
2019-02-26 05:59:22 +00:00
Dimitry Andric
af373543d8 Merge ^/head r344513 through r344548. 2019-02-25 19:18:32 +00:00
Dimitry Andric
da18572fa1 Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r354799, resolve conflicts, and bump version numbers.
2019-02-25 19:17:20 +00:00
Dag-Erling Smørgrav
23d1722334 Upgrade to OpenPAM Tabebuia. 2019-02-25 18:41:16 +00:00
Enji Cooper
18b18078f2 MFhead@r344527 2019-02-25 18:00:14 +00:00
Dimitry Andric
a8fe8db49a Merge ^/head r344178 through r344512. 2019-02-25 11:59:29 +00:00
Dimitry Andric
4f560b016f Pull in r354756 from upstream llvm trunk (by Craig Topper):
[X86] Fix tls variable lowering issue with large code model

  Summary:
  The problem here is the lowering for tls variable. Below is the DAG
  for the code. SelectionDAG has 11 nodes:

  t0: ch = EntryToken
	t8: i64,ch = load<(load 8 from `i8 addrspace(257)* null`,
	addrspace 257)> t0, Constant:i64<0>, undef:i64
	  t10: i64 = X86ISD::WrapperRIP TargetGlobalTLSAddress:i64<i32*
	  @x> 0 [TF=10]
	t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64
      t12: i64 = add t8, t11
    t4: i32,ch = load<(dereferenceable load 4 from @x)> t0, t12,
    undef:i64
  t6: ch = CopyToReg t0, Register:i32 %0, t4

  And when mcmodel is large, below instruction can NOT be folded.

    t10: i64 = X86ISD::WrapperRIP TargetGlobalTLSAddress:i64<i32* @x> 0
    [TF=10]
  t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64

  So "t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64" is
  lowered to " Morphed node: t11: i64,ch = MOV64rm<Mem:(load 8 from
  got)> t10, TargetConstant:i8<1>, Register:i64 $noreg,
  TargetConstant:i32<0>, Register:i32 $noreg, t0"

  When llvm start to lower "t10: i64 = X86ISD::WrapperRIP
  TargetGlobalTLSAddress:i64<i32* @x> 0 [TF=10]", it fails.

  The patch is to fold the load and X86ISD::WrapperRIP.

  Fixes PR26906

  Patch by LuoYuanke

  Reviewers: craig.topper, rnk, annita.zhang, wxiao3

  Reviewed By: rnk

  Subscribers: llvm-commits

  Tags: #llvm

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

This should fix "fatal error: error in backend: Cannot select" messages
when compiling <ctype.h> functions using -mcmodel=large.

Reported by:	phk
PR:		233143
MFC after:	3 days
2019-02-24 21:22:16 +00:00
Dimitry Andric
1bf8c89f28 Pull in r353299 from upstream lld trunk (by George Rimar):
Recommit r353293 "[LLD][ELF] - Set DF_STATIC_TLS flag for i386 target."

  With the following changes:
  1) Compilation fix:
  std::atomic<bool> HasStaticTlsModel = false; ->
  std::atomic<bool> HasStaticTlsModel{false};

  2) Adjusted the comment in code.

  Initial commit message:

  DF_STATIC_TLS flag indicates that the shared object or executable
  contains code using a static thread-local storage scheme.

  Patch checks if IE/LE relocations were used to check if the code uses
  a static model. If so it sets the DF_STATIC_TLS flag.

  Differential revision: https://reviews.llvm.org/D57749

Pull in r353378 from upstream lld trunk (by George Rimar):

  [LLD][ELF] - Set DF_STATIC_TLS flag for X64 target

  This is the same as D57749, but for x64 target.

  "ELF Handling For Thread-Local Storage" p41 says
  (https://www.akkadia.org/drepper/tls.pdf):
  R_X86_64_GOTTPOFF relocation is used for IE TLS models.
  Hence if linker sees this relocation we should add DF_STATIC_TLS flag.

  Differential revision: https://reviews.llvm.org/D57821

This adds support to lld for the DF_STATIC_TLS flag in shared objects,
which signals to the dynamic linker that the shared object requires
static thread local storage.

See also:	https://reviews.freebsd.org/D19072
MFC after:	1 week
2019-02-21 18:41:41 +00:00
Dimitry Andric
18ff5bdb9c Pull in r354515 from upstream libc++ trunk:
Fix the build with gcc when `-Wredundant-decls` is passed

  Summary:

  gcc warns that `__throw_runtime_error` is declared both in
  `<__locale>` and `<stdexcept>`, if `-Wredundant-decls` is passed on
  the command line; this is the case with FreeBSD when ${WARNS} == 6.

  Since `<__locale>` gets its first declaration via a transitive
  include of `<stdexcept>`, and the second declaration is after the
  first invocation of `__throw_runtime_error`, delete that second
  declaration.

  Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>

  Reviewers: kristina, MaskRay, EricWF, ldionne, ngie

  Reviewed By: EricWF

  Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, libcxx-commits

  Tags: #libc

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

Submitted by:	ngie
MFC after:	3 days
2019-02-20 21:06:11 +00:00
Enji Cooper
7ea28b21e4 Don't hardcode the source filename
In order to compile these tests with different CXXFLAGS, I needed to copy them
to different filenames to trick the compiler. Unfortunately, this triggers a
failure with one of the tests as it hardcodes the path to the test, instead of
relying on the compiler to fill in the path via `__FILE__`.

Using `__FILE__` is standard and works. Rely on it instead of a hardcoded path.
2019-02-20 07:21:22 +00:00
Enji Cooper
0cd3ea4138 Add .Lb references for gmock/gtest
These will be used in src.conf(5) changes--coming up next.
2019-02-19 22:35:14 +00:00
Enji Cooper
30e009fc3a MFhead@r344270 2019-02-19 03:46:32 +00:00
Dimitry Andric
993b827f31 Pull in r345199 from upstream libc++ trunk (by Petr Hosek):
Revert "Teach __libcpp_is_floating_point that __fp16 and _Float16 are
  floating-point types."

  This reverts commits r333103 and r333108. _Float16 and __fp16 are C11
  extensions and compilers other than Clang don't define these for C++.

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

This prevents "_Float16 is not supported on this target" errors in
libc++'s type_traits header, in some cases.

Reported by:	Charlie Li
MFC after:	3 days
2019-02-18 18:34:13 +00:00
Dimitry Andric
c981cbbd13 Merge ^/head r343956 through r344177. 2019-02-15 21:50:45 +00:00
Dimitry Andric
640dd76f2c Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r354130, resolve conflicts, and bump version numbers.
2019-02-15 21:44:42 +00:00
Dimitry Andric
381ab04f4f Pull in r353907 from upstream llvm trunk (by Reid Kleckner):
[MC] Make symbol version errors non-fatal

  We stil don't have a source location, which is pretty lame, but at
  least we won't tell the user to file a clang bug report anymore.

  Fixes PR40712

This will make errors for symbols with @@ versions that are not defined
non-fatal.  For example:

  void f(void)
  {
    __asm__(".symver foo,bar@@baz");
  }

will now result in:

  error: versioned symbol bar@@baz must be defined

instead of clang crashing with a diagnostic report.

PR:		234671
Upstream PR:	https://bugs.llvm.org/show_bug.cgi?id=40712
MFC after:	3 days
2019-02-13 20:13:40 +00:00
Martin Matuska
2a021abd9e MFV r344088 (libarchive):
archive_read_disk_posix.c: initialize delayed_errno

MFC after:	2 weeks
2019-02-13 07:37:33 +00:00
Enji Cooper
b89a7cc2ed Copy googletest 1.8.1 from ^/vendor/google/googletest/1.8.1 to .../contrib/googletest 2019-02-13 02:46:46 +00:00
Martin Matuska
a39fc08da2 MFV r344063:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1085: Fix a null pointer dereference bug in zip writer
  PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2
            decopmpression
  PR #1116: Add support for 64-bit ar format
  PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2]
  PR #1125: RAR5 reader - fix an invalid read and a memory leak
  PR #1131: POSIX reader - do not fail when tree_current_lstat() fails
            due to ENOENT [3]
  PR #1134: Delete unnecessary null pointer checks before calls of free()
  OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy.
  OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader

PR:		233006 [3]
Security:	CVE-2019-1000019 [1], CVE-2019-1000020 [2]
MFC after:	2 weeks
2019-02-12 23:24:45 +00:00
Martin Matuska
fbb1b16ad8 Update vendor/libarchive/dist to git 31c0a517c91f44eeee717a04db8b075cadda83d8
Relevant vendor changes:
  PR #1085: Fix a null pointer dereference bug in zip writer
  PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2
            decopmpression
  PR #1116: Add support for 64-bit ar format
  PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2]
  PR #1125: RAR5 reader - fix an invalid read and a memory leak
  PR #1131: POSIX reader - do not fail when tree_current_lstat() fails
            due to ENOENT [3]
  PR #1134: Delete unnecessary null pointer checks before calls of free()
  OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy.
  OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader

PR:		233006 [3]
Security:	CVE-2019-1000019 [1], CVE-2019-1000020 [2]
2019-02-12 22:29:41 +00:00
Dimitry Andric
54553daf6d Pull in r339734 from upstream llvm trunk (by Eli Friedman):
[ARM] Make PerformSHLSimplify add nodes to the DAG worklist correctly.

  Intentionally excluding nodes from the DAGCombine worklist is likely
  to lead to weird optimizations and infinite loops, so it's generally
  a bad idea.

  To avoid the infinite loops, fix DAGCombine to use the
  isDesirableToCommuteWithShift target hook before performing the
  transforms in question, and implement the target hook in the ARM
  backend disable the transforms in question.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=38530 . (I don't have a
  reduced testcase for that bug. But we should have sufficient test
  coverage for PerformSHLSimplify given that we're not playing weird
  tricks with the worklist. I can try to bugpoint it if necessary,
  though.)

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

This should fix a possible hang when compiling sys/dev/nxge/if_nxge.c
(which exists now only in the stable/11 branch) for arm.
2019-02-12 18:32:14 +00:00
Dimitry Andric
9e43c218d5 Merge ^/head r343807 through r343955. 2019-02-10 12:49:34 +00:00
Dimitry Andric
c232a6c2f7 Pull in r352607 from upstream llvm trunk (by Craig Topper):
[X86] Add FPSW as a Def on some FP instructions that were missing it.

Pull in r352608 from upstream llvm trunk (by Craig Topper):

  [X86] Remove a couple places where we unnecessarily pass 0 to the
  EmitPriority of some FP instruction aliases. NFC

  As far as I can tell we already won't emit these aliases due to an
  operand count check in the tablegen code. Removing these because I
  couldn't make sense of the inconsistency between fadd and fmul from
  reading the code.

  I checked the AsmMatcher and AsmWriter files before and after this
  change and there were no differences.

Pull in r353015 from upstream llvm trunk (by Craig Topper):

  [X86] Print %st(0) as %st when its implicit to the instruction.
  Continue printing it as %st(0) when its encoded in the instruction.

  This is a step back from the change I made in r352985. This appears
  to be more consistent with gcc and objdump behavior.

Pull in r353061 from upstream llvm trunk (by Craig Topper):

  [X86] Print all register forms of x87 fadd/fsub/fdiv/fmul as having
  two arguments where on is %st.

  All of these instructions consume one encoded register and the other
  register is %st. They either write the result to %st or the encoded
  register. Previously we printed both arguments when the encoded
  register was written. And we printed one argument when the result was
  written to %st. For the stack popping forms the encoded register is
  always the destination and we didn't print both operands. This was
  inconsistent with gcc and objdump and just makes the output assembly
  code harder to read.

  This patch changes things to always print both operands making us
  consistent with gcc and objdump. The parser should still be able to
  handle the single register forms just as it did before. This also
  matches the GNU assembler behavior.

Pull in r353141 from upstream llvm trunk (by Craig Topper):

  [X86] Connect the default fpsr and dirflag clobbers in inline
  assembly to the registers we have defined for them.

  Summary:
  We don't currently map these constraints to physical register numbers
  so they don't make it to the MachineIR representation of inline
  assembly.

  This could have problems for proper dependency tracking in the
  machine schedulers though I don't have a test case that shows that.

  Reviewers: rnk

  Reviewed By: rnk

  Subscribers: eraman, llvm-commits

  Tags: #llvm

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

Pull in r353489 from upstream llvm trunk (by Craig Topper):

  [X86] Add FPCW as a register and start using it as an implicit use on
  floating point instructions.

  Summary:
  FPCW contains the rounding mode control which we manipulate to
  implement fp to integer conversion by changing the roudning mode,
  storing the value to the stack, and then changing the rounding mode
  back. Because we didn't model FPCW and its dependency chain, other
  instructions could be scheduled into the middle of the sequence.

  This patch introduces the register and adds it as an implciit def of
  FLDCW and implicit use of the FP binary arithmetic instructions and
  store instructions. There are more instructions that need to be
  updated, but this is a good start. I believe this fixes at least the
  reduced test case from PR40529.

  Reviewers: RKSimon, spatel, rnk, efriedma, andrew.w.kaylor

  Subscribers: dim, llvm-commits

  Tags: #llvm

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

These should fix a problem in clang 7.0 where it would sometimes emit
long double floating point instructions in a slightly wrong order,
leading to failures in our libm tests.  In particular, the cbrt_test
test case 'cbrtl_powl' and the trig_test test case 'reduction'.

Reported by:	lwhsu
PR:		234040
Upstream PR:	https://bugs.llvm.org/show_bug.cgi?id=40206
2019-02-10 12:45:33 +00:00
Dimitry Andric
bc8fc00705 Amend r343442, by only expecting the lib.msun.cbrt_test.cbrtl_powl and
trig_test.reduction test cases to fail, if the fixes from r343916 have
not yet been applied to the base compiler.

Reported by:    lwhsu
PR:		234040
Upstream PR:	https://bugs.llvm.org/show_bug.cgi?id=40206
MFC after:	1 week
2019-02-08 18:31:54 +00:00
Dimitry Andric
94ba333f9c Pull in r352607 from upstream llvm trunk (by Craig Topper):
[X86] Add FPSW as a Def on some FP instructions that were missing it.

Pull in r353141 from upstream llvm trunk (by Craig Topper):

  [X86] Connect the default fpsr and dirflag clobbers in inline
  assembly to the registers we have defined for them.

  Summary:
  We don't currently map these constraints to physical register numbers
  so they don't make it to the MachineIR representation of inline
  assembly.

  This could have problems for proper dependency tracking in the
  machine schedulers though I don't have a test case that shows that.

  Reviewers: rnk

  Reviewed By: rnk

  Subscribers: eraman, llvm-commits

  Tags: #llvm

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

Pull in r353489 from upstream llvm trunk (by Craig Topper):

  [X86] Add FPCW as a register and start using it as an implicit use on
  floating point instructions.

  Summary:
  FPCW contains the rounding mode control which we manipulate to
  implement fp to integer conversion by changing the roudning mode,
  storing the value to the stack, and then changing the rounding mode
  back. Because we didn't model FPCW and its dependency chain, other
  instructions could be scheduled into the middle of the sequence.

  This patch introduces the register and adds it as an implciit def of
  FLDCW and implicit use of the FP binary arithmetic instructions and
  store instructions. There are more instructions that need to be
  updated, but this is a good start. I believe this fixes at least the
  reduced test case from PR40529.

  Reviewers: RKSimon, spatel, rnk, efriedma, andrew.w.kaylor

  Subscribers: dim, llvm-commits

  Tags: #llvm

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

These should fix a problem in clang 7.0 where it would sometimes emit
long double floating point instructions in a slightly wrong order,
leading to failures in our libm tests.  In particular, the cbrt_test
test case 'cbrtl_powl' and the trig_test test case 'reduction'.

Also bump __FreeBSD_cc_version, to be able to detect this in our test
suite.

Reported by:    lwhsu
PR:		234040
Upstream PR:	https://bugs.llvm.org/show_bug.cgi?id=40206
MFC after:	1 week
2019-02-08 18:24:53 +00:00
Dag-Erling Smørgrav
9c9d011eed Vendor import of Unbound 1.9.0. 2019-02-06 12:31:02 +00:00
Dimitry Andric
c8630eab15 Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r353167, resolve conflicts, and bump version numbers.
2019-02-05 19:48:24 +00:00
Dimitry Andric
c2c227a536 Merge ^/head r343571 through r343711. 2019-02-03 11:41:43 +00:00
Cy Schubert
e9a5006bff Kernel module shim sources have no business being in the userland
build directory, especially those for other operating systems.
The kernel module shims for other operating systems are hereby removed.
The kernel module shim for FreeBSD, mlfk_ipl.c, is already in
sys/contrib/ipfilter/netinet. The one here is never used and should
not be in the userland build directory either.

mlfk_rule.c isn't used either however we will keep it in case someone
wishes to use this shim to load rules via a kernel module, handy for
embedded. In that case it should be copied to
sys/contrib/ipfilter/netinet and a Makefile created to employ it.
(Probably a useful documentation project when time permits.)

MFC after:	1 month
2019-02-03 05:26:07 +00:00
Cy Schubert
e559413d6f Remove a redundant ip_compat.h, originally merged from upstream.
MFC after:	1 month
2019-02-03 05:26:01 +00:00
Cy Schubert
0fcd8cab4e ipfilter #ifdef cleanup.
Remove #ifdefs for ancient and irrelevant operating systems from
ipfilter.

When ipfilter was written the UNIX and UNIX-like systems in use
were diverse and plentiful. IRIX, Tru64 (OSF/1) don't exist any
more. OpenBSD removed ipfilter shortly after the first time the
ipfilter license terms changed in the early 2000's. ipfilter on AIX,
HP/UX, and Linux never really caught on. Removal of code for operating
systems that ipfilter will never run on again will simplify the code
making it easier to fix bugs, complete partially implemented features,
and extend ipfilter.

Unsupported previous version FreeBSD code and some older NetBSD code
has also been removed.

What remains is supported FreeBSD, NetBSD, and illumos. FreeBSD and
NetBSD have collaborated exchanging patches, while illumos has expressed
willingness to have their ipfilter updated to 5.1.2, provided their
zone-specific updates to their ipfilter are merged (which are of interest
to FreeBSD to allow control of ipfilters in jails from the global zone).

Reviewed by:	glebius@
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D19006
2019-02-03 05:25:49 +00:00
Ed Maste
3f0e38d70c readelf: decode FreeBSD note types
Decode NT_FREEBSD_ABI_TAG, NT_FREEBSD_ARCH_TAG, and NT_FREEBSD_FEATURE_CTL.

Reviewed by:	brooks, kib (earlier)
MFC after:	2 weeks
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19054
2019-02-01 22:24:14 +00:00
Ed Maste
6b2779a022 readelf: use table-based DT_FLAGS and DT_FLAGS_1 decoding
Fewer lines of code and more maintainable.

Reviewed by:	brooks, kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19053
2019-02-01 20:28:15 +00:00
Ed Maste
675f752cc5 readelf: dump elf note data
Output format is compatible with GNU readelf's handling of unknown note
types (modulo a GNU char signedness bug); future changes will add type-
specific decoding.

Reviewed by:	kib
MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2019-01-31 17:04:55 +00:00
Ed Maste
fb4e718261 readelf: fix i386 build
Use %jx and (uintmax_t) cast.

PR:		232983
MFC with:	r343592
Sponsored by:	The FreeBSD Foundation
2019-01-30 21:46:12 +00:00
Ed Maste
87a8583b24 readelf: decode flag bits in DT_FLAGS/DT_FLAGS_1
Decode d_val when the tag is DT_FLAGS or DT_FLAGS_1 based on the
information at:

https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-42444.html

PR:		232983
Submitted by:	Bora Ozarslan borako.ozarslan@gmail.com
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18784
2019-01-30 20:44:51 +00:00
Dimitry Andric
7e565c552a Merge ^/head r343320 through r343570. 2019-01-30 07:10:33 +00:00
Dimitry Andric
d75fca0d08 Pull in r352407 from upstream lld trunk (by Rui Ueyama):
Refactoring. NFC.

Pull in r352435 from upstream lld trunk (by Rui Ueyama):

  Attempt to fix build failure with GCC 5.4.

Pull in r352482 from upstream lld trunk (by George Rimar):

  [ELF] - Remove dead `readBfdName` declaration. NFC.

  `readBfdName` was removed recently.

Pull in r352606 from upstream lld trunk (by me):

  Recognize FreeBSD specific BFD names in OUTPUT_FORMAT

  Summary:
  After rLLD344952 ("Add OUTPUT_FORMAT linker script directive
  support"), using BFD names such as `elf64-x86-64-freebsd` the
  `OUTPUT_FORMAT` linker script command does not work anymore,
  resulting in errors like:

  ```
  ld: error: /home/dim/src/clang800-import/stand/efi/loader/arch/amd64/ldscript.amd64:2: unknown output format name: elf64-x86-64-freebsd
  >>> OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd")
  >>>               ^
  ```

  To fix this, recognize a `-freebsd` suffix in BFD names, and also set
  `Configuration::OSABI` to `ELFOSABI_FREEBSD` for those cases.

  Add and/or update several test cases to check for the correct results
  of these new `OUTPUT_FORMAT` arguments.

  Reviewers: ruiu, atanasyan, grimar, hokein, emaste, espindola

  Reviewed By: ruiu

  Subscribers: nemanjai, javed.absar, arichardson, krytarowski, kristof.beyls, kbarton, llvm-commits

  Differential Revision: https://reviews.llvm.org/D57283
2019-01-30 07:09:01 +00:00
Cy Schubert
60f4a175c5 Fix a typo.
MFC after:	3 days
2019-01-27 02:31:42 +00:00
Li-Wen Hsu
24df7b15fa Temporarily mark lib.msun.{cbrt_test.cbrtl_powl,trig_test.reduction}
expected failure after clang700-import merge

PR:		234040
Reviewed by:	ngie, markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18938
2019-01-25 18:48:20 +00:00
Ed Maste
ade4db4d04 clang: default to DWARF 4 as of FreeBSD 13
FreeBSD previously defaulted to DWARF 2 because several tools (gdb,
ctfconvert, etc.) did not support later versions.  These have either
been fixed or are deprecated.

Note that gdb 6 still exists but has been moved out of $PATH into
/usr/libexec and is intended only for use by crashinfo(8).  The kernel
build sets the DWARF version explicitly via -gdwarf2, so this should
have no effect there.

PR:		234887 [exp-run]
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17930
2019-01-25 14:46:13 +00:00
Dimitry Andric
bcba4b6d83 Reduce diff against upstream. 2019-01-22 20:34:42 +00:00
Dimitry Andric
7570aff4a0 Merge lldb release_80 branch r351543, and resolve conflicts. 2019-01-22 20:16:41 +00:00
Dimitry Andric
1064158e9b Merge lld release_80 branch r351543, and resolve conflicts. 2019-01-22 20:15:58 +00:00
Dimitry Andric
73471dd8c0 Merge clang release_80 branch r351543, and resolve conflicts. 2019-01-22 20:15:01 +00:00
Dimitry Andric
6f6198e75d Merge llvm release_80 branch r351543, and resolve conflicts. 2019-01-22 20:13:43 +00:00
Dimitry Andric
9c710df928 Merge compiler-rt trunk r351319, and resolve conflicts. 2019-01-22 19:20:24 +00:00
Dimitry Andric
0c824832d6 Merge libc++ trunk r351319, and resolve conflicts. 2019-01-22 19:02:28 +00:00
Dimitry Andric
053d6b6842 Remove customizations in #includes of Options.inc, and adjust lld
Makefile to generate the file in the right place.
2019-01-22 18:04:40 +00:00
Dimitry Andric
a903123562 Add #ifdef LLDB_ENABLE_ALL guards to prevent accessing the PDB AST
parser, which we have disabled in our lldb.
2019-01-22 18:02:40 +00:00
Dimitry Andric
4c14ae3e1e Fix ifunc code from r338251 for lld 8.0. 2019-01-21 20:22:11 +00:00
Dimitry Andric
763d4102c9 Merge lldb trunk r351319, resolve conflicts, and update FREEBSD-Xlist. 2019-01-20 15:00:15 +00:00
Dimitry Andric
0e23b2ff8c Merge lld trunk r351319, resolve conflicts, and update FREEBSD-Xlist. 2019-01-20 14:42:59 +00:00
Dimitry Andric
d5ea6fa648 Merge clang trunk r351319, resolve conflicts, and update FREEBSD-Xlist. 2019-01-20 14:02:54 +00:00
Dimitry Andric
d9484dd61c Merge llvm trunk r351319, resolve conflicts, and update FREEBSD-Xlist. 2019-01-20 11:41:25 +00:00
Kirk McKusick
adb8eabc2e Truely fix #if defined broken in -r343111
Pointy-hat-to: mckusick
2019-01-17 16:26:59 +00:00
Kirk McKusick
cc50e5a1b8 Proper definition of elast3.
Reported by: Oliver Pinter <oliver.pinter@hardenedbsd.org>
2019-01-17 15:42:10 +00:00
Kirk McKusick
cbb97f8d1e Fix #if defined broken in -r343111
Pointy-hat-to: mckusick
2019-01-17 15:35:04 +00:00
Kirk McKusick
88640c0e8b Create new EINTEGRITY error with message "Integrity check failed".
An integrity check such as a check-hash or a cross-correlation failed.
The integrity error falls between EINVAL that identifies errors in
parameters to a system call and EIO that identifies errors with the
underlying storage media. EINTEGRITY is typically raised by intermediate
kernel layers such as a filesystem or an in-kernel GEOM subsystem when
they detect inconsistencies. Uses include allowing the mount(8) command
to return a different exit value to automate the running of fsck(8)
during a system boot.

These changes make no use of the new error, they just add it. Later
commits will be made for the use of the new error number and it will
be added to additional manual pages as appropriate.

Reviewed by:    gnn, dim, brueffer, imp
Discussed with: kib, cem, emaste, ed, jilles
Differential Revision: https://reviews.freebsd.org/D18765
2019-01-17 06:35:45 +00:00
Cy Schubert
e719f737b7 Remove redundant ipfilter version of pcap-bpf.h. As of r214535 it was
no longer needed.

MFC after:	1 week
2019-01-16 20:46:39 +00:00
Konstantin Belousov
ea7e7006db Implement shmat(2) flag SHM_REMAP.
Based on the description in Linux man page.

Reviewed by:	markj, ngie (previous version)
Sponsored by:	Mellanox Technologies
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18837
2019-01-16 05:15:57 +00:00
Konstantin Belousov
b87850b96e Trim spaces at the end of lines.
Reviewed by:	markj, ngie
Sponsored by:	Mellanox Technologies
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18837
2019-01-16 05:09:29 +00:00
Cy Schubert
636a29ff4f Remove an IRIX-only source file.
MFC after:	1 week
2019-01-16 02:05:42 +00:00
Ed Maste
ae500c1ff8 Update to ELF Tool Chain r3668
Highlights:
- Make sure that only TLS sections are sorted into TLS segment.
- Fixed multiple errors in "Section to Segment mapping".
- Man page updates
- ar improvements
- elfcopy: avoid filter_reloc uninitialized variable for rela
- elfcopy: avoid stripping relocations from static binaries
- readelf: avoid printing directory in front of absolute path
- readelf: add NT_FREEBSD_FEATURE_CTL FreeBSD note type
- test improvements

NOTES:

Some of these changes originated in FreeBSD and simply reduce diffs
between contrib and vendor.

ELF Tool Chain ar is not (currently) used in FreeBSD, and there are
improvements in both FreeBSD and ELF Tool Chain ar that are not in
the other.

Sponsored by:	The FreeBSD Foundation
2019-01-10 14:35:23 +00:00
Gleb Smirnoff
3231251399 Timer interval is correctly counted in ticks (1/100 s) in
mibif_reset_hc_timer().  Multiplication by 10 is erroneous
and is probably a blind copy and paste from next function.

PR:		132993
Submitted by:	Vitezslav Novy <vnovy vnovy.net>
2019-01-09 05:53:59 +00:00
Pawel Jakub Dawidek
6d4db58393 In r316006 the getstrfromtype_locked() function was modified to return
an empty string, instead of NULL, if an entry is missing in the audit_control
file. Because of that change the getachost() function started to return
success even if the host name was not defined in the audit_control.
This in turn led to auditd_hostlen always being set (for an empty host it was
set to 0). If auditd_hostlen was not equal to -1 we were trying to append
the host name to trail file name. All this led to situation where when host
name is not defined in audit_control, auditd will create trail files with
a leading '.', which breaks auditdistd as it doesn't work with longer audit
trail file names.

Fix this by appending host name to the trail file name only if the host name
is not empty.
2019-01-09 01:16:35 +00:00
Konstantin Belousov
866fe991ac Clamp tuklib_physmem() return value to SIZE_T_MAX.
On 32bit platforms it is possible to have (much) more physical RAM
than is mappable into single address space.  In this case liblzma
scales the value into a request to mmap more address space than it is
theoretically possible.

Reported and tested by:	pho
Reviewed by:	delphij
Discussed with:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-01-06 23:59:04 +00:00
Cy Schubert
480717af29 Remove ipsd (IP Scan Detetor). It is unused and to my knowledge has
never been used on any platform that ipfilter has been on. However
it looks like it could be a useful utility, therefore there are plans
to make it a port one day. It lacks a man page as well.

MFC after:	1 month
2019-01-06 21:24:44 +00:00
Philip Paeps
d595db7390 Import tzdata 2018i
Changes: https://github.com/eggert/tz/blob/2018i/NEWS

MFC after:	2 days
2018-12-31 07:57:37 +00:00
Philip Paeps
2c5e84cc26 Import tzdata 2018h
Changes: https://github.com/eggert/tz/blob/2018h/NEWS

MFC after:	3 days
2018-12-30 08:22:35 +00:00
Cy Schubert
da7e48c690 TCP_PAWS_IDLE is does not exist in NetBSD and illumos. In FreeBSD
TCP_PAWS_IDLE is defined in netinet/tcp_seq.h, however this header
isn't included explicitly or implicitly at this point therefore
as far ipfilter is concerned TCP_PAWS_IDLE is not defined. Remove
the #ifdef and include netinet/tcp.h unconditionally.

MFC after:	1 week
2018-12-30 04:25:48 +00:00
Dimitry Andric
a9419c7133 Pull in r342863 from upstream llvm trunk (by Hans Wennborg):
Remove debug printf leftover from r342397

PR:		234480
MFC after:	6 weeks
X-MFC-With:	r341825
2018-12-29 15:21:51 +00:00
Dimitry Andric
434fe561e1 Pull in r342397 from upstream llvm trunk (by Amara Emerson):
Revert "Revert r342183 "[DAGCombine] Fix crash when store merging
  created an extract_subvector with invalid index.""

  Fixed the assertion failure.

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

This fixes 'Assertion failed: ((VT.getVectorNumElements() +
N2C->getZExtValue() <= N1.getValueType().getVectorNumElements()) &&
"Extract subvector overflow!"), function getNode' when building the
multimedia/aom port (with AVX2 enabled).

Reported by:	jbeich
PR:		234480
MFC after:	6 weeks
X-MFC-With:	r341825
2018-12-29 15:13:49 +00:00
Simon J. Gerraty
dfd669ab38 Merge bmake-20181221 2018-12-23 01:05:52 +00:00
Cy Schubert
076b94438c MFV r342175:
Update sqlite3-3.23.1 --> sqlite3-3.26.0 (3260000)

MFC after:	3 days
Security:	https://blade.tencent.com/magellan/index_en.html
		No known CVE was apparently registered.
2018-12-18 01:12:30 +00:00
Dimitry Andric
176fdeee33 Update clang, llvm, lld, lldb, compiler-rt and libc++ version number to
7.0.1 release r349250.  There were no functional changes since the 7.0.1
rc3 import.

PR:		230240, 230355
Relnotes:	yes
MFC after:	2 months
X-MFC-With:	r341825
2018-12-15 14:08:41 +00:00
Martin Matuska
98bf66e624 MFV r341771,342040,342041:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1102: RAR5 reader - fix big-endian problems
  PR #1105: Fix various crash, memory corruption and infinite loop conditions
  PR #1107: RAR5 reader: removed an unused function: bf_is_last_block

MFC after:	1 week
2018-12-13 11:18:45 +00:00
Hans Petter Selasky
46caeeca78 Don't register IOCTLs with capsicum when there is no valid file descriptor.
This fixes tcpdump when using mlx5_X devices.

Differential Revision:	https://reviews.freebsd.org/D18499
Reviewed by:		kib@, slavash@, oshogbo@
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2018-12-12 09:51:10 +00:00
Dimitry Andric
67350cb56a Merge ^/head r340918 through r341763. 2018-12-09 11:39:45 +00:00
Dimitry Andric
0b9890fcbf Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r348686 (effectively 7.0.1 rc3), resolve conflicts, and bump version
numbers.

PR:		230240, 230355
2018-12-09 11:36:04 +00:00
Cy Schubert
85732ac8bc MFV r341618:
Update wpa 2.6 --> 2.7.
2018-12-09 06:45:49 +00:00
Pawel Jakub Dawidek
4926792bc9 Consider the following situation:
The sender has .not_terminated file. It gets disconnected. The last trail
file is then terminated without adding new data (this can happen for example
when auditd is being stopped on the sender). After reconnect the .not_terminated
was not renamed on the receiver as it should.

We were already handling similar situation where the sender crashed and the
.not_terminated trail file was renamed to .crash_recovery. Extend this case to
handle the situation above.
2018-12-07 03:13:36 +00:00
Simon J. Gerraty
2eae894ca7 Update bmake to version 20180919
Cleanup of stats cache
and new :q modifier.
2018-12-06 20:56:19 +00:00
Cy Schubert
efc4145a6e Remove an ugly Ultrix hack. Ultrix has been AWOL since the last ice
age, more to come.

MFC after:	1 week
2018-12-06 20:15:54 +00:00
Slava Shwartsman
318bd2348c opensm: Use precision specifier for scanf
If user input a string larger than the length of buffer, the stack
memory will be corrupted.

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies
2018-12-05 13:28:46 +00:00
Slava Shwartsman
a6578a04e4 libibverbs: Fix memory leak in ibv_read_sysfs_file().
Testing packetdrill using valgrind resulted in finding a memory leak in
ibv_read_sysfs_file(). The attached patch fixes it.

Submitted by:	tuexen@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies
2018-12-05 13:28:17 +00:00
Cy Schubert
b1ece51fb8 As part of the general cleanup of the ipfilter code, special cases
are committed separately to document fixing them separately from
the general cleanup. In this case we don't want to hide the utter
brokenness of what is being fixed.

Clean up a discombobulated block of #if's, with one block unreachable.
ip_fil.c is used in ipftest which is used to dry-run test ipfilter
rules in userspace without loading them in the kernel. The call to
(*ifp->if_output) matches that in the FreeBSD kernel.

Further testing and work will be required to make ipftest fully
functional.

MFC after:	1 week
2018-12-04 06:11:04 +00:00
Yuri Pankov
f2dfec1ffb vi: fix UTF-8 detection.
PR:		202290
Submitted by:	lampa@fit.vutbr.cz
Reviewed by:	bapt
Approved by:	kib (mentor, implicit)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D17950
2018-11-26 15:33:55 +00:00
Martin Matuska
7d69e4cde7 MFV r340938:
Sync libarchive with vendor.

Relevant vendor changes:
  Issue #1096: Support extracting ACLs with in-entry comments (GNU tar)
  PR #1023: Support extracting extattrs as non-root on non-user-writeable
            files

MFC after:	1 week
2018-11-26 11:04:35 +00:00
Dimitry Andric
3d5db45595 Merge ^/head r340427 through r340868. 2018-11-24 14:46:06 +00:00
Martin Matuska
276f481d65 MFV r340865:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1080: Spelling fixes
  PR #1084: RAR5 reader bugfixes
  PR #1091: fix use-after-free in delayed newc link processing
  PR #1092: Fix a few obvious resource leaks and strcpy() misuses

MFC after:	1 week
2018-11-24 01:25:45 +00:00
Mateusz Guzik
248b5d08b3 strings: unbreak the build after r340746
Discussed with:	oshogbo
Sponsored by:	The FreeBSD Foundation
2018-11-21 22:37:49 +00:00
Mariusz Zaborski
4f486ad6f6 strings: fix style nits
Reviewed by:	cem, emaste, Joseph Koshy <jkoshy@users.sourceforge.net>
Differential Revision:	https://reviews.freebsd.org/D18036
2018-11-21 21:48:02 +00:00
Maxim Sobolev
65caaa0ed6 Fix CU: output of the --debug-dump=decodedline, the problem there
is that both file name and current directory is recorded, however
file name sometimes already contains absolute path. In which case
prefixing it with directory name results in an invalid pathname.

Only append directory name if the file name does not start with '/'.
This seems to DTRT.

Approved by:	emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D18290
2018-11-21 21:46:06 +00:00
Yuri Pankov
adeebb8308 Make mbstowcs_basic test pass, now that we have more ctype definitions.
Reported by:	jenkins
Approved by:	kib (mentor, implicit)
2018-11-17 12:59:59 +00:00
Mateusz Piotrowski
830809aea1 smbutil(1): Improve mdoc formatting.
Also, make the path to the example configuration file absolute.

Reviewed by:	bcr
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17985
2018-11-14 15:15:07 +00:00
Edward Tomasz Napierala
d5aef6d6ca Pick 57553c3b1a5592dc4c03f3c6831d9b794e523865 from upstream:
Avoid touching all pages in extent_recycle for debug build.

    We may have a large number of pages with *zero set (since they are populated on
    demand).  Only check the first page to avoid paging in all of them.

This makes it easy to compare performance with and without 'retain:true'.

Discussed with:	jasone
Obtained from:	Qi Wang <interwq at gwu dot edu>
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-11-14 13:06:48 +00:00
Ed Maste
7ee126159f Revert r340385, strings capability mode
This needs to be reworked for bootstrapping.
2018-11-13 01:30:31 +00:00
Ed Maste
672b07ce30 strings: enter capability mode when operating on stdin
Reviewed by:	oshogbo
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2018-11-12 20:38:43 +00:00
Dimitry Andric
9b5cb2f639 Merge ^/head r340235 through r340367. 2018-11-12 16:41:41 +00:00
Mariusz Zaborski
752d135e0d libcasper: ange the name of limits in cap_dns so the intentions are obvious.
Reported by:	pjd
MFC after:	3 weeks
2018-11-12 15:52:45 +00:00
Ed Maste
c59e510923 nvi: remove superfluous space before ^\
This fixes alignment in vi's 'viusage' command and has been fixed
upstream and in OpenBSD.

Submitted by:	Raf Czlonka (github:rjc)
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd/pull/122
2018-11-09 17:39:57 +00:00
Yuri Pankov
9eb7d595e1 Reset persistent mbstates when rune locale encoding changes.
This was shown to be a problem by side effect of now-enabled test case,
which was going through C, en_US.UTF-8, ja_JP.SJIS, and ja_JP.eucJP,
and failing eventually as data in mbrtowc's mbstate, that was
perfectly correct for en_US.UTF-8 was treated as incorrect for
ja_JP.SJIS, failing the entire test case.

This makes the persistent mbstates to be per ctype-component,
and not per-locale so we could easily reset the mbstates when
only LC_CTYPE is changed.

Reviewed by:	bapt, pfg
Approved by:	kib (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17796
2018-11-09 03:32:53 +00:00
Dimitry Andric
c06e7b66a1 Merge ^/head r340126 through r340212. 2018-11-07 18:52:28 +00:00
Edward Tomasz Napierala
086165ecb5 Pick 50b473c8839f5408df179bdf6f2b3fd2cf5c3b2f from upstream:
Set commit properly for FreeBSD w/ overcommit.

    When overcommit is enabled, commit needs to be set when doing mmap().  The
    regression was introduced in f80c97e.

This fixes 'retain:true'.

Discussed with:	jasone
Obtained from:	Qi Wang <interwq at gwu dot edu>
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-11-06 12:05:46 +00:00
Mariusz Zaborski
9b5dd8ff8b Un-break build libexpact.
The writeRandomBytes_arc4random is not used if the arc4random_buf
is available. This caused compiler to throw warnings which are treated as
an error in libexpact.

Approved by:	vangyzen
2018-11-04 18:24:11 +00:00
Eric van Gyzen
0a48773f8c Update expat to 2.2.6
Update contrib/expat by merging from the vendor branch.

Update expat_config.h manually, using
    make -C /usr/ports/textproc/expat2 configure
as a baseline.

MFC after:	1 month
Relnotes:	yes
Security:	yes; see contrib/expat/Changes since 2.2.0
Sponsored by:	Dell EMC Isilon
2018-11-04 16:08:59 +00:00
Dimitry Andric
2a22df74e9 Merge ^/head r339813 through r340125. 2018-11-04 15:49:06 +00:00
Dimitry Andric
689486003b Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r346007 (effectively 7.0.1 rc2), resolve conflicts, and bump version
numbers.

PR:		230240, 230355
2018-11-04 15:46:30 +00:00
Yuri Pankov
32a8ec8bdd strptime: make %k and %l specifiers match their description in
strftime(3), and allow them to process space-padded input.

PR:		230720
Submitted by:	rlittle@inetco.com (original version)
Approved by:	kib (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17761
2018-11-03 23:37:13 +00:00
Devin Teske
e0ff4751f0 Update awk(1) manual to state an exception to egrep(1)-like RE syntax
Reviewed by:	imp, jmg
MFC after:	3 days
Sponsored by:	Smule, Inc.
Differential Revision:	https://reviews.freebsd.org/D17739
2018-11-02 23:03:40 +00:00
Ed Maste
e74f411d47 Define NT_FREEBSD_FEATURE_CTL ELF note type
This ELF note will be used to allow binaries to opt out of, or in to,
upcoming vulnerability mitigation and other features.

Committing the definition and readelf change separately to allow
independent MFC.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2018-11-02 19:02:03 +00:00
Ed Maste
e37480d938 readelf: decode R_MIPS_HIGHER and R_MIPS_HIGHEST relocation types
Sponsored by:	The FreeBSD Foundation
2018-11-02 18:40:01 +00:00
Dag-Erling Smørgrav
209fcf8ed9 Merge upstream r4932: turn so-reuseport option off by default.
MFC after:	3 days
2018-11-01 23:42:35 +00:00
Mateusz Piotrowski
8df507900a smbutil(1): Reference nsmb.conf(5) and mount_smbfs(8)
Reviewed by:	bcr
Approved by:    krion (mentor, implicit), mat (mentor, implicit)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D17809
2018-11-01 22:54:52 +00:00
Mateusz Piotrowski
62d7aab953 mount_smbfs(8): Mention /etc/nsmb.conf, smbutil(1) and nsmb.conf(5)
Reviewed by:	bcr
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D17808
2018-11-01 22:50:50 +00:00
Mateusz Piotrowski
d5e3b0b563 mount_smbfs(8): Add the STANDARDS and HISTORY sections
- Document that mount_smbfs(8) only supports SMB1 and that SMB2 and SMB3
  are not supported at the moment. Suggest users to browse ports for
  software compatible with newer versions of the protocol.
- Copy supported servers list from README.
- Add a SEE ALSO section and reference the chapter about Samba in the
  FreeBSD Handbook.
- Add a HISTORY section.
- Style changes:
  - Use Dq instead of Em in the EXAMPLES section.
  - Mark command modifiers with Cm.

Reviewed by:	bcr
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
MFC after:	1 week
Sponsored by:   Bally Wulff Games & Entertainment GmbH
Differential Revision:	https://reviews.freebsd.org/D17798
2018-11-01 11:37:19 +00:00
Edward Tomasz Napierala
9436aa0e66 Remove no longer relevant comment, as suggested by imp@.
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-10-30 15:44:16 +00:00
Edward Tomasz Napierala
02ba1d993f Remove useless call to access(2) from tzcode. Quoting OpenBSD:
> Remove doaccess variable and access(2) call since this interfers with
> applications like zdump(8) because pledge(2) doesn't allow access(2) to
> /usr/share/zoneinfo.
>
> millert@ better described why this call can go away:
>
> "This looks like an attempt to do access checks based on the real uid instead
> of the effective uid.  Basically for setuid programs we don't want to allow a
> user to set TZ to a path they should not be able to otherwise access.
>
> However, we already have a check for issetugid() above so I think the doaccess
> bits can just be removed and we can rely on open()."
>
> After discussion with tb@, deraadt@ and millert@, this was also OK'ed by them

Reviewed by:	imp
Obtained from:	OpenBSD
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D17701
2018-10-30 15:43:06 +00:00
Yuri Pankov
281c29899f Connect libc/tests/time to the build, adding test cases for strptime()
issues fixed recently, and disabling the failing ones (mostly due to TZ
parsing differences with NetBSD).

Reviewed by:	ngie
Approved by:	kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D17546
2018-10-30 02:37:23 +00:00
Navdeep Parhar
7815283df2 rping(1): Make sure the socket address defaults to something reasonable
when running as the server.

Submitted by:	Krishnamraju Eraparaju @ Chelsio
Reviewed by:	hselasky@, np@
MFC after:	1 month
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D17707
2018-10-29 21:46:05 +00:00
Philip Paeps
b999412482 Import tzdata 2018g
Changes: https://github.com/eggert/tz/blob/2018g/NEWS

MFC after:	3 days
2018-10-28 23:54:05 +00:00
Dimitry Andric
fda9adafa3 Merge ^/head r339670 through r339812. 2018-10-27 14:44:39 +00:00
Martin Matuska
b160a8765d MFV r339792:
Sync libarchive with vendor.

Relevant vendor changes:
  RAR5 reader: more maybe-uninitialized size_t fixes for riscv64
               FreeBSD build

MFC after:	1 month
2018-10-26 21:17:50 +00:00
Martin Matuska
343d766b69 MFV r339750:
Sync libarchive with vendor.

Relevant vendor changes:
  RAR5 reader: FreeBSD build platform fixes for powerpc(64), mips(64),
               sparc64 and riscv64

MFC after:	1 month
2018-10-25 23:13:19 +00:00
Martin Matuska
b1c91e4b6c MFV r339640,339641,339644:
Sync libarchive with vendor

Relevant vendor changes:
  PR #1013: Add missing h_base offset when performing absolute seeks in
            xar decompression
  PR #1061: Add support for extraction of RAR v5 archives
  PR #1066: Fix out of bounds read on empty string filename for gnutar, pax
            and v7tar
  PR #1067: Fix temporary file path buffer overflow in tests
  IS #1068: Correctly process and verify integer arguments passed to
            bsdcpio and bsdtar
  PR #1070: Don't default XAR entry atime/mtime to the current time

MFC after:	1 month
2018-10-25 21:44:17 +00:00
Dimitry Andric
3e0f7fbee0 Add interpose flag, introduced in head r342239, to the list of checked
flag names.
2018-10-25 20:44:14 +00:00
Dimitry Andric
c6879c6c14 Merge ^/head r339015 through r339669. 2018-10-23 21:09:37 +00:00
Dimitry Andric
950f620367 Pull in r345002 from upstream lld trunk:
Don't mess up RelIplt symbols during relocatable processing

  Summary:
  During upgrading of the FreeBSD source tree with lld 7.0.0, I noticed
  that it started complaining about crt1.o having an "index past the
  end of the symbol table".

  Such a symbol table looks approximately like this, viewed with
  readelf -s (note the Ndx field being messed up):

  Symbol table '.symtab' contains 4 entries:
     Num:    Value  Size Type    Bind   Vis      Ndx Name
       0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
       1: 00000000     0 SECTION LOCAL  DEFAULT    1
       2: 00000000     0 NOTYPE  WEAK   HIDDEN  RSV[0xffff] __rel_iplt_end
       3: 00000000     0 NOTYPE  WEAK   HIDDEN  RSV[0xffff] __rel_iplt_start

  At first, it seemed that recent ifunc relocation work had caused this:
  <https://reviews.freebsd.org/rS339351>, but it turned out that it was
  due to incorrect processing of the object files by lld, when using -r
  (a.k.a. --relocatable).

  Bisecting showed that rL324421 ("Convert a use of Config->Static") was
  the commit where this new behavior began.  Simply reverting it solved
  the issue, and the __rel_iplt symbols had an index of UND again.

  Looking at Rafael's commit message, I think he simply missed the
  possibility of --relocatable being in effect, so I have added an
  additional check for it.

  I also added a simple regression test case.

  Reviewers: grimar, ruiu, emaste, espindola

  Reviewed By: ruiu

  Subscribers: arichardson, krytarowski, llvm-commits

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

This fixes a problem in lld where it places incorrect indexes for ifunc
related symbols in crt1.o and friends, making it impossible to link most
normal programs with it.
2018-10-23 20:56:59 +00:00
Edward Tomasz Napierala
0c885e274a Pick f80c97e477d1b3fe7778c65d9439d673738b4131 from upstream:
Rework the way jemalloc uses mmap(2) on FreeBSD.

    This makes it directly use MAP_EXCL and MAP_ALIGNED() instead
    of weird workarounds involving mapping at random places and then
    unmapping parts of them.

Discussed with:	jasone
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-10-23 14:11:35 +00:00
Edward Tomasz Napierala
bff19560ee Pick 676cdd66792ccb629a978837ea2a066d5db342cc from upstream:
Disable runtime detection of lazy purging support on FreeBSD.

    The check doesn't seem to serve any purpose here, and this shaves
    off three syscalls on binary startup.

Discussed by:	jasone
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-10-23 13:54:54 +00:00
Kristof Provost
a00d561893 tcpdump: Log uid on pflog interfaces
If pf logs the user id ('pass out log (user)') have tcpdump also print
this.

Example output:
 00:00:00.000000 rule 0/0(match) [uid 1001]: pass out on vtnet0: (tos 0x0, ttl 64, id 57539, offset 0, flags [none], proto UDP (17), length 55)
    172.16.2.2.18337 > 172.16.2.1.53: [bad udp cksum 0x5c58 -> 0x16e4!] 40222+ A? google.be. (27)

PR:		122773
Differential Revision:	https://reviews.freebsd.org/D17625
2018-10-21 21:17:42 +00:00
Philip Paeps
89abb9f8c2 Import tzdata 2018f
Changes: https://github.com/eggert/tz/blob/2018f/NEWS

MFC after:	3 days
2018-10-20 22:32:10 +00:00
Baptiste Daroussin
f4f33ea0c7 Update libdialog to 1.3-20180621 2018-10-20 20:49:46 +00:00
Ed Maste
447a8c25fe libelf: also test for 64-bit ELF in _libelf_is_mips64el
Although _libelf_is_mips64el is only called in contexts where we've
already checked that e_class is ELFCLASS64 but this may change in the
future.  Add a safety belt so that we don't access an invalid e_ehdr64
union member if it does.

Reported by:	jkoshy (in review D17380)
2018-10-20 18:47:45 +00:00