jhb [Fri, 1 Mar 2013 14:54:37 +0000 (14:54 +0000)]
MFC 245577,245640:
Don't attempt to use clflush on the local APIC register window. Various
CPUs exhibit bad behavior if this is done (Intel Errata AAJ3, hangs on
Pentium-M, and trashing of the local APIC registers on a VIA C7). The
local APIC is implicitly mapped UC already via MTRRs, so the clflush isn't
necessary anyway.
jhb [Fri, 1 Mar 2013 03:05:08 +0000 (03:05 +0000)]
MFC 245823,245824,246210
- Use decimal values for UDP, TCP, and UNIX domain socket options rather
than hex to avoid implying that these constants should be treated as bit
masks.
- Add placeholder constants to reserve a portion of the socket option
name space for use by downstream vendors to add custom options.
jhb [Fri, 1 Mar 2013 01:02:44 +0000 (01:02 +0000)]
MFC 245610,245633,245635:
Include the thread name along with the command name when displaying the
command name of a thread from a multi-threaded process that doesn't have
an available argument list (such as kernel processes) and threads display
is enabled via -H.
jhb [Thu, 28 Feb 2013 21:58:07 +0000 (21:58 +0000)]
MFC 245508,245566,245568,245611,245909:
Various fixes to timestamps in NFS:
- Use the VA_UTIMES_NULL flag to detect when NULL was passed to utimes()
instead of comparing the desired time against the current time as a
heuristic.
- Remove unused nfs_curusec().
- Use vfs_timestamp() to set file timestamps rather than invoking
getmicrotime() or getnanotime() directly in NFS.
- Use NFSD_MONOSEC (which maps to time_uptime) instead of the seconds
portion of wall-time stamps to manage timeouts on events.
- Remove unused nd_starttime from the per-request structure in the new
NFS server.
- Use nanotime() for the modification time on a delegation to get as
precise a time as possible.
- Use time_second instead of extracting the second from a call to
getmicrotime().
jhb [Thu, 28 Feb 2013 21:24:19 +0000 (21:24 +0000)]
MFC 245238:
Add an option to not drop options from the third retransmitted SYN. If the
SYNs (or SYN/ACK replies) are dropped due to network congestion, then the
remote end of the connection may act as if options such as window scaling
are enabled but the local end will think they are not. This can result in
very slow data transfers in the case of window scaling disagreements.
Note that the unlike HEAD the existing behavior is preserved by default,
but it can be disabled by setting the
net.inet.tcp.rexmit_drop_options sysctl to zero.
jhb [Thu, 28 Feb 2013 19:01:04 +0000 (19:01 +0000)]
MFC 245476:
- More properly handle interrupted NFS requests on an interruptible mount
by returning an error of EINTR rather than EACCES.
- While here, bring back some (but not all) of the NFS RPC statistics lost
when krpc was committed.
jhb [Thu, 28 Feb 2013 18:59:00 +0000 (18:59 +0000)]
MFC 245471:
Do not require a filter-only interrupt handler for puc ports that are not
serial devices (such as printer ports). This allows ppc devices attached
to puc to correctly setup an interrupt handler and work.
jhb [Thu, 28 Feb 2013 18:49:40 +0000 (18:49 +0000)]
MFC 241748:
When checking to see if a video output's _ADR matches an entry in the
parent adapter's _DOD list, only check the low 16 bits of both _ADR and
_DOD. The language in the ACPI spec seems to indicate that the _ADR values
should exactly match the entries in _DOD. However, I assume that the
masking added to _DOD values was added to work around some known busted
machines (the commit history doesn't indicate either way), and the ACPI
spec does require that the low 16 bits are unique for all video outputs,
so only checking the low 16 bits should be fine.
This fixes recognition of video outputs that use the new standardized
device ID scheme in ACPI 3.0 that set bit 31 such as certain Dell laptops.
jhb [Thu, 28 Feb 2013 18:22:50 +0000 (18:22 +0000)]
MFC 241027:
- Re-shuffle the <machine/pc/bios.h> headers to move all kernel-specific
bits under #ifdef _KERNEL but leave definitions for various structures
defined by standards ($PIR table, SMAP entries, etc.) available to
userland.
- Consolidate duplicate SMBIOS table structure definitions in ipmi(4)
and smbios(4) in <machine/pc/bios.h> and make them available to
userland.
jhb [Thu, 28 Feb 2013 18:10:35 +0000 (18:10 +0000)]
MFC 240968:
Merge similar fixes from 223198 from igb to ixgbe:
- Use a dedicated task to handle deferred transmits from the if_transmit
method instead of reusing the existing per-queue interrupt task.
Reusing the per-queue interrupt task could result in both an interrupt
thread and the taskqueue thread trying to handle received packets on a
single queue resulting in out-of-order packet processing and lock
contention.
- Don't define ixgbe_start() at all when if_transmit is used.
hselasky [Thu, 28 Feb 2013 16:25:34 +0000 (16:25 +0000)]
MFC r235451:
Move reset of USB mouse parameters from the USB mouse attach to
the USB mouse device open. Protect against multi character
device open. Some other nits.
jfv [Thu, 28 Feb 2013 08:19:55 +0000 (08:19 +0000)]
Remove DEV_NETMAP from stable/8 options, this was suggested
and approved by the owner, although there is code in some
drivers in support of it, the feature itself is not fully
supported in this release.
jfv [Thu, 28 Feb 2013 00:22:04 +0000 (00:22 +0000)]
MFC of the E1000 drivers to STABLE/8, this includes the follow revisions
plus a few tweaks:
196969,196970,211516,214646,215781,215789,215808,215910,223350,
223482,223831,228281,228393,229939,231796,232238,234665,235256,
236406,238148,238151,238214,238765,238770,238953,238981,239105,
239109,239304,240518,240693,240968,241037,241856,241885,243570,
243857,245334,246128,246482,247064
jhb [Wed, 27 Feb 2013 21:03:19 +0000 (21:03 +0000)]
MFC 240692,241228:
Adjust the ioctl workaround from r234501:
- Ensure the native ioctl path always allocates a 4kb buffer if a request
uses a buffer size of 0.
- Rounding all small requests up to 32k swamped the controller causing
firmware hangs. Instead, round requests smaller than 64k up to the next
power of 2 as a general rule. To handle the one known special case of a
command that accepts a 12k buffer returning a 24k-ish reply, round
requests between 8k and 16k up to 32k rather than 16k. The result is
that commands less than 8k should now be rounded up to a smaller size
(either 4k or 8k) rather than 32k.
jhb [Wed, 27 Feb 2013 19:38:33 +0000 (19:38 +0000)]
MFC 240474:
- Denote PCI-e endpoints that support FLR.
- Make parsing of PCI-e extended capabilities assume that future version
numbers are backwards compatible.
- Add new AER error descriptions.
- Add descriptions for more PCI-e extended capabilities.
jhb [Tue, 26 Feb 2013 21:05:06 +0000 (21:05 +0000)]
MFC 240467:
Ignore stop and continue signals sent to an exiting process. Stop signals
set p_xstat to the signal that triggered the stop, but p_xstat is also
used to hold the exit status of an exiting process. Without this change,
a stop signal that arrived after a process was marked P_WEXIT but before
it was marked a zombie would overwrite the exit status with the stop signal
number.
jhb [Tue, 26 Feb 2013 19:14:29 +0000 (19:14 +0000)]
MFC 239356,239564:
Teach dhclient to track changes in link state and to enter the reboot
state when the link on an interface goes up causing dhclient to attempt
to renew its existing lease.
jhb [Tue, 26 Feb 2013 16:55:59 +0000 (16:55 +0000)]
MFC 234927:
- Don't log messages saying that accounting is being disabled and enabled
if the accounting log file is atomically replaced with a new file
(such as during log rotation).
- Simplify accounting log rotation a bit. There is no need to re-run
accton(8) after renaming the new log file to it's real name.
mav [Thu, 21 Feb 2013 17:00:37 +0000 (17:00 +0000)]
MFC r238379, r238382 (by bruefer):
Renamed the kern.cam.da.da_send_ordered sysctl and tunable to
kern.cam.da.send_ordered, more in line with the other da sysctls/tunables.
Renamed the kern.cam.ada.ada_send_ordered sysctl and tunable to
kern.cam.ada.send_ordered, more in line with the other da sysctls/tunables.
hselasky [Thu, 21 Feb 2013 08:21:14 +0000 (08:21 +0000)]
MFC r246616 and r246759:
- Move scratch data from the USB bus structure to the USB device
structure so that simultaneous access cannot happen. Protect scratch
area using the enumeration lock.
- Reduce stack usage in usbd_transfer_setup() by moving some big stack
members to the scratch area. This saves around 200 bytes of stack.
- Fix a whitespace.
- Protect control requests using the USB device enumeration lock.
- Make sure all callers of usbd_enum_lock() check the return value.
- Remove the control transfer specific lock.
- Bump the FreeBSD version number, hence external USB modules may need
to be recompiled due to a USB device structure change.
markj [Tue, 19 Feb 2013 16:40:16 +0000 (16:40 +0000)]
MFC r239672 (by rrs):
This small change takes care of a race condition
that can occur when both sides close at the same time.
If that occurs, without this fix the connection enters
FIN1 on both sides and they will forever send FIN|ACK at
each other until the connection times out. This is because
we stopped processing the FIN|ACK and thus did not advance
the sequence and so never ACK'd each others FIN. This
fix adjusts it so we *do* process the FIN properly and
the race goes away ;-)
markj [Sun, 17 Feb 2013 19:49:29 +0000 (19:49 +0000)]
MFC r245961 r245962 r245963.
MFC r245961:
When the 'R' flag is used with a newsyslog.conf entry, some fields of
the corresponding struct sigwork_entry were left uninitialized,
potentially causing an early return from do_sigwork(). Ensure that these
fields are initialized, and handle the 'R' flag properly in
do_sigwork().
MFC r245962:
Ensure that newsyslog -n prints the correct message for a rotation rule
that uses the 'R' flag.
MFC r245963:
Rename the run_cmd field to sw_runcmd to make it consistent with the
other fields in struct sigwork_entry.
hselasky [Thu, 14 Feb 2013 11:25:07 +0000 (11:25 +0000)]
MFC r246397:
Make sure that all mouse buttons are released when clients
using /dev/consolectl close. This fixes a problem where if
a USB mouse is detached while a button is pressed, that
button is never released.
yongari [Wed, 13 Feb 2013 00:47:47 +0000 (00:47 +0000)]
MFC r246341:
Rework jumbo frame handling. QAC confirmed that the controller
requires 8 bytes alignment on RX buffer. Given that non-jumbo
frame works on any alignments I guess this DMA limitation for RX
buffer could be jumbo frame specific one. Also I'm not sure
whether this DMA limitation is related with 64bit DMA. Previously
age(4) disabled 64bit DMA addressing due to silent data corruption.
So we may need more testing on re-enabling 64bit DMA in future.
While I'm here, change mbuf chaining algorithm to use fixed sized
buffer and force software checksum if controller reports length
error. According to QAC, RFD is not updated at all for jumbo frame
so it works just like alc(4) controllers. This change also added
alignment fixup for strict alignment architectures. Because I'm
not aware of any non-x86 machines that use age(4) controllers it's
just for completeness at this moment.
Wit this change, jumbo frame should work with age(4).
cperciva [Sun, 10 Feb 2013 17:50:56 +0000 (17:50 +0000)]
MFC r246016:
Add a loader tunable "hw.broken_txfifo" which enables a workaround for a
bug in old versions of QEMU (and Xen, and other places using QEMU code).
delphij [Sat, 9 Feb 2013 01:41:21 +0000 (01:41 +0000)]
MFC r245264:
The current ZFS code expects ddt_zap_count to always succeed by asserting
the underlying zap_count() to return no errors. However, it is possible
that the pool reaches to such a state where zap_count would return error,
leading to panics when a pool is imported.
This commit changes the ddt_zap_count to return error returned from
zap_count and handle the error appropriately. With this change, it's now
possible to let zpool rollback damaged transaction groups and import the
pool.
delphij [Sat, 9 Feb 2013 01:38:43 +0000 (01:38 +0000)]
MFC r222950 (gibbs):
Remove C constructs that are incompatible with C++ from various
OpenSolaris and ZFS header files. These changes are sufficient
to allow a C++ program to use the libzfs library.
Note: The majority of these files already included 'extern "C"'
declarations, so the intention of providing C++ compatibility
already existed even if it wasn't provided.
cddl/compat/opensolaris/include/assert.h:
Wrap our compatibility assert implementation in
'extern "C"'. Since this is a compatibility header
I matched the Solaris style of doing this explicitly
rather than rely on FreeBSD's __BEGIN/END_DECLS macro.
sys/cddl/compat/opensolaris/sys/kstat.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h:
Rename parameters in function declarations that conflict
with C++ keywords. This was the solution preferred by
members of the Illumos community.
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h:
In C, nested structures are visible in the global namespace,
but in C++, they take on the namespace of the structure in
which they are contained. Flatten nested structure
definitions within struct zfs_cmd so these structures are
visible in the global namespace when compiled in both
languages.
kib [Fri, 8 Feb 2013 11:17:47 +0000 (11:17 +0000)]
MFC r246218:
Backup FATs were sometimes marked dirty by copying their first block
from the primary FAT, and then they were not marked clean on unmount.
Force marking them clean when appropriate.
pluknet [Thu, 7 Feb 2013 11:09:16 +0000 (11:09 +0000)]
MFC r226043 (manually):
Remove assertion against empty NFSv4 ACLs. An empty ACL is not exactly
valid - we don't allow for setting it on a file, for example - but it's
not something we should assert on.
For STABLE kernel, it changes nothing, because it's not compiled with
INVARIANTS. If it was, it would fix crashes. It also fixes an assert
in libc encountered with NFSv4 without nfsuserd(8) running.
mav [Wed, 6 Feb 2013 18:41:12 +0000 (18:41 +0000)]
MFC r242175:
Remove priority enforcement from xpt_ation(). It is not good and even not
safe in some cases to reduce CCB priority after it was scheduled with high
priority. This fixes reproducible deadlock when command sent through the
pass interface while ATA XPT recovers from command timeout.
Instead of that enforce priority at passioctl(). libcam provides no obvious
interface to specify CCB priority and so much (all?) code specifies zero
(highest) priority. This change limits pass CCBs priority to NORMAL run
level, allowing XPT to complete bus and device recovery after reset before
running any payload.
delphij [Tue, 5 Feb 2013 09:53:32 +0000 (09:53 +0000)]
MFC r243779 (marcel):
Protect against DoS attacks, such as being described in CVE-2010-2632.
The changes were derived from what has been committed to NetBSD, with
modifications. These are:
1. Preserve the existsing GLOB_LIMIT behaviour by including the number
of matches to the set of parameters to limit.
2. Change some of the limits to avoid impacting normal use cases:
GLOB_LIMIT_STRING - change from 65536 to ARG_MAX so that glob(3)
can still provide a full command line of expanded names.
GLOB_LIMIT_STAT - change from 128 to 1024 for no other reason than
that 128 feels too low (it's not a limit that impacts the
behaviour of the test program listed in CVE-2010-2632).
GLOB_LIMIT_PATH - change from 1024 to 65536 so that glob(3) can
still provide a fill command line of expanded names.
3. Protect against buffer overruns when we hit the GLOB_LIMIT_STAT or
GLOB_LIMIT_READDIR limits. We append SEP and EOS to pathend in
those cases. Return GLOB_ABORTED instead of GLOB_NOSPACE when we
would otherwise overrun the buffer.
This change also modifies the existing behaviour of glob(3) in case
GLOB_LIMIT is specifies by limiting the *new* matches and not all
matches. This is an important distinction when GLOB_APPEND is set or
when the caller uses a non-zero gl_offs. Previously pre-existing
matches or the value of gl_offs would be counted in the number of
matches even though the man page states that glob(3) would return
GLOB_NOSPACE when gl_matchc or more matches were found.
The limits that cannot be circumvented are GLOB_LIMIT_STRING and
GLOB_LIMIT_PATH all others can be crossed by simply calling glob(3)
again and with GLOB_APPEND set.
The entire description above applies only when GLOB_LIMIT has been
specified of course. No limits apply when this flag isn't set!
delphij [Tue, 5 Feb 2013 09:50:33 +0000 (09:50 +0000)]
MFC r243758 (marcel):
In globextend() when the pathv vector cannot be (re-)allocated, don't
free and clear the gl_pathv pointer in the glob_t structure. Such
breaks the invariant of the glob_t structure, as stated in the comment
right in front of the globextend() function. If gl_pathv was non-NULL,
then gl_pathc was > 0. Making gl_pathv a NULL pointer without also
setting gl_pathc to 0 is wrong.
Since we otherwise don't free the memory associated with a glob_t in
error cases, it's unlikely that this change will cause a memory leak
that wasn't already there to begin with. Callers of glob(3) must
call globfree(3) irrespective of whether glob(3) returned an error
or not.
MFC r243759 (marcel):
In globextend(), take advantage of the fact that realloc(NULL, size) is
equivalent to malloc(size). This eliminates the conditional expression
used for calling either realloc() or malloc() when realloc() will do
all the time.
eadler [Sat, 2 Feb 2013 23:22:39 +0000 (23:22 +0000)]
MFC r244122:
Remove 'dangerous' instructions from the example make.conf.
Clarify when and why these might be used and that this isn't a supported
configuration.
pluknet [Fri, 1 Feb 2013 15:48:29 +0000 (15:48 +0000)]
MFC r200596 (by imp):
Add NO_KERNELOBJ flag, similar to NO_KERNEL{CONFIG,DEPEND,CLEAN},
which disables doing a make obj. Use it when you know it will work
only. KERNFAST now implies NO_KERNELOBJ, since you don't need to keep
doing obj when doing incremental kernel builds.
delphij [Fri, 1 Feb 2013 07:38:26 +0000 (07:38 +0000)]
MFC r244568:
- Reduce buffer size from LINE_MAX to PATH_MAX, there is no point to store
path longer than this.
- Fix an unreached case of check against sizeof buf, which in turn leads
to an off-by-one nul byte write on the stack. The original condition
can never be satisfied because the passed boundary is the maximum value
that can be returned, so code was harmless.