Commit Graph

18685 Commits

Author SHA1 Message Date
Warren Block
6d0f80c921 Remove redundant wording, minor edits for clarity.
MFC after:	1 week
Sponsored by:	iXsystems
2017-06-23 18:38:27 +00:00
Warner Losh
5ab191c42b Forward compatibility for ino64.
Add forward compatibility so that new binaries can run on old
kernels. If the new system call from ino64 isn't available on your
system, then the old one will be used and the results translated.  The
stat and statfs families of functions are fully emulated. While not
required by policy, in this case it is helpful to our users to provide
this compatibility. In this case, it allows rollback of the kernel
after installing a new userland should a problem be discovered. It
also prevents foot-shooting if a user does an install before rebooting
with the new kernel. Finally, it allows the use case where one needs
to run new binaries on an old kernel as part of an upgrade process.

The getdirentries family uses tricks that may not work on remote
filesystems. Specifically, it uses a buffer 1/4 the size requested to
get the data from he old syscall.

The code carefully uses direct syscalls for old system calls to avoid
referencing freebsd11_* symbols, which contaminate ld-elf.so.1's
export table due to its use of stat functions, which causes errno to
be incorrect in client programs due to the wrong *stat* function being
resolved in some cases.

This code should removed sometime after 12 is branched.

Tested on: 12-current binaries on a 10.3-beta kernel run and return
       consistent results. 12-current kernel and userland with
       packages from before ino64 was committed also work.

Differential Revision: https://reviews.freebsd.org/D11185
Reviewed by: kib@, emaste@
2017-06-23 18:06:20 +00:00
Alan Somers
09986d3bd2 Clarify usage of aio(4) with kqueue(2)
Reviewed by:	jhb
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D11299
2017-06-23 00:40:09 +00:00
Xin LI
091867a611 Fix use-after-free introduced in r300388.
In r300388, endnetconfig() was called on nc_handle which would release
the associated netconfig structure, which means tmpnconf->nc_netid
would be a use-after-free.

Solve this by doing endnetconfig() in return paths instead.

Reported by:	jemalloc via kevlo
Reviewed by:	cem, ngie (earlier version)
MFC after:	3 days
Differential Revision:    https://reviews.freebsd.org/D11288
2017-06-22 05:10:16 +00:00
Bryan Drewery
f944e9e208 Tweak r320206: Still create the TABLE but not the .depend entry for missing headers.
X-MFC-With:	r320206
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-06-21 23:28:24 +00:00
Bryan Drewery
87d18efc7b Follow-up r308602: Don't add missing headers to .depend.tables.h.
This also avoids an error from egrep when a header is missing.  This can happen
with something like WITHOUT_BLUETOOTH set when searching for
$include_dir/netgraph/bluetooth/include/ng_btsocket.h.  The warning was
not an error (from set -e) due to being on the left side of a pipe.  Now the
all_headers list is only filled with existing headers.

Reviewed by:	ngie
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-06-21 23:01:18 +00:00
Jason Evans
e46bcb7d38 Decrease relative branch brittleness.
Replace conditional branches with trampolines to unconditional branches when
jumping to labels within other compilation units.  This increases the offset
range from +-1 MiB to +-128 MiB.
2017-06-20 07:25:38 +00:00
Bryan Drewery
c99b67a794 Utilize SYSROOT from r320119 in places where DESTDIR may be wanting WORLDTMP.
Since buildenv exports SYSROOT all of these uses will now look in
WORLDTMP by default.

sys/boot/efi/loader/Makefile
        A LIBSTAND hack is no longer required for buildenv.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-19 20:47:24 +00:00
Conrad Meyer
a13136cdb7 pdwait4(2): Remove documentation of vaporware
This syscall has never existed and is not at risk of existing any time soon.
Remove documentation referencing it, which has been wrong since FreeBSD 9.

Reported by:	allanjude@
2017-06-17 17:32:40 +00:00
Konstantin Belousov
f3990417c5 Do not leak syslog_mutex on cancellation.
Make syslog(3) resilent to cancellation occuring in supported deferred
mode.  Code must unlock syslog_mutex on cancel, install the cleanup
handler.

Diagnosed and tested by:	eugen
Discussed with:	dchagin
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-06-17 11:29:59 +00:00
Konstantin Belousov
2b34e84335 Add abstime kqueue(2) timers and expand struct kevent members.
This change implements NOTE_ABSTIME flag for EVFILT_TIMER, which
specifies that the data field contains absolute time to fire the
event.

To make this useful, data member of the struct kevent must be extended
to 64bit.  Using the opportunity, I also added ext members.  This
changes struct kevent almost to Apple struct kevent64, except I did
not changed type of ident and udata, the later would cause serious API
incompatibilities.

The type of ident was kept uintptr_t since EVFILT_AIO returns a
pointer in this field, and e.g. CHERI is sensitive to the type
(discussed with brooks, jhb).

Unlike Apple kevent64, symbol versioning allows us to claim ABI
compatibility and still name the new syscall kevent(2).  Compat shims
are provided for both host native and compat32.

Requested by:	bapt
Reviewed by:	bapt, brooks, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D11025
2017-06-17 00:57:26 +00:00
Konstantin Belousov
d60fa657b2 Move the description of kern.kq_calloutmax sysctl into a new paragraph
for better presentation.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2017-06-16 23:25:11 +00:00
Konstantin Belousov
17c847c1ff Start a new sentence on the new line.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2017-06-16 23:17:31 +00:00
Maxim Sobolev
3d751650c1 Document st_flags in the stat(2).
Approved by:	mckusick,vangyzen,jilles
Differential Revision:	https://reviews.freebsd.org/D10852
2017-06-16 15:09:43 +00:00
Jason Evans
b7eaed250f Update jemalloc to 5.0.0. 2017-06-15 07:15:05 +00:00
Dimitry Andric
5c4e2ac498 Revert r319796 for now, it can cause undefined references when linking
in some circumstances.

Reported by:	Shawn Webb <shawn.webb@hardenedbsd.org>
2017-06-13 21:01:06 +00:00
Konstantin Belousov
b43ce76c77 Add ptrace(PT_GET_SC_ARGS) command to return debuggee' current syscall
arguments.

Reviewed by:	jhb (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D11080
2017-06-12 21:15:43 +00:00
Enji Cooper
5bf28159df Remove stdlib.h #include added in r319844
A previous iteration of the tests I added in r319844 involved free(3), but
that attempt didn't pan out, so I switched to stack allocated buffers instead
of heap allocated ones, making the #include unnecessary.

MFC after:	1 month
MFC with:	r319844
2017-06-12 02:38:37 +00:00
Enji Cooper
f56f82e00f Add positive and negative testcases for cam_get_device(3)
MFC after:	1 month
Submitted by:	Evan Cramer <evan.cramer@isilon.com>
2017-06-12 02:12:22 +00:00
Enji Cooper
5e3f43f2e0 getbsize(3): clarify that underflow/overflow warnings in regard to $BLOCKSIZE
gets output via warnx(3)

This helps set expectations for how one might deal with those messages, i.e.,
mute output from /dev/stderr today, since that's where vwarn(3) outputs messages
to today.

MFC after:	1 month
2017-06-12 00:43:14 +00:00
Mark Johnston
df633e60c9 Remove an inaccuracy from socket.2.
SOCK_SEQPACKET is implemented for several protocols.

MFC after:	1 week
2017-06-10 21:07:55 +00:00
Dimitry Andric
834210fa5d Remove a few unneeded files from libllvm, libclang and liblldb.
MFC after:	3 days
2017-06-10 18:52:13 +00:00
John Baldwin
30b94d0cf4 Improve decoding of RB_AUTOBOOT in the 'howto' argument to reboot().
The reboot() system call accepts a mode (RB_AUTOBOOT, RB_HALT, RB_POWEROFF,
or RB_REROOT) as well as zero or more optional flags in 'howto'.
However, RB_AUTOBOOT was only displayed if 'howto' was exactly 0.
Combinations like 'RB_AUTOBOOT | RB_DUMP' were decoded as 'RB_DUMP'.
Instead, imply that RB_AUTOBOOT was specified if none of the other "mode"
flags were specified.
2017-06-10 01:20:08 +00:00
Phil Shafer
2f78413036 Import libxo-0.8.1 with official fix to today's build break.
Submitted by:	phil
2017-06-09 03:32:49 +00:00
Phil Shafer
f2b7bf8afc Import libxo-0.8.0:
- addition of --libxo colors=xxxxx color map (so I never see "blue")
 - fix bugs from -fsanitize=address and =undefined
 - utf-8 changes (remove support fore 6 byte utf-8 values, which are "historical")
 - add comments
 - fix man pages
 - update test cases

Submitted by:	phil
Reviewed by:	sjg
Approved by:	sjg (mentor)
2017-06-08 13:04:01 +00:00
Jilles Tjoelker
e0e0323354 libc: Remove futimens() and utimensat() compat stubs.
The futimens() and utimensat() compat stubs allowed using these functions on
kernels that did not have the system calls yet (10.2, old 11-current).

Also remove the documentation of the [ENOTSUP] error that could occur with
an old kernel.

A -DNO_CLEAN build may fail because the depend files refer to the deleted
files.
2017-06-07 21:21:14 +00:00
Will Andrews
c384464d25 tsearch_test: Test twalk & add some determinism. 2017-06-06 03:40:45 +00:00
Toomas Soome
a87f43927c ANSIfy md5 functions
Update the function declarations.

Reviewed by:	dim
Differential Revision:	https://reviews.freebsd.org/D11055
2017-06-05 11:55:26 +00:00
John Baldwin
ee8aa41dca Decode the 'who' argument passed to getrusage().
Add a new sysdecode_getrusage_who() which decodes the RUSAGE_* constant
passed as the first argument to getrusage().  Use this function in both
kdump and truss to decode the first argument to getrusage().

PR:		215448
Submitted by:	Anton Yuzhaninov <citrin+pr@citrin.ru>
MFC after:	1 month
2017-06-03 14:22:15 +00:00
John Baldwin
2bdd2e7e61 Add a cross-reference to sysdecode_socket_protocol(3). 2017-06-03 14:10:09 +00:00
John Baldwin
60b67035f2 Remove stale cap_rights_get(2) manpage.
The documentation moved to section 3 several years ago, but
'man cap_rights_get' pulls up cap_rights_limit(2) (which is
MLINKed to cap_rights_get.2) instead of cap_rights_get(3).

MFC after:	1 week
2017-06-02 03:53:34 +00:00
Dimitry Andric
38d6a62a21 For arm targets, place ABI at the end of the target triple
For some reason, we have been inserting the ABI specification into the
middle of the target triple, when building LLVM, like so:

    armv6-gnueabi-freebsd12.0

This is the wrong way around.  LLVM even auto-canonicalizes it to:

    armv6--freebsd12.0-gnueabi

Let's do this the right way in llvm.build.mk instead.  While here,
define a proper VENDOR macro which can be overridden easily.

Reviewed by:	emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D10846
2017-06-01 21:05:56 +00:00
Stephen J. Kiernan
91601d8c5d When sysctlbyname fails, free buf before returning.
Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	jhb
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9867
2017-06-01 16:44:39 +00:00
Xin LI
6448ec89e7 * limit size of buffers to RPC_MAXDATASIZE
* don't leak memory
 * be more picky about bad parameters

From:

https://raw.githubusercontent.com/guidovranken/rpcbomb/master/libtirpc_patch.txt
https://github.com/guidovranken/rpcbomb/blob/master/rpcbind_patch.txt

via NetBSD.

Reviewed by:	emaste, cem (earlier version)
Differential Revision:	https://reviews.freebsd.org/D10922
MFC after:	3 days
2017-06-01 06:12:25 +00:00
Enji Cooper
f31a4fc86c :dnvlist_get_string__default_value: fix a bogus string comparison test
Check actual_value vs "5", not "5" vs itself.

MFC after:	3 days
Reported by:	Coverity
CID:		1362021
Sponsored by:	Dell EMC Isilon
2017-05-29 19:02:52 +00:00
Enji Cooper
b97ee15f62 logarithm_test: assert that feclearexcept succeeds
This helps ensure that test preconditons are fulfilled.

MFC after:	3 days
Reported by:	Coverity
CID:		1346572
Sponsored by:	Dell EMC Isilon
2017-05-29 18:49:28 +00:00
Enji Cooper
2dd512c37f fma_test: mute a warning about unreachable code on amd64 by restructuring
the #ifdef block to only handle the rest of the logic in the loop in the
#else case.

MFC after:	3 days
Reported by:	Coverity
CID:		1346844
Sponsored by:	Dell EMC Isilon
2017-05-29 18:45:10 +00:00
Enji Cooper
6399b5e03a :nvlist_unpack__duplicate_key : check the result of nvlist_pack(3)
This fixes a potential NULL pointer dereference.

MFC after:	3 days
Reported by:	Coverity
CID:		1362051
Sponsored by:	Dell EMC Isilon
2017-05-29 18:39:28 +00:00
Enji Cooper
2c6778ed5b lib/libnv/tests/dnv_test: fix memory leaks for memory allocated via
either strdup or one of the dnvlist* libcalls.

Reported by:	Coverity
CID:		1362056-1362060
Sponsored by:	Dell EMC Isilon
2017-05-29 18:34:45 +00:00
Konstantin Belousov
a327b06f81 Mention that the basep argument to getdirentries(2) can be NULL.
Noted by:	dim
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D10972
2017-05-28 21:42:47 +00:00
Toomas Soome
4a57c6f1b6 use the same option list for dhcp discovery and request
The DHCP client is supposed to use the same option request list for
both DHCP discovery and request.

This will also allow us to fill the list in single function.

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D10981
2017-05-28 21:30:01 +00:00
Konstantin Belousov
3449821376 Update getdirentries(2) page for new struct dirent layout.
Sponsored by:	The FreeBSD Foundation
2017-05-28 09:29:53 +00:00
Enji Cooper
ae442ee64a hostent_test_getaddrinfo_eq(..): call freeaddrinfo on ai when done
This plugs a leak of memory allocated via getaddrinfo.

MFC after:	1 week
Reported by:	Coverity
CID:		1346866
Sponsored by:	Dell EMC Isilon
2017-05-28 07:40:42 +00:00
Enji Cooper
dedafe6447 hostent_test_getnameinfo_eq(..): initialize found_a_host to false
MFC after:	1 week
Reported by:	Coverity
CID:		1368943
Sponsored by:	Dell EMC Isilon
2017-05-28 07:04:50 +00:00
Enji Cooper
49dd57f22d Bump WARNS from 1 to 3 after recent commits to fix warnings in the
directory.

Tested with:	clang 4.0, gcc 4.2.1, gcc 6.3.0
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-05-28 06:29:01 +00:00
Enji Cooper
8eb2367596 Push snapshot_file copying down into run_tests function, and mark snapshot_file
const char *.

This fixes a bogus set of errors from gcc about strdup not being allowed a NULL
argument.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-05-28 06:26:43 +00:00
Michal Meloun
e1b98d0774 Implement sincos, sincosf, and sincosl.
The primary benefit of these functions is that argument
reduction is done once instead of twice in independent
calls to sin() and cos().

* lib/msun/Makefile:
  . Add s_sincos[fl].c to the build.
  . Add sincos.3 documentation.
  . Add appropriate MLINKS.

* lib/msun/Symbol.map:
  . Expose sincos[fl] symbols in dynamic libm.so.

* lib/msun/man/sincos.3:
  . Documentation for sincos[fl].

* lib/msun/src/k_sincos.h:
  . Kernel for sincos() function.  This merges the individual kernels
    for sin() and cos().  The merger offered an opportunity to re-arrange
    the individual kernels for better performance.

* lib/msun/src/k_sincosf.h:
   . Kernel for sincosf() function.  This merges the individual kernels
     for sinf() and cosf(). The merger offered an opportunity to re-arrange
     the individual kernels for better performance.

* lib/msun/src/k_sincosl.h:
   . Kernel for sincosl() function.  This merges the individual kernels
     for sinl() and cosl(). The merger offered an opportunity to re-arrange
     the individual kernels for better performance.

* lib/msun/src/math.h:
  . Add prototytpes for sincos[fl]().

* lib/msun/src/math_private.h:
  . Add RETURNV macros.  This is needed to reset fpsetprec on I386
    hardware for a function with type void.

* lib/msun/src/s_sincos.c:
  . Implementation of sincos() where sin() and cos() were merged into
    one routine and possibly re-arranged for better performance.

* lib/msun/src/s_sincosf.c:
  . Implementation of sincosf() where sinf() and cosf() were merged into
    one routine and possibly re-arranged for better performance.

* lib/msun/src/s_sincosl.c:
  . Implementation of sincosl() where sinl() and cosl() were merged into
    one routine and possibly re-arranged for better performance.

PR:		215977, 218300
Submitted by:	Steven G. Kargl <sgk@troutmask.apl.washington.edu>
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10765
2017-05-28 06:13:38 +00:00
Enji Cooper
e1f5475701 Fix a -Wunused-but-set-variable warning reported by gcc 6.3.0
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 05:31:18 +00:00
Enji Cooper
981aa50fc2 Fix -Wunused and -Wshadow warnings
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 05:26:45 +00:00
Enji Cooper
91c53523fd getgr_test: fix -Wunused warnings
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:43:02 +00:00