Commit Graph

17136 Commits

Author SHA1 Message Date
Ruslan Bukin
7dd3aed9c9 Add support for RISC-V ISA.
Reviewed by:	andrew
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D5040
2016-01-24 12:10:29 +00:00
Ed Maste
5abb4cd79f Use MAN= to specify that no man page is provided
NO_MAN is deprecated.

Reviewed by:	imp
2016-01-22 21:33:27 +00:00
Warren Block
c18d8171a6 Add a standards compliance note for strtok_r as suggested by cpercival.
Reviewed by:	cpercival
MFC after:	1 week
2016-01-22 20:36:03 +00:00
Jilles Tjoelker
afa04e4170 sem: Don't free nameinfo that is still in list when open() fails.
This bug could be reproduced easily by calling sem_open() with O_CREAT |
O_EXCL on a semaphore that is already open in the process. The struct
sem_nameinfo would be freed while still in sem_list and later calls to
sem_open() or sem_close() could access freed memory.

PR:		206396
MFC after:	5 days
2016-01-22 14:52:31 +00:00
Brooks Davis
af6f4233fd Replace the last non-optional use of sbrk() in the tree with mmap().
All gmon want's is a region of memory without the overhead of malloc().
Just mapping some pages with mmap is an easy way to accomplish this.

Approved by:	jhb, cem, emaste
Obtained from:	CheriBSD (bf33e1e70b)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D5005
2016-01-21 18:17:19 +00:00
Brooks Davis
1e3a2e82aa Fix the implementations of PSEUDO_NOERROR and PSEUDO.
The PSEUDO* macros should not declare <syscall>, only _<syscall> and
__sys_<syscall>.  This was causing the interposing C wrappers to be
ignored due to link order.

Reviewed by:	kib
Obtained from:	CheriBSD (4e8e13c90f)
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D4097
2016-01-21 17:29:01 +00:00
Andrew Turner
9beacb6f22 Disable -mlong-calls for the clang libraries for now, it increases the
size of the clang binary for people with a crt1.o from before r293832.
2016-01-21 12:59:54 +00:00
Bryan Drewery
628c4b98fb Add .NOMETA missed in r291320.
Sponsored by:	EMC / Isilon Storage Division
2016-01-20 20:58:42 +00:00
John Baldwin
c560a31571 Update for API changes in OpenSSH 6.8p1.
First, the authfd API now uses a direct file descriptor for the control
socket instead of a more abstract AuthenticationConnection structure.
Second, the functions now consistently return an error value.

Reviewed by:	bdrewery
2016-01-20 00:26:50 +00:00
Baptiste Daroussin
f16550ad09 Test for /etc/ssl/cert.pem existence to avoid masking SSL_CA_CERT_PATH
Prior to this patch, unless SSL_CA_CERT_FILE is set in the environment,
libfetch will set the CA file to "/usr/local/etc/cert.pem" if it exists,
and to "/etc/ssl/cert.pem" otherwise. This has the consequence of
masking SSL_CA_CERT_PATH, because OpenSSL will ignore the CA path if a CA
file is set but fails to load (see X509_STORE_load_locations()).

While here, fall back to OpenSSL defaults if neither SSL_CA_CERT_FILE nor
SSL_CA_CERT_PATH are set in the environment, and if neither of the
libfetch default CA files exists.

PR:		193871
Submitted by:	John W. O'Brien <john@saltant.com>
Approved by:	des
MFC after:	1 week
2016-01-19 15:02:37 +00:00
Ed Maste
d47c0c97de Update elftc version to 3272M, imported in r292120 2016-01-18 21:53:39 +00:00
Joel Dahl
5837aafd13 mdoc: sort Xr 2016-01-18 20:21:38 +00:00
Ruslan Bukin
2ca92170c4 Fix compilation on MIPS (typo introduced in r294227). 2016-01-18 09:36:10 +00:00
Jilles Tjoelker
9ff8318f65 utimensat(2): Correct description of [EINVAL] error.
MFC after:	4 days
2016-01-17 21:14:27 +00:00
Ruslan Bukin
0bfee92849 Bring in initial libc and libstand support for RISC-V.
Reviewed by:	andrew, emaste, kib
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D4943
2016-01-17 15:21:23 +00:00
Svatopluk Kraus
effb4b3c8c Add mmu format info into ARM vmcore.
Fix kvatop translation for 64K pages.

Reviewed by:	jhb
Approved by:	kib (mentor)
Differential Revision:    https://reviews.freebsd.org/D4942
2016-01-15 18:53:06 +00:00
Jonathan T. Looney
492e9ee5a9 Improvements to the MDXFileChunk() template function:
- Remove unneeded fstat()/lseek() calls.
- Return NULL and set errno to EINVAL on negative length.
- Fix small style problems and expand variable names.

After this change, it is possible to use this code for some irregular
files. For example, 'md5 /dev/md0' should now succeed.

Differential Revision:	https://reviews.freebsd.org/D4748
Suggested by:	bde
Reviewed by:	bde, allanjude, delphij
2016-01-14 21:08:23 +00:00
Andrew Turner
c455b92483 Set -mlong-calls where needed to get a static clang and lldb 3.8.0
linking. These are too large for a branch instruction to branch from an
earlier point in the code to somewhere later.

This will also allow these to be build with Thumb-2 when we get this
infrastructure.

Reviewed by:	dim
Differential Revision:	https://reviews.freebsd.org/D4855
2016-01-14 19:00:13 +00:00
John Baldwin
2f9e579166 Fix building with GCC since PAGE_MASK is signed on i386.
Reviewed by:	ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D4772
2016-01-14 15:51:13 +00:00
Ed Schouten
3196923796 Remove an unneeded assignment of the return value.
tdelete() is supposed to return the address of the parent node that has
been deleted. We already keep track of this node in the loop between
lines 94-107. The GO_LEFT()/GO_RIGHT() macros are used later on as well,
so we must make sure not to change it to something else.
2016-01-14 07:27:42 +00:00
Devin Teske
9e35cfced5 Default to en_US.ISO8859-1 if no locale
MFC after:	3 days
X-MFC-to:	stable/10
2016-01-14 01:59:20 +00:00
Kevin Lo
c911734adb - Add the 'restrict' type qualifier to match function prototype.
- Remove sys/types.h.
2016-01-14 01:33:16 +00:00
Eric van Gyzen
8e402f34b9 libthr: const-ify two variables
Make the default umutex and urwlock initializers const,
because they can be, and as a microoptimization.

MFC after:	5 days
Sponsored by:	Dell Inc.
2016-01-13 22:34:55 +00:00
Brooks Davis
216818a1bb Avoid reading pass the end of the source buffer when it is not NUL
terminated.

If this buffer is adjacent to an unmapped page or a version of C with
bounds checked is used this may result in a crash.

PR:		206178
Submitted by:	Alexander Cherepanov <cherepan@mccme.ru>
MFC after:	1 week
2016-01-13 21:50:08 +00:00
Brooks Davis
cd3dbc2573 Avoid reading pass the end of the source buffer when it is not NUL
terminated.

If this buffer is adjacent to an unmapped page or a version of C with
bounds checked is used this may result in a crash.

PR:		206177
Submitted by:	Alexander Cherepanov <cherepan@mccme.ru>
MFC after:	1 week
2016-01-13 21:49:01 +00:00
Andrew Turner
fafb1ee7bd Remove the compat code to handle the kernel passing us an unalinged
stackpointer. Userland expects the kernel to pass it an aligned sp and
pass a pointer to the arguments in x0. The kernel side was updated in
r289502, 3 months ago.

Sponsored by:	ABT Systems Ltd
2016-01-13 15:54:17 +00:00
Jilles Tjoelker
b956ae7c20 Update futimens/utimensat for MFC to stable/10:
* Fix __FreeBSD_version check.
* Update history section in man page.

An MFC of this commit to stable/10 will allow using the new system calls
instead of the fallback.

MFC after:	3 days
2016-01-12 20:53:57 +00:00
Enji Cooper
c16d674c2d Fix a mismerge from NetBSD in r162194 with xdr_rpcb_entry_list_ptr(..)
This fixes the potential NULL pointer dereference properly, and also fixes
memory leaks encountered in the process of iterating through `*rp`.

MFC after: 1 week
Found by: Valgrind
Reported by: Dan Roberts <dan.roberts@isilon.com>
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
Sponsored by: EMC / Isilon Storage Division
2016-01-12 00:20:57 +00:00
Enji Cooper
7f3159edc5 Similar to r293704, fix theoretical leak of netconfig(3) resources in
__rpcbind_is_up(..) if getnetconfig(3) is partly successful in allocating
resources, but not completely successful by moving the endnetconfig(3) call
up before we return from the function if nconf == NULL.

MFC after: 1 week
Reported by: Coverity
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
Sponsored by: EMC / Isilon Storage Division
2016-01-11 22:01:33 +00:00
Enji Cooper
d140ec33c7 Fix theoretical leak of netconfig(3) resources in svcunix_create(..)
In the event that the getconfig(3) call in svcunix_create is partly successful,
some of the netconfig(3) resources allocated might be leaked if the call returns
NULL as endnetconfig(3) wasn't called explicitly in that case. Ensure that the
resources are fully cleaned up by going to the `done` label, which will call
endnetconfig(3) for us.

MFC after: 1 week
Reported by: Coverity
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
Sponsored by: EMC / Isilon Storage Division
2016-01-11 21:56:53 +00:00
Andrew Turner
84eacaf728 Use -mlong-calls to build crt1.o and gcrt1.o. This tells the compiler to
generate code to branch based on an address in a register. This allows us
to have binaries larger than the 32MiB limit of a branch instruction.

The main use of this is with clang. Clang 3.8.0 has been shown to be larger
than the above limit.
2016-01-10 23:41:31 +00:00
Andrey V. Elsukov
6299675b9f Make tohex() work as expected. 2016-01-09 08:04:29 +00:00
Andrey V. Elsukov
06ddd0b7ac Fix a typo.
PR:		205722
2016-01-09 08:02:35 +00:00
Gleb Smirnoff
2bab0c5535 New sendfile(2) syscall. A joint effort of NGINX and Netflix from 2013 and
up to now.

The new sendfile is the code that Netflix uses to send their multiple tens
of gigabits of data per second. The new implementation features asynchronous
I/O, when I/O operations are launched, but not awaited to be complete. An
explanation of why such behavior is beneficial compared to old one is
going to be too long for a commit message, so we will skip it here.

Additional features of new syscall are extra flags, which provide an
application more control over data sent. The SF_NOCACHE flag tells
kernel that data shouldn't be cached after it was sent. The SF_READAHEAD()
macro allows to specify readahead size in pages.

The new syscalls is a drop in replacement. No modifications are required
to applications. One can take nginx binary for stable/10 and run it
successfully on head. Although SF_NODISKIO lost its original sense, as now
sendfile doesn't block, and now means something completely different (tm),
using the new sendfile the old way is absolutely safe.

Celebrates:	Netflix global launch!
Sponsored by:	Nginx, Inc.
Sponsored by:	Netflix
Relnotes:	yes
2016-01-08 20:34:57 +00:00
Devin Teske
eb581ab54a Bump copyright (forgotten part of r293340)
MFC after:	3 days
X-MFC-to:	stable/10
X-MFC-with:	r293340
2016-01-07 22:13:17 +00:00
Bryan Drewery
e3ebb82118 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	EMC / Isilon Storage Division
2016-01-07 19:58:23 +00:00
Bryan Drewery
25e85b1fbc Don't install /usr/include/stand.h twice after r293040.
Only install it from lib/libstand.

Sponsored by:	EMC / Isilon Storage Division
2016-01-07 19:19:23 +00:00
Devin Teske
ca1c025222 Increase maximum buffer size for `-x cmd' value
MFC after:	3 days
X-MFC-to:	stable/10
2016-01-07 18:50:02 +00:00
Bryan Drewery
f99c0d1382 Add in DIRDEPS_BUILD support.
Sponsored by:	EMC / Isilon Storage Division
2016-01-07 00:19:30 +00:00
Ed Maste
4053652b92 Add fls() to libstand
Although we don't use it in tree yet libstand is installed as user-
facing /usr/liblibstand.a, and some work in progress makes use of it.
Instead of conflicting with ongoing libstand Makefile deduplication,
just add it now.
2016-01-06 17:33:32 +00:00
Jilles Tjoelker
43d53dba8f Add sbin and /usr/local directories to _PATH_DEFPATH.
Set _PATH_DEFPATH to
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin. This is the
path in the default class in the default /etc/login.conf,
excluding ~/bin which would not be expanded properly in a string
constant.

For normal logins, _PATH_DEFPATH is overridden by /etc/login.conf,
~/.login_conf or shell startup files. _PATH_DEFPATH is still used as a
default by execlp(), execvp(), posix_spawnp() and sh if PATH is not set, and
by cron. Especially the latter is a common trap (most recently in PR
204813).

PR:		204813
Reviewed by:	secteam (delphij), alfred
2016-01-05 16:21:20 +00:00
Doug Rabson
4c3117aa02 Fix a memory leak in gss_release_oid_set 2016-01-04 17:42:12 +00:00
Enji Cooper
db61e6ef45 Remove free'ing of an uninitialized variable
Just remove it completely from the test as it's initialized but unused apart
from the free(3) call

Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff)
MFC after: 5 days
Reported by: cppcheck
Reviewed by: oshogbo
Sponsored by: EMC / Isilon Storage Division
2016-01-04 03:34:22 +00:00
Enji Cooper
e02f530ebb Use nitems(x) macro instead of using hardcoded numbers for indices into
the nvlists

Convert some of the variables from int to unsigned int to squelch -Wsign-compare
warnings when converting hardcoded values to nitems(..)

Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff)
MFC after: 5 days
Reviewed by: oshogbo
Sponsored by: EMC / Isilon Storage Division
2016-01-04 03:26:36 +00:00
Enji Cooper
bd7f70daa5 Convert another string variable to string_arr missed in r293130
Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff)
MFC after: 5 days
Reviewed by: oshogbo
Sponsored by: EMC / Isilon Storage Division
2016-01-04 03:12:18 +00:00
Enji Cooper
8d86e318ea Rename nitems and string variables to avoid collisions
Rename the `nitems` variable to `num_items` to avoid collisions with the
macro in sys/param.h for counting elements in an array

Similarly, rename `string` to `string_arr` to avoid future collisions with
potential keywords, as well as make it clear that `string_arr` isn't a char*
value, but instead a char** value.

Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff)
MFC after: 5 days
Reviewed by: oshogbo
Sponsored by: EMC / Isilon Storage Division
2016-01-04 03:02:44 +00:00
Enji Cooper
93ef13b5e0 Add sys/types.h for for size_t, etc
stable/10 requires it due to header pollution

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2016-01-03 11:22:15 +00:00
Ed Maste
9ed9d9bc3c Reduce libstand Makefile duplication
libstand is built in three places (lib/libstand, sys/boot/libstand32,
and sys/boot/userboot/libstand). Reduce Makefile duplication by
.including libstand/Makefile from sys/boot/libstand32/Makefile.

sys/boot/userboot/libstand/Makefile will be addressed later, as it
contains additional differences yet to be handled.

This change also switches libstand32 to use the new uuid_from_string
and uuid_to_string, which was not included in r292473.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D4747
2016-01-01 15:30:11 +00:00
Ian Lepore
1256437c72 When building libstand for arm, don't emit instructions that require
relocation fixups unsupported by the self_reloc() code, and don't optimize
memcpy/memset using floating point registers, because in a standalone
environment nothing has initialized the fpu hardware.
2015-12-31 18:29:24 +00:00
Jonathan T. Looney
8d03d93fb7 Fix a file descriptor leak in mdXhl.c (which is used by numerous hashing
algorithms.

CID:	1305669,1305611,1305663,1305603,1305584,1305639,1346865,1305601
Differential Revision:	https://reviews.freebsd.org/D4732
Reviewed by:	allanjude, delphij
MFC after:	2 weeks
Sponsored by:	Juniper Networks
2015-12-30 18:04:50 +00:00