dim [Fri, 2 Sep 2016 17:07:52 +0000 (17:07 +0000)]
MFC r305013:
Add an empty virtual destructor to zfsd's Vdev class. This is needed
because the class has virtual functions, and the compiler-generated
default destructor is non-virtual.
Reviewed by: asomers
MFC r305016:
Fix the zfsd unittest:
* TESTSDIR is supposed to be under cddl/usr.sbin, not cddl/sbin
* DevdCtl::EventBuffer no longer exists, so remove its forward
declaration
MFC r305036:
Some versions of SLOF do not append the partition number to the boot
device argument to the stage-1 bootloader. In such cases, boot1 would
only try to read the entire device rather than checking for partitions.
Instead of panic'ing, fall back to reading the partitions as normal in
such situations. This was preventing boot of installed systems on some
versions of PowerKVM.
MFC r304966 (peter):
The read-ahead code from r298230 made it likely the boot code would read
beyond the end of disk. r298900 added code to prevent this. Some BIOSes
cause significant delays if asked to read past end-of-disk.
We never trusted the BIOS to accurately report the sectorsize of disks
before and this set of changes. Unfortuately they interact badly with
the infamous >2TB wraparound bugs. We have a number of relatively-recent
machines in the FreeBSD.org cluster where the BIOS reports 3TB disks as 1TB.
With pre-r298900 they work just fine. After r298900 they stop working if
the boot environment attempts to access anything outside the first 1TB on
the disk. 'ZFS: I/O error, all block copies unavailable' etc. It affects
both UFS and ZFS if they try to boot from large volumes.
This change replaces the blind trust of the BIOS end-of-disk reporting
with a read-ahead clip to prevent reads crossing the of end-of-disk
boundary. Since 2^32 (2TB) size reporting truncation is not uncommon,
the clipping is done on 2TB aliases of the reported end-of-disk.
ie: a 3TB disk reported as 1TB has readahead clipped at 1TB, 3TB, 5TB, ...
as one of them is likely to be the real end-of-disk.
This should make the loader on these broken machines behave the same as
traditional pre-r298900 loader behavior, without disabling read-ahead.
Add non-TRUSTEDBSD prefixed knobs for the _PC_ACL* and {CAP,INF,MAC}_PRESENT knobs
It's not necessarily intuitive that the variables to query contain TRUSTEDBSD
in the prefix. Add non-TRUSTEDBSD prefixed knobs for querying things like
"_PC_ACL_NFS4".
MFC r304075,r304989:
Sync libarchive with vendor including security fixes
Vendor issues fixed:
Issue #731: Reject tar entries >= INT64_MAX
Issue #744: Very long pathnames evade symlink checks
Issue #748: libarchive can compress, but cannot decompress zip some files
PR #750: ustar: fix out of bounds read on empty string ("") filename
PR #755: fix use of acl_get_flagset_np() on FreeBSD
Issue #767: Buffer overflow printing a filename
Issue #770: Zip read: be more careful about extra_length
MFC r304874:
Temporarily disable two libarchive tests that have not yet been fixed by
vendor. Tests will be re-enabled after a fix has been merged.
jkim [Wed, 31 Aug 2016 20:21:03 +0000 (20:21 +0000)]
MFC: r304320
Disable assembly sources when compiler/assembler cannot compile certain
instructions. For example, GCC 4.2.1 + binutils 2.17.50 does not support
AVX instructions.
Follow-up to r304953, in which I broke the build: apparently the SOLARIS
macro is defined in lots of different places in ipfilter, so replace all
of the nonportable definitions with portable ones.
tuexen [Tue, 30 Aug 2016 19:27:27 +0000 (19:27 +0000)]
MFC r304736:
When aborting an association, send the ABORT before notifying the upper
layer. For the kernel this doesn't matter, for the userland stack, it does.
While there, silence a clang warning when compiling it in userland.
MFC r304837:
Fix a bug, where no SACK is sent when receiving a FORWARD-TSN or
I-FORWARD-TSN chunk before any DATA or I-DATA chunk.
Thanks to Julian Cordes for finding this problem and prividing
packetdrill scripts to reporduce the issue.
badger [Tue, 30 Aug 2016 13:39:42 +0000 (13:39 +0000)]
MFC r304184:
sem_post(): wake up the sleeper only after adjusting has_waiters
If the caller of sem_post() wakes up a thread sleeping via sem_wait()
before it clears the has_waiters flag, the caller of sem_wait() has no way of
knowing when it is safe to destroy the semaphore and reuse the memory. This is
because the caller of sem_post() may be interrupted between the wake step and
the clearing of has_waiters. It will then write into the has_waiters flag in
userspace after being preempted for some unknown amount of time.
Approved by: vangyzen (mentor)
Sponsored by: Dell Inc.
ache [Tue, 30 Aug 2016 01:01:41 +0000 (01:01 +0000)]
MFC r304911
The formal behavior of qsort is unstable with regard to objects that
are equal. Unfortunately, RFC 3484 requires that otherwise equal objects
remain in the order supplied by the DNS server. The present code attempts
to deal with this by returning -1 for objects that are equal (i.e.,
returns that the first parameter is less then the second parameter).
Unfortunately, the qsort API does not state that the first parameter
passed in is in any particular position in the list.
hselasky [Mon, 29 Aug 2016 08:52:53 +0000 (08:52 +0000)]
MFC r304629:
Don't separate the status stage of the XHCI USB control transfers into
its own job because this breaks the simplified QEMU XHCI TRB parser,
which expects the complete USB control transfer as a series of back to
back TRBs. The old behaviour is kept under #ifdef in case this change
breaks enumeration of any USB devices.
hselasky [Mon, 29 Aug 2016 08:39:53 +0000 (08:39 +0000)]
MFC r304597:
Fix for invalid use of bits in input context. Basically split
configuring of EP0 and non-EP0 into xhci_cmd_evaluate_ctx() and
xhci_cmd_configure_ep() respectivly. This resolves some errors when
using XHCI under QEMU and gets is more in line with the XHCI
specification.
ngie [Sun, 28 Aug 2016 07:19:33 +0000 (07:19 +0000)]
MFC r303804:
Fix building usr.bin/tar/tests with PIE symbol building enabled by
removing CFLAGS+= -static
`CFLAGS+= -static` was a carryover from pre-r289195 with
usr.bin/tar/test/Makefile that should have been specified in LDFLAGS
There doesn't seem to be an apparent need for static compilation
of the test binaries.
alc [Sun, 28 Aug 2016 05:18:39 +0000 (05:18 +0000)]
MFC r304050
Eliminate two calls to vm_page_xunbusy() that are both unnecessary and
incorrect from the error cases in exec_map_first_page(). They are
unnecessary because we automatically unbusy the page in vm_page_free()
when we remove it from the object. The calls are incorrect because they
happen after the page is freed, so we might actually unbusy the page
after it has been reallocated to a different object. (This error was
introduced in r292373.)
skreuzer [Sun, 28 Aug 2016 00:12:45 +0000 (00:12 +0000)]
Document r299142, The leap-seconds file has been updated to
leap-seconds.3676752000
Document r302177, WITH_SYSTEM_COMPILER: Enable by default
Document r304246, PCIe HotPlug: Detect bridges that are not really
HotPlug capable
Document r301565, Switch arm64 to use intrng by default
Document r299781, Support for the Allwinner Reduced Serial Bus (RSB)
Document r296064, Support for Allwinner A20 HDMI
Document r299393, Default installation directory for modules is /boot/modules
Document r303716, Drop SSH1 support
Document r303719, Disable DSA by default
Document r297633, RCTL resources for limited filesystem IO
Document r300723, Mellanox implementation of iSER
Document r299848, Allow reroot to NFS
Document r301033, Discovery without attaching support in iscsictl
Document r299371, camcontrol reprobe
Document r295212, Add an additional, libucl-based configuration file parser
to ctld
Document r287842, Change default regulatory domain from DEBUG to FCC in ifconfig
Document r301875, The SIOCSIFALIFETIME_IN6 ioctl has been removed
skreuzer [Sat, 27 Aug 2016 21:32:56 +0000 (21:32 +0000)]
Document r299142, Native PCIe Hotplug support
Document r298166, libucl has been updated to version 0.8.0
Document r302288, Enable indirect segment I/O by default when running on EC2
Document r302265, Allow ZFS ARC min / max to be tuned at runtime
alc [Sat, 27 Aug 2016 21:31:00 +0000 (21:31 +0000)]
MFC r303747,303982
Correct errors and clean up the comments on the active queue scan.
Eliminate some unnecessary blank lines.
Clean up the comments and code style in and around vm_pageout_cluster().
In particular, fix factual, grammatical, and spelling errors in various
comments, and remove comments that are out of place in this function.
ache [Sat, 27 Aug 2016 11:07:57 +0000 (11:07 +0000)]
MFC r304607,r304641,r304819,r304811
1) Don't forget to set __SERR on __slbexpand() error.
2) Remove "Fast path" from fgetwc()/fputwc() since it can't detect
encoding errors and ignores them all.
One of affected encoding example: US-ASCII
3) Original fgetln() from 44lite return success for line tail errors,
i.e. partial line, but set __SERR and errno in the same time, which
is inconsistent.
Now both OpenBSD and NetBSD return failure, i.e. no line and set error
indicators for such case, so make our fgetln() and fgetwln()
(as its wide version) compatible with the rest of *BSD.
ache [Sat, 27 Aug 2016 10:00:36 +0000 (10:00 +0000)]
MFC r304810
Don't check for __SERR which may stick from one of any previous stdio
functions.
__SERR is for user and the rest of stdio code do not check it
for error sensing internally, only set it.
In vf(w)printf.c here it is more easy to save __SERR, clear and restore it.
cy [Sat, 27 Aug 2016 02:53:21 +0000 (02:53 +0000)]
MFC r304779, r304780, r304781, r304782, r304802
r304779:
Revert r298887 (spelling fix) and remove $FreeBSD$ because text changes
to leap-seconds invaldidates validation hash at the end of the file.
Remove svn:keywords and replace with fbsd:nokeywords=yes to
support this change.
r304780:
Change the algorithm by which /var/db/leap-seconds is updated.
1. Use the leap-seconds version number (update time) to determine
whether to update the file or not.
2. If the version numbers of the files is the same, use the later
expiry date to determine which file to use.
Suggested by: ian@
r304781:
Add logic to replace the working ntp leap-seconds file in /var/db
if it contains a $FreeBSD$ header. The header will cause the file
to fail checksum of the hash causing ntpd to ignore the file.
r304782:
Make validation of the leap-seconds file unconditional.
r304802:
Remove the gratuitous check for $FreeBSD$ and rename the function
to ntpd_init_leapfile, to ensure a copy exists in /var/db if a copy
isn't already there.
ache [Fri, 26 Aug 2016 21:23:38 +0000 (21:23 +0000)]
MFC r304703, r304755
1) _locale.h
LC_*_MASK bit shifting order was partially broken from the initial commit
time at year 2012. Only LC_COLLATE_MASK and LC_CTYPE_MASK are in the
right order.
The order here should match XLC_* from "xlocale_private.h" which, in turn,
match LC_* publicly visible order from <locale.h> which determines how
locale components are stored in the structure.
LC_*_MASK -> XLC_* translation done as "ffs(mask) - 1" in the querylocale()
and equivalent shift loop in the newlocale(), so mapped to some wrong
components (excluding two mentioned above).
Formally the fix is ABI breakage, but old code using those masks
never works properly in any case.
Only newlocale() and querylocale() are affected.
2) msgcat.c
Use current locale (f.e. set by thread). It was global locale always
previously.
hselasky [Fri, 26 Aug 2016 12:04:31 +0000 (12:04 +0000)]
MFC r304342:
Add support for setting blocking and non-blocking mode on /dev/rdma_cm
by returning success on FIONBIO and FIOASYNC IOCTLs. The actual flags
handling is done by the kern_ioctl() function.
Reported by: Alex Bowden <alex.bowden@outlook.com>
Sponsored by: Mellanox Technologies
kib [Fri, 26 Aug 2016 10:04:10 +0000 (10:04 +0000)]
MFC r303382:
Provide the getboottime(9) and getboottimebin(9) KPI.
MFC r303387:
Prevent parallel tc_windup() calls. Keep boottime in timehands,
and adjust it from tc_windup().
MFC notes:
The boottime and boottimebin globals are still exported from
the kernel dyn symbol table in stable/11, but their declarations are
removed from sys/time.h. This preserves KBI but not KPI, while all
in-tree consumers are converted to getboottime().
The variables are updated after tc_setclock_mtx is dropped, which gives
approximately same unlocked bugs as before.
The boottime and boottimebin locals in several sys/kern_tc.c functions
were renamed by adding the '_x' suffix to avoid name conficts.
sephe [Fri, 26 Aug 2016 05:37:44 +0000 (05:37 +0000)]
MFC 303766
tcp/lro: If timestamps mismatch or it's a FIN, force flush.
This keeps the segments/ACK/FIN delivery order.
Before this patch, it was observed: if A sent FIN immediately after
an ACK, B would deliver FIN first to the TCP stack, then the ACK.
This out-of-order delivery causes one unnecessary ACK sent from B.
tuexen [Thu, 25 Aug 2016 09:16:25 +0000 (09:16 +0000)]
MFC r304543:
Unbreak sctp_connectx().
MFC r304573:
Remove duplicate code, which is not protected by the appropriate locks.
MFC r304579:
Improve the locking when sending user messages.
First, keep a ref count on the stcb after looking it up, as
done in the other lookup cases.
Second, before looking again at sp, ensure that it is not
freed, because the assoc is about to be freed.
shurd [Tue, 23 Aug 2016 21:21:56 +0000 (21:21 +0000)]
MFC r304021: Update iflib to support more NIC designs
- Move group task queue into kern/subr_gtaskqueue.c
- Change intr_enable to return an int so it can be detected if it's not
implemented
- Allow different TX/RX queues per set to be different sizes
- Don't split up TX mbufs before transmit
- Allow a completion queue for TX as well as RX
- Pass the RX budget to isc_rxd_available() to allow an earlier return
and avoid multiple calls
kib [Tue, 23 Aug 2016 07:30:20 +0000 (07:30 +0000)]
MFC r304231:
On unwind after failed block allocation in ffs_balloc_ufs{1,2}, assert
that recorded allocated blocks numbers match the physical block numbers
of dandling buffers which are released.
When finally freeing the blocks during unwind, assert that dandling
buffers where not re-allocated.
kib [Tue, 23 Aug 2016 07:25:39 +0000 (07:25 +0000)]
MFC r304228:
When block allocation fails in UFS_BALLOC(), and the volume does not
have SU enabled, there is no point in calling softdep_request_cleanup().
dim [Tue, 23 Aug 2016 05:22:03 +0000 (05:22 +0000)]
MFC r304530:
Pull in r265122 from upstream llvm trunk (by James Molloy):
Fix for pr24346: arm asm label calculation error in sub
Some ARM instructions encode 32-bit immediates as a 8-bit integer
(0-255) and a 4-bit rotation (0-30, even) in its least significant 12
bits. The original fixup, FK_Data_4, patches the instruction by the
value bit-to-bit, regardless of the encoding. For example, assuming
the label L1 and L2 are 0x0 and 0x104 respectively, the following
instruction:
add r0, r0, #(L2 - L1) ; expects 0x104, i.e., 260
would be assembled to the following, which adds 1 to r0, instead of
260:
jhb [Mon, 22 Aug 2016 17:52:10 +0000 (17:52 +0000)]
MFC 304476: Fix various nits in the aio operation manpages.
- Avoid double use of "request" in a single sentence. Instead, describe
aio_sigevent as being used to request notification of the associated
operation's completion. This matches the language used to describe
aio_sigevent in aio(4).
- Simplify the prohibition on modifying buffers while requests are in
flight.
- Fix case mismatch.
- Drop note about not using stack variables. C programmers should be able
to figure out if a stack variable is safe based on the later warning
about the life cycle requirements of control blocks.
- Remove prohibition on modifying the I/O buffer for aio_fsync() since
it does not use an I/O buffer. For aio_mlock(), prohibit modifications
to the mapping (e.g. due to mprotect, munmap, mmap, etc.) but do not
prohibit modifications to the memory backing the buffer (stores into
the pages backing the buffer).
bapt [Mon, 22 Aug 2016 07:08:00 +0000 (07:08 +0000)]
Import Dragonfly Mail Agent snapshort from 20160806 aka v0.11+
Most important change being:
dma - Fix security hole
Affecting DragonFly 4.6 and earlier, Matt Dillon fixed this in base after
finding out from BSDNow Episode 152. Comments following were from his commit
which explains better than I. Just taking his change and putting it here as well.
* dma makes an age-old mistake of not properly checking whether a file
owned by a user is a symlink or not, a bug which the original mail.local
also had.
* Add O_NOFOLLOW to disallow symlinks. Thanks-to: BSDNow Episode 152, made me dive dma to check when they talked
about the mail.local bug.
sephe [Mon, 22 Aug 2016 02:23:05 +0000 (02:23 +0000)]
MFC 304251
hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error.
SRB status is set to 0x20 by the hypervisor, if the specified LUN is
unaccessible, and even worse the INQUIRY response will not be set by
the hypervisor at all under this situation. Additionally, SRB status
is 0x20 too, for TUR on an unaccessible LUN.
Deliver CAM_SEL_TIMEOUT to CAM upon SRB status errors as suggested by
Scott Long, other values seems improper.
This commit fixes the Hyper-V disk hotplug support.
Submitted by: Hongjiang Zhang <honzhan microsoft com>
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7521
ae [Sun, 21 Aug 2016 17:26:16 +0000 (17:26 +0000)]
MFC r304313:
Teach netisr_get_cpuid() to limit a given value to supported by netisr.
Use netisr_get_cpuid() in netisr_select_cpuid() to limit cpuid value
returned by protocol to be sure that it is not greather than nws_count.
karels [Sat, 20 Aug 2016 20:56:36 +0000 (20:56 +0000)]
MFC r304545: Disable L2 caching for UDP over IPv6
The ip6_output routine is missing L2 cache invalication as done
in ip_output. Even with that code, some problems with UDP over
IPv6 have been reported. Diabling L2 cache for that problem works
around the problem for now.