Commit Graph

8587 Commits

Author SHA1 Message Date
Cy Schubert
4fcb870612 Teach the ippool parser about address families. This is a precursor
to implementing IPv6 support within ippool which requires reworking
radix_ipf.c.

MFC after:	1 month
2019-09-26 03:09:45 +00:00
Martin Matuska
f057565e0d MFV r352731:
Sync libarchive with vendor.

Relevant vendor changes:
  Issue #1237: Fix integer overflow in archive_read_support_filter_lz4.c
  PR #1249: Correct some typographical and grammatical errors.
  PR #1250: Minor corrections to the formatting of manual pages

MFC after:	1 week
2019-09-26 01:50:20 +00:00
Martin Matuska
a297901e6c Update vendor/libarchive/dist to git 2f3033ca23f8c21160506c3c7ac8a0df0d3fde42
Relevant vendor changes:
  Issue #1237: Fix integer overflow in archive_read_support_filter_lz4.c
  PR #1249: Correct some typographical and grammatical errors.
  PR #1250: Minor corrections to the formatting of manual pages
2019-09-26 01:42:09 +00:00
Kyle Evans
38325e2ab8 bsdgrep(1): various fixes of empty pattern/exit code/-c behavior
When an empty pattern is encountered in the pattern list, I had previously
broken bsdgrep to count that as a "match all" and ignore any other patterns
in the list. This commit rectifies that mistake, among others:

- The -v flag semantics were not quite right; lines matched should have been
  counted differently based on whether the -v flag was set or not. procline
  now definitively returns whether it's matched or not, and interpreting
  that result has been kicked up a level.
- Empty patterns with the -x flag was broken similarly to empty patterns
  with the -w flag. The former is a whole-line match and should be more
  strict, only matching blank lines. No -x and no -w will will match the
  empty string at the beginning of each line.
- The exit code with -L was broken, w.r.t. modern grep. Modern grap will
  exit(0) if any file that didn't match was output, so our interpretation
  was simply backwards. The new interpretation makes sense to me.

Tests updated and added to try and catch some of this.

This misbehavior was found by autoconf while fixing ports found in PR 229925
expecting either a more sane or a more GNU-like sed.

MFC after:	1 week
2019-09-25 17:14:43 +00:00
Dimitry Andric
8b1412a144 Pull in r372606 from upstream llvm trunk (by Sanjay Patel):
[x86] fix assert with horizontal math + broadcast of vector (PR43402)

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

This should fix 'Assertion failed: ((HOp.getValueType() == MVT::v2f64 ||
HOp.getValueType() == MVT::v4f64) && HOp.getValueType() == VT &&
"Unexpected type for h-op"), function foldShuffleOfHorizOp, file
contrib/llvm/lib/Target/X86/X86ISelLowering.cpp, line 33661' when
building the devel/llvm90 port with CPUTYPE=haswell.

PR:		240759
2019-09-23 17:05:46 +00:00
Dimitry Andric
6d3bb28257 Pull in r372513 from upstream lld trunk (by Simon Atanasyan):
[mips] Deduce MIPS specific ELF header flags from `emulation`

  In case of linking binary blobs which do not have any ELF headers, we
  can deduce MIPS ABI ELF header flags from an `emulation` option.

  Patch by Kyle Evans.

Requested by:	kevans :)
2019-09-22 17:31:27 +00:00
Dimitry Andric
f05b9584fa Merge ^/head r352537 through r352586. 2019-09-21 21:02:57 +00:00
Dimitry Andric
8a4b4f9f2b Pull in r371557 from upstream clang trunk (by Richard Smith):
When evaluating a __builtin_constant_p conditional, always enter
  constant-folding mode regardless of the original evaluation mode.

  In order for this to be correct, we need to track whether we're
  checking for a potential constant expression or checking for
  undefined behavior separately from the evaluation mode enum, since we
  don't want to clobber those states when entering constant-folding
  mode.

This should fix "ld: error: undefined symbol: ix86_isa_flags" (and many
other symbol names) during the initial stages of the lang/gcc* ports.

The issue was that without optimization, the __builtin_constant_p()
expressions generated in gencondmd.c would emit references to global
variables that were undefined, such as ix86_isa_flags.

PR:		240629
2019-09-21 21:01:38 +00:00
Cy Schubert
20674acb70 Follow up on r352304 which disabled default mlockall() at startup.
Unfortunately though the original tarball supports this in ./configure
(for Linux), to fully support disabling of mlockall() by default requires
a little extra help otherwise the following is logged in syslog:

	Cannot set RLIMIT_MEMLOCK: Operation not permitted

MFC after:	2 weeks
X-MFC with:	r352304
2019-09-19 20:16:51 +00:00
Dimitry Andric
7dfde55afd Pull in r371066 from upstream clang trunk (by Justin Hibbits):
Add -m(no)-spe to clang

  Summary:
  r337347 added support for the Signal Processing Engine (SPE) to LLVM.
  This follows that up with the clang side.

  This adds -mspe and -mno-spe, to match GCC.

  Subscribers: nemanjai, kbarton, cfe-commits

  Differential Revision: https://reviews.llvm.org/D49754
2019-09-19 19:42:59 +00:00
Dimitry Andric
2ee8a62f0f Partially undo r351659, which unconditionally removed gets(3) from libc++.
Instead, pull in r371324 from upstream libc++ trunk (by me):

  Remove ::gets for FreeBSD 13 and later

  Summary:

  In https://svnweb.freebsd.org/changeset/base/351659 @emaste removed
  gets() from FreeBSD 13's libc, and our copies of libc++ and
  libstdc++.  In that change, the declarations were simply deleted, but
  I would like to propose this conditional test instead.

  Reviewers: EricWF, mclow.lists, emaste

  Reviewed By: mclow.lists

  Subscribers: krytarowski, christof, ldionne, emaste, libcxx-commits

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

This makes these changes more MFCable.
2019-09-19 19:39:34 +00:00
Dimitry Andric
0f80acb965 Merge ^/head r352436 through r352536. 2019-09-19 19:26:12 +00:00
Dimitry Andric
7fc776a827 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb, and openmp
release 9.0.0 r372316, and update version numbers.
2019-09-19 19:25:01 +00:00
Konstantin Belousov
0edc114ac0 realloc(x, 0) should not return NULL.
See http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400.
Upstream jemalloc issue is opened by emaste at
https://github.com/jemalloc/jemalloc/issues/1629.

Reviewed by:	emaste
PR:	240456
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
DIfferential revision:	https://reviews.freebsd.org/D21632
2019-09-17 18:36:29 +00:00
Li-Wen Hsu
7b2f790200 Temporarily skip flakey test case lib.libc.sys.stat_test.stat_socket
PR:		240621
Sponsored by:	The FreeBSD Foundation
2019-09-17 14:08:09 +00:00
Dimitry Andric
c0f37bf652 Fix arm and aarch64 builds of libedit after r352275
On arm and arm64, where chars are unsigned by default, buildworld dies
with:

--- terminal.o ---
/usr/src/contrib/libedit/terminal.c:569:41: error: comparison of
integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
'unsigned int') [-Werror,-Wsign-compare]
                                     el->el_cursor.v][where & 0370] !=
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/src/contrib/libedit/terminal.c:659:28: error: comparison of
integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
'unsigned int') [-Werror,-Wsign-compare]
                                     [el->el_cursor.h] == MB_FILL_CHAR)
                                     ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~

Fix this by making MB_FILL_CHAR a wint_t, so no casting is needed.

Note that in https://reviews.freebsd.org/D21584 this was also proposed
by Yuichiro Naito <naito.yuichiro_gmail.com>.

Reviewed by:	bapt
Subscribers:	naito.yuichiro_gmail.com, ml_vishwin.info
MFC after:	3 weeks
X-MFC-With:	r352275
Differential Revision: https://reviews.freebsd.org/D21657
2019-09-14 21:49:42 +00:00
Dimitry Andric
c950e61287 Work around gcc's inability to compile an incomplete type in googletest,
leading to hundreds of lines of fairly unreadable error messages.

I don't think we particularly care about the specific source file gcc
dies on, and the many layers of macros and sub-types in googletest make
it very hard to diagnose whether this is a bug in googletest, gcc, clang
or libc++.
2019-09-14 19:19:38 +00:00
Dimitry Andric
ceb19815c7 Revert commit from upstream llvm trunk (by Hans Wennborg):
Re-commit r357452 (take 3): "SimplifyCFG
  SinkCommonCodeFromPredecessors: Also sink function calls without used
  results (PR41259)"

  Third time's the charm.

  This was reverted in r363220 due to being suspected of an internal
  benchmark regression and a test failure, none of which turned out to
  be caused by this.

As reported in https://bugs.llvm.org/show_bug.cgi?id=43269, this causes
UNREACHABLE errors when compiling if_malo_pci.c for arm and aarch64.
2019-09-14 10:55:33 +00:00
Dimitry Andric
c0035c9efc Apply tentative fix for libedit build error on arm. 2019-09-14 10:51:18 +00:00
Dimitry Andric
61c1328eb0 Merge ^/head r352105 through r352307. 2019-09-13 21:15:01 +00:00
Dimitry Andric
7b01d357a2 Include <stdint.h> in unwind-arm.h, since it uses uint32_t and uint64_t
in various declarations.

Otherwise, depending on how unwind-arm.h is included from other source
files, the compiler may complain that uint32_t and uint64_t are unknown
types.

MFC after:	3 days
2019-09-13 21:00:19 +00:00
Bryan Drewery
62a4b30239 mtree -O: Fix not descending on hash collisions
MFC after:	2 weeks
Obtained from:	NetBSD (nakayama)
2019-09-12 20:46:46 +00:00
Bryan Drewery
09c9ed3b05 mtree -c: Fix username logic when getlogin(3) fails.
Obtained from:	NetBSD (Credit to Sascha Wildner with DragonFlyBSD)
MFC after:	2 weeks
2019-09-12 18:51:59 +00:00
Bryan Drewery
4f4b548b1d mtree: Fix -f -f not considering type changes.
This only lists the changed type and not other attributes so that it
matches the behavior of -C as done in r66747 for fmtree. The NetBSD
-ff implementation was copied from fmtree.

Reviewed by:	imp
MFC after:	2 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D21623
2019-09-12 18:44:48 +00:00
Baptiste Daroussin
d3a4d55866 Remove usesless readline compat includes which will reinclude readline.h
itself.

This simplifies the upcoming update to newer libedit.
2019-09-12 08:54:48 +00:00
Philip Paeps
798c0c0b01 Import tzdata 2019c
Changes: https://github.com/eggert/tz/blob/2019c/NEWS

MFC after:	3 days
2019-09-12 00:19:16 +00:00
Li-Wen Hsu
dfcf2d87dd Only skip problematic test in CI env.
PR:		237450
Sponsored by:	The FreeBSD Foundation
2019-09-11 18:40:05 +00:00
Baptiste Daroussin
96c81c97e4 Readd _el_fn_sh_complete for backward compatibility
This function is not needed anymore, it allows old sh binary to continue
to run and avoid breaking backward compatibility.
Note that is now just calls the regular _el_fn_complete which does a proper
job at quoting.

Discussed with:	jilles
2019-09-11 07:03:17 +00:00
Baptiste Daroussin
d0ef721ed3 Import libedit 2019-09-10
Compared to current version in base:
- great improvements on the Unicode support
- full support for filename completion including quoting
  which means we do not need anymore our custom addition)
- Improved readline compatiblity

Upgrading libedit has been a pain in the past, because somehow we never
managed to properly cleanup the tree in lib/libedit and each merge has always
been very painful. After years of fighting give up and refresh a merge from
scrarch properly in contrib.

Note that the switch to this version will be done in another commit.
2019-09-10 14:30:10 +00:00
Dimitry Andric
f993ed2fbd Merge ^/head r351732 through r352104. 2019-09-09 19:58:46 +00:00
Ed Maste
057a14dafb compiler-rt: use 64-bit time_t for all FreeBSD archs except i386
Obtained from:	LLVM r370756
2019-09-09 18:33:15 +00:00
Ed Maste
af3c40982c compiler-rt: use more __sanitizer_time_t on FreeBSD
A few structs were using long for time_t members.

Obtained from:	LLVM r370755
2019-09-09 18:32:29 +00:00
Dimitry Andric
c0e18e70bd Target i586 by default on the i386 architecture, since after upstream's
change https://reviews.llvm.org/rL356631 ("[X86] Add CMPXCHG8B feature
flag. Set it for all CPUs except i386/i486 including 'generic'. Disable
use of CMPXCHG8B when this flag isn't set"), clang now correctly emits
calls to __atomic_load_8, __atomic_store_8, etc. when targeting i486,
and this means we can no longer link most modern programs, because we do
not have a libatomic, nor support for atomic functions in libc.  See
also PR 230888, 220822, 233725, 234976, and more probably duplicates.

Note that in practice, clang has been incorrectly generating cmpxchg8b
instructions for years now, when targeting i486.  So de facto nothing
really changes by doing this.
2019-09-08 10:31:34 +00:00
Dimitry Andric
e2d4fd9739 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb, and openmp
release_90 branch r371301, and update version numbers.
2019-09-07 12:31:36 +00:00
Dimitry Andric
617ea2e6c8 Pull in r370426 from upstream llvm trunk (by Fāng-ruì Sòng):
[PPC32] Emit R_PPC_GOT_TPREL16 instead R_PPC_GOT_TPREL16_LO

  Unlike ppc64, which has ADDISgotTprelHA+LDgotTprelL pairs, ppc32 just
  uses LDgotTprelL32, so it does not make lots of sense to use _LO
  without a paired _HA.

  Emit R_PPC_GOT_TPREL16 instead R_PPC_GOT_TPREL16_LO to match GCC, and
  get better linker relocation check. Note, R_PPC_GOT_TPREL16_{HA,LO}
  don't have good linker support:

  (a) lld does not support R_PPC_GOT_TPREL16_{HA,LO}.
  (b) Top of tree ld.bfd does not support R_PPC_GOT_REL16_HA
      Initial-Exec -> Local-Exec relaxation:

    // a.o
    addis 3, 3, tsd_tls@got@tprel@ha
    lwz 3, tsd_tls@got@tprel@l(3)
    add 3, 3, tsd_tls@tls
    // b.o
    .section .tdata,"awT"; .globl tsd_tls; tsd_tls:

    // ld/ld-new a.o b.o
    internal error, aborting at ../../bfd/elf32-ppc.c:7952 in
    ppc_elf_relocate_section

  Reviewed By: adalava

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

This allows use of LLD for linking 32-bit static binaries on
FreeBSD/powerpc.

Submitted by:	Alfredo Dal'Ava Júnior <alfredo.junior@eldorado.org.br>
2019-09-07 12:23:57 +00:00
Dimitry Andric
211f2e5c6b Pull in r371111 from upstream llvm trunk (by Eli Friedman):
[IfConversion] Fix diamond conversion with unanalyzable branches.

  The code was incorrectly counting the number of identical
  instructions, and therefore tried to predicate an instruction which
  should not have been predicated.  This could have various effects: a
  compiler crash, an assembler failure, a miscompile, or just
  generating an extra, unnecessary instruction.

  Instead of depending on TargetInstrInfo::removeBranch, which only
  works on analyzable branches, just remove all branch instructions.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=43121 and
  https://bugs.llvm.org/show_bug.cgi?id=41121 .

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

This should fix "Unable to predicate BX killed renamable $r0" errors
when building the lang/spidermonkey170 and lang/spidermonkey38 ports for
armv7 and armv6.

PR:		236567
MFC after:	3 days
2019-09-06 16:06:37 +00:00
Dimitry Andric
fec2a7b242 Catch up our non-upstreamed riscv parts in libunwind:
* DEFINE_LIBUNWIND_PRIVATE_FUNCTION changed into
  DEFINE_LIBUNWIND_FUNCTION
* unw_getcontext changed into __unw_getcontext
2019-09-05 18:47:58 +00:00
Dimitry Andric
24ea14660b Pull in r369828 from upstream lld trunk (by Fāng-ruì Sòng):
[ELF] Align the first section of a PT_LOAD even if its type is
  SHT_NOBITS

  Reported at https://reviews.llvm.org/D64930#1642223

  If the only section of a PT_LOAD is a SHT_NOBITS section (e.g. .bss),
  we may not align its sh_offset. p_offset of the PT_LOAD will be set
  to sh_offset, and we will get p_offset!=p_vaddr (mod p_align).  If
  such executable is mapped by the Linux kernel, it will segfault.

  After D64906, this may happen the non-linker script case.

  The linker script case has had this issue for a long time.  This was
  fixed by rL321657 (but the test linkerscript/nobits-offset.s failed
  to test a SHT_NOBITS section), but broken by rL345154.

  Reviewed By: peter.smith

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

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

  Align output segments correctly

  Previously, segments were aligned according to their first section's
  alignment requirements. That was not correct, but segments are also
  aligned to a page boundary, and a page boundary is usually much
  larger than a section alignment requirement, so no one noticed this
  bug before.

  Now, lld has --nmagic option which sets maxPageSize to 1 to
  effectively disable page alignment, which reveals the issue.

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

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

Together, these should ensure gpboot.out gets a correctly aligned offset
for its .rodata section, and fix "layout constraint violation" errors
from objcopy.
2019-09-05 17:53:41 +00:00
Dimitry Andric
c5c3ba6b43 Merge ^/head r351317 through r351731. 2019-09-03 05:58:43 +00:00
Dimitry Andric
6a82ac86f0 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb, and openmp
release_90 branch r370514, and update version numbers.
2019-09-02 17:55:39 +00:00
Dimitry Andric
22f75ae738 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb, and openmp
release_90 branch r369369, and update version numbers.
2019-09-02 17:32:57 +00:00
Ed Maste
aebac09b6f lldb: shorten thread names to make logs easier to follow
lldb prepends the thread name to log entries, and the existing thread
name for the FreeBSD ProcessMonitor thread was longer than the kernel's
supported thread name length, and so was truncated.  This made logs hard
to read, as the truncated thread name ran into the log message.  Shorten
"lldb.process.freebsd.operation" to just "freebsd.op" so that logs are
more readable.

(Upstreaming to lldb still to be done).
2019-09-01 16:50:34 +00:00
Ed Maste
da15a90df6 libstdc++: remove gets
Removed from libc in r351659
2019-09-01 16:41:24 +00:00
Ed Maste
7381dcc9ee libc: remove gets
gets is unsafe and shouldn't be used (for many years now).  Leave it in
the existing symbol version so anything that previously linked aginst it
still runs, but do not allow new software to link against it.

(The compatability/legacy implementation must not be static so that
the symbol and in particular the compat sym gets@FBSD_1.0 make it
into libc.)

PR:		222796 (exp-run)
Reported by:	Paul Vixie
Reviewed by:	allanjude, cy, eadler, gnn, jhb, kib, ngie (some earlier)
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12298
2019-09-01 16:12:05 +00:00
Dimitry Andric
302310d928 Update libunwind custom frame register and deregister functions for
FreeBSD: use the new doubly underscored names for unw_add_dynamic_fde
and unw_remove_dynamic_fde.

NOTE: this should be upstreamed...
2019-08-29 18:53:00 +00:00
Hiroki Sato
76d46bbb0e MFV r351553:
Fix a problem which prevented -OServerSSLOptions or -OClientSSLOptions
specified in the command-line option from working.

This patch has been accepted by the upstream.

Reviewed by and discussed with:	gshapiro
2019-08-27 20:11:45 +00:00
Dimitry Andric
5c1533a86d Disable UniversalMachO support in lldb's SystemInitializerFull.cpp,
since we do not need it.
2019-08-26 20:56:16 +00:00
Dimitry Andric
1f1d86b2b3 Update FREEBSD-Xlist for lldb. 2019-08-25 20:36:52 +00:00
Dimitry Andric
1771245355 Merge missed sources for lldb-specific TableGen tool. 2019-08-25 20:36:02 +00:00
Dimitry Andric
cbcf53de47 Merge openmp trunk r366426, resolve conflicts, and add FREEBSD-Xlist. 2019-08-22 20:26:20 +00:00
Dimitry Andric
d8053d0817 Merge libunwind trunk r366426, resolve conflicts, and add FREEBSD-Xlist. 2019-08-22 20:14:59 +00:00
Dimitry Andric
2f1cb2a6c9 Merge libc++ trunk r366426, resolve conflicts, and add FREEBSD-Xlist. 2019-08-22 19:49:51 +00:00
Dimitry Andric
14a0b2859e Merge compiler-rt trunk r366426, resolve conflicts, and add
FREEBSD-Xlist.
2019-08-22 19:26:11 +00:00
Dimitry Andric
580d4aa65a Merge lldb trunk r366426, resolve conflicts, and update FREEBSD-Xlist. 2019-08-22 19:14:02 +00:00
Cy Schubert
206b73d042 MFV r346563:
Update wpa 2.8 --> 2.9

hostapd:
* SAE changes
  - disable use of groups using Brainpool curves
  - improved protection against side channel attacks
  [https://w1.fi/security/2019-6/]
* EAP-pwd changes
  - disable use of groups using Brainpool curves
  - improved protection against side channel attacks
  [https://w1.fi/security/2019-6/]
* fixed FT-EAP initial mobility domain association using PMKSA caching
* added configuration of airtime policy
* fixed FILS to and RSNE into (Re)Association Response frames
* fixed DPP bootstrapping URI parser of channel list
* added support for regulatory WMM limitation (for ETSI)
* added support for MACsec Key Agreement using IEEE 802.1X/PSK
* added experimental support for EAP-TEAP server (RFC 7170)
* added experimental support for EAP-TLS server with TLS v1.3
* added support for two server certificates/keys (RSA/ECC)
* added AKMSuiteSelector into "STA <addr>" control interface data to
  determine with AKM was used for an association
* added eap_sim_id parameter to allow EAP-SIM/AKA server pseudonym and
  fast reauthentication use to be disabled
* fixed an ECDH operation corner case with OpenSSL

wpa_supplicant:
* SAE changes
  - disable use of groups using Brainpool curves
  - improved protection against side channel attacks
  [https://w1.fi/security/2019-6/]
* EAP-pwd changes
  - disable use of groups using Brainpool curves
  - allow the set of groups to be configured (eap_pwd_groups)
  - improved protection against side channel attacks
  [https://w1.fi/security/2019-6/]
* fixed FT-EAP initial mobility domain association using PMKSA caching
  (disabled by default for backwards compatibility; can be enabled
  with ft_eap_pmksa_caching=1)
* fixed a regression in OpenSSL 1.1+ engine loading
* added validation of RSNE in (Re)Association Response frames
* fixed DPP bootstrapping URI parser of channel list
* extended EAP-SIM/AKA fast re-authentication to allow use with FILS
* extended ca_cert_blob to support PEM format
* improved robustness of P2P Action frame scheduling
* added support for EAP-SIM/AKA using anonymous@realm identity
* fixed Hotspot 2.0 credential selection based on roaming consortium
  to ignore credentials without a specific EAP method
* added experimental support for EAP-TEAP peer (RFC 7170)
* added experimental support for EAP-TLS peer with TLS v1.3
* fixed a regression in WMM parameter configuration for a TDLS peer
* fixed a regression in operation with drivers that offload 802.1X
  4-way handshake
* fixed an ECDH operation corner case with OpenSSL

MFC after:	1 week
Security:	https://w1.fi/security/2019-6/\
		sae-eap-pwd-side-channel-attack-update.txt
2019-08-22 18:52:30 +00:00
Dimitry Andric
22d1794578 Merge lld trunk r366426, and resolve conflicts. 2019-08-21 20:44:42 +00:00
Dimitry Andric
e123fc8fd8 Merge clang trunk r366426, resolve conflicts, and update FREEBSD-Xlist. 2019-08-21 19:57:54 +00:00
Dimitry Andric
54db30ce18 Merge llvm trunk r366426, resolve conflicts, and update FREEBSD-Xlist. 2019-08-21 18:13:02 +00:00
Dimitry Andric
51ff47d7a5 Pull in r368867 from upstream libc++ trunk (by Marshall Clow):
Rework recursive_timed_mutex so that it uses __thread_id instead of
  using the lower-level __libcpp_thread_id. This is prep for fixing
  PR42918. Reviewed as https://reviews.llvm.org/D65895

Pull in r368916 from upstream libc++ trunk (by Marshall Clow):

  Fix thread comparison by making sure we never pass our special 'not a
  thread' value to the underlying implementation. Fixes PR#42918.

This should fix std:🧵🆔:operator==() attempting to call
pthread_equal(3) with zero values.

Reported by:	andrew@tao11.riddles.org.uk
PR:		239038, 239550
MFC after:	3 days
2019-08-20 17:39:32 +00:00
Eric van Gyzen
dc26651a96 Update pthread_cond_timedwait() test to current NetBSD
NetBSD adapted and committed our r350620.  Update to their version 1.8.

Reviewed by:	ngie
Obtained from:	NetBSD
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D21279
2019-08-16 13:10:08 +00:00
Ed Maste
83129c0b65 telnet: remove 3rd clause from Berkeley copyrights
Per the July 22, 1999 letter (in /COPYRIGHT) from
William Hoskins
Director, Office of Technology Licensing
University of California, Berkeley

MFC after:	1 week
2019-08-15 13:27:57 +00:00
Xin LI
51f61fc0c7 Upgrade to Bzip2 version 1.0.8.
MFC after:	3 days
2019-08-11 06:26:03 +00:00
Mark Johnston
bbce101753 Merge r3780 from elftoolchain.
Adjust argc and argv by optind before using them.  This slightly
simplifies the code.  No functional change intended.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21079
2019-08-07 16:22:25 +00:00
Mark Johnston
1966967151 readelf: Close input files when done with them.
The low fd limit used by poudriere exposed an odd failure mode in
cap_fileargs (used by readelf as of r350516).  In particular, when
the limit was hit, both the main process and casper service would
block on their shared socket, waiting forever for the other to send a
message.

Reported by:	zeising
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2019-08-07 03:14:45 +00:00
Ed Maste
54e9e4e72d bsnmp: add asn1 message length validation
admbugs:	780
Submitted by:	Guido Vranken, bz
Reported by:	Guido Vranken
Security:	CVE-2019-5610
2019-08-06 16:09:06 +00:00
Eric van Gyzen
e48c002fa4 Relax time constraint in pthread_cond_timedwait unit test
pthread_cond_timedwait() should wait _at least_ until the timeout,
but it might appear to wait longer due to system activity and
scheduling.  The test ignored fractional seconds when comparing the
actual and expected timeouts, so it allowed anywhere between zero
and one extra second of wait time.  Zero is a bit unreasonable.
Compare fractional seconds so we always allow up to one extra second.

Reviewed by:	ngie
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2019-08-05 22:59:35 +00:00
Ed Maste
7959685201 as: add deprecation notice to the man page
In the future FreeBSD will ship without GNU binutils 2.17.50.  Add a
note advising users who require GNU as to install the binutils port
or package.

Note that on armv7, arm64, amd64, i386 we currently ship only two
binutils tools (as and objdump).  A deprecation notice was added to
objdump's man page some time ago.

PR:		233611
Discussed with:	jhb
MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2019-08-01 19:01:27 +00:00
Mark Johnston
1033464925 Capsicumize size(1).
Reviewed by:	oshogbo
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21105
2019-08-01 18:57:37 +00:00
Mark Johnston
802c2095b5 Capsicumize readelf(1).
Reviewed by:	oshogbo
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21108
2019-08-01 18:57:08 +00:00
Mark Johnston
1d954fed61 Capsicumize addr2line(1).
Reviewed by:	oshogbo
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21104
2019-08-01 18:56:32 +00:00
Ed Maste
14a345d921 readelf: decode NT_GNU_PROPERTY_TYPE_0 / GNU_PROPERTY_X86_FEATURE_1_AND
These bits are used for Intel CET IBT/Shadow Stack.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20516
2019-08-01 17:59:56 +00:00
Ed Maste
840dff46ae objdump: be explicit that GNU objdump that will be removed
We may install llvm-objdump as objdump (see review D18307) or just
provide no /usr/bin/objdump, but either way GNU objdump won't be
installed in the future.

MFC after:	3 days
2019-08-01 14:42:41 +00:00
Ed Maste
deffed6ea2 telnet: use asprintf for r349890 change
Suggested by:	imp
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
2019-08-01 13:46:04 +00:00
Leandro Lupori
1153929465 [PPC64] Backport fix for missing IRELATIVE relocations
This is a backport of LLVM commit 8331f61a51a7a0a1efbf5ed398e181593023d151,
llvm-svn: 353981:

ELF: Allow GOT relocs pointing to non-preemptable ifunc to resolve to an
IRELATIVE where possible.

This is needed in order to make ifuncs work correctly on PPC64.

It fixes an issue with lld, in which it would skip emitting necessary IRELATIVE
relocations.  Without this change, indirect calls to ifuncs would result in a
segmentation fault, in static binaries or when defined in the main binary
(outside shared libraries).

This change also reverts the local
"Preserve relocations against ifuncs when -zifunc-noplt" commit and
replaces it by its upstream version, as part of the merge.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D21102
2019-07-31 16:22:05 +00:00
Mark Johnston
36d7818975 Merge r3778 and r3779 from ELFToolchain.
Modify strip(1) to not accept multiple input files when an output
file is specified.  There is no good way to handle this combination,
and the change is compatible with binutils.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-07-29 22:07:43 +00:00
Dimitry Andric
ba9b2ede8a Pull in r366369 from upstream llvm trunk (by Francis Visoiu Mistrih):
[CodeGen][NFC] Simplify checks for stack protector index checking

  Use `hasStackProtectorIndex()` instead of `getStackProtectorIndex()
  >= 0`.

Pull in r366371 from upstream llvm trunk (by Francis Visoiu Mistrih):

  [PEI] Don't re-allocate a pre-allocated stack protector slot

  The LocalStackSlotPass pre-allocates a stack protector and makes sure
  that it comes before the local variables on the stack.

  We need to make sure that later during PEI we don't re-allocate a new
  stack protector slot. If that happens, the new stack protector slot
  will end up being **after** the local variables that it should be
  protecting.

  Therefore, we would have two slots assigned for two different stack
  protectors, one at the top of the stack, and one at the bottom. Since
  PEI will overwrite the assigned slot for the stack protector, the
  load that is used to compare the value of the stack protector will
  use the slot assigned by PEI, which is wrong.

  For this, we need to check if the object is pre-allocated, and re-use
  that pre-allocated slot.

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

Pull in r367068 from upstream llvm trunk (by Francis Visoiu Mistrih):

  [CodeGen] Don't resolve the stack protector frame accesses until PEI

  Currently, stack protector loads and stores are resolved during
  LocalStackSlotAllocation (if the pass needs to run). When this is the
  case, the base register assigned to the frame access is going to be
  one of the vregs created during LocalStackSlotAllocation. This means
  that we are keeping a pointer to the stack protector slot, and we're
  using this pointer to load and store to it.

  In case register pressure goes up, we may end up spilling this
  pointer to the stack, which can be a security concern.

  Instead, leave it to PEI to resolve the frame accesses. In order to
  do that, we make all stack protector accesses go through frame index
  operands, then PEI will resolve this using an offset from sp/fp/bp.

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

Together, these fix a issue where the stack protection feature in LLVM's
ARM backend can be rendered ineffective when the stack protector slot is
re-allocated so that it appears after the local variables that it is
meant to protect, leaving the function potentially vulnerable to a
stack-based buffer overflow.

Reported by:	andrew
Security:	https://kb.cert.org/vuls/id/129209/
MFC after:	3 days
2019-07-26 18:49:20 +00:00
Dimitry Andric
e91d723ad4 Merge libcxxrt master f96846efbfd508f66d91fcbbef5dd808947c7f6d.
Interesting fixes:
f96846e Fix std::size_t -> size_t to unbreak build against libc++ 6.0.0
6f4cfa2 Fix the uncaught exception count with rethrowing (PR 239265)
db54f53 Added C++14-specific operator delete (#47)

PR:		239265
MFC after:	3 days
2019-07-26 16:55:06 +00:00
Baptiste Daroussin
45a5aec3f1 Update mandoc to cvs snapshot 2019-07-23
This snapshot among other things includes a fix for a crash of mandoc with empty
tbl reported by rea@ (his regression test has been incorporated upstream)

MFC after:	3 weeks
2019-07-26 10:00:33 +00:00
Li-Wen Hsu
7e37c475fa Temporarily skip lib.libc.regex.exhaust_test.regcomp_too_big and
lib.libregex.exhaust_test.regcomp_too_big on i386 as they are flakey on it

PR:		237450
Sponsored by:	The FreeBSD Foundation
2019-07-22 18:42:55 +00:00
Dimitry Andric
87c8ef55c3 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
8.0.1 final release r366581.  The only functional change is a fix for a
mismerge of upstream r360816, which properly restores the r2 register
when unwinding on PowerPC64 (See https://reviews.freebsd.org/D20337).

Relnotes:	yes
PR:		236062
MFC after:	3 days
X-MFC-With:	r349004
2019-07-20 15:26:21 +00:00
Cy Schubert
5f34d83b8c MFV r350080:
Update sqlite3-3.28.0 (3280000) --> sqlite3-3.29.0 (3290000)

MFC after:	1 week
2019-07-18 00:27:28 +00:00
Brooks Davis
1011a4fe27 Remove a duplicate global (rfc931_timeout).
It is declared here and in rfc931.c and unused here so keep that copy
and discard this one.

Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA, AFRL
2019-07-17 23:43:14 +00:00
Brooks Davis
7d2d393c25 Use headers instead of manual declerations of standard functions and
variables.
2019-07-17 23:36:36 +00:00
Brooks Davis
068ad27de3 Use ANSI C function definitions and declerations.
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA, AFRL
2019-07-17 23:09:40 +00:00
Brooks Davis
1575a795cb Add missing mode in open(2) calls with O_CREAT.
When O_CREAT is specified, the third, variadic argument is
required as the permission. If on is not passed, then depending
on the ABI, either the contents of the third argument register
or some arbitrary stuff on the stack will be used as the permission.

This has been merged to NetBSD.

Reviewed by:	asomers, ngie
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D20972
2019-07-16 22:27:49 +00:00
Brooks Davis
a74dca96a1 Fix two mismatches between function declaration and definition.
In both cases, function pointer arguments were inconsistently declared
and the result worked because of C's odd rules around function pointer
(de)references.  With a stricter compiler these fail to compile.

Reviewed by:	cem
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D20964
2019-07-16 16:03:08 +00:00
Mariusz Zaborski
5eac9c1cb0 strings: extends rights
The libelf is using mmap if it can, if not it was fall backing to read.

Reported by:	markj
2019-07-16 04:17:25 +00:00
Mariusz Zaborski
5ff84ed38f strings: fix entering to the capability mode
Reported by:	markj
2019-07-16 03:32:21 +00:00
Dimitry Andric
f7e8f5d439 Pull in r365760 from upstream lld trunk (by Fangrui Song):
[ELF] Handle non-glob patterns before glob patterns in version
  scripts & fix a corner case of --dynamic-list

  This fixes PR38549, which is silently accepted by ld.bfd.
  This seems correct because it makes sense to let non-glob patterns
  take precedence over glob patterns.

  lld issues an error because
  `assignWildcardVersion(ver, VER_NDX_LOCAL);` is processed before
  `assignExactVersion(ver, v.id, v.name);`.

  Move all assignWildcardVersion() calls after assignExactVersion()
  calls to fix this.

  Also, move handleDynamicList() to the bottom. computeBinding() called
  by includeInDynsym() has this cryptic rule:

      if (versionId == VER_NDX_LOCAL && isDefined() && !isPreemptible)
	return STB_LOCAL;

  Before the change:

  * foo's version is set to VER_NDX_LOCAL due to `local: *`
  * handleDynamicList() is called
    - foo.computeBinding() is STB_LOCAL
    - foo.includeInDynsym() is false
    - foo.isPreemptible is not set (wrong)
  * foo's version is set to V1

  After the change:

  * foo's version is set to VER_NDX_LOCAL due to `local: *`
  * foo's version is set to V1
  * handleDynamicList() is called
    - foo.computeBinding() is STB_GLOBAL
    - foo.includeInDynsym() is true
    - foo.isPreemptible is set (correct)

  Reviewed By: ruiu

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

This makes it longer necessary to patch the version scripts for the
samba ports, to avoid "duplicate symbol 'pdb_search_init' in version
script" errors.

PR:		230602
MFC after:	3 days
2019-07-13 15:04:30 +00:00
Philip Paeps
6071f00ffe telnet: fix minor style violation
While here also fix a very unlikely NULL pointer dereference.

Submitted by:	Shawn Webb <shawn.webb@hardenedbsd.org>
2019-07-10 22:36:14 +00:00
Philip Paeps
e68ce1cc10 telnet: fix a couple of snprintf() buffer overflows
Obtained from:	Juniper Networks
MFC after:	1 week
2019-07-10 17:42:04 +00:00
Dimitry Andric
128c495e50 Apply a workaround to be able to build clang 8.0.0 headers with clang
3.4.1, which is still in the stable/10 branch.

It looks like clang 3.4.1 implements static_asserts by instantiating a
temporary static object, and if those are in an anonymous union, it
results in "error: anonymous union can only contain non-static data
members".

To work around this implementation limitation, move the static_asserts
in question out of the anonymous unions.

This should make building the latest stable/11 from stable/10 possible
again.

Reported by:	Mike Tancsa <mike@sentex.net>
MFC after:	3 days
2019-07-10 05:57:37 +00:00
Dimitry Andric
ec38f4f941 Upgrade our copies of clang, llvm, lld, lldb, compiler-rt, libc++,
libunwind and openmp to the upstream release_80 branch r364487
(effectively, 8.0.1 rc3).  The 8.0.1 release will most likely
have no further changes.

MFC after:	1 week
X-MFC-With:	r349004
2019-07-06 18:02:29 +00:00
Mark Johnston
0070b575f4 elfcopy: Clear errors after fetching the shstrtab index.
Otherwise a future call to elf_errno() will return a non-zero value.
update_shdr(), for example, treats any errors associated with the ELF
descriptor as fatal.  Clear the error per the first example in
elf_errmsg.3.

Convert to elf_getshdrstrndx() while here since elf_getshstrndx() is
apparently deprecated.

Reported by:	royger
Reviewed by:	emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20852
2019-07-04 15:07:19 +00:00
Dag-Erling Smørgrav
e86b909626 Upgrade Unbound to 1.9.2. 2019-07-04 08:40:10 +00:00
Philip Paeps
2865ab3fad Import tzdata 2019b
Changes: https://github.com/eggert/tz/blob/2019b/NEWS

MFC after:	1 day
2019-07-02 01:12:23 +00:00
Dimitry Andric
d80439b9b0 Pull in r360968 from upstream llvm trunk (by Philip Reames):
Clarify comments on helpers used by LFTR [NFC]

  I'm slowly wrapping my head around this code, and am making comment
  improvements where I can.

Pull in r360972 from upstream llvm trunk (by Philip Reames):

  [LFTR] Factor out a helper function for readability purpose [NFC]

Pull in r360976 from upstream llvm trunk (by Philip Reames):

  [IndVars] Don't reimplement Loop::isLoopInvariant [NFC]

  Using dominance vs a set membership check is indistinguishable from a
  compile time perspective, and the two queries return equivelent
  results.  Simplify code by using the existing function.

Pull in r360978 from upstream llvm trunk (by Philip Reames):

  [LFTR] Strengthen assertions in genLoopLimit [NFCI]

Pull in r362292 from upstream llvm trunk (by Nikita Popov):

  [IndVarSimplify] Fixup nowrap flags during LFTR (PR31181)

  Fix for https://bugs.llvm.org/show_bug.cgi?id=31181 and partial fix
  for LFTR poison handling issues in general.

  When LFTR moves a condition from pre-inc to post-inc, it may now
  depend on value that is poison due to nowrap flags. To avoid this, we
  clear any nowrap flag that SCEV cannot prove for the post-inc addrec.

  Additionally, LFTR may switch to a different IV that is dynamically
  dead and as such may be arbitrarily poison. This patch will correct
  nowrap flags in some but not all cases where this happens. This is
  related to the adoption of IR nowrap flags for the pre-inc addrec.
  (See some of the switch_to_different_iv tests, where flags are not
  dropped or insufficiently dropped.)

  Finally, there are likely similar issues with the handling of GEP
  inbounds, but we don't have a test case for this yet.

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

Pull in r362971 from upstream llvm trunk (by Philip Reames):

  Prepare for multi-exit LFTR [NFC]

  This change does the plumbing to wire an ExitingBB parameter through
  the LFTR implementation, and reorganizes the code to work in terms of
  a set of individual loop exits. Most of it is fairly obvious, but
  there's one key complexity which makes it worthy of consideration.
  The actual multi-exit LFTR patch is in D62625 for context.

  Specifically, it turns out the existing code uses the backedge taken
  count from before a IV is widened. Oddly, we can end up with a
  different (more expensive, but semantically equivelent) BE count for
  the loop when requerying after widening.  For the nestedIV example
  from elim-extend, we end up with the following BE counts:
  BEFORE: (-2 + (-1 * %innercount) + %limit)
  AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))<nsw>)

  This is the only test in tree which seems sensitive to this
  difference. The actual result of using the wider BETC on this example
  is that we actually produce slightly better code. :)

  In review, we decided to accept that test change.  This patch is
  structured to preserve the old behavior, but a separate change will
  immediate follow with the behavior change.  (I wanted it separate for
  problem attribution purposes.)

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

Pull in r362975 from upstream llvm trunk (by Philip Reames):

  [LFTR] Use recomputed BE count

  This was discussed as part of D62880.  The basic thought is that
  computing BE taken count after widening should produce (on average)
  an equally good backedge taken count as the one before widening.
  Since there's only one test in the suite which is impacted by this
  change, and it's essentially equivelent codegen, that seems to be a
  reasonable assertion.  This change was separated from r362971 so that
  if this turns out to be problematic, the triggering piece is obvious
  and easily revertable.

  For the nestedIV example from elim-extend.ll, we end up with the
  following BE counts:
  BEFORE: (-2 + (-1 * %innercount) + %limit)
  AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))<nsw>)

  Note that before is an i32 type, and the after is an i64.  Truncating
  the i64 produces the i32.

Pull in r362980 from upstream llvm trunk (by Philip Reames):

  Factor out a helper function for readability and reuse in a future
  patch [NFC]

Pull in r363613 from upstream llvm trunk (by Philip Reames):

  Fix a bug w/inbounds invalidation in LFTR (recommit)

  Recommit r363289 with a bug fix for crash identified in pr42279.
  Issue was that a loop exit test does not have to be an icmp, leading
  to a null dereference crash when new logic was exercised for that
  case.  Test case previously committed in r363601.

  Original commit comment follows:

  This contains fixes for two cases where we might invalidate inbounds
  and leave it stale in the IR (a miscompile). Case 1 is when switching
  to an IV with no dynamically live uses, and case 2 is when doing
  pre-to-post conversion on the same pointer type IV.

  The basic scheme used is to prove that using the given IV (pre or
  post increment forms) would have to already trigger UB on the path to
  the test we're modifying. As such, our potential UB triggering use
  does not change the semantics of the original program.

  As was pointed out in the review thread by Nikita, this is defending
  against a separate issue from the hasConcreteDef case. This is about
  poison, that's about undef. Unfortunately, the two are different, see
  Nikita's comment for a fuller explanation, he explains it well.

  (Note: I'm going to address Nikita's last style comment in a separate
  commit just to minimize chance of subtle bugs being introduced due to
  typos.)

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

Pull in r363875 from upstream llvm trunk (by Philip Reames):

  [LFTR] Rename variable to minimize confusion [NFC]

  (Recommit of r363293 which was reverted when a dependent patch was.)

  As pointed out by Nikita in D62625, BackedgeTakenCount is generally
  used to refer to the backedge taken count of the loop. A conditional
  backedge taken count - one which only applies if a particular exit is
  taken - is called a ExitCount in SCEV code, so be consistent here.

Pull in r363877 from upstream llvm trunk (by Philip Reames):

  [LFTR] Stylistic cleanup as suggested in last review comment of
  D62939 [NFC]

  (Resumbit of r363292 which was reverted along w/an earlier patch)

Pull in r364346 from upstream llvm trunk (by Philip Reames):

  [LFTR] Adjust debug output to include extensions (if any)

Pull in r364693 from upstream llvm trunk (by Philip Reames):

  [IndVars] Remove a bit of manual constant folding [NFC]

  SCEV is more than capable of folding (add x, trunc(0)) to x.

Pull in r364709 from upstream llvm trunk (by Nikita Popov):

  [LFTR] Fix post-inc pointer IV with truncated exit count (PR41998)

  Fixes https://bugs.llvm.org/show_bug.cgi?id=41998. Usually when we
  have a truncated exit count we'll truncate the IV when comparing
  against the limit, in which case exit count overflow in post-inc form
  doesn't matter. However, for pointer IVs we don't do that, so we have
  to be careful about incrementing the IV in the wide type.

  I'm fixing this by removing the IVCount variable (which was ExitCount
  or ExitCount+1) and replacing it with a UsePostInc flag, and then
  moving the actual limit adjustment to the individual cases (which
  are: pointer IV where we add to the wide type, integer IV where we
  add to the narrow type, and constant integer IV where we add to the
  wide type).

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

Together, these should fix a hang when building the textproc/htmldoc
port, due to an incorrect loop optimization.

PR:		237515
MFC after:	1 week
2019-07-01 21:06:10 +00:00
Alex Richardson
b46517aa7b Allow bootstrapping elftoolchain on MacOS and Linux
This is required in order to build on non-FreeBSD systems without setting
all the XAR/XSTRINGS/etc. variables

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D16771
2019-07-01 11:52:54 +00:00
Mitchell Horne
1a0c2201f6 readelf: Add RISC-V DWARF register aliases
This allows DWARF debugging output to use the common register
mneumonics, such as ra, sp, or t0.

DWARF registers 0-31 are mapped to the 32 general purpose registers,
which are then followed by the 32 floating point registers.

Reviewed by:	markj
Approved by:	markj (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D20779
2019-06-30 19:47:15 +00:00
Mitchell Horne
5bb13a0b50 elftoolchain: fix an incorrect e_flags description
r349482 introduced the definitions and descriptions of the RISC-V
specific e_flags values to elftoolchain. However, the description for
the EF_RISCV_RVE flag was incorrectly duplicated from EF_RISCV_RVC. Fix
this by providing the proper description for this flag.

Reported by:	jhb
Approved by:	markj (mentor)
2019-06-30 19:43:13 +00:00
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