Commit Graph

9175 Commits

Author SHA1 Message Date
Dimitry Andric
9097e3cbca Partially revert libcxxrt changes to avoid _Unwind_Exception change
(Note I am also applying this to main and stable/13, to restore the old
libcxxrt ABI and to avoid having to maintain a compat library.)

After the recent cherry-picking of libcxxrt commits 0ee0dbfb0d and
d2b3fadf2d, users reported that editors/libreoffice packages from the
official package builders did not start anymore. It turns out that the
combination of these commits subtly changes the ABI, requiring all
applications that depend on internal details of struct _Unwind_Exception
(available via unwind-arm.h and unwind-itanium.h) to be recompiled.

However, the FreeBSD package builders always use -RELEASE jails, so
these still use the old declaration of struct _Unwind_Exception, which
is not entirely compatible. In particular, LibreOffice uses this struct
in its internal "uno bridge" component, where it attempts to setup its
own exception handling mechanism.

To fix this incompatibility, go back to the old declarations of struct
_Unwind_Exception, and restore the __LP64__ specific workaround we had
in place before (which was to cope with yet another, older ABI bug).

Effectively, this reverts upstream libcxxrt commits 88bdf6b290da
("Specify double-word alignment for ARM unwind") and b96169641f79
("Updated Itanium unwind"), and reapplies our commit 3c4fd2463b
("libcxxrt: add padding in __cxa_allocate_* to fix alignment").

PR:		253840
2021-03-13 14:54:24 +01:00
Alex Richardson
8cf5812af4 capsicum-test: Update for O_BENEATH removal
Update the tests to check O_RESOLVE_BENEATH instead.
If this looks reasonable, I'll try to upstream this change.
This keeps a compat fallback for O_BENEATH since the Linux port still
has/had O_BENEATH with "no .., no absolute paths" semantics.

Test Plan:	`/usr/tests/sys/capsicum/capsicum-test -u 977` passes and
		runs the O_RESOLVE_BENEATH tests.
Reviewed By:	markj
Differential Revision: https://reviews.freebsd.org/D29016
2021-03-12 17:12:10 +00:00
Stefan Eßer
028616d0dd bc: Vendor import new version 3.3.3 2021-03-05 12:33:01 +01:00
Ed Maste
19587d7422 clang: Fix -gz=zlib options for linker
Clang commit ccb4124a4172bf2cb2e1cd7c253f0f1654fce294:

Fix -gz=zlib options for linker

gcc translates -gz=zlib to --compress-debug-options=zlib for both
assembler and linker but clang only does this for assembler.

The linker needs --compress-debug-options=zlib option to compress the
debug sections in the generated executable or shared library.

Due to this bug, -gz=zlib has no effect on the generated executable or
shared library.

This patch fixes that.

Clang commit 462cf39a5c180621b56f7602270ce33eb7b68d23:

[Driver] Fix -gz=zlib options for linker also on FreeBSD

ccb4124a4172 fixed translating -gz=zlib to --compress-debug-sections for
linker invocation for several ToolChains, but omitted FreeBSD.

Approved by:	dim
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29028
2021-03-04 15:10:03 -05:00
Chris Rees
5ac70383c8 elftoolchain: stop leaving tempfiles on error
Temporary files were not cleaned up, resulting in $TMPDIR or even
the current directory becoming littered with ecp.* files.

This happened with error and even sometimes on success!

Approved by:		dim
MFC after:		4 weeks
Accepted upstream:	https://sourceforge.net/p/elftoolchain/code/3918/
Differential Revision:	https://reviews.freebsd.org/D28651
2021-03-04 12:24:07 +00:00
Alex Richardson
47ceb65f3c Fix capsicum-test build with GCC
Apparently GCC defines NULL to 0 in C++11 mode (instead of nullptr), so
this causes the following error:
```
In file included from capsicum-test.h:15,
                 from capsicum-test.cc:1:
gtest-1.10.0/include/gtest/gtest.h: In instantiation of 'testing::AssertionResult testing::internal::CmpHelperNE(const char*, const char*, const T1&, const T2&) [with T1 = long int; T2 = procstat*]':
capsicum-test.cc:75:3:   required from here
gtest-1.10.0/include/gtest/gtest.h:1621:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
 1609 |   if (val1 op val2) {\
      |       ~~~~~~~~~~~~
......
 1621 | GTEST_IMPL_CMP_HELPER_(NE, !=);
gtest-1.10.0/include/gtest/gtest.h:1609:12: note: in definition of macro 'GTEST_IMPL_CMP_HELPER_'
 1609 |   if (val1 op val2) {\
      |            ^~
```

Fix this by using nullptr directly.

Submitted upstream as https://github.com/google/capsicum-test/pull/56

Reported by:	Jenkins CI
2021-03-03 13:53:45 +00:00
Alex Richardson
955a3f9ad5 Update capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40
This includes various fixes that I submitted recently such as updating the
pdkill() tests for the actual implemented behaviour
(https://github.com/google/capsicum-test/pull/53) and lots of changes to
avoid calling sleep() and replacing it with reliable synchronization
(pull requests 49,51,52,53,54). This should make the testsuite more reliable
when running on Jenkins. Additionally, process status is now retrieved using
libprocstat instead of running `ps` and parsing the output
(https://github.com/google/capsicum-test/pull/50). This fixes one previously
failing test and speeds up execution.

Overall, this update reduces the total runtime from ~60s to about 4-5 seconds.
2021-03-02 16:38:05 +00:00
Alex Richardson
c88c1f23a8 Allow ssp_test:read to pass more reliably
It appears that the stackframe layout can be slightly different depending on
compiler and target architecture. For example, when using CHERI LLVM for RISC-V
we can actually overflow the buffer by up to 8 bytes without SSP detecting it.
Fix this by increasing the overflow to 15 bytes.

Reviewed By:	ngie, emaste
Differential Revision: https://reviews.freebsd.org/D28997
2021-03-01 19:56:05 +00:00
Baptiste Daroussin
95da5e131a dialog: fix macro redefinition
dialog.h defines MIN and MAX (making sure to undefine the previous
macros if it already exists), but sys/param.h also defines those
macros (without guards) and is included after dialog.h resulting
in both gcc and clang complaining about macro redefiniton

While clang do accept -Wno-macro-redefined to ignore the redefinition
warning, gcc does not [1]

Undefine both macros prior inclusion of sys/param.h to avoid the warning

Reported by:	arichardson
2021-03-01 16:01:44 +01:00
dankm
888ae57252 nvi: fix catalog generation
Upstream broke catalog generation with some over-eagre style cleanups.
This brings in my pull request.

Obtained from:	https://github.com/lichray/nvi2/pull/88
Differential Revision: https://reviews.freebsd.org/D28594
2021-02-26 16:32:01 +01:00
Baptiste Daroussin
ec74116ace dialog: finish update to 1.3-20210117
patch dialog.c which requires stddef for the usage of offsetof
catchup on the config header
2021-02-26 10:17:19 +01:00
Baptiste Daroussin
a96ef45019 dialog: import dialog 1.3-20210117 2021-02-26 10:16:49 +01:00
Baptiste Daroussin
7a65641922 ncurses: import version 6.2-20210220 2021-02-25 19:26:56 +01:00
Alex Richardson
fa32350347 close_range: add audit support
This fixes the closefrom test in sys/audit.

Includes cherry-picks of the following commits from openbsm:

4dfc628aaf
99ff6fe32a
da48a0399e

Reviewed By:	kevans
Differential Revision: https://reviews.freebsd.org/D28388
2021-02-23 17:47:07 +00:00
Dimitry Andric
d149877758 Fix possibly unitialized variables in __cxa_demangle_gnu3()
After 0ee0dbfb0d where I imported a more
recent libcxxrt snapshot, the variables 'rtn' and 'has_ret' could in
some cases be used while still uninitialized. Most obviously this would
lead to a jemalloc complaint about a bad free(), aborting the program.

Fix this by initializing a bunch variables in their declarations. This
change has also been sent upstream, with some additional changes to be
used in their testing framework.

PR:		253226
MFC after:	3 days
2021-02-22 21:01:09 +01:00
Alex Richardson
1ec3feb648 Update libm tests from NetBSD
I did this without a full vendor update since that would cause too many
conflicts. Since these files now almost match the NetBSD sources the
next git subtree merge should work just fine.

Reviewed By:	lwhsu
Differential Revision: https://reviews.freebsd.org/D28797
2021-02-22 17:41:04 +00:00
Dimitry Andric
d2b3fadf2d Revert 3c4fd2463b since upstream libcxxrt fixed it in another way
In 0ee0dbfb0d I imported a more recent
libcxxrt snapshot, which includes an upstream fix for the padding of
struct _Unwind_Exception:

e458560b7e

However, we also had a similar fix in our tree as:
https://cgit.freebsd.org/src/commit/?id=3c4fd2463bb29f65ef1404011fcb31e508cdf2e2

Since having both fixes makes the struct too large again, it leads to
SIGBUSes when throwing exceptions on amd64 (or other LP64 arches). This
is most easily tested by running kyua without any arguments.

It looks like our fix is no longer needed now, so revert it to reduce
diffs against upstream.

PR:		253226
Reviewed by:	arichardson, kp
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D28799
2021-02-19 22:18:02 +01:00
Dimitry Andric
0ee0dbfb0d Merge libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456
Interesting fixes:
b3c73ba libelftc_dem_gnu3: Sync with elftoolchain r3877
7b2335c Mostly fix __cxa_demangle after #3

Reported by:	arichardson
PR:		253226
MFC after:	3 days
2021-02-18 22:30:27 +01:00
Fernando Apesteguía
cee8be2c78 vis(1): Add EXAMPLES section
Add three examples showing the use of `-h`, `-l`, `-t`, `-w`

christos@netbsd.org to be notified.

Reviewed by: bcr@, gbe@, imp@
Approved by: bcr@, gbe@ (mentor), imp@

Differential Revision: https://reviews.freebsd.org/D25242
2021-02-18 19:10:33 +01:00
Alex Richardson
2aa3ef285a libc: Fix t_spawn_fileactions test after ATF update
Since 4581cefc1e
ATF opens the results file on startup. This fixes problems like
capsicumized tests not being able to open the file on exit.

However, this test closes all file descriptors above 3 to get a
deterministic fd table allocation for the child. Instead of using closefrom
(which will close the ATF output file FD) I've changed this test use
the lowest available fd and pass that to the helper program as a string.

We could also try to re-open the results file in ATF if we get a EBADF
error, but that will fail when running under Capsicum.

Reviewed By:	cem
Differential Revision: https://reviews.freebsd.org/D28684
2021-02-18 14:02:47 +00:00
Stefan Eßer
9a995fe186 Upgrade to version 3.3.0
This update changes the behavior of "-e" or "-f" in BC_ENV_ARGS:

Use of these options on the command line makes bc exit after executing
the given commands. These options will not cause bc to exit when
passed via the environment (but EOF in STDIN or -e or -f on the
command line will make bc exit as before).

The same applies to DC_ENV_ARGS with regard to the dc program.
2021-02-17 23:02:01 +01:00
Jung-uk Kim
6b7e592c21 lex: Do not let input() return 0 when end-of-file is reached
Importing flex 2.6.4 has introduced a regression: input() now returns 0
instead of EOF to indicate that the end of input was reached, just like
traditional AT&T and POSIX lex.  Note the behavior contradicts flex(1).
See "INCOMPATIBILITIES WITH LEX AND POSIX" section for information.
This incompatibility traces back to the original version and documented
in its manual page by the Vern Paxson.

Apparently, it has been reported in a few places, e.g.,

https://github.com/westes/flex/issues/448
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911415

Unfortunately, this also breaks the scanner used by libdtrace and
dtrace is unable to resolve some probe argument types as a result.  See
PR253440 for more information.

Note the regression was introduced by the following upstream commit
without any explanation or documentation change:

f863c9490e

Now we restore the traditional flex behavior unless lex-compatibility
mode is set with "-l" option because I believe the author originally
wanted to make it more lex and POSIX compatible.

PR:		253440
Reported by:	markj
2021-02-17 02:22:47 -05:00
Alex Richardson
2d936e6c99 Update capsicum-test to git commit 7707222b46abe52d18fd4fbb76115ffdb3e6f74b
This includes changes to use GTEST_SKIP() instead of the local hand-rolled
mechanism as well as a few minor cleanups.
2021-02-16 14:35:12 +00:00
Alex Richardson
10fc4c3218 Fix two failing tests after ATF update
Since 4581cefc1e
ATF opens the results file on startup. This fixes problems like
capsicumized tests not being able to open the file on exit.

However, this test closes all file descriptors just to check that
socketpair returns fd 3+4 and thereby also closes the ATF results file.
This then results in an EBADF when writing the result so the test is
reported as broken.

While system calls that create new file descriptors (must?) use the lowest
available file descriptor number, it does not seem useful to test this
property here. Drop the check for FD==3/4 to unbreak the testsuite.

We could also try to re-open the results file in ATF if we get a EBADF
error, but that will fail when running under Capsicum.

Reviewed By:	cem
Differential Revision: https://reviews.freebsd.org/D28683
2021-02-15 22:55:12 +00:00
Alex Richardson
90b5fc9583 lib/libc/tests/rpc: Correctly set timeout
The rpc_control() API does not accept the CLCR_SET_RPCB_TIMEOUT command,
it only accepts RPC_SVC_CONNMAXREC_GET/RPC_SVC_CONNMAXREC_SET, so it was
not doing anything.
Instead of incorrectly calling this API, use clnt_create_timed() instead.

I noticed this because the test was timing out after 120s in the CheriBSD CI.

Reviewed By:	ngie
Differential Revision: https://reviews.freebsd.org/D28478
2021-02-13 13:53:01 +00:00
Dimitry Andric
0ff1014944 Update Subversion to 1.14.1 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 1: 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.

NOTE 2: The upstream release also contains a fix for a security issue in
mod_dav_svn (CVE-2020-17525), but since we do not build or use any
Apache modules, it is not an issue for the FreeBSD base system.

Relnotes:	yes
MFC after:	3 days
2021-02-13 14:38:51 +01:00
Jung-uk Kim
bf80e08ed5 yacc: Regen test cases for the previous commit 2021-02-11 18:41:28 -05:00
Jung-uk Kim
80f3143274 yacc: Use NULL instead of 0 for pointers
Note araujo tried to fix it in r298241 but he only touched generated
files for bootstrap.  This commit properly fixes the problem.
2021-02-11 18:40:00 -05:00
Jung-uk Kim
34e67bb597 lex: Use NULL instead of 0 for pointers
Note araujo tried to fix it in r298241 but he only touched generated
files for bootstrap.  This commit properly fixes the problem.
2021-02-11 18:31:53 -05:00
Dimitry Andric
2512066228 Fix lib/msun/test builds on platforms without 80-bit long doubles
After d3338f3355, the lib/msun test case
'hypotl_near_underflow' would fail to compile on platforms where long
doubles weren't 80 bit, like on x86. Disable this particular test on
such platforms for now.

PR:		253313
MFC after:	1 week
X-MFC-With:     d3338f3355
2021-02-11 12:01:10 +01:00
Simon J. Gerraty
dba7b0ef92 Merge bmake-20210206
Changes of interest

  o unit-tests: use private TMPDIR to avoid errors from other users
  o avoid strdup in mkTempFile
  o always use vfork
  o job.c: do not create empty shell files in jobs mode
    reduce unnecessary calls to waitpid
  o cond.c: fix debug output for comparison operators in conditionals
2021-02-10 22:03:22 -08:00
Dimitry Andric
d3338f3355 Fix incorrect hypotl(3) result with subnormal numbers
This adjusts the factor used to scale the subnormal numbers, so it
becomes the right value after adjusting its exponent. Thanks to Steve
Kargl for finding the most elegant fix.

Also enable the hypot tests, and add a test case for this bug.

PR:		253313
MFC after:	1 week
2021-02-10 23:28:43 +01:00
Cy Schubert
f44e67d120 MFV d60fa10fd8:
Update unbound 1.13.0 --> 1.13.1.

Includes numerous bugfixes documented at:
https://www.nlnetlabs.nl/projects/unbound/download/#unbound-1-13-1

MFC after:	1 month
2021-02-09 20:27:25 -08:00
Dimitry Andric
51af033287 Add test case for 93fc678965 (incorrect powf(3) result)
This adds the test case to contrib/netbsd-tests/lib/libm/t_pow.c, as it
is currently the only place testing pow(3) and friends.

MFC after:	1 week
2021-02-09 23:37:18 +01:00
Cy Schubert
d60fa10fd8 Vendor import of Unbound 1.13.1.
Includes numerous bugfixes documented at:
https://www.nlnetlabs.nl/projects/unbound/download/#unbound-1-13-1
2021-02-09 12:59:02 -08:00
Cy Schubert
57785538c6 Simplify the FreeBSD check using __FreeBSD__ compiler macro.
Rather than rely on __FreeBSD_version, defined in sys/param.h, use
__FreeBSD__ defined by the compiler.

Reported by:	emaste
MFC after:	1 week
2021-02-08 16:36:27 -08:00
Cy Schubert
d20f7a5a3d Simply FreeBSD check using __FreeBSD__ and remove OpenBSD
MFC after:	1 week
2021-02-08 16:36:27 -08:00
Kyle Evans
3e2d96ac97 grep: fix -A handling in conjunction with -m match limitation
The basic issue here is that grep, when given -m 1, would stop all
line processing once it hit the match count and exit immediately.  The
problem with exiting immediately is that -A processing only happens when
subsequent lines are processed and do not match.

The fix here is relatively easy; when bsdgrep matches a line, it resets
the 'tail' of the matching context to the value supplied to -A and
dumps anything that's been queued up for -B. After the current line has
been printed and tail is reset, we check our mcount and do what's
needed. Therefore, at the time that we decide we're doing nothing, we
know that 'tail' of the context is correct and we can simply continue
on if there's still more to pick up.

With this change, we still bail out immediately if there's been no -A
flag. If -A was supplied, we signal that we should continue on. However,
subsequent lines will not even bothere to try and process the line.  We
have reached the match count, so even if the next line would match then
we must process it if it hadn't. Thus, the loop in procfile() can
short-circuit and just process the line as a non-match until
procmatches() indicates that it's safe to stop.

A test has been added to reflect both that we should be picking up the
next line and that the next line should be considered a non-match even
if it should have been.

PR:		253350
MFC-after:	3 days
2021-02-08 12:41:22 -06:00
Cy Schubert
10990cb460 Simplify FreeBSD check.
MFC after:	1 week
2021-02-05 18:39:38 -08:00
Cy Schubert
e673debe7d Simplify BSD macro tests.
All FreeBSD and NetBSD are BSD >= 199306 and have been for a long time.

MFC after:	1 week
2021-02-05 18:39:38 -08:00
Kyle Evans
f823c6dc73 grep: fix null pattern and empty pattern file behavior
The null pattern semantics were terrible because I tried to match gnugrep,
but I got it wrong.  Let's unwind that:

- The null pattern should match every line if neither -w nor -x.
- The null pattern should match empty lines if -x.
- The null pattern should not match any lines if -w.

The first two will stop processing (shortcut) even if additional patterns
are specified. In any other case, we will continue processing other
patterns.  If no other patterns are specified beside a null pattern, then
we match if neither -w nor -x or set and do not match if either of those
are specified.

The justification for -w is that it should match on a whole word, but the
null pattern deos not have a whole word to match on.

Empty pattern files should never match anything, and more importantly, -v
should cause everything to be written.

PR:		253209
MFC-after:	4 days
2021-02-04 20:59:42 -06:00
Alex Richardson
c203bd70b5 Import atf 0.22 snapshot ca73d08c3fc1ecffc1f1c97458c31ab82c12bb01
This includes improvements to the atf-sh helper functions that
significantly reduce the number of spawned processes for each test
and therefore speeds up running the testsuite noticeably.
2021-02-04 15:03:05 +00:00
John Baldwin
cb7cc72c54 serf: Fix the default return value of the BIO control method.
OpenSSL BIO classes provide an abstraction for dealing with I/O.
OpenSSL provides BIO classes for commonly used I/O primitives backed
by file descriptors, sockets, etc. as well as permitting consumers
of OpenSSL to define custom BIO classes.

One of the methods BIO classes implement is a control method invoked
by BIO_ctrl() for various ancilliary tasks somewhat analgous to
fcntl() and ioctl() on file descriptors.  According to the BIO_ctrl(3)
manual page, control methods should return 0 for unknown control
requests.

KTLS support in OpenSSL adds new control requests.  Two of those new
requests are queries to determine if KTLS is enabled for either
reading or writing.  These control reuquest return 1 if KTLS is
enabled and 0 if it is not.

serf includes two custom BIO classes for wrapping I/O requests from
files and from a buffer in memory.  These BIO classes both use a
custom control method.  However, this custom control method was
returning 1 for unknown or unsupported control requests instead of 0.
As a result, OpenSSL with KTLS believed that these BIOs were using
KTLS and were thus adding headers and doing encryption/decryption in
the BIO.  Correcting the return value removes this confusion.

PR:		253135
Reported by:	Guido Falsi <mad@madpilot.net>
Reviewed by:	emaste
MFC after:	3 days
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D28472
2021-02-03 14:59:32 -08:00
Ed Maste
847dfd2803 readelf: do not trucate section name with -W
PR:		246015
Reviewed by:	cem
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28461
2021-02-03 16:24:22 -05:00
Ed Maste
e79b51e2b2 readelf: decode LA48 and ASG_DISABLE feature flags
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-02-03 16:17:56 -05:00
Alex Richardson
2a39919364 readelf: Fix printing NT_FREEBSD_ARCH_TAG
Looking at lib/csu/arm/crt1_s.S, this should be a string and therefore the
restriction to 4 characters seems wrong.
Found whle updating https://reviews.llvm.org/D74393.

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D28470
2021-02-03 15:44:39 +00:00
Cy Schubert
0f34c80f37 Replace the redundant MENTAT macro with SOLARIS.
MENTAT and SOLARIS are synonymous. Remove the extraneous duplicate
macro.

MFC after:	1 week
2021-02-01 17:19:15 -08:00
Cy Schubert
4cd1807c7d Retire the K&R/STD C __P prototype declarations.
In the old days when K&R C and STD C were each in use a workaround
(read hack) was required to allow the same code to work on each
without modification. All C compilers support STD C. We can finally
put the __P prototype to rest.

MFC after:	1 week
2021-02-01 17:19:15 -08:00
Stefan Eßer
10328f8b11 Merge commit '47a52dc4d48f259ab7d9f9ba6b65f4f2331a22dc'
Update to version 3.2.6

MFC after:	3 days
2021-01-31 21:07:42 +01:00
Alex Richardson
83ff5d5d98 Un-XFAIL two tests with Clang > 10
SVN r343917 fixed this for in-tree clang, but when building with a newer
out-of-tree clang the test was still marked as XFAIL.

Reviewed By:	dim
Differential Revision: https://reviews.freebsd.org/D28390
2021-01-28 17:24:24 +00:00
Dimitry Andric
e63539f305 Fix clang assertion when compiling the devel/onetbb port
Merge commit 740a164de from llvm git (by Richard Smith):

  PR46377: Fix dependence calculation for function types and typedef
  types.

  We previously did not treat a function type as dependent if it had a
  parameter pack with a non-dependent type -- such a function type depends
  on the arity of the pack so is dependent even though none of the
  parameter types is dependent. In order to properly handle this, we now
  treat pack expansion types as always being dependent types (depending on
  at least the pack arity), and always canonically being pack expansion
  types, even in the unusual case when the pattern is not a dependent
  type. This does mean that we can have canonical types that are pack
  expansions that contain no unexpanded packs, which is unfortunate but
  not inaccurate.

  We also previously did not treat a typedef type as
  instantiation-dependent if its canonical type was not
  instantiation-dependent. That's wrong because instantiation-dependence
  is a property of the type sugar, not of the type; an
  instantiation-dependent type can have a non-instantiation-dependent
  canonical type.

Merge commit 9cf98d26e from llvm git (by Richard Smith):

  PR46637: Fix handling of placeholder types in trailing-return-types.

  Only permit a placeholder type in a trailing-return-type if it would
  also have been permitted in the decl-specifier sequence of a
  corresponding declaration with no trailing-return-type. The standard
  doesn't actually say this, but this is the only thing that makes sense.

  Also fix handling of an 'auto' in a trailing-return-type in a parameter
  of a generic lambda. We used to crash if we saw such a thing.

Merge commit 234f51a65 from llvm git (by Richard Smith):

  Don't crash if we deserialize a pack expansion type whose pattern
  contains no packs.

  Fixes a regression from 740a164dec483225cbd02ab6c82199e2747ffacb.

PR:		252892
Reported by:	thierry
MFC after:	3 days
2021-01-26 17:51:25 +01:00
Cy Schubert
25cdacf79b Import sqlite 3.34.1 (3340100). 2021-01-25 20:24:44 -08:00
Cy Schubert
1fc148624f Fix build following bfc99943b0.
bfc99943b0 removed ndis(4) support however
wpa as delivered by the wpa upstream (w1.fi) enables NDIS by default.
This commit disables NDIS suppport in the w1.fi delivered build config,
circumventing the build failure.
2021-01-25 14:46:45 -08:00
Cy Schubert
83edbc3cb5 ipfilter: Retire pre-standard C support.
All C compilers in 2021 support standard C and architectures that did
not were retired long ago. Simplify by removing now redundant
pre-standard C code.

MFC after:	1 week
2021-01-25 14:46:45 -08:00
Philip Paeps
8c5bef2eb2 contrib/tzdata: import tzdata 2021a
Merge commit '4cd7e1071de16a7392b0e466287f13e9e6f2081a'

Changes: https://github.com/eggert/tz/blob/2021a/NEWS

MFC after:      3 days
2021-01-25 08:18:14 +08:00
Cy Schubert
d70886d063 wpa_supplicant uses PF_ROUTE to return the routing table in order to
determine the length of the routing table buffer. As of 81728a538d
wpa_supplicant is started before the routing table has been populated
resulting in the length of zero to be returned. This causes
wpa_supplicant to loop endlessly. (The workaround is to kill and restart
wpa_supplicant as by the time it is restarted the routing table is
populated.)

(Personally, I was not able to reproduce this unless wlan0 was a member of
lagg0. However, others experienced this problem on standalone wlan0.)

PR:		252844
Submitted by:	shu <ankohuu _ outlook.com>
Reported by:	shu <ankohuu _ outlook.com>
Reviewed by:	cy
X-MFC with:	81728a538d
Differential Revision:	https://reviews.freebsd.org/D28249
2021-01-20 07:45:18 -08:00
Alex Richardson
7954ad9f22 Fix macro-redefined warning in gnu/diff for fputc_unlocked
While updating config.h to set HAVE_DECL_FPUTC_UNLOCKED to 1 also update
the other macros that are defined in stdio.h.
2021-01-19 21:23:25 +00:00
Simon J. Gerraty
06b9b3e0ad Merge bmake-20210110
Quite a lot of churn on style, but lots of
good work refactoring complicated functions
and lots more unit-tests.
Thanks mostly to rillig at NetBSD

Some interesting entries from ChangeLog

o .MAKE.{UID,GID} represent uid and gid running make.

o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o add more unit tests for META MODE

Merge commit '8e11a9b4250be3c3379c45fa820bff78d99d5946' into main

Change-Id: I464fd4c013067f0915671c1ccc96d2d8090b2b9c
2021-01-13 22:21:37 -08:00
Kyle Evans
0495ed398c contrib/lua: update to 5.4.2
Merge commit '0ea45b9cd43ce1247eb3eee9bfd5cee3d19068e7' into main
2021-01-13 23:56:18 -06:00
Toomas Soome
2c52512caf pnglite: should use ntohl
Replace manual conversion with ntohl()
2021-01-12 00:56:35 +02:00
Dimitry Andric
86d2671e3e Update contrib/llvm-project/FREEBSD-Xlist for llvmorg-11.0.1-rc2.
MFC after:	4 weeks
X-MFC-With:	r364284
2021-01-03 14:21:54 +01:00
Dimitry Andric
eaeb601bd6 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.1-rc2-0-g43ff75f2c3f (aka 11.0.1 rc2).

MFC after:	4 weeks
X-MFC-With:	r364284
2021-01-03 13:54:24 +01:00
Toomas Soome
80aa931900 contrib: setup pnglite 2021-01-02 21:29:24 +02:00
Toomas Soome
72c59f1728 Add 'contrib/pnglite/' from commit 'a70c2a23d0d84dfc63a1d9413a7f4aaede7313aa'
git-subtree-dir: contrib/pnglite
git-subtree-mainline: 5bcd0b860c
git-subtree-split: a70c2a23d0
2021-01-02 21:27:29 +02:00
Toomas Soome
5bcd0b860c contrib: setup terminus 2021-01-02 21:03:28 +02:00
Toomas Soome
eb1e8a8296 Add 'contrib/terminus/' from commit 'cee3932f8c02a220d70e48949c7c5ca6e98dfef4'
git-subtree-dir: contrib/terminus
git-subtree-mainline: 51a9b978e7
git-subtree-split: cee3932f8c
2021-01-02 20:57:12 +02:00
Kyle Evans
8929690a63 contrib: remove libgnuregex
This should have been a part of 47d1ad2413, but it was overlooked. All of
the build bits have been previously removed, and nothing references this
anymore.
2021-01-02 00:00:58 -06:00
Dimitry Andric
543478be75 Merge commit 4f568fbd2 from llvm git (by Nemanja Ivanovic):
[PowerPC] Do not emit HW loop when TLS var accessed in PHI of loop
  exit

  If any PHI nodes in loop exit blocks have incoming values from the
  loop that are accesses of TLS variables with local dynamic or general
  dynamic TLS model, the address will be computed inside the loop.
  Since this includes a call to __tls_get_addr, this will in turn cause
  the CTR loops verifier to complain. Disable CTR loops in such cases.

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

This should fix building ceph 12.2.12 on powerpc64, powerpc, powerpcspe
and powerpc64le.

Requested by:	pkubaj
MFC after:	3 days
2021-01-01 15:35:13 +01:00
Ed Maste
f492599d7b Remove unused contrib/gdb
As of 1c0ea326aa in-tree gdb is not used.  Clean up the contrib
directory.

Reported by:	kib
Sponsored by:	The FreeBSD Foundation
2020-12-31 13:41:17 -05:00
Kyle Evans
9e1281eaba libc: tests: hook CPUSET(9) test up to the build
Add shims to map NetBSD's API to CPUSET(9). Obviously the invalid input
parts of these tests are relatively useless since we're just testing the
shims that aren't used elsewhere, there's still some amount of value in
the parts testing valid inputs.

Differential Revision:	https://reviews.freebsd.org/D27307
2020-12-31 12:26:01 -06:00
Philip Paeps
e35a01eec6 contrib/tzdata: import tzdata 2020f
Merge commit '96b88ac701b35ce68425046d4be8f51cb75b5d5b' into main

Changes: https://github.com/eggert/tz/blob/2020f/NEWS

MFC after:    1 day
2020-12-30 12:50:26 +08:00
Poul-Henning Kamp
3db1b221ed Set stdout & stderr unbuffered, so that the "telnet>" prompt
also shows up when output is redirected:

	telnet |& tee _log
2020-12-29 21:05:48 +00:00
Edward Tomasz Napierala
f53120073b Revert "bsnmpclient(3): make it thread-safe"
This reverts commit 89e3d5671b.

As pointed out, there are several problems with that commit:

1. The new semantics, while useful for clients where multiple
   threads use separate contexts, breaks clients which correctly
   share a single one
2. Change in semantics would require a library version bump
3. It doesn't build with GCC
2020-12-29 19:55:05 +00:00
Edward Tomasz Napierala
89e3d5671b bsnmpclient(3): make it thread-safe
Reviewed By:	harti
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27336
2020-12-29 14:59:37 +00:00
Martin Matuska
69a18c5826 contrib/libarchive: Import libarchive 3.5.1
Merge commit '8be2bb3d35e232080b4e39244020e650bbe31562' into main
2020-12-28 00:34:06 +01:00
Stefan Eßer
e458944cf9 Import bc 3.2.4 2020-12-27 22:32:22 +01:00
Philip Paeps
dc505d53dc contrib/tzdata: import tzdata 2020e
Changes: https://github.com/eggert/tz/blob/2020e/NEWS

MFC after:    insta-MFC
2020-12-25 23:16:38 +08:00
Cy Schubert
7d8ff32452 Sync ippool.8 man page synopsis with reality and the rest of the
man page..

MFC after:	3 days
2020-12-23 17:04:34 -08:00
Marcin Wojtas
b62ae61446 Fix abort in jemalloc extent coalescing.
Fix error in extent_try_coalesce_impl(), which could cause abort
to happen when trying to coalesce extents backwards. The error could
happen because of how extent_before_get() function works. This function
gets address of previous extent, by subtracting page size from current
extent address. If current extent is located at PAGE_SIZE offset, this
address resolved to 0x0000. An assertion in rtree_leaf_elm_lookup
then caused the running program to abort.

This problem was discovered when trying to build world on 32-bit
machines with ASLR and PIE enabled. The problem was encountered
on armv7 and i386 machines, but most likely other 32-bit
architectures are affected as well.

While this patch fixes one problem with buildworld on 32-bit platforms
with ASLR, the build still fails, however it happens much later
and due to lack of memory.

The change is aligned with accepted fix in the upstream Jemalloc
repository (https://github.com/jemalloc/jemalloc/pull/1973).
As it doesn't apply on top of Jemalloc tree, its updated version
was eventually merged: https://github.com/jemalloc/jemalloc/pull/2003

PR: 249937
Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D27025
2020-12-18 10:09:21 +00:00
Xin LI
7341cb0cd1 MFV r368746:
Apply upstream fix 08968baec1122a58bb90d8f97ad948a75f8a5d69:

Fix error cases when udp-connect is set and send() returns an error

Obtained from:	unbound git
MFC after:	3 days
2020-12-18 04:23:20 +00:00
Ed Maste
546114d08e Remove contrib/binutils, unused after r368667 2020-12-16 14:01:04 +00:00
Martin Matuska
87c1ec0a31 MFV r368607:
Sync libarchive with vendor.

Vendor changes:
  Issue #1461: Unbreak build without lzma
  Issue #1462: warc reader: Fix build with gcc11
  Issue #1463: Fix code compatibility in test_archive_read_support.c
  Issue #1464: Use built-in strnlen on platforms where not available
  Issue #1465: warc reader: fix undefined behaviour in deconst() function

MFC after:	3 days
X-MFC-With:	368234
2020-12-13 16:26:37 +00:00
Martin Matuska
bcd2ffcdc2 Update vendor/libarchive/dist to b2c3ee7e2907511533eeb2a0f2ceecc1faa73185
Vendor changes:
  Issue #1461: Unbreak build without lzma
  Issue #1462: warc reader: Fix build with gcc11
  Issue #1463: Fix code compatibility in test_archive_read_support.c
  Issue #1464: Use built-in strnlen on platforms where not available
  Issue #1465: warc reader: fix undefined behaviour in deconst() function
2020-12-13 15:29:19 +00:00
Gordon Bergling
6580cc162d ee(1): Whitespace cleanup
This is a direct commit to -CURRENT since the upstream went away.

MFC after:	1 week
2020-12-10 10:58:30 +00:00
Dimitry Andric
6813f2420b Merge commit 28de0fb48 from llvm git (by Luís Marques):
[RISCV] Set __GCC_HAVE_SYNC_COMPARE_AND_SWAP_x defines

  The RISCV target did not set the GCC atomic compare and swap defines,
  unlike other targets. This broke builds for things like glib on
  RISCV.

  Patch by Kristof Provost (kprovost)

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

This should fix building glib20 on RISC-V and unblock a number of
dependent ports.

Requested by:	kp
MFC after:	3 days
2020-12-09 18:37:43 +00:00
Cy Schubert
369c692350 MFV r368464:
Update unbound from 1.12.0 to 1.13.0

MFC after:	1 week
Security:	CVE-2020-28935
2020-12-09 02:59:24 +00:00
Bryan Drewery
2dfa4b66b3 fts_read: Handle error from a NULL return better.
This is addressing cases such as fts_read(3) encountering an [EIO]
from fchdir(2) when FTS_NOCHDIR is not set.  That would otherwise be
seen as a successful traversal in some of these cases while silently
discarding expected work.

As noted in r264201, fts_read() does not set errno to 0 on a successful
EOF so it needs to be set before calling it.  Otherwise we might see
a random error from one of the iterations.

gzip is ignoring most errors and could be improved separately.

Reviewed by:	vangyzen
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D27184
2020-12-08 23:38:26 +00:00
Cy Schubert
c1dbcbf2d1 Vendor import of Unbound 1.13.0.
Security:	CVE-2020-28935
2020-12-08 21:23:03 +00:00
Stefan Eßer
c6bfc8968d Upgrade to version 3.2.3 2020-12-06 11:49:21 +00:00
Kyle Evans
4f1efa309c libc: regex: partial revert of r368358
Part of the libregex functionality leaked into the tests it shares with
the standard regex(3). Introduce a P flag to set the REG_POSIX cflag to
indicate that libc regex should effectively do nothing while libregex should
specifically run it in non-extended mode.

This unbreaks the libc/regex test run.

Reported by:	Jenkins
2020-12-05 14:38:46 +00:00
Kyle Evans
6b986646d4 libregex: implement \b and \B (word boundary, not word boundary)
This is the last of the needed GNU expressions before we can unleash bsdgrep
by default. \b is effectively an agnostic equivalent of \< and \>, while
\B will match every space that isn't making a transition from
nonchar -> char or char -> nonchar.
2020-12-05 03:16:05 +00:00
Dimitry Andric
c3f7be36e8 Merge commit d989ffd10 from llvm git (by Dimitry Andric):
Implement computeHostNumHardwareThreads() for FreeBSD

  This retrieves CPU affinity via FreeBSD's cpuset(2) API, and makes
  LLVM respect affinity settings configured by the user via the
  cpuset(1) command.

  In particular, this allows to reduce the number of threads used on
  machines with high core counts, which can interact badly with
  parallelized build systems. This is particularly noticable with lld,
  which spawns lots of threads even for linking e.g. hello_world!

  This fix is related to PR48193, but does not adress the more
  fundamental problem, which is that LLVM by default grabs as many CPUs
  and/or threads as possible.

  Reviewed By: MaskRay

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

Originally by:	mjg
MFC after:	1 week
2020-12-03 19:29:18 +00:00
Dimitry Andric
5cc6cb2645 Revert r367815, so we can apply the slightly different version that
landed upstream:

For llvm's internal function which retrieves the number of available
"hardware threads", use cpuset_getaffinity(2) on FreeBSD, so it will
honor processor sets configured by the cpuset(1) command.

This should make it possible to avoid e.g. lld creating a huge number of
threads on a machine with many cores, even for linking simple programs.

This will also be submitted upstream.

Submitted by:	mjg
2020-12-03 19:26:21 +00:00
Ed Maste
67b94fc58e addr2line: fix allocation leak in error path
CID:		1437677
Reported by:	Coverity Scan
Sponsored by:	The FreeBSD Foundation
2020-12-03 14:41:11 +00:00
Ed Maste
f4d6ed9a5c addr2line: rework check_range conditions
Simplify logic and reduce indentation for DW_AT_low_pc case.

Reviewed by:	Tiger Gao, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27426
2020-12-02 17:22:29 +00:00
Martin Matuska
c3afd20f13 MFV r368207:
Update libarchive to 3.5.0

Relevant vendor changes:
  Issue #1258: add archive_read_support_filter_by_code()
  PR #1347: mtree digest reader support
  Issue #1381: skip hardlinks pointing to itself on extraction
  PR #1387: fix writing of cpio archives with hardlinks without file type
  PR #1388: fix rdev field in cpio format for device nodes
  PR #1389: completed support for UTF-8 encoding conversion
  PR #1405: more formats in archive_read_support_format_by_code()
  PR #1408: fix uninitialized size in rar5_read_data
  PR #1409: system extended attribute support
  PR #1435: support for decompression of symbolic links in zipx archives
  Issue #1456: memory leak after unsuccessful archive_write_open_filename

MFC after:	1 week
2020-12-01 15:53:12 +00:00
Ed Maste
a36179937e addr2line: add label checks when DW_AT_range and DW_AT_low_pc cannot be used
Check label's ranges for address we want to translate if a CU doesn't
have usable DW_AT_range or DW_AT_low_pc.

Use more appropriate names: "struct CU" -> "struct range"

Developed as part of upstream ELF Tool Chain bug report
https://sourceforge.net/p/elftoolchain/tickets/552/ although this does
not address the specific case reported there.

Submitted by:	Tiger Gao <tig@freebsdfoundation.org>
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23782
2020-11-27 21:38:03 +00:00
Stefan Eßer
50696a6e8c Update to version 3.2.0 2020-11-26 17:39:51 +00:00
Alex Richardson
371f152c7f Significantly speed up libthr/mutex_test and make more reliable
Instead of using a simple global++ as the data race, with this change we
perform the increment by loading the global, delaying for a bit and then
storing back the incremented value. If I move the increment outside of the
mutex protected range, I can now see the data race with only 100 iterations
on amd64 in almost all cases. Before this change such a racy test almost
always passed with < 100,000 iterations and only reliably failed with the
current limit of 10 million.

I noticed this poorly written test because the mutex:mutex{2,3} and
timedmutex:mutex{2,3} tests were always timing out on our CheriBSD Jenkins.
Writing good concurrency tests is hard so I won't attempt to do so, but this
change should make the test more likely to fail if pthread_mutex_lock is not
implemented correctly while also significantly reducing the time it takes to
run these four tests. It will also reduce the time it takes for QEMU RISC-V
testsuite runs by almost 40 minutes (out of currently 7 hours).

Reviewed By:	brooks, ngie
Differential Revision: https://reviews.freebsd.org/D26473
2020-11-26 13:31:57 +00:00
Alan Somers
01f3f35447 ping: fix some man pages and tests after r368045
MFC-with:	r368045
2020-11-26 04:55:02 +00:00
Ed Maste
3063e1e56b clang: allow -fstack-clash-protection on FreeBSD
-fstack-clash-protection was added in Clang commit e67cbac81211 but was
enabled only on Linux.  It should work fine on FreeBSD as well, so
enable it.

To be discussed and upstreamed with a test.  The OS test should probably
just be removed.

Reviewed by:	dim
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27366
2020-11-25 14:26:13 +00:00
Simon J. Gerraty
e2eeea75eb Merge bmake-20201117
o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o More code cleanup and refactoring.

o More unit tests

MFC after:	1 week
2020-11-20 06:02:31 +00:00
Ed Maste
65c207758a addr2line: swap if conditions for diff reduction in upcoming change
No functional change intended.
2020-11-19 21:10:36 +00:00
Dag-Erling Smørgrav
a90c7d9aa8 Merge upstream r948: fix race condition in openpam_ttyconv(3). 2020-11-19 05:46:59 +00:00
Dimitry Andric
991f6e7534 For llvm's internal function which retrieves the number of available
"hardware threads", use cpuset_getaffinity(2) on FreeBSD, so it will
honor processor sets configured by the cpuset(1) command.

This should make it possible to avoid e.g. lld creating a huge number of
threads on a machine with many cores, even for linking simple programs.

This will also be submitted upstream.

Submitted by:	mjg
MFC after:	1 week
2020-11-18 19:55:24 +00:00
Dimitry Andric
1e4896b176 When elftoolchain's objcopy (or strip) is rewriting a file in-place,
make it create the temporary file in the same directory as the source
file by default, instead of always using $TMPDIR or /tmp. If creating
that file fails because the directory is not writable, also fallback to
$TMPDIR or /tmp.

This has also been submitted upstream as:
https://sourceforge.net/p/elftoolchain/tickets/597/

Reported by:	cem
PR:		250872
MFC after:	2 weeks
2020-11-18 18:40:58 +00:00
Dimitry Andric
2418469b60 Merge commit 8df4e6094 from llvm git (by Fangrui Song):
[ELF] Don't consider SHF_ALLOC ".debug*" sections debug sections

  Fixes PR48071

  * The Rust compiler produces SHF_ALLOC `.debug_gdb_scripts` (which
    normally does not have the flag)
  * `.debug_gdb_scripts` sections are removed from `inputSections` due
    to --strip-debug/--strip-all
  * When processing --gc-sections, pieces of a SHF_MERGE section can be
    marked live separately

  `=>` segfault when marking liveness of a `.debug_gdb_scripts` which
  is not split into pieces (because it is not in `inputSections`)

  This patch circumvents the problem by not treating SHF_ALLOC
  ".debug*" as debug sections (to prevent --strip-debug's stripping)
  (which is still useful on its own).

  Reviewed By: grimar

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

This should fix lld segfaulting when linking the rust-based parts of the
devel/py-maturin port.

Reported by:	Nick Venenga <nijave@gmail.com>
PR:		250783
MFC after:	3 days
2020-11-12 19:25:31 +00:00
Dimitry Andric
1ee2434eb5 Merge commit 354d3106c from llvm git (by Kai Luo):
[PowerPC] Skip combining (uint_to_fp x) if x is not simple type

  Current powerpc64le backend hits
  ```
  Combining: t7: f64 = uint_to_fp t6
  llc: llvm-project/llvm/include/llvm/CodeGen/ValueTypes.h:291:
  llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() &&
  "Expected a SimpleValueType!"' failed.
  ```
  This patch fixes it by skipping combination if `t6` is not simple
  type.
  Fixed https://bugs.llvm.org/show_bug.cgi?id=47660.

  Reviewed By: #powerpc, steven.zhang

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

This should fix the llvm assertion mentioned above when building the
following ports for powerpc64le:

* audio/traverso
* databases/percona57-pam-for-mysql
* databases/percona57-server
* emulators/citra
* emulators/citra-qt5
* games/7kaa
* graphics/dia
* graphics/mandelbulber
* graphics/pcl-pointclouds
* net-p2p/libtorrent-rasterbar
* textproc/htmldoc

Requested by:	pkubaj
MFC after:	3 days
2020-11-08 12:47:35 +00:00
Simon J. Gerraty
956e45f6fb Update to bmake-20201101
Lots of new unit-tests increase code coverage.

Lots of refactoring, cleanup and simlpification to reduce
code size.

Fixes for Bug 223564 and 245807

Updates to dirdeps.mk and meta2deps.py
2020-11-07 21:46:27 +00:00
Enji Cooper
ae41709ab4 snmpmod(3): fix typo under the COMMUNITIES section
"recipte" should be spelled like "receipt".

.Dd is intentionally not being bumped for the change.

MFC after:	1 week
Sponsored by:	DellEMC
2020-11-05 21:37:24 +00:00
Dimitry Andric
7b7921b47e Make vector-related functions in libcxxrt's demangler static
Follow-up to r367323 by re-adding static to a number of the functions
copied from elftc's libelftc_vstr.c. This was requested by upstream.

PR:		250702
MFC after:	3 days
2020-11-04 17:51:09 +00:00
Dimitry Andric
a7941b3326 Update libcxxrt's private copy of elftoolchain demangler
This updates the private copy of libelftc_dem_gnu3.c in libcxxrt with
the most recent version from upstream r3877. Similar to r367322, this
fixes a number of possible assertions, and allows it to correctly
demangle several names that it could not handle before.

PR:		250702
MFC after:	3 days
2020-11-04 11:13:36 +00:00
Dimitry Andric
c2bffd0a97 Merge elftoolchain r3877 (by jkoshy):
Incorporate fixes from Dimitry Andric:

  - Use a BUFFER_GROW() macro to avoid rounding errors in capacity
    calculations.
  - Fix a bug introduced in [r3531].
  - Fix handling of nested template parameters.

  Ticket:	#581

This should fix a number of assertions on elftoolchain's cxxfilt, and
allow it to correctly demangle several names that it could not handle
before.

Obtained from:	https://sourceforge.net/p/elftoolchain/code/3877/
PR:		250702
MFC after:	3 days
2020-11-04 11:02:05 +00:00
Brandon Bergren
d4fba56212 Fix 32-bit build after r367209
Fix build on systems with a 32-bit size_t.

Since it's being passed as a pointer, a 64-bit write to it will overflow.

MFC with:	r367209
2020-10-31 22:14:37 +00:00
Ed Maste
e128bd0ff9 readelf: Add -z decompression support
Compatible with GNU readelf, -z decompresses sections displayed by
-x or -p.

ELF Tool Chain ticket #555
https://sourceforge.net/p/elftoolchain/tickets/555/

Submitted by:	Tiger Gao <tig@FreeBSDFoundation.org>
Reviewed by:	markj
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:    https://reviews.freebsd.org/D26909
2020-10-31 15:27:45 +00:00
Cy Schubert
c0caa2e24e MFV r367082:
Update unbound 1.11.0 --> 1.12.0.

MFC after:	1 month.
2020-10-27 23:03:15 +00:00
Cy Schubert
4cb89f2eee Vendor import of Unbound 1.12.0. 2020-10-27 15:09:16 +00:00
Cy Schubert
b85540d0a3 Remove a random equal sign from the example. It should not be there.
It's a syntax error.

PR:		210303
Reported by:	leventelist at gmail.com
MFC after:	3 days
2020-10-27 04:35:47 +00:00
Cy Schubert
bbd1103c30 Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after:	3 days
2020-10-27 04:35:36 +00:00
Brooks Davis
f61a22193c Key decleration of union semun on src version
__FreeBSD__ is defined by the compiler derived from the triple. When
building FreeBSD 11 on a FreeBSD 12 with a CROSS_TOOLCHAIN=llvm10,
__FreeBSD__ was set to 12 when building lib32 (for some reason no triple
is being passed which seems to mean that we're taking default values
from the build system).  This in turn meant we end up with a double
decleration of union semun which is a build error.

Reviewed by:	gshapiro, dim
Differential Revision:	https://reviews.freebsd.org/D26902
2020-10-26 17:52:28 +00:00
Ryan Moeller
73577bf01d flua: Add a libjail module
libjail is pretty small, so it makes for a good proof of concept demonstrating
how a system library can be wrapped to create a loadable Lua module for flua.

* Introduce 3lua section for man pages
* Add libjail module

Reviewed by:	kevans, manpages
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D26080
2020-10-24 17:08:59 +00:00
Xin LI
6f26c71d76 MFV r366990: less v563.
MFC after:	2 weeks
Relnotes:	yes
2020-10-24 15:58:42 +00:00
Ed Maste
573456a931 libelf: add compression header support
GNU and Oracle libelf implementations added support for section
compression, intended to reduce the size of DWARF debug info (which
might be an order of magnitude larger than the code).

There are two compressed ELF section formats:

1. Old GNU - sections are renmaed to start with 'z'.  Section contains
   a magic number, uncompressed size, and compressed data.

2. Oracle and New GNU - compressed sections use the SHF_COMPRESSED flag.
   The compression header contains the compression type, uncompressed
   size, and uncompressed alignment.

The second style is preferred and this change implements only that one.

Submitted by:	Tiger Gao <tig@FreeBSDFoundation.org>
Reviewed by:	markj
MFC after:	2 weeks
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D24566
2020-10-23 16:35:23 +00:00
Philip Paeps
3611c2d809 Import tzdata 2020c
Changes: https://github.com/eggert/tz/blob/2020d/NEWS

MFC after:	1 day
2020-10-22 01:05:34 +00:00
Adrian Chadd
d061adc48d [libcxx] Fix atomic type for mips32 on gcc to work w/out needing libatomic
When compiling this for mips32 on gcc-6.x, we'd hit issues where we
don't have 64 bit atomics on mips32.

gcc implements this using libatomic, which we don't currently include
in our freebsd-gcc compiler packages.

So for now add this work around so mips32 works.  It's also fine for
mips64.  We can fix this later once we get libatomic included.

Approved by:	dim
Differential Revision:	https://reviews.freebsd.org/D26774
2020-10-18 17:31:10 +00:00
Philip Paeps
e7e2d659af Import tzdata 2020c
Changes: https://github.com/eggert/tz/blob/2020c/NEWS

MFC after:	1 day
2020-10-17 00:44:04 +00:00
Kyle Evans
bf9580a118 MFC r366760: lua: update to 5.3.6
This release contains some minor bugfixes; notably:
- 2x minor Makefile fixes (not used in base)
- Long brackets with a huge number of '=' overflow some internal buffer
  arithmetic.
- Joining an upvalue with itself can cause a use-after-free crash.

See here for examples: http://www.lua.org/bugs.html#5.3.5

MFC after:	2 weeks
2020-10-16 17:03:27 +00:00
Adrian Chadd
d00afbaea9 This fixes some fun type size truncation that shows up giving errors like
" changes value from '287948901175001088' to '0' "

.. which turns out is a known issue with later gcc's.

eg - https://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00154.html

It was fixed up upstream corelib/gnulib in commit hash
252b52457da7887667c036d18cc5169777615bb0
(eg in 252b52457d)

TEST PLAN
  - compiled/run for gcc-6.4 on amd64

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D26804
2020-10-16 14:28:13 +00:00
Adrian Chadd
cdd9aa250e [tests] Fix itimer test warning-errors on gcc-6.4
This fixes a "suggested parens" compile warning-into-error
that shows up on gcc-6.4.

Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D26789
2020-10-15 14:55:07 +00:00
Dimitry Andric
f845673b24 Merge commit 35ecc7fe4 from llvm git (by Hubert Tong):
[clang][Sema] Fix PR47676: Handle dependent AltiVec C-style cast

  Fix premature decision in the presence of type-dependent expression
  operands on whether AltiVec vector initializations from single
  expressions are "splat" operations.

  Verify that the instantiation is able to determine the correct cast
  semantics for both the scalar type and the vector type case.

  Note that, because the change only affects the single-expression case
  (and the target type is an AltiVec-style vector type), the
  replacement of a parenthesized list with a parenthesized expression
  does not change the semantics of the program in a program-observable
  manner.

  Reviewed By: aaron.ballman

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

This should fix 'Assertion failed: (isScalarType()), function
getScalarTypeKind, file /usr/src/contrib/llvm-project/clang/lib/AST
/Type.cpp, line 2146', when building the graphics/opencv-core port for
powerpc64le.

Requested by:	pkubaj
MFC after:	4 weeks
X-MFC-With:	r364284
2020-10-13 19:42:22 +00:00
Dimitry Andric
f91b0c1c18 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-0-g176249bd673 (aka 11.0.0 release).

MFC after:	4 weeks
X-MFC-With:	r364284
2020-10-12 21:35:29 +00:00
Alex Richardson
5ce117c698 Fix buildworld on Linux/macOS after nvi update
This re-applies r365941 which was lost in the nvi update.
2020-10-12 10:42:24 +00:00
Philip Paeps
12a899b632 Import tzdata 2020b
Changes: https://github.com/eggert/tz/blob/2020b/NEWS

MFC after:	3 days
2020-10-08 00:35:36 +00:00
Li-Wen Hsu
85a6f8076f Revert r358001 in favor of r366509
Sponsored by:	The FreeBSD Foundation
2020-10-07 07:55:55 +00:00
Jakub Wojciech Klama
067bb8206d Import lib9p 9d5aee77bcc1bf0e79b0a3bfefff5fdf2146283c.
Approved by:	trasz (mentor)
Sponsored by:	Conclusive Engineering Sp. z o. o.
2020-10-03 18:52:54 +00:00
Mitchell Horne
6955543a88 tmpfs tests: check for built-in tmpfs module
As of r363471, tmpfs is included in all GENERIC kernel configs. This
results in a warning being emitted for each call to kldload(8):

module_register: cannot register tmpfs from tmpfs.ko; already loaded from kernel

Check for the presence of the module via kldstat first to quiet this
warning.

Reviewed by:	asomers, arichardson
Differential Revision:	https://reviews.freebsd.org/D26632
2020-10-02 00:52:31 +00:00
Eric van Gyzen
01348ccda2 fix setitimer test for returned it_value
An old it_value of {4,3} is valid. Allow it.

Reviewed by:	bdrewery
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D26445
2020-10-01 21:52:57 +00:00
Eric van Gyzen
63c8336d4d zgrep: fix exit status with multiple files
zgrep should exit with success when given multiple files and the
pattern is found in at least one file.  Prior to this change,
it would exit with success only if the pattern was found in _every_ file.

Reviewed by:	dab ngie
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D26616
2020-10-01 21:48:22 +00:00
Dimitry Andric
8833aad7be Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-rc5-0-g60a25202a7d.

MFC after:	4 weeks
X-MFC-With:	r364284
2020-10-01 19:06:07 +00:00
Stefan Eßer
d213476d1c Upgrade to version 3.1.6
This upgrade addresses one (benign) compiler warning when building with
LLVM-12.
2020-10-01 15:45:07 +00:00
Baptiste Daroussin
755cc40c21 Update nvi to 2.2.0-05ed8b9
This version incorporates many fixes in particular a fix for vi -w
Another approach was proposed to merge those fixes (see review), I find
it easier to track changes if we keep importing snapshot on regular
basis

PR:		241985
Reported by:	fernape
Differential Revision:	https://reviews.freebsd.org/D26158
2020-10-01 04:46:23 +00:00
Cy Schubert
6dbd2fb858 ipfilter getifname ifdef cleanup.
MFC after:	2 months
2020-09-30 08:26:22 +00:00
Cy Schubert
2c1685f369 Resurrect ipfilter's getifname, replacing the stub with the real
function.

MFC after:	2 months
2020-09-30 08:26:00 +00:00
Cy Schubert
15dc17b8d5 Remove Linux and IRIX specific files.
MFC after:	1 week
2020-09-27 18:39:12 +00:00
Cy Schubert
2e93aaa766 Continuing the effort started in r343701, #ifdef cleanup, remove
never to be used again checks.

MFC after:	1 week
2020-09-27 18:39:09 +00:00
Fernando Apesteguía
f1cba2b70c vi(1): Add URL to the vi/ex reference manual in the man page
Reported in PR 241985

The manual page references the "vi/ex reference manual" but there is no
information about where to find that document. Add a reference to the manual in
the SEE ALSO section since the Project hosts a copy of it[1].

Change sent upstream[2]

If D26158 gets reviewed and committed, we could close that PR.

[1] https://docs.freebsd.org/44doc/usd/13.viref/paper.pdf).
[2] https://github.com/lichray/nvi2/pull/85

Submitted by:	freebsd@tim.thechases.com
Approved by:	manpages (gbe@)
Differential Revision:	https://reviews.freebsd.org/D26163
2020-09-25 10:20:12 +00:00
Alex Richardson
d1e106f262 byacc: fix UBSan signed shift range error
I've submitted this patch upstream, so apply this to contrib/ until a new
version containing this change has been released.

Reviewed By:	jkim
Differential Revision: https://reviews.freebsd.org/D26505
2020-09-23 12:54:42 +00:00
Alex Richardson
1116946093 Fix another UBSan error in awk
This applies my upstreamed fix: ad9bd2f40a
Found By:	UBSan
2020-09-21 19:03:12 +00:00
Alex Richardson
ae692c42cb awk: Fix subobject out-of-bounds access
When matching a regex with ^, it would attempt to access
gototab[NSTATES][NCHARS+2], and therefore access the state for the \002
character instead. This change is required to run awk under CHERI (with
sub-object bounds) and when running with UBSan instrumentation.

This was committed upstream as cbf924342b

Found by:	CHERI (with subobject bounds enabled)
Obtained from:	CheriBSD
Reviewed By:	imp
Differential Revision: https://reviews.freebsd.org/D26509
2020-09-21 19:03:07 +00:00
Poul-Henning Kamp
895a7e604d Pull in fix from upstream NetBSD rev. 1.5:
If Unwind_Backtrace is broken, ctx.n will still contain ~0, and we will
    return that which poor behavior for the user, so return 0 instead.
    We could document ~0 to be an error, but that would deviate from the
    Linux behavior which is not desirable. Noted by Poul-Henning Kamp

PR:		209842
2020-09-21 16:43:38 +00:00