Commit Graph

18249 Commits

Author SHA1 Message Date
Pedro F. Giffuni
3b243527db librss: simplify some NULL checks.
MFC after:	1 week
2017-02-27 00:10:00 +00:00
Mariusz Zaborski
b62c1f2b18 Remove unneeded variable initialization from r314319.
Pointed out by:	kib
2017-02-26 22:15:39 +00:00
Mariusz Zaborski
ba1b663656 Don't try to open devices in the gettc() function which will always
fail in the Capability mode. Instead silently fallback to the syscall
method, which is done for example in the gettimeofday(2) function.

Reviewed by:	kib
2017-02-26 22:07:26 +00:00
Warner Losh
589c673b32 Don't convert ENOENT to nothing for individual lookup, just for the
iterative get_next interface. This prevents efivar(3) from printing 4k
of 0's when a variable isn't set.

Sponsored by: Netflix
2017-02-25 00:09:21 +00:00
Enji Cooper
8f7861b26f Fix up r314189
The conditional in do_buff_decode(..) after the while loop was accidentally
inverted. Only increment the pointer for fmt if it's not NUL.

MFC after:	2 weeks
X-MFC with:	r314189
Reported by:	pstef
Sponsored by:	Dell EMC Isilon
2017-02-24 06:49:31 +00:00
Enji Cooper
29d14889f5 Fix some minor style nits: put parentheses around return values
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-02-24 06:28:58 +00:00
Enji Cooper
69c703b9c4 Fix up NULL/'\0' uses and fix 2 derefs after NULL
MFC after:	2 weeks
Reported by:	Coverity
CID:		1018898, 1018899
Differential Revision:	https://reviews.freebsd.org/D6142
Sponsored by:	Dell EMC Isilon
2017-02-24 06:24:39 +00:00
Eric van Gyzen
b215ceaaec Add sem_clockwait_np()
This function allows the caller to specify the reference clock
and choose between absolute and relative mode.  In relative mode,
the remaining time can be returned.

The API is similar to clock_nanosleep(3).  Thanks to Ed Schouten
for that suggestion.

While I'm here, reduce the sleep time in the semaphore "child"
test to greatly reduce its runtime.  Also add a reasonable timeout.

Reviewed by:	ed (userland)
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D9656
2017-02-23 19:36:38 +00:00
Jung-uk Kim
d751009457 Remove an assembler flag, which is redundant since r309124. The upstream
took care of it by introducing a macro NO_EXEC_STACK_DIRECTIVE.

http://llvm.org/viewvc/llvm-project?rev=273500&view=rev

Reviewed by:	dim
2017-02-23 17:46:38 +00:00
Dimitry Andric
e3c4285520 Surround any unmangled C++ names in libcxxrt's version map with 'extern
"C++"', otherwise ld refuses to make the symbols global in the final
library.  This causes the __int128-related symbols to go missing when
the library is stripped during installation.

Helpful hints:	emaste
MFC after:	2 weeks
X-MFC-With:	r314061
2017-02-22 18:44:57 +00:00
Dimitry Andric
6fc1c2befc Add __int128-related symbols to libcxxrt's version map. Put these into
the same CXXABI verions as recent libstdc++.

Note that __int128 types are only available on arches where long long is
128 bit wide.

Noticed by:	harti
MFC after:	2 weeks
2017-02-21 21:48:45 +00:00
Eric van Gyzen
90c1b723a5 Make several improvements and corrections in the kenv(2) man page
MFC after:	3 days
Sponsored by:	Dell EMC
2017-02-21 19:51:41 +00:00
Dag-Erling Smørgrav
f3b0ac3409 Upgrade to OpenPAM Radula. 2017-02-20 00:56:46 +00:00
Baptiste Daroussin
d8713bf361 Add a file descriptor in struct url for netrc
When using libfetch in an application that drops privileges when fetching
like pkg(8) then user complain because the application does not read anymore
${HOME}/.netrc. Now a caller can prepare a fd to the said file and manually
assign it to the structure.

It is also a first step to allow to capsicumize libfetch applications

Reviewed by:	allanjude, des
Approved by:	des
Differential Revision:	https://reviews.freebsd.org/D9678
2017-02-20 00:14:31 +00:00
Dag-Erling Smørgrav
04e3065217 Vendor import of OpenPAM Radula. 2017-02-19 21:00:46 +00:00
Michal Meloun
d98d230378 Publish fp[get][set]sticky() for ARMv6.
Although fp[get][set]sticky() functions are obsolete, they are still
required for GNU fortran49 library.

MFC after: 2 months
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D9634
2017-02-17 13:49:46 +00:00
Michal Meloun
cd9bdb7362 Publish __aeabi_uidiv and __aeabi_idiv as compatible symbols from libc.
Due to bug[1] in libcompiler_rt, all symbols declared by
DEFINE_AEABI_FUNCTION_ALIAS() are not hidden. All these but two
are explicitly exported from libc and don't causes problems.

Remaining two, __aeabi_uidiv and __aeabi_idiv, infecting all
non-versioned shared libraries. And these symbols are consumed
by many (if not all) packages[2].

As workaround, export these from libc as compatible symbols,
in global namespace. With this, these are still visible for
rtld, but static linker doesn't use then.

[1]
DEFINE_AEABI_FUNCTION_ALIAS() macro uses '.set' directive for
declaration of aliased symbol. Unfortunately, '.set' doesn't
inherit visibility of base symbol, and macro don't explicitly
sets visibility for aliased one.

[2]
Given symbols are exported from non-versioned libraries only if
library itself uses them. So, if world is built for CPU with
HW divide, these function are not used and given symbols are
not exported. By this, contents of these libraries is not stable,
and all packages fails to run.

Note: Due to r313823 I'm forced to commit this too early, without
leave enough time for proper review.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D9632
2017-02-17 11:16:19 +00:00
Mahdi Mokhtari
1fdfb24aa7 Add documentations related to new APIs of r313761
PR:		216850 216851 216852 216856 216857 216858
Submitted by:	sgk@troutmask.apl.washington.edu
Reported by:	sgk@troutmask.apl.washington.edu
Reviewed by:	bde emaste hselasky
Approved by:	bde emaste hselasky
Differential Revision:	https://reviews.freebsd.org/D9491
2017-02-17 08:25:48 +00:00
Mahdi Mokhtari
a287735349 Fix building of r313761 on platforms that
`long double` is alias of `double` (MIPS, etc)

PR:		216850 216851 216852 216856 216857 216858
Reported by:	emsate
Reviewed by:	bde emaste hselasky
Approved by:	bde emaste hselasky
Differential Revision:	https://reviews.freebsd.org/D9491
2017-02-17 08:22:32 +00:00
Ed Schouten
8eb15797b1 Remove unnecessary #includes from the kqueue(2) man page.
Now that <sys/event.h> can be included on its own, adjust the manual
page accordingly. Remove both unnecessary #include statements from the
synopsis and the example code.

While there, also add a note to the BUGS section to mention that
previous versions of this header file still depend on <sys/types.h>.

Reviewed by:	ngie, vangyzen
Differential Revision:	https://reviews.freebsd.org/D9605
2017-02-16 06:52:53 +00:00
Ed Maste
1dc349ab95 prefix UFS symbols with UFS_ to reduce namespace pollution
Specifically:
  ROOTINO -> UFS_ROOTINO
  WINO -> UFS_WINO
  NXADDR -> UFS_NXADDR
  NDADDR -> UFS_NDADDR
  NIADDR -> UFS_NIADDR
  MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Also prefix ext2's and nandfs's NDADDR and NIADDR with EXT2_ and NANDFS_

Reviewed by:	kib, mckusick
Obtained from:	NetBSD
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9536
2017-02-15 19:50:26 +00:00
Mahdi Mokhtari
a11c507775 Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
to improve C11 conformance.

PR:		216850 216851 216852 216856 216857 216858
Submitted by:	mmokhi
Reported by:	sgk@troutmask.apl.washington.edu
Reviewed by:	bde, mat, theraven
Approved by:	bde (src committer), mat (mentor)
Differential Revision:	https://reviews.freebsd.org/D9491
2017-02-15 07:59:54 +00:00
Mark Johnston
661c4fe512 Fix indentation in nss_configure().
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-14 21:55:50 +00:00
Mark Johnston
888e46a99b Register nss_atexit() before parsing nsswitch.conf for the first time.
NSS modules are loaded when nsswitch.conf is parsed and may register their
own atexit handlers with libc. nss_atexit() unloads any dynamically loaded
NSS modules, so it should run only after the modules' atexit handlers have
been invoked.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-02-14 21:51:19 +00:00
Bartek Rutkowski
00ef17befe Capsicum support for bhyve(8).
Adds Capsicum sandboxing to bhyve.

Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Reviewed by:	grehan, oshogbo
Approved by:	emaste, grehan
Sponsored by:	Mysterious Code Ltd.
Differential Revision:	https://reviews.freebsd.org/D8290
2017-02-14 13:35:59 +00:00
Enji Cooper
87dc0e9bc9 Handle clang 4.x+ with the compile-time exception added in r312213
It also fails the assertions noted in bug 208703

PR:	208703
PR:	217084
Submitted by:	jbeich
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-14 00:54:48 +00:00
Xin LI
ada6f083b9 MFV r313676: libpcap 1.8.1
MFC after:	1 month
2017-02-13 08:23:39 +00:00
Konstantin Belousov
987ff18184 Consistently handle negative or wrapping offsets in the mmap(2) syscalls.
For regular files and posix shared memory, POSIX requires that
[offset, offset + size) range is legitimate.  At the maping time,
check that offset is not negative.  Allowing negative offsets might
expose the data that filesystem put into vm_object for internal use,
esp. due to OFF_TO_IDX() signess treatment.  Fault handler verifies
that the mapped range is valid, assuming that mmap(2) checked that
arithmetic gives no undefined results.

For device mappings, leave the semantic of negative offsets to the
driver.  Correct object page index calculation to not erronously
propagate sign.

In either case, disallow overflow of offset + size.

Update mmap(2) man page to explain the requirement of the range
validity, and behaviour when the range becomes invalid after mapping.

Reported and tested by:	royger (previous version)
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-02-12 21:05:44 +00:00
Enji Cooper
99b33ca4ec Manipulate OBJDIR with :H when referencing dso directory
This reduces path lengths, etc in memory with make by a minimal value

Sponsored by:	Dell EMC Isilon
2017-02-11 20:14:50 +00:00
Conrad Meyer
0ecf59f68f ufs: Use UFS_MAXNAMLEN constant
(like NFS, EXT2FS, SVR4, IBCS2) instead of redefining the MAXNAMLEN
constant.

No functional change.

Reviewed by:	kib@, markj@
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9500
2017-02-09 17:47:01 +00:00
Enji Cooper
635f2911b0 Merge content from ^/projects/netbsd-tests-upstream-01-2017 into ^/head
The primary end-goal of this drop is ease future merges with NetBSD and
collaborate further with the NetBSD project.

The goal was (largely, not completely as some items are still oustanding
in the NetBSD GNATS system) achieved by doing the following:
- Pushing as many changes required to port contrib/netbsd-tests
  back to NetBSD as possible, then pull the upstream applied changes
  back in to FreeBSD.
- Diff reduce with upstream where possible by:
-- Improving libnetbsd header, etc compat glue.
-- Using _SED variables to modify test scripts on the fly for items
   that could not be upstreamed to NetBSD.

As a bonus for this work, this change also introduces testcases for
uniq(1).

Many thanks to Christos for working with me to get many of the changes
back into the NetBSD project.

In collaboration with:	Christos Zoulas <christos@netbsd.org>
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-02-08 09:46:15 +00:00
Enji Cooper
12e1a6e990 Clean up trailing and leading whitespace for variables to make it
consistent with the rest of the file and style.Makefile(9) a bit
more

MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-02-08 09:24:25 +00:00
Enji Cooper
0a2eff9dd9 Create link from hexdump(3) to sbuf_hexdump(9) as the manpage describes
sbuf_hexdump(9)'s behavior

MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-02-08 09:22:35 +00:00
Enji Cooper
696fcb05fb Clarify #includes for hexdump(3) vs sbuf_hexdump(9)
hexdump(3) only requires libutil.h, whereas sbuf_hexdump(9) requires
sys/types.h (for ssize_t) and sys/sbuf.h

MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-02-08 09:19:49 +00:00
Enji Cooper
9ddd071605 MFhead@r313404 2017-02-07 19:47:30 +00:00
Enji Cooper
da9813b9ea Remove placeholder compat header for stdio.h
In the end, dealing with fparseln was more bikeshed worthy than I
anticipated, and polling stdio.h with libutil.h caused me more
grief than necessary. Keeping the compat header around for no
reason other than include_next'ing the stdio.h header in FreeBSD
makes no sense.
2017-02-07 19:47:04 +00:00
Enji Cooper
e0f389edab Improve libnetbsd compatibility with NetBSD
This change is being made to diff reduce/reduce duplication in
contrib/netbsd-tests and to facilitate further porting of software from
NetBSD

Add the following headers:
- sys/event.h:
-- sys/types.h is required for kqueue on FreeBSD, but not NetBSD.
- sys/types.h:
-- NBBY is defined in sys/param.h on FreeBSD, not sys/types.h like on NetBSD.
   Pull in sys/param.h to have parity with NetBSD.
- sys/wait.h:
-- Define wrusage as __wrusage for parity with NetBSD typedef.
- glob.h
-- Define __gl_stat_t as "struct stat" for parity with NetBSD typedef.
- pthread.h:
-- Pull in pthread_np.h for _np functions defined separately on FreeBSD.

Improve compatibility with NetBSD in the following headers:

- sha1.h:
-- define SHA1_CTX as SHA_CTX
-- define SHA1Final as SHA1_Final
- sha2.h:
-- #include sha384 to pick up all of the SHA 384 bit macros and definitions.
- util.h:
-- Add sys/types.h to util.h to pollute the header for types used in
   flags_to_string and string_to_flags (u_long) as NetBSD doesn't require them
   for the functions.

MFC after:      2 weeks
Sponsored by:   Dell EMC Isilon
2017-02-07 19:42:41 +00:00
Enji Cooper
a678f77962 MFhead@r313380 2017-02-07 06:04:13 +00:00
Enji Cooper
9a41ce4a69 Expect :int_within_limits to fail when ptrdiff_t/*intmax_t differ in base type
The %t{d,u} (ptrdiff_t) tests fail for the following reasons:
- ptrdiff_t is by definition int32_t on !LP64 architectures and int64_t on
  LP64 architectures.
- intmax_t is by definition fixed to int64_t on all architectures.
- Some of the code in lib/libc/stdio/... is promoting ptrdiff_t to *intmax_t
  when parsing/representing the value.

PR:		191674
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 05:39:00 +00:00
Enji Cooper
1eca9a9a49 Wrap strcmp/wcscmp calls with ATF_CHECK_MSG and drop atf_tc_fail use
The reasoning here was the same as what was done in r313376:
- Gather as many results as possible instead of failing early and
  not testing the rest of the cases.
- Simplify logic when checking test inputs vs outputs and printing
  test result.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 04:25:21 +00:00
Enji Cooper
0653d1fb68 Fix :hexadecimal_floating_point on i386
Don't exclude i386 from LDBL_MANT_DIG == 64; it works properly in
that case.

While here, replace strcmp + atf_tc_fail with ATF_CHECK_MSG for 2
reasons:
- Gather as many results as possible instead of failing early and
  not testing the rest of the cases.
- Simplify logic when checking test inputs vs outputs and printing
  test result.

Tested on:	amd64, i386
MFC after: 	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 03:46:48 +00:00
Enji Cooper
d5f154d3cf hcreate(3): fix the ERRORS section and bump .Dd
- Add missing comma between functions that trigger ENOMEM error.
- Fix the description for ESRCH. The action that triggers this error is
  FIND, not SEARCH (SEARCH does not exist).

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 02:32:49 +00:00
Enji Cooper
15df32b48d MFhead@r313360 2017-02-07 01:33:39 +00:00
Toomas Soome
467c82cb84 loader: Replace EFI part devices.
Rewrite EFI part device interface to present disk devices in more
user friendly way.

We keep list of three types of devices: floppy, cd and disk, the
visible names: fdX: cdX: and diskX:

Use common/disk.c and common/part.c interfaces to manage the
partitioning.

The lsdev -l will additionally list the device path.

Reviewed by:	imp, allanjude
Approved by:	imp (mentor), allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8581
2017-02-06 09:18:47 +00:00
Andrey V. Elsukov
fcf596178b Merge projects/ipsec into head/.
Small summary
 -------------

o Almost all IPsec releated code was moved into sys/netipsec.
o New kernel modules added: ipsec.ko and tcpmd5.ko. New kernel
  option IPSEC_SUPPORT added. It enables support for loading
  and unloading of ipsec.ko and tcpmd5.ko kernel modules.
o IPSEC_NAT_T option was removed. Now NAT-T support is enabled by
  default. The UDP_ENCAP_ESPINUDP_NON_IKE encapsulation type
  support was removed. Added TCP/UDP checksum handling for
  inbound packets that were decapsulated by transport mode SAs.
  setkey(8) modified to show run-time NAT-T configuration of SA.
o New network pseudo interface if_ipsec(4) added. For now it is
  build as part of ipsec.ko module (or with IPSEC kernel).
  It implements IPsec virtual tunnels to create route-based VPNs.
o The network stack now invokes IPsec functions using special
  methods. The only one header file <netipsec/ipsec_support.h>
  should be included to declare all the needed things to work
  with IPsec.
o All IPsec protocols handlers (ESP/AH/IPCOMP protosw) were removed.
  Now these protocols are handled directly via IPsec methods.
o TCP_SIGNATURE support was reworked to be more close to RFC.
o PF_KEY SADB was reworked:
  - now all security associations stored in the single SPI namespace,
    and all SAs MUST have unique SPI.
  - several hash tables added to speed up lookups in SADB.
  - SADB now uses rmlock to protect access, and concurrent threads
    can do SA lookups in the same time.
  - many PF_KEY message handlers were reworked to reflect changes
    in SADB.
  - SADB_UPDATE message was extended to support new PF_KEY headers:
    SADB_X_EXT_NEW_ADDRESS_SRC and SADB_X_EXT_NEW_ADDRESS_DST. They
    can be used by IKE daemon to change SA addresses.
o ipsecrequest and secpolicy structures were cardinally changed to
  avoid locking protection for ipsecrequest. Now we support
  only limited number (4) of bundled SAs, but they are supported
  for both INET and INET6.
o INPCB security policy cache was introduced. Each PCB now caches
  used security policies to avoid SP lookup for each packet.
o For inbound security policies added the mode, when the kernel does
  check for full history of applied IPsec transforms.
o References counting rules for security policies and security
  associations were changed. The proper SA locking added into xform
  code.
o xform code was also changed. Now it is possible to unregister xforms.
  tdb_xxx structures were changed and renamed to reflect changes in
  SADB/SPDB, and changed rules for locking and refcounting.

Reviewed by:	gnn, wblock
Obtained from:	Yandex LLC
Relnotes:	yes
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D9352
2017-02-06 08:49:57 +00:00
Enji Cooper
9b3ece1c2e MFhead@r313243 2017-02-04 18:06:09 +00:00
Eric van Gyzen
f02396d5d9 Fix grammar in getpeereid(3) 2017-02-04 00:37:25 +00:00
Jilles Tjoelker
e301fd984a Clean up documentation of AF_UNIX control messages.
Document AF_UNIX control messages in unix(4) only, not split between unix(4)
and recv(2).

Also, warn about LOCAL_CREDS effective uid/gid fields, since the write could
be from a setuid or setgid program (with the explicit SCM_CREDS and
LOCAL_PEERCRED, the credentials are read at such a time that it can be
assumed that the process intends for them to be used in this context).

Reviewed by:	wblock
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9298
2017-02-03 20:33:23 +00:00
Andrew Turner
5b50ed8043 Fix the comment showing the meaning of the first argument to sigprocmask.
Sponsored by:	ABT Systems Ltd
2017-02-03 11:51:06 +00:00
Martin Matuska
9f3de9e26d MFV r313071:
Sync libarchive with vendor

Vendor changes (relevant to FreeBSD):
- support extracting NFSv4 ACLs from Solaris tar archives
- bugfixes and optimizations in the ACL code
- multiple fixes in the test suite
- typo and other small bugfixes

Security fixes:
- cab reader: endless loop when parsing MSZIP signature (OSS-Fuzz 335)
- LHA reader: heap-buffer-overflow in lha_read_file_header_1()
  (CVE-2017-5601)
- LZ4 reader: null-pointer dereference in lz4_filter_read_legacy_stream()
  (OSS-Fuzz 453)
- mtree reader: heap-buffer-overflow in detect_form() (OSS-Fuzz 421, 443)
- WARC reader: heap-buffer-overflow in xstrpisotime() (OSS-Fuzz 382, 458)

Memory leak fixes:
- ACL support: free memory allocated by acl_get_qualifier()
- disk writer: missing free in create_filesystem_object()
- file reader: fd leak (Coverity 1016755)
- gnutar writer: fix free in archive_write_gnutar_header()
  (Coverity 101675)
- iso 9660 reader: missing free in parse_file_info()
  (partial Coverity 1016754)
- program reader: missing free in __archive_read_program()
- program writer: missing free in __archive_write_program_free()
- xar reader: missing free in xar_cleanup()
- xar reader: missing frees in expat_xmlattr_setup()
  (Coverity 1229979-1229981)
- xar writer: missing free in file_free()
- zip reader: missing free in zip_read_local_file_header()

MFC after:	1 week
X-MFC with:	310866, 310868, 310870, 311899
2017-02-02 00:50:46 +00:00