Commit Graph

16623 Commits

Author SHA1 Message Date
Dimitry Andric
ef6fa9e26d Upgrade our copy of clang and llvm to 3.6.1 release.
This release contains the following cherry-picked revisions from
upstream trunk:

  226124 226151 226164 226165 226166 226407 226408 226409 226652
  226905 226983 227084 227087 227089 227208 227209 227210 227211
  227212 227213 227214 227269 227430 227482 227503 227519 227574
  227822 227986 227987 227988 227989 227990 228037 228038 228039
  228040 228188 228189 228190 228273 228372 228373 228374 228403
  228765 228848 228918 229223 229225 229226 229227 229228 229230
  229234 229235 229236 229238 229239 229413 229507 229680 229750
  229751 229752 229911 230146 230147 230235 230253 230255 230469
  230500 230564 230603 230657 230742 230748 230956 231219 231237
  231245 231259 231280 231451 231563 231601 231658 231659 231662
  231984 231986 232046 232085 232142 232176 232179 232189 232382
  232386 232389 232425 232438 232443 232675 232786 232797 232943
  232957 233075 233080 233351 233353 233409 233410 233508 233584
  233819 233904 234629 234636 234891 234975 234977 235524 235641
  235662 235931 236099 236306 236307

Please note that from 3.5.0 onwards, clang and llvm require C++11
support to build; see UPDATING for more information.
2015-05-25 13:43:03 +00:00
Enji Cooper
4ed27da932 Remove SUBDIR_DEPEND for non-existent libreadline directory
libreadline lives under gnu/lib

MFC after: 1 week
2015-05-24 23:19:47 +00:00
Tijl Coosemans
f171d54687 When only 2 bytes can be read from a 4 byte UTF-16 character in a base64
encoded chunk of a UTF-7 string, treat that as an incomplete character and
return an error instead of a shift sequence and no error.

Also check that the low 2 bytes have a valid value.

MFC after:	1 week
2015-05-24 15:47:06 +00:00
Tijl Coosemans
ec513841b3 Fix decoding of UTF-7 when a base64 encoded chunk appears at the end of
the input buffer.

_citrus_UTF7_mbtoutf16 stored the decoder state at the beginning so it
could restore this state on an incomplete character such that the next
call would restart the decoding.  The problem was that "-" (end of base64
mode) at the end of a string was also treated as an incomplete character
but was also removed from the state buffer.  So the initial state would be
restored (with base64 mode) and the next call would no longer see the "-"
so it continued in base64 mode.

This state saving/restoring isn't needed here.  It's already handled
elsewhere (citrus_iconv_std.c:_citrus_iconv_std_iconv_convert) so just
remove it.

Also initialise *nresult.

PR:		200398
Tested by:	delphij
MFC after:	1 week
2015-05-24 15:27:31 +00:00
Warner Losh
111ff432de Remove the stray DEBUG_FLAGS=-g line that snuck in with the
soft-updates journaling project merge in r207141.
2015-05-21 14:36:11 +00:00
Baptiste Daroussin
8def216e05 Drop libmandoc and incorporate it into the main mandoc Makefile
This simplifies maintainance of mandoc(1).
Note that the same direction was taken on OpenBSD
2015-05-21 12:51:56 +00:00
Baptiste Daroussin
a822b64165 Remove clause 3 and 4 from the license
Obtained from:	NetBSD
2015-05-21 08:38:25 +00:00
Dimitry Andric
d5f23b0b75 Vendor import of clang RELEASE_361/final tag r237755 (effectively, 3.6.1 release):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_361/final@237755
2015-05-21 06:58:08 +00:00
Dimitry Andric
f03b5bed27 Vendor import of llvm RELEASE_361/final tag r237755 (effectively, 3.6.1 release):
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_361/final@237755
2015-05-21 06:57:07 +00:00
Allan Jude
04017fc7a4 Create links to the libprocstat man pages for all of the libprocstat functions so they can be looked up by name
Add a cross refrence to libprocstat in the procstat.1 man page

Differential Revision:	https://reviews.freebsd.org/D2578
Suggested by:	jmg
Reviewed by:	brueffer
Approved by:	wblock (mentor)
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
2015-05-21 03:32:44 +00:00
Konstantin Belousov
60a8e659bb Remove the write-only variable phent. We currently do not check the
size of the program header's entries.

Reported by:	adrian (by using gcc 4.9)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-05-20 15:37:15 +00:00
Baptiste Daroussin
f8eb7ac92c Fix underlinking 2015-05-19 22:23:15 +00:00
Ed Maste
302af79506 All FreeBSD platforms are elf: move i386-elf to i386
This was a leftover from when we had both i386 a.out and ELF.

Reviewed by:	kib, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2591
2015-05-19 21:00:53 +00:00
John Baldwin
0ceb54c2cf Use fixed enum values for PMC_CLASSES().
This removes one of the frequent causes of ABI breakage when new CPU
types are added to hwpmc(4).

Differential Revision:	https://reviews.freebsd.org/D2586
Reviewed by:	davide, emaste, gnn (earlier version)
MFC after:	2 weeks
2015-05-19 18:58:18 +00:00
Ruslan Bukin
bc88bb2bf3 Add Performance Monitoring Counters support for AArch64.
Family-common and CPU-specific counters implemented.

Supported CPUs: ARM Cortex A53/57/72.

Reviewed by:	andrew, bz, emaste, gnn, jhb
Sponsored by:	ARM Limited
Differential Revision:	https://reviews.freebsd.org/D2555
2015-05-19 15:25:47 +00:00
Baptiste Daroussin
d44bc1335e Synchronize libedit with NetBSD
It incorporates and fixes our patches to get el_gets return the proper count of
characters in unicode mode.
2015-05-18 22:03:05 +00:00
Pedro F. Giffuni
1b81d86525 Drop some unnecessary casts.
Reported by:	Clang static analyzer
Obtained from:	NetBSD
2015-05-18 16:28:13 +00:00
Steve Kargl
5b3a5f8343 In r279493, the functions pzero[f](), qzero[f], pone[f](),
and qone[f]() were marked as __inline, but their forward
declarations were not updated.  Fix the forward declarations
to match the actual function declarations.

Requested by:	 bde
2015-05-17 16:27:06 +00:00
Konstantin Belousov
9be6046a47 Some third-party malloc(3) implementations use pthread_setspecific(3)
to handle per-thread information.  Since our pthread_setspecific()
implementation calls calloc(3) to allocate per-thread specific data
storage, things get complicated.

Switch the allocator to use bare mmap(2).  There is some loss of the
allocated page, since e.g. on amd64, PTHREAD_KEYS_MAX * sizeof(struct
pthread_specific_elem) is 3K (it actually spans whole page due to
padding), but I believe it is more acceptable than additional code for
specialized allocator().

The alternatives would either to make the specific data array be part of
the struct thread, or use internal bindings to call the libc malloc,
avoiding interposing.

Also do the style pass over the thr_spec.c, esp. simplify the
conditionals nesting by returning early when an error detected.
Remove trivial comments.

Found by:	yuri@rawbw.com
PR:	200138
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-05-15 08:40:17 +00:00
Ed Maste
b00fe64f4a Update to ELF Tool Chain r3197
Highlights:
 - Fix man page markup, whitespace, and typos
 - Fix sh_info of SHT_GROUP section to point to the correct string
 - Improve validation in readelf and elfcopy/strip
 - Handle DWARF 4's DW_AT_high_pc in addr2line

Sponsored by:	The FreeBSD Foundation
2015-05-14 19:48:15 +00:00
Ed Maste
e09e55dc82 Add fabs() to arm64 libc
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2532
2015-05-14 17:12:45 +00:00
Ed Maste
4d37254910 Remove redundant csu subdir logic
The appropriate subdirectories are handled by lib/csu/Makefile. There's
no need to duplicate this logic in Makefile.inc1 and lib/Makefile.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2523
2015-05-12 17:53:22 +00:00
Andrew Turner
2b6a6357f2 Teach bits of libc about Thumb. This adds the if-then instructions needed
to handle the ARM conditional execution.

While here fix a bug found by this in the hard-float code, cc is the
opposite of cs. The former is used for 'less than' in floating-point code
and is executed when the C (carry) bit is clear, the latter is used when
greater than, equal, or unordered, and is executed when the C bit is set.
2015-05-12 10:03:14 +00:00
Xin LI
0a23444a57 Revert r282775 for now. The added dependency would cause problems for
e.g. ports-mgmt/pkg and we would like to do an exp-build.

Requested by:	bdrewery
2015-05-12 05:42:13 +00:00
Andrew Turner
74de7730b7 Use the GOT_* macros to help simplify the code, these work with both pic
and non-pic code, and to build for Thumb.
2015-05-11 20:33:46 +00:00
Xin LI
f2626e0e62 Revert r281372, it's no longer needed after r282726 (fix for PR 199119) as the
symbol conflict between libmd and libcrypto have been solved.
2015-05-11 17:49:07 +00:00
Thomas Quinot
2dd0a89c26 Unbreak MIPS build following rev. 282726
Introduce further adjustments to the renaming of libmd
symbols: make sure that we do not generate dangling weak
aliases, as this causes build failures on MIPS.

Tested by:	sbruno
2015-05-11 16:45:33 +00:00
Thomas Quinot
55b130956d Unbreak build following rev. 282726
(Makefile.inc1): add dependency of xinstall on libmd to
avoid failure of parallel bootstrap.

(lib/libmd/*.h): do not redefine symbols if already
defined as macros (libcrypt uses the same sources internally,
redefining symbols with a prefix of its own).

Fixes build failures caused by previous change to libmd.

Reported by: ian
Pointy hat to: thomas
2015-05-10 21:21:52 +00:00
Jilles Tjoelker
53d1c63711 recv(),send(): Directly call interposing entry instead of going through PLT.
recv() and send()'s calls to recvfrom() and sendto() are much like
waitpid()'s call to wait4(), and likewise need not allow PLT interposing on
the called function.
2015-05-10 14:50:50 +00:00
Thomas Quinot
9d8b66868a Ensure libmd symbols do not clash with libcrypto
Add a prefix to all symbols in libmd to avoid incompatibilites
with same-named, but not binary compatible, symbols from libcrypto.

Also introduce Weak aliases to avoid the need to rebuild dependent
binaries and a major version bump.

PR:		199119
Differential Revision:	D2216
Reviewed by:	roberto, delphij
MFC after:	2 weeks
2015-05-10 13:21:36 +00:00
John Baldwin
8b2e525f52 Tweak the comment here some more. In particular, the previous opening
sentence was a bit confusing.

Noted by:	kib
2015-05-06 17:23:42 +00:00
Neel Natu
9c4d547896 Deprecate the 3-way return values from vm_gla2gpa() and vm_copy_setup().
Prior to this change both functions returned 0 for success, -1 for failure
and +1 to indicate that an exception was injected into the guest.

The numerical value of ERESTART also happens to be -1 so when these functions
returned -1 it had to be translated to a positive errno value to prevent the
VM_RUN ioctl from being inadvertently restarted. This made it easy to introduce
bugs when writing emulation code.

Fix this by adding an 'int *guest_fault' parameter and setting it to '1' if
an exception was delivered to the guest. The return value is 0 or EFAULT so
no additional translation is needed.

Reviewed by:	tychon
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D2428
2015-05-06 16:25:20 +00:00
John Baldwin
5deee724da Remove the note about seekdir() removing telldir() cookies. That was
removed back in r269204.

MFC after:	3 days
2015-05-06 15:30:05 +00:00
John Baldwin
df00427834 A few style fixes and expand the comment a bit on what _fixtelldir() is
doing.
2015-05-06 15:25:20 +00:00
Julian Elischer
af069b0649 Tweak seekdir, telldir and readdir so that when htere are deletes going on,
as seek to teh last location saved will still work. This is needed for Samba
to be able to correctly handle delete requests from windows. This does not
completely fix seekdir when deletes are present but fixes the worst of the
problems. The real solution must involve some changes to the API for eh VFS
and getdirentries(2).

Obtained from:	Panzura inc
MFC after:	1 week
2015-05-05 14:52:33 +00:00
Sergey Kandaurov
3ef1b3b535 Fix major copy/paste and other style errors. 2015-05-05 10:44:17 +00:00
Baptiste Daroussin
5551c57355 Rework PRIVATELIB
Now when a lib is marked as PRIVATELIB it is renamed into libprivate$foo instead
of being installed in /usr/lib/private and playing with rpath.

Also allow to install headers for PRIVATELIBS in that case the headers will be
installed in /usr/include/private/$foo

Keep the headers under a private namespace to prevent third party build system
to easily find them to ensure they are only used on purpose.

This allows for non base applications to statically link against a library in
base which is linked to a privatelib

Treating PRIVATELIBS as regular libraries allows to push them into our current
compatX packages if needed.

While here finish promotion of libevent as PRIVATELIB
Install header for bsdstat and libucl

Differential Revision:	https://reviews.freebsd.org/D2365
Reviewed by:	brooks, des
Discussed with:	imp
2015-05-04 16:28:54 +00:00
John Baldwin
196cd80898 Various updates to the ftruncate(2) documentation:
- Note that ftruncate(2) can operate on shared memory objects and cross
  reference shm_open(2).
- Note that ftruncate(2) does not change the file position pointer (aka
  seek pointer) of the file descriptor.
- ftruncate(2) will fail with EINVAL for all sorts of other fd types than
  just sockets, so instead note that it fails for all but regular files and
  shared memory objects.
- Note that ftruncate(2) also appeared in 4.2BSD along with truncate(2).
  (Or at least the manpage for both appeared in 4.2, I did not check the
  kernel code itself to see if either predated 4.2.)

PR:		199472 (2)
Submitted by:	andrew@ugh.net.au (2)
MFC after:	1 week
2015-05-04 14:47:00 +00:00
John Baldwin
afa94a3f97 Partially revert r255486, the first argument to socketpair() is a socket
domain, not a file descriptor.  Use 'domain' instead of the original 'd'
for this argument to match socket(2).

PR:		199491
Reported by:	sp55aa@qq.com
MFC after:	1 week
2015-05-04 14:23:31 +00:00
Mariusz Zaborski
00173c094e Add test case for unpack with diffrent flags.
Approved by:	pjd (mentor)
2015-05-02 18:07:47 +00:00
Mariusz Zaborski
169c153b59 Introduce the NV_FLAG_NO_UNIQUE flag. When set, it allows to store
multiple values using the same key in a nvlist.

Approved by:	pjd (mentor)
Obtained from:	WHEEL Systems (http://www.wheelsystems.com)

Update man page.

Reviewed by:	AllanJude
Approved by:	pjd (mentor)
2015-05-02 18:03:47 +00:00
Mariusz Zaborski
bd1da0a002 Approved, oprócz użycie RESTORE_ERRNO() do ustawiania errno.
Change the nvlist_recv() function to take additional argument that
specifies flags expected on the received nvlist. Receiving a nvlist with
different set of flags than the ones we expect might lead to undefined
behaviour, which might be potentially dangerous.

Update consumers of this and related functions and update the tests.

Approved by:	pjd (mentor)

Update man page for nvlist_unpack, nvlist_recv, nvlist_xfer, cap_recv_nvlist
and cap_xfer_nvlist.

Reviewed by:	AllanJude
Approved by:	pjd (mentor)
2015-05-02 17:45:52 +00:00
Mark Johnston
93c9677b94 fork(2): Add a note to the effect that kqueue descriptors, unlike other
descriptor types, are not inherited from the parent process.

Reported by:	kmacy
MFC after:	1 week
2015-05-02 00:29:27 +00:00
Baptiste Daroussin
fc0219a1e7 Apply the copyright the the same owners as the original malloc(3) where most of
the text here comes from

Reported by:	many
Discussed with:	miod@OpenBSD.org
Pointyhat to:	bapt
2015-05-01 20:37:59 +00:00
Baptiste Daroussin
5fa137c326 libc now has reallocarray 2015-05-01 18:34:29 +00:00
Baptiste Daroussin
450dfafb15 Import reallocarray(3) from OpenBSD
Add a manpage for it, assign the copyright to the OpenBSD project on it since it
is mostly copy/paste from OpenBSD manpage.
style(9) fixes

Differential Revision:	https://reviews.freebsd.org/D2420
Reviewed by:	kib
2015-05-01 18:32:16 +00:00
Mariusz Zaborski
24f93ee714 Add nvlist_flags() function, which returns nvlist's public flags.
Approved by:	pjd (mentor)
2015-05-01 17:50:24 +00:00
Mariusz Zaborski
041392bc29 Sort MLINKS alphabetically.
Approved by:	pjd (mentor)
2015-05-01 16:41:46 +00:00
Bjoern A. Zeeb
b9dadec087 Unreak DNS usage through libcapsicum, which broke, e.g., ping in r282252
with what looks like a copy and paste error.

Sponsored by:	DARPA/AFRL
2015-05-01 11:56:21 +00:00
Mariusz Zaborski
0bb5e6ef80 Remove the nvlist_.*[fv] functions.
Those functions are problematic, because there is no way to report
memory allocation problems without complicating the API, so we can
either abort or potentially return invalid results. None of which is
acceptable.

In most cases the caller knows the size of the name, so he can allocate
buffer on the stack and use snprintf(3) to prepare the name.

After some discussion the conclusion is to removed those functions,
which also simplifies the API.

Discussed with: pjd, rstone
Approved by:	pjd (mentor)
2015-04-29 22:57:04 +00:00
Mariusz Zaborski
37c6848ce6 Remove the use of nvlist_.*[fv] functions from tests.
Approved by:	pjd (mentor)
2015-04-29 22:46:18 +00:00
Mariusz Zaborski
bed3fb70df Remove the use of nvlist_.*[vf] functions from libcapsicum and replace
them with snprintf(3). Assert the results of snprintf(3).

Approved by:	pjd (mentor)
2015-04-29 22:19:40 +00:00
Warner Losh
c6b992ed3a The presence/absence of CPU features should be tested with
MACHINE_CPUARCH or MACHINE_ARCH, not MACHINE. The latter is for kernel
only things. Also, I think this should be unconditional since all our
architectures have long double support, but I don't have time to test
that thoroughly so just add a comment to that effect.
2015-04-28 14:14:06 +00:00
Enji Cooper
b18bade8c2 Remove per-architecture checks for enabling HAVE_FENV_H
The conditional came from NetBSD, where only select architectures have this
header/support

All architectures on FreeBSD have the necessary support though, so the
conditional's completely unnecessary

make tinderbox done on all architectures (including arm64, where the issue
occurred before) this time

X-MFC with: r282057, r282092
MFC after: 6 days
2015-04-27 18:01:52 +00:00
Marcel Moolenaar
788ca347b8 Upgrade libxo to 0.3.2.
Obtained from:  https://github.com/Juniper/libxo/tree/0.3.2
Requested by: Phil Shafer <phil@juniper.net>

This import incorporates local change 279966.
Local change 276260 has been merged-in.
2015-04-27 17:23:19 +00:00
Andrew Turner
4e78be73ba Correct the spelling of MACHINE_CPUARCH, MACHINE_CPU is not set on arm64. 2015-04-27 13:57:39 +00:00
Andrew Turner
ae99516732 Disable the tests that use makecontext on arm64, it still needs to be
written.
2015-04-27 13:56:20 +00:00
Enji Cooper
1119ece4d3 Build/install libc, librt, libthr, and msun NetBSD test suites on all
architectures

MFC after: 1 week
2015-04-27 06:49:27 +00:00
Baptiste Daroussin
0af928e203 mdoc: fix function declaration 2015-04-26 11:35:36 +00:00
Baptiste Daroussin
fbe7ee53da mdoc: remove empty line 2015-04-26 11:35:07 +00:00
Baptiste Daroussin
84413e5425 Remove end of line whitespace 2015-04-26 11:30:27 +00:00
Baptiste Daroussin
06c00e8bfd mdoc: remove end of line whitespace 2015-04-26 10:56:06 +00:00
Baptiste Daroussin
a2746a445f mdoc: rendering fixes 2015-04-26 10:55:39 +00:00
Baptiste Daroussin
272a3bb29b Use mdoc(7) macros to handle parenthesis 2015-04-26 10:54:52 +00:00
Baptiste Daroussin
583110b719 mdoc: fix functions declarations 2015-04-26 10:53:50 +00:00
Baptiste Daroussin
18c5321d06 Escape "Ed" 2015-04-26 10:52:37 +00:00
Baptiste Daroussin
7acd8260b5 Escape "Ed" 2015-04-26 10:29:43 +00:00
Baptiste Daroussin
b5ed0fe321 Do not modify locales 2015-04-26 09:25:44 +00:00
Jilles Tjoelker
97792364fd libarchive: Allow setting nanosecond timestamps. 2015-04-25 21:25:00 +00:00
Enji Cooper
fba6933f6e Assuming a system has /bin/csh on it is a bad idea (especially it being
optional on FreeBSD). Look for /bin/cat instead

MFC after: 3 days
2015-04-25 04:35:43 +00:00
Enji Cooper
6eec0f2bda Avoid an infinite loop by ensuring that the amount of bytes read is greater
than 0 in MDXFileChunk when calculating the checksum

This edgecase can be triggered if the file is truncated while the checksum
is being calculated (i.e. the EOF is reached)

Differential Revision: https://reviews.freebsd.org/D2351 (patch by darius)
PR: 196694
Reviewed by: delphij, ngie
Submitted by: Daniel O'Connor <darius@dons.net.au>
Sponsored by: EMC / Isilon Storage Division
2015-04-24 11:03:47 +00:00
David Chisnall
710ec77e3a __xlocale_C_ctype should not be const. It contains a reference count that is modified by newlocale / duplocale / freelocale.
MFC after:	1 week
2015-04-24 10:21:20 +00:00
David Chisnall
58912ae7c3 Small changes to locale-related man pages.
Fix a missing .h and change the recommended include for the POSIX2008 functions from xlocale.h to locale.h.  Including xlocale.h is for legacy / Darwin compatibility so should not be encouraged.
2015-04-24 10:17:55 +00:00
John Baldwin
179fa75e6e Reassign copyright statements on several files from Advanced
Computing Technologies LLC to Hudson River Trading LLC.

Approved by:	Hudson River Trading LLC (who owns ACT LLC)
MFC after:	1 week
2015-04-23 14:22:20 +00:00
Ed Maste
15222dc5d6 Reduce diffs between the three copies of libstand's Makefile
This should be a non-functional change.  A future change should
address the functional differences between these three and converge
on a single source.

Differential Revision:	https://reviews.freebsd.org/D2058
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
2015-04-23 14:04:33 +00:00
Michael Tuexen
446734c25e A complete user message is signalled with the MSG_EOR flag, not the MSG_EOF
flag.
Thanks to Valentin Nechayev for reporting the issue.

MFC after: 1 week
2015-04-23 13:10:03 +00:00
Pedro F. Giffuni
e54379826c libgeom: plug memory leak in EndElement.
CID:		1016696
Found by:	Clang static checker
MFC after:	1 week
2015-04-22 22:23:56 +00:00
Pedro F. Giffuni
12eb0bca33 computematchjumps(): fix allocator sizeof operand mismatch.
Mostly cosmetical warning.

Found by:	Clang static analyzer
2015-04-22 17:09:02 +00:00
Pedro F. Giffuni
9acf5917d3 _pthread_cleanup_push: fix allocator sizeof operand mismatch
Same fix appears to be in DragonFly's libthread_xu.

Found by:	Clang Static Analyzer
MFC after:	1 week
2015-04-22 16:51:21 +00:00
Craig Rodrigues
d5fec48956 Support file verification in MAC.
* Add VCREAT flag to indicate when a new file is being created
* Add VVERIFY to indicate verification is required
* Both VCREAT and VVERIFY are only passed on the MAC method vnode_check_open
  and are removed from the accmode after
* Add O_VERIFY flag to rtld open of objects
* Add 'v' flag to __sflags to set O_VERIFY flag.

Submitted by:		Steve Kiernan <stevek@juniper.net>
Obtained from:		Juniper Networks, Inc.
GitHub Pull Request:	https://github.com/freebsd/freebsd/pull/27
Relnotes:		yes
2015-04-22 01:54:25 +00:00
Pedro F. Giffuni
4194e4e371 Fix improbable memory leak in _citrus_prop_read_str().
Found by:	Clang Static Analyzer
2015-04-20 22:09:50 +00:00
Joel Dahl
ac074de850 Minor mdoc fixes. 2015-04-20 21:19:26 +00:00
Konstantin Belousov
a22fc06636 Remove code to support the top of the stack layout for FreeBSD 1.x/2.x
kernel, but keep explanation of the old ps_strings structure to make
it clear what sanity check tries to accomplish.

Noted by:	Oliver Pinter <oliver.pinter@hardenedbsd.org>
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-04-20 09:07:12 +00:00
Konstantin Belousov
0538aafc41 The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), and
pwrite(2) syscalls are wrapped to provide compatibility with pre-7.x
kernels which required padding before the off_t parameter.  The
fcntl(2) contains compatibility code to handle kernels before the
struct flock was changed during the 8.x CURRENT development.  The
shims were reasonable to allow easier revert to the older kernel at
that time.

Now, two or three major releases later, shims do not serve any
purpose.  Such old kernels cannot handle current libc, so revert the
compatibility code.

Make padded syscalls support conditional under the COMPAT6 config
option.  For COMPAT32, the syscalls were under COMPAT6 already.

Remove WITHOUT_SYSCALL_COMPAT build option, which only purpose was to
(partially) disable the removed shims.

Reviewed by:	jhb, imp (previous versions)
Discussed with:	peter
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-04-18 21:50:13 +00:00
Justin Hibbits
a745246822 Implement hwpmc(4) for Freescale e500 core.
This supports e500v1, e500v2, and e500mc. Tested only on e500v2, but the
performance counters are identical across all, with e500mc having some
additional events.

Relnotes:	Yes
2015-04-18 21:39:17 +00:00
Konstantin Belousov
3d0045bb2b Make wait6(2), waitid(3) and ppoll(2) cancellation points. The
waitid() function is required to be cancellable by the standard.  The
wait6() and ppoll() follow the other syscalls in their groups.

Reviewed by:	jhb, jilles (previous versions)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-04-18 21:35:41 +00:00
Ed Maste
95f23d6e36 compiler_rt: add floatunsitf for arm64
It provides unsigned integer to quad-precision conversion.

Sponsored by:	The FreeBSD Foundation
2015-04-16 12:54:28 +00:00
Tijl Coosemans
1243a98e38 Remove the const qualifier from iconv(3) to comply with POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html

Adjust all code that calls iconv.

PR:		199099
Exp-run by:	antoine
MFC after:	2 weeks
2015-04-15 09:09:20 +00:00
Sergey Kandaurov
d359191f7e Remove obsolete bits about maximum number of file systems.
NMOUNT has gone together with static mount table in 4.3BSD-Reno.

MFC after:	1 week
2015-04-12 21:14:58 +00:00
Xin LI
36d99b08a5 For reasons that I am not understand yet, using the libmd version of
SHA256 would make libarchive based application to give:

	archive_read_extract(): Lzma library error: Corrupted input data

(Internally this is LZMA_DATA_ERR)

However, the libmd version of SHA256 is supposed to give same result
as the bundled version do, and xz(1) is not affected.

As a precaution, revert the SHA256 portion of r281316 for now until
we figure out why it breaks libarchive interoperability as we can't
yet rule out this change have introduced an ABI breakage.
2015-04-10 17:21:47 +00:00
Baptiste Daroussin
ea4a4d8a2e Fix overlinking in bhyve:
libvmmapi is actually needed to be linked to libutil, not bhyve nor bhyveload
2015-04-09 21:38:40 +00:00
Baptiste Daroussin
32e5044deb Convert mt(1) and libmt to LIBADD
While here fix missing link to libbsdxml for libmt
Fix overlinking in mt(1)
Make add an indirect libmt dependency on bsdxml to allow static linking if
needed
2015-04-09 21:26:38 +00:00
Xin LI
342bcb1232 MFV r281278:
- Update xz to 5.2.1, where the most visible change is that it
   fixed a compression-ratio regression in fast mode LZMA1 and
   LZMA2 and used cpuset_getaffinity() for CPU cores detection.
 - Make liblzma use the base system SHA256 implementation instead of
   the bundled one.
 - Additional annotation in config.h for FreeBSD specific tweaks.
 - Refresh symbols in XZprivate_1.0 to reflect reality.

Relnotes:	yes
MFC after:	1 month (TBD)
2015-04-09 18:03:27 +00:00
Ed Maste
eade5b3856 compiler-rt: include 128-bit quad precision fp support only on arm64
Other architectures do not use quad precision long double and don't need
these runtime support routines.

Differential Revision:	https://reviews.freebsd.org/D2252
Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
2015-04-08 19:07:06 +00:00
Justin Hibbits
6554d5b421 Fix powerpc setjmp FPR saving/restoring.
X-MFC-With:	r279784
2015-04-08 00:32:39 +00:00
Ed Maste
6853d12d4f compiler-rt: add floatditf and floatunditf
These are long integer (di_int/du_int) to quad precision floating point
conversions. They may be reworked based on upstream discussion. These
versions are here to support arm64 world builds.

Reviewed by:	ed
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2174
2015-04-07 19:31:29 +00:00
Ed Maste
13553dc6bd compiler-rt: Implement multc3 - quad-precision complex multiplication
This may be reworked based on upstream discussion. This version is here
to support arm64 world builds.

Reviewed by:	ed
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2173
2015-04-07 19:28:53 +00:00
Takanori Watanabe
8d6f425ddd Check l2cap socket initialisation and define L2CAP_SOCKET_CHECKED
This will fix build.
2015-04-07 16:48:23 +00:00
Andrew Turner
d422e6f9b5 Add the start of libc and libstand for arm64. Not all of the machine
dependent functions have been implemented, but this is enough for world.

Differential Revision:	https://reviews.freebsd.org/D2132
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2015-04-07 09:52:14 +00:00
John Baldwin
b871bfa1a2 vfork() first appeared in 3BSD which pre-dates 2.9BSD. Verified via the
copy of 3BSD on disc 1 of "The CSRG Archives".

PR:		198612
MFC after:	1 week
2015-04-06 20:40:01 +00:00
Ed Maste
5d93595789 Update reported elftoolchain version to 3179
Missed in r280932
2015-04-06 13:55:33 +00:00
Gleb Smirnoff
56d5e0967c Stop including if_var.h from userland.
Sponsored by:	Nginx, Inc.
2015-04-06 09:42:23 +00:00
Pedro F. Giffuni
3d4c8bbc51 Make strlcpy/strlcat slightly easier to read.
Bring small upstream updates.

Obtained from:	OpenBSD
2015-04-06 03:21:22 +00:00
Adrian Chadd
f6e6460dfc Add support for the MIPS74K SoC family performance counters events.
These are similar to the mips24k performance counters - some are
available on perfcnt0/3, some are available on perfcnt1/4.
However, the events aren't all the same.

* Add the events, named the same as from Linux oprofile.
* Verify they're the same as  "MIPS32(R) 74KTM Processor Core Family
  Software User's Manual"; Document Number: MD00519; Revision 01.05.
* Rename INSTRUCTIONS to something else, so it doesn't clash with
  the alias INSTRUCTIONS.  I'll try to tidy this up later; there
  are a few other aliases to add and shuffle around.

Tested:

* QCA9558 SoC (AP135 board) - MIPS74Kc core (no FPU.)
* make universe; where it didn't fail for other reasons.

TODO:

* It'd be nice to support the four performance counters
  in at least this hardware, rather than just two.

Reviewed by:	bsdimp ("looks good; don't break world".)
2015-04-05 02:57:02 +00:00
Jilles Tjoelker
d30c6f8edf fts: Don't return FTS_SLNONE if it's not a symlink (if race).
When following symlinks, fts returned FTS_SLNONE when fstatat(flag=0)
failed, but a subsequent fstatat(flag=AT_SYMLINK_NOFOLLOW) succeeded. This
incorrectly triggered if a filename existed to be read from the directory,
was deleted before the fstatat(flag=0) and created again after the
fstatat(flag=0).

Fix this by only returning FTS_SLNONE if the result from
fstatat(flag=AT_SYMLINK_NOFOLLOW) is actually a symlink. If it is not a
symlink, treat it as if fstatat(flag=0) succeeded.

PR:		196724
Reported and tested by:	pho
MFC after:	1 week
2015-04-04 20:22:12 +00:00
Ed Maste
541236cf60 libc: Eliminate duplicate copies of __vdso_gettc.c
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2152
2015-04-02 21:18:11 +00:00
Andrew Turner
cd12a51d8d Add stub functions to build libkvm. There will be added, but we need them
now get the toolchain target building.

Differential Revision:	https://reviews.freebsd.org/D2185
Sponsored by:	The FreeBSD Foundation
2015-04-02 17:30:19 +00:00
Edward Tomasz Napierala
522196b5ed Update open(2) to make it more obvious that O_NOCTTY and O_TTY_INIT
are ignored.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-04-02 11:41:04 +00:00
Dimitry Andric
76e2c537bc Ensure the cross assembler, linker and objcopy are used for the build32
stage, just like for the regular world stage.

Reviewed by:	rodrigc, imp, bapt, emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D2187
2015-04-02 06:58:17 +00:00
Konstantin Belousov
1849df3006 Correctly handle __fcntl_compat symbol for the !SYSCALL_COMPAT case.
Both .weak and .alias assembler directives only work when assembling
the file which defines the symbol.

Reported and tested by:	andrew
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-04-01 16:55:30 +00:00
Andrew Turner
f03b8244b4 Add the arm64 parts of libthread_db.
Differential Revision:	https://reviews.freebsd.org/D2184
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2015-04-01 08:37:50 +00:00
Tycho Nightingale
ef7c2a82ed Fix "MOVS" instruction memory to MMIO emulation. Currently updates to
%rdi, %rsi, etc are inadvertently bypassed along with the check to
see if the instruction needs to be repeated per the 'rep' prefix.

Add "MOVS" instruction support for the 'MMIO to MMIO' case.

Reviewed by:	neel
2015-04-01 00:15:31 +00:00
Jilles Tjoelker
2f61288c80 wordexp: Explicitly pass along IFS.
Per Austin group issue #884, sh should not import IFS from the environment
but always set it to $' \t\n'. For wordexp(), however, it is documented and
useful for it to use IFS from the environment.

Since sh currently imports IFS from the environment, this change has no
functional effect.

MFC after:	1 week
2015-03-31 20:51:01 +00:00
Andrew Turner
f734628543 Add the fe* symbols to libm for arm64.
Sponsored by:	The FreeBSD Foundation
2015-03-31 19:07:28 +00:00
Andrew Turner
a7dfee7ab1 Add pthread_md.h for arm64.
Differential Revision:	https://reviews.freebsd.org/D2137
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
2015-03-30 19:10:09 +00:00
Ed Maste
58853f4fb9 Correct mrs_fpcr and mrs_fpsr macros in arm64 fenv.h
Submitted by:	andrew
Sponsored by:	The FreeBSD Foundation
2015-03-30 16:42:08 +00:00
Ed Maste
b4a5ecf64c compiler-rt: Build additional quad precision floating point builtins
These are needed for arm64

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2160
2015-03-30 14:28:31 +00:00
Konstantin Belousov
b072e86d09 Make kevent(2) a cancellation point.
Note that to cancel blocked kevent(2) call, changelist must be empty,
since we cannot cancel a call which already made changes to the
process state.  And in reverse, call which only makes changes to the
kqueue state, without waiting for an event, is not cancellable.  This
makes a natural usage model to migrate kqueue loop to support
cancellation, where existing single kevent(2) call must be split into
two: first uncancellable update of kqueue, then cancellable wait for
events.

Note that this is ABI-incompatible change, but it is believed that
there is no cancel-safe code that relies on kevent(2) not being a
cancellation point.  Option to preserve the ABI would be to keep
kevent(2) as is, but add new call with flags to specify cancellation
behaviour, which only value seems to add complications.

Suggested and reviewed by:	jilles
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-03-29 19:14:41 +00:00
Michael Tuexen
4b2dd7af64 Add an SCTP symbol which was missed in
https://svnweb.freebsd.org/base?view=revision&revision=169622
This fixes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197783
Thanks to Jukka Ukkonen for reporting the bug and providing a fix.

MFC after: 3 days
2015-03-28 09:08:57 +00:00
Jilles Tjoelker
73cc817ec8 setmode(): Use sysctl kern.proc.umask instead of umask() if possible.
The kern.proc.umask.<pid> sysctl allows querying the umask without
temporarily modifying it.
2015-03-26 21:58:06 +00:00
Alexander Motin
5523c82c1a Make GEOM_PART work in presence of previous withered self.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2015-03-26 12:17:47 +00:00
Jung-uk Kim
01ed3ca3de Remove defunct SSLv2 support from fetch(1) and fetch(3). 2015-03-25 18:56:36 +00:00
Luiz Otavio O Souza
4e8058e313 Add the missing manual page link to the recently added function. 2015-03-20 19:29:59 +00:00
Andrew Turner
8daa81674e Start to import support for the AArch64 architecture from ARM. This change
only adds support for kernel-toolchain, however it is expected further
changes to add kernel and userland support will be committed as they are
reviewed.

As our copy of binutils is too old the devel/aarch64-binutils port needs
to be installed to pull in a linker.

To build either TARGET needs to be set to arm64, or TARGET_ARCH set to
aarch64. The latter is set so uname -p will return aarch64 as existing
third party software expects this.

Differential Revision:	https://reviews.freebsd.org/D2005
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2015-03-19 13:53:47 +00:00
Andrew Turner
667a4af397 We won't support a.out on arm64/aarch64. As such there will be no need to
support it in nlist(3).

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2015-03-18 13:54:53 +00:00
Bryan Drewery
215d02b78c Add LIB_CXX so that C++ libraries will use CXX to link.
This fixes C++ libraries not implicitly linking in libc++.  This is
generally not an issue because the final linking with the compiled binary
will involve CXX via PROG_CXX or other means.  It is however
inconsistent with libraries implicitly linking in libc and problematic
for trying to build libraries with '-z defs' to ensure all direct
dependencies are linked in.

libatf-c++ is currently the only consumer of this new feature.

Differential Revision:	https://reviews.freebsd.org/D2039
Reviewed by:	imp
Discussed with:	bapt
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-03-17 15:16:36 +00:00
Dimitry Andric
e0125cfdd1 Merge ^/head r279893 through r279984. 2015-03-14 13:08:00 +00:00
Dimitry Andric
25e141edd2 Pull in r231965 from upstream compiler-rt trunk (by Jörg Sonnenberger):
Refactor float to integer conversion to share the same code.
  80bit Intel/PPC long double is excluded due to lacking support
  for the abstraction. Consistently provide saturation logic.
  Extend to long double on 128bit IEEE extended platforms.

  Initial patch with test cases from GuanHong Liu.
  Reviewed by Steve Canon.

  Differential Revision: http://reviews.llvm.org/D2804

Pull in r232107 from upstream compiler-rt trunk (by Ed Maste):

  Use signed int implementation for __fixint

Requested by:	emaste
2015-03-14 12:40:19 +00:00
Pedro F. Giffuni
cf0f0b800c libc: plug memory leaks in edge cases for the posix1e code.
CID:	1016705
CID:	1016706
CID:	1016707

Differential Revision:	https://reviews.freebsd.org/D2023
2015-03-13 18:42:43 +00:00
John Baldwin
ad06e987b1 The System V ABI for amd64 allows functions to use space in a 128 byte
redzone below the stack pointer for scratch space and requires
interrupt and signal frames to avoid overwriting it. However, EFI uses
the Windows ABI which does not support this. As a result, interrupt
handlers in EFI push their interrupt frames directly on top of the
stack pointer. If the compiler used the red zone in a function in the
EFI loader, then a device interrupt that occurred while that function
was running could trash its local variables.  In practice this happens
fairly reliable when using gzipfs as an interrupt during decompression
can trash the local variables in the inflate_table() function
resulting in corrupted output or hangs.

Fix this by disabling the redzone for amd64 EFI binaries. This
requires building not only the loader but any libraries used by the
loader without redzone support.

Thanks to Jilles for pointing me at the redzone once I found the stack
corruption.

Differential Revision:	https://reviews.freebsd.org/D2054
Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	Cisco Systems, Inc.
2015-03-13 09:38:16 +00:00
Stanislav Sedov
0faaddb8db Fix debug symbols loading in libproc: 0 is a valid file descriptor.
Reported by:	Chris Torek <chris.torek@gmail.com>
2015-03-13 04:26:48 +00:00
John Baldwin
498046a190 Spin the twiddle in dosfs to give visual feedback for disk I/O on
FAT filesystems as is done for other filesystems in the loader.

MFC after:	1 week
2015-03-12 17:10:04 +00:00
Dimitry Andric
a857c4c833 Merge ^/head r279759 through r279892. 2015-03-11 19:04:01 +00:00
Michael Tuexen
59b6d5be4e Add a SCTP socket option to limit the cwnd for each path.
MFC after: 1 month
2015-03-10 19:49:25 +00:00
Steve Kargl
186f620727 According to POSIX.1-2008, the Bessel functions of second kind
should raise a divide-by-zero floating point exception for x = +-0
and an invalid floating point exception for x < 0 including x = -Inf.
Update the code to raise the exception and update the documentation
with hopefully better description of the behavior.

Reviewed by:	bde (code only)
2015-03-10 17:10:54 +00:00
Ryan Stone
bc0ad9a99d Fix Ivy Bridge+ MEM_UOPS_RETIRED counters
The MEM_UOPS_RETIRED actually work the same way as the Sandy
Bridge counters, but the counters were documented in a different
way and that seemed to cause the Ivy Bridge counters to be
implemented incorrectly.  Use the same counter definitions as
Sandy Bridge.  While I'm here, rename the counters to match
what's documented in the datasheet.

Differential Revision:	https://reviews.freebsd.org/D1590
MFC after:	1 month
Sponsored by:	Sandvine Inc.
2015-03-10 01:24:08 +00:00
Ryan Stone
ae9975db34 Use the correct event table for Haswell Xeon events
Differential Revision:	https://reviews.freebsd.org/D1588
MFC after:	1 month
Sponsored by:	Sandvine Inc.
2015-03-10 01:23:55 +00:00
Ryan Stone
9e60f3acd2 Fix Sandy Bridge+ hwpmc branch counters
On Sandy Bridge and later, to count branch-related events you
have to or together a mask indicating the type of branch
instruction to count (e.g. direct jump, branch, etc) and a bits
indicating whether to count taken and not-taken branches.  The
current counter definitions where defining this bits individually,
so the counters never worked and always just counted 0.

Fix the counter definitions to instead contain the proper
combination of masks.  Also update the man pages to reflect the
new counters.

Differential Revision:	https://reviews.freebsd.org/D1587
MFC after:	1 month
Sponsored by:	Sandvine Inc.
2015-03-10 01:23:47 +00:00
Ryan Stone
f1ec0939ec Add manpage for Haswell Xeon pmc implementation
Differential Revision:	https://reviews.freebsd.org/D1584
Reviewed by:	gnn
MFC After:	1 month
Sponsored by:	Sandvine Inc
2015-03-10 01:22:43 +00:00
Jung-uk Kim
be070eb896 Fix a typo in comment and explain the reason. 2015-03-09 20:26:42 +00:00
Nathan Whitehorn
78f38c60bc Fix loader on PowerPC following r279784. It turns out that, due to .PATH
confusion, the _setjmp.S in libstand was never being used and was instead
being shadowed by the libc version. Since the libc version now uses FPRs,
it caused loader to crash.
2015-03-09 02:19:44 +00:00
Luiz Otavio O Souza
5126a47396 Fix contraction and unnecessary commas in function arguments.
Found with mandoc and igor.
2015-03-08 21:17:56 +00:00
Nathan Whitehorn
1ee3532451 Save and restore non-volatile floating-point registers during longjmp().
This should also save and restore non-volatile Altivec registers, but that
needs to wait on solving two problems:
1. Adding the nonvolatile vector registers means we need 5 more than _JBLEN
   entries in jmp_buf on 32-bit targets (64-bit is OK).
2. Need to figure out how to determine if saving/restoring vector regs
   is supported on the current CPU from userland.

MFC after:	1 month
2015-03-08 19:37:08 +00:00
Luiz Otavio O Souza
d752f0f69d Add a new ioctl to allow the setting of GPIO pin names.
When a gpiobus child is added, use its name to identify the mapped pin
names.

Make the respective changes to libgpio.

Add a new '-n' flag to gpioctl(8) to set the pin name.

Differential Revision:	https://reviews.freebsd.org/D2002
Reviewed by:	rpaulo
Requested by:	many
2015-03-08 00:47:50 +00:00
Dimitry Andric
bf5d6cf0a9 Fix lib/libnv tests compilation with -std=c++11, by adding appropriate
casts for NULL to invocations of the ATF_REQUIER_EQ() macro.

Reviewed by:	rstone, jmmv
Differential Revision: https://reviews.freebsd.org/D2027
2015-03-08 00:30:52 +00:00
Dimitry Andric
6404f697a0 Merging ^/head r279596 through r279758. 2015-03-07 23:01:27 +00:00
John-Mark Gurney
32d52c275d forgot to bump date, and replace contraction (igor)... 2015-03-07 03:48:32 +00:00
John-Mark Gurney
4a46673183 make things a bit more clear.. we worked together on language..
Submitted by:	Justin Cormack
2015-03-06 23:17:18 +00:00
Pedro F. Giffuni
b3d078e666 compat_passwd(): yet another uninitialized access to stayopen.
CID:	1018731
2015-03-06 22:22:57 +00:00
Pedro F. Giffuni
2eaea119b8 qsort(3): small style(9) cleanups.
Basically spaces vs. tabs.
No functional change.
2015-03-05 17:17:11 +00:00