avos [Sat, 18 Feb 2017 19:19:08 +0000 (19:19 +0000)]
MFC r313694:
iwi: add 12-14 2GHz channels into channel list.
Return full channel list via iwi_getradiocaps() method
(ieee80211_init_channels() was replaced with iwi_getradiocaps()
to be consistent with other drivers).
PR: 216923
Submitted and tested by: ds@ukrhub.net (original patch)
grehan [Thu, 16 Feb 2017 17:07:20 +0000 (17:07 +0000)]
MFC r311702
Use correct PCI device id for virtio-rng.
This prevented the device from attaching with a
Windows guest (most other guests use the device type
for matching)
garga [Thu, 16 Feb 2017 09:12:36 +0000 (09:12 +0000)]
MFC r313477:
Cleanup on usr.sbin/arp/arp.c
* 'blackhole' and 'reject' are mutually exclusive, replace printf() by errx()
when both are selected.
* 'trail' option is no longer supported since first import of arp from 4.4BSD.
XXX message was added 13 years ago in r128192. I believe it's time to remove
it.
* Use warnx() to print some informative messages instead of printf()
* Replace strncmp() by strcmp() when validating parameters and exit when invalid
parameter is found
jah [Wed, 15 Feb 2017 10:35:46 +0000 (10:35 +0000)]
MFC r312610, r312792
r312610:
Like r310481 for i386, move the objects used to create temporary
mappings for armv6 pmap zero and copy operations to the MD PCPU region.
Change sysmap initialization to only allocate KVA pages for CPUs that
are actually present.
While here, collapse CMAP3 into CMAP2 (their use was mutually exclusive
anyway) and "recover" some space in PCPU padding that has always been
available due to 64-byte cacheline padding.
r312792:
Further cleanup of per-CPU armv6 pmap data:
- Replace pcpu_find(curcpu) with get_pcpu(), which is much more direct.
- Remove armv4 pcpu fields which I added in r286296 but never needed
to use.
- armv6 pc_qmap_addr was leftover from the old armv6 pmap
implementation. Rename it and put it to use in the new one.
garga [Wed, 15 Feb 2017 08:43:26 +0000 (08:43 +0000)]
MFC r313448:
bsdinstall: Make sure chroot filesystems are umounted after use
* DISTDIR_IS_UNIONFS is set every time BSDINSTALL_DISTDIR is mounted inside
BSDINSTALL_CHROOT. Use this flag to decide if it needs to be umounted
* BSDINSTALL_CHROOT/dev is mounted when 'bsdinstall mount' is called, there is
no need to mount it again when user goes to shell after installation
asomers [Wed, 15 Feb 2017 00:15:24 +0000 (00:15 +0000)]
MFC r311893, r313008, r313081
r311893:
ATFify the geom gate tests.
This ensures their cleanup routines will be run even if they should timeout.
tests/sys/geom/class/gate/ggate_test.sh
tests/sys/geom/class/gate/Makefile
Add an ATF test with three testcases, one for each TAP test. Use
ATF-style cleanup functions, and convert sleeps to polling loops.
ObsoleteFiles.inc
tests/sys/geom/class/gate/conf.sh
tests/sys/geom/class/gate/1_test.sh
tests/sys/geom/class/gate/2_test.sh
tests/sys/geom/class/gate/3_test.sh
Delete TAP test files
r313008:
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`.
r313081:
Replace for/retry loops with "wait_for_ggate_device" calls and check
results of commands
As noted in r313008, the underlying issue was that geom_gate device
creation wasn't created at ggatel command completion, but some short
time after. ggatec(8) employs similar logic when creating geom_gate(4)
devices.
Switch from retry loops (after the ggatec/dd write calls) to
wait_for_ggate_device function calls after calling ggatec(8) instead
to detect the presence of the /dev/ggate* device, as this function is
sufficient for determining whether or not the character device is ready
for testing
While here, use atf_check consistently with all dd calls to ensure that
data output is as expected.
ngie [Tue, 14 Feb 2017 04:51:21 +0000 (04:51 +0000)]
MFC r313374:
hcreate(3): fix the ERRORS section and bump .Dd
- Add missing comma between functions that trigger ENOMEM error.
- Fix the description for ESRCH. The action that triggers this error is
FIND, not SEARCH (SEARCH does not exist).
ngie [Tue, 14 Feb 2017 04:49:06 +0000 (04:49 +0000)]
MFC r313378,r313379:
r313378:
Wrap strcmp/wcscmp calls with ATF_CHECK_MSG and drop atf_tc_fail use
The reasoning here was the same as what was done in r313376:
- Gather as many results as possible instead of failing early and
not testing the rest of the cases.
- Simplify logic when checking test inputs vs outputs and printing
test result.
r313379:
Expect :int_within_limits to fail when ptrdiff_t/*intmax_t differ in base type
The %t{d,u} (ptrdiff_t) tests fail for the following reasons:
- ptrdiff_t is by definition int32_t on !LP64 architectures and int64_t on
LP64 architectures.
- intmax_t is by definition fixed to int64_t on all architectures.
- Some of the code in lib/libc/stdio/... is promoting ptrdiff_t to *intmax_t
when parsing/representing the value.
ngie [Tue, 14 Feb 2017 04:47:13 +0000 (04:47 +0000)]
MFC r313376:
Fix :hexadecimal_floating_point on i386
Don't exclude i386 from LDBL_MANT_DIG == 64; it works properly in
that case.
While here, replace strcmp + atf_tc_fail with ATF_CHECK_MSG for 2
reasons:
- Gather as many results as possible instead of failing early and
not testing the rest of the cases.
- Simplify logic when checking test inputs vs outputs and printing
test result.
dim [Mon, 13 Feb 2017 18:39:21 +0000 (18:39 +0000)]
MFC r313052:
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
ken [Mon, 13 Feb 2017 16:06:38 +0000 (16:06 +0000)]
MFC r313568:
------------------------------------------------------------------------
r313568 | ken | 2017-02-10 15:02:45 -0700 (Fri, 10 Feb 2017) | 68 lines
Change the isp(4) driver to not adjust the tag type for REQUEST SENSE.
The isp(4) driver was changing the tag type for REQUEST SENSE
commands to Head of Queue, when the CAM CCB flag
CAM_TAG_ACTION_VALID was NOT set. CAM_TAG_ACTION_VALID is set
when the tag action in the XPT_SCSI_IO is not CAM_TAG_ACTION_NONE
and when the target has tagged queueing turned on.
In most cases when CAM_TAG_ACTION_VALID is not set, it is because
the target is not doing tagged queueing. In those cases, trying to
send a Head of Queue tag may cause problems. Instead, default to
sending a simple tag.
IBM tape drives claim to support tagged queueing in their standard
Inquiry data, but have the DQue bit set in the control mode page
(mode page 10). CAM correctly detects that these drives do not
support tagged queueing, and clears the CAM_TAG_ACTION_VALID flag
on CCBs sent down to the drives.
This caused the isp(4) driver to go down the path of setting the
tag action to a default value, and for Request Sense commands only,
set the tag action to Head of Queue.
If an IBM tape drive does get a Head of Queue tag, it rejects it with
Invalid Message Error (0x49,0x00). (The Qlogic firmware translates that
to a Transport Error, which the driver translates to an Unrecoverable
HBA Error, or CAM_UNREC_HBA_ERROR.) So, by default, it wasn't possible
to get a good response from a REQUEST SENSE to an FC-attached IBM
tape drive with the isp(4) driver.
IBM tape drives (tested on an LTO-5 with G9N1 firmware and a TS1150
with 4470 firmware) also have a bug in that sending a command with a
non-simple tag attribute breaks the tape drive's Command Reference
Number (CRN) accounting and causes it to ignore all subsequent
commands because it and the initiator disagree about the next
expected CRN. The drives do reject the initial command with a head
of queue tag with an Invalid Message Error (0x49,0x00), but after that
they ignore any subsequent commands. IBM confirmed that it is a bug,
and sent me test firmware that fixes the bug. However tape drives in
the field will still exhibit the bug until they are upgraded.
Request Sense is not often sent to targets because most errors are
reported automatically through autosense in Fibre Channel and other
modern transports. ("Modern" meaning post SCSI-2.) So this is not
an error that would crop up frequently. But Request Sense is useful on
tape devices to report status information, aside from error reporting.
This problem is less serious without FC-Tape features turned on,
specifically precise delivery of commands (which enables Command
Reference Numbers), enabled on the target and initiator. Without
FC-Tape features turned on, the target would return an error and
things would continue on.
And it also does not cause problems for targets that do tagged
queueing, because in those cases the isp(4) driver just uses the
tag type that is specified in the CCB, assuming the
CAM_TAG_ACTION_VALID flag is set, and defaults to sending a Simple
tag action if it isn't an ordered or head of queue tag.
sys/dev/isp/isp.c:
In isp_start(), don't try to send Request Sense commands
with the Head of Queue tag attribute if the CCB doesn't
have a valid tag action. The tag action likely isn't valid
because the target doesn't support tagged queueing.
ian [Sat, 11 Feb 2017 20:02:39 +0000 (20:02 +0000)]
MFC r311850:
Use the post-reset hook to force the controller to host mode. This will
make both usb ports work on imx6 systems (the OTG port of course will only
work in host mode).
mm [Sat, 11 Feb 2017 00:54:16 +0000 (00:54 +0000)]
MFC r310866,310868,310870,311903,313074:
Sync libarchive with vendor.
MFC r310866:
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 r310868:
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 r310870:
Use __LA_DEPRECATED macro with functions deprecated in 379867e
MFC r311903:
#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 r313074:
- 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()
List of all libarchive issues at OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/list?can=1&q=libarchive
jhb [Fri, 10 Feb 2017 19:49:42 +0000 (19:49 +0000)]
MFC 311568,311584,312387:
Set MORETOCOME for AIO write requests on a socket.
311568:
Set MORETOCOME for AIO write requests on a socket.
Add a MSG_MOREOTOCOME message flag. When this flag is set, sosend*
set PRUS_MOREOTOCOME when invoking the protocol send method. The aio
worker tasks for sending on a socket set this flag when there are
additional write jobs waiting on the socket buffer.
311584:
Unbreak lib/libsysdecode after r311568 by decoding MSG_MORETOCOME flag
in msgflags
(Actually, this change excludes MSG_MORETOCOME from being decoded)
312387:
Fix regression from r311568: collision of MSG_NOSIGNAL with MSG_MORETOCOME
lead to delayed send of data sent with sendto(MSG_NOSIGNAL).
jilles [Fri, 10 Feb 2017 15:03:54 +0000 (15:03 +0000)]
MFC r313174: Clean up documentation of AF_UNIX control messages.
Document AF_UNIX control messages in unix(4) only, not split between unix(4)
and recv(2).
Also, warn about LOCAL_CREDS effective uid/gid fields, since the write could
be from a setuid or setgid program (with the explicit SCM_CREDS and
LOCAL_PEERCRED, the credentials are read at such a time that it can be
assumed that the process intends for them to be used in this context).
emaste [Fri, 10 Feb 2017 14:54:20 +0000 (14:54 +0000)]
MFC r304430: vt: fix old keyboard release in CONS_SETKBD
On the first switch we previously released the newly allocated keyboard
instead of the old one. Keyboard state was very confused afterwards for
further keyboard switches.
vangyzen [Fri, 10 Feb 2017 05:14:19 +0000 (05:14 +0000)]
MFC r313401
Fix garbage IP addresses in UDP log_in_vain messages
If multiple threads emit a UDP log_in_vain message concurrently,
or indeed call inet_ntoa() for any other reason,
the IP addresses could be garbage due to concurrent usage of a
single string buffer inside inet_ntoa(). Use inet_ntoa_r() with
two stack buffers instead.
vangyzen [Wed, 8 Feb 2017 20:08:38 +0000 (20:08 +0000)]
MFC r313180
PCIe HotPlug: remove tests for DL active link capability
As of r313097, the HotPlug code requires the link to support
reporting of the data-link status. Remove tests for this capability
from code that can now assume its presence.
jhb [Wed, 8 Feb 2017 18:32:35 +0000 (18:32 +0000)]
MFC 310638:
Rename the 'flags' argument to getfsstat() to 'mode' and validate it.
This argument is not a bitmask of flags, but only accepts a single value.
Fail with EINVAL if an invalid value is passed to 'flag'. Rename the
'flags' argument to getmntinfo(3) to 'mode' as well to match.
Taking closer look on my ASM1062 I found that it has bunch of issues around
error recovery: reported wrong CCS, failed commands reported as completed,
READ LOG EXT times out after NCQ error. This patch workarounds first two
problems, that were making ATAPI devices close to unusable on these HBAs.
jhb [Tue, 7 Feb 2017 22:40:38 +0000 (22:40 +0000)]
MFC 313097: Require Data Layer Active reporting for native PCI-e HotPlug.
Some PCI-e bridges report that they support HotPlug in the slot
capabilities but do not report support for Data Layer Active events
in the link capabilities register. These bridges do not work correctly
when HotPlug is used. Further, while the description of HotPlug in
the spec does not mention that DL active events are required, the
description of the link capabilities register says that DL active is
required for HotPlug. Thanks to Dave Baukus for finding that language
in the spec.
rstone [Tue, 7 Feb 2017 15:13:19 +0000 (15:13 +0000)]
MFC r312544
Fix reference to free memory in ixgbe/if_media.c
When ixgbe receives an interrupt indicating that a new optical module
may have been inserted, it discards all of its current media types
by calling ifmedia_removeall() and then creates a new set of media
types for the supported media on the new module. However,
ifmedia_removeall() was maintaining a pointer to whatever the
current media type was before the call to ifmedia_removealL().
The result of this was that any attempt to read the current media
type of the interface (e.g. via ifconfig) would return potentially
garbage data from free memory (or if one were particularly unlucky
on an architecture that does not malloc() from a direct map, page
fault the kernel).
Fix this by NULL'ing out the current media field in if_media.c,
and have ixgbe update the current media type after recreating
them.
mav [Tue, 7 Feb 2017 01:57:29 +0000 (01:57 +0000)]
MFC r312694: Make CTL ramdisk backend a real RAM disk.
If "capacity" LU option is set, ramdisk backend now implements featured
thin provisioned disk, storing data in malloc(9) allocated memory blocks
of pblocksize bytes (default PAGE_SIZE or 4KB). Additionally ~0.2% of LU
size is used for indirection tree (bigger pblocksize reduce the overhead).
Backend supports all unmap and anchor operations. If configured capacity
is overflowed, proper error conditions are reported.
If "capacity" LU option is not set, the backend operates mostly the same
as before without allocating real storage: writes go to nowhere, reads
return zeroes, reporting that all LBAs are unmapped.
This backend is still mostly oriented on testing and benchmarking (it is
still a volatile RAM disk), but now it should allow to run real FS tests,
not only simple dumb dd.
mav [Tue, 7 Feb 2017 01:55:48 +0000 (01:55 +0000)]
MFC r312603: Add initial support for CTL module unloading.
It is only a first step and not perfect, but better then nothing.
The main blocker is CAM target frontend, that can not be unloaded,
since CAM does not have mechanism to unregister periph driver now.
mav [Tue, 7 Feb 2017 01:43:45 +0000 (01:43 +0000)]
MFC r312348: Remove writing 'residual' field of struct ctl_scsiio.
This field has no practical use and never readed. Initiators already
receive respective residual size from frontends. Removed field had
different semantics, which looks useless, and was never passed through
by any frontend.
While there, fix kern_data_resid field support in case of HA, missed in
r312291.
mav [Tue, 7 Feb 2017 01:42:13 +0000 (01:42 +0000)]
MFC r312291, r312669:
Make CTL frontends report kern_data_resid for under-/overruns.
It seems like kern_data_resid was never really implemented. This change
finally does it. Now frontends update this field while transferring data,
while CTL/backends getting it can more flexibly handle the result.
At this point behavior should not change significantly, still reporting
errors on write overrun, but that may be changed later, if we decide so.
CAM target frontend still does not properly handle overruns due to CAM API
limitations. We may need to add some fields to struct ccb_accept_tio to
pass information about initiator requested transfer size(s).
ngie [Sat, 4 Feb 2017 17:21:17 +0000 (17:21 +0000)]
MFC r311174:
Make /usr/lib/libbsnmptools.so.0 into an INTERRNALLIB
Although it increases the size of the bsnmp{get,set,walk} binaries by
four on my [amd64] system, it removes the need for producing .debug
files, profiled libraries, and for installing the library itself,
reducing the overall size use on disk by the utilities noted
previously.
Plus, it guards against ABI/API compatibility issues with the library
as it's only used internal to the tools themselves.
ngie [Sat, 4 Feb 2017 17:17:38 +0000 (17:17 +0000)]
MFC r312332,r312446,r312451:
r312332:
Use SRCTOP where possible and use :H to manipulate .CURDIR to get rid of
unnecessarily long relative path .PATH values with make
r312446 (by emaste):
libc: remove reference to nonexistent lib/locale directory
As far as I can tell this was introduced in r72406 and updated in several
subsequent revisions, but the lib/locale directory it referenced never
existed.
r312451:
Replace dot-dot relative pathing with SRCTOP-relative paths where possible
This reduces build output, need for recalculating paths, and makes it clearer
which paths are relative to what areas in the source tree. The change in
performance over a locally mounted UFS filesystem was negligible in my testing,
but this may more positively impact other filesystems like NFS.
LIBC_SRCTOP was left alone so Juniper (and other users) can continue to
manipulate lib/libc/Makefile (and other Makefile.inc's under lib/libc) as
include Makefiles with custom options.
ngie [Sat, 4 Feb 2017 17:06:51 +0000 (17:06 +0000)]
MFC r303841,r312012,r312213:
r303841 (by bdrewery):
Revert r298434 which should be fixed by r301287, r301394, and r301403.
PR: 208703, 208963
r312012:
fmaxmin_test still fails with clang 3.9.x.. bypass the test
PR: 208703
r312213:
Turn COMPILER_VERSION/COMPILER_TYPE make check into a compile-time check
of the clang version
This works around breakage on ^/stable/10 when running installworld from
a ^/stable/10 host where the test wouldn't be compiled on the first
go-around and would be missing when make installworld is run.