Commit Graph

7385 Commits

Author SHA1 Message Date
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
Navdeep Parhar
af67ca3780 Add support for RDMA from userspace with T6 cards.
Submitted by:	Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
2017-02-23 19:21:47 +00:00
Kurt Lidl
2495a63064 Reset failed login count to zero when removing a blocked address
The blacklistd daemon keeps records of failed login attempts for
each address:port that is flagged as a failed login.  When a
successful login occurs for that address:port combination,
the record's last update time is set to zero, to indicate no current
failed login attempts.

Reset the failed login count to zero, so that at the next failed
login attempt, the counting will restart properly at zero.  Without
this reset to zero, the first failed login after a successful login
will cause the address to be blocked immediately.

When debugging is turned on, output more information about database
state before and after the database updates have occured.

A similar patch has already been upstreamed to NetBSD.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-02-23 05:40:59 +00:00
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
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
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
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
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
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
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
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