Commit Graph

8969 Commits

Author SHA1 Message Date
Dimitry Andric
59948e95d8 Reapply r327026 (partially):
Merge lld trunk r321017 to contrib/llvm/tools/lld.

(Note that in this merge, I foolishly combined upstream changes with
this local change. But only this ifdef part is really needed, as we
always default to ELF link mode.)
2020-08-02 18:34:29 +00:00
Dimitry Andric
dd6565b7a6 Reapply r326600 (by imp):
Since this is contrib code, create an upstreamable version of my
change. Now on FreeBSD and NetBSD if _STANDALONE is defined, we
include the kernel version with alloances for the quirky differences
between the two.

Sponsored by: Netflix
2020-08-02 18:30:29 +00:00
Dimitry Andric
fd28fec2f0 Reapply r322168 (partially, by br):
o Replace __riscv__ with __riscv
o Replace __riscv64 with (__riscv && __riscv_xlen == 64)

This is required to support new GCC 7.1 compiler.
This is compatible with current GCC 6.1 compiler.

RISC-V is extensible ISA and the idea here is to have built-in define
per each extension, so together with __riscv we will have some subset
of these as well (depending on -march string passed to compiler):

__riscv_compressed
__riscv_atomic
__riscv_mul
__riscv_div
__riscv_muldiv
__riscv_fdiv
__riscv_fsqrt
__riscv_float_abi_soft
__riscv_float_abi_single
__riscv_float_abi_double
__riscv_cmodel_medlow
__riscv_cmodel_medany
__riscv_cmodel_pic
__riscv_xlen

Reviewed by:	ngie
Sponsored by:	DARPA, AFRL

Differential Revision:	https://reviews.freebsd.org/D11901
2020-08-02 18:27:59 +00:00
Dimitry Andric
cfe333b850 Reapply r311165:
Disable PDB support in LLVMSymbolizer for now, to avoid llvm-objdump
pulling in all the PDB handling code.
2020-08-02 18:18:16 +00:00
Dimitry Andric
f824666886 Reapply r311164:
Fix printf format warning on i386.
2020-08-02 18:16:04 +00:00
Dimitry Andric
9f287522ce Reapply r310365 (by emaste):
libunwind: make __{de,}register_frame compatible with libgcc API

The libgcc __register_frame and __deregister_frame functions take a
pointer to a set of FDE/CIEs, terminated by an entry where length is 0.

In Apple's libunwind implementation the pointer is taken to be to a
single FDE. I suspect this was just an Apple bug, compensated by Apple-
specific code in LLVM.

See lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp and
http://lists.llvm.org/pipermail/llvm-dev/2013-April/061737.html
for more detail.

This change is based on the LLVM RTDyldMemoryManager.cpp. It should
later be changed to be alignment-safe.

Reported by:	dim
Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8869

Reapply r351610:

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...
2020-08-02 18:12:14 +00:00
Dimitry Andric
71daeec70a Reapply r230021, r276851 and a few other commits to compiler-rt
Reapply r230021 (by ed):

Add a workaround to prevent endless recursion in compiler-rt.

SPARC and MIPS CPUs don't have special instructions to count
leading/trailing zeroes. The compiler-rt library provides fallback
rountines for these. The 64-bit routines, __clzdi2 and __ctzdi2, are
implemented as simple wrappers around the compiler built-in
__builtin_clz(), assuming these will expand to either 32-bit
CPU instructions or calls to __clzsi2 and __ctzsi2.

Unfortunately, our GCC 4.2 probably thinks that because the operand is
stored in a 64-bit register, it might just be a better idea to invoke
its 64-bit equivalent, simply resulting into endless recursion. Fix this
by defining __builtin_clz and __builtin_ctz to __clzsi2 and __ctzsi2
explicitly.

Reapply r276851:

Update compiler-rt to trunk r224034.  This brings a number of new
builtins, and also the various sanitizers.  Support for these will be
added in a later commit.
2020-08-02 18:07:16 +00:00
Dimitry Andric
979e22ff1a Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-rc1-25-g903c872b169.
2020-07-31 22:23:32 +00:00
Dimitry Andric
590d96feea Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11-init-20933-g3c1fca803bc.
2020-07-31 21:43:56 +00:00
Dimitry Andric
5ffd83dbcc Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from
which release/11.x was branched.

Note that for now, I rolled back all our local changes to make merging
easier, and I will reapply the still-relevant ones after updating to
11.0.0-rc1.
2020-07-31 21:22:58 +00:00
Kyle Evans
adeebf4cd4 regex(3): Interpret many escaped ordinary characters as EESCAPE
In IEEE 1003.1-2008 [1] and earlier revisions, BRE/ERE grammar allows for
any character to be escaped, but "ORD_CHAR preceded by an unescaped
<backslash> character [gives undefined results]".

Historically, we've interpreted an escaped ordinary character as the
ordinary character itself. This becomes problematic when some extensions
give special meanings to an otherwise ordinary character
(e.g. GNU's \b, \s, \w), meaning we may have two different valid
interpretations of the same sequence.

To make this easier to deal with and given that the standard calls this
undefined, we should throw an error (EESCAPE) if we run into this scenario
to ease transition into a state where some escaped ordinaries are blessed
with a special meaning -- it will either error out or have extended
behavior, rather than have two entirely different versions of undefined
behavior that leave the consumer of regex(3) guessing as to what behavior
will be used or leaving them with false impressions.

This change bumps the symbol version of regcomp to FBSD_1.6 and provides the
old escape semantics for legacy applications, just in case one has an older
application that would immediately turn into a pumpkin because of an
extraneous escape that's embedded or otherwise critical to its operation.

This is the final piece needed before enhancing libregex with GNU extensions
and flipping the switch on bsdgrep.

[1] http://pubs.opengroup.org/onlinepubs/9699919799.2016edition/

PR:		229925 (exp-run, courtesy of antoine)
Differential Revision:	https://reviews.freebsd.org/D10510
2020-07-29 23:21:56 +00:00
Cy Schubert
12b2f3daaa Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after:	1 week
2020-07-29 19:36:24 +00:00
Christian S.J. Peron
3008333d44 Fixup some incorrect information and some comments. These changes
were cherry picked up the upstream OpenBSD repository. At some point we
will look at doing another import, but the diffs are substantial and will
require some careful testing.

Differential Revision:	https://reviews.freebsd.org/D25021
MFC after:	2 weeks
Submitted by:	gbe
Reviewed by:	myself, bcr
2020-07-28 20:06:16 +00:00
Cy Schubert
f0276e8c38 Document the IPFILTER_PREDEFINED environment variable.
PR:		248088
Reported by:	joeb1@a1poweruser.com
MFC after:	1 week
2020-07-23 17:39:49 +00:00
Craig Leres
c4cbf1fbab Fix some regressions with the zgrep(1) wrapper.
- Handle whitespace with long flags that take arguments:

	echo 'foo bar' > test
	zgrep --regexp='foo bar' test

 - Do not hang reading from stdin with patterns in a file:

	echo foobar > test
	echo foo > pattern
	zgrep -f pattern test
	zgrep --file=pattern test

 - Handle any flags after -e:

	echo foobar > test
	zgrep -e foo --ignore-case < test

These two are still outstanding problems:

 - Does not handle flags that take an argument if there is no
   whitespace:

	zgrep -enfs /etc/rpc

 - When more than one -e pattern used matching should occur for all
   patterns (similar to multiple patterns supplied with -f file).
   Instead only the last pattern is used for matching:

	zgrep -e rex -e nfs /etc/rpc

   (This problem is masked in the unpatched version by the "any
   flags after -e" problem.)

Add tests for the above problems.

Update the mange and add references to gzip(1) and zstd(1) and also
document the remaining known problems.

PR:		247126
Approved by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25613
2020-07-20 23:57:53 +00:00
Mark Johnston
f690eff983 libdwarf: Hide SHT_NOBITS sections.
gnu_debuglink external debug files will contain an .eh_frame section of
type SHT_NOBITS.  libdwarf does not handle such sections (or rather, it
expects all debug sections to not have type SHT_NOBITS).  Avoid loading
SHT_NOBITS sections, to be consistent with SGI libdwarf's handling of
this case.

PR:		239516
Diagnosed by:	Paco Pascal <me@pacopascal.com>
Reviewed by:	emaste (previous version)
Event:		July 2020 Bugathon
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25626
2020-07-20 18:22:38 +00:00
Cy Schubert
64a1886d5c -4 and -6 only make sense with -i, -o, and -t.
PR:		247952
MFC after:	1 week
2020-07-17 19:07:53 +00:00
Cy Schubert
ebdefe6cb4 The output from usage() need not contain usage for -t when STATETOP
is not compiled in.

PR:		247952
MFC after:	1 week
2020-07-17 19:07:50 +00:00
Cy Schubert
e082c89385 Make ipfstat -t header generic when IPv4 and IPv6 output are
displayed in the same display.

PR:		247952
MFC after:	1 week
2020-07-17 19:07:47 +00:00
Cy Schubert
08c24e2f88 ipfstat -t defaults to IPv4 output. Make consistent with ipfstat -i
and ipfstat -o where without an argument IPv4 and IPv6 states are
shown. Use -4 and -6 to limit the display to IPv4 or IPv6 respectively.

PR:		247952
MFC after:	1 week
2020-07-17 19:07:44 +00:00
Cy Schubert
88b86bb0f3 Historically ipfstat listings and stats only listed IPv4 or IPv6 output.
ipfstat would list IPv4 outputs by default while -6 would produce IPv6
outputs. This commit combines the ipfstat -i and -o outputs into one
listing of IPv4 and IPv6 rules. The -4 option lists only IPv4 rules
(as the default before) while -6 continues to list only rules that affect
IPv6.

PR:		247952
Reported by:	joeb1@a1poweruser.com
MFC after:	1 week
2020-07-17 19:07:40 +00:00
Cy Schubert
5317660176 fr_family (the protocol family) must be AF_INET or AF_INET6, as in
the kernel, not an arbitrary 4 or 6.

This only affected printing ipfilter stats and rules from a kernel
dump. (This is currently undocumented.)

PR:		247952
MFC after:	1 week
2020-07-17 19:07:37 +00:00
Cy Schubert
ce1c2aafce Only use the use_inet6 variable when INET6 is a build option.
This is a prerequisite to upcoming argument processing cleanups which
will resolve consistency as was done with ippool previously.

PR:		247952
MFC after:	1 week
2020-07-17 19:07:34 +00:00
Gregory Neil Shapiro
5b0945b570 Merge sendmail 8.16.1 to HEAD: See contrib/sendmail/RELEASE_NOTES for details
Includes build infrastructure & config updates required for changes in 8.16.1

MFC after:	5 days
2020-07-15 18:28:54 +00:00
Eric van Gyzen
8ca1ed33ec Fix style in r363220
Apply the style change Kostik suggested in the review.

Reported by:	kib
MFC after:	2 weeks
X-MFC with:	r363220
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D25676
2020-07-15 13:26:15 +00:00
Eric van Gyzen
d13def78cc Fix Coverity issues in OFED
read_ibdiag_config NULL deref
read_ibdiag_config mem leak
ib_mad_inv_field_str Missing comma in a string array initialization
print_node_header NULL deref
diff_node_ports copy-paste error
ibportstate.c main() missing break in switch
set_thresholds NULL ptr deref
dump_unicast_tables leaks mapnd
umad_cm_attr_str dead code
__ibv_close_device close(-1)
check return value of listen()
mlx5 bitmap.h - bad bit shift - UB
get_dst_addr check return value of inet_pton
osm_perfmgr_init check return value of cl_spinlock_init
osm_port_new memory leak on error path
sa_mad_ctrl_rcv_callback missing break in switch case

I did not include CID numbers because these were found by an internal
run at Isilon.

Reviewed by:	cem kib
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D25676
2020-07-15 13:17:16 +00:00
Jung-uk Kim
be495738e4 Remove a redundant file from test directory to unbreak yacc regression test.
It looks like the obsolete file from old regression test was accidentally
re-added between version 20170709 and 20180510.

Reported by:	lwhsu
2020-07-14 23:59:00 +00:00
Gregory Neil Shapiro
cee0d44ab3 Import sendmail 8.16.1 2020-07-14 21:40:53 +00:00
Gordon Bergling
189ae32695 Revert r362809: Mention FreeBSD in the HISTORY sections of apropos(1) and makewhatis(8).
We don't mention the first appearance of a utility in FreeBSD, when it first
appeared in a BSD version that predates FreeBSD.

PR:		223520, 223521
Reported by:	rgrimes, imp
Reviewed by:	bcr (mentor)
Approved by:	bcr (mentor)
Differential Revision:	https://reviews.freebsd.org/D25521
2020-07-14 12:02:30 +00:00
Adrian Chadd
14679cb2f3 [bc] Fix a "maybe uninitialized" compiler warning under mips-gcc-6.3.0.
I guess this didn't like the case statements.. ? But this does quieten
the compiler error.
2020-07-14 05:02:18 +00:00
Adrian Chadd
85c9048573 [flex] Fix compilation issue under mips-gcc-6.4
This was triggering a pointer-losing-constness error.
2020-07-14 05:00:08 +00:00
Jung-uk Kim
b53bb29fed MFV: r362513
Update byacc to 20200330.
2020-07-14 01:54:24 +00:00
Simon J. Gerraty
3841c28717 Update to bmake-20200710
Key changes include reduced noise at end of failed build log
and avoid evaluation of unnecessary terms in conditionals.
In META MODE; a target flagged .META is out-of-date if meta file
is missing

MFC after:      1 week
2020-07-12 01:11:48 +00:00
Stefan Eßer
cf7becd216 Update to version 3.1.3
This version fixes the following evaluation, which lead to a parse error:

     echo "if (1 < 3) 1" | bc
2020-07-11 07:33:18 +00:00
Mark Johnston
5c346ead18 Adjust .Dd, missed in r363084.
MFC with:	r363084
2020-07-10 19:58:07 +00:00
Mark Johnston
d041589227 Add a --sctp flag to nc.
The change adds an SCTP mode akin to UDP mode.  This is handy for doing
smoke testing of SCTP.

Use a long option to minimize the risk of option conflicts with OpenBSD.
For bonus points, this change unbreaks --no-tcpopt by adding a missing
case required by getopt_long().

Reviewed by:	delphij, tuexen
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25610
2020-07-10 19:54:04 +00:00
Simon J. Gerraty
9093286b6a Revert r363031 2020-07-09 03:46:07 +00:00
Simon J. Gerraty
2d147b4741 Update to bmake-20200704
Key changes include reduced noise at end of failed build log
and avoid evaluation of unnecessary terms in conditionals.

MFC after:	1 week
2020-07-08 21:20:12 +00:00
Dimitry Andric
f13e619347 Merge commit 065fc1eafe7c from llvm git (by Richard Smith):
PR45521: Preserve the value kind when performing a standard
  conversion sequence on a glvalue expression.

  If the sequence is supposed to perform an lvalue-to-rvalue
  conversion, then one will be specified as the first conversion in the
  sequence. Otherwise, one should not be invented.

This should fix clang crashing with "can't implicitly cast lvalue to
rvalue with this cast kind", followed by "UNREACHABLE executed at
/usr/src/contrib/llvm-project/clang/lib/Sema/Sema.cpp:538!", when
building recent versions of Ceph, and the CPAN module SYBER/Date-5.2.0.

Reported by:	Willem Jan Withagen <wjw@digiware.nl>, eserte12@yahoo.de
PR:		245530, 247812
MFC after:	3 days
2020-07-08 16:50:47 +00:00
Cy Schubert
3c67996ca9 MFV r362990:
Update sqlite to 3.32.3 (3320300).

Release Announcement:	https://www.sqlite.org/releaselog/3_32_3.html
See also:		ports r541414

PR:		247819
Reported by:	Pavel Volkov <pavelivolkov at gmail.com>
MFC after:	1 week
2020-07-07 19:09:38 +00:00
Stefan Eßer
3aa99676b4 Update to version 3.1.1
This version fixes a regression with regard to tradtional behavior of the
non-standard FreeBSD option "-e". In the previous version "-e quit" caused
bc to exit before any computations had been performed, since all -e option
parameters were concatenated and parsed as a whole, with quit causing the
program to exit as soon as it was parsed. This version parses and executes
commands passed with -e one by one and only exits after all prior commands
have been executed.

This commit is not a SVN merge, since the vendor import had been performed
after the import to contrib. Instead the contents of contrib/bc has been
removed and the new version is copied over unchanged from vendor/bc/dist.
2020-07-07 07:51:09 +00:00
Gordon Bergling
f9c7920eb1 Mention FreeBSD in the HISTORY sections of apropos(1) and makewhatis(8).
PR:	223520, 223521
Reviewed by:	bcr (mentor)
Approved by:	bcr (mentor)
Differential Revision:	https://reviews.freebsd.org/D25521
2020-06-30 18:08:59 +00:00
Ed Maste
4e22eafc99 Revert r362261, "Re-apply r333944 to unbreak ports"
A file update in 2018 broke many ports as it misidentified shared
libraries as PIE binaries.  r333944 reverted part of the change,
restoring ports builds but misidentifying objects in the opposite
direction.

Earlier this month file 5.39 was imported, and then the change
originally from r333944 was recommitted as r362261.  However, the
issue was fixed upstream, so r362261 serves no purpose.

PR:		246960, 247461 [exp-run]
Sponsored by:	The FreeBSD Foundation
2020-06-29 13:30:48 +00:00
Dimitry Andric
62cfcf62f6 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
llvmorg-10.0.1-rc2-0-g77d76b71d7d.

Also add a few more llvm utilities under WITH_CLANG_EXTRAS:

* llvm-dwp, a utility for merging DWARF 5 Split DWARF .dwo files into
  .dwp (DWARF package files)
* llvm-size, a size(1) replacement
* llvm-strings, a strings(1) replacement

MFC after:	3 weeks
2020-06-28 07:43:43 +00:00
Stefan Eßer
252884ae7e Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:

- They do not depend on external large number functions (i.e. no dependency
  on OpenSSL or any other large number library)

- They implements all features found in GNU bc/dc (with the exception of
  the forking of sub-processes, which the author of this version considers
  as a security issue).

- They are significantly faster than the current code in base (more than
  2 orders of magnitude in some of my tests, e.g. for 12345^100000).

- They should be fully compatible with all features and the behavior of the
  current implementations in FreeBSD (not formally verified).

- They support POSIX message catalogs and come with localized messages in
  Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
  and Russian.

- They offer very detailed man-pages that provide far more information than
  the current ones.

The upstream sources contain a large number of tests, which are not
imported with this commit. They could be integrated into our test
framework at a latter time.

Installation of this version is controlled by the option "MK_GH_BC=yes".
This option will be set to yes by default in 13-CURRENT, but will be off
by default in 12-STABLE.

Approved by:	imp
Obtained from:	https://git.yzena.com/gavin/bc
MFC after:	4 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D19982
2020-06-27 12:02:01 +00:00
Li-Wen Hsu
f4beb2edcd Temporarily skip flakey sys.kern.sysv_test.msg in CI
PR:		233649
2020-06-26 17:58:10 +00:00
Dimitry Andric
0946e70a3b Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
llvmorg-10.0.0-129-gd24d5c8e308. Getting closer to 10.0.1-rc2.

MFC after:	3 weeks
2020-06-25 08:15:10 +00:00
Cy Schubert
767173cec2 MFV r362565:
Update 4.2.8p14 --> 4.2.8p15

Summary: Systems that use a CMAC algorithm in ntp.keys will not release
a bit of memory on each packet that uses a CMAC keyid, eventually causing
ntpd to run out of memory and fail. The CMAC cleanup from
https://bugs.ntp.org/3447, part of ntp-4.2.8p11, introduced a bug whereby
the CMAC data structure was no longer completely removed.

MFC after:	3 days
Security:	NTP Bug 3661
2020-06-24 01:51:05 +00:00
Oleksandr Tymoshenko
e16b207739 Fix crash in drill(1) when IP has two subsequent dots
Cherry-pick crash fix from the upstream repo

PR:		226575
Reported by:	Goran Mekić <meka@tilda.center>
Obtained from:	https://git.nlnetlabs.nl/ldns/commit/?id=98291475
MFC after:	2 weeks
2020-06-22 23:13:14 +00:00
Yuri Pankov
1a176e87df Revert r362148.
Breaks UTF-8 input for new or having only 7bit characters present files.

Reported by:	glebius
2020-06-22 22:59:03 +00:00
Baptiste Daroussin
5b990a9463 Revert r362466
Such change should not have happen without prior discussion and review.

With hat:	transitioning core
2020-06-22 07:46:24 +00:00
Hans Petter Selasky
7747001b12 Improve wording to be more precise and clear.
No functional change intended.

s/Master Boot/Main Boot/ (also called MBR)

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-06-21 13:34:08 +00:00
Xin LI
65422c964a liblzma: Make liblzma use libmd implementation of SHA256.
MFC after:	2 weeks
PR:		200142
2020-06-20 21:32:07 +00:00
Dimitry Andric
e837bb5cfb Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
llvmorg-10.0.0-97-g6f71678ecd2 (not quite 10.0.1 rc2, as more fixes are
still pending).

MFC after:	3 weeks
2020-06-20 20:06:52 +00:00
Dimitry Andric
b32fb2a4ea Merge commit 0cecafd647cc from llvm git (by Alina Sbirlea):
[BasicAA] Make BasicAA a cfg pass.

  Summary:
  Part of the changes in D44564 made BasicAA not CFG only due to it
  using PhiAnalysisValues which may have values invalidated. Subsequent
  patches (rL340613) appear to have addressed this limitation.

  BasicAA should not be invalidated by non-CFG-altering passes. A
  concrete example is MemCpyOpt which preserves CFG, but we are testing
  it invalidates BasicAA.

  llvm-dev RFC:
  https://groups.google.com/forum/#!topic/llvm-dev/eSPXuWnNfzM

  Reviewers: john.brawn, sebpop, hfinkel, brzycki

  Subscribers: hiraditya, llvm-commits

  Tags: #llvm

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

This fixes an issue with clang's -fintegrated-cc1 feature, which could
make it output slightly different assembly code, depending on the way it
was invoked.

In r361755 we attempted to work around it by disabling the integrated
cc1 stage, but it did not solve the root cause for all situations.

Extensive testing and bisecting showed that the above change finally
makes the output deterministic, even if -fintegrated-cc1 is on.

Reported by:	Fabian Keil <fk@fabiankeil.de>
PR:		246630
MFC after:	3 days
2020-06-18 20:41:43 +00:00
Jung-uk Kim
b7cadce49a Remove the unnecessary configure.ac. 2020-06-18 18:16:13 +00:00
Jung-uk Kim
7e38239042 MFV: r362286
Merge flex 2.6.4.
2020-06-18 18:09:16 +00:00
Gordon Bergling
1adf1a2e4c ctime(3): Bump .Dd after r362165
Reported by:	bcr (mentor)
Reviewed by:	bcr (mentor)
Approved by:	bcr (mentor)
X-MFC-With:	r362165
2020-06-17 11:57:48 +00:00
Andrew Turner
b6aadd183a Update opencsd to 0.14.2
Sponsored by:	Innovate UK
2020-06-17 10:42:20 +00:00
Antoine Brodin
1f73e3e4a4 Re-apply r333944 to unbreak ports 2020-06-17 10:11:54 +00:00
Xin LI
2726a70148 MFV r362254: file 5.39.
MFC after:	2 weeks
2020-06-17 07:41:28 +00:00
Kristof Provost
389f88cffd llvm: Default to -mno-relax on RISC-V
Compiling on a RISC-V system fails with 'relocation R_RISCV_ALIGN
requires unimplemented linker relaxation; recompile with -mno-relax'.

Our default linker (ld.lld) doesn't support relaxation, so default to
no-relax so we don't generate object files the linker can't handle.

Reviewed by:	mhorne
Sponsored by:	Axiado
Differential Revision:	https://reviews.freebsd.org/D25210
2020-06-16 18:39:56 +00:00
Andrew Turner
c120c5646d Re-add opencsd as a vendor import from the dist directory
Sponsored by:	Innovate UK
2020-06-16 08:59:44 +00:00
Andrew Turner
9619ffaac8 Remove opencsd so I can re-import it with the correct ancestry
Sponsored by:	Innovate UK
2020-06-16 08:57:13 +00:00
Gordon Bergling
5e3ca52e78 Add a HISTORY section to ctime(3)
Reviewed by:	bcr (mentor)
Approved by:	bcr (mentor)
Obtained from:	OpenBSD
MFC after:	7 days
Differential Revision:	https://reviews.freebsd.org/D24635
2020-06-14 05:08:15 +00:00
Yuri Pankov
38f168e1a3 nvi: fallback to ISO8859-1 as last resort
Current logic of using user's locale encoding that is UTF-8 doesn't make
much sense if we already failed the looks_utf8() check and skipped
encoding set using "fileencoding" as being UTF-8 as well; fallback to
ISO8859-1 in that case.

Reviewed by:	Zhihao Yuan <lichray@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D24919
2020-06-13 14:11:02 +00:00
Cy Schubert
9236bd4bb7 MFV r362143:
Update sqlite3 to 3.32.2 (3320200).

CVE-2020-11655: SQLite through 3.31.1 allows attackers to cause a denial of
service (segmentation fault) via a malformed window-function query because
the AggInfo object's initialization is mishandled.

CVE-2020-13434: SQLite through 3.32.0 has an integer overflow in
sqlite3_str_vappendf in printf.c.

CVE-2020-13435: SQLite through 3.32.0 has a segmentation fault in
sqlite3ExprCodeTarget in expr.c.

CVE-2020-13630: ext/fts3/fts3.c in SQLite before 3.32.0 has a
use-after-free in fts3EvalNextRow, related to the snippet feature

CVE-2020-13631: SQLite before 3.32.0 allows a virtual table to be renamed
to the name of one of its shadow tables, related to alter.c and build.c.

CVE-2020-13632: ext/fts3/fts3_snippet.c in SQLite before 3.32.0 ha s a
NULL pointer dereference via a crafted matchinfo() query.

PR:		247149
Reported by:	spam123@bitbert.com
MFC after:	3 days
Security:	vuxml: c4ac9c79-ab37-11ea-8b5e-b42e99a1b9c3
		https://nvd.nist.gov/vuln/detail/CVE-2020-11655
		https://nvd.nist.gov/vuln/detail/CVE-2020-13434
		https://nvd.nist.gov/vuln/detail/CVE-2020-13435
		https://nvd.nist.gov/vuln/detail/CVE-2020-13630
		https://nvd.nist.gov/vuln/detail/CVE-2020-13631
		https://nvd.nist.gov/vuln/detail/CVE-2020-13632
2020-06-13 04:47:59 +00:00
Cy Schubert
b622dc25cf MFV r362082:
Update sqlite3 3.31.1 --> 3.32.0.

PR:		247149
Reported by:	spam123@bitbert.com
Reminded by:	emaste
MFC after:	3 days
Security:	CVE-2020-11655, CVE-2020-13434, CVE-2020-13435,
		CVE-2020-13630, CVE-2020-13631, CVE-2020-13632
2020-06-12 13:02:44 +00:00
Simon J. Gerraty
ef0b253881 Merge bmake-20200606
Relevant items from ChangeLog:

	o dir.c: cached_stats - don't confuse stat and lstat results.
	o var.c: add :Or for reverse sort.
2020-06-09 20:52:35 +00:00
Cy Schubert
ee7b7f3f05 Post CVE-2020-12695 cleanup patch:
Resolve a Linuxism to fix the build.

MFC after:	3 days
X-MFC with:	r361957, r361958, r361959
2020-06-09 05:43:51 +00:00
Cy Schubert
7d748adc91 MFV r361938:
Upstream commit message:

[PATCH 3/3] WPS UPnP: Handle HTTP initiation failures for events more
properly

While it is appropriate to try to retransmit the event to another
callback URL on a failure to initiate the HTTP client connection, there
is no point in trying the exact same operation multiple times in a row.
Replve the event_retry() calls with event_addr_failure() for these cases
to avoid busy loops trying to repeat the same failing operation.

These potential busy loops would go through eloop callbacks, so the
process is not completely stuck on handling them, but unnecessary CPU
would be used to process the continues retries that will keep failing
for the same reason.

Obtained from:	https://w1.fi/security/2020-1/\
	0003-WPS-UPnP-Handle-HTTP-initiation-failures-for-events-.patch
MFC after:	3 days
Security:	VU#339275 and CVE-2020-12695
2020-06-09 05:39:37 +00:00
Cy Schubert
b266d2f206 MFV r361937:
Upstream commit message:

[PATCH 2/3] WPS UPnP: Fix event message generation using a long URL path

More than about 700 character URL ended up overflowing the wpabuf used
for building the event notification and this resulted in the wpabuf
buffer overflow checks terminating the hostapd process. Fix this by
allocating the buffer to be large enough to contain the full URL path.
However, since that around 700 character limit has been the practical
limit for more than ten years, start explicitly enforcing that as the
limit or the callback URLs since any longer ones had not worked before
and there is no need to enable them now either.

Obtained from:	https://w1.fi/security/2020-1/\
	0002-WPS-UPnP-Fix-event-message-generation-using-a-long-U.patch
MFC after:	3 days
Security:	VU#339275 and CVE-2020-12695
2020-06-09 05:38:12 +00:00
Cy Schubert
a3557ef05f MFV r361936:
Upstream commit message:

[PATCH 1/3] WPS UPnP: Do not allow event subscriptions with URLs to
other networks

The UPnP Device Architecture 2.0 specification errata ("UDA errata
16-04-2020.docx") addresses a problem with notifications being allowed
to go out to other domains by disallowing such cases. Do such filtering
for the notification callback URLs to avoid undesired connections to
external networks based on subscriptions that any device in the local
network could request when WPS support for external registrars is
enabled (the upnp_iface parameter in hostapd configuration).

Obtained from:	https://w1.fi/security/2020-1/\
	0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch
MFC after:	3 days
Security:	VU#339275 and CVE-2020-12695
2020-06-09 05:35:38 +00:00
Ed Maste
dfd4db9333 lld: Set DF_1_PIE for -pie
DF_1_PIE originated from Solaris[1].

GNU ld[2] sets the flag on non-Solaris platforms.

It can help distinguish PIE from ET_DYN.
eu-classify from elfutils uses this to recognize PIE[3].

glibc uses this flag to reject dlopen'ing a PIE[4]

[1] https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html
[2] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5fe2850dd96483f176858fd75c098313d5b20bc2
[3] https://sourceware.org/git/?p=elfutils.git;a=commit;h=3f489b5c7c78df6d52f8982f79c36e9a220e8951
[4] https://sourceware.org/bugzilla/show_bug.cgi?id=24323

Discussed with:	dim
Obtained from:	LLVM ee9a251caf1d
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-06-02 22:57:13 +00:00
Ed Maste
4e99f45480 llvm: Add DF_1_PIE
Discussed with:	dim
Obtained from:	LLVM d9943e7f0ce8
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-06-02 22:55:51 +00:00
Cy Schubert
9543f281e8 Per-rule hit counts (-h) can be used with either -i (input) or -o (output)
filter rule lists.

MFC after:	3 days
2020-06-02 03:44:22 +00:00
Dimitry Andric
b7ec5dea64 Update Subversion to 1.14.0 LTS. See contrib/subversion/CHANGES for a
summary of changes, or for a more thorough overview:

https://subversion.apache.org/docs/release-notes/1.14

NOTE: there is no need to dump and reload repositories, and the working
copy format is still the same as Subversion 1.8 through 1.13.

Relnotes:	yes
MFC after:	2 weeks
X-MFC-With:	r361677
2020-06-01 10:27:05 +00:00
Dimitry Andric
674baa3c4f Update apr-util to 1.6.1. See contrib/apr-util/CHANGES for a summary of
changes.

MFC after:	2 weeks
X-MFC-With:	r361677
2020-06-01 10:14:45 +00:00
Dimitry Andric
b081c245fd Update apr to 1.7.0. See contrib/apr/CHANGES for a summary of changes.
MFC after:	2 weeks
X-MFC-With:	r361677
2020-05-31 22:12:56 +00:00
Ed Maste
796bf3133b readelf: add more DT_FLAGS_1 flags
Reference:
https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html

> DF_1_SINGLETON  Singleton symbols exist.
> DF_1_STUB       Object is a stub.
> DF_1_PIE        Object is a position-independent executable.

Sponsored by:	The FreeBSD Foundation
2020-05-31 15:31:47 +00:00
Dimitry Andric
d65cd7a57b Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
llvmorg-10.0.1-rc1-0-gf79cd71e145 (aka 10.0.1 rc1).

MFC after:	3 weeks
2020-05-23 10:32:18 +00:00
Conrad Meyer
33af263230 ctime.3: Use ASCII asterisks for C, not special unicode math glyphs
PR:		246656
Reported by:	danfe
2020-05-22 15:30:14 +00:00
Cy Schubert
091e9e469b MFV r361322:
Update unbound 1.9.6 --> 1.10.1.

Bug Fixes:
 - CVE-2020-12662 Unbound can be tricked into amplifying an incoming
   query into a large number of queries directed to a target.
 - CVE-2020-12663 Malformed answers from upstream name servers can be
   used to make Unbound unresponsive.

Reported by:	emaste
MFC after:	3 days
Relnotes:	yes
Security:	CVE-2020-12662, CVE-2020-12663
2020-05-21 21:00:46 +00:00
Cy Schubert
6a53c00e64 Vendor import of Unbound 1.10.1.
Security:	CVE-2020-12662, CVE-2020-12663
2020-05-21 05:01:52 +00:00
Simon J. Gerraty
49caa483b3 Merge bmake-20200517
Changes since 20181221 are mostly portability related
hence the large gap in versions imported.

There are however some bug fixes, and a rework of filemon handling.
In NetBSD make/filemon/filemon_ktrace.c allows use of fktrace
and elimination of filemon(4) which has not had the TLC it needs.

FreeBSD filemon(4) is in much better shape, so bmake/filemon/filemon_dev.c
allows use of that, with a bit less overhead than the ktrace model.

Summary of changes from ChangeLog

	o str.c: empty string does not match % pattern
	  plus unit-test changes
	o var.c: import handling of old sysV style modifier using '%'
	o str.c: refactor brk_string
	o meta.c: meta_oodate, CHECK_VALID_META is too aggressive for CMD
	  a blank command is perfectly valid.
	o meta.c: meta_oodate, check for corrupted meta file
	  earlier and more often.
	* meta.c: meta_compat_parent check for USE_FILEMON
	  patch from Soeren Tempel
	o meta.c: fix compat mode, need to call meta_job_output()
	o job.c: extra fds for meta mode not needed if using filemon_dev
	o meta.c: avoid passing NULL to filemon_*() when meta_needed()
	  returns FALSE.
	o filemon/filemon_{dev,ktrace}.c: allow selection of
	  filemon implementation.  filemon_dev.c uses the kernel module
	  while filemon_ktrace.c leverages the fktrace api available in
	  NetBSD.  filemon_ktrace.c can hopefully form the basis for
	  adding support for other tracing mechanisms such as strace on
	  Linux.
	o meta.c: when target is out-of-date per normal make rules
	  record value of .OODATE in meta file.
	o parse.c: don't pass NULL to realpath(3)
	  some versions cannot handle it.
	o parse.c: ParseDoDependency: free paths rather than assert

plus more unit-tests
2020-05-20 22:25:46 +00:00
Martin Matuska
de6fa6b43b MFV r361280:
Update libarchive to 3.4.3

Relevant vendor changes:
  PR #1352: support negative zstd compression levels
  PR #1359: improve zstd version checking
  PR #1348: support RHT.security.selinux from GNU tar
  PR #1357: support for archives compressed with pzstd
  PR #1367: fix issues in acl tests
  PR #1372: child handling cleanup
  PR #1378: fix memory leak from passphrase callback
2020-05-20 20:58:48 +00:00
Martin Matuska
e117869ad3 Update vendor/libarchive/dist to git fc6563f5130d8a7ee1fc27c0e55baef35119f26c
Libarchive 3.4.3

Relevant vendor changes:
  PR #1352: support negative zstd compression levels
  PR #1359: improve zstd version checking
  PR #1348: support RHT.security.selinux from GNU tar
  PR #1357: support for archives compressed with pzstd
  PR #1367: fix issues in acl tests
  PR #1372: child handling cleanup
  PR #1378: fix memory leak from passphrase callback
2020-05-20 16:13:02 +00:00
Cy Schubert
2ecd01c7c1 Silence the once per second CTRL-EVENT-SCAN-FAILED errors when the WiFi
radio is disabled through the communication device toggle key (also known
as the RF raidio kill button). Only the CTRL-EVENT-DISCONNECTED will be
issued.

Submitted by:	avg
Reported by:	avg
MFC after:	1 week
2020-05-20 04:16:13 +00:00
Ed Maste
36b1f67ca1 blacklistd.conf.5: typo/grammar fixes
PR:		246467
Submitted by:	Mike Lempriere
2020-05-19 00:15:19 +00:00
Ed Maste
eb95dbfa4f GNU as: move deprecation message after option parsing
Some cmake test parses the output of the first line of as --version, and
emits an error if it does not contain some expected strings:

Checking whether the ASM compiler is GNU using "--version" did not match
"(GNU assembler)|(GCC)|(Free Software Foundation)"

Emit the deprecation message later, after parsing argv and thus --version.

PR:		246540
Reported by:	dch
Sponsored by:	The FreeBSD Foundation
2020-05-18 16:07:14 +00:00
Li-Wen Hsu
b13788e396 Temporarily disable failing case in CI of amd64:
- lib.libexecinfo.backtrace_test.backtrace_fmt_basic

PR:		246537
Sponsored by:	The FreeBSD Foundation
2020-05-18 12:36:28 +00:00
Justin Hibbits
4f8d098652 elftoolchain: Add powerpc64 definition to elftoolchain config
powerpc is already in place, but powerpc64 is needed separately.
2020-05-16 03:52:30 +00:00
Jakub Wojciech Klama
134e17798c Import lib9p 7ddb1164407da19b9b1afb83df83ae65a71a9a66.
Approved by:	trasz
MFC after:	1 month
Sponsored by:	Conclusive Engineering (development), vStack.com (funding)
2020-05-14 19:57:52 +00:00
Conrad Meyer
134a253edc clang: Reject %n for __attribute__((format(__freebsd_kprintf__)))
A follow-up to r360849.

Reported by:	imp
Reviewed by:	emaste, imp
X-MFC-With:	r360849
Differential Revision:	https://reviews.freebsd.org/D24786
2020-05-09 19:26:44 +00:00
Ed Maste
c7d9dfe810 Merge commit 21e5e1724b75 from llvm git:
getMainExecutable: Fix hand-rolled AT_EXECPATH for older FreeBSD

  Once we hit AT_NULL, we need to bail out of the loop; not just the
  enclosing switch.  This fixes basic usage (e.g. `cc --version`) when
  AT_EXECPATH isn't present on older branches (e.g. under
  emu-user-static, at the moment), where we would previously run off
  the end of ::environ.

  Patch By: kevans

  Reviewed By: arichardson

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

MFC after:	3 days
2020-05-07 21:18:37 +00:00
Dimitry Andric
e86cf8ada1 Merge commit 4ca2cad94 from llvm git (by Justin Hibbits):
[PowerPC] Add clang -msvr4-struct-return for 32-bit ELF

  Summary:

  Change the default ABI to be compatible with GCC. For 32-bit ELF
  targets other than Linux, Clang now returns small structs in
  registers r3/r4. This affects FreeBSD, NetBSD, OpenBSD. There is no
  change for 32-bit Linux, where Clang continues to return all structs
  in memory.

  Add clang options -maix-struct-return (to return structs in memory)
  and -msvr4-struct-return (to return structs in registers) to be
  compatible with gcc. These options are only for PPC32; reject them on
  PPC64 and other targets. The options are like -fpcc-struct-return and
  -freg-struct-return for X86_32, and use similar code.

  To actually return a struct in registers, coerce it to an integer of
  the same size. LLVM may optimize the code to remove unnecessary
  accesses to memory, and will return i32 in r3 or i64 in r3:r4.

  Fixes PR#40736

  Patch by George Koehler!

  Reviewed By: jhibbits, nemanjai
  Differential Revision: https://reviews.llvm.org/D73290

Requested by:	jhibbits
MFC after:	3 days
2020-05-06 19:10:39 +00:00
Dimitry Andric
95512cda91 In r358396 I merged llvm upstream commit 2e24219d3, which fixed "error:
unsupported relocation on symbol" when assembling arm 'adr' pseudo
instructions. However, the upstream commit did not take big-endian arm
into account.

Applying the same changes to the big-endian handling is straightforward,
thanks to Andrew Turner and Peter Smith for the hint. This will also be
submitted upstream.

MFC after:	immediately, since this fix is meant for stable/11
2020-05-06 18:13:00 +00:00
Ed Maste
6fd36c3b7a GNU as: print a deprecation warning on program start
GNU as 2.17.50 will be removed before FreeBSD 13.
2020-05-06 01:08:19 +00:00
Conrad Meyer
6b1e5fae2c pwcache.3: Explicitly document OOM condition
The pwcache functions allocate memory, and may return NULL pointers if that
allocation fails and the corresponding uid or gid was not found in the local
password database.  Document this behavior.

Sponsored by:	Dell EMC Isilon
2020-05-05 17:55:45 +00:00
Brooks Davis
ea69bf7f5d Set LG_VADDR to 48 on RISC-V.
The Sv48 PTE format is the largest currently defined address space for
RISC-V. It makes no sense to define a larger size and doing so (at
least for 64-bits) forces rtrees down a slow path.

Reviewed by:	vangyzen, jhb, mhorne
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24658
2020-05-04 17:16:30 +00:00
Dimitry Andric
702995b2a5 Tentatively apply https://reviews.llvm.org/D78877 (by Dave Green):
[ARM] Only produce qadd8b under hasV6Ops

  When compiling for a arm5te cpu from clang, the +dsp attribute is
  set. This meant we could try and generate qadd8 instructions where we
  would end up having no pattern. I've changed the condition here to be
  hasV6Ops && hasDSP, which is what other parts of ARMISelLowering seem
  to use for similar instructions.

  Fixed PR45677.

This fixes "fatal error: error in backend: Cannot select: t37: i32 =
ARMISD::QADD8b t43, t44" when compiling sys/dev/sound/pcm/feeder_mixer.c
for armv5. For some reason we do not encounter this on head, but this
error popped up while building universes for stable/12.

MFC after:	3 days
2020-04-26 19:17:45 +00:00
Philip Paeps
dd5f96c48d Import tzdata 2020a
Changes: https://github.com/eggert/tz/blob/2020a/NEWS

MFC after:	3 days
2020-04-24 05:05:58 +00:00
Eric van Gyzen
c5ad81420c Update jemalloc to version 5.2.1
Revert r354606 to restore r354605.

Apply one line from jemalloc commit d01b425e5d1e1 in hash_x86_128()
to fix the build with gcc, which only allows a fallthrough attribute
to appear before a case or default label.

Submitted by:	jasone in r354605
Discussed with:	jasone
Reviewed by:	bdrewery
MFC after:	never, due to gcc 4.2.1
Relnotes:	yes
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D24522
2020-04-23 23:57:43 +00:00
Cy Schubert
1c2fa9150d Fix PowerPC segfault.
The segfault fix was originally developed by our upstream, sqlite.org,
to address S/390 and Sparc segfaults, both of which are big endian.
Our PowerPC is also big endian, which this patch also fixes.

Reported by:	Mark Millard <marklmi at yahoo.com>
Tested by:	Mark Millard <marklmi at yahoo.com>
Obtained from:	https://www.sqlite.org/src/vinfo/04885763c4cd00cb?diff=1
		https://sqlite.org/forum/forumpost/672291a5b2
MFC after:	1 month
X-MFC with:	r360221, 360221
2020-04-23 14:08:40 +00:00
Cy Schubert
74a6cddade MFV r360158:
Update sqlite3-3.31.0 (3310000) --> sqlite3-3.31.1 (3310100)

Tested by:	Mark Millard <marklmi at yahoo.com>
		With to be committed PowerPC patch
MFC after:	1 month
X-MFC with:	r360221
2020-04-23 13:58:11 +00:00
Cy Schubert
0e2816f50a In preparation for update to sqlite3-3.31.1 (3310100),
recommit r357201: MFV r357163, which was reverted by r357522
due to segfault under PowerPc.

Update sqlite3-3.30.1 (3300100) --> sqlite3-3.31.0 (3310000)

MFC after:	1 month
2020-04-23 13:46:34 +00:00
Ed Maste
c027e8cf48 blacklistd.8: fix db file path
PR:		245781
Submitted by:	Jose Luis Duran
MFC after:	3 days
2020-04-21 13:30:00 +00:00
Gleb Smirnoff
ee2e9f4dbc Fix immediate crash when snmpd is bound to a specific IP address.
The code that sets up msghdr must first fully fill in the msghdr
itself, and only then use CMSG_xxx() macros.

Silence from:	harti, one week
2020-04-20 23:32:49 +00:00
Dimitry Andric
5c94a87341 Merge commit 64b31d96d from llvm git (by Nemanja Ivanovic):
[PowerPC] Do not attempt to reuse load for 64-bit FP_TO_UINT without
  FPCVT

  We call the function that attempts to reuse the conversion without
  checking whether the target matches the constraints that the callee
  expects. This patch adds the check prior to the call.

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

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

This should fix 'Assertion failed: ((Op.getOpcode() == ISD::FP_TO_SINT
|| Subtarget.hasFPCVT()) && "i64 FP_TO_UINT is supported only with
FPCVT"), function LowerFP_TO_INTForReuse, file
/usr/src/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp, line 7276'
when building the devel/libslang2 port (and a few others) for PowerPC64.

Requested by:	pkubaj
MFC after:	6 weeks
X-MFC-With:	358851
2020-04-20 19:16:10 +00:00
Dimitry Andric
3788a439e9 Merge commit ce5173c0e from llvm git (by Reid Kleckner):
Use FinishThunk to finish musttail thunks

  FinishThunk, and the invariant of setting and then unsetting
  CurCodeDecl, was added in 7f416cc42638 (2015). The invariant didn't
  exist when I added this musttail codepath in ab2090d10765 (2014).
  Recently in 28328c3771, I started using this codepath on non-Windows
  platforms, and users reported problems during release testing
  (PR44987).

  The issue was already present for users of EH on i686-windows-msvc,
  so I added a test for that case as well.

  Reviewed By: hans

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

This should fix 'Assertion failed: (!empty() && "popping exception stack
when not empty"), function popTerminate, file
/usr/src/contrib/llvm-project/clang/lib/CodeGen/CGCleanup.h, line 583'
when building the net-p2p/libtorrent-rasterbar

PR:		244830
Reported by:	jbeich, yuri
MFC after:	6 weeks
X-MFC-With:	358851
2020-04-20 17:39:51 +00:00
Alan Somers
72a600a7a1 libauditd: make it a PRIVATELIB
According to the upstream man page (which we don't install), none of
libauditd's symbols are intended to be public. Also, I can't find any
evidence for a port that uses libauditd. Therefore, we should treat it like
other such libraries and use PRIVATELIB.

Reported by:	phk
Reviewed by:	cem, emaste
MFC after:	2 weeks
2020-04-19 02:20:39 +00:00
Dimitry Andric
5df2af0809 Revert commit b6cf400aa fro llvm git (by Nemanja Ivanovic):
Fix bots after a9ad65a2b34f

  In the last commit, I neglected to initialize the new subtarget
  feature I added which caused failures on a few bots. This should fix
  that.

This unbreaks the build after r359981, which reverted upstream commit
a9ad65a2b34f.

Reported by:	jhibbits (and jenkins :)
MFC after:	6 weeks
X-MFC-With:	358851
2020-04-15 21:06:38 +00:00
Dimitry Andric
f64e2fac5d Revert commit a9ad65a2b from llvm git (by Nemanja Ivanovic):
[PowerPC] Change default for unaligned FP access for older subtargets

  This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40554

  Some CPU's trap to the kernel on unaligned floating point access and
  there are kernels that do not handle the interrupt. The program then
  fails with a SIGBUS according to the PR. This just switches the
  default for unaligned access to only allow it on recent server CPUs
  that are known to allow this.

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

This upstream commit causes a compiler hang when building certain ports
(e.g. security/nss, multimedia/x264) for powerpc64.  The hang has been
reported in https://bugs.llvm.org/show_bug.cgi?id=45186, but in the mean
time it is more convenient to revert the commit.

Requested by:	jhibbits
MFC after:	6 weeks
X-MFC-With:	358851
2020-04-15 18:43:44 +00:00
Dimitry Andric
c3ca3130e2 Merge commit 30588a739 from llvm git (by Erich Keane):
Make target features check work with ctor and dtor-

  The problem was reported in PR45468, applying target features to an
  always_inline constructor/destructor runs afoul of GlobalDecl
  construction assert when checking for target-feature compatibility.

  The core problem is fixed by using the version of the check that
  takes a FunctionDecl rather than the GlobalDecl. However, while
  writing the test, I discovered that source locations weren't properly
  set for this check on ctors/dtors. This patch also fixes constructors
  and CALLED destructors.

  Unfortunately, it doesn't seem too possible to get a meaningful
  source location for a 'cleanup' destructor, so those are still
  'frontend' level errors unfortunately. A fixme was added to the test
  to cover that situation.

This should fix 'Assertion failed: (!isa<CXXConstructorDecl>(D) && "Use
other ctor with ctor decls!"), function Init, file
/usr/src/contrib/llvm-project/clang/include/clang/AST/GlobalDecl.h, line
45' when compiling the security/botan2 port.

PR:		245550
MFC after:	6 weeks
X-MFC-With:	358851
2020-04-12 16:06:59 +00:00
Kyle Evans
302ab0eb27 ntpd: fix build with -fno-common
Only a small nit here: psl should be declared extern and defined exactly
once.

-fno-common will become the default in GCC10/LLVM11.

MFC after:	3 days
2020-04-06 23:11:43 +00:00
Ed Maste
2b99119f6d lldb: use lua as the default script language
In the FreeBSD base system we do not have Python support in lldb, but
will have Lua support.  Make Lua the default.

This needs to be made into a configure-time option; that is being
discussed upstream and will appear in a future lldb import.  For now
carry this change as a tiny patch to our copy of lldb.
2020-04-02 21:08:28 +00:00
Dimitry Andric
130d950caf Merge once more from ^/vendor/llvm-project/release-10.x, to get the
lldb/bindings directory, which will be used to provide lua bindings for
lldb.

Requested by:	emaste
MFC after:	6 weeks
X-MFC-With:	358851
2020-04-02 19:56:43 +00:00
Hartmut Brandt
0bf56da32d Merge release 1.14 of bsnmp. 2020-04-01 15:25:16 +00:00
Ed Maste
1176bc823f lldb: stop excluding bindings/ subdir
With liblua in the tree we should be able to enable lldb's lua
scripting.  We'll need the files in bindings/, so start by allowing them
to come in with the next import.

Approved by:	dim
Sponsored by:	The FreeBSD Foundation
2020-04-01 13:18:01 +00:00
Edward Tomasz Napierala
568f01f6c3 Make jemalloc(3) default to retain:true on 64-bit platforms,
like it already does on Linux and OSX.  This results in significantly
fewer calls to mmap(2).  This should result in a small reduction
in system CPU time and improved superpage usage.

Reviewed by:	markj
Tested by:	markj
MFC after:	2 weeks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D23874
2020-03-31 13:48:06 +00:00
Kyle Evans
b766b8bf1a MFV r359442: bmake: import -fno-common fix build back from upstream
sjg@ committed the local patch previously committed upstream; pull it in to
vendor/ to ease any potential stress of future imports.
2020-03-30 16:22:16 +00:00
Kyle Evans
661a2cb802 bmake: fix -fno-common build
debug was declared extern, but debug_file was not; correct this and define
debug_file in main.c (as debug is) to fix the -fno-common build.

-fno-common will become the default with GCC10/LLVM11.

MFC after:	3 days
2020-03-30 00:06:56 +00:00
Enji Cooper
09ae09a9eb Revert r359385-r359387
As noted by brooks/emaste, this is the wrong approach to take.
Revert the changes so brooks can apply a more proper change.

Requested by:	brooks, emaste
2020-03-29 02:40:03 +00:00
Kyle Evans
0690ee732a ipfilter: remove duplicate definition of 'thishost'
thishost is already defined in lib/initparse.c; no need for this one. This
fixes the ipfilter build with -fno-common.

-fno-common will become the default in GCC10/LLVM11.

MFC after:	3 days
2020-03-29 02:26:58 +00:00
Kyle Evans
103d3266eb telnet: kill off remaining duplicate definition 2020-03-28 20:43:15 +00:00
Kyle Evans
fb1bc03eee Re-apply r359399: telnet -fno-common fix
line and auth_level's redefinitions are just extraneous

telnetd will #define extern and then include ext.h to allocate storage for
all of these extern'd vars; however, two of them are actually defined in
libtelnet instead. Instead of doing an #ifdef extern dance around those
function pointers, just add an EXTERN macro to make it easier to
differentiate by sight which ones will get allocated in globals.c and which
ones are defined elsewhere.

MFC after:	3 days
2020-03-28 19:43:45 +00:00
Kyle Evans
42b4e3fb5e Revert 359399: telnet -fno-common bits
There was a large misfire from my local diff that I need to investigate, and
this version committed did not build.
2020-03-28 17:57:36 +00:00
Kyle Evans
71f8f48356 MFV r359401: OpenBSM: import ee79d73e8df5: auditreduce: add a zone filter
This allows one to select audit records that match a -z zone glob.

MFC after:	1 week
Sponsored by:	Modirum MDPay, Klara Systems
2020-03-28 17:36:39 +00:00
Kyle Evans
c1b2af731b telnet: remove some duplicate definitions, mark terminaltype extern
Most of these were already properly declared and defined elsewhere, this is
effectively just a minor cleanup that fixes the -fno-common build.

-fno-common will become the default in GCC10/LLVM11.

MFC after:	3 days
2020-03-28 17:06:34 +00:00
Kyle Evans
688f58d2da MFV r359393: tcsh: import 6974bc35a5cd
This removes an extra variable definition that causes the -fno-common build
to fail, which will be a new default in GCC10/LLVM11.

MFC after:	3 days
2020-03-28 15:00:55 +00:00
Kyle Evans
d1df43288e gas: mark dwarf2_loc_mark_labels as extern
Compiling with -fno-common complains as this header's included in multiple
compilation units. In fact, the proper definition of dwarf2_loc_mark_labels
already exists in dwarf2dbg.c, so simply mark this declaration with extern.
2020-03-28 03:58:57 +00:00
Enji Cooper
dc60c91821 Follow up to r359385
Actually add the generated manpages to unbreak the build.

MFC with:	r359385
2020-03-28 01:14:37 +00:00
Ed Maste
e4c8ad744a objdump: emit a deprecation notice at program start
PR:		212319
2020-03-27 19:39:14 +00:00
Dimitry Andric
aec4c088fd Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
llvmorg-10.0.0-0-gd32170dbd5b (aka 10.0.0 release).

PR:		244251
MFC after:	6 weeks
X-MFC-With:	358851
2020-03-26 17:46:32 +00:00
Dimitry Andric
6dce2be1c7 Merge commit 459e8e948 from llvm git (by Justin Hibbits):
[PowerPC]: Don't allow r0 as a target for LD_GOT_TPREL_L/32

  Summary:
  The linker is free to relax this (relocation R_PPC_GOT_TPREL16)
  against R_PPC_TLS, if it sees fit (initial exec to local exec). If r0
  is used, this can generate execution-invalid code (converts to 'addi
  %rX, %r0, FOO, which translates in PPC-lingo to li %rX, FOO). Forbid
  this instead.

  This fixes static binaries using locales on FreeBSD/powerpc (tested
  on FreeBSD/powerpcspe).

  Reviewed By: nemanjai
  Differential Revision: https://reviews.llvm.org/D76662

Requested by:	jhibbits
MFC after:	6 weeks
X-MFC-With:	358851
2020-03-26 17:28:54 +00:00
Dimitry Andric
5b5f869e87 Merge commit f0990e104 from llvm git (by Justin Hibbits):
[PowerPC]: e500 target can't use lwsync, use msync instead

  The e500 core has a silicon bug that triggers an illegal instruction
  program trap on any sync other than msync. Other cores will typically
  ignore illegal sync types, and the documentation even implies that
  the 'illegal' bits are ignored.

  Address this hardware deficiency by only using msync, like the PPC440.

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

Requested by:	jhibbits
MFC after:	6 weeks
X-MFC-With:	358851
2020-03-26 17:27:41 +00:00
Brooks Davis
b0d29bc47d Import the kyua test framework.
Having kyua in the base system will simplify automated testing in CI and
eliminates bootstrapping issues on new platforms.

The build of kyua is controlled by WITH(OUT)_TESTS_SUPPORT.

Reviewed by:	emaste
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24103
2020-03-23 19:01:23 +00:00
Brooks Davis
c697fb7f7c Add liblutok a lightweight C++ API for lua.
It is added an INTERNALLIB and not installed.  It will be used by kyua.

This is a preparatory commit for D24103.

Reviewed by:	emaste
Obtained from:	CheriBSD
Sponsored by:	DARPA
2020-03-23 18:26:23 +00:00
Xin LI
a8675d927b MFV r359197: xz 5.2.5.
MFC after:	2 weeks
Relnotes:	yes
2020-03-22 01:27:38 +00:00
Ed Maste
e982f6f935 readelf: simplify Xen string note printing
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D24140
2020-03-21 00:08:33 +00:00
Mark Johnston
c364ccf9ce libelftc: Fix a memory leak in cpp_demangle_read_type().
CID:		1305425
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-03-20 16:25:06 +00:00
Mark Johnston
d5e7add6b5 readelf: Fix another instance of the leak mentioned in r357542.
CID:		1292493
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-03-20 16:24:53 +00:00
Mark Johnston
c37c6b38b6 readelf: Avoid leaking ELF descriptors for archive entries.
CID:		1292494
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-03-20 16:24:40 +00:00
Mark Johnston
388586bcd8 libpe: Avoid a potential use-after-free in pe_update_symtab().
This function appears to be unused within FreeBSD and ELFToolChain.

CID:		1418982
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-03-20 16:24:23 +00:00
Mark Johnston
a9d65c5fae libdwarf: Make an out-pointer assignment unconditional.
There is no reason for diep to ever be NULL, since in that case we would
simply be leaking memory.

CID:		1418801
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-03-20 16:24:06 +00:00
Ed Maste
05ab65497e objcopy: add new sections also when there is no .shstrtab
Previously objcopy (elfcopy) --add-sections inserted new sections before
.shstrtab, but omitted them if there was no .shstrtab.

Now, after processing existing sections add new sections if they were
not yet added.

PR:		241437
Reported by:	arrowd
Submitted by:	Tiger Gao <tig@FreeBSDFoundation.org>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23571
2020-03-20 15:50:37 +00:00
Dimitry Andric
9ec406dc40 Merge commit 585a3cc31 from llvm git (by me):
Fix -Wdeprecated-copy-dtor and -Wdeprecated-dynamic-exception-spec
  warnings.

  Summary:
  The former are like:

  libcxx/include/typeinfo:322:11: warning: definition of implicit copy
  constructor for 'bad_cast' is deprecated because it has a
  user-declared destructor [-Wdeprecated-copy-dtor]
    virtual ~bad_cast() _NOEXCEPT;
	    ^
  libcxx/include/typeinfo:344:11: note: in implicit copy constructor
  for 'std::bad_cast' first required here
      throw bad_cast();
	    ^

  Fix these by adding an explicitly defaulted copy constructor.

  The latter are like:

  libcxx/include/codecvt:105:37: warning: dynamic exception
  specifications are deprecated [-Wdeprecated-dynamic-exception-spec]
      virtual int do_encoding() const throw();
				      ^~~~~~~

  Fix these by using the _NOEXCEPT macro instead.

  Reviewers: EricWF, mclow.lists, ldionne, #libc

  Reviewed By: EricWF, #libc

  Subscribers: dexonsmith, libcxx-commits

  Tags: #libc

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

This is because we use -Wsystem-headers during buildworld, and the two
warnings above are now triggered by default with clang 10, preventing
most C++ code from compiling without NO_WERROR.

Requested by:	brooks
MFC after:	6 weeks
X-MFC-With:	358851
Differential Revision: https://reviews.freebsd.org/D24049
2020-03-18 20:50:30 +00:00
Dimitry Andric
e39dad62a8 Merge commit b8ebc11f0 from llvm git (by Sanjay Patel):
[EarlyCSE] avoid crashing when detecting min/max/abs patterns (PR41083)

  As discussed in PR41083:
  https://bugs.llvm.org/show_bug.cgi?id=41083
  ...we can assert/crash in EarlyCSE using the current hashing scheme
  and instructions with flags.

  ValueTracking's matchSelectPattern() may rely on overflow (nsw, etc)
  or other flags when detecting patterns such as min/max/abs composed
  of compare+select. But the value numbering / hashing mechanism used
  by EarlyCSE intersects those flags to allow more CSE.

  Several alternatives to solve this are discussed in the bug report.
  This patch avoids the issue by doing simple matching of min/max/abs
  patterns that never requires instruction flags. We give up some CSE
  power because of that, but that is not expected to result in much
  actual performance difference because InstCombine will canonicalize
  these patterns when possible. It even has this comment for abs/nabs:

    /// Canonicalize all these variants to 1 pattern.
    /// This makes CSE more likely.

  (And this patch adds PhaseOrdering tests to verify that the expected
  transforms are still happening in the standard optimization
  pipelines.

  I left this code to use ValueTracking's "flavor" enum values, so we
  don't have to change the callers' code. If we decide to go back to
  using the ValueTracking call (by changing the hashing algorithm
  instead), it should be obvious how to replace this chunk.

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

This fixes an assertion when building the math/gsl port on PowerPC64.

Requested by:	pkubja
MFC after:	6 weeks
X-MFC-With:	358851
2020-03-18 20:44:40 +00:00
Dimitry Andric
5a0c326f63 Merge commit 315f8a55f from llvm git (by Fangrui Song):
[ELF][PPC32] Don't report "relocation refers to a discarded section"
  for .got2

  Similar to D63182 [ELF][PPC64] Don't report "relocation refers to a
  discarded section" for .toc

  Reviewed By: Bdragon28

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

This is needed to fix compile errors when building for ppc32/lld10.

Requested by:	bdragon
MFC after:	6 weeks
X-MFC-With:	358851
Differential Revision: https://reviews.freebsd.org/D24110
2020-03-18 20:38:15 +00:00
Dimitry Andric
92c0d181e5 Merge commit 00925aadb from llvm git (by Fangrui Song):
[ELF][PPC32] Fix canonical PLTs when the order does not match the PLT order

  Reviewed By: Bdragon28

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

This is needed to fix miscompiled canonical PLTs on ppc32/lld10.

Requested by:	bdragon
MFC after:	6 weeks
X-MFC-With:	358851
Differential Revision: https://reviews.freebsd.org/D24109
2020-03-18 20:28:26 +00:00