Commit Graph

21156 Commits

Author SHA1 Message Date
Stefan Eßer
1f474190fc Replace literal uses of /usr/local in C sources with _PATH_LOCALBASE
Literal references to /usr/local exist in a large number of files in
the FreeBSD base system. Many are in contributed software, in configuration
files, or in the documentation, but 19 uses have been identified in C
source files or headers outside the contrib and sys/contrib directories.

This commit makes it possible to set _PATH_LOCALBASE in paths.h to use
a different prefix for locally installed software.

In order to avoid changes to openssh source files, LOCALBASE is passed to
the build via Makefiles under src/secure. While _PATH_LOCALBASE could have
been used here, there is precedent in the construction of the path used to
a xauth program which depends on the LOCALBASE value passed on the compiler
command line to select a non-default directory.

This could be changed in a later commit to make the openssh build
consistently use _PATH_LOCALBASE. It is considered out-of-scope for this
commit.

Reviewed by:	imp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D26942
2020-10-27 11:29:11 +00:00
John-Mark Gurney
0fda26dbb3 update write(2)'s iovec limit w/ info about the iosize_max_clamp sysctl... 2020-10-26 00:37:31 +00:00
Warner Losh
e369c79ca0 Remove intel compiler support from math.h
The intel compiler support has badly decayed over the years. Stop
pretending that we support it. Note, I've stopped short of requiring
gcc builtin support with this commit since other compilers may be used
to build non-base software and we need to support those so more
investigation is needed before simplifying further.
2020-10-24 23:21:22 +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
Warner Losh
b38d86a585 warnx: fix needless static
I noticed after the review that these shouldn't be static. Remove the
'static' from them, otherwise concurrent calls to warn* might see a
similar but to the original.
2020-10-24 00:03:11 +00:00
Warner Losh
4e0771b2da warnx: Save errno across calls that might change it.
When warn() family of functions is being used after err_set_file() has
been set to, for example, /dev/null, errno is being clobbered,
rendering it unreliable after, for example, procstat_getpathname()
when it is supposed to emit a warning. Then the errno is changed to
Inappropriate ioctl for device, destroying the original value (via
calls to fprintf()functions).

Submitted by: Juraj Lutter
Differential Revision: https://reviews.freebsd.org/D26871
2020-10-23 23:56:00 +00:00
Brooks Davis
3e7449a37b Only use ASAN when using the in-tree compiler
When building FreeBSD 11 on a FreeBSD 12 system with
CROSS_TOOLCHAIN=llvm10 we end up trying to link against the packaged
version of the sanitizer library.  This resulted in a requirement for
getentropy(3) which is not present in FreeBSD 11.

Reviewed by:	emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D26903
2020-10-23 22:27:45 +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
Konstantin Belousov
69c09181d4 mmap(2): Document guard size for MAP_STACK and related EINVAL.
Based on submission by:	emaste
Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D26894
2020-10-21 21:40:33 +00:00
Ryan Moeller
0710ec8cef Move list_cloners to libifconfig
Move list_cloners() from ifconfig(8) to libifconfig(3) where it can be
reused by other consumers.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D26858
2020-10-21 05:27:25 +00:00
Xin LI
5011fb430a Further refinements of ptsname_r(3) interface:
- Hide ptsname_r under __BSD_VISIBLE for now as the specification
   is not finalized at this time.
 - Keep Symbol.map sorted.
 - Avoid the interposing of ptsname_r(3) from an user application
   from breaking ptsname(3) by making the implementation a static
   method and call the static function from ptsname(3) instead.

Reported by:	kib
Reviewed by:	kib, jilles
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D26845
2020-10-20 01:29:45 +00:00
Alex Richardson
4fa4bd6312 Enable SUBDIR_PARALLEL for lib/googletest
This saves a few seconds in a parallel build since we can build the
gtest_main and gmock subdirectories in parallel.

Reviewed By:	ngie
Differential Revision: https://reviews.freebsd.org/D26760
2020-10-19 19:51:03 +00:00
Alex Richardson
2ed3236082 Major improvement to build parallelism for googletest internal tests
Currently the googletest internal tests build after the matching library.
However, each of these is serialized at the top level makefile.
Additionally some of the tests (e.g. the gmock-matches-test) take up to
90 seconds to build with clang -O2. Having to wait for this test to
complete before continuing to the next directory seriously slows down the
parllelism of a -j32 build.
Before this change running `make -C lib/googletest -j32 -s` in buildenv
took 202 seconds, now it's 153 due to improved parallelism.

Reviewed By:	emaste (no objection)
Differential Revision: https://reviews.freebsd.org/D26748
2020-10-19 19:50:57 +00:00
Kyle Evans
07335072e2 libbe(3): install MLINKS for all of the functions provided
MFC after:	1 week
2020-10-18 23:58:40 +00:00
Kyle Evans
513bd2fc81 libbe(3): document be_snapshot()
While toying around with lua bindings for libbe(3), I discovered that I
apparently never documented this, despite having documented
be_is_auto_snapshot_name that references it.

MFC after:	1 week
2020-10-18 23:42:00 +00:00
Kyle Evans
5773e924e7 libbe(3): const'ify a couple arguments
libbe will never need to mutate these as we either process them into a local
buffer or we just don't touch them and write to a separate out argument.

MFC after:	1 week
2020-10-18 23:32:47 +00:00
Xin LI
3e7224dffe Implement ptsname_r.
MFC after:	2 weeks
PR:		250062
Reviewed by:	jilles, 0mp, Ray <i maskray me>
Differential Revision:	https://reviews.freebsd.org/D26647
2020-10-17 04:14:38 +00:00
Kyle Evans
6d55b98d52 libc: typo fix (s/involes/involves)
Reported by:	Masahiko Sawada via twitter
MFC after:	3 days
2020-10-16 17:51:09 +00:00
Mateusz Piotrowski
6709a5167f Fix formatting of SYNOPSIS
There was an unnecessary newline being added before Nm.

MFC after:	3 days
2020-10-15 14:17:45 +00:00
Adrian Chadd
388197f414 [libcasper] Update cap_dns API to not trigger unused variable warnings when disabled
When compiling without casper these API calls result in unused variable warnings.
Using #defines was lovely in the past but unfortunately it triggers warnings
which can cascade into errors.

Instead, just inline with some fallthrough functions and keep things happy.

Tested:

* gcc-6 targeting mips32, with casper disabled

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D26762
2020-10-13 22:49:43 +00:00
Brooks Davis
155e586513 libgssapi: modernize static string array use
Use designated initializers to document positions in the arrays rather
than requiring counting. Use nitems() rather than rolling it by hand to
count elements.

Also, passify a Clang 12 warning about suspcious string concatenation
within an array initializer by adding parentheses.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26592
2020-10-13 17:14:30 +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
cf084e9e92 Enable SUBDIR_PARELLEL in lib/libclang_rt
I noticed that this part of the build was taking much longer than
expected. Turns out it's due to not running the subdirs in parallel.
Reduces `make all` inside lib/libclang_rt time from 63s to 20s with -j32.

Reviewed By:	dim
Differential Revision: https://reviews.freebsd.org/D26623
2020-10-12 10:42:33 +00:00
Alex Richardson
c2ca066705 Fix building on Linux/macOS after r366622
We have to bootstrap arc4random.c, so guard the FenestrasX code to avoid
using it on Linux/macOS.

Reviewed By:	cem
Differential Revision: https://reviews.freebsd.org/D26738
2020-10-12 10:42:14 +00:00
Conrad Meyer
f8e8a06d23 random(4) FenestrasX: Push root seed version to arc4random(3)
Push the root seed version to userspace through the VDSO page, if
the RANDOM_FENESTRASX algorithm is enabled.  Otherwise, there is no
functional change.  The mechanism can be disabled with
debug.fxrng_vdso_enable=0.

arc4random(3) obtains a pointer to the root seed version published by
the kernel in the shared page at allocation time.  Like arc4random(9),
it maintains its own per-process copy of the seed version corresponding
to the root seed version at the time it last rekeyed.  On read requests,
the process seed version is compared with the version published in the
shared page; if they do not match, arc4random(3) reseeds from the
kernel before providing generated output.

This change does not implement the FenestrasX concept of PCPU userspace
generators seeded from a per-process base generator.  That change is
left for future discussion/work.

Reviewed by:	kib (previous version)
Approved by:	csprng (me -- only touching FXRNG here)
Differential Revision:	https://reviews.freebsd.org/D22839
2020-10-10 21:52:00 +00:00
Gordon Bergling
3d265fce43 Fix a few mandoc issues
- skipping paragraph macro: Pp after Sh
- sections out of conventional order: Sh EXAMPLES
- whitespace at end of input line
- normalizing date format
2020-10-09 19:12:44 +00:00
Bjoern A. Zeeb
1e375f3aa7 80211: non-functional changes
Sort a few VHT160 and 80+80 lines, update some comments, and remove
a superfluous ','.

No functional changes intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-10-07 21:56:58 +00:00
Mateusz Guzik
f165a1df9a libkvm: catch up with pre-subtracated per-cpu addresses
Only concerns amd64.

Reported by:	imp
2020-10-06 02:57:37 +00:00
Jakub Wojciech Klama
100353cfbf Add virtio-9p (aka VirtFS) filesystem sharing to bhyve.
VirtFS allows sharing an arbitrary directory tree between bhyve virtual
machine and the host. Current implementation has a fairly complete support
for 9P2000.L protocol, except for the extended attribute support. It has
been verified to work with the qemu-kvm hypervisor.

Reviewed by:	rgrimes, emaste, jhb, trasz
Approved by:	trasz (mentor)
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Conclusive Engineering (development), vStack.com (funding)
Differential Revision:	https://reviews.freebsd.org/D10335
2020-10-03 19:05:13 +00:00
Mark Johnston
afd95785c0 newlocale(3): Fix a memory leak.
newlocale() optionally takes a "base" locale, from which components not
specified in the mask are inherited.  POSIX says that newlocale() may
modify "base" and return it, or free "base" and return a newly allocated
locale.  We were not doing either, so applications which use newlocale()
to modify an existing base locale end up leaking memory on FreeBSD.

This diff fixes the leak by releasing a reference to the base locale
before returning.  This is less efficient than modifying "base"
directly, but is simpler for an initial bug fix.  Also, update the man
page to clarify behaviour with respect to "base".

PR:		249416
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D26522
2020-10-02 18:35:55 +00:00
Ed Maste
da6e5efe92 libmd: add dependency workaround for r366344
r366344 fixed and reenabled the assembly optimized skein implementation,
but skein_block objects were not being rebuilt in no-clean builds. This
resulted in failing no-clean builds. SKEIN_USE_ASM controls which
routines come from C vs assembly, and with no explicit dependency
r366344's change to SKEIN_USE_ASM did not cause skein_block.{o,pico}
to be rebuilt.

Add a dependency on this Makefile for the skein_block objects. This
dependency is broader in scope than absolutely required (that is, the
skein_block objects will now be rebuilt on any change to this Makefile).
There are ways this could be addressed, but it is probably not worth the
additional effort or testing time to pursue them.

PR:		248221
Reported by:	kevans, Jeremy Faulkner
Discussed with:	kevans
Sponsored by:	The FreeBSD Foundation
2020-10-02 14:00:52 +00:00
Ed Maste
36972ee3e0 libmd: fix assembly optimized skein implementation
The assembly implementation incorrectly used logical AND instead of
bitwise AND. Fix, and re-enable in libmd.

Submitted by:	Yang Zhong <yzhong@freebsdfoundation.org>
Reviewed by:	cem (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D26614
2020-10-01 21:05:50 +00:00
Kyle Evans
320ef1bef0 auxv: partially revert r366207, cast buflen to unsigned int as needed
The warning generated pre-r366207 is actually a sign comparison warning:

error: comparison of integers of different signs: 'unsigned long' and 'int'
                        if (strlcpy(buf, execpath, buflen) >= buflen)

Revert parts that affected other lines and just cast this to unsigned int.

The buflen < 0 -> EINVAL has been kept despite no longer serving any
purposes w.r.t. sign-extension because I do believe it's the right thing to
do: "The provided buffer was not the right size for the requested item."

The original warning is confirmed to still be gone with an:
env WARNS=6 make WITHOUT_TESTS=yes.

Reviewed by:	asomers, kib
X-MFC-With:	r366207
Differential Revision:	https://reviews.freebsd.org/D26631
2020-10-01 19:56:38 +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
Enji Cooper
c9d175ea90 Eliminate duplicate afterinstallconfigs target
Define separate dependent targets which `afterinstallconfigs` relies on, in
order to modify `${DESTDIR}/etc/master.passwd` and
`${DESTDIR}/etc/nsswitch.conf`.

Mark these targets .PHONY, since they manipulate configurations on the fly and
the generation logic isn't 100% defined in terms of the source files/logic,
and is variable, based on MK_foo flags.

MFC after:	2 weeks
Reviewed by:	bapt, brd
Differential Revision:	https://reviews.freebsd.org/D20330
2020-10-01 16:37:49 +00:00
Kyle Evans
7cc42f6d25 Do a sweep and remove most WARNS=6 settings
Repeating the default WARNS here makes it slightly more difficult to
experiment with default WARNS changes, e.g. if we did something absolutely
bananas and introduced a WARNS=7 and wanted to try lifting the default to
that.

Drop most of them; there is one in the blake2 kernel module, but I suspect
it should be dropped -- the default WARNS in the rest of the build doesn't
currently apply to kernel modules, and I haven't put too much thought into
whether it makes sense to make it so.
2020-10-01 01:10:51 +00:00
Warner Losh
61c4a6f317 Updates to chroot(2) docs
1. Note what settings give historic behavior
2. Recommend jail under security considerations.
2020-09-29 18:13:54 +00:00
Alan Somers
d14f60e9ba Misc compiler warning fixes in lib/libc
Reviewed by:	kevans, imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D26534
2020-09-27 22:26:41 +00:00
Alan Somers
90ec6a3035 lib/libc/tests/iconv: raise WARNS to 6
MFC after:	2 weeks
2020-09-24 21:42:44 +00:00
Alan Somers
9f036e84fb lib/libc/tests/sys: raise WARNS to 6
MFC after:	2 weeks
2020-09-24 21:39:09 +00:00
Brandon Bergren
bceb5a2c8d [PowerPC64LE] Pass our byte order to the sqlite3 build.
Due to the sqlite3 endian detection code preferring to check platform defines
instead of checking endian defines, it is necessary to manually set
the endianness on PowerPC64LE.

Unlike other bi-endian platforms, PowerPC64LE relies entirely on the
generic endianness macros like __BYTE_ORDER__ and has no platform-specific
define to denote little endian.

Add -DSQLITE_BYTEORDER=1234 to the CFLAGS when building libsqlite3 on
powerpc64le.

Fixes runtime operation of sqlite on PowerPC64LE.

Sponsored by:	Tag1 Consulting, Inc.
2020-09-23 02:17:44 +00:00
Brandon Bergren
f4eb39ba6b [PowerPC64LE] libkvm powerpc64le support.
* Add missing _kvm16toh() function.
* Teach libkvm about powerpc64le.

Sponsored by:	Tag1 Consulting, Inc.
2020-09-23 02:11:24 +00:00
Brandon Bergren
b257310103 [PowerPC64LE] Fix gdtoa configurations on LE.
gdtoa wins the award for "most outdated endianness naming convention"
with its IEEE_8087 vs IEEE_MC68k defines. I had a good chuckle.

Update softfloat and arith.h to adjust to BE or LE automatically
based on the low level preprocessor defines.

Fixes printf/scanf on PowerPC64LE, although there is still a problem
lurking regarding Signalling NaNs...

Sponsored by:	Tag1 Consulting, Inc.
2020-09-23 02:05:44 +00:00
Brandon Bergren
24faccc241 [PowerPC64LE] Use a shared LIBC_ARCH for powerpc64le.
Given that we have converted to ELFv2 for BE already, endianness is the only
difference between the two ARCHs.

As such, there is no need to differentiate LIBC_ARCH between the two.

Combining them like this lets us avoid needing to have two copies of several
bits for no good reason.

Sponsored by:	Tag1 Consulting, Inc.
2020-09-23 00:21:51 +00:00
Konstantin Belousov
1f305be431 Document {O,AT}_RESOLVE_BENEATH and new O_BENEATH behavior for relative paths.
PR:	248335
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25886
2020-09-22 22:54:54 +00:00
Vincenzo Maffione
92c5d82c86 libnetmap: fix cast from uint64_t to void*
We use uintptr_t as an intermediate cast to avoid compiler
warnings on 32 bit architectures.

Reported by:	adrian
MFC after:	3 days
2020-09-22 20:20:43 +00:00
D Scott Phillips
00e6614750 Sparsify the vm_page_dump bitmap
On Ampere Altra systems, the sparse population of RAM within the
physical address space causes the vm_page_dump bitmap to be much
larger than necessary, increasing the size from ~8 Mib to > 2 Gib
(and overflowing `int` for the size).

Changing the page dump bitmap also changes the minidump file
format, so changes are also necessary in libkvm.

Reviewed by:	jhb
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D26131
2020-09-21 22:21:59 +00:00
Toomas Soome
e307eb94ae loader: zfs should support bootonce an nextboot
bootonce feature is temporary, one time boot, activated by
"bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag.

By default, the bootonce setting is reset on attempt to boot and the next
boot will use previously active BE.

By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will
be set permanently active.

bootonce dataset name is recorded in boot pool labels, bootenv area.

in case of nextboot, the nextboot_enable boolean variable is recorded in
freebsd:nvstore nvlist, also stored in boot pool label bootenv area.
On boot, the loader will process /boot/nextboot.conf if nextboot_enable
is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf
processing on next boot.

bootonce and nextboot features are usable in both UEFI and BIOS boot.

To use bootonce/nextboot features, the boot loader needs to be updated on disk;
if loader.efi is stored on ESP, then ESP needs to be updated and
for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated
(gpart or other tools).

At this time, only lua loader is updated.

Sponsored by:	Netflix, Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D25512
2020-09-21 09:01:10 +00:00
Stefan Eßer
fcce470c2b Apply an opimization for the kernels used by cexp(x) and cexpf(x) submitted
by Steve Kargl:

- Use sincos[f] instead of a call to cos[f] and a call to sin[f].

- While here, alphabetize declaration.

Submitted by:   sgk at troutmask.apl.washington.edu (Steve Kargl)
2020-09-20 05:32:53 +00:00
Stefan Eßer
a67cc94327 Apply fix for ld80 and ld128 submitted by Steve Kargl:
- Micro-optimization: use sincosl(x) instead of a call to cosl(x) and
  a call to sinl(x).  Argument reduction is done once not twice.

- Use a long double constant instead of an invalid double constant.

- Spell scale2 correctly

He could not test ld128, so that patch is untested.

Submitted by:	sgk at troutmask.apl.washington.edu (Steve Kargl)
2020-09-20 05:28:31 +00:00