Commit Graph

7482 Commits

Author SHA1 Message Date
Jilles Tjoelker
8dd985befe Enable utimensat tests from NetBSD.
As with other tests from c063, a required #include <sys/stat.h> was missing.
2015-01-24 15:49:40 +00:00
Jilles Tjoelker
2205e0d1bd Add futimens and utimensat system calls.
The core kernel part is patch file utimes.2008.4.diff from
pluknet@FreeBSD.org. I updated the code for API changes, added the manual
page and added compatibility code for old kernels. There is also audit and
Capsicum support.

A new UTIME_* constant might allow setting birthtimes in future.

Differential Revision:	https://reviews.freebsd.org/D1426
Submitted by:	pluknet (partially)
Reviewed by:	delphij, pluknet, rwatson
Relnotes:	yes
2015-01-23 21:07:08 +00:00
Konstantin Belousov
677258f7e7 Add procctl(2) PROC_TRACE_CTL command to enable or disable debugger
attachment to the process.  Note that the command is not intended to
be a security measure, rather it is an obfuscation feature,
implemented for parity with other operating systems.

Discussed with:	jilles, rwatson
Man page fixes by:	rwatson
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-18 15:13:11 +00:00
Will Andrews
7a37b5fc17 Add a ${CP} alias for copying files in the build.
Some users build FreeBSD as non-root in Perforce workspaces.  By default,
Perforce sets files read-only unless they're explicitly being edited.
As a result, the -f argument must be used to cp in order to override the
read-only flag when copying source files to object directories.  Bare use of
'cp' should be avoided in the future.

Update all current users of 'cp' in the src tree.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	Spectra Logic
2015-01-16 21:39:08 +00:00
Ed Maste
4b12fb6103 Remove duplicate copies of trivial getcontextx.c
Only i386 and amd64 provide a non-trivial __getcontextx(). Use a common
trivial implementation in gen/ for other architectures, rather than
copying the file to each MD subdirectory.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D1472
2015-01-12 18:13:38 +00:00
Konstantin Belousov
397d851d66 Reduce the size of the interposing table and amount of
cancellation-handling code in the libthr.  Translate some syscalls
into their more generic counterpart, and remove translated syscalls
from the table.

List of the affected syscalls:
creat, open -> openat
raise -> thr_kill
sleep, usleep -> nanosleep
pause -> sigsuspend
wait, wait3, waitpid -> wait4

Suggested and reviewed by:	jilles (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-11 22:16:31 +00:00
Dimitry Andric
18ecc14c78 Apparently more Makefiles use stuff from compiler-rt, so fix them up
too.  (This did not show during a make universe, strangely.)
2015-01-08 20:11:38 +00:00
John Baldwin
e275993995 Document CPU_WHICH_DOMAIN and bump Dd for cpuset.1.
Missed in:	r276829
2015-01-08 18:53:11 +00:00
Craig Rodrigues
9cebfb86a7 Clarify text to be consistent with nanosleep(2),
since sleep(3) is implemented in terms of nanosleep(2).

This is similar to the sleep(3) man page for Darwin.
2015-01-08 01:27:43 +00:00
Justin Hibbits
85eda151ff Avoid use of register variables. Clang 3.5 treats this as undefined behavior,
and bad things happen.

MFC after:	1 week
2015-01-06 03:50:43 +00:00
Konstantin Belousov
1a744fefc2 Avoid calling internal libc function through PLT or accessing data
though GOT, by staticizing and hiding.  Add setter for
__error_selector to hide it as well.

Suggested and reviewed by:	jilles
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-05 01:06:54 +00:00
Joel Dahl
f636caf195 mdoc: paragraph improvements. 2015-01-04 12:49:24 +00:00
Konstantin Belousov
8495e8b1e9 Fix known issues which blow up the process after dlopen("libthr.so")
(or loading a dso linked to libthr.so into process which was not
linked against threading library).

- Remove libthr interposers of the libc functions, including
  __error(). Instead, functions calls are indirected through the
  interposing table, similar to how pthread stubs in libc are already
  done.  Libc by default points either to syscall trampolines or to
  existing libc implementations.  On libthr load, libthr rewrites the
  pointers to the cancellable implementations already in libthr.  The
  interposition table is separate from pthreads stubs indirection
  table to not pull pthreads stubs into static binaries.

- Postpone the malloc(3) internal mutexes initialization until libthr
  is loaded.  This avoids recursion between calloc(3) and static
  pthread_mutex_t initialization.

- Reinstall signal handlers with wrapper on libthr load.  The
  _rtld_is_dlopened(3) is used to avoid useless calls to sigaction(2)
  when libthr is statically referenced from the main binary.

In the process, fix openat(2), swapcontext(2) and setcontext(2)
interposing.  The libc symbols were exported at different versions
than libthr interposers.  Export both libc and libthr versions from
libc now, with default set to the higher version from libthr.

Remove unused and disconnected swapcontext(3) userspace implementation
from libc/gen.

No objections from:	deischen
Tested by:	pho, antoine (exp-run) (previous versions)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-03 18:38:46 +00:00
Konstantin Belousov
0e521992a4 Add rtld private interface for dso to detect dynamic loading
vs. static linking.

Tested by:	pho, antoine (exp-run)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-03 18:09:53 +00:00
Jilles Tjoelker
d79f904ad2 Link lib/libc/c063 tests to the build.
Some files lack required #include <sys/stat.h>. The #ifdef is per ngie's
request; the includes are clearly necessary for struct stat.

The faccessat test fails because it tries to use AT_SYMLINK_NOFOLLOW with
faccessat(), which is not specified by POSIX.1-2008.

Differential Revision:	https://reviews.freebsd.org/D1411
Reviewed by:	ngie
2015-01-02 22:49:05 +00:00
Enji Cooper
97e4ab0905 Don't install h_raw if dealing with clang 3.5.0+ to unbreak the tests2 Jenkins
job

The h_raw application doesn't do proper bounds checking without the option
being supplied via the build, which means that it doesn't throw signals and
fail as expected

PR: 196430
X-MFC with: r276479
2015-01-02 05:40:02 +00:00
Joel Dahl
f7e00d4bbd mdoc: remove EOL whitespace. 2014-12-29 13:50:59 +00:00
Enji Cooper
70cf851cc5 Build/install lib/libc/tests/hash/t_sha2 if MK_OPENSSL == yes
Reported by: Beeblebrox <zaphod@berentweb.com>
2014-12-27 20:48:36 +00:00
Joel Dahl
4990a1c050 mdoc: improvements to SEE ALSO. 2014-12-27 08:31:52 +00:00
Christian Brueffer
0aee91e1fb Various mdoc fixes and a few EOL whitespace removals.
Found with:	mandoc -Tlint
2014-12-21 12:36:36 +00:00
Xin LI
cfbebadc60 Plug a memory leak.
Obtained from:	DragonFlyBSD (commit 5119ece)
MFC after:	2 weeks
2014-12-19 06:48:47 +00:00
Michael Tuexen
2b8a4d8033 Initilize the msg_flags field consistently in all code paths.
Reported by:	Coverity
CID:		1018726
2014-12-17 07:47:25 +00:00
Bryan Drewery
4bb90cbe18 Bump Dd for r275846
MFC after:	3 weeks
2014-12-17 01:36:00 +00:00
Kirk McKusick
27ae6f4af7 Add some additional clarification and fix a few gammer nits.
Reviewed by: kib
MFC after:   3 weeks
2014-12-17 01:32:27 +00:00
Konstantin Belousov
19eaed5353 Markup fixes for kqueue(2), no content changes.
Reviewed by:	brueffer (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2014-12-15 14:58:10 +00:00
Jun Kuriyama
d38b156d2e Fix incorrect type of "invalids" argument in __iconv() prototype. 2014-12-15 14:36:04 +00:00
Konstantin Belousov
237623b028 Add a facility for non-init process to declare itself the reaper of
the orphaned descendants.  Base of the API is modelled after the same
feature from the DragonFlyBSD.

Requested by:	bapt
Reviewed by:	jilles (previous version)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2014-12-15 12:01:42 +00:00
Edward Tomasz Napierala
c6033229fc Fix quick_exit(3) manual page to match reality - the status was missing.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-12-13 21:13:28 +00:00
Michael Tuexen
0d958bd47a Fix a typo reported by Lennart Grahl.
MFC after: 3 days
2014-12-10 14:50:57 +00:00
Xin LI
805288c2f0 In r268924 __fflush was modified so that when write(2) was not successful,
_p and _w are adjusted to account for the partial write (if any).

However, _p and _w should not be unconditionally adjusted and should only
be changed when we actually wrote some bytes, or the accumulated accounting
error will eventually result in a heap buffer overflow.

Reported by:	adrian and alfred (Norse Corporation)
Security:	FreeBSD-SA-14:27.stdio
Security:	CVE-2014-8611
2014-12-10 08:18:22 +00:00
Andrew Turner
a215cdfdb0 Switch to the ARM unified assembly language as the clang integrated as only
supports it. Binutils supports it when the ".syntax unified" directive
is set.

Sponsored by:	ABT Systems Ltd
2014-11-29 15:56:52 +00:00
Ed Maste
d4287c3092 ANSIfy b64_pton 2014-11-27 02:15:35 +00:00
Xin LI
52e05d9a24 Reinstitate send() after syslogd restarts.
In r228193 the test of CONNPRIV have been moved to before the _usleep
and send in vsyslog().  When syslogd restarts, this would prevent the
message being logged after the disconnect/connect dance for
scenario #1.

PR:		194751
Submitted by:	Peter Creath <pjcreath+freebsd gmail com>
Reviewed By:	glebius
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D1227
2014-11-25 20:59:22 +00:00
Ed Maste
333cabbec5 Fix b64_pton output buffer overrun test for exact-sized buffer
b64_pton would sometimes erroneously fail to decode a base64 string into
a precisely sized buffer. The overflow check was a little too greedy.

Reported by:	Ted Unangst on freebsd-hackers@
Reviewed by:	loos, trasz
Obtained from:	OpenBSD
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D1218
2014-11-25 18:39:37 +00:00
Sergey Kandaurov
ac071896d1 Fix ifa_data description.
PR:		176583
Discussed with:	glebius
MFC after:	1 week
Sponsored by:	Nginx, Inc.
2014-11-25 15:09:34 +00:00
Baptiste Daroussin
6b129086dc Convert libraries to use LIBADD
While here reduce a bit overlinking
2014-11-25 11:07:26 +00:00
Dag-Erling Smørgrav
83804ea074 The fallback flag in nsdispatch prevents the fallback implementation of
getgroupmembership() from invoking the correct backend in the compat case.
Replace it with a nesting depth counter so it only blocks one level (the
first is the group -> group_compat translation, the second is the actual
backend).  This is one of two bugs that break getgrouplist() in the compat
case, the second being that the backend's own getgroupmembership() method
is ignored.  Unfortunately, that is not easily fixable without a redesign
of our nss implementation (which is also needed to implement the +@group
syntax in /etc/passwd).

PR:		190055
MFC after:	1 week
2014-11-25 09:47:15 +00:00
Ed Maste
294246bb7d Revert r274772: it is not valid on MIPS
Reported by:	sbruno
2014-11-25 03:50:31 +00:00
Dimitry Andric
519195e820 For now, disable using -fsanitize=bounds for the libc ssp tests, when
using clang 3.5.0, until the runtime support (via compiler-rt) is added.
Otherwise, this would lead to link errors about missing support
libraries.
2014-11-24 20:07:09 +00:00
Baptiste Daroussin
2c900f1907 Ta is only allowed with Bl -column not in Bl -item 2014-11-23 23:35:16 +00:00
Joel Dahl
d4d112e34a Misc mdoc fixes:
- Remove superfluous paragraph macros.
- Remove/fix empty or incorrect macros.
- Sort sections into conventional order.
- Terminate quoted strings properly.
- Remove EOL whitespace.
2014-11-23 21:00:00 +00:00
Brooks Davis
1e7bf26b33 Add FPU support for MIPS setjmp(3)/longjmp(3).
This change saves/restores the callee-saved MIPS floating point
registers as documented by the o32/n32/n64 spec ("MIPSpro N32
ABI Handbook", Table 2-1) for the _setjmp(3), _longjmp(3),
setjmp(3) and longjmp(3) C library functions.  This is only
included when the C library is built with hardware floating point
support (or when "SOFTFLOAT" is not defined).

Submitted by:	sson
MFC after:	1 month
Sponsored by:	DARPA, AFRL
2014-11-21 20:02:06 +00:00
Ed Maste
688fd61ae8 Use canonical __PIC__ flag
It is automatically set when -fPIC is passed to the compiler.

Reviewed by:	dim, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D1179
2014-11-21 02:05:48 +00:00
Edward Tomasz Napierala
c07b9c32f0 Remove acl_size.c; apparently it was never used.
PR:		194398
Submitted by:	ngie@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-19 19:43:39 +00:00
Enji Cooper
53cecec82e Convert tools/regression/lib/libc/stdio/test-fpclassify into an ATF testcase and
Rename as lib/libc/stdio/fpclassify2_test

Sponsored by: EMC / Isilon Storage Division
2014-11-16 20:29:57 +00:00
Enji Cooper
41a3b1244b Convert tools/regression/lib/libc/stdio/test-fmemopen into an ATF testcase and
rename as lib/libc/stdio/fmemopen2_test

Sponsored by: EMC / Isilon Storage Division
2014-11-16 19:57:47 +00:00
Enji Cooper
37074d966d Convert tools/regression/lib/libc/gen/test-arc4random into an ATF testcase and
rename as lib/libc/gen/arc4random_test

Sponsored by: EMC / Isilon Storage Division
2014-11-16 07:55:28 +00:00
Dmitry Chagin
186d9c3473 Add the ppoll() system call.
Export kern_poll() needed by an upcoming Linuxulator change.

Differential Revision:	https://reviews.freebsd.org/D1133
Reviewed by:	kib, wblock
MFC after:	1 month
2014-11-13 05:26:14 +00:00
Alexander V. Chernikov
603eaf792b Renove faith(4) and faithd(8) from base. It looks like industry
have chosen different (and more traditional) stateless/statuful
NAT64 as translation mechanism. Last non-trivial commits to both
faith(4) and faithd(8) happened more than 12 years ago, so I assume
it is time to drop RFC3142 in FreeBSD.

No objections from:	net@
2014-11-09 21:33:01 +00:00
Enji Cooper
2f1217877e Add reachover Makefiles for contrib/netbsd-tests/lib/libc; this adds approximately
500 new testcases

Various TODOs have been sprinkled around the Makefiles for items that even need
to be ported (missing features), testcases have issues with building/linking, or
issues at runtime.

A variant of this code has been tested extensively on amd64 and i386
10-STABLE/11-CURRENT for several months without issue. It builds on other
architectures, but the code will remain off until I have prove it works on
virtual hardware or real hardware on other architectures

In collaboration with: pho, Casey Peel <casey.peel@isilon.com>
Sponsored by: EMC / Isilon Storage Division
2014-11-04 00:56:25 +00:00