Commit Graph

18182 Commits

Author SHA1 Message Date
Ed Schouten
8ab00b8fbc Properly sign extend the result of jrand48() and mrand48().
These functions are supposed to return a value between [_2^31, 2^31).
This doesn't seem to work on 64-bit systems, where we return a value
between [0, 3^32). Patch up the function to use proper casts to int32_t.
While there, fix some other style bugs.

MFC after:	2 weeks
2016-12-06 19:08:29 +00:00
Gleb Smirnoff
edc816d625 Fix possible integer overflow in guest memory bounds checking, which could
lead to access from the virtual machine to the heap of the bhyve(8) process.

Submitted by:	Felix Wilhelm <fwilhelm ernw.de>
Patch by:	grehan
Security:	FreeBSD-SA-16:38.bhyve
2016-12-06 18:50:44 +00:00
Gleb Smirnoff
74e540d788 Fix possible buffer overflow(s) in link_ntoa(3).
A specially crafted sockaddr_dl argument can trigger a static buffer overflow
in the libc library, with possibility to rewrite with arbitrary data following
static buffers that belong to other library functions.

Reviewed by:	kib
Security:	FreeBSD-SA-16:37.libc
2016-12-06 18:50:33 +00:00
Konstantin Belousov
4dafad49c6 Do not leak curthread->inact_mtx when cancelling in pthread_cond_wait(3).
Leave robust-protected region before checking for cancellation by
calling _thr_testcancel().  Otherwise, if cancelling request was
pending, the cancel handler is called with the dandling inact_mtx,
which triggers an assert if any mutex operation is performed by the
handler.

Reported and tested by:	Dimitri Staessens <dimitri.staessens@intec.ugent.be>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-12-06 17:13:17 +00:00
Mark Johnston
fe2521b980 Bump the libproc library version. 2016-12-06 04:23:32 +00:00
Mark Johnston
b043b5dc6b libproc: Add support for some proc_attach() flags.
This change adds some handling for the equivalent of Solaris' PGRAB_*
flags. In particular, support for PGRAB_RDONLY is needed to avoid a
nasty deadlock: dtrace(1) may otherwise stop the master process for its
pseudo-terminal and end up blocking while writing to standard output.
2016-12-06 04:22:38 +00:00
Mark Johnston
c156354ff8 libproc: Cache symbol tables for mapped objects upon access.
Extend the file handle cache entries to include symbol tables as well. An
index is used to implement binary search by symbol value. Lookups by
name are comparatively rare and are thus still implemented with a linear
search, but support for a binary search by name would be straightforward
to add if needed.
2016-12-06 04:21:35 +00:00
Mark Johnston
d42df2a447 libproc: Match prefixes when looking up mapped object by name.
When looking up an object by name, allow prefix matches if no direct match
is found. This allows one to, for example, match libc entry probes with:

 # dtrace -n 'pid$target:libc.so::entry' -c ./foo

instead of requiring "libc.so.7" or a glob.

Also remove proc_obj2map() as it currently just duplicates the
functionality of proc_name2map(). It's supposed to take a Solaris
link-map ID as a paramter, but support for this isn't implemented and
isn't required to support DTrace's pid provider.
2016-12-06 04:20:32 +00:00
Mark Johnston
07a9c2e65d libproc: Cache ELF handles for loaded objects.
libproc previously created a new handle for each symbol lookup, which
gives rather egregious performance for DTrace's ustack() action. With
this change libproc will cache the libelf descriptor upon access, making
lookups much faster in the common case.
2016-12-06 04:19:08 +00:00
Mark Johnston
76c6531c65 libproc: Improve .gnu_debuglink support.
As of r278658 libproc looks for debug files under /usr/lib/debug and will
use them if available. This change fleshes out that support a bit further:
- Check for a .gnu_debuglink section and use the file name specified
  there if one is present.
- Validate external debug files with the CRC in the .gnu_debuglink
  section so as to avoid using stale or corrupt debug files.
- Search for debug files in the directory containing the referencing
  object or in the .debug subdirectory, as GDB does.
2016-12-06 04:18:09 +00:00
Mark Johnston
b1bb30e5c5 libproc: Make proc_getpid() an accessor for struct proc_handle.
This allows librtld_db to fetch the PID from a handle without calling into
libproc. Together with r303531, this means that librtld_db no longer
references symbols from libproc.
2016-12-06 04:14:20 +00:00
Mark Johnston
fcf9fc109e Fix style bugs and remove trailing whitespace in libproc and librtld_db.
MFC after:	1 week
2016-12-06 04:13:02 +00:00
Martin Matuska
a2e802b76b MFV r309587:
Sync libarchive with vendor.

Vendor bugfixes:

libarchive #831:
  Spelling fixes
libarchive #832:
  Relax sanity checks of number fields in tar header even more
OSS-Fuzz #16:
  Fix possible hang in uudecode_filter_read()
OSS-Fuzz #220:
  Reject an 'ar' filename table larger than 1GB or a filename larger
  than 1MB.

MFC after:	1 week
2016-12-06 01:35:27 +00:00
Dimitry Andric
4f9d94bf64 Merge ^/head r309263 through r309518. 2016-12-04 00:00:56 +00:00
Eric van Gyzen
ff07dd913e thr_set_name(): silently truncate the given name as needed
Instead of failing with ENAMETOOLONG, which is swallowed by
pthread_set_name_np() anyway, truncate the given name to MAXCOMLEN+1
bytes.  This is more likely what the user wants, and saves the
caller from truncating it before the call (which was the only
recourse).

Polish pthread_set_name_np(3) and add a .Xr to thr_set_name(2)
so the user might find the documentation for this behavior.

Reviewed by:	jilles
MFC after:	3 days
Sponsored by:	Dell EMC
2016-12-03 01:14:21 +00:00
Dimitry Andric
29a85f30b7 Update compiler-rt to release_39 branch r288513. Since this contains a
rather unfortunate upstream workaround for an unwind header problem that
does not exist on FreeBSD, but which causes an unnecessary warning for
us, add some flags to the compiler-rt Makefile to suppress the warning.
2016-12-02 20:17:41 +00:00
Dimitry Andric
5042637be1 Update build glue for clang 3.9.1 r288513. 2016-12-02 19:40:00 +00:00
Dimitry Andric
545937e1be Vendor import of clang release_39 branch r288513:
https://llvm.org/svn/llvm-project/cfe/branches/release_39@288513
2016-12-02 19:20:19 +00:00
Dimitry Andric
2cf3bd4601 Vendor import of llvm release_39 branch r288513:
https://llvm.org/svn/llvm-project/llvm/branches/release_39@288513
2016-12-02 19:20:10 +00:00
Bryan Drewery
710542df20 Fix setrlimit_test:setrlimit_memlock when the system has exceeded vm.max_wired.
This uses the same fix as r294894 did for the mlock test.  The code from
that commit is moved into a common object file which PROGS supports
building first.

Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8689
2016-12-01 22:12:58 +00:00
Toomas Soome
40a969525a libstand: dosfs cstyle cleanup for return keyword.
Reviewed by:	bapt, imp, allanjude
Approved by:	imp (mentor), allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8678
2016-12-01 19:19:20 +00:00
Conrad Meyer
103701b155 capsicum_helpers: Squash errors from closed fds
Squash EBADF from closed stdin, stdout, or stderr in caph_limit_stdio().
Any program used during special shell scripts may commonly be forked
from a parent process with closed standard stream.  Do the common sense
thing for this common use.

Reported by:	Iblis Lin <iblis AT hs.ntnu.edu.tw>
Reviewed by:	oshogbo@ (earlier version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8657
2016-12-01 17:28:45 +00:00
Martin Matuska
007dbc1f18 MFC r309362:
Sync libarchive with vendor.
Small improvements, style fixes, bugfixes.
Restores compatibility with tar archives created with Perl Archive::Tar (1)

MFC after:	1 week
Reported by:	Matthew Seaman <matthew@freebsd.org> (1)
2016-12-01 15:46:26 +00:00
Conrad Meyer
33d19692e8 Remove a death threat from the FreeBSD sources
Reported by:	koobs@, araujo@, linimon@, bjk@, emaste@, jhb@, ngie@, cem@
Maintainer timeout:	des@
2016-12-01 02:21:36 +00:00
Martin Matuska
d5d08d297d MFV r309299:
Sync libarchive with vendor.

Important vendor bugfixes (relevant to FreeBSD):
#821: tar -P cannot extract hardlinks through symlinks
#825: Add sanity check of tar "uid, "gid" and "mtime" fields

PR:		213255
Reported by:	Tijl Coosemans <tilj@FreeBSD.org>
MFC after:	1 week
2016-11-29 22:14:42 +00:00
Ed Maste
2737721014 libm: remove duplicate version script entries
These symbols already appear in the common lib/msun/Symbol.map.
Duplicate entries produce an error with LLVM's LLD linker.

Reviewed by:	br
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8627
2016-11-29 18:40:24 +00:00
Dag-Erling Smørgrav
e68bca507d Use malloc()ed buffers instead of stack buffers in gr_copy() and pw_copy().
This allows pw(8) to operate on passwd and group files with longer lines
than could be accomodated by a stack buffer.  It doesn't take more than a
few hundred users to exceed 8192 bytes in /etc/group.

MFC after:	3 weeks
Sponsored by:	The University of Oslo
2016-11-28 21:00:19 +00:00
Dimitry Andric
d6d16831c5 Merge ^/head r309170 through r309212. 2016-11-27 14:27:51 +00:00
Mark Johnston
64910ddbff Launder VPO_NOSYNC pages upon vnode deactivation.
As of r234483, vnode deactivation causes non-VPO_NOSYNC pages to be
laundered. This behaviour has two problems:

1. Dirty VPO_NOSYNC pages must be laundered before the vnode can be
   reclaimed, and this work may be unfairly deferred to the vnlru process
   or an unrelated application when the system is under vnode pressure.
2. Deactivation of a vnode with dirty VPO_NOSYNC pages requires a scan of
   the corresponding VM object's memq for non-VPO_NOSYNC dirty pages; if
   the laundry thread needs to launder pages from an unreferenced such
   vnode, it will reactivate and deactivate the vnode with each laundering,
   potentially resulting in a large number of expensive scans.

Therefore, ensure that all dirty pages are laundered upon deactivation,
i.e., when all maps of the vnode are removed and all references are
released.

Reviewed by:	alc, kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8641
2016-11-26 21:00:27 +00:00
Dimitry Andric
5b41a5b675 Update build glue for llvm/clang 3.9.1. 2016-11-26 01:13:53 +00:00
Dimitry Andric
7ade6c809a Vendor import of compiler-rt release_39 branch r287912:
https://llvm.org/svn/llvm-project/compiler-rt/branches/release_39@287912
2016-11-25 19:09:40 +00:00
Dimitry Andric
17c7957f02 Vendor import of clang release_39 branch r287912:
https://llvm.org/svn/llvm-project/cfe/branches/release_39@287912
2016-11-25 19:07:40 +00:00
Dimitry Andric
6449741f4c Vendor import of llvm release_39 branch r287912:
https://llvm.org/svn/llvm-project/llvm/branches/release_39@287912
2016-11-25 19:05:59 +00:00
Dimitry Andric
d52fad0e5d Bump FREEBSD_CC_VERSION again for r309147 and 309149. 2016-11-25 18:12:57 +00:00
Fabien Thomas
bf4356266d IPsec RFC6479 support for replay window sizes up to 2^32 - 32 packets.
Since the previous algorithm, based on bit shifting, does not scale
with large replay windows, the algorithm used here is based on
RFC 6479: IPsec Anti-Replay Algorithm without Bit Shifting.
The replay window will be fast to be updated, but will cost as many bits
in RAM as its size.

The previous implementation did not provide a lock on the replay window,
which may lead to replay issues.

Reviewed by:	ae
Obtained from:	emeric.poupon@stormshield.eu
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D8468
2016-11-25 14:44:49 +00:00
Dimitry Andric
2000ee7730 Merge ^/head r309106 through r309117. 2016-11-24 21:14:22 +00:00
Dimitry Andric
d590c67486 In preparation for merging back to head, bump __FreeBSD_version,
FREEBSD_CC_VERSION and set date in ObsoleteFiles.inc.
2016-11-24 21:12:43 +00:00
Dag-Erling Smørgrav
4e2825545b Add a warning against modifying this code without understanding it, and
an example of how not to make it more portable.  I've had this lying
around uncommitted since 2009...
2016-11-24 14:50:21 +00:00
Dimitry Andric
0ed76ec8e6 Merge ^/head r308870 through r309105. 2016-11-24 14:39:04 +00:00
Dag-Erling Smørgrav
1da400983c Remove debugging code. 2016-11-23 10:52:19 +00:00
Julian Elischer
0f7f3352c8 This little BSD licensed library has been kicking around for years.
It allows one to trivially convert an absolute path to a relative path
and the reverse. The test programs themselves are very useful in scripts
but the real use comes shortly with the -r and -a arguments to ln.
These are sometimes known as the --relative and --absolute flags and
can force a symlink to be relative when you only have an absolue path.
Another place these are sometimes used is to add -a and -r args to 'realpath'.
Incredibly useful in Makefiles.

I was going to just add the files in with 'ln' but a library makes more sense.
The test programs may come out in their own right some day for scripting.

released under a BSD 2-clause:
 * Copyright (c) 1997 Shigio Yamaguchi. All rights reserved.
 * Copyright (c) 1999 Tama Communications Corporation. All rights reserved.

The test directry does not conform to any framework.
Not connected to build.
doc people may want to play with the manual pages.

Obtained from:  https://www.tamacom.com/pathconvert.html  Shigio Yamaguchi.
MFC after: 1 month
Relnotes:       yes
Sponsored by:   Panzura, Tama Communications Corporation
2016-11-23 07:57:52 +00:00
Jilles Tjoelker
295159dfa3 open(2): Clarify non-POSIX error when opening a symlink with O_NOFOLLOW.
We return [EMLINK] instead of [ELOOP] when trying to open a symlink with
O_NOFOLLOW, so that the original case of [ELOOP] can be distinguished. Code
like cmp -h and xz takes advantage of this.

PR:		214633
Reviewed by:	kib, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8586
2016-11-22 22:30:55 +00:00
Ed Maste
134ede2dd2 remove unnecessary vm includes from setproctitle
vm headers were needed only for the PS_STRINGS fallback, which was
removed in r297888.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2016-11-22 16:00:18 +00:00
Dag-Erling Smørgrav
792ef1ae7b Refactor fetch_connect() and fetch_bind() to improve readability and avoid
repeating the same DNS lookups.

MFC after:	3 weeks
2016-11-22 13:30:07 +00:00
Eric van Gyzen
81f91de9f7 Fix error reporting from wcstof()
When wcstof() skipped initial space and then parsing failed, it set
endptr to the first non-space character.  Fix it to correctly report
failure by setting endptr to the beginning of the input string.
The fix is from theraven@, who fixed this bug in wcstod() and
wcstold() in r227753.

While I'm here:

Move assignments out of declarations in wcstod() and wcstold().
This is against my personal preference, but it is our agreed style(9).

Set endptr correctly on malloc() failure in all three functions.

Remove an incorrect comment:  This is pointer arithmetic,
so the code was not actually making that assumption.

wcstold() advanced the wcp pointer beyond leading whitespace
and then reset it back to the beginning of the string.
Do not reset it.  This seems to have no functional effect,
since strtold_l() also skips leading whitespace.  I'm making
the change to keep this function consistent with wcstof() and
wcstod(), and because the C11 spec prescribes the use of iswspace()
to skip leading space.

Reported by:	libc++ unit test for std::stof(std::wstring)
MFC after:	8 days
Sponsored by:	Dell EMC
2016-11-20 20:13:22 +00:00
Justin Hibbits
4026b44790 Fix buildworld for powerpc.
vmpage requires struct pmap to exist and contain a pm_stats field.  As of
r308817, either AIM or BOOKE is required to be set in order to get their
respective pmap structs.  Rather than expose them both, or try to unify them
unnecessarily, add a third option which contains only a pm_stats field, and
change the two existing pmap structures to place the common fields at the
beginning of the struct.  This actually fixes the stats collection by libkvm on
AIM hardware, because before it was accessing a possibly different offset, which
would cause it to read garbage.

Bump __FreeBSD_version to denote this ABI change, so that ports which depend on
libkvm can be rebuilt.
2016-11-20 06:10:12 +00:00
Dimitry Andric
67bc8c8b9e Merge ^/head r308491 through r308841. 2016-11-19 16:05:55 +00:00
Alan Somers
cbaba16b23 Speed up pw operations that edit /etc/group or /etc/passwd
r285050 fixed a bug in pw that could lead to /etc/passwd or /etc/group
corruption on power loss. However, it fixed it by opening those files with
O_SYNC, which is very slow, especially on ZFS. This change replaces O_SYNC
with appropriately placed fsync()s instead, which is much faster. Using a
ZFS tmpdir, the time to run pw's kyua tests drops from 245s to 35s.

Reviewed by:	allanjude, bapt, vangyzen, garga
Tested on pfSense by:	garga
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D8319
2016-11-18 16:07:08 +00:00
Gleb Smirnoff
00b5ffde8e Add flag SF_USER_READAHEAD to sendfile(2). When specified, the syscall won't
do any speculations about readahead, and use exactly the amount of readahead
specified by user.  E.g. setting SF_FLAGS(0, SF_USER_READAHEAD) will guarantee
that no readahead at all will be performed.
2016-11-17 21:36:18 +00:00
Ruslan Bukin
7804dd5212 Add full softfloat and hardfloat support for RISC-V.
Hardfloat is now default (use riscv64sf as TARGET_ARCH
for softfloat).

Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8529
2016-11-16 15:21:32 +00:00
Alexander Kabaev
20d197f463 Make MIPS startup assembly files use neutral float ABI.
This allows these files to be used with hard and softfloat targets
with no special flags passed to the compiler.

Reviewed by: adrian, br, imp
Differential Revision:	https://reviews.freebsd.org/D8506
2016-11-16 03:21:49 +00:00
Bryan Drewery
d329c46cfa DIRDEPS_BUILD: Connect new dependencies.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2016-11-13 00:11:23 +00:00
Bryan Drewery
7c6d0bb1a0 Move libsysdecode-specific hack out of buildworld.
This should fix the lib32 build since it was not removing the generated
ioctl.c.  This file is generated by a find(1) call, so cannot use normal
dependency tracking methods.

Reported by:	jhb
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2016-11-13 00:11:15 +00:00
Bryan Drewery
5e1eb60d94 Generate and use a proper .depend file for tables.h.
Reported by:	jhb
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2016-11-13 00:11:12 +00:00
Ed Maste
2ed1e385b0 libcc_{s,eh}: build without SSP
As in the gnu/lib/libgcc Makefile:
    libgcc is linked in last and thus cannot depend on ssp
    symbols coming from earlier libraries. Disable stack protection
    for this library.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
2016-11-11 23:28:07 +00:00
Glen Barber
0eaded92d0 Spell 'PACKAGE' correctly.
Submitted by:	Kyle Evans, emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2016-11-11 18:47:53 +00:00
Dimitry Andric
2828dafcf3 Merge ^/head r308227 through r308490. 2016-11-10 22:12:19 +00:00
Jason Evans
bde951447f Update jemalloc to 4.3.1. 2016-11-09 18:42:30 +00:00
Ed Maste
199f4e8d68 add missing i386 symbols libgcc_s symbol version map
After r308294 they were missing on i386 (and previously were exported
only accidentally).

Reported by:	antoine
2016-11-08 17:36:19 +00:00
Toomas Soome
cbd6713146 Loader paged/pageable data is not always paged.
This change does modify devsw dv_print() to return the int value,
enabling walkers to interrupt the walk on non zero value from dv_print().

This will allow the pager_print actually to stop displaying data on
user input, and additionally pager is used in various *dev_print callbacks,
where it was missing.

For test, lsdev [-v] command should display data by screenfuls and should
stop when the key 'q' is pressed on pager prompt.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D5461
2016-11-08 06:50:18 +00:00
Xin LI
a5d223e641 MFV r308392: file 5.29.
MFC after:	2 weeks
2016-11-07 15:54:47 +00:00
Edward Tomasz Napierala
319f1fd2ea Document that getfsstat(2) called with MNT_NOWAIT skips file systems
that are in the process of being unmounted.

Reviewed by:	des@ (earlier version)
MFC after:	1 month
2016-11-06 19:37:22 +00:00
Ed Maste
7f35637063 add __divdi3 and __udivdi3 to libgcc_s symbol version map
After r308294 they were missing on i386 (and previously were exported
only accidentally).

Reported by:	antoine
2016-11-06 17:21:26 +00:00
Ed Maste
c7fbd7722d Connect new LLVM-based libgcc_eh & libgcc_s to the build
Compiler-rt and LLVM's libunwind provide a suitable replacement for
libgcc.a, libgcc_eh.a, and libgcc_s.so.

Remove the now-unused LLVM_LIBUNWIND block from gnu/lib/libgcc.

PR:		213480 [exp-run]
Reviewed by:	brooks, ed
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8189
2016-11-04 19:35:49 +00:00
Ed Maste
e8664a318d libgcc_s: make unspecified shlib symbols local
We want only symbols explicitly specified in the Version.map.

Sponsored by:	The FreeBSD Foundation
2016-11-04 15:44:00 +00:00
Ed Schouten
34168b28e9 Replace basename(3) by a thread-safe implementation.
Now that the changes to the dirname(3) function had some time to settle,
let's go ahead and use the same approach for replacing basename(3) by a
simple implementation that modifies the input string, thereby making it
thread-safe and guaranteed to succeed.

Unlike dirname(3), this function already had a thread-safe variant
basename_r(3). This function had its own set of problems, like having an
upper bound on the pathname length. Keep this function around for
compatibility, but remove most references from the man page. Make the
man page more similar to that of dirname(3).

As the basename_r(3) function is only provided by FreeBSD (and Bionic),
depending on its use is even more implementation defined than assuming
that basename(3) is thread-safe.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D8382
2016-11-03 20:21:34 +00:00
Ruslan Bukin
2ad1d09f16 o Add support for long double.
o Add support for latest RISC-V GNU toolchain.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-11-03 13:06:17 +00:00
Dimitry Andric
a2b802ce70 Merge ^/head r303250 through r308226. 2016-11-02 19:18:24 +00:00
Ed Maste
dba5d1ca17 libm: add braces around initialization of subobjects
This cleans up a warning when building libm at higher WARNS levels and
makes the intent more clear. By the C standard the values are assigned
to subobject members in order so this change introduces no functional
change. (6.7.9 20)

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8333
2016-11-01 15:11:10 +00:00
Ruslan Bukin
77bc2a1cd6 Locale fix for endian big (EB) machines.
We have locale files generated on EL machines (e.g. during cross-build
on amd64 host), but then we are using them on EB machines (e.g. MIPS64EB),
so proceed byte-swap if necessary.

All the libc tests passed successfully, including Russian collation.

Tested by:	br@, Hongyan Xia <hx242@cam.ac.uk>
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8281
2016-11-01 13:54:44 +00:00
Dimitry Andric
02ebdc7823 Merge ^/head r307736 through r308146. 2016-10-31 19:02:42 +00:00
Ruslan Bukin
130a08a362 Detect integer overflow and limit the number of positional
arguments in the string format.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8286
2016-10-31 18:38:58 +00:00
Ruslan Bukin
5bca221511 Add full softfloat and hardfloat support for MIPS.
This adds new target architectures for hardfloat:
mipselhf mipshf mips64elhf mips64hf.

Tested in QEMU only.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8376
2016-10-31 15:33:58 +00:00
Baptiste Daroussin
ad9f2cecd7 When issuing a PXE dhcp request, always issue a param request (DHCP option 55)
with all dhcp parameters we might be interested in.

Some DHCP server like the new kea (by ISC) expect it.

This makes pxeboot functional with ISC kea.

Submitted by:	Vincent Legout <vincent.legout@gandi.net>
MFC after:	1 month
Sponsored by:	Gandi.net
2016-10-31 15:11:55 +00:00
Ed Maste
c82bd4484c compile libunwind c source with -fexceptions
When an exception is thrown the unwinder must unwind its own C source
(starting with _Unwind_RaiseException in UnwindLevel1.c), so it needs to
be built with unwinding data.
2016-10-30 02:57:47 +00:00
Justin Hibbits
aab03089ee Fix a copy&paste-o causing a segfault with sigsetjmp.
I'm not sure how this passed my code inspection and initial testing, it's
obviously wrong.  Found when debugging csh.
2016-10-29 01:22:55 +00:00
John Baldwin
ab1b41edb5 Fix formatting of tables.
Specifically, use .Ta instead of tabs to separate column entries.  While
here fix a few other things:
- Use .Sy for all column headers (previously only the first column header
  was bold)
- Use .Dv to markup constants used for MIB names.
- Use "1234" and "4321" for the byte order descriptions without
  thousands separators.
- Mark up header files in the first table with .In.

MFC after:	2 weeks
2016-10-28 18:09:08 +00:00
Ed Maste
e301826d4c libgcc_eh/libgcc_s: apply hidden visibility only to static libs 2016-10-27 14:21:54 +00:00
Ruslan Bukin
1d290950b2 Use uint32_t instead of u_long as a storage for breakpoint instruction
to copy. All the platforms breakpoints fits this fine.

This fixes operation on big-endian MIPS64 where we were coping
zeroes instead of real instruction.

Reviewed by:	rpaulo
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8250
2016-10-26 14:26:45 +00:00
John Baldwin
8368d90bfc Use binary and (&) instead of logical to extract the mask of a capability.
CID:		1365227
Submitted by:	cem
2016-10-25 18:45:14 +00:00
Justin Hibbits
80d2e10c9b Fix a typo which broke the build for powerpc.
It's spelled LIBC_SRCTOP not LIBC_SRC.

Pointy-hat to:	jhibbits
Reported by:	kib
2016-10-25 01:32:35 +00:00
Marcel Moolenaar
871afaefab Include "util.h", not <util.h>. The header is in the same directory
as the C file. There may be a <util.h> on the host when compiling
on macOS or Linux, causing conflicts.
2016-10-24 17:57:46 +00:00
Marcel Moolenaar
b0928c0dbb When compiling on macOS or Linux, __dead can be defined already.
Conditionally define __dead.
2016-10-24 17:56:08 +00:00
Ed Maste
6430a5fde0 Move the LLVM-based libgcc_s to /lib
When enabled, it should install in the same location as the existing
library.

Reported by:	antoine
2016-10-24 14:56:13 +00:00
Ed Maste
aa09009340 Set SHLIBDIR before .including src.opts.mk in libcapser services
bsd.own.mk (included from src.opts.mk) sets SHLIBDIR?=${LIBDIR}, so
SHLIBDIR must be set before including either one of them.

MFC with:	305626
Sponsored by:	The FreeBSD Foundation
2016-10-24 14:37:18 +00:00
Adrian Chadd
94dab02d88 [rss] manpage improvements.
Submitted by:	gallatin
2016-10-23 20:42:32 +00:00
Adrian Chadd
3b46b94b58 [rss] install the header file.
Submitted by:	gallatin
2016-10-23 20:41:25 +00:00
Justin Hibbits
3bf61aa48d Remove the powerpcspe Symbol.map, it's identical to powerpc's.
Reported by:	kib
2016-10-23 18:08:34 +00:00
Justin Hibbits
54360de77b Reduce code duplication between powerpc and powerpcspe
They're nearly identical except for a few files.
Reported by:	kib
2016-10-22 21:51:58 +00:00
Edward Tomasz Napierala
0b9cf9729b Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not
"product vendor". This is consistent with how it's generally done.
The ordering is visible eg in usbconfig(8) output.

Note to self: MFC this to 9 and 8.

Reviewed by:	hselasky@
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8258
2016-10-22 14:37:13 +00:00
Justin Hibbits
8f34671a5e ptrace.S is not needed, libc/sys/ptrace.c exists already.
This was leftovers from the initial branch work.

Reported by:	kib
2016-10-22 13:11:09 +00:00
Justin Hibbits
dc9b124d66 Create a new MACHINE_ARCH for Freescale PowerPC e500v2
Summary:
The Freescale e500v2 PowerPC core does not use a standard FPU.
Instead, it uses a Signal Processing Engine (SPE)--a DSP-style vector processor
unit, which doubles as a FPU.  The PowerPC SPE ABI is incompatible with the
stock powerpc ABI, so a new MACHINE_ARCH was created to deal with this.
Additionaly, the SPE opcodes overlap with Altivec, so these are mutually
exclusive.  Taking advantage of this fact, a new file, powerpc/booke/spe.c, was
created with the same function set as in powerpc/powerpc/altivec.c, so it
becomes effectively a drop-in replacement.  setjmp/longjmp were modified to save
the upper 32-bits of the now-64-bit GPRs (upper 32-bits are only accessible by
the SPE).

Note: This does _not_ support the SPE in the e500v1, as the e500v1 SPE does not
support double-precision floating point.

Also, without a new MACHINE_ARCH it would be impossible to provide binary
packages which utilize the SPE.

Additionally, no work has been done to support ports, work is needed for this.
This also means no newer gcc can yet be used.  However, gcc's powerpc support
has been refactored which would make adding a powerpcspe-freebsd target very
easy.

Test Plan:
This was lightly tested on a RouterBoard RB800 and an AmigaOne A1222
(P1022-based) board, compiled against the new ABI.  Base system utilities
(/bin/sh, /bin/ls, etc) still function appropriately, the system is able to boot
multiuser.

Reviewed By:	bdrewery, imp
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D5683
2016-10-22 01:57:15 +00:00
Mariusz Zaborski
afc7ee85ef Fix few sentence in the man page.
Pointed out by:	wblock
2016-10-21 16:31:58 +00:00
Dimitry Andric
5763f79695 Merge ^/head r307383 through r307735. 2016-10-21 16:29:40 +00:00
Enji Cooper
aa1a469bcd Only build lib/libc/tests/iconv if MK_ICONV != no
MFC after:	1 week
Reported by:	damian@damianek.be
Sponsored by:	Dell EMC Isilon
2016-10-21 04:54:43 +00:00
Alan Somers
8254c3c5d3 Fix C++ includability of crypto headers with static array sizes
C99 allows array function parameters to use the static keyword for their
sizes. This tells the compiler that the parameter will have at least the
specified size, and calling code will fail to compile if that guarantee is
not met. However, this syntax is not legal in C++.

This commit reverts r300824, which worked around the problem for
sys/sys/md5.h only, and introduces a new macro: min_size(). min_size(x) can
be used in headers as a static array size, but will still compile in C++
mode.

Reviewed by:	cem, ed
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D8277
2016-10-18 23:20:49 +00:00
John Baldwin
9289f547a2 Move mksubr from kdump into libsysdecode.
Restructure this script so that it generates a header of tables instead
of a source file.  The tables are included in a flags.c source file which
provides functions to decode various system call arguments.

For functions that decode an enumeration, the function returns a pointer
to a string for known values and NULL for unknown values.

For functions that do more complex decoding (typically of a bitmask), the
function accepts a pointer to a FILE object (open_memstream() can be used
as a string builder) to which decoded values are written.  If the
function operates on a bitmask, the function returns true if any bits
were decoded or false if the entire value was valid.  Additionally, the
third argument accepts a pointer to a value to which any undecoded bits
are stored.  This pointer can be NULL if the caller doesn't care about
remaining bits.

Convert kdump over to using decoder functions from libsysdecode instead of
mksubr.  truss also uses decoders from libsysdecode instead of private
lookup tables, though lookup tables for objects not decoded by kdump remain
in truss for now.  Eventually most of these tables should move into
libsysdecode as the automated table generation approach from mksubr is
less stale than the static tables in truss.

Some changes have been made to truss and kdump output:
- The flags passed to open() are now properly decoded in that one of
  O_RDONLY, O_RDWR, O_WRONLY, or O_EXEC is always included in a decoded
  mask.
- Optional arguments to open(), openat(), and fcntl() are only printed
  in kdump if they exist (e.g. the mode is only printed for open() if
  O_CREAT is set in the flags).
- Print argument to F_GETLK/SETLK/SETLKW in kdump as a pointer, not int.
- Include all procctl() commands.
- Correctly decode pipe2() flags in truss by not assuming full
  open()-like flags with O_RDONLY, etc.
- Decode file flags passed to *chflags() as file flags (UF_* and SF_*)
  rather than as a file mode.
- Fix decoding of quotactl() commands by splitting out the two command
  components instead of assuming the raw command value matches the
  primary command component.

In addition, truss and kdump now build without triggering any warnings.
All of the sysdecode manpages now include the required headers in the
synopsis.

Reviewed by:	kib (several older versions), wblock (manpages)
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D7847
2016-10-17 22:37:07 +00:00
John Baldwin
3abf45a148 Use 'cmd' rather than 'command' to match the function prototype. 2016-10-17 22:36:37 +00:00
Ed Maste
de13c2427d libmd: introduce functions that operate on an fd instead of filename
Reviewed by:	allanjude, cem
MFC after:	2 months
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8264
2016-10-17 13:47:22 +00:00
Dimitry Andric
a0e610c439 Merge ^/head r306906 through r307382. 2016-10-15 22:49:04 +00:00
Baptiste Daroussin
a0642264ba Use SRCTOP to find the sources of libucl 2016-10-15 13:17:27 +00:00
Baptiste Daroussin
26d8ca3bc9 directly create the socket with SOCK_NONBLOCK instead of calling fcntl(2) 2016-10-15 13:16:52 +00:00
Ed Schouten
279d89406b Improve phrasing of the STANDARDS section.
Reported by:	wblock
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8205
2016-10-15 08:09:55 +00:00
Ed Maste
df283203fc Simplify logic for libproc and librtld_db in lib/Makefile 2016-10-14 17:04:07 +00:00
Ed Maste
cd060b8d7a partially convert lib/Makefile to SUBDIR.${MK_FOO} style
Cases other than MK_* (e.g. ${MACHINE_CPUARCH} == "i386") have been left
as is.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8246
2016-10-14 01:53:15 +00:00
Ed Maste
3ba97c2088 garbage collect _libatm, missed in r179308 2016-10-13 21:35:48 +00:00
Ed Maste
bff207520a libgcc_s: add libm dependencies from div{d,s,x}c3
compiler-rt's complex division support routines contain calls to
compiler builtins such as `__builtin_scalbnl`.  Unfortunately Clang
turns these back into a call to `scalbnl`.

For now link libm's C version of the required support routines.

Reviewed by:	ed
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8190
2016-10-13 19:18:00 +00:00
Ed Maste
49c5eacbbf Introduce lib/libgcc_eh and lib/libgcc_s for LLVM's implementation
They are not yet connected to the build, but I am adding them to allow
for easier testing, ports exp-runs, etc.

Reviewed by:	ed
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8188
2016-10-13 18:57:18 +00:00
Ed Schouten
4ef9bd22ed Improve typing of POSIX search tree functions.
Back in 2015 when I reimplemented these functions to use an AVL tree, I
was annoyed by the weakness of the typing of these functions. Both tree
nodes and keys are represented by 'void *', meaning that things like the
documentation for these functions are an absolute train wreck.

To make things worse, users of these functions need to cast the return
value of tfind()/tsearch() from 'void *' to 'type_of_key **' in order to
access the key. Technically speaking such casts violate aliasing rules.
I've observed actual breakages as a result of this by enabling features
like LTO.

I've filed a bug report at the Austin Group. Looking at the way the bug
got resolved, they made a pretty good step in the right direction. A new
type 'posix_tnode' has been added to correspond to tree nodes. It is
still defined as 'void' for source-level compatibility, but in the very
far future it could be replaced by a proper structure type containing a
key pointer.

MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8205
2016-10-13 18:25:40 +00:00
Ruslan Bukin
c3fa65b1c8 Fix typos: use correct string format and value to compare.
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8226
2016-10-13 15:26:51 +00:00
Ruslan Bukin
2302bd3539 Fix strchr, strrchr implementation: convert c to char
(according to standard).

Discussed with:	andrew
Reviewed by:	emaste
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8239
2016-10-13 15:23:53 +00:00
Warner Losh
b2a7ac4802 Fix building on i386 and arm. But 'public domain' headers on the files
with no creative content. Include "lost" changes from git:
o Use /dev/efi instead of /dev/efidev
o Remove redundant NULL checks.

Submitted by: kib@, dim@, zbb@, emaste@
2016-10-13 06:56:23 +00:00
Ed Maste
49a6e1ba32 Add comment on use of abort() in libc
Suggested by:	jonathan (in review D8133)
2016-10-12 13:56:14 +00:00
Ruslan Bukin
32797df534 Add different libc ldscript: the one without libssp --
we don't have it when MK_SSP==no.

This fixes compilation on MIPS.

Reviewed by:	imp
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8212
2016-10-12 13:19:21 +00:00
Warner Losh
d49a5ddd04 Create libefivar library. This library aims to provide
the same API as the GPL'd version of this library. It implements the common
Linux API for programatically manipulating UEFI environment varibales using
the UEFI Runtime Services the kernel provides. It replaces the old efi
library since it is programmed to a different interface, but retails the
CHAR16 to UTF-8 and vice versa conversion routines. The new name is to match
Linux program's expectations.

Differential Revision: https://reviews.freebsd.org/D8128
Reviewed by: kib@, wblock@, Ganael Laplanche
2016-10-11 22:30:41 +00:00
Ruslan Bukin
fae95359ee Don't use fmaxl/fminl on platforms with no long double support,
use fmax/fmin instead.

This fixes fmaxmin test failure on MIPS64.

Reviewed by:	emaste
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8216
2016-10-11 20:31:59 +00:00
Konstantin Belousov
6886c70100 Correct indent.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2016-10-11 11:46:02 +00:00
Konstantin Belousov
c3b83049d6 Fill msg_len for the initial element of msgvec.
Submitted by:	Daniel Salzman <daniel.salzman@nic.cz>
MFC after:	3 days
2016-10-11 11:45:12 +00:00
Dimitry Andric
242b248284 Merge ^/head r306412 through r306905. 2016-10-09 13:30:57 +00:00
Bryan Drewery
3617efe593 Improve grammar.
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2016-10-06 17:35:50 +00:00
Mariusz Zaborski
c3eed03d15 Add man pages for Capsicum helpers.
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D8154
2016-10-05 20:02:34 +00:00
Ed Maste
a01a51a352 libm: remove unused variables
Sponsored by:	The FreeBSD Foundation
2016-10-05 17:04:58 +00:00
Ed Maste
7e81ad1292 abort in srandomdev if kern.arandom sysctl fails
The sysctl cannot fail. If it does fail on some FreeBSD derivative or
after some future change, just abort() so that the problem will be found
and fixed.

While abort() is not normally suitable for a library, it makes sense
here.

This is akin to r306636 for arc4random.

Reviewed by:	ed
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8077
2016-10-05 17:03:22 +00:00
Mariusz Zaborski
e7798d20c5 Fix naming in Casper man page. 2016-10-05 16:23:02 +00:00
Mariusz Zaborski
059cc32342 libcapsicum: limit stderr
Don't limit stdout twice, instead limit stderr.

Pointed out by:	rpokala@
2016-10-04 13:33:43 +00:00
Martin Matuska
f3e9b21a7a MFV r306669:
Sync libarchive with vendor including security fixes.

Important vendor bugfixes (relevant to FreeBSD):
#747: Out of bounds read in mtree parser
#761: heap-based buffer overflow in read_Header (7-zip)
#784: Invalid file on bsdtar command line results in internal errors (1)

PR:		213092 (1)
MFC after:	1 week
2016-10-04 11:56:46 +00:00
Mariusz Zaborski
7a6e3cf83e libcapsicum: introduce Capsicum helpers
Capsicum helpers are a set of inline functions which goal is to reduce
duplicated patterns used to Capsicumize applications.

Reviewed by:	cem, AllanJude, bapt, ed, emaste
Differential Revision:	https://reviews.freebsd.org/D8013
2016-10-03 20:48:18 +00:00
Ed Schouten
1a466ddc79 Remove setkey(), encrypt(), des_setkey() and des_cipher().
The setkey() and encrypt() functions are part of XSI, not the POSIX base
definitions. There is no strict requirement for us to provide these,
especially if we're only going to keep these around as undocumented
stubs. The same holds for des_setkey() and des_cipher().

Instead of providing functions that only generate warnings when linking,
simply disallow linking against them. The impact of this is relatively
low. It only causes two leaf ports to break. I'll see what I can do to
help out to get those fixed.

PR:		211626
2016-10-03 18:20:58 +00:00
Toomas Soome
ef97c45728 Fix remaining bugs in libstancd/cd9660.c reported by Bruce Evans.
Fixed text in comments.

Reported by:	Bruce Evans <brde@optusnet.com.au>
Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8119
2016-10-03 14:07:15 +00:00
Ed Maste
5c1ea1fcd0 libc arc4_stir: use only kern.arandom sysctl
The sysctl cannot fail. If it does fail on some FreeBSD derivative or
after some future change, just abort() so that the problem will be found
and fixed.

It's preferable to provide an arc4random() function that cannot fail and
cannot return poor quality random data. While abort() is not normally
suitable for a library, it makes sense here.

Reviewed by:	ed, jonathan, markm
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8077
2016-10-03 13:12:44 +00:00
Konstantin Belousov
ddce1c3ddb Export the mq_getfd_np() symbol from librt.so, which allows to get
file descriptor for the given posix mqueue.  Export the
timer_oshandle_np() symbol to get ktimer id for the given posix timer.

Requested by:	Lewis Donzis <lew@perftech.com>
Reviewed by:	jilles
Discussed with:	kan
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-10-02 17:02:59 +00:00
Ruslan Bukin
e5edb77987 Fix libjail reached latest sysctl entry.
Reviewed by:	jamie
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8096
2016-10-02 11:56:17 +00:00
Toomas Soome
062b8022ac Fix remaining cstyle issues in libstand/cd9660.c
Reported by:	Bruce Evans <brde@optusnet.com.au>
Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8107
2016-10-01 07:46:28 +00:00
Toomas Soome
6a21906bea cstyle fix of cd9660_open in libstand
rS306534 did create bad cstyle by my mistake, correcting it.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8103
2016-09-30 23:19:08 +00:00
Conrad Meyer
c038bae74c open.2: Document Capsicum behavior
Document open(2) and openat(2) behavior in Capsicum capability mode.

Reviewed by:	ed (previous version), emaste, rwatson (previous version),
		wblock
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D7947
2016-09-30 23:01:37 +00:00
Toomas Soome
339e076e67 cd9660_open should check for padding
The libstand cd9660 reader code must check for extents having padding.

Reviewed by:	jhb
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8101
2016-09-30 22:28:20 +00:00
Ed Maste
cf825f93cc libm: remove unused variables for LDBL_MANT_DIG != 113
Sponsored by:	The FreeBSD Foundation
2016-09-30 20:20:07 +00:00
Adrian Chadd
35c05a4fbc Add librss, a simple wrapper around RSS APIs so applications can begin auto-tuning.
I've used this in a handful of RSS test applications.  It is just some
very simple functions to fetch the RSS configuration, query the per-bucket
CPU set, and mark sockets as local to an RSS bucket.  It should be sufficient
for both thread-based and process-based workloads.

(Yes, I wrote a manpage.)

This is based on some early RSS API and wrapper API work I did whilst
I was at Netflix.  Thanks to Netflix for the very original work that
spawned this; thanks to Peter Grehan for his feedback about RSS APIs
and thanks to Jack Vogel and Navdeep Parhar for the NIC-facing side of the
APIs.  These fed into the simple userland API I wrote up here.

Reviewed by:	gallatin
2016-09-30 19:59:56 +00:00
Konstantin Belousov
6d8f097966 Reword the statement.
Submitted by:	wblock
MFC after:	3 days
2016-09-30 16:02:25 +00:00
Konstantin Belousov
98003d078f Add an article.
Submitted by:	wblock
MFC after:	3 days
2016-09-30 15:47:13 +00:00
Dag-Erling Smørgrav
58d2f848e2 Reinstate Xr macros that were accidentally removed in a previous
commit.  Add some missing cross-references to the SEE ALSO section.
Bump date now that there are content changes.

MFC after:	1 week
2016-09-30 13:05:32 +00:00
Dag-Erling Smørgrav
2224742ff4 Minor markup and wording fixes.
MFC after:	1 week
2016-09-30 13:04:18 +00:00
Dag-Erling Smørgrav
1577b7750e After perusal of the documentation and some experimentation, I found a
version that works with both groff and mandoc.

Hat tip to:	kib
MFC after:	1 week
2016-09-30 11:05:29 +00:00
Dag-Erling Smørgrav
ef14f6a19e Format the table correctly, using cell separators instead of relying
on *roff or mandoc to guess where one cell ends and the next begins.

MFC after:	1 week
2016-09-30 09:23:29 +00:00
Ed Maste
335bcabec9 Merge ^/head r306303 through 306411. 2016-09-28 19:29:01 +00:00
Ed Maste
d6e65178c6 libm: simplify i387 subdir logic with make's :S substitution 2016-09-28 17:44:03 +00:00
Ed Maste
dcdfa506cc libm: fix some unused variable (rcsid) and dangling else warnings
s_{fabs,fmax,logb,scalb}{,f,l}.c may be built elsewhere with a higher
WARNS setting.

Reviewed by:	ed
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8061
2016-09-28 14:48:34 +00:00
Ed Maste
040b30497c libcompiler_rt: move file list to Makefile.inc for reuse elsewhere
Also switch to the style used in the clang390-import branch to reduce
future conflicts.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8039
2016-09-27 18:55:45 +00:00
Ed Maste
f987297fc9 Add a WITHOUT_DIALOG src.conf(5) knob
It also turns off dependencies (bsdinstall, bsdconfig, dpv, tzsetup).

Reviewed by:	dteske
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7969
2016-09-27 18:08:38 +00:00
Konstantin Belousov
5925fff002 Editing fixes for r306257, documentation for trapcap.
Suggested by:	wblock
Discussed with:	jilles
Reviewed by:	cem (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D8023
2016-09-27 11:31:53 +00:00
Ruslan Bukin
5bec6d5513 Mark SSP broken on MIPS.
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-09-27 09:44:30 +00:00
Ruslan Bukin
cda20f96df Increase timeout from 300 (default) to 600 seconds.
It takes 6-7 minutes to proceed the test on MIPS64EB.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-09-26 20:13:33 +00:00
Pedro F. Giffuni
70e7268bd5 hash(3): protect in-memory page when using cross-endianness.
When writing out pages in the "other endian" format, make a copy
instead of trashing the in-memory one.

Obtained from:	NetBSD (CVS rev. 1.29)
2016-09-26 16:06:50 +00:00
Ruslan Bukin
ed8f18ded4 Don't build SSP tests on MIPS as we dont have stack-protector
supported on this platform.

Discussed with:	brooks
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-09-26 15:38:02 +00:00
Konstantin Belousov
fd6c95c09f Document thr_suspend(2) and thr_wake(2).
Reviewed by:	bjk, jilles
Discussed with:	emaste, wblock
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D8016
2016-09-26 08:18:34 +00:00
Pedro F. Giffuni
d191be26c0 btree(3): don't shortcut closing if the metadata is dirty.
Obtained from:	NetBSD (from krb5 tree)

MFC after:	3 weeks
2016-09-26 02:29:28 +00:00
Dimitry Andric
8c4282b370 Merge ^/head r305892 through r306302. 2016-09-24 20:58:59 +00:00
Marcel Moolenaar
2b4da8aa20 When MAKEOBJDIRPREFIX points to a case-insensitive file system, the
build can break when different source files create the same target
files (case-insensitivity speaking).  This is the case for object
files compiled with -fpic and shared libraries. The former uses
an extension of ".So", and the latter an extension ".so".  Rename
shared object files from *.So to *.pico to match what NetBSD does.

See also r305855

MFC after:	1 month
Sponsored by:	Bracket Computing
Differential Revision:	https://reviews.freebsd.org/D7906
2016-09-24 15:11:27 +00:00
Ed Maste
d7e002ff96 libcompiler_rt: use ${SRCTOP} for the top of the FreeBSD tree 2016-09-23 13:23:52 +00:00
Konstantin Belousov
23670cf40a Document r306081, i.e. procctl(PROC_TRAPCAP) and sysctl kern.trap_enocap.
Reviewed by:	cem
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D8003
2016-09-23 09:26:40 +00:00
Conrad Meyer
852aea3dd7 posix_openpt.2: Sort includes per style(9)
Sponsored by:	Dell EMC Isilon
2016-09-21 17:51:27 +00:00
Andrey A. Chernov
5fca7e1f13 1) For already non-standard %z extension implement GNU compatible formats:
+hh and -hh.
2) Check for incorrect values for %z.

MFC after:      7 days
2016-09-21 15:47:40 +00:00
Ruslan Bukin
dab6d6fb5a Use kqueue(2) instead of select(2).
This helps to ensure we will not lose SIGINT sent by parent to child.

Reviewed by:	sbruno, ngie
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D7892
2016-09-21 11:59:52 +00:00
Andrey A. Chernov
62b939ebfb 1) Microoptimize %p case.
2) Implememt %u for GNU compatibility.
3) Don't forget to advance buf for %w/%u.
4) Fail with incomplete week (week 0) request and no such week in the
year.
5) Fix yday formula when Sunday requested and the week started from Monday.
6) Fail with impossible yday for incomplete week (week 0) and direct %w/%u
request.
7) Shift yday/wday to the first day of the year, if incomplete week
(week 0) requested and no %w/%u used.

MFC after:      7 days
2016-09-21 06:44:32 +00:00
Andrew Turner
5a3a700931 Attach the cortex strings library to the build. Only a subset of functions
have been added as some don't seem to be improvements over the libc C
implementation.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-09-19 15:08:03 +00:00
Enji Cooper
b3ef7604b9 Re-add PACKAGE=> tests to lib/libc/tests/net/getaddrinfo/Makefile and add
it to lib/libc/tests/sys/Makefile [*]

Even though make -VPACKAGE and make -n install seem to do the right thing,
the effects are a bit different, depending on the build host.

MFC after:		1 week
Obtained from:		HardenedBSD (af602f0db) [*]
Reported by:		Oliver Pinter <oliver.pinter@hardenedbsd.org> [*]
Sponsored by:		Dell EMC Isilon
2016-09-19 06:59:17 +00:00
Eric Badger
5c07002e67 Add manpage for rctl_* system calls
Reviewed by:	trasz, wblock
Approved by:	kib (mentor)
MFC after:	3 days
Sponsored by:	Dell Technologies
Differential Revision:	https://reviews.freebsd.org/D7877
2016-09-19 02:25:30 +00:00
Ed Schouten
fd85bff53e Replace dirname(3) by a copy that complies to POSIX.
It turns out that the path normalization that our brand new copy of
dirname(3) does is actually not allowed by the draft version of the
upcoming version of POSIX. It has to behave identically to the
dirname(1) utility.

This change replaces our new dirname(3) implementation by yet another
version that doesn't implement the path normalization logic; it merely
looks for the end of the directory name and overwrites that with a null
byte.

More details: See note #3370 at http://austingroupbugs.net/view.php?id=1073

PR:		212193
Reviewed by:	emaste, jilles
Differential Revision:	https://reviews.freebsd.org/D7790
2016-09-18 20:47:55 +00:00
Enji Cooper
9cd70b19ae Similar to r305920, remove spurious newlines from ATF_REQUIRE_MSG calls
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2016-09-18 06:00:07 +00:00
Enji Cooper
e57c1140a0 Remove spurious newlines from atf_tc_fail calls
This changes the results from broken (incorrect) to failed (correct) on
i386

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2016-09-18 05:54:13 +00:00
Enji Cooper
87d5d10d7d Don't define PACKAGE in lib/libc/tests/{iconv,net/getaddrinfo}
needlessly

This is already being done by bsd.test.mk

The other subdirectory Makefiles were intentionally left alone

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2016-09-18 05:12:23 +00:00
Konstantin Belousov
6bd8ddcf0c Fix libprocstat build after r305902.
- Use _Bool to not require userspace to include stdbool.h.
- Make extattr.h usable without vnode_if.h.
- Follow i_ump to get cdev pointer.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-09-17 18:14:31 +00:00
Dimitry Andric
93badfa1f2 Merge ^/head r305687 through r305890. 2016-09-16 20:49:12 +00:00
Marcel Moolenaar
cb1cb6a2a8 When MAKEOBJDIRPREFIX points to a case-insensitive file system, the
build can break when different source files create the same object
files (case-insensitivity speaking).  This is the case for _Exit.c
and _exit.s.  Compile _Exit.c as C99_Exit.c

Reviewed by:	sjg@
MFC after:	completion
Sponsored by:	Bracket Computing
Differential Revision:	https://reviews.freebsd.org/D7893
2016-09-16 03:04:48 +00:00
Martin Matuska
24113d8c17 MFV r305816:
Sync libarchive with vendor including important security fixes.

Issues fixed (FreeBSD):
PR #778: ACL error handling
Issue #745: Symlink check prefix optimization is too aggressive
Issue #746: Hard links with data can evade sandboxing restrictions

This update fixes the vulnerability #3 and vulnerability #4 as reported in
"non-cryptanalytic attacks against FreeBSD update components".
https://gist.github.com/anonymous/e48209b03f1dd9625a992717e7b89c4f

Fix for vulnerability #2 has already been merged in r304989.

MFC after:	1 week
Security: http://gist.github.com/anonymous/e48209b03f1dd9625a992717e7b89c4f
2016-09-14 21:15:01 +00:00
Baptiste Daroussin
d600e95429 Add a comment on the #endif related to the guards
Reported by:	tsoome
2016-09-13 15:41:05 +00:00
Allan Jude
567de0da7e Mark libifconfig as private until the API/ABI is stable
libifconfig is still experimental and under active development.
To avoid making any ABI promises, mark the library as private

Suggested by:	bapt
Reviewed by:	kp
2016-09-11 17:44:35 +00:00
Ed Maste
f14f55d622 cap_enter.2: describe flag returned by cap_getmode
Previously the flag returned by cap_getmode was not described explicitly
in the man page.

Reviewed by:	wblock
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7822
2016-09-11 01:11:47 +00:00
Dimitry Andric
a75e9a0239 Merge ^/head r305623 through r305686. 2016-09-10 17:00:08 +00:00
Brooks Davis
3662835abf Fix spelling in comment.
Submitted by:	brueffer
2016-09-09 16:18:44 +00:00
Brooks Davis
aec2fba60f Reduce duplicate NOASM and PSEUDO definitions
The initial value of NOASM is nearly the same in all cases and the
initial value of PSEUDO is the same in all cases so reduce duplication
(and hopefully, future merge conflicts) by machine independent defaults.

Also document the PSEUDO variable.

Reviewed by:	jhb, kib
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D7820
2016-09-08 22:38:20 +00:00
Jilles Tjoelker
527094b93f intro(2),_exit(2): Update for reaper (procctl(PROC_REAP_ACQUIRE)).
MFC after:	1 week
2016-09-08 21:50:03 +00:00
Mariusz Zaborski
d3bfc7250f Move libcasper tests from regression/capsicum/libcasper/ to
lib/libcasper/service/${service_name}/tests.

Reviewed by:	emaste, ngie
Differential Revision:	https://reviews.freebsd.org/D7759
2016-09-08 20:01:26 +00:00
Dimitry Andric
d002f039ae Merge ^/head r305431 through r305622. 2016-09-08 18:15:36 +00:00
Sepherosa Ziehau
ff9eac2e6d pxeboot: Add nfs.read_size tunable.
Increase this tunable improves kernel loading speed.

Submitted by:	Jun Su <junsu microsoft com>
Reviewed by:	rpokala, wblock (previous version)
Obtained from:	DragonFlyBSD
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7756
2016-09-08 09:11:13 +00:00
Warner Losh
949b56ba66 Renumber the advertising clause. 2016-09-06 15:17:35 +00:00
Enji Cooper
b8cc28b782 Install h_db to unbreak some of the lib/libc/db testcases after
r305358

MFC after:	59 days
X-MFC with:	r305358
Reported by:	Jenkins, rodrigc
Sponsored by:	EMC / Isilon Storage Division
2016-09-06 00:51:25 +00:00
Dimitry Andric
1839de1a4b Merge ^/head r305397 through r305430. 2016-09-05 18:05:45 +00:00
Dimitry Andric
2a0eade7f4 Fix building some arm-specific primitives for libcompiler_rt. This was
an unfortunate search and replace error.
2016-09-05 17:20:12 +00:00
Martin Matuska
47af42f8e7 MFV r305420:
Sync libarchive with vendor

Vendor issues fixed:
PR #777: Multiple bugfixes for setup_acls()

This includes a bugfix for a bug that caused ACLs not to be read properly
for files and directories inside subdirectories and as a result not being
stored or being incorrectly stored in tar archives.

MFC after:	3 days
2016-09-05 15:40:41 +00:00
Andrey A. Chernov
031986c4f3 Fix error handling.
MFC after:      3 days
2016-09-05 06:46:04 +00:00
Andrey A. Chernov
0b51c11a0e Fix n == 1 case. Here should be no physical read (fill buffer) attempt
(we read n - 1 chars with the room for NUL, see fgets()),
and no NULL return.

MFC after:      3 days
2016-09-05 06:10:51 +00:00
Andrey A. Chernov
4a9921c601 1) Prevent out of bounds access to ws[-1] (passed buffer) which happens
when the first mb sequence is incomplete and there are not enougn chars in
the read buffer. ws[-1] may lead to memory faults or false results, in
case the memory here contains '\n'.

2) Fix EOF checking I mess in my previos r305406 commit.

MFC after:      3 days
2016-09-05 04:49:58 +00:00
Andrey A. Chernov
0c744b20b0 Fix errors handling.
MFC after:      3 days
2016-09-05 03:37:28 +00:00
Dimitry Andric
b39c8b65aa Merge ^/head r305394 through r305396. 2016-09-04 21:54:24 +00:00
Kristof Provost
9a2ff3154b libifconfig: style(9) fixes
Also switch from BSD 3-clause to 2-clause license where possible, and
consolidate duplicate 3-clause license into one.

Submitted by:	Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Reviewed by:	cem, kp
Differential Revision:	https://reviews.freebsd.org/D7764
2016-09-04 20:55:27 +00:00
Dimitry Andric
3d6d3da454 Merge ^/head r305361 through r305389. 2016-09-04 17:26:42 +00:00
Dimitry Andric
084b3adb03 Some further micro-optimizations for the libllvm and lldb build. 2016-09-04 16:54:55 +00:00
Bruce Evans
f776d19f07 Oops, the previous i386 version of e_fmodf.S and e_fmodl.S was
actually the amd64 version.
2016-09-04 15:08:14 +00:00
Bruce Evans
5432c3bec3 Disconnect the "optimized" asm variants of cos(), sin() and tan() from
the build on i386.  Leave them in the source tree for regression tests.

The asm functions were always much less accurate (by a factor of more
than 10**18 in the worst case).  They were faster on old CPUs.  But
with each new generation of CPUs they get relatively slower.  The
double precision C version's average advantage is about a factor of 2
on Haswell.

The asm functions were already intentionally avoided in float and long
double precision on i386 and in all precisions on amd64.  Float
precision and amd64 give larger advantages to the C version.  The long
double precision C code and compilers' understanding of long double
precision are not so good, so the i387 is still slightly faster for
long double precision, except for the unimportant subcase of huge args
where the sub-optimal C code now somehow beats the i387 by about a
factor of 2.
2016-09-04 14:12:19 +00:00