Commit Graph

19268 Commits

Author SHA1 Message Date
Eric van Gyzen
9121aedd2f Fix formatting of _umtx_op(2)
Do not use macros in the -width of a .Bl, since mandoc does not support them.

Fix issues reported by igor and mandoc -Tlint.

Use a .Bl for list of clock IDs instead of a comma list.

MFC after:	3 days
Sponsored by:	Dell EMC
2017-11-13 17:46:38 +00:00
Warner Losh
50a717a67b Add notes about overlapping copies.
Add notes to each of these that specifically state that results are
undefined if the strings overlap. In the case of memcpy, we document
the overlapping behavior on FreeBSD (pre-existing). For str*, it is
left unspecified, however, since the default (and x86) implementations
do not handle overlapping strings properly.

PR: 223653
Sponsored by: Netflix
2017-11-13 17:04:44 +00:00
Mariusz Zaborski
7b4fce76cc Introduce syslog service for Casper.
syslog in libc secretly reconnects to the daemon.
Another issue is that we don't have any information from openlog(3) if we
succeeded to open log or not so we don't know if we are ready
to enter cabability mode.
Because all of that we decided we need a syslog service for Caspser.

Reviewed by:	bapt@
Differential Revision:	https://reviews.freebsd.org/D12824
2017-11-12 08:34:25 +00:00
Mariusz Zaborski
8751b03b19 We return a pointer when we are using cap_init() or cap_service_open()
function, so check if cap_chanel_t is NULL is not enough.
Casper with a normal libc will still fail in capability mote so let's not
enter capability mode without casper support when we need to resolve DNS.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D12823
2017-11-12 07:18:10 +00:00
Will Andrews
ec8659b385 libkvm: fix lib32 build. 2017-11-12 03:28:47 +00:00
Will Andrews
8baaf913be libkvm: fix build failures 2017-11-12 01:36:48 +00:00
Will Andrews
2aa6a4f3c8 libkvm: fix 'index' shadowing. 2017-11-12 00:00:38 +00:00
Will Andrews
c9057838be libkvm: add kvm_walk_pages API.
This API allows callers to enumerate all known pages, including any
direct map & kernel map virtual addresses, physical addresses, size,
offset into the core, & protection configured.

For architectures that support direct map addresses, also generate pages
for any direct map only addresses that are not associated with kernel
map addresses.

Fix page size portability issue left behind from previous kvm page table
lookup interface.

Reviewed by:	jhb
Sponsored by:	Backtrace I/O
Differential Revision:	https://reviews.freebsd.org/D12279
2017-11-11 23:30:58 +00:00
Baptiste Daroussin
b903189b6c Fix some nroff style issue
MFC after:	3 days
2017-11-11 14:39:13 +00:00
Baptiste Daroussin
04ac1c64fe Follow up on zstd update 2017-11-11 13:57:30 +00:00
Warner Losh
831bec1163 Simplify the efivar interface a little.
We started out having Linux compatible libefivar interfaces. This was
in anticipation of porting the GPL'd efibootmgr to FreeBSD via a
port. However, since we need that functionality in the base, that port
isn't going to happened. It also appears that efivar is a private
library that's not used much outside a command line util and
efibootmgr. Reduce compatibility with the Linux version a little by
removing the mode parameter to efi_set_variable (which was unused on
FreeBSD, and not set to something useful in the code we'd
written). Also remove some efi error routines that were never
implemented and existed only to placate early GPL efibootmgr porting
experiments.

Suggested by: Matt Williams
Sponsored by: Netflix
2017-11-10 23:30:23 +00:00
Bryan Drewery
ddf95e2ae8 Tell bsd.dep.mk which depend files to dinclude.
This allows the _SKIP_DEPEND optimization to work, avoiding reading
the files when not needed.  It also fixes META_MODE incorrectly
reading these files when not needed.

Sponsored by:	Dell EMC Isilon
2017-11-10 20:09:15 +00:00
Alexander Motin
898300ee11 s/NgSendMsgReply/NgSendReplyMsg/ in man to match the code.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2017-11-08 12:34:47 +00:00
Glen Barber
0ff7d32714 Fix the 'casper' package, following r325062.
Submitted by:	woodsb02
Sponsored by:	The FreeBSD Foundation
2017-11-08 01:00:59 +00:00
John Baldwin
2b6e6d8500 Wrap to 80 columns. No functional change. 2017-11-07 17:45:39 +00:00
Bartek Rutkowski
cee09850f7 Make sysctl_kern_proc_umask execute fast path when requested pid in
curproc->p_pid or 0, avoiding unnecessary locking. Update libc consumer
to skip calling getpid().

Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Reviewed by:	mjg, robak
Approved by:	mjg
Sponsored by:	Mysterious Code Ltd.
Differential Revision:	D12972
2017-11-07 15:13:32 +00:00
Warner Losh
25dfe63ccb Use MACHINE_CPUARCH in preference MACHINE for userland.
Sponsored by: Netflix
2017-11-07 09:57:26 +00:00
Warner Losh
8f3b60c5f1 Correct the detection of hard float arm
* Don't test MACHINE, it's irrelevant to userland and should never be
  used in userland Makefiles.
* If we match armv[67] and CPUTYPE is undefined OR it doesn't have
  'soft' in it, choose armhf.
* Add a note that the soft float on armv[67] may be broken.

Sponsored by: Netflix
2017-11-07 09:47:05 +00:00
Enji Cooper
d61b3d7a72 Redo r325502
:U:Mfoo expands to :Mfoo, apparently. Explicit check for CPUTYPE being
defined, and test for it's value not containing *soft* before calling CRTARCH
armhf.

Tested, somewhat. Unfortunately recent changes appear to have affected
cross-builds where it no longer works, per my tests after universe12a being
upgraded from 07/2017 to 11/2017 sources (DESTDIR isn't being used in WORLDTMP;
MK_SYSTEM_COMPILER might be causing issues right now).

MFC after:	1 week
MFC with:	r325502
Reported by:	imp
2017-11-07 06:26:48 +00:00
Enji Cooper
c03bb93303 Handle arm/armv[67] hosted/targeted builds gracefully
CPUTYPE (apparently) isn't defined in non-cross-builds, which caused
arm/armv[67] hosted/targeted builds to fail when evaluating CPUTYPE.

Add the :U modifier to CPUTYPE so it evaluates to "". This allows armv[67] to
get past the conditional successfully.

MFC after:	1 week
Reported by:	bob prohaska <fbsd@www.zefox.net>
2017-11-07 05:02:36 +00:00
Enji Cooper
5252514fb4 Remove unnecessary src.opts.mk .include
MK_<FOO> isn't used in lib/libcompiler_rt/Makefile at all. Remove it to reduce
namespace pollution.

MFC after:	1 week
2017-11-07 04:56:53 +00:00
Enji Cooper
a2a142486a Use bsd.compiler.mk instead of src.opts.mk
- MK_PROFILE is controlled in bsd.opts.mk, which is pulled in via bsd.own.mk,
  which is pulled in via bsd.init.mk . All upstream Makefiles which build off
  of this one use bsd.init.mk.
- COMPILER_{TYPE,VERSION} is set via bsd.compiler.mk .

This reduces the namespace pollution/complexity somewhat.

MFC after:	1 week
2017-11-07 04:55:23 +00:00
Enji Cooper
792bc22266 Choose a simpler, more philosophically correct version for CRTARCH with armv[67]
This is a rework of r325443.

PR:		222925
Tested with:	make buildenv with appropriate TARGET/TARGET_ARCH pairs
2017-11-05 20:38:40 +00:00
Enji Cooper
c9c9774c70 Revert r325443
Despite the fact that it's a working solution, it doesn't follow the design
philosophy of only doing TARGET_* in Makefile.inc1 and special locations in
the source tree.

PR:		222925
Requested by:	imp
2017-11-05 20:01:00 +00:00
Enji Cooper
571e134eea Fix paths for cross-built versions of lib/libclang_rt and hardfloat arm variants
- Define TARGET_CPUARCH and use in libclang_rt as the basis for CRTARCH

  When cross-compiling, the wrong architecture was being embedded in the
  libclang_rt binary filenames. It should be based on TARGET_ARCH (target), not
  MACHINE_ARCH (host).

  If TARGET_ARCH isn't defined (host-builds), fallback to MACHINE_ARCH.

- Define CRTARCH to armhf when TARGET/TARGET_ARCH are set to arm/armv[67]

  TARGET_ABI/TARGET_CPU in Makefile.inc1 sets the ABI to gnueabihf, which
  affects the clang lookup path per `getArchNameForCompilerRTLib(..)` in
  contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp, so chase clang and
  Linux's assumed naming convention for hard-float arm architectures.

  CROSSENV (in Makefile.inc1) sets CPUTYPE/MACHINE(_ARCH)? to the
  TARGET*-relevant values when building the `libraries` target, so test
  those variables instead.

- Add OLD_FILES/OLD_LIBS entries for TARGET/TARGET_ARCH == arm/armv[67]. This
  impacts only arm/armv6 and arm/armv7.

PR:	222925
2017-11-05 19:38:51 +00:00
Enji Cooper
a060f1416a Support compiling lib/libclang_rt/profile a bit more with recent versions of gcc
Several of the flags were being treated as CFLAGS, when they were actually
technically CXXFLAGS. Move them there.

Only apply -fno-sanitize=safe-stack with clang.

PR:             223179
2017-11-05 19:25:06 +00:00
Benedict Reuschling
18b80db55f The last example used LOG_INFO, but the message itself said error.
Change to LOG_ERR to be less confusing.

PR:			216756
Submitted by:		Thomas Cort (linuxgeek@gmail.com)
Reviewed by:		noone (after 2 months)
Differential Revision:	https://reviews.freebsd.org/D11824
2017-11-05 18:24:31 +00:00
Enji Cooper
600da319ad Simplify r325427
CROSSENV (in Makefile.inc1) sets CPUTYPE/MACHINE(_ARCH)? to the
TARGET*-relevant values when building the `libraries` target.

PR:	222925
2017-11-05 07:48:40 +00:00
Enji Cooper
7efeac5c18 Define CRTARCH to armhf when TARGET/TARGET_ARCH are set to arm/armv[67]
TARGET_ABI/TARGET_CPU in Makefile.inc1 sets the ABI to gnueabihf, which affects
the clang lookup path per getArchNameForCompilerRTLib(..) in
contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp .

This is a follow up to r324873.

PR:		222925
2017-11-05 07:36:11 +00:00
Enji Cooper
254d2760ce MFhead@r325422 2017-11-05 04:08:00 +00:00
Ed Maste
8ca8d252bb posix_fallocate.2: add an EINVAL errno case
As of r325320 posix_fallocate returns EINVAL on ZFS to indicate that
the underlying filesystem does not support this operation, per
POSIX.1-2008. Document this case in the man page.

MFC after:	20 days
MFC with:	r325320
Sponsored by:	The FreeBSD Foundation
2017-11-05 03:02:19 +00:00
Mariusz Zaborski
0dfac7ee08 The src.opts.mk sets default value for the SHLIBDIR, so our set was not
respected.

Please notice that libcasper is already in ObsoleteFiles so we don't add it
again.

Reported by:	Herbert J. Skuhra <herbert@mailbox.org>
Reviewed by:	bdrewery@
Differential Revision:	https://reviews.freebsd.org/D12918
2017-11-04 15:50:05 +00:00
Mariusz Zaborski
95844abe53 Casper work's only as shared library - disable building static ones.
Reviewed by:	bdrewery@
Differential Revision:	https://reviews.freebsd.org/D12917
2017-11-04 15:47:18 +00:00
Konstantin Belousov
6a96a39c77 C++17 requires quick_exit(3) to be async-signal safe.
Make it safe, and update man page with the useful information.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-11-04 10:52:58 +00:00
Enji Cooper
f6e116eea9 MFhead@r325383 2017-11-04 07:05:21 +00:00
Kenneth D. Merry
70a8349311 Add the LTO-8 Type M density code (0x5d, LTO-8M) to libmt and the
mt(1) man page.

LTO-8 Type M (also known as M8) is a pristine LTO-7 cartridge
formatted in a LTO-8 drive in a new, higher density format.  It
has a separate density code, and is only readable in an LTO-8
drive.

lib/libmt/mtlib.c:
	Add the LTO-8 Type M density code to the density table
	in libmt.

usr.bin/mt/mt.1:
	Add the LTO-8 Type M density code to the density
	table in the mt(1) man page.

MFC after:	3 days
Sponsored by:	Spectra Logic
2017-11-03 21:04:22 +00:00
Michal Meloun
8584ed54ab Add alignment support to __libc_allocate_tls().
For statically linked binaries, where all relocation are solved by static
linker, the linker expect that offset to TLS section is aligned. Additionaly,
to maintain absolute alignment, TLS TCB should by also aligned.

Obtained from:	CheriBSD (initial version)
MFC after:	1 month
Reviewed by:	brooks (previous version), kib
Differential Revision:	https://reviews.freebsd.org/D12907
2017-11-03 15:57:27 +00:00
Cy Schubert
aee1526ce7 While discussing the new gets_s.c in D12785, ed@ suggested putting
{}'s around the if (c == EOF) block to prevent potential 'trailing else'
issues from being introduced when refactoring. As my gets_s() code
is based on this, it makes sense to fix the same issue here first
here and now, then do an svn copy again to capture this history).

Suggested by:	ed@ in D12785
2017-11-03 13:08:29 +00:00
Alex Richardson
8974782e89 Export std::get_new_handler() from libcxxrt.so
When trying to build world for MIPS64 with clang I was getting
linker errors because of a missing reference to std::get_new_handler().
It turns out std::get_new_handler() was not listed in Version.map so it was
marked as a local symbol in libcxxrt.so.

Reviewed by:	theraven, brooks (mentor), emaste
Approved by:	trasz
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D11925
2017-11-03 12:52:59 +00:00
Bryan Drewery
939d033cab Disconnect libpathconv tests since they require external perl and do not work with kyua.
This reverts r325192 and is due to libpathconv being connected in r325186.

Reported by:	ngie
Sponsored by:	Dell EMC Isilon
2017-10-31 19:52:30 +00:00
Enji Cooper
0821ef1af8 MFhead@r325209 2017-10-31 04:12:48 +00:00
Enji Cooper
ca28b8ee5b Add static to cap_setgrent prototype in !WITH_CASPER case
This unbreaks the default powerpc/sparc64 build configuration after r325062.
2017-10-31 04:02:50 +00:00
Enji Cooper
076777cc29 MFhead@r325199 2017-10-31 02:46:36 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Bryan Drewery
3806950135 DIRDEPS_BUILD: Connect new directories.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:04:07 +00:00
Bryan Drewery
82fcadcd55 Connect libpathconv, disconnected since import in r309035.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:03:52 +00:00
Bryan Drewery
a160cbfa07 DIRDEPS_BUILD: libgcc now depends on MK_LLVM_LIBUNWIND
The dependency on gnu/lib/libgcc or lib/libgcc* is determined
at 'make dirdeps' time.

Sponsored by:	Dell EMC Isilon
2017-10-31 00:03:36 +00:00
Enji Cooper
ae1a42beff Revert r325128; would break buildworld without TARGET_ARCH 2017-10-30 08:23:48 +00:00
Enji Cooper
ebcaa90545 Don't try overriding TARGET_ARCH from llvm.build.mk; rely on sys.mk's definition 2017-10-30 08:19:27 +00:00
Enji Cooper
3c5ab8c1cc MFhead@r325119 2017-10-30 05:52:26 +00:00
Michal Meloun
f879eb0488 Fix misleading comment.
Not a functional change.

MFC after:	3 days
2017-10-29 14:26:37 +00:00
Mariusz Zaborski
c19b1a6a08 Fix information about nv.h include.
MFC after:	1 week
2017-10-29 09:50:20 +00:00
Eitan Adler
a2aef24aa3 Update several more URLs
- Primarily http -> https
- Primarily FreeBSD project URLs
2017-10-29 08:17:03 +00:00
Pedro F. Giffuni
0f23ab8aac Fix out-of-bounds read in libc/regex.
The bug is an out-of-bounds read detected with address sanitizer that
happens when 'sp' in p_b_coll_elems() includes NUL byte[s], e.g. if it's
equal to "GS\x00". In that case len will be equal to 4, and the
strncmp(cp->name, sp, len) call will succeed when cp->name is "GS" but the
cp->name[len] == '\0' comparison will cause the read to go out-of-bounds.

Checking the length using strlen() instead eliminates the issue.

The bug was found in LLVM with oss-fuzz:
	https://reviews.llvm.org/D39380

MFC after:	1 week
Obtained from:	Vlad Tsyrklevich through posting on openbsd-tech
2017-10-28 20:09:34 +00:00
Mariusz Zaborski
ceb36bc93a Introduce caspermocks.
The idea behinds mocks is that we don't need to ifdef a lot of code in
tools itself but those defines are hidden in the casper library.
Right now the mocks are implemented as define/inlines functions.
There was a very long discussion how this should be implemented.
This approach has some advantages like we don't need to link to any additional
libraries. Unfortunately there are also some disadvantages for example it is
easy to get library out of sync between two versions of functions or that we
need extra define to compile program with casper support.
This isn't an ideal solution but it's good enough for now and should simplify
capsicumizing programs. This also doesn't close us any other ways to do those
mocks and this should evolve in time.

Discussed with:	pjd, emaste, ed, rwatson, bapt, cem, bdrewery
Differential Revision:    https://reviews.freebsd.org/D8753
2017-10-28 19:23:57 +00:00
Cy Schubert
e223d957c3 Revert r325031. This breaks the build due to __FBSDID.
Pointy hat to:	cy
2017-10-27 05:04:29 +00:00
Cy Schubert
d022f5de53 Ensure all incude statements are kept together by moving the
sys/cdefs.h include appropriately.

MFC after:	1 week
X-MFC with:	r325030
2017-10-27 04:51:05 +00:00
Cy Schubert
d3add8e174 Remove redundant sys/cdefs.h include.
MFC after:	1 week
2017-10-27 04:47:44 +00:00
Alan Somers
33d9904abc Partially revert r325011: restore Guid's default constructor
Reported by:	ohartmann
MFC after:	3 weeks
X-MFC-With:	325011
Sponsored by:	Spectra Logic Corp
2017-10-26 17:56:34 +00:00
Alan Somers
12a88a3d63 zfsd should be able to online an L2ARC that disappears and returns
Previously, this didn't work because L2ARC devices' labels don't contain
pool GUIDs.  Modify zfsd so that the pool GUID won't be required:

lib/libdevdctl/guid.h
	Change INVALID_GUID from a uint64_t constant to a function that
	returns an invalid Guid object.  Remove the void constructor.
	Nothing uses it, and it violates RAII.

cddl/usr.sbin/zfsd/case_file.h
cddl/usr.sbin/zfsd/case_file.cc
	Allow CaseFile::Find to match a CaseFile based on Vdev GUID alone.
	In CaseFile::ReEvaluate, attempt to online devices even if the newly
	arrived device has no pool GUID.

cddl/usr.sbin/zfsd/vdev_iterator.cc
	Iterate through a pool's cache devices as well as its regular
	devices.

Reported by:	avg
Reviewed by:	avg
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D12791
2017-10-26 15:28:18 +00:00
Dag-Erling Smørgrav
79b67c8d4a If the user-provided password exceeds the maximum password length, don't
bother passing it to crypt().  It won't succeed and may allow an attacker
to confirm that the user exists.

Reported by:	jkim@
MFC after:	1 week
Security:	CVE-2016-6210
2017-10-26 13:23:13 +00:00
Enji Cooper
5ff880dc0f MFhead@r325004 2017-10-26 03:34:17 +00:00
Bryan Drewery
59696d216c Prefix {TARGET,BUILD}_TRIPLE with LLVM_ to avoid Makefile.inc1 collision.
The Makefile.inc1 TARGET_TRIPLE is for specifying which -target is used
during the build of world.

MFC after:	2 weeks
Reviewed by:	dim, imp
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12792
2017-10-25 21:45:55 +00:00
Warner Losh
dae8f61f5b RB_POWERCYCLE needs to be handled like RB_POWEROFF for decoding.
Sponsored by: Netflix
2017-10-25 15:30:25 +00:00
Warner Losh
06828ffb88 Define RB_POWERCYCLE
RB_POWERCYCLE instructs the platform to power off and then power back
on a short time later, if that's possible. Otherwise, degrade to the
RB_POWEROFF behavior.

Sponsored by: Netflix
2017-10-25 15:30:20 +00:00
Ruslan Bukin
d27927f731 Extract a set of pmcstat functions and interfaces to the new internal
library -- libpmcstat.

This includes PMC logging module, symbols lookup functions,
ELF parsing, process management, PMC attachment, etc.

This allows to reuse code while building new hwpmc(4)-based applications.

Also add pmcstat_symbol_search_by_name() function that allows to find
mapped IP range for a given function name.

Reviewed by:	kib
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12718
2017-10-24 16:28:00 +00:00
Alan Somers
42b22a3e74 Bump man page revision dates for r324941
Reported by:	jhb
MFC after:	20 days
X-MFC-with:	324941
Sponsored by:	Spectra Logic Corp
2017-10-24 14:34:25 +00:00
Alan Somers
913b932900 Remove artificial restriction on lio_listio's operation count
In r322258 I made p1003_1b.aio_listio_max a tunable. However, further
investigation shows that there was never any good reason for that limit to
exist in the first place. It's used in two completely different ways:

* To size a UMA zone, which globally limits the number of concurrent
  aio_suspend calls.

* To artifically limit the number of operations in a single lio_listio call.
  There doesn't seem to be any memory allocation associated with this limit.

This change does two things:

* Properly names aio_suspend's UMA zone, and sizes it based on a new constant.

* Eliminates the artifical restriction on lio_listio. Instead, lio_listio
  calls will now be limited by the more generous max_aio_queue_per_proc. The
  old p1003_1b.aio_listio_max is now an alias for
  vfs.aio.max_aio_queue_per_proc, so sysconf(3) will still work with
  _SC_AIO_LISTIO_MAX.

Reported by:	bde
Reviewed by:	jhb
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D12120
2017-10-23 23:12:01 +00:00
Enji Cooper
fcc46733b3 Clean up trailing whitespace
MFC after:	1 week
2017-10-23 16:55:22 +00:00
Enji Cooper
df6a67d624 Remove dead stores
The return value of various snprintf calls was stored in `len` and not used
in many functions.

MFC after:	1 week
Reported by:	clang-scanbuild
2017-10-23 16:54:30 +00:00
Enji Cooper
0db4d62fc0 -fvisibility is a c++ thing, per gcc(1)
Followup to r324894

PR:	223179
2017-10-23 05:11:00 +00:00
Enji Cooper
7cb2c97507 This shouldn't be required either 2017-10-23 04:44:35 +00:00
Enji Cooper
19aa52065a Diff reduce with ^/head
This doesn't seem to be necessary after the changes to only apply --coverage
to shared objects.

We'll see if it works with make tinderbox.
2017-10-23 04:42:57 +00:00
Enji Cooper
c547fc0ffc Support compiling lib/libclang_rt/profile with gcc
Several of the flags were being treated as CFLAGS, when they were actually
technically CXXFLAGS. Move them there.

Also, only apply -fno-sanitize=safe-stack with clang.

This is a draft diff.

PR:		223179
2017-10-23 04:22:17 +00:00
Enji Cooper
dd467c8ac1 MFhead@r324884 2017-10-22 23:40:49 +00:00
Enji Cooper
69735ece08 Define TARGET_CPUARCH and use in libclang_rt as the basis for CRTARCH
When cross-compiling, the wrong architecture was being embedded in the
libclang_rt binary filenames. It should be based on TARGET_ARCH (target), not
MACHINE_ARCH (host).

This is a draft commit against my project branch. Will fix on ^/head soon.

PR:	222925
2017-10-22 21:34:37 +00:00
Edward Tomasz Napierala
be7d4ac586 Add OID for the vm.overcommit sysctl. This makes it possible to remove
one call to sysctl(2) from jemalloc startup code. (That also requires
changes to jemalloc, but I plan to push those to upstream first.)

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12745
2017-10-22 10:35:29 +00:00
Enji Cooper
0a8f81bc28 MFhead@r324837
While here, diff reduce some of the changes in sys/boot by moving
MK_COVERAGE=no to sys/boot/Makefile.inc .
2017-10-21 23:40:52 +00:00
Dimitry Andric
fc203cd43e After the import of libc++ 5.0.0, there is no need to disable building
libc++experimental.a on arm (r318654) and mips (r318859) anymore, since
upstream fixed the static assertions which would occur.

Noticed by:	George Abdelmalik <gabdelmalik@uniridge.com.au>
PR:		223119
MFC after:	3 days
2017-10-21 18:21:44 +00:00
Michal Meloun
0b08ae2120 Make elf_aux_info() as public libc function.
- Teach elf aux vector functions about newly added AT_HWCAP and AT_HWCAP2
  vectors.
- Export _elf_aux_info() as new public libc function elf_aux_info(3)

The elf_aux_info(3) should be considered as FreeBSD counterpart of glibc
getauxval() with more robust interface.

Note:
We cannot name this new function as getauxval(), with glibc compatible
interface. Some ports autodetect its existence and then expects that all
Linux specific AT_<*> vectors are defined and implemented.

MFC after:	1 month
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D12743
2017-10-21 12:06:18 +00:00
Ed Maste
31a4787b80 write.2: correct maximum nbytes size for EINVAL error
In FreeBSD 11 and later debug.iosize_max_clamp defaults to 0, and the
maximum nbytes count for write(2) is SSIZE_MAX. Update the man page to
document this, and mention the sysctl that can be set to obtain the
previous behaviour.

PR:		196666
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2017-10-17 02:51:45 +00:00
Romain Tartière
3f7047aeeb Add a quick description of the geom_getxml(3), geom_xml2tree(3),
geom_gettree(3) and geom_deletetree(3) functions provided by libgeom and are
not documented in libgeom(3).

Reviewed by:	mav, bjk, allanjude
Approved by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D12679
2017-10-16 17:21:52 +00:00
Michal Meloun
a86d798210 Save VFP state in getcontext(3) on ARM.
This is a last followup of r315974, which fixes userland part
of VFP save/restore problems described in PR 217611.

PR:		217611
MFC after:	2 weeks
2017-10-16 12:53:54 +00:00
Andriy Voskoboinyk
c2803f1a04 libifconfig: allow to get original interface name via ifconfig_get_orig_name()
Uses the same method as in tools/tools/ifinfo/ifinfo.c
(via net.link.generic sysctl).

Tested with modified wlandebug(8).

Differential Revision:	https://reviews.freebsd.org/D12554
2017-10-16 06:54:26 +00:00
Ed Maste
5532aa9bb4 allow posix_fallocate in capability mode
posix_fallocate is logically equivalent to writing zero blocks to the
desired file size and there is no reason to prevent calling it in
capability mode. posix_fallocate already checked for the CAP_WRITE
right, so we merely need to list it in capabilities.conf.

Reviewed by:	allanjude
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12640
2017-10-12 15:45:53 +00:00
Warner Losh
4eb1313ff2 Move lib/libstand to sys/boot/libsa
Move the sources to sys/boot. Make adjustments related to the
move. Kill LIBSTAND_SRC since it's no longer needed.

Sponsored by: Netflix
2017-10-12 14:56:28 +00:00
Warner Losh
93f4c41f28 Add $FreeBSD$ to ancient sources that it's missing from.
Sponsored by: Netflix
2017-10-12 14:53:25 +00:00
Enji Cooper
50896984cd MFhead@r324482 2017-10-10 06:26:12 +00:00
Warner Losh
c8550231ef Disconnect libstand from the build.
Remove libstand from the src/lib build. Remove LIBSTAND from
bsd.libnames.mk. Add affected files to the obsolete files list.

Sponsored by: Netflix
2017-10-09 22:12:57 +00:00
Edward Tomasz Napierala
131e8e0289 capsicum_helpers: Add EVENT to default stdio rights set
Without it, calling caph_limit_stdio(3) breaks Irssi.

Reviewed by:	oshogbo
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12622
2017-10-08 17:29:43 +00:00
Warner Losh
0b972ac92e Support armv7 builds for userland
Make armv7 as a new MACHINE_ARCH.

Copy all the places we do armv6 and add armv7 as basically an
alias. clang appears to generate code for armv7 by default. armv7 hard
float isn't supported by the the in-tree gcc, so it hasn't been
updated to have a new default.

Support armv7 as a new valid MACHINE_ARCH (and by extension
TARGET_ARCH).

Add armv7 to the universe build.

Differential Revision: https://reviews.freebsd.org/D12010
2017-10-05 23:01:33 +00:00
Hans Petter Selasky
9f16d9c95b Add support for new cuse(3) error code, CUSE_ERR_NO_DEVICE.
This error code is useful when emulating Linux input event
devices from userspace.

PR:			218626
Submitted by:		jan.kokemueller@gmail.com
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-10-05 16:42:02 +00:00
Benjamin Kaduk
75ea0b7697 mdoc style: start new sentence on new line 2017-10-04 12:58:30 +00:00
Cy Schubert
9eba44bf46 Fix typo.
Reported by:	se
2017-10-04 09:54:59 +00:00
Cy Schubert
b1b1386ff4 Clarify the wording describing the stayopen flag.
MFC after:	1 week
2017-10-04 06:06:22 +00:00
Brooks Davis
5e12225140 Remove an unneeded and incorrect memset().
On Variant I TLS architectures (aarch64, arm, mips, powerpc, and riscv)
the __libc_allocate_tls function allocates thread local storage memory
with calloc(). It then copies initialization data over the portions with
non-zero initial values. Before this change it would then pointlessly
zero the already zeroed remainder of the storage. Unfortunately the
calculation was wrong and it would zero TLS_TCB_SIZE (2*sizeof(void *))
additional bytes.

In practice, this overflow only matters if the TLS segment is sized such
that calloc() allocates a less than TLS_TCB_SIZE extra memory. Even
then, the likely result will be zeroing part of the next bucket. This
coupled with the impact being confined to Tier II platforms means there
will be no security advisory for this issue.

Reviewed by:	kib, dfr
Discussed with:	security-officer (delphij)
MFC after:	1 week
Found by:	CHERI
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12547
2017-10-03 22:57:19 +00:00
Edward Tomasz Napierala
3cfa7c6e48 Make procstat(1) recognize process descriptors, so that it shows
"P" instead of "?" in "procstat -af" output. Note that there are
still a few more DTYPE_* kinds we don't decode yet.

Reported by:	rwatson
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12426
2017-10-03 11:45:24 +00:00
Ruslan Ermilov
a470b2750f Fixed description of msg_name/msg_namelen in recvmsg(). 2017-10-03 11:13:25 +00:00
Gleb Smirnoff
0e229f343f Hide struct socket and struct unpcb from the userland.
Violators may define _WANT_SOCKET and _WANT_UNPCB respectively and
are not guaranteed for stability of the structures.  The violators
list is the the usual one: libprocstat(3) and netstat(1) internally
and lsof in ports.

In struct xunpcb remove the inclusion of kernel structure and add
a bunch of spare fields.  The xsocket already has socket not included,
but add there spares as well.  Embed xsockbuf into xsocket.

Sort declarations in sys/socketvar.h to separate kernel only from
userland available ones.

PR:		221820 (exp-run)
2017-10-02 23:29:56 +00:00
Michael Zhilin
37a6f46190 [libthr] revert change of visibility of _thread_keytable to unbreak debugger
Fix regression by r318539. The sysutils/pstack uses library libthread_db to
read information about threads state. The function pt_ta_new makes lookup of
several key symbols including _thread_keytable. But r318539 mades this field
static. It causes silent ignore of libthr library by pstack and as result
sysutils/pstack doesn't output any thread information.

This fix changes this field back to non-static.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D11738
2017-10-02 20:33:16 +00:00
Enji Cooper
d5db4328ad MFhead@r324148 2017-10-01 02:28:16 +00:00
Martin Matuska
5c831a5bd6 MFV r324145,324147:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #905: Support for Zstandard read and write filters
  PR #922: Avoid overflow when reading corrupt cpio archive
  Issue #935: heap-based buffer overflow in xml_data (CVE-2017-14166)
  OSS-Fuzz 2936: Place a limit on the mtree line length
  OSS-Fuzz 2394: Ensure that the ZIP AES extension header is large enough
  OSS-Fuzz 573: Read off-by-one error in RAR archives (CVE-2017-14502)

MFC after:	1 week
Security:	CVE-2017-14166, CVE-2017-14502
2017-10-01 00:40:23 +00:00
Bryan Drewery
dc8507e1f7 __setrunelocale: Fix asprintf(3) failure not returning an error.
Also fix the style of the asprintf(3) call in __collate_load_tables_l().
Both of these lines were modified away from snprintf(3) during the
import from DragonFly/Illumos.

Reviewed by:	jilles (briefly over shoulder)
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-09-29 16:30:50 +00:00
Enji Cooper
d2549a448d MFhead@r324075 2017-09-28 05:20:37 +00:00
Conrad Meyer
35362d660f capsicum_helpers: Add SEEK to default stdio rights set
PR:		219173
Sponsored by:	Dell EMC Isilon
2017-09-25 19:33:32 +00:00
Enji Cooper
e5d34ca9fd MFhead@r320180 2017-09-23 18:37:37 +00:00
Kirk McKusick
75e3597abb Continuing efforts to provide hardening of FFS, this change adds a
check hash to cylinder groups. If a check hash fails when a cylinder
group is read, no further allocations are attempted in that cylinder
group until it has been fixed by fsck. This avoids a class of
filesystem panics related to corrupted cylinder group maps. The
hash is done using crc32c.

Check hases are added only to UFS2 and not to UFS1 as UFS1 is primarily
used in embedded systems with small memories and low-powered processors
which need as light-weight a filesystem as possible.

Specifics of the changes:

sys/sys/buf.h:
    Add BX_FSPRIV to reserve a set of eight b_xflags that may be used
    by individual filesystems for their own purpose. Their specific
    definitions are found in the header files for each filesystem
    that uses them. Also add fields to struct buf as noted below.

sys/kern/vfs_bio.c:
    It is only necessary to compute a check hash for a cylinder
    group when it is actually read from disk. When calling bread,
    you do not know whether the buffer was found in the cache or
    read. So a new flag (GB_CKHASH) and a pointer to a function to
    perform the hash has been added to breadn_flags to say that the
    function should be called to calculate a hash if the data has
    been read. The check hash is placed in b_ckhash and the B_CKHASH
    flag is set to indicate that a read was done and a check hash
    calculated. Though a rather elaborate mechanism, it should
    also work for check hashing other metadata in the future. A
    kernel internal API change was to change breada into a static
    fucntion and add flags and a function pointer to a check-hash
    function.

sys/ufs/ffs/fs.h:
    Add flags for types of check hashes; stored in a new word in the
    superblock. Define corresponding BX_ flags for the different types
    of check hashes. Add a check hash word in the cylinder group.

sys/ufs/ffs/ffs_alloc.c:
    In ffs_getcg do the dance with breadn_flags to get a check hash and
    if one is provided, check it.

sys/ufs/ffs/ffs_vfsops.c:
    Copy across the BX_FFSTYPES flags in background writes.
    Update the check hash when writing out buffers that need them.

sys/ufs/ffs/ffs_snapshot.c:
    Recompute check hash when updating snapshot cylinder groups.

sys/libkern/crc32.c:
lib/libufs/Makefile:
lib/libufs/libufs.h:
lib/libufs/cgroup.c:
    Include libkern/crc32.c in libufs and use it to compute check
    hashes when updating cylinder groups.

Four utilities are affected:

sbin/newfs/mkfs.c:
    Add the check hashes when building the cylinder groups.

sbin/fsck_ffs/fsck.h:
sbin/fsck_ffs/fsutil.c:
    Verify and update check hashes when checking and writing cylinder groups.

sbin/fsck_ffs/pass5.c:
    Offer to add check hashes to existing filesystems.
    Precompute check hashes when rebuilding cylinder group
    (although this will be done when it is written in fsutil.c
    it is necessary to do it early before comparing with the old
    cylinder group)

sbin/dumpfs/dumpfs.c
    Print out the new check hash flag(s)

sbin/fsdb/Makefile:
    Needs to add libufs now used by pass5.c imported from fsck_ffs.

Reviewed by: kib
Tested by: Peter Holm (pho)
2017-09-22 12:45:15 +00:00
Mariusz Zaborski
08016b3185 Remove redundant initialization. Don't use variable - just return the value.
Make scan-build happy by casting to 'void *' instead of 'void **'.

Submitted by:	pjd@
MFC after:	1 month
Found by:	scan-build and cppcheck
Sponsored by:	Wheel Systems
2017-09-21 10:00:16 +00:00
Gordon Tetlow
40427cca7a MFV r323678: file 5.32
Approved by:	emaste (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D12400
2017-09-17 19:14:38 +00:00
Ed Maste
c9c69ebad7 libsysdecode: report invalid cap_rights_t
Previously we'd have an assertion failure in cap_rights_is_set if
sysdecode_cap_rights is called with an invalid cap_rights_t, so test for
validity first.

PR:		222258
Reviewed by:	cem
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12391
2017-09-17 14:03:54 +00:00
Ed Maste
13f2a57b0e rename(2): document capability mode errors
Reviewed by:	allanjude
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12339
2017-09-15 20:12:38 +00:00
Ed Maste
487214afa5 open(2): update ENOTCAPABLE description for .. lookups
After r308212 Capsicum permits .. lookups in capability mode, as long as
path component traversal does not escape the directory corresponding to
the provided file descriptor.

We should add a description of the vfs.lookup_cap_dotdot and
vfs.lookup_cap_dotdot_nonlocal sysctls, perhaps as a cross-reference to
capsicum(4). I intend to look at that soon.

Reviewed by:	bjk, cem, kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12343
2017-09-15 20:05:55 +00:00
Pedro F. Giffuni
98fa04efed libedit: raise the warning level to 3.
NetBSD has the warning level to 5 but that actually triggers -Wcast-qual.
2017-09-14 19:50:07 +00:00
Konstantin Belousov
587e285e97 Silently handle freeaddrinfo(NULL) for compatibility with code which
works on other OSes.  Also avoid unnecessary NULL check, free(NULL) is
valid.

Reviewed by:	bjk (man page), hrs, hselasky, ume
Sponsored by:	Mellanox Technologies
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D12354
2017-09-14 19:18:24 +00:00
John Baldwin
197e3ae5fc Add ptrace operations to fetch and store VFP registers.
Reviewed by:	mmel, kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D12294
2017-09-14 15:03:43 +00:00
Pedro F. Giffuni
cf7df9f141 libedit: add missing bracket.
We never hit this because we always build with widechar support.

Reported by:	cognet
MFC after:	3 days
2017-09-13 16:13:14 +00:00
Warner Losh
0e5d767884 Minor fixes to edge cases in efi_get_next_variable_name
Fix allocating more memory for the names (unlikely to be needed, but
still best to get right) to ask for the length the kernel told use we
needed, not the old length of the variable. Mind the proper NUL that
we add in the space we allocate. Free the old name string before we
allcoate a new one to limit what we leak to the last one (free passed
in name for the last one in the list), and detect the last one by rv
!= 0 and errno == ENOENT, rather then just the former to avoid false
positives if errno happens to be ENOENT on entry.

Sponsored by: Netflix
2017-09-13 04:32:23 +00:00
Toomas Soome
c7901210fb libstand: tftp_open() can leak pkt on error
The memory can be leaked if we will have pkt set and will get an error
during tftp_open() processing.

Differential Revision:	https://reviews.freebsd.org/D12202
2017-09-12 13:51:18 +00:00
Conrad Meyer
b906c1a02a libgeom: Remove redundant and duplicated code
In g_open(), g_device_path_open().

No functional change.

Sponsored by:	Dell EMC Isilon
2017-09-08 15:44:52 +00:00
David Chisnall
c0cd38223c Document some invariants for the XLC_ enum.
These can't be reordered without breaking other code.  Document that and add
some static asserts to ensure that anyone who tries gets build failures.
2017-09-07 17:51:35 +00:00
Warner Losh
1028a2d4b3 Implement efidp_size
efidp_size will return the size, in bytes, of a EFI device path
structure. This is a convenience wrapper in the same style as the
other linux routines. It's implemented by GetDevicePathSize from EDK2
we already needed for other things.

Sponsored by: Netflix
2017-09-07 07:30:14 +00:00
Dimitry Andric
c891abb2ae Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
5.0.0 release (upstream r312559).

Release notes for llvm, clang and lld will be available here soon:
<http://releases.llvm.org/5.0.0/docs/ReleaseNotes.html>
<http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html>
<http://releases.llvm.org/5.0.0/tools/lld/docs/ReleaseNotes.html>

Relnotes:	yes
MFC after:	1 month
X-MFC-with:	r321369
2017-09-06 21:21:13 +00:00
Dimitry Andric
4bc3002fe0 Vendor import of clang 5.0.0 release r312559:
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_500/final@312559
2017-09-06 20:55:03 +00:00
Dimitry Andric
0bc1bd0d39 Vendor import of llvm 5.0.0 release r312559:
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_500/final@312559
2017-09-06 20:52:23 +00:00
Konstantin Belousov
b99b705d9c Skylake server core PMC support for hwpmc(4).
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Hardware provided by:	Intel
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D12221
2017-09-06 17:19:48 +00:00
Konstantin Belousov
9491ba7593 Minor style changes to make forthcoming code stand out less.
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
X-Differential revision:	https://reviews.freebsd.org/D12221
2017-09-06 17:14:23 +00:00
Mark Johnston
2c73c414eb Avoid keeping a dangling pointer when the mappings array is resized.
Sponsored by:	Dell EMC Isilon
2017-09-06 16:24:34 +00:00
Ryan Libby
92ac7e80da libefivar: -fno-strict-aliasing
Avoid dealing with some code that uses type-punned pointers.

See D12210 and D12211 for more background.

Reviewed by:	imp
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12219
2017-09-04 18:59:44 +00:00
John Baldwin
39a3a4386a Decode pathconf() names, *at() flags, and sysarch() numbers in libsysdecode.
Move tables that were previously in truss over to libsysdecode.  truss
output is unchanged, but kdump has been updated to decode these fields.
In addition, sysdecode_sysarch_number() should support all platforms
whereas the old table in truss only supported x86.
2017-09-04 05:34:36 +00:00
Dimitry Andric
3ea909cc76 Upgrade our copies of clang, llvm, lldb and compiler-rt to r312293 from
the upstream release_50 branch.  This corresponds to 5.0.0 rc4.

As of this version, the cad/stepcode port should now compile in a more
reasonable time on i386 (see bug 221836 for more information).

PR:		221836
MFC after:	2 months
X-MFC-with:	r321369
2017-09-01 18:53:36 +00:00
Toomas Soome
7a42b7f27f libstand: nfs_readlink() should return proper return code
The nfs_readlink() is returning constant 0 instead of variable.

Reviewed by:	avg
Differential Revision:	https://reviews.freebsd.org/D12201
2017-09-01 16:40:12 +00:00
Dimitry Andric
8a86acebf8 Vendor import of libc++ release_50 branch r312293:
https://llvm.org/svn/llvm-project/libcxx/branches/release_50@312293
2017-09-01 16:29:22 +00:00
Dimitry Andric
ef2abedb8a Vendor import of clang release_50 branch r312293:
https://llvm.org/svn/llvm-project/cfe/branches/release_50@312293
2017-09-01 16:29:06 +00:00
Dimitry Andric
26811f17f2 Vendor import of llvm release_50 branch r312293:
https://llvm.org/svn/llvm-project/llvm/branches/release_50@312293
2017-09-01 16:28:56 +00:00
Warner Losh
ae3adc0645 Fix parsing File() nodes in device paths.
o Add File to the mUefiDevicePathLibDevPathFromTextTable table so we
  don't include 'File()' in the supposed path name. This happens because
  of a possible misfeature in the EDK2 code where any path that's not
  recognized is treated as a File() node.
o Convert utf8 input into ucs2 output rather than just copying the
  utf8 and hoping for the best (no good comes from that).
o Remove bogus comment about needing to add 1. The dummy array already
  is length 1, so that's included in sizeof the struct, so there's no
  need to add it.

Sponsored by: Netflix
2017-08-31 15:53:47 +00:00
Warner Losh
0d802f5a7a Fix printing File() nodes in device paths.
Device paths encoded into the FILEPATH_DEVICE_PATH are UCS2 not
ASCII/UTF8. Convert to utf8 and print that when printing File
paths. Also, since File may be at the end of a long device path,
output File() around the path so it doesn't just show up as random
nodes that might accidentally match real node paths names and cause
errors.
2017-08-31 15:53:27 +00:00
John Baldwin
e896328044 Don't include GNU object attributes when building with clang.
LLVM's MIPS assembler parser does not understand the GNU as
'.gnu_attribute' keyword.  This could be re-enabled if LLVM is updated
in the future.  The desired floating point ABI is already described in
the .MIPS.abiflags section.

Reviewed by:	emaste
Sponsored by:	DARPA / AFRL
2017-08-30 19:19:31 +00:00
Dimitry Andric
2b12718be6 Follow-up to r323001: if the actually selected CPUTYPE is capable of
SSE2 instructions, we can use them.

Suggested by:	jkim
PR:		221733
MFC after:	1 week
X-MFC-With:	r323001
2017-08-30 07:05:29 +00:00
Ryan Libby
fca37d4727 lib/msun: add more csqrt unit tests for precision and overflow
Reviewed by:	bde
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
2017-08-29 22:37:24 +00:00
Ryan Libby
cf551d94ef lib/msun: avoid referring to broken LDBL_MAX
LDBL_MAX is broken on i386:
https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html

Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
for some time, and newer versions of gcc are now warning that the
"floating constant exceeds range of 'long double'".  Avoid this by
referring to proxy values instead.

Reviewed by:	bde
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
2017-08-29 22:32:29 +00:00
Dimitry Andric
e1ca2b88e2 In compiler-rt, a few assembler implementations for i386 floating point
conversion functions use SSE2 instructions, but these are not guarded by
#ifdef __SSE2__, and there is no implementation using general purpose
registers.  For these functions, use the generic C variants instead,
otherwise they will cause SIGILL on older processors.

Reported by:	bsdpr@phoe.frmug.org
PR:		221733
MFC after:	1 week
2017-08-29 21:45:00 +00:00
Pedro F. Giffuni
be53a489c6 libc: minor indent(1) cleanups.
Illumos and Schillix is adopting some of the locale code and our style(9)
sometimes matches the Solaris cstyle, so the changes are also useful as a
way to reduce diffs.

No functional change.

Discussed with: Joerg Schilling
MFC after:	1 week
2017-08-26 16:11:21 +00:00
Enji Cooper
b92e8635f9 Revert r321457
It doesn't fail after ^/head@r322855 (the releng_50 clang merge).

PR:	220989
MFC after:	2 months
MFC with:	r321369, r322855
2017-08-26 06:44:50 +00:00
Conrad Meyer
5a28df2e13 getmntinfo(3): Scale faster, and return sooner
getmntinfo(3) is designed around a relatively static or slow growing set of
current mounts.  It tried to detect a race with somewhat concurrent mount
and re-call getfsstat(2) in that case, looping indefinitely.  It also
allocated space for a single extra mount as slop.

In the case where the user has a large number of mounts and is adding them
at a rapid pace, it fell over.

This patch makes two functional changes:

1. Allocate even more slop.  Double whatever the last getfsstat(2) returned.

2. Abort and return some known results after looping a few times
   (arbitrarily, 3).  If the list is constantly changing, we can't guarantee
   we return a full result to the user at any point anyways.

While here, add very basic functional tests for getmntinfo(3) to the libc
suite.

PR:		221743
Submitted by:	Peter Eriksson <peter AT ifm.liu.se> (earlier version)
Sponsored by:	Dell EMC Isilon
2017-08-25 16:38:21 +00:00
Dimitry Andric
0fa4377182 Upgrade our copies of clang, llvm, lldb and compiler-rt to r311606 from
the upstream release_50 branch.

As of this version, lib/msun's trig test should also work correctly
again (see bug 220989 for more information).

PR:		220989
MFC after:	2 months
X-MFC-with:	r321369
2017-08-24 20:19:27 +00:00
Dimitry Andric
965351a4eb Vendor import of compiler-rt release_50 branch r311606:
https://llvm.org/svn/llvm-project/compiler-rt/branches/release_50@311606
2017-08-24 16:35:23 +00:00
Dimitry Andric
a75fa8aaf2 Vendor import of clang release_50 branch r311606:
https://llvm.org/svn/llvm-project/cfe/branches/release_50@311606
2017-08-24 16:35:14 +00:00
Dimitry Andric
5e529592b1 Vendor import of llvm release_50 branch r311606:
https://llvm.org/svn/llvm-project/llvm/branches/release_50@311606
2017-08-24 16:35:02 +00:00
John Baldwin
de6feefdb7 Improve the coverage of debug symbols for MK_DEBUG_FILES.
- Include debug symbols in static libraries.  This permits binaries
  to include debug symbols for functions obtained from static libraries.
- Permit the C/C++ compiler flags added for MK_DEBUG_FILES to be
  overridden by setting DEBUG_FILES_CFLAGS.  Use this to limit the debug
  information for llvm libraries and binaries.

Reviewed by:	emaste
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D12025
2017-08-23 23:30:25 +00:00
John Baldwin
04a91333db Include {u,}{div,mod}si3() on mips in libcompiler_rt.
These builtins were listed in the mips-specific Symbol.map for libc but
were not implemented.  Compiling mips with recent clang requires these
symbols.

Sponsored by:	DARPA / AFRL
2017-08-21 17:49:01 +00:00
Konstantin Belousov
7fea98ac16 Optimize libc to get and set TLS using the RDFSBASE and RDGSBASE
instructions, if supported both by CPU and kernel.

Reviewed by:	jhb (previous version)
Tested by:	pho (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D12023
2017-08-21 17:39:12 +00:00
Dimitry Andric
0554abf0e0 Upgrade our copies of clang, llvm, lld and libc++ to r311219 from the
upstream release_50 branch.

MFC after:	2 months
X-MFC-with:	r321369
2017-08-21 07:03:02 +00:00
Dimitry Andric
6aa46a19c5 Vendor import of clang release_50 branch r311219:
https://llvm.org/svn/llvm-project/cfe/branches/release_50@311219
2017-08-20 21:03:30 +00:00
Dimitry Andric
15c5c77fa0 Vendor import of llvm release_50 branch r311219:
https://llvm.org/svn/llvm-project/llvm/branches/release_50@311219
2017-08-20 21:02:43 +00:00
Dag-Erling Smørgrav
3954b52f28 In fetch_resolve(), if the port number or service name is included in
the host argument (e.g. "www.freebsd.org:443"), the service pointer,
which is supposed to point to the port or service part, instead points
to the separator, causing getaddrinfo() to fail.

Note that I have not been able to trigger this bug with fetch(1), nor
do I believe it is possible, as libfetch always parses the host:port
specification itself.  I discovered it when I copied fetch_resolve()
into an unrelated project.

MFC after:	3 days
2017-08-18 18:20:36 +00:00
Sevan Janiyan
242afab281 Add caveat to kinfo_getvmmap(3) explaining high CPU utilisation.
Based on kib's reply on https://lists.freebsd.org/pipermail/freebsd-hackers/2016-July/049710.html

PR:		210904
Submitted by:	Yuri Victorovich <yuri AT rawbw DOT com>
Reviewed by:	jilles
Approved by:	bcr (mentor)
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D12004
2017-08-18 16:42:58 +00:00
Ed Maste
f8de17a11f force use of ld.bfd for linking i386 libc, even when using lld
lld can successfully link most of a working i386 userland and kernel,
but produces a broken libc. For now if we're otherwise using lld, and
ld.bfd is available, explicitly use it for libc.

Sponsored by:	The FreeBSD Foundation
2017-08-16 18:55:39 +00:00
Warner Losh
b53a8df3aa There is no MACHINE_CPUARCH == armv6, remove redunant check. 2017-08-14 22:38:54 +00:00
Enji Cooper
188e46ab03 Add supporting changes for Add limited sandbox capability to "make check"
Non-tests/... changes:
- Add HAS_TESTS= to Makefiles with libraries and programs to enable iteration
  and propagate the appropriate environment down to *.test.mk.

tests/... changes:
- Add appropriate support Makefile.inc's to set HAS_TESTS in a minimal manner,
  since tests/... is a special subdirectory tree compared to the others.

MFC after:	2 months
MFC with:	r322511
Reviewed by:	arch (silence), testing (silence)
Differential Revision:	D12014
2017-08-14 19:21:37 +00:00
Michael Tuexen
703e1e3d0f Fix minor formatting issue. 2017-08-13 15:15:40 +00:00
Konstantin Belousov
b1cbddaf5d Fix a regression in r321608.
On i386 with CPUID but without SSE2, set lfence_works to LMB_NONE
instead of looping.

Reported and tested by:	Andre Albsmeier <andre@fbsd.e4m.org>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2017-08-13 14:42:23 +00:00
Enji Cooper
ac5ff11099 TESTSDIR isn't required; remove it
MFC after:	1 week
MFC with:	r322450
2017-08-13 01:08:37 +00:00
Enji Cooper
38dd175927 Integrate the tests moved in r305626 in to the FreeBSD test suite
The reachover Kyuafiles were never added, and thus the tests were installed
as standalone tests, and not integrated into the full suite.

MFC after:	1 week
MFC with:	r305626, 305629, r307863, r322447, r322448, r322449
2017-08-13 01:04:44 +00:00
Enji Cooper
191d976f61 Use hardcoded IPv4/IPv6 addresses for google-public-dns-a.google.com instead
of freefall.freebsd.org to unbreak the DNS tests

The address allocations for freefall.freebsd.org have changed in the past 4 years.
Use a more stable set of hardcoded addresses for now to make the tests succeed
reliably.

The hostname should be resolved dynamically instead of hardcoding the addresses in
the future. This is just a bandaid.

MFC after:	1 week
2017-08-13 00:56:43 +00:00
Enji Cooper
737fb907a7 Make root-privileges a requirement for the test
Some of the testcases try to manipulate sysctls that require root privileges,
e.g., "kern.sync_on_panic". Make root-privileges a hard requirement so the
tests don't raise false positives due to privilege issues when calling
sysctlbyname(3) on writable sysctls.

MFC after:	1 week
2017-08-13 00:14:08 +00:00
Enji Cooper
ebe3e93cef Fix result printing
- Flushing stdout prevents the buffer from being printed twice, fixing
  issues with stdout printing out the testplan, etc, twice.
- Don't print out raw source/line numbers; hide them behind comments.

MFC after:	1 week
2017-08-13 00:04:50 +00:00
Enji Cooper
22dae9c629 Hide sccsid under #if 0, per example in style(9)
This fixes a -Wunused warning with gcc 6.3.0/7.0.0.

MFC after:	1 week
2017-08-12 22:20:08 +00:00
Ryan Libby
4c889da8b6 Revert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches
Either need a different way to spell HALF_LDBL_MAX, or a different way
to spell LDBL_MAX_EXP, or a different approach.

Reported by:	ian
2017-08-12 18:28:02 +00:00
Sevan Janiyan
ef764b4b8e Add missing header.
S_IRUSR is defined in sys/stat.h

PR:		209229
Submitted by:	<mt AT markoturk DOT info>
Approved by:	bcr (mentor)
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D12007
2017-08-12 17:46:50 +00:00
Konstantin Belousov
25b73e6327 Improve standard compliance for memset_s() and abort_handler_s().
abort_handler_s() currently simply calls abort(), though the standard
specifies more: "Writes an implementation-defined message to stderr
which must include the string pointed to by msg and calls abort()."

memset_s() is missing error condition "n > smax", and does not invoke
the constraint handler after filling the buffer: "following errors are
detected at runtime and call the currently installed constraint
handler function after storing ch in every location of the destination
range [dest, dest+destsz) if dest and destsz are themselves valid",
one of the errors is "n > smax" itself.

Submitted by:	Yuri Pankov <yuripv@gmx.com>
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D11991
2017-08-12 15:18:17 +00:00
Konstantin Belousov
6fe9e5b821 Fix indent.
Submitted by:	Yuri Pankov <yuripv@gmx.com>
MFC after:	3 days
2017-08-12 14:58:09 +00:00
Ryan Libby
9afac9fed9 lib/msun: avoid referring to broken LDBL_MAX
LDBL_MAX is broken on i386:
https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html

Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
for some time, and newer versions of gcc are now warning that the
"floating constant exceeds range of 'long double'".  Avoid this by
referring to half the value of LDBL_MAX instead.

Reviewed by:	bde
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
2017-08-11 22:41:24 +00:00
Pedro F. Giffuni
9404dae2a1 fnmatch(3): Update testcase for r322368. 2017-08-10 17:03:46 +00:00
Mariusz Zaborski
1a32b20594 Limit descriptors stored in the pidfh structure.
Reviewed by:	markj, cem
Differential Revision:	https://reviews.freebsd.org/D11741
2017-08-10 16:50:13 +00:00
Mariusz Zaborski
4f9612a321 Store directory descriptor in the pidfh structure and use unlinkat(2)
function instead of unlink(2).

Now when pidfile_remove() uses unlinkat(2) to remove the pidfile
it is safe to use this function in capability mode.

Style fix: sort headers.

PR:		220524
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D11692
2017-08-10 16:45:05 +00:00
Pedro F. Giffuni
303cbb93c5 fnmatch(3): improve POSIX conformance.
In a recent interpretation[1], "\\" shall return a non-zero value
(indicating either no match or an error).

The fix involves a change over r254091 and now the behavior matches the
Sun/IBM/HP closed source implementations and also likely musl libc.

Submitted by:	Joerg Schilling <joerg at schily.net>
MFC after:	1 week

[1] http://austingroupbugs.net/view.php?id=806
2017-08-10 15:42:25 +00:00
Ruslan Bukin
af19cc59ca Support for v1.10 (latest) of RISC-V privilege specification.
New version is not compatible on supervisor mode with v1.9.1
(previous version).

Highlights:
    o BBL (Berkeley Boot Loader) provides no initial page tables
      anymore allowing us to choose VM, to build page tables manually
      and enable MMU in S-mode.
    o SBI interface changed.
    o GENERIC kernel.
      FDT is now chosen standard for RISC-V hardware description.
      DTB is now provided by Spike (golden model simulator). This
      allows us to introduce GENERIC kernel. However, description
      for console and timer devices is not provided in DTB, so move
      these devices temporary to nexus bus.
    o Supervisor can't access userspace by default. Solution is to
      set SUM (permit Supervisor User Memory access) bit in sstatus
      register.
    o Compressed extension is now turned on by default.
    o External GCC 7.1 compiler used.
    o _gp renamed to __global_pointer$
    o Compiler -march= string is now in use allowing us to choose
      required extensions (compressed, FPU, atomic, etc).

Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11800
2017-08-10 14:18:09 +00:00
Ryan Libby
20100e740e Pick 'Remove external linkage for spin_adaptive' from upstream jemalloc
Apply the changes from upstream jemalloc 048c6679.  This is actually not
quite a cherry pick due to makefile difference and because FreeBSD does
not carry the msvc project files which were also modified in that
commit.

Approved by:	jasone (maintainer), markj (mentor)
Sponsored by:	Dell EMC Isilon
2017-08-09 22:58:42 +00:00
Kyle Evans
3e13c1fa27 capsicum_helpers: Add FIODTYPE to default ioctls allowed
FIODTYPE will be needed by hexdump(1) to speed up the -s flag on devices
that should be able to support fseek(3); specifically, in an attempt to
correct for the fact that most tape drives don't support seeking yet don't
indicate as such when fseeko(3) is invoked. Related: D10939

Reviewed by:	cem, emaste, oshogbo
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D10937
2017-08-09 18:15:07 +00:00
Kyle Evans
f75f5a355e libusb(3): Expose device caps as libusb_bos_descriptor::dev_capability
Some libusb consumers in Linux-land (in this case, libusb4java) expect a
dev_capability member that they can use to enumerate the device
capabilities.

No particular layout is expected of this, just that it can be traversed
using the bLength member until bNumDeviceCapabilities are read and that the
consumer may then use one of the libusb_get_*_descriptor methods to extract
specific (usb 2.0 vs. ss) capability information.

In collaboration with:	hselasky
Reviewed by:	hselasky
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D11494
2017-08-09 18:06:27 +00:00
Dimitry Andric
9dc417c32b Upgrade our copies of clang, llvm and libc++ to r310316 from the
upstream release_50 branch.

MFC after:	2 months
X-MFC-with:	r321369
2017-08-09 17:32:39 +00:00
Kyle Evans
a0bf5d8a68 regex(3): Refactor fast/slow stepping bits in the matching engine
Adding features for matching is fairly straightforward, but this requires
some duplication because of this fast/slow setup. They can be fairly
trivially combined into a single walk(), so do it to make future additions
less error prone.

Reviewed by:	cem (earlier version), emaste, pfg
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D11233
2017-08-09 01:04:36 +00:00
Dimitry Andric
ffe56ea4c3 Vendor import of clang release_50 branch r310316:
https://llvm.org/svn/llvm-project/cfe/branches/release_50@310316
2017-08-08 16:53:22 +00:00
Dimitry Andric
4e20bb0468 Vendor import of llvm release_50 branch r310316:
https://llvm.org/svn/llvm-project/llvm/branches/release_50@310316
2017-08-08 16:52:53 +00:00
Kyle Evans
a4a801688c regex(3): Handle invalid {} constructs consistently and adjust tests
Currently, regex(3) exhibits the following wrong behavior as demonstrated
with sed:

 - echo "a{1,2,3}b" | sed -r "s/{/_/"     (1)
 - echo "a{1,2,3}b" | sed "s/\}/_/"       (2)
 - echo "a{1,2,3}b" | sed -r "s/{}/_/"    (3)

Cases (1) and (3) should throw errors but they actually succeed, and (2)
throws an error when it should match the literal '}'. The correct behavior
was decided by comparing to the behavior with the equivalent BRE (1)(3) or
ERE (2) and consulting POSIX, along with some reasonable evaluation.

Tests were also adjusted/added accordingly.

PR:		166861
Reviewed by:	emaste, ngie, pfg
Approved by:	emaste (mentor)
MFC after:	never
Differential Revision:	https://reviews.freebsd.org/D10315
2017-08-08 04:10:46 +00:00
Ruslan Bukin
ca20f8ec29 o Replace __riscv__ with __riscv
o Replace __riscv64 with (__riscv && __riscv_xlen == 64)

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

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

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

Reviewed by:	ngie
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11901
2017-08-07 14:09:57 +00:00
Enji Cooper
7921075587 MFhead@r322057 2017-08-04 17:41:49 +00:00
Mariusz Zaborski
73979478cc Introduce the flopenat(3) function.
Reviewed by:	des, emaste
Differential Revision:	https://reviews.freebsd.org/D11690
2017-08-04 14:24:24 +00:00
Warner Losh
fac7b28779 Add stpcpy and stpncpy to libstand
This adds the stpcpy and stpncpy functions to libstand.

Differential Revision: https://reviews.freebsd.org/D11844
2017-08-04 03:48:17 +00:00
Enji Cooper
d1ce8bc1b5 MFhead@r322023 2017-08-03 18:07:01 +00:00
Enji Cooper
b382804144 Remove special-case logic for running tests on host machines
I'm not sure what process sjg@ was using, but using CHECKDIR=${.OBJDIR} with
"make check" on ^/head is the correct thing to do. This unbreaks "make check"
for me (unsandboxed, not using CHECKDIR=${.OBJDIR}).

While here, fix a whitespace nit with LIBADD.

MFC after:	1 week
2017-08-03 17:53:14 +00:00
Enji Cooper
f2381beb2c MFhead@r322021 2017-08-03 17:43:26 +00:00
Phil Shafer
fd5e3f3ec6 Update from libxo-0.8.1 to 0.8.4:
0.8.4:
    - void anchor width optimization when we have a custom formatter (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221130)
    - make "{[:/18}" do the right thing (also allows "{[:/%s}", wide ? 40 : 10)
    - Can't skip anchor formatting in non-display styles
    - add test case for {[:/18}
    - add upload-xohtml-files to 'make upload'
  0.8.3:
    - xohtml: Add "-w" option to pull support files from gh_pages
    - Add "upload-xohtml-files" target to publish support files in gh_pages/
    - add HISTORY/AUTHORS section to man pages
  0.8.2:
    - xohtml: Add div.units as standard CSS text
    - Don't treat values as format strings; they are not
    - add "-p" to "mkdir -p build" in setup.sh
    - add test case for {U:%%} (from df.c)
    - detect end-of-string in '%' and '' escaping
    - make xo_simple_field, for common simple cases
    - xohtml: nuke "n" in "echo" commands
    - rename "format" to "fmt" for consistency; same for "str" to "value"

Submitted by:	phil
2017-08-03 15:47:42 +00:00
Enji Cooper
3a8b7649ce MFhead@r321916 2017-08-02 09:00:59 +00:00
Enji Cooper
c119e4a444 Remove bogus bsd.subdir.mk .include
bsd.subdir.mk is included from bsd.obj.mk, which is included via bsd.lib.mk.

MFC after:	3 days
2017-08-02 08:54:18 +00:00
Enji Cooper
d511b20a69 Add HAS_TESTS to all Makefiles that are currently using the
`SUBDIR.${MK_TESTS}+= tests` idiom.

This is a follow up to r321912.
2017-08-02 08:50:42 +00:00
Enji Cooper
46b37aa2c4 MFhead@r321912 2017-08-02 08:38:36 +00:00
Enji Cooper
4b330699f8 Convert traditional ${MK_TESTS} conditional idiom for including test
directories to SUBDIR.${MK_TESTS} idiom

This is being done to pave the way for future work (and homogenity) in
^/projects/make-check-sandbox .

No functional change intended.

MFC after:	1 weeks
2017-08-02 08:35:51 +00:00
Enji Cooper
8c09935728 Add HAS_TESTS to all Makefiles that use the SUBDIR.${MK_TESTS}+= tests idiom 2017-08-02 08:14:06 +00:00
Cy Schubert
01da25af6b Remove redundant include directories which expand to a noop,
"-I/lib/krb5 -I -I".

Reviewed by:	ngie@, markm@
MFC after:	1 month
Differential Revision:	D11769
2017-07-31 19:07:45 +00:00
Dimitry Andric
37cd60a321 Upgrade our copies of clang, llvm, lld and lldb to r309439 from the
upstream release_50 branch.  This is just after upstream's 5.0.0-rc1.

MFC after:	2 months
X-MFC-with:	r321369
2017-07-30 18:01:34 +00:00
Enji Cooper
b9c6d356b2 libprocstat(3): fix arguments list for procstat_getargv(3) and procstat_getenvv(3)
Neither libcall takes a fourth argument (`char *errbuf`).

PR:		217884
Submitted by:	tobik
MFC after:	1 month
2017-07-29 22:25:45 +00:00
Enji Cooper
45805bd715 libprocstat(3): fix reference (typo) to procstat_freeenvv in description for
procstat_getargv(3)

PR:		217884
MFC after:	1 month
Submitted by:	tobik
2017-07-29 22:19:00 +00:00
Enji Cooper
e504201ea7 Add sys/socket.h to SYNOPSIS for libprocstat(3)
sys/socket.h is required for procstat_get_socket_info(3), added in
r221807.

MFC after:	1 month
PR:		217884
Submitted by:	tobik
2017-07-29 22:16:05 +00:00
Dimitry Andric
9e3ca9b3ba Vendor import of lld release_50 branch r309439:
https://llvm.org/svn/llvm-project/lld/branches/release_50@309439
2017-07-29 21:30:27 +00:00
Dimitry Andric
104a02fb6c Vendor import of clang release_50 branch r309439:
https://llvm.org/svn/llvm-project/cfe/branches/release_50@309439
2017-07-29 21:28:13 +00:00
Dimitry Andric
3ad6a4b447 Vendor import of llvm release_50 branch r309439:
https://llvm.org/svn/llvm-project/llvm/branches/release_50@309439
2017-07-29 21:25:18 +00:00
Konstantin Belousov
d00ed7642f Simplify flow control.
Also add explicit comment why libc cannot simply rely on open(2)
failure in capability mode.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-07-28 12:22:32 +00:00
Konstantin Belousov
9a3083660d Use MFENCE to serialize RDTSC on non-Intel CPUs.
Kernel already used the stronger barrier instruction for AMDs, correct
the userspace fast gettimeofday() implementation as well.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D11728
2017-07-27 08:37:07 +00:00
Enji Cooper
9f27375481 Re-add #endif accidentally deleted in r321484
MFC after:	1 month
MFC with:	r321455, r321484
2017-07-25 16:57:25 +00:00
Enji Cooper
db92647731 Only test ld_pi_odd with LDBL_MANT_DIG == 64 to fix the build
The empty (unimplemented) test inputs for sparc64 trigger a -Wtype-limits build
failure because nitems of an empty array is always false, i.e., deadcode.

MFC after:	1 month
MFC with:	r321455
Reported by:	Jenkins (sparc64 job)
2017-07-25 16:21:22 +00:00
Enji Cooper
82482c7c1f Mask issues with duplicate definitions for __fnstcw, __fldenv, and __fldcw on
i386 by ignoring -Wmacro-redefined.

This is a bandaid until the code is fixed and will be reverted before MFC.
2017-07-25 16:11:36 +00:00
Konstantin Belousov
4f969e10d1 Fix indent.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2017-07-25 09:48:33 +00:00
Enji Cooper
bc82a381be Mark :reduction as an expected failure
It fails with clang 5.0+.

PR:	220989
MFC after:	2 months
MFC with:	r321369
Reported by:	Jenkins
2017-07-25 03:56:42 +00:00
Enji Cooper
4580a78efd Convert lib/msun/trig_test from TAP to ATF format
Only expose :accuracy and :reduction if !i386, similar to before,
but more holistically to avoid future -Wunused issue with the unused
functions.

MFC after:	1 month
2017-07-25 03:55:44 +00:00
Enji Cooper
fd5e9c331e Raise WARNS to 1
This will enable warnings with the msun tests.

MFC after:	1 month
2017-07-25 03:54:35 +00:00
Bryan Drewery
cd2831005b Move llvm Options.inc hack from r321433 for NO_CLEAN to lib/clang/libllvm.
The files are only ever generated to .OBJDIR, not to WORLDTMP (as a
sysroot) and are only ever included from a compilation.  So using
a beforebuild target here removes the file before the compilation
tries to include it.

MFC after:	2 months
X-MFC-With:	r321369
2017-07-24 23:32:24 +00:00
Warner Losh
4c69a17ff9 fix typo 2017-07-24 18:10:42 +00:00
Dimitry Andric
0cc9e150fb Add a few more object files to liblldb, which should solve errors when
linking the lldb executable in some cases.  In particular, when the
-ffunction-sections -fdata-sections options are turned off, or
ineffective.

Reported by:	Shawn Webb, Mark Millard
MFC after:	2 months
X-MFC-With:	r308421
2017-07-24 16:33:06 +00:00
Kristof Provost
a342f43571 Handle WITH/WITHOUT_PF in libsysdecode
Only filter out the PF ioctls if we're building without pf support.
Until now those were always filtered out, so truss did not show symbolic
names for pf ioctls.

Differential Revision:	https://reviews.freebsd.org/D11629
2017-07-22 12:51:19 +00:00
Dimitry Andric
90a5403fea Merge ^/head r321307 through r321350. 2017-07-21 18:54:34 +00:00
Bryan Drewery
9f4bf11e12 Properly set userid for truncate_test.
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-07-21 16:14:06 +00:00
Alan Somers
18ddf67c64 Implement SIGEV_THREAD notifications for lio_listio(2)
Our man pages have always indicated that this was supported, but in fact the
feature was never implemented for lio_listio(2).

Reviewed by:	jhb, kib (earlier version)
MFC after:	20 days
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D11680
2017-07-21 15:09:24 +00:00
Dimitry Andric
7a0f27890a Merge ^/head r321239 through r321306. 2017-07-20 20:37:23 +00:00
Alan Somers
1bf9ff7603 Remove some private symbols from librt
Private functions like __aio_read and _aio_read were exposed in
FBSDprivate_1.0 by r169090, even though they've never been used outside of
librt. Also, remove some weak references from r156136 that have never
resolved.

Reviewed by:	kib
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D11649
2017-07-20 16:24:29 +00:00
Dimitry Andric
2fef18f836 Merge ^/head r320994 through r321238. 2017-07-19 19:43:10 +00:00
Dimitry Andric
b40b48b876 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r308421, and update
build glue.
2017-07-19 19:41:41 +00:00
Ed Maste
e6db6692e5 enable pidfile tests on arm64
Pidfile tests were disabled on arm64 (in r286863) because they hung.
They have been fixed (r306098) and so can be enabled now.

PR:		202304
Sponsored by:	The FreeBSD Foundation
2017-07-19 14:07:38 +00:00
Dimitry Andric
97a708bebc Vendor import of libc++ trunk r308421:
https://llvm.org/svn/llvm-project/libcxx/trunk@308421
2017-07-19 07:02:49 +00:00
Dimitry Andric
462d72ec21 Vendor import of compiler-rt trunk r308421:
https://llvm.org/svn/llvm-project/compiler-rt/trunk@308421
2017-07-19 07:02:40 +00:00
Dimitry Andric
de51d67148 Vendor import of clang trunk r308421:
https://llvm.org/svn/llvm-project/cfe/trunk@308421
2017-07-19 07:02:30 +00:00
Dimitry Andric
93c91e39b2 Vendor import of llvm trunk r308421:
https://llvm.org/svn/llvm-project/llvm/trunk@308421
2017-07-19 07:02:10 +00:00
John Baldwin
ad6b4a346f Remove special handling for 'disk*.h'
This was originally added so that only one of diskmbr.h or diskpc98.h
was chosen and is no longer needed after PC98's removal.  However, the
special handling was also broken as it effectively prevented the decoding
of ioctls declared in other headers such as <sys/disk.h> or
<sys/disklabel.h>.
2017-07-18 21:09:29 +00:00
Pedro F. Giffuni
1c9158aabe libthr: check for possible overflow in the pthread_barrier_init() count.
Following up on r320900, where the check for negative count values was
removed, add a check to prevent integer overflow. This is to account that
b_count, b_waiters but most importantly the total number of threads in
the system are signed values.

Discussed with:	kib
MFC after:	2 weeks
2017-07-15 15:00:13 +00:00
Dimitry Andric
03f072d13d Merge ^/head r320971 through r320993. 2017-07-14 17:38:44 +00:00
Brad Davis
a9796f9d2b Follow up to r320992, properly escape the backslash so it renders properly.
MFC after:	1 week
Forgotten by:	brd
X-MFC-With:	r320992
2017-07-14 17:27:15 +00:00
Brad Davis
d29193055b Add a complete example to tsearch(3)
Reviewed by:	wblock, sevan, bruffer
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D11053
2017-07-14 17:07:28 +00:00
Kenneth D. Merry
683b025ade Add IBM TS1155 density codes to libmt and the mt(1) man page.
These are taken directly from the density report from a TS1155
tape drive.  (Using mt getdensity)

lib/libmt/mtlib.c:
	Add 3592B5 encrypted/unencrypted density codes, and bpmm/bpi
	values.  The bpmm/bpi values are the same as TS1150, but
	there are 50% more tracks.

usr.bin/mt/mt.1:
	Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi
	values and number of tracks.  Bump the man page date.

MFC after:	3 days
Sponsored by:	Spectra Logic
2017-07-14 16:45:46 +00:00
Pedro F. Giffuni
97c3a994e4 libthr: 'count' is unsigned so don't check for negative values.
Obtained from:	DragonFlyBSD (git e7db8139)
2017-07-14 16:05:54 +00:00
Dimitry Andric
d2043ca373 Merge ^/head r320573 through r320970. 2017-07-13 22:01:38 +00:00
Dimitry Andric
c439438675 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r307894, and update
build glue.
2017-07-13 21:58:45 +00:00
Dimitry Andric
2678297743 Vendor import of lld trunk r307894:
https://llvm.org/svn/llvm-project/lld/trunk@307894
2017-07-13 19:26:06 +00:00
Dimitry Andric
289ae9e3ac Vendor import of libc++ trunk r307894:
https://llvm.org/svn/llvm-project/libcxx/trunk@307894
2017-07-13 19:25:57 +00:00
Dimitry Andric
1992b790c2 Vendor import of compiler-rt trunk r307894:
https://llvm.org/svn/llvm-project/compiler-rt/trunk@307894
2017-07-13 19:25:48 +00:00
Dimitry Andric
8746d127c0 Vendor import of clang trunk r307894:
https://llvm.org/svn/llvm-project/cfe/trunk@307894
2017-07-13 19:25:38 +00:00
Dimitry Andric
ca089b24d4 Vendor import of llvm trunk r307894:
https://llvm.org/svn/llvm-project/llvm/trunk@307894
2017-07-13 19:25:18 +00:00
Mark Johnston
7f48d6a486 Don't dlclose NSS modules from nss_atexit().
As hinted in the commit log message for r259042, this is unnecessary.
Moreover, as a result of that change we may invoke a DSO's atexit handler
after it has been unmapped.

Reviewed by:	bdrewery, cem
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-07-11 17:59:15 +00:00
Bryan Drewery
1671f70652 DIRDEPS_BUILD: Connect more libraries.
Sponsored by:	Dell EMC Isilon
2017-07-11 00:32:48 +00:00
Konstantin Belousov
99ac8154ff Provide libdl.
Create libdl.so.1 as a filter for libc.so.7 which exports public dl*
functions. The functions are resolved from the rtld instead, the goal
of creating library is to avoid errors from the static linker due to
missed libdl. For static binaries, an empty .o is compiled into
libdl.a so that static binaries still get dl stubs from libc.a.

Right now lld cannot create filter objects, disable libdl on arm64
when binutils are not used.

Reviewed by:	bdrewery, dim (previos version); emaste
Exp run:	PR 220525, done by antoine
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D11504
2017-07-10 14:59:21 +00:00
Konstantin Belousov
7bd5b9f365 Fix warnings, adjust style.
Reviewed by:	bdrewery, dim, emaste (as part of D11504)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-07-10 08:10:45 +00:00