Commit Graph

219843 Commits

Author SHA1 Message Date
Mateusz Guzik
ed869ff019 i386: fixup fcmpset
An incorrect output specifier was used which worked with clang by accident,
but breaks with the in-tree gcc version.

While here plug a whitespace nit.

Reported by:	bde
2017-02-02 01:33:08 +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
Martin Matuska
91360634ec Update vendor/libarchive to git d77b577b2d5aa259fca06313c4940e1e61ab1e0e
Vendor changes (relevant to FreeBSD):
- bugfixes, improvemens and optimizations in ACL code
- NFSv4 ACLs can now be extracted from Solaris tar archives

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 1016752)
- iso 9660 reader: missing free in parse_file_info() (part. 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_locazip_read_local_file_header()
2017-02-02 00:20:18 +00:00
Alan Somers
cb23468e75 Allow 999.local to run scripts in any language
If one of the scripts listed in (daily|weekly|monthly)_local is executable,
999.local should simply execute it. Only if the script isn't executable
should 999.local assume it needs /bin/sh.

Reviewed by:	brian
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-02-01 23:22:54 +00:00
Oleksandr Tymoshenko
878097c10e [am335x] Fallback to standard video interface bindings when using Linux dts
Historically AM335x LCDC driver used non-standard "hdmi" property to
refer to HDMI framer. There is no such thing in upstream DTS, so to
handle both cases fallback to bindings described in
bindings/media/video-interfaces.txt in Linux documentation.

We still make some assumptions that are not universally true: we
assume that if remote endpoint is available it's going to be HDMI
framer. Which is true for AM335x-based devices currently supported
but may be not true for some custom hardware.

MFC after:	1 week
2017-02-01 22:03:59 +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
Toomas Soome
151139ad9e loader: disk/part api needs to use uint64_t offsets
The disk_* and part_* api is using 64bit values for media size and
offsets. However, the current api is using off_t type, which is signed
64-bit int.

In this context the signed media size does not make any sense, and
the offsets are used to mark absolute, not relative locations.

Also, the data from GPT partition table and some other sources is
already using uint64_t data type, so using signed off_t can cause sign
issues.

Reviewed by:	imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D8710
2017-02-01 20:10:56 +00:00
George V. Neville-Neil
82988b50a1 Add an mbuf to ipinfo_t translator to finish cleanup of mbuf passing to TCP probes.
Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9401
2017-02-01 19:33:00 +00:00
Brad Davis
accb19a8bc Add some comments with examples on how to build Vagrant images.
Approved by:	re (gjb)
2017-02-01 16:15:23 +00:00
Hartmut Brandt
4b481ba0ed Merge filt_soread and filt_solisten and decide what to do when checking
for EVFILT_READ at the point of the check not when the event is registers.
This fixes a problem with asio when accepting a connection.

Reviewed by:	kib@, Scott Mitchell
2017-02-01 13:12:07 +00:00
Toomas Soome
d124e3965a loader.efi environment related cleanups
Since we have dedicated libefi/env.c file for variable support, the following
changes are done:

Simple cstyle changes in env.c
Moved efi variable related commands from loader/main.c to libefi/env.c
Did create function to set "efi-version" environment variable in env.c.

This function does serve two purposes: for first a  small clean up of the
loader main(), and for second, it does replace the otherwise unused
efi_variable_support hack.
A bit of cleanup of ficl backend functions. The TEST_MAIN has no meaning,
and removed few memory leaks.

The forth code is updated to use "efi-version" variable, instead of ficl
environment check.

Reviewed by:	imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D9165
2017-02-01 08:46:59 +00:00
Ed Maste
4b1be206bb Bump GCC FBSD_CC_VER for r312899 (-march=octeon+ support)
Reported by:	lidl
MFC after:	1 month
MFC with:	r312899
Sponsored by:	The FreeBSD Foundation
2017-02-01 05:24:17 +00:00
Alexander Kabaev
2733239f37 Add atomic_fcmpset_*() inlines for MIPS
atomic_fcmpset_*() is analogous to atomic_cmpset(), but saves off the
read value from the target memory location into the 'old' pointer.

Reviewed by:	imp, brooks
Requested by:	mjg
Differential Revision:	https://reviews.freebsd.org/D9391
2017-02-01 05:00:34 +00:00
Jason A. Harmening
65ed483615 Implement get_pcpu() for the remaining architectures and use it to
replace pcpu_find(curcpu) in MI code.
2017-02-01 03:32:49 +00:00
Justin Hibbits
91722a2f0f Add Book-E Enhanced Debug (E.D) profile debug support
Freescale added the E.D profile to e500mc and derivative cores.  From
Freescale's EREF reference manual this is enabled by a bit in HID0 and should
otherwise default to traditional debug.  However, none of the Freescale cores
support that bit, and instead always use E.D.  This results in kernel panics
using the standard debug on e500mc+ cores.

Enhanced debug allows debugging of interrupts, including critical interrupts,
as it uses a different save/restore registers (srr*).  At this time we don't use
this ability, so instead share the core of the debug handler code between both
handlers.

MFC after:	3 weeks
2017-02-01 03:29:13 +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
Warner Losh
50d96564ed Add USB IDs supported by TI / Intel USB 3410 family (modems of various
flavors). This includes both the release products (from Honeywell,
Moxa and Multitech) as well as development kits.
2017-02-01 02:00:18 +00:00
Johannes M Dieterich
dc3d501581 Add myself (jmd) to committers-ports.dot. Document rene and swills as my mentors.
Reviewed by:	rene (mentor)
Approved by:	rene (mentor)
Differential Revision:	https://reviews.freebsd.org/D9393
2017-02-01 01:25:30 +00:00
Michael Tuexen
c03627fd06 Ensure that the variable bail is always initialized before used.
MFC after:	1 week
2017-02-01 00:10:29 +00:00
Michael Tuexen
2aa116007c Take the SCTP common header into account when computing the
space available for chunks. This unbreaks the handling of
ICMPV6 packets indicating "packet too big". It just worked
for IPv4 since we are overbooking for IPv4.

MFC after:	1 week
2017-01-31 23:36:31 +00:00
Michael Tuexen
7858d7cb8e Remove a duplicate debug statement.
MFC after:	1 week
2017-01-31 23:34:02 +00:00
Andriy Voskoboinyk
704cd54206 net80211: cleanup ic_flags / iv_flags
Flags
 - IEEE80211_F_ASCAN
 - IEEE80211_F_SIBSS
 - IEEE80211_F_IBSSON
are not used since r170530 (old WI compatibility ioctls removal)
and r178354 (removed from other places).

IEEE80211_F_TXPOW_FIXED was never utilized; initially added with
IEEE80211_F_TXPOW_AUTO / IEEE80211_F_TXPOW_OFF flags,
which were replaced with IEEE80211_C_TXPMGT capability check in r138568.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D9369
2017-01-31 22:21:08 +00:00
Brad Davis
ef7a48206d Add a new vagrant-box target, to make it easier and less redundant to only
produce the Vagrant box and not upload it.

Approved by:	re (gjb)
2017-01-31 21:59:10 +00:00
Adrian Chadd
39d5467677 [ath] log seqno, type and subtype when assigning sequence numbers for A-MPDU.
This is just to improve adrian-debugging.
2017-01-31 20:57:40 +00:00
Alan Somers
c7f3d08d40 Add tests for multi-fib IPv6 routing
PR:		196361
Submitted by:	jhujhiti@adjectivism.org
Reported by:	Jason Healy <jhealy@logn.net>
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
2017-01-31 20:13:50 +00:00
Gleb Smirnoff
d79b843cb7 Import tcpdump-4.9.0 into dist. 2017-01-31 19:17:06 +00:00
Brad Davis
bdc6b35a96 Force a few variables to be upper case when they are evaulated.
This allows specifying, for example: CLOUDWARE=vagrant-vmware

Approved by:	re (gjb)
2017-01-31 19:09:06 +00:00
John Baldwin
0ed5eff947 Fix a couple of issues with t4iov probe and attach.
- Check for Chelsio vendor ID in probe routines.
- Fail attach instead of faulting if pci_find_dbsf() doesn't find a
  device.

PR:		216539
Reported by:	asomers
Tested by:	Dave Baukus <daveb@spectralogic.com>
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-01-31 18:54:13 +00:00
Stephen J. Kiernan
d0b2cad1ca Add the folowing set accessor functions for recently-added members of ifnet
structure:

if_gethwtsomax(), if_sethwtsomax()                 - if_hw_tsomax
if_gethwtsomaxsegcount(), if_sethwtsomaxsegcount() - if_hw_tsomaxsegcount
if_gethwtsomaxsegsize(), if_sethwtsomaxsegsize()   - if_hw_tsomaxsegsize

Update em and vnic drivers which had already been coverted to use accessor
functions for the other ifnet structure members.

Reviewed by:	erj
Approved by:	sjg (mentor)
Obtained from:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D8544
2017-01-31 16:12:31 +00:00
Edward Tomasz Napierala
b38b22b0b2 Add kern_pread() and kern_pwrite(), and use it in compats instead
of their sys_*() counterparts. The svr4 is left unchanged.

Reviewed by:	kib@
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9379
2017-01-31 15:35:18 +00:00
Edward Tomasz Napierala
5db72ef2e4 Fix linux_getppid() to debug the actual parent, even it was reparented
by debugger.

Reviewed by:	dchagin@
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9361
2017-01-31 15:22:51 +00:00
Edward Tomasz Napierala
fc8bde8ffe Replace calls to sys_truncate() with kern_truncate().
Reviewed by:	kib@
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9371
2017-01-31 15:19:44 +00:00
Edward Tomasz Napierala
ea2ebdc19e Add kern_cpuset_getid() and kern_cpuset_setid(), and use them
in compat32 instead of their sub_*() counterparts.

Reviewed by:	jhb@, kib@
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9382
2017-01-31 15:11:23 +00:00
Jared McNeill
265c594a2c Add missing ephy bus gates and resets. 2017-01-31 14:36:06 +00:00
Enji Cooper
8641eed228 Expose symbols in lib/libclang_rt/profile to fix --coverage
The symbols currently hidden in libprofile_rt are needed for linking with
`clang --coverage` to add coverage counters at link time and produce
coverage numbers at runtime.

In collaboration with:	dim
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
Differential Revision:	D9168
2017-01-31 07:13:01 +00:00
Enji Cooper
15b69ab272 Wait for /dev/ggate* to appear after calling ggatel create in :ggatel_{file,md}
The test assumed that `ggatel create` created a device on completion, but that's
incorrect. This squashes the race by waiting for the device to appear, as
`ggatel create` daemonizes before issuing an ioctl to geom_gate(4) if not called
with `-v`.

Discussed with:	asomers
MFC after:	1 week
PR:		204616
Sponsored by:	Dell EMC Isilon
2017-01-31 06:12:51 +00:00
Justin Hibbits
d3a8234cef Don't retry a lost reservation in atomic_fcmpset()
The desired behavior of atomic_fcmpset_() is to always exit on error.  Instead
of retrying on lost reservation, leave the retry to the caller, and return
error.

Reported by:	kib
2017-01-31 03:40:13 +00:00
Conrad Meyer
6be2ff7d3e calculate_crc32c: Add SSE4.2 implementation on x86
Derived from an implementation by Mark Adler.

The fast loop performs three simultaneous CRCs over subsets of the data
before composing them.  This takes advantage of certain properties of
the CRC32 implementation in Intel hardware.  (The CRC instruction takes 1
cycle but has 2-3 cycles of latency.)

The CRC32 instruction does not manipulate FPU state.

i386 does not have the crc32q instruction, so avoid it there.  Otherwise
the implementation is identical to amd64.

Add basic userland tests to verify correctness on a variety of inputs.

PR:		216467
Reported by:	Ben RUBSON <ben.rubson at gmail.com>
Reviewed by:	kib@, markj@ (earlier version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9342
2017-01-31 03:26:32 +00:00
Justin Hibbits
d9dbd70bca Update CFLAGS for clang compatibility
* Clang/llvm does not (yet) support -m(no-)spe, so make it gcc-only
* Clang now supports -msoft-float, and does not appear to recognize
  "-disable-ppc-float-in-variadic", which appears to have been a crutch until
  soft-float was implemented.  It's now implemented for both 32- and 64-bit.
* Clang/llvm use a 'medium' code model by default for powerpc64, supporting up
  to 4GB TOC, and does not support the '-mminimal-toc' option.  Given both of
  these, make -mminimal-toc gcc-only.

MFC after:	2 weeks
2017-01-31 01:55:29 +00:00
Adrian Chadd
cc59dd9ae0 Fix compilation! 2017-01-31 01:48:55 +00:00
John Baldwin
2a7278307b Remove a duplicate store when performing REL32 relocations in rtld.
The duplicate call to store_ptr() was added in r204687, but it should
have no effect as it only stores an Elf_Sword and the later store_ptr()
does a write that is at least as large if not larger.

Reviewed by:	jmallett
Obtained from:	CheriBSD (sort of)
Sponsored by:	DARPA / AFRL
2017-01-30 23:13:41 +00:00
Pedro F. Giffuni
678bbc14b2 MFV 312999:
Update libedit 2016-03-21

Minor cleanups plus some license syncing.

Obtained from:	NetBSD
X-MFC with:	r312997
2017-01-30 23:00:51 +00:00
Gleb Smirnoff
164aa3ce5e Fix indentantion in pf_purge_thread(). No functional change. 2017-01-30 22:47:48 +00:00
Pedro F. Giffuni
70f1d4d70d Import libedit 2016-03-21
Obtained from:	NetBSD
2017-01-30 22:35:42 +00:00
Adrian Chadd
4691c88fee [mips] add some (temporary, I hope!) mips24k/mips74k hwpmc modules.
Ideally we'd have a top level hwpmc module with the shared bits, then
cpu specific glue as needed.  However, on the MIPS side, there's no
probe code - {mips24k, mips74k, octeon} implement a set of methods
that hwpmc_mips.c expects.

So this populates separate modules with duplicate code.
Ew, but it does work.

This gets me off the hook - these work fine as copied into the relevant
mfsroot for mips24k/mips74k systems.

TODO:

* do it the "right" way in the future.  Note that modules/hwpmc/ does
  build fine on MIPS, it jusn't DO anything.  So it'd be nice to
  maybe call that "hwpmc_core" and then "hwpmc" can be the CPU/arch glue.
2017-01-30 22:29:21 +00:00
Pedro F. Giffuni
450aba5b34 MFV r312996:
Re-import libedit 2016-02-27

This reverts r296435: the issues related to lldb and this update appear to
have been identified (in lldb).

Obtained from:	NetBSD
Reported by:	emaste
MFC after:	3 weeks
2017-01-30 22:11:53 +00:00
Pedro F. Giffuni
034904e961 Import libedit 2016-02-27
This basically reverts r296500: there are many changes in the latest
version and this intermediate step lets us save all the work done
for the previous update.

Obtained from:	NetBSD
2017-01-30 21:06:07 +00:00
Alan Somers
4e02badb18 Initialize a stack variable in mprsas_get_sas_address_for_sata_disk
Thought it's difficult to reproduce, I think this variable was responsible
for a use-after-free panic when a SATA disk timed out responding to a SATA
identify command during boot.

Submitted by:	slm
Reviewed by:	slm
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D9364
2017-01-30 19:49:08 +00:00
Mark Johnston
aa3650ea36 Avoid page lookups in the top-level object in vm_object_madvise().
We can iterate over consecutive resident pages in the top-level object
using the object's page list rather than by performing lookups in the
object radix tree. This extends one of the optimizations in r312208 to the
case where a shadow chain is present.

Suggested by:	alc
Reviewed by:	alc, kib (previous version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D9282
2017-01-30 18:51:43 +00:00