Commit Graph

7633 Commits

Author SHA1 Message Date
Kurt Lidl
ea3431376e Improve ipfw rule creation for blacklist-helper script
When blocking an address, the blacklist-helper script
needs to do the following things for the ipfw packet
filter:

 - create a table to hold the addresses to be blocked,
   so lookups can be done quickly, and place the address
   to be blocked in that table
 - create rule that does the lookup in the table and
   blocks the packet

The ipfw system allows multiple rules to be inserted for
a given rule number.  There only needs to be one rule
to do the lookup per port.  Modify the script to probe
for the existence of the rule before attempting to create
it, so only one rule is inserted, rather than one rule per
blocked address.

PR:		214980
Reported by:	azhegalov (at) gmail.com
Reviewed by:	emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9681
2017-02-22 21:50:37 +00:00
Mariusz Zaborski
7b13366373 Capsicumize traceroute.
PR:		 193973
Submitted by:	 Mikhail <mp39590@gmail.com>
Reviewed by:	 pjd, bapt, emaste, AllanJude
Differential Revision:	https://reviews.freebsd.org/D9303
2017-02-20 23:48:50 +00:00
Dag-Erling Smørgrav
f3b0ac3409 Upgrade to OpenPAM Radula. 2017-02-20 00:56:46 +00:00
Baptiste Daroussin
1f87cafa31 Import mandoc 1.4.1rc2 2017-02-19 17:46:37 +00:00
Baptiste Daroussin
11dd9ed664 Import libucl 20170219
MFC after:	3 days
2017-02-19 17:37:16 +00:00
Dimitry Andric
a3906ca572 Merge ^/head r313644 through r313895. 2017-02-17 20:19:38 +00:00
Dimitry Andric
2bcad0d8d6 Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r295380, and update build glue.
2017-02-17 20:07:35 +00:00
Dimitry Andric
b0f512390e Pull in r285478 from upstream compiler-rt trunk (by Saleem Abdulrasool):
build: give aliases the same visibility

  ARM EABI also uses function aliases.  Ensure that those aliased
  functions are given proper visibility annotations.

Reported by:	mmel
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D9633
2017-02-16 21:03:43 +00:00
Martin Matuska
5d6770bd30 MFV r313781:
Sync libarchive with vendor

Vendor changes:
Make SCHILY.acl.ace header more compact (NFSv4 ACLs)

Vendor bugfixes:
zip reader integer parsing fix (OSS-Fuzz 556)
spelling fixes (issue #863)
2017-02-15 20:17:55 +00:00
Ed Maste
26ab9a178c localtime: return NULL if time_t out of range of struct tm
Previously we would truncate tm.tm_year for any time_t corresponding to
a year that does not fit in int.  This issue was discovered because it
caused the bash-static build to fail when linking with LLD.

As reported by Rafael Espíndola:

    Configure has

    AC_FUNC_MKTIME

    which expands to a test of mktime that fails with the freebsd
    implementation. Given that, bash compiles a mktime.o file that
    defines just mktime and uses localtime. That goes in a .a file
    that is before libc.

    The freebsd libc defines mktime in localtime.o, which also defines
    localtime among other functions.

    When lld sees an undefined reference to mktime from libc, it uses
    the bash provided one and then tries to find a definition of
    localtime. It is found on libc's localtime.o, but now we have a
    duplicated error.

    The reason it works with bfd is that bash doesn't use mktime
    directly and the undefined reference from libc is resolved to the
    libc implementation. It would also fail to link if bash itself
    directly used mktime.

The bash-static configure test verifies that, for many values of t, either
localtime(t) returns NULL or mktime(localtime(t)) == t.  This test failed
when localtime returned a truncated tm_year.

This was fixed in tzcode in 2004 but has persisted in our tree since
rS2708.

Reported by:	Rafael Espíndola
Reviewed by:	bapt
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9534
2017-02-15 15:32:29 +00:00
Xin LI
b86fcc147f MFV r313759: license change for a few headers (4 clause BSD to 3 clause BSD).
MFC after:	28 days
X-MFC-with:	r313695
2017-02-15 07:22:47 +00:00
Xin LI
ada6f083b9 MFV r313676: libpcap 1.8.1
MFC after:	1 month
2017-02-13 08:23:39 +00:00
Dimitry Andric
1a36faad54 Merge ^/head r313301 through r313643. 2017-02-11 14:04:18 +00:00
Dimitry Andric
5ca5951e31 Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r294803, and update build glue.
2017-02-11 13:58:05 +00:00
Martin Matuska
333b68ab52 MFV r313569:313569:313569:
Sync libarchive with vendor

Vendor bugfixes:
cpio reader sanity fix (OSS-Fuzz 504)
WARC reader sanity fixes (OSS-Fuzz 511, 526, 532, 552)
mtree reader time parsing fix (OSS-Fuzz 538)
XAR reader memleak fix (OSS-Fuzz 551)

MFC after:	1 week
2017-02-11 01:00:58 +00:00
Gleb Smirnoff
00dffd7e7d Don't check struct rtentry on FreeBSD, it is an internal kernel structure.
On other systems it may be API structure for SIOCADDRT/SIOCDELRT.

Reviewed by:	emaste, dim
2017-02-10 17:34:48 +00:00
Ed Maste
0bce01b269 lld: Allow arbitrary code alignment in .eh_frame
According to the specification, CIE code alignment factor is an
arbitrary unsigned LEB128 encoded value.

PR:		216908
Reported by:	Wolfgang Meyer
Obtained from:	Upstream LLD r277105
MFC after:	1 week
2017-02-08 20:31:54 +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
67c58b9926 MFhead@r313433 2017-02-08 08:55:05 +00:00
Justin Hibbits
9569e13dce Add elf*-powerpc-freebsd targets to the elftoolchain target list
FreeBSD uses the full target triple when generating embedded rootfs images
(MFS_IMAGE= make option).  Without this change objcopy errors out with:

objcopy: elf64-poewrpc-freebsd: invalid target name

MFC after:	2 weeks
2017-02-08 03:21:29 +00:00
Enji Cooper
cad7148985 Oops... put the atf_tc_expect_fail in the testcase definition, not the
test suite definition
2017-02-07 19:02:59 +00:00
Enji Cooper
ce801ad813 Expect the t_precision long double checks to fail on FreeBSD/i386
There are some potential issues with the test (as brd@ has pointed out
elsewhere) with precision, etc not being set before the test, but as
always, more research is required.
2017-02-07 18:57:52 +00:00
Enji Cooper
4a2dbde724 MFhead@r313398 2017-02-07 18:47:16 +00:00
Enji Cooper
fa841eb67a Apply r274475's to expr.oxout.tab.c to fix the test on FreeBSD
YYINT on FreeBSD is int, not short

I'll work with the upstream maintainer or come up with a build
method of modifying their definitions on install instead of
having to modify tests to match our forked YYINT definition.

PR:		216891
Sponsored by:	Dell EMC Isilon
2017-02-07 18:37:46 +00:00
Enji Cooper
62d02a8f74 Add #else case in run(..) to fix test on non-{amd64,arm64,mips} after
recent refactoring to the test
2017-02-07 06:34:02 +00:00
Enji Cooper
a678f77962 MFhead@r313380 2017-02-07 06:04:13 +00:00
Enji Cooper
87e886953f Expect :floatunditf to fail on FreeBSD/i386
The precision error on FreeBSD/i386 doesn't match the expected output in
long double form.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 04:15:41 +00:00
Enji Cooper
7047ed6854 Expect :hsearch_r_nonexistent to fail on FreeBSD
The docs and the behavior mismatch; as noted in the bug, the behavior
for hsearch_r matches Linux, whereas the docs seem to match NetBSD
requirements wise.

PR:	216872
2017-02-07 02:57:11 +00:00
Enji Cooper
f2b9adff63 Uncomment more of the hsearch_r testcases
Call hdestroy/hdestroy_r on FreeBSD instead of hdestroy(1?)(_r).

All but hdestroy_r_nonexistent pass as-is.
2017-02-07 02:00:14 +00:00
Enji Cooper
15df32b48d MFhead@r313360 2017-02-07 01:33:39 +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
Dimitry Andric
f9edb08480 Merge ^/head r313055 through r313300. 2017-02-05 20:03:05 +00:00
Dimitry Andric
899ca3d65f Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r294123, and update build glue.
2017-02-05 19:57:41 +00:00
Enji Cooper
dd66b5baa8 Merge in changes from ^/vendor/NetBSD/tests/dist@r313245
Diff reduce lib/libm/t_pow.c per upstream changes
2017-02-04 18:20:07 +00:00
Enji Cooper
9b3ece1c2e MFhead@r313243 2017-02-04 18:06:09 +00:00
Dimitry Andric
c819c1240d Pull in r293773 from upstream llvm trunk (by Sanjay Patel):
[ValueTracking] avoid crashing from bad assumptions (PR31809)

  A program may contain llvm.assume info that disagrees with other
  analysis. This may be caused by UB in the program, so we must not
  crash because of that.

  As noted in the code comments:
  https://llvm.org/bugs/show_bug.cgi?id=31809
  ...we can do better, but this at least avoids the assert/crash in the
  bug report.

  Differential Revision: https://reviews.llvm.org/D29395

This fixes an assertion when building editors/emacs-devel.

PR:		216614
2017-02-02 23:01:29 +00:00
Jung-uk Kim
3e794565fc MFV: r313101
Update byacc to 20170201.
2017-02-02 20:00:01 +00:00
Gleb Smirnoff
3057e051be Reduce diff to upstream using HAVE_CAPSICUM instead of __FreeBSD__. It'll also
make it easier to upstream HAVE_CASPER patch.
2017-02-02 19:56:41 +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
Dimitry Andric
077e1117dc Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r293807, and update build glue.
2017-02-01 21:57:07 +00:00
Dimitry Andric
71fe94fdb1 Merge ^/head r312968 through r313054. 2017-02-01 21:21:01 +00:00
Dimitry Andric
4ee07888b7 Pull in r293536 from upstream compiler-rt trunk:
Recommit: Stop intercepting some malloc-related functions on FreeBSD
  and macOS

  Summary:
  In https://bugs.freebsd.org/215125 I was notified that some configure
  scripts attempt to test for the Linux-specific `mallinfo` and
  `mallopt` functions by compiling and linking small programs which
  references the functions, and observing whether that results in
  errors.

  FreeBSD and macOS do not have the `mallinfo` and `mallopt` functions,
  so normally these tests would fail, but when sanitizers are enabled,
  they incorrectly succeed, because the sanitizers define interceptors
  for these functions.  This also applies to some other malloc-related
  functions, such as `memalign`, `pvalloc` and `cfree`.

  Fix this by not intercepting `mallinfo`, `mallopt`, `memalign`,
  `pvalloc` and `cfree` for FreeBSD and macOS, in all sanitizers.

  Also delete the non-functional `cfree` wrapper for Windows, to fix the
  test cases on that platform.

  Reviewers: emaste, kcc, rnk

  Subscribers: timurrrr, eugenis, hans, joerg, llvm-commits, kubamracek

  Differential Revision: https://reviews.llvm.org/D27654

This prevents autoconf scripts from incorrectly detecting that functions
like mallinfo, mallopt, memalign, pvalloc and cfree are supported.

PR:		215125, 215455
MFC after:	1 week
2017-02-01 20:41:09 +00:00
Gleb Smirnoff
3340d77368 Update tcpdump to 4.9.0.
It fixes many buffer overflow in different protocol parsers, but none of
them are critical, even in absense of Capsicum.

Security:	CVE-2016-7922, CVE-2016-7923, CVE-2016-7924, CVE-2016-7925
Security:	CVE-2016-7926, CVE-2016-7927, CVE-2016-7928, CVE-2016-7929
Security:	CVE-2016-7930, CVE-2016-7931, CVE-2016-7932, CVE-2016-7933
Security:	CVE-2016-7934, CVE-2016-7935, CVE-2016-7936, CVE-2016-7937
Security:	CVE-2016-7938, CVE-2016-7939, CVE-2016-7940, CVE-2016-7973
Security:	CVE-2016-7974, CVE-2016-7975, CVE-2016-7983, CVE-2016-7984
Security:	CVE-2016-7985, CVE-2016-7986, CVE-2016-7992, CVE-2016-7993
Security:	CVE-2016-8574, CVE-2016-8575, CVE-2017-5202, CVE-2017-5203
Security:	CVE-2017-5204, CVE-2017-5205, CVE-2017-5341, CVE-2017-5342
Security:	CVE-2017-5482, CVE-2017-5483, CVE-2017-5484, CVE-2017-5485
Security:	CVE-2017-5486
2017-02-01 20:26:42 +00:00
Justin Hibbits
e0b603cb9e Add rfdi opcode to binutils
The rfdi instruction is part of the e500mc and derivative cores.  It came into
binutils in a GPLv3 patch, along with the rest of the e500mc instruction set.
Currently only rfdi is planned to be used, so rather than attempt to backport
the full patch, take a surgical route and add instructions as needed.

MFC after:	2 weeks
2017-02-01 02:42:45 +00:00
Dimitry Andric
fab7084f12 Pull in r279454 from upstream llvm trunk (by James Molloy):
[SROA] Remove incorrect assertion

  Confirmed with aprantl, this assertion is incorrect - code can get
  here (for example 80-bit FP types) and if it does it's benign. This
  is exposed by a completely unrelated patch of mine, so stop the
  compiler falling over.

  Original differential: http://reviews.llvm.org/D16187
  aprantl's advice to remove assertion:
  http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160815/382129.html

This should fix assertions when building the math/opensolaris-libm port.

Reported by:	marino
MFC after:	3 days
2017-01-30 18:35:24 +00:00
Pedro F. Giffuni
87b2cfcecf MFV r312970:
openresolv: update to version 3.9.0.

It is now possible to drop the _WITH_ARG vars thanks to a change to the
pdns_recursor upstreamed by Guy Yur.

MFC after:	3 weeks
2017-01-30 16:32:53 +00:00
Dimitry Andric
65575c1424 Merge ^/head r312894 through r312967. 2017-01-29 22:00:47 +00:00
Dimitry Andric
98221d2e7e Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r293443, and update build glue.
2017-01-29 21:56:47 +00:00
Baptiste Daroussin
b4b4b5304b Revert crap accidentally committed 2017-01-28 16:31:23 +00:00
Baptiste Daroussin
814aaaa7da Revert r312923 a better approach will be taken later 2017-01-28 16:30:14 +00:00
Ed Maste
5be48d84be add octeon+ as an alias for octeon in GCC & binutils
In r208737 jmallett@ added support for the "mips64r2" architecture
and "octeon" CPU, and the saa/saad instructions.

Upstream binutils also added the "octeon+" CPU, and the saa/saad
instructions are only available in octeon+, not octeon.  Since our
base system tool chain already accepts saa/saad with -march=octeon,
just allow octeon+ as an alias.

This allows the use of octeon+ in kernel config files, for use with both
external tool chain and in-tree GCC/binutils.

PR:		216516
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2017-01-27 21:31:32 +00:00
Dimitry Andric
14f850f3df Merge ^/head r312720 through r312893. 2017-01-27 20:01:46 +00:00
Ed Maste
3dd7b92917 lld: do not round up PT_GNU_RELRO p_memsz
The change was made to support glibc and believed to be a no-op on
FreeBSD, but that is not the case for architectures with multiple page
sizes, such as arm64. The relro p_memsz header was rounded up to the
default maximum page size (64K). When 4K pages are in use, multiple
pages beyond the final PT_LOAD segment had their permissions changed to
read-only after application of relocations and copy relocations, which
led to a segfault in certain cases.

This reverts upstream r290986. I have started a discussion about the
upstream fix on the LLVM mailing list.

Reported by:	andrew
Sponsored by:	The FreeBSD Foundation
2017-01-27 16:53:53 +00:00
Dimitry Andric
2d0512c137 Pull in r278160 from upstream llvm trunk (by Wei Mi):
Recommit "Use ValueOffsetPair to enhance value reuse during SCEV
  expansion".

  The fix for PR28705 will be committed consecutively.

  In D12090, the ExprValueMap was added to reuse existing value during
  SCEV expansion. However, const folding and sext/zext distribution can
  make the reuse still difficult.

  A simplified case is: suppose we know S1 expands to V1 in
  ExprValueMap, and
    S1 = S2 + C_a
    S3 = S2 + C_b
  where C_a and C_b are different SCEVConstants. Then we'd like to
  expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is
  helpful when S2 is a complex SCEV expr and S2 has no entry in
  ExprValueMap, which is usually caused by the fact that S3 is
  generated from S1 after const folding.

  In order to do that, we represent ExprValueMap as a mapping from SCEV
  to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a}
  into the ExprValueMap when we create SCEV for V1. When S3 is
  expanded, it will first expand S2 to V1 - C_a because of S2->{V1,
  C_a} in the map, then expand S3 to V1 - C_a + C_b.

  Differential Revision: https://reviews.llvm.org/D21313

Pull in r278161 from upstream llvm trunk (by Wei Mi):

  Fix the runtime error caused by "Use ValueOffsetPair to enhance value
  reuse during SCEV expansion".

  The patch is to fix the bug in PR28705. It was caused by setting
  wrong return value for SCEVExpander::findExistingExpansion. The
  return values of findExistingExpansion have different meanings when
  the function is used in different ways so it is easy to make mistake.
  The fix creates two new interfaces to replace
  SCEVExpander::findExistingExpansion, and specifies where each
  interface is expected to be used.

  Differential Revision: https://reviews.llvm.org/D22942

Pull in r281439 from upstream llvm trunk (by Wei Mi):

  Create a getelementptr instead of sub expr for ValueOffsetPair if the
  value is a pointer.

  This patch is to fix PR30213. When expanding an expr based on
  ValueOffsetPair, if the value is of pointer type, we can only create
  a getelementptr instead of sub expr.

  Differential Revision: https://reviews.llvm.org/D24088

This should fix assertion failures when building OpenCV >= 3.1, and also
allow building lang/spidermonkey24 without any further assertions.

PR:		215649
MFC after:	1 week
2017-01-26 20:39:43 +00:00
Dimitry Andric
b9389c99a5 Revert r312765 for now, since it causes assertions when building
lang/spidermonkey24.

Reported by:	antoine
PR:		215649
2017-01-26 20:18:28 +00:00
Cy Schubert
520f089ad0 Use normal KNF cuddling of elses.
Reported by:	bde
MFC after:	2 weeks
X-MFC with:	r312777
2017-01-26 04:51:48 +00:00
Cy Schubert
971fa117c0 Currently the fragment info is placed at the top of the linked list
under a shared read lock. This patch attempts to upgrade the lock to
an exclusive write lock. If the exclusive write lock fails to be
obtained, the current fragment is not placed at the head of the list.

This portion of the patch was inspired by NetBSD ip_frag.c r1.4 (which
effectively removed the section of code that performed the reordering).

The patch to sys/contrib/ipfilter/netinet/ip_compat.h adds the
MUTEX_TRY_UPGRADE macro to support the patch to ip_frag.c.

The patch to contrib/ipfilter/lib/rwlock_emul.c supports this patch
by emulating the mutex in userspace when exercised by ipftest(1).

Inspired by:	NetBSD ip_frag.c r1.4
MFC after:	1 month
2017-01-26 01:24:05 +00:00
Cy Schubert
26594bd1ee Remove extraneous blank line.
MFC after:	2 weeks
X-MFC with:	r312777
2017-01-25 20:59:23 +00:00
Ed Maste
080b710889 strings: avoid unnecessary trip through handle_file for stdin
Sponsored by:	The FreeBSD Foundation
2017-01-25 20:59:06 +00:00
Cy Schubert
d780a32bc5 Issue an error message when an incorrect flush argument is
encountered.`

MFC after:	2 weeks
2017-01-25 20:41:16 +00:00
Dimitry Andric
1324fa835c Pull in r276136 from upstream llvm trunk (by Wei Mi):
Use ValueOffsetPair to enhance value reuse during SCEV expansion.

  In D12090, the ExprValueMap was added to reuse existing value during
  SCEV expansion. However, const folding and sext/zext distribution can
  make the reuse still difficult.

  A simplified case is: suppose we know S1 expands to V1 in
  ExprValueMap, and
    S1 = S2 + C_a
    S3 = S2 + C_b
  where C_a and C_b are different SCEVConstants. Then we'd like to
  expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is
  helpful when S2 is a complex SCEV expr and S2 has no entry in
  ExprValueMap, which is usually caused by the fact that S3 is
  generated from S1 after const folding.

  In order to do that, we represent ExprValueMap as a mapping from SCEV
  to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a}
  into the ExprValueMap when we create SCEV for V1. When S3 is
  expanded, it will first expand S2 to V1 - C_a because of S2->{V1,
  C_a} in the map, then expand S3 to V1 - C_a + C_b.

  Differential Revision: https://reviews.llvm.org/D21313

This should fix assertion failures when building OpenCV >= 3.1.

PR:		215649
MFC after:	3 days
2017-01-25 17:59:22 +00:00
Dimitry Andric
f8496407cb Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r292951, and update build glue.
2017-01-24 19:56:22 +00:00
Dimitry Andric
b1c1e77a87 Pull in r292833 from upstream libc++ trunk (by Eric Fiselier):
Manually force the use of __decltype in C++03 with Clang 3.4.

  <string> uses `decltype` in a way incompatible with `__typeof__`.
  This is problematic when compiling <string> with Clang 3.4 because
  even though it provides `__decltype` libc++ still used `__typeof__`
  because clang 3.4 doesn't provide __is_identifier which libc++
  uses to detect __decltype.

  This patch manually detects Clang 3.4 and properly configures
  for it.

This allows the graphics/openshadinglanguage port to build with
lang/clang34.

PR:		216054
2017-01-23 23:20:00 +00:00
Dimitry Andric
f23c525c9b Pull in r292830 from upstream libc++ trunk (by Eric Fiselier):
Fix GCC C++03 build by hiding default template argument in C++03

This allows the graphics/GraphicsMagic to compile with gcc 4.9 and
libc++.

PR:		216404
2017-01-23 22:10:57 +00:00
Dimitry Andric
e353c0d2f9 Pull in r292758 from upstream llvm trunk (by Sanjay Patel):
[x86] avoid crashing with illegal vector type (PR31672)

  https://llvm.org/bugs/show_bug.cgi?id=31672

This fixes an assertion while building graphics/gegl3.

PR:		216166
2017-01-22 18:31:49 +00:00
Dimitry Andric
daf78e69a8 Merge libc++ release_40 branch r292732. 2017-01-22 18:06:21 +00:00
Dimitry Andric
94c53d4054 Merge llvm, clang, lld and lldb release_40 branch 292732, and update
build glue.
2017-01-22 18:02:44 +00:00
Dimitry Andric
a4aa656aa5 Merge ^/head r312309 through r312623. 2017-01-22 16:05:13 +00:00
Baptiste Daroussin
7666f5006c Import mandoc cvs snapshot 20170121 (pre 1.14)
Note that mandoc does not use anymore sqlite3 but a home made database format
An important improvement has been made as well in makewhatis performance:
Tests on my laptop shows makewhatis on the entire system goes from 26s to 12s
2017-01-21 13:17:25 +00:00
Enji Cooper
4421971444 Add back #else block accidentally removed in r312145
This fixes the build with !(amd64|arm64|mips*)
2017-01-18 09:46:02 +00:00
Enji Cooper
5f761d3c88 Merge ^/vendor/NetBSD/tests/dist@r312370 2017-01-18 05:36:09 +00:00
Xin LI
ca6e7a016c MFV r312333: zlib 1.2.11.
MFC after:	1 month
2017-01-17 05:55:47 +00:00
Xin LI
850069632c Vendor import of zlib 1.2.11. 2017-01-17 05:47:05 +00:00
Gleb Smirnoff
1897a4f168 Fix regression from r310655, which broke operation of bsnmpd if it is bound
to a non-wildcard address.  As documented in ip(4), doing sendmsg(2) with
IP_SENDSRCADDR on a socket that is bound to non-wildcard address is
completely different to using this control message on a wildcard one.

A fix is to add a bool to mark whether we did setsockopt(IP_RECVDSTADDR)
on the socket, and use IP_SENDSRCADDR control message only if we did.

While here, garbage collect absolutely useless udp_recv() function that
establishes some structures on stack to never use them later.
2017-01-17 03:52:57 +00:00
Enji Cooper
6fa647788e Reintroduce libutil.h #include for FreeBSD only for fparseln 2017-01-16 20:46:40 +00:00
Dimitry Andric
9b1870035a Pull in r292133 from upstream llvm trunk (by Hal Finkel):
Fix use-after-free bug in AffectedValueCallbackVH::allUsesReplacedWith

  When transferring affected values in the cache from an old value,
  identified by the value of the current callback, to the specified new
  value we might need to insert a new entry into the DenseMap which
  constitutes the cache. Doing so might delete the current callback
  object. Move the copying logic into a new function, a member of the
  assumption cache itself, so that we don't run into UB should the
  callback handle itself be removed mid-copy.

  Differential Revision: https://reviews.llvm.org/D28749

This should fix crashes when building lld (as part of the llvmXY ports).

Reported by:	jbeich
PR:		216117
2017-01-16 19:53:18 +00:00
Enji Cooper
f115a1c3e0 Remove explicit pthread_np.h #include, per change in libnetbsd@r312303 2017-01-16 18:52:05 +00:00
Enji Cooper
ea498175b9 Diff reduce with upstream and prep for next set of content pushes 2017-01-16 18:44:40 +00:00
Enji Cooper
4acf8d706e Diff reduce with upstream by using macros and logic integrated in
later revisions of the test
2017-01-16 18:36:38 +00:00
Enji Cooper
39a3103b41 Use sys/param.h instead of sys/types.h to prep for upstreaming to NetBSD 2017-01-16 18:17:53 +00:00
Enji Cooper
e2a4e9c682 Remove unnecessary whitespace diff 2017-01-16 18:04:14 +00:00
Enji Cooper
183ae521e5 Use _SED instead of hacking tests rewriting mknod ... p as mkfifo
Similar to r312297
2017-01-16 17:53:58 +00:00
Enji Cooper
267f10b14c Use _SED to rewrite mknod ... p command as mkfifo instead of
adding an unnecessary diff to the test
2017-01-16 17:49:53 +00:00
Enji Cooper
3b0a9131e6 Merge ^/vendor/NetBSD/tests/dist@r312294
This includes a number of accepted upstream fixes, as well as
a reimplementation of the net/carp/... testcase (which is
currently unused).
2017-01-16 17:43:43 +00:00
Enji Cooper
89964aab17 Add GLOB_STAR #ifdef to testcases which require GLOB_STAR support 2017-01-16 07:41:39 +00:00
Enji Cooper
f467f63cbb Remove sys/param.h
It was used for nitems, but I converted it to __arraycount later, and
is already pulled in by header pollution on FreeBSD as well as NetBSD
ala sys/cdefs.h
2017-01-16 07:39:08 +00:00
Enji Cooper
5ca8558309 Drop unnecessary diff rewriting dict(..) function
This is already being properly handled via ATF config require.files call
2017-01-16 07:34:45 +00:00
Enji Cooper
6a93de28a6 Diff reduce with upstream and consolidate #ifdefs where possible 2017-01-15 22:00:59 +00:00
Enji Cooper
bfb8e4c9c4 Remove libutil.h #include on FreeBSD and instead favor stdio.h from libnetbsd 2017-01-15 21:38:19 +00:00
Enji Cooper
caeb04e465 lib/libc/gen/t_glob.c: diff reduce with NetBSD's copy 2017-01-15 10:17:15 +00:00
Enji Cooper
f40f3adc42 Pull in ^/vendor/NetBSD/tests/dist@r312219
Remove divergence with upstream where possible
2017-01-15 10:04:20 +00:00
Dimitry Andric
fb20e17e5a Pull in r292032 from upstream llvm trunk (by Yaron Keren):
Fix PR31644 introduced by r287138 and add a regression test.
  Thanks Dimitry Andric for the report and fix!

This should restore -MP output to what it was before.

Reported by:	jbeich
PR:		216043
2017-01-15 01:34:07 +00:00
Dimitry Andric
d370fd1cd8 Merge ^/head r311940 through r312200. 2017-01-14 22:20:12 +00:00
Dimitry Andric
7a848d17e7 Merge libc++ release_40 branch r292009. 2017-01-14 22:17:12 +00:00
Dimitry Andric
6313c2ae8d Merge compiler-rt release_40 branch r292009. 2017-01-14 22:16:01 +00:00
Dimitry Andric
f1a29dd344 Merge llvm, clang, lld and lldb release_40 branch r292009. Also update
build glue.
2017-01-14 22:12:13 +00:00
Enji Cooper
83e891f222 Revert t_pow@r312154
This hunk hasn't been accepted yet
2017-01-14 10:10:49 +00:00
Enji Cooper
1f6a3aa8e5 Fix the build using hunks pending upstream contributions 2017-01-14 10:08:22 +00:00
Enji Cooper
e0940c61c2 Diff reduce with upstream post-accepted contributions 2017-01-14 10:05:26 +00:00
Enji Cooper
81e7d81dc3 One more sys/types.h kevent clarification missed in r312151 2017-01-14 09:47:06 +00:00
Enji Cooper
ecab856bc9 Clarify why sys/types.h #include is needed on FreeBSD 2017-01-14 09:45:46 +00:00
Enji Cooper
c8300756f2 Use cleanup routines to remove POSIX semaphores instead of just blindly
unlinking them at the beginning of the testcase

This is a lot more intelligent in cleaning up the semaphores if the testcase
fails before sem_unlink is called.

Contributed back as bin/51872 upstream.
2017-01-14 09:42:06 +00:00
Enji Cooper
2a1440c618 Diff reduce with upstream by taking diff hunks that were contributed back 2017-01-14 09:38:40 +00:00
Enji Cooper
9f30f6b7c3 Readd the CMSG_DATA for assigning the kqueue... this testcase isn't officially
correct yet, but it's getting closer.
2017-01-14 09:25:09 +00:00
Enji Cooper
25785590d5 Remove extra EVSET I added in r312146 by accident 2017-01-14 09:21:36 +00:00
Enji Cooper
a41b7cf58e Diff reduce with upstream
Use CMSG_FIRSTHDR macro to properly link the kqueue to the socket to
get it to now return -1/EBADF with sendmsg per the testcase expectations
2017-01-14 09:20:54 +00:00
Enji Cooper
7bb9bc9cc2 Try to consolidate the #ifdef soup into FreeBSD vs non-FreeBSD blocks better 2017-01-14 08:47:00 +00:00
Enji Cooper
0e6a2253dc Diff reduce with upstream 2017-01-14 08:39:53 +00:00
Enji Cooper
6e515978dd Remove comment no longer true since the test no longer bombs out earlier on 2017-01-14 08:38:21 +00:00
Enji Cooper
04f40d86db Diff reduce with upstream 2017-01-14 08:36:43 +00:00
Enji Cooper
50e474a4f6 :strtold_nan: remove unnecessary strcmp check
It gets checked again later on in the testcase
2017-01-14 08:35:29 +00:00
Enji Cooper
1081817ad5 Diff reduce with upstream 2017-01-14 08:12:57 +00:00
Enji Cooper
154be35857 Use copy of sha2.h from libnetbsd 2017-01-14 08:11:17 +00:00
Enji Cooper
0e3f47800f Restore deleted line 2017-01-14 07:59:33 +00:00
Enji Cooper
1cb4521644 Diff reduce with upstream using lib/libnetbsd's updated copy of sha1.h 2017-01-14 07:58:40 +00:00
Enji Cooper
9a62e988b3 r312133 should have used the non-FreeBSD block 2017-01-14 07:50:29 +00:00
Enji Cooper
4e9c68081e Diff reduce with upstream by using util.h from libnetbsd instead of libutil.h 2017-01-14 07:48:22 +00:00
Enji Cooper
3b85282333 Diff reduce with upstream 2017-01-14 07:39:07 +00:00
Enji Cooper
88dd6cd01d Copy ^/vendor/NetBSD/tests/dist/lib/libc/hash/t_hmac.c to
contrib/netbsd-tests/lib/libc/hash/t_hmac.c

This was missed in r303980
2017-01-14 07:16:15 +00:00
Enji Cooper
8eace6ac0f Try again with a better commit message 2017-01-14 07:15:14 +00:00
Enji Cooper
519b4f22b0 Copy ^/vendor/NetBSD/tests/dist to contrib/netbsd-tests
This was missed in r303980
2017-01-14 07:14:25 +00:00
Enji Cooper
63d1fd5970 Merge content currently under test from ^/vendor/NetBSD/tests/dist/@r312123
Sponsored by:	Dell EMC Isilon
2017-01-14 06:49:17 +00:00
Enji Cooper
792bbaba98 Remove contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind
This should have been pruned in r305358

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-01-14 06:16:57 +00:00
Enji Cooper
36b9e15c66 Delete trailing whitespace and use __arraycount instead of nitems in contrib code
MFC after:	1 week
2017-01-14 03:54:23 +00:00
Enji Cooper
a5deb9babb Note that sys/types.h is required on FreeBSD for kqueue(2), unlike NetBSD
MFC after:	12 days
X-MFC with:	r305358
Sponsored by:	Dell EMC Isilon
2017-01-14 01:01:02 +00:00
Enji Cooper
cdebaff820 Upgrade NetBSD tests to 01.11.2017_23.20 snapshot
This contains some new testcases in /usr/tests/...:

- .../lib/libc
- .../lib/libthr
- .../lib/msun
- .../sys/kern

Tested on:	amd64, i386
MFC after:	1 month
2017-01-13 03:33:57 +00:00
Enji Cooper
9527fa4f66 Remove __HAVE_LONG_DOUBLE #define from t_strtod.c and place it in Makefile
This is to enable support in other testcases

Inspired by lib/msun/tests/Makefile .

MFC after:	1 week
2017-01-12 08:40:52 +00:00
Enji Cooper
35cfc322f1 Fix lib/libc/sys/access_test after r311925
sys/param.h needs to be #included in order for __FreeBSD_version to be checked

MFC after:	13 days
2017-01-12 08:31:42 +00:00
Ed Maste
c83bcfbd2e readelf: add S390 relocation types
From https://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_zSeries.html

Reviewed by:	bz
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9149
2017-01-11 22:54:04 +00:00
Ed Maste
0fbbe5bf87 readelf: add more PPC64 relocation types found in LLVM
MFC after:	2 weeks
MFC with:	r311941
Sponsored by:	The FreeBSD Foundation
2017-01-11 21:28:22 +00:00
Ed Maste
dd9d62b416 readelf: add PPC64 relocation types
Reported by:	Mark Millard
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9146
2017-01-11 21:18:14 +00:00
Dimitry Andric
8a6fe8ce60 Merge ^/head r311812 through r311939. 2017-01-11 21:05:13 +00:00
Enji Cooper
bccef7f6d9 Consolidate __NetBSD__ #ifdef
MFC after:	3 days
2017-01-11 10:20:35 +00:00
Enji Cooper
ddba0402f4 Import testcase updates with code contributed back to NetBSD
This also (inadvertently) contains an update to
contrib/netbsd-tests/lib/libc/sys/t_wait.c (new testcases).

MFC after:		2 weeks
In collaboration with:	christos@NetBSD.org
2017-01-11 09:51:34 +00:00
Enji Cooper
d1a6b5fb2f Fix whitespace in comment
MFC after:	3 days
2017-01-11 09:34:42 +00:00
Enji Cooper
0e0dd02306 Partially revert r311236
There's no sense in trying to close a file descriptor from the negative cases
with unlink_test; it's best to ignore these cases.

The mkfifo case does make sense to keep though.

MFC after:	3 days
2017-01-11 07:22:21 +00:00
Enji Cooper
19f27f3c34 Fix up r311227
Check for creat returning a value != -1, not a non-zero value

MFC after:	3 days
Pointyhat to:	ngie
Reported by:	Coverity
CID:		1368366
2017-01-11 07:17:03 +00:00
Martin Matuska
2dbf8c4a76 MFV r311899:
Sync libarchive with vendor.

Vendor bugfixes:
#691: Support for SCHILY.xattr extended attributes
#854: Spelling fixes

Multiple fixes in ACL code:
  - prefer acl_set_fd_np() to acl_set_fd()
  - if acl_set_fd_np() fails, do no fallback to acl_set_file()
  - do not warn if trying to write ACLs to a filesystem without ACL support
  - fix id handling in archive_acl_(from_to)_text*() for NFSv4 ACLs

MFC after:	1 week
X-MFC with:	r310866
2017-01-10 21:59:35 +00:00
Enji Cooper
7931520d40 Diff reduce with upstream by removing signal.h #include
MFC after:	3 days
2017-01-10 10:27:09 +00:00
Enji Cooper
b6a72c5dbe Merge ^/vendor/NetBSD/tests/dist@r311868
This is the vendor accepted version of ^/head@r311245

MFC after:	3 days
2017-01-10 10:16:59 +00:00
Enji Cooper
2bbc0fe246 Merge the grammar fix for lib/libc/gen/raise_test:raise_stress
MFC after:	3 days
2017-01-10 10:12:36 +00:00
Dimitry Andric
93729b12fb Merge compiler-rt trunk r291476. 2017-01-09 22:49:35 +00:00
Dimitry Andric
80779b3774 Merge libc++ trunk r291476, update Makefile, ObsoleteFiles.inc and
OptionalObsoleteFiles.inc.
2017-01-09 22:41:53 +00:00
Dimitry Andric
24e2fe98d0 Merge llvm, clang, lld and lldb trunk r291476. 2017-01-09 22:32:19 +00:00
Dimitry Andric
b0cc56edcc Merge ^/head r311692 through r311807. 2017-01-09 19:25:49 +00:00
Enji Cooper
818d3ff977 Add a REVISION section to track changes for the BEGEMOT-MIB MIB file
There haven't been any changes to the MIB definition, so the REVISION
remains static at the version it was imported at

MFC after:	1 week
2017-01-09 06:27:30 +00:00
Enji Cooper
0c72a43f3f Add a REVISION section to track changes for the FOKUS-MIB MIB file
There haven't been any changes to the MIB definition, so the REVISION
remains static at the version it was imported at

MFC after:	1 week
2017-01-09 06:24:28 +00:00
Enji Cooper
b55d259a14 Similar to r311750, check for the result from smiGetModule to avoid a segfault
when dereferencing a NULL pointer later on.

Choose to just check for the NULL pointer in the next for-loop for now to fix
the issue with a minimal amount of code churn

sys/queue.h use here would make more sense than using a static table

MFC after:	5 days
2017-01-09 06:13:27 +00:00
Enji Cooper
8406423362 Use calloc instead of malloc + memset(.., 0, ..)
MFC after:	5 days
2017-01-09 06:03:49 +00:00
Enji Cooper
c5f8d75113 Check result from smiGetFirstNode and smiGetNodeByOID
This avoids a segfault with malformed or unanticipated files,
like IPV6-TC.txt (a file containing just TEXTUAL-CONVENTIONS).

MFC after:	5 days
Found with:	gensnmpdef /usr/local/share/snmp/mibs/IPV6-TC.txt
2017-01-09 05:51:38 +00:00
Enji Cooper
fbd43e4c99 Add a REVISION section to track changes for the BEGEMOT-IP-MIB MIB file
There haven't been any changes to the MIB definition, so the REVISION
remains static at the version it was imported at

MFC after:	1 week
2017-01-09 03:21:21 +00:00
Enji Cooper
0ab7046959 Use nitems(mib) instead of hardcoding mib's length when calling sysctl(3)
MFC after:	3 days
2017-01-09 01:47:00 +00:00
Dimitry Andric
91f52fcc1f Clean out stuff we don't use. 2017-01-08 19:48:13 +00:00
Dimitry Andric
f00b4812b9 Merge compiler-rt r291274. 2017-01-08 19:47:17 +00:00
Dimitry Andric
aed8d94e97 Merge libc++ r291274, and update the library Makefile. 2017-01-08 19:39:03 +00:00
Dimitry Andric
69415bc524 Merge ^/head r311546 through r311683. 2017-01-08 14:36:18 +00:00
Dimitry Andric
00742f6ced Fix the following clang 4.0.0 warning in ngatm's snmp_atm.c:
contrib/ngatm/snmp_atm/snmp_atm.c:173:6: error: logical not is only
    applied to the left hand side of this bitwise operator
    [-Werror,-Wlogical-not-parentheses]
            if (!ifmr.ifm_status & IFM_AVALID) {
                ^                ~

Obviously, the masking needs to be done before the logical not
operation.  Add parentheses to make it so.

MFC after:      3 days
2017-01-07 15:57:12 +00:00
Ed Maste
d4cd50b494 libunwind: add noexec stack annotation
Reported by:	vangyzen
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9075
2017-01-07 14:40:58 +00:00
Dimitry Andric
05ea86b0c0 In tcpdump's print-tcp.c, avoid increasing alignment when taking the
addresses of members of struct ip, which is packed.  Since the pointers
are only used for memcmp'ing, they can be pointing to void instead.

Note that upstream has removed the src and dst variables, in the mean
time.

MFC after:	3 days
2017-01-07 00:17:01 +00:00
Dimitry Andric
dba092b109 After r311459, some ports can break, because a few of the newly added
prototypes in <tcpd.h> use FILE.  Pull in a minimal forward declaration
of FILE from <stdio.h> to minimize impact.  Sorry for the breakage.

Reported by:	Shawn Webb <shawn.webb@hardenedbsd.org>
X-MFC-With:	r311459
2017-01-06 21:40:30 +00:00
Dimitry Andric
7fa59e6718 Merge ^/head r311460 through r311545. 2017-01-06 20:33:48 +00:00
Dimitry Andric
95ec533a1d Merge llvm, clang, lld and lldb trunk r291274, and resolve conflicts. 2017-01-06 20:24:06 +00:00
Konstantin Belousov
1c32456953 Use type-independent formats for printing nlink_t and ino_t.
Extracted from:	ino64 work by gleb, mckusick
Discussed with:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-01-06 16:59:33 +00:00
Enji Cooper
08235f2408 Remove unnecessary __unused attribute attached to ctx in op_begemot_mibII(..)
MFC after:	3 days
2017-01-06 07:57:45 +00:00
Xin LI
1456f0f968 MFV r311477: xz 5.2.3.
MFC after:	2 weeks
2017-01-06 07:54:53 +00:00
Dimitry Andric
8da8161b26 Also remove unnecessary extern keywords from tcpd.h.
Noticed by:	kib
X-MFC-With:	r311459
2017-01-05 21:17:10 +00:00
Dimitry Andric
2b532af829 Merge ^/head r311314 through r311459. 2017-01-05 20:50:44 +00:00
Dimitry Andric
fd3e9b3896 Put proper prototypes in tcpd.h
Clang 4.0.0 complains about tcpd.h's not-really-prototypes, e.g.:

    /usr/include/tcpd.h:75:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
    extern int hosts_access();              /* access control */
                           ^

To fix this, turn these declarations into real prototypes.  While here,
garbage collect the incompatible rfc931() function from scaffold.c, as
it is never used.

Reviewed by:	emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D9052
2017-01-05 20:44:45 +00:00
Enji Cooper
60c2226f89 op_usm_users: don't deref uusers if it's NULL when SETting the value
Add an XXX comment to note that the conditional seems suspect given
how it's handled elsewhere in the SNMP_OP_SET case.

MFC after:	2 weeks
Reported by:	Coverity
CID:		1008573
2017-01-05 09:46:36 +00:00
Enji Cooper
3daec7ae72 snmp_table_fetch_async: don't leak work if snmp_pdu_send(..) fails
MFC after:	1 week
Reported by:	Coverity
CID:		1017276
2017-01-05 08:49:06 +00:00
Enji Cooper
994c8618ec op_usm_users: fix indentation in SNMP_OP_SET block
MFC after:	3 days
2017-01-05 08:27:23 +00:00
Enji Cooper
446bd8a476 Use calloc instead of malloc + memset(.., 0, ..)
MFC after:	3 days
2017-01-05 08:17:17 +00:00
Enji Cooper
70157df618 lsock_init_port: address issues with initializing sockaddr_un object
- Use strlcpy to ensure p->name doesn't overflow sa.sun_path [*].
- Use SUN_LEN(..) instead of spelling out calculation longhand (inspired
  by comment by jmallett).

Tested with:	dgram and stream support with both bsnmpwalk and snmpwalk

MFC after:	1 week
Reported by:	Coverity
CID:		1006825
2017-01-05 08:14:20 +00:00
Enji Cooper
10a0306a2e lm_load: fix string copying issues
- Ensure `section` doesn't overrun section by using strlcpy instead of
  strcpy [*].
- Use strdup instead of malloc + strcpy (this wasn't flagged by Coverity,
  but is an opportunistic change).

MFC after:	1 week
Reported by:	Coverity
CID:		1006826 [*]
2017-01-05 07:55:17 +00:00
Enji Cooper
20a4ce8bf2 Redo fix for CID 979581
The previous change was flawed in terms of how it calculated the
buffer length for the sockaddr_un object. Use SUN_LEN where
appropriate and mute the Coverity complaint by using memset(.., 0, ..)
to zero out the entire structure instead of setting .sun_len to a bogus
value and strlcpy'ing in the contents of argv[1].

SUN_LEN is now being passed to bind(2) as well. For some odd reason
this wasn't flagged as a bug with Coverity.

Reported by:	jilles, jmallett
MFC after:	2 days
X-MFC with:	r311233
2017-01-05 07:46:57 +00:00
Dimitry Andric
e466241c2a Merge llvm, clang, lld and lldb trunk r291015, and resolve conflicts. 2017-01-04 22:29:00 +00:00
Dimitry Andric
8e0f8b8c96 Merge llvm, clang, lld and lldb trunk r291012, and resolve conflicts. 2017-01-04 22:19:42 +00:00
Dimitry Andric
91b95f3d9a Merge ^/head r311132 through r311305. 2017-01-04 20:41:43 +00:00
Dimitry Andric
629e066c03 Update lldb Makefile, and disable some functionality for Windows and
Darwin.
2017-01-04 19:53:04 +00:00
Xin LI
a94dccbe27 MFV r311279: zlib 1.2.10.
MFC after:	1 month
2017-01-04 16:09:08 +00:00
Enji Cooper
ccd0cf8ffa snmp_mibII(3) requires net/if.h and net/if_mib.h
Document that requirement

MFC after:	1 week
2017-01-04 10:08:18 +00:00
Xin LI
ea3017ea00 Vendor import of zlib 1.2.10. 2017-01-04 09:37:45 +00:00
Xin LI
e16f0839c6 Restructure libz, place vendor files in contrib/zlib like other third
party software, this provides more standarized import workflow and
makes future upgrades easier.

The following files are new with this commit:

	zconf.h.in
	zlib.map
	zlib.pc.in

They are not connected to build, but were kept in tree for reference
for future maintenance.

All our local trivial changes were applied to contrib/zlib, and the
contrib/zlib vendor source code is intended to 100% match lib/libz
before this commit.

MFC after:	2 weeks
2017-01-04 09:30:47 +00:00
Enji Cooper
d6766132c2 run: ensure pthread_condattr_{init,setclock} is successful
MFC after:	1 week
Reported by:	Coverity
CID:		1268631, 1268633
2017-01-04 09:06:49 +00:00
Enji Cooper
dca7cc9815 setrlimit_basic: don't leak buf; free it on completion
MFC after:	3 days
Reported by:	Coverity
CID:		978311
2017-01-04 09:00:16 +00:00
Enji Cooper
fcc9604d43 revoke_perm: don't leak fd at the end of the test; close it
This code is unused on FreeBSD, but it mutes a valid Coverity warning
which would be true on NetBSD

MFC after:	3 days
Reported by:	Coverity
CID:		978311
2017-01-04 08:59:06 +00:00
Enji Cooper
621b0f13af stat_symlink: don't leak fd; close the file descriptor when done
MFC after:	3 days
Reported by:	Coverity
CID:		978314
2017-01-04 08:49:07 +00:00
Enji Cooper
c0b11b8e04 pipe_restart: free f on function exit to quell complaint from Coverity
MFC after:	3 days
Reported by:	Coverity
CID:		978307
2017-01-04 08:43:27 +00:00
Enji Cooper
64af3fbaba swapcontext1: test for getcontext(3) and swapcontext(3) success properly
The beforementioned libcalls both succeed if the return codes aren't -1

MFC after:	3 days
Reported by:	Coverity
CID:		976790, 976791
2017-01-04 08:35:46 +00:00
Enji Cooper
7251167f52 Clarify lifetime of child(..) function
Ensure child exits when complete as it's always run in a forked
process.

Add a missing break statement in :pselect_sigmask when calling
child(..) for clarity and to avoid weird domino effects if the
child process somehow does something it's not supposed to do
with the logfiles, file descriptors, etc

MFC after:	1 week
Reported by:	Coverity
CID:		1223369, 1223370, 1300301
2017-01-04 08:25:31 +00:00
Xin LI
0594943177 Add missing files in zlib 1.2.8. 2017-01-04 08:12:31 +00:00
Enji Cooper
17a0c1eb75 fpu: ensure calls to pthread_create succeed and test sched_yield to make
sure it returns 0

sched_yield tests for values returning 0 of type int and sched_yield is
of type long, so the test is a mismatch

MFC after:	1 week
Reported by:	Coverity
CID:		1254953, 1254954, 1254965, 1254966
2017-01-04 08:07:48 +00:00
Enji Cooper
2e590d595e Use calloc instead of malloc with buffers in snmp_{recv,send}_packet
This doesn't fix the issue noted in the PR, but at the very least it
cleans up the error so it looks a bit more sane, and in the event
that bsnmp did wander off into the weeds, the likelihood of it
crashing with more sensible output is greater, in my opinion

MFC counter set high so I have enough time to resolve the real
underlying bug in bsnmpwalk

MFC after:	1 month
PR:		215721
2017-01-04 07:53:01 +00:00
Enji Cooper
b5bbd2a17c mincore_resid: free buf after use
MFC after:	3 days
Reported by:	Coverity
CID:		978304
2017-01-04 04:55:33 +00:00
Enji Cooper
83e8b13f15 {strchr,strlen}_basic: don't leak the dlopen'ed handle; close after use
MFC after:	3 days
Reported by:	Coverity
CID:		978299, 978300
2017-01-04 04:50:03 +00:00
Enji Cooper
5d37d9cc25 mknodat_fd: close dfd after use to avoid leaking it
MFC after:	3 days
Reported by:	Coverity
CID:		978287
2017-01-04 04:32:00 +00:00
Enji Cooper
f4cbf11049 mkfifoat_fd: close dfd after use to avoid leaking it
MFC after:	3 days
Reported by:	Coverity
CID:		978286
2017-01-04 04:29:53 +00:00
Enji Cooper
5641f109c1 fexecve: don't leak fd on fexecve(2) failure; close before calling err
MFC after:	3 days
Reported by:	Coverity
CID:		978285
2017-01-04 04:27:13 +00:00
Enji Cooper
3b33767589 tty: don't leak s after opening it with openpty
MFC after:	3 days
Reported by:	Coverity
CID:		978321
2017-01-04 04:19:05 +00:00
Enji Cooper
57f5b7d843 mmap_prot_3, mmap_truncate, mmap_truncate_signal: don't leak fd and map
Reported by:	Coverity
CID:		978306, 1251406, 1288196, 1300541
2017-01-04 04:10:36 +00:00
Enji Cooper
619898777b listen_low_port: check for errors from socket(2) before continuing
MFC after:	3 days
Reported by:	Coverity
CID:		976778
2017-01-04 03:59:50 +00:00
Enji Cooper
2020383ffd kqueue_desc_passing: initialize m.msg_flags to 0
This mutes an uninitialized scalar warning from Coverity

MFC after:	3 days
Reported by:	Coverity
CID:		979620
2017-01-04 03:54:54 +00:00
Enji Cooper
ab25ecadbf umask_open: don't leak fd on success
MFC after:	3 days
Reported by:	Coverity
CID:		978315
2017-01-04 03:41:16 +00:00
Enji Cooper
3c917d6fa3 unlink_fifo: don't leak the file descriptors opened with mkfifo and open
MFC fater:	3 days
Reported by:	Coverity
CID:		978316, 978317
2017-01-04 03:35:23 +00:00
Enji Cooper
6a64e31600 ttyname_err: close fd if it was opened successfully
MFC after:	3 days
Reported by:	Coverity
CID:		978292
2017-01-04 02:52:39 +00:00
Enji Cooper
cc34906655 Fix Coverity issues
- Initialize .sun_len before passing it to strlcpy and bind.
- Close fd on error

MFC after:	3 days
Reported by:	Coverity
CID:		978283, 979581
2017-01-04 02:46:36 +00:00
Enji Cooper
251d8e776e humanize_number_basic: don't leak buf
MFC after:	3 days
Reported by:	Coverity
CID:		1251407
2017-01-04 02:38:14 +00:00
Enji Cooper
06cd8428bc ftok_link: don't leak fd
MFC after:	3 days
Reported by:	Coverity
CID:		978291
2017-01-04 02:34:30 +00:00
Enji Cooper
05aee7d5b0 seekdir_basic: fix various Coverity issues
Address..
- .. resource leaks of file descriptors and memory
- .. unchecked return values from creat(2), mkdir(2), and telldir(3)
- .. potential NULL derefs after calling readdir(3)

MFC after:	1 week
Reported by:	Coverity
CID:		975255, 975256, 976989, 978989, 978990
2017-01-04 02:31:05 +00:00
Enji Cooper
1a55af1fb9 Initialize msg.msg_flags to 0
This mutes a valid coverity warning about it being uninitialized
when passed in to sendmsg(2).

MFC after:	2 weeks
Reported by:	Coverity
CID:		1368202
2017-01-04 01:38:07 +00:00
Dimitry Andric
ded09321a8 Disable PDB support in LLVMSymbolizer for now, to avoid llvm-objdump
pulling in all the PDB handling code.
2017-01-03 20:19:37 +00:00
Dimitry Andric
dfb5f2eb8a Fix printf format warning on i386. 2017-01-03 18:10:23 +00:00
Dimitry Andric
e9f2ce8531 Comment out more unused functionality. 2017-01-03 18:09:54 +00:00
Dimitry Andric
545866cd2e Remove incorrectly merged code fragment. 2017-01-03 18:09:16 +00:00
Dimitry Andric
5bf4713bde Fix line endings (upstream file has CRLF ones). 2017-01-02 22:05:05 +00:00
Dimitry Andric
435933dd67 Update lldb to trunk r290819 and resolve conflicts. 2017-01-02 21:59:52 +00:00
Dimitry Andric
1189dbaa8c Update lld to trunk r290819 and resolve conflicts. 2017-01-02 21:32:52 +00:00
Dimitry Andric
4429064704 Update clang to trunk r290819 and resolve conflicts. 2017-01-02 21:29:30 +00:00
Dimitry Andric
d88c1a5a57 Update llvm to trunk r290819 and resolve conflicts. 2017-01-02 21:25:48 +00:00
Enji Cooper
84d0b89e96 Fix spelling errors; bump .Dd for the change
MFC after:	3 days
2017-01-01 05:23:01 +00:00
Enji Cooper
d1b4c796ac Bump .Dd for the spelling and .Nm updates
MFC after:	3 days
2017-01-01 05:16:24 +00:00
Enji Cooper
d075380571 Fix spelling errors
MFC after:	3 days
Reported by:	igor
2017-01-01 05:14:58 +00:00
Enji Cooper
ad52f0d10c bsnmpclient(3) also documents snmp_client_init, snmp_client_set_host,
and snmp_client_set_port. Add them to the NAME section

MFC after:	3 days
2017-01-01 05:13:54 +00:00
Enji Cooper
1cc49661ec snmp_discover_engine: fix up req/resp (PDU object) handling a bit
- Call snmp_pdu_free on req and resp when done with the objects
- Call snmp_pdu_free on req before calling snmp_pdu_create on it
  again

MFC after:	1 week
2016-12-31 23:20:57 +00:00
Enji Cooper
560c5ef9a2 Similar to r310954, set .len to 0 on malloc failure and to len only
on success

MFC after:	1 week
2016-12-31 12:37:53 +00:00
Enji Cooper
39ebb4e1e0 Initialize ret to SNMPD_INPUT_OK at the top of snmp_input_start(..) to
avoid returning an uninitialized value

There are some really complicated, snakey if-statements combined with
switch statements that could result in an invalid value being returned
as `ret`

MFC after:	1 week
Reported by:	Coverity
CID:		1006551
2016-12-31 12:30:14 +00:00
Enji Cooper
8e02b381d3 Use strlcpy when copying com to pdu->community to avoid potential
buffer overruns

MFC after:	1 week
Reported by:	Coverity
CID:		1006823, 1006824
2016-12-31 12:18:17 +00:00
Enji Cooper
a0e0e1ffa5 MIB-II: use strlcpy instead of strcpy when copying {descr,name}
This is of course to avoid buffer overruns

The remaining strcpy instance in the module needs to be audited for
correctness

MFC after:	1 week
Reported by:	Coverity
CID:		1006827, 1006828
2016-12-31 12:03:25 +00:00
Enji Cooper
02ff676c4d MIB-II: use strlcpy when copying interface names to .ifr_name
.ifra_name is assumed to be NUL terminated; using strlcpy(3)
ensures that it's indeed NUL terminated whereas strncpy does
not.

Tested and verified as follows with a combination of ifconfig,
snmpget, and snmpset:

  % ifconfig create lo1 127.0.0.2/8
  % SNMPARGS="-v 3 -n '' -u bsnmp -A bsnmptest -l authPriv -a sha -x des -X bsnmptest localhost"
  % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
  IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
  % snmpset $SNMPARGS IF-MIB::ifAdminStatus.4 i 2
  IF-MIB::ifAdminStatus.4 = INTEGER: down(2)
  % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
  IF-MIB::ifAdminStatus.4 = INTEGER: down(2)
  % snmpset $SNMPARGS IF-MIB::ifAdminStatus.4 i 1
  IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
  % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
  IF-MIB::ifAdminStatus.4 = INTEGER: up(1)

MFC after:	2 weeks
Reported by:	Coverity
CID:		1009652-1009656, 1349850
2016-12-31 11:50:36 +00:00
Enji Cooper
1e5211d238 Unbreak the build by passing the string to strdup, not its length
MFC after:	1 week
X-MFC with:	r310931
Pointyhat to:	ngie
2016-12-31 11:24:12 +00:00
Enji Cooper
bfb81e6524 Use strdup in snmp_parse_server(..) when possible instead of malloc+strcpy
This simplifies the code and mutes a Coverity warning about sc->cport being
improperly allocated

Reported by:	Coverity
CID:		1018247
MFC after:	1 week
2016-12-31 11:13:00 +00:00
Enji Cooper
8373993535 Guard against use-after-free after calling mibif_free(..)
Set variables to NULL after calling free.

Also, remove unnecessary if (x != NULL) checks before calling free(x)

MFC after:	1 week
2016-12-30 23:44:39 +00:00
Martin Matuska
739d7cfd6d MFV r310869:
Sync libarchive with vendor.

Vendor bugfixes:
Use __LA_DEPRECATED macro with functions deprecated in 379867e (r310796)

MFC after:	2 weeks
X-MFC with:	r310866
2016-12-30 23:05:06 +00:00
Martin Matuska
09c253fd1b MFV r310798:
Sync libarchive with vendor.

Vendor bugfixes (relevant to FreeBSD):
PR #843: Fix memory leak of struct archive_entry in cpio/cpio.c
PR #851: Spelling fixes
Fix two protoypes in manual page archive_read_disk.3

MFC after:	2 weeks
2016-12-30 22:54:08 +00:00
Martin Matuska
e9ed7ea4dc MFV r310796, r310797:
Sync libarchive with vendor.

Vendor changes (relevant to FreeBSD):
PR #771: Add NFSv4 ACL support to pax and restricted pax

NFSv4 ACL information may now be stored to and restored from tar archives.
ACL must be non-trivial and supported by the underlying filesystem, e.g.
natively by ZFS or by UFS with the NFSv4 ACL enable flag set.

MFC after:	2 weeks
Relnotes:	yes
2016-12-30 22:18:22 +00:00
Enji Cooper
2fd30e016e Fix whitespace in a comment and fixing a spelling error in a comment
MFC after:	3 days
2016-12-30 21:41:01 +00:00
Enji Cooper
b8882958b3 Use uint32_t instead of u_int32_t for or_last_change and services in "struct systemg"
This is being done to match "struct systemg" in snmpmod(3)

No functional change

MFC after:	3 days
2016-12-29 08:16:43 +00:00
Enji Cooper
6c9b7542ef Prevent improper memory accesses after calling snmp_pdu_free and snmp_value_free
snmp_pdu_free: set pdu->nbindings to 0 to limit the damage that
could happen if a pdu was reused after calling the function, and
as both stack and heap allocation types are used in contrib/bsnmp
and usr.sbin/bsnmpd.

snmp_value_free: NULL out value->v.octetstring.octets after calling
free on it to prevent a double-free from occurring.

MFC after:      2 weeks
2016-12-29 00:20:03 +00:00
Mark Johnston
2ef476c9a2 Follow DW_AT_specification when looking up DW_AT_type attributes.
dwarf_attrval_*() will search the parent DIE referenced by a
DW_AT_abstract_origin attribute for the value of the DW_AT_type attribute.
Do the same thing for the DW_AT_specification attributes in variable
definitions emitted by GCC 6.2, and ensure that we return an error rather
than crashing if neither DW_AT_abstract_origin or DW_AT_specification is
found when looking for the value of the DW_AT_type attribute.

PR:		215350, 215395
Reviewed by:	emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8920
2016-12-28 21:54:33 +00:00
Dmitry Marakasov
b9c36cc755 bzip2 does not exit after showing license as requested with --version
or --license as most apps would do, instead it waits for data to
compress on stdin. Because of that, if `bzip2 --version' is called,
bogus `bzip2: I won't write compressed data to a terminal' error
message will be displayed, and checking for bzip2 version in scripts
as in

    bzip2 --version 2>&1 | grep -o "Version [^,]*"

will hand as bzip2 would wait for data to compress on stdin. Fix
this by exiting right after showing version/license text.

I've tried to push this upstream for more than a year, but author
is unresponsive, so upstream may be considered dead.

Ubuntu applies similar fix, for the note.

PR:		199443
Approved by:	dim, bapt
MFC after:	2 weeks
Differential Revision:	D8924
2016-12-28 18:04:18 +00:00
Enji Cooper
b3972edb64 style(9): ip_get(..): clean up whitespace
MFC after:	3 days
2016-12-28 05:05:08 +00:00
Enji Cooper
700d391fb8 style(9): snmp_send_packet(..): fix whitespace
MFC after:	3 days
2016-12-28 04:56:15 +00:00
Enji Cooper
bc54857ed0 style(9): fix whitespace in pdu_encode_secparams(..)
MFC after:	3 days
2016-12-28 04:53:52 +00:00
Enji Cooper
5120d21c63 style(9): sort alignment in udp_recv(..)
MFC after:	3 weeks
2016-12-28 04:31:07 +00:00
Enji Cooper
8d7f605b6c Fix bsnmpd sending/receiving with multi-homed configurations or INADDR_ANY used
as the listening address in snmpd_input(..)

Stash the IPv4 address of the receiver via the recv(..) callback and use it in
the send(..) callback for the transport by specifying IP_SENDSRCADDR for the
control message type.

Add sendmsg logic to the UDP transport's send(..) callback and use the
respective send(..) callback for the transport instead of calling sendto in
snmpd_input(..).

MFC after:      3 weeks
Obtained from:  Isilon OneFS (^/onefs/branches/BR_8_0_0_DEV@r507595)
Submitted by:   Thor Steingrimsson <thor.steingrimsson@isilon.com>
Sponsored by:   Dell EMC Isilon
2016-12-28 04:29:09 +00:00
Enji Cooper
e1d581b289 style(9): clean up trailing whitespace
MFC after:	3 weeks
2016-12-27 23:32:54 +00:00
Ed Maste
d0aa56451e elfcopy: fix PE object section name corruption and crash
Fixed a bug that the PE object section names are generated incorrectly
using the section name table found in the original input ELF object
instead of the intermediate ELF object.

Ticket:		#541

Do not try to copy section content from a NULL d_buf when creating
uninitialized data COFF section for PE object.

Ticket:		#540

Obtained from:	ELF Tool Chain r3507, r3508
MFC after:	1 week
2016-12-27 17:31:07 +00:00
Martin Matuska
7105995c64 MFV r310622:
Sync libarchive with vendor.

Vendor bugfixes (relevant to FreeBSD):
PR 846: Spelling fixes
PR 850: Fix issues with reading certain jar files
OSS-Fuzz 286: Bugfix in archive_strncat_l()
2016-12-27 01:10:28 +00:00
Enji Cooper
23516259fd style(9): fix trailing whitespace
MFC after:	3 days
2016-12-26 11:16:55 +00:00
Enji Cooper
3b7e3b0ae5 Update engine time using update_snmpd_engine_time(..)
MFC after:	6 days
X-MFC with:	r310498
Sponsored by:	Dell EMC Isilon
2016-12-26 11:11:30 +00:00