Remove useless comparisions of assigned offset and resid with the
sources from uio. Both uio_offset and offset, and uio_resid and resid
have the same types for some time.
Add check for buflen overflow by comparing the buflen with both offset
and resid (vs. comparing with offset only, as it is currently done).
Reported and tested by: pho
Approved by: des (pseudofs maintainer)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Colin Percival [Wed, 13 Nov 2013 08:08:56 +0000 (08:08 +0000)]
Strip the -pN patch level from the VERSION string which gets encoded into
CTF data. Otherwise FreeBSD Update builds think every kernel file has
changed every time there's a security advisory, since the FreeBSD Update
build code isn't smart enough to look inside CTF data to ignore those
changes.
Pointy hat to: cperciva
MFC after: 1 day, or before the next BETA
Adrian Chadd [Wed, 13 Nov 2013 07:09:00 +0000 (07:09 +0000)]
Correctly initialise the 2-chain antenna mask in the link quality table.
The previous code simply hard-coded IWN_ANT_AB which is only correct for
some of the NICs.
Now, if the NIC is a 1-stream TX, you need to set IWN_ANT_AB and _not_
just a single antenna. The Intel 5100 firmware panics the moment the
link quality table is updated.
So!
* no secondary antenna? Set it to IWN_ANT_AB;
* two-stream device? Transmit on the full transmit antenna configuration.
Justin Hibbits [Wed, 13 Nov 2013 01:37:52 +0000 (01:37 +0000)]
Increase the stack size for ppc64 from 4 pages to 8.
I found a stack overflow when a coredump was taken onto a ZFS volume with
heavy network activity. 2 DSI traps, plus one DECR trap, along with several
function calls in the stack, overflowed the 4 pages. 8 page stack fixes this.
Ian Lepore [Wed, 13 Nov 2013 01:04:02 +0000 (01:04 +0000)]
Add ENETUNREACH and EADDRNOTAVAIL to the list of errors that are potentially
transient and shouldn't result in closing the socket and giving up forever.
Ian Lepore [Wed, 13 Nov 2013 01:01:15 +0000 (01:01 +0000)]
This fixes 3 problems in syslogd related to sizing receive buffers...
- A call was misplaced at the wrong level of nested if blocks, so that
the buffers for unix domain sockets (/dev/log, /dev/klog) were never
increased at all; they remained at a way-too-small default size of 4096.
- The function that was supposed to double the size of the buffer
sometimes did nothing, and sometimes installed a wildly-wrong buffer
size (either too large or too small) due to an unitialized 'slen'
variable passed to getsockopt(). Most often it doubled the UDP buffers
from 40k to 80k because accidentally there would be harmless stack
garbage in the unitialized variables.
- The whole concept of blindly doubling a socket's buffer size without
knowing what size it started at is a design flaw that has to be called a
bug. If the double_rbuf() function had worked at all (I.E., if the
other two bugs didn't exist) this would lead to UDP sockets having an
80k buffer while unix dgram sockets get an 8k buffer. There's nothing
about the problem being solved that requires larger buffers for UDP than
for unix dgram sockets -- the buffering requirements are the same
regardless of socket type.
This change renames the double_rbuf() function to increase_rbuf() and
increases the buffer size on all types of sockets to 80k. 80k was
chosen only because it appears to be the size the original change was
shooting for, and it certainly seems to be reasonably large (I might
have picked 64k in the absence of any historical guidance).
Jim Harris [Tue, 12 Nov 2013 21:14:19 +0000 (21:14 +0000)]
Check for special status code from FIRMWARE_ACTIVATE command
signifying that a reboot is required to complete activation
of the requested firmware image.
Reported by: Joe Golio <joseph.golio@emc.com>
Sponsored by: Intel
MFC after: 3 days
John Baldwin [Tue, 12 Nov 2013 19:44:18 +0000 (19:44 +0000)]
Add a pre-world mode of updating similar to the -p option that can be
passed to mergemaster. In this mode, only changes to /etc/master.passwd
and /etc/group are merged to /etc. In addition, it uses a temporary
tree to stage these changes rather than overwriting the existing
'current' and 'previous' trees so that a full update can be run after
a normal installworld has completed.
John Baldwin [Tue, 12 Nov 2013 19:15:06 +0000 (19:15 +0000)]
Add an -s option that specifies a path to an alternate etcupdate.sh script
to test. This allows a non-installed version of the script to be tested
more easily.
John Baldwin [Tue, 12 Nov 2013 18:59:23 +0000 (18:59 +0000)]
Revert r257715. This breaks the case where devd isn't running. The
real solution to this is still being discussed and probably won't look
quite like this.
Alan Cox [Tue, 12 Nov 2013 17:46:11 +0000 (17:46 +0000)]
Eliminate the gratuitous use of mmap(2) flags from the implementation
of kern_shmat(). Use a simpler approach to determine whether to pass
VMFS_NO_SPACE or VMFS_OPTIMAL_SPACE to vm_map_find().
Ed Maste [Tue, 12 Nov 2013 17:25:33 +0000 (17:25 +0000)]
Update LLDB to upstream r194122 snapshot
ludes minor changes relative to upstream, for compatibility with
FreeBSD's in-tree LLVM 3.3:
- Reverted LLDB r191806, restoring use of previous API.
- Reverted part of LLDB r189317, restoring previous enum names.
- Work around missing LLVM r192504, using previous registerEHFrames API
(limited functionality).
- Removed PlatformWindows header include and init/terminate calls.
Nathan Whitehorn [Tue, 12 Nov 2013 16:15:09 +0000 (16:15 +0000)]
Following the approach with ACPI DMAR on x86, split IOMMU handling into
a variant PCI bus instead of trying to shoehorn it into the PCI host bridge
adapter. Besides matching better the architecture on other platforms, this
also allows systems with multiple partitionable endpoints per PCI host
bridge to work correctly.
Nathan Whitehorn [Tue, 12 Nov 2013 16:14:45 +0000 (16:14 +0000)]
Actually add IOMMU domain to the list of known mappings. This fixes a bug
where multiple devices in the same IOMMU domain would be allocated
conflicting mappings unless they also shared a DMA tag.
As all the IIC controllers on system uses the same 'iichb' prefix we cannot
rely only on checking the device unit to indentify the BSC unit we are
attaching to. Make use of the device base address to identify our BSC unit.
Adds gpioiic.4 and gpioled.4 man pages. Moves some of the information that
was previously available on gpio.4 to their respectives pages. Add the
cross references on gpioctl.8.
Adrian Chadd [Tue, 12 Nov 2013 05:49:01 +0000 (05:49 +0000)]
Fix up the link quality lookup and re-enable multi-rate retry.
This is a terrible solution that at least behaves mostly correctly.
It walks the currently active rate table looking for rates to match.
It assumes that the code matches the setup path in the link quality
setup code (much like the previous, much simpler but even more hackish
math did.)
It's O(n), but n<15, so we're okay for the time being.
Nathan Whitehorn [Mon, 11 Nov 2013 23:37:16 +0000 (23:37 +0000)]
Use the same implementation of copyinout.c for both AIM and Book-E. This
fixes some bugs in both implementations related to validity checks on
mapping bounds.
Dimitry Andric [Mon, 11 Nov 2013 21:16:55 +0000 (21:16 +0000)]
Disable building the ctl module for the i386 XEN kernel configuration
for now, since it causes gcc warnings about casting 64 bit bus_addr_t's
to 32 bit pointers, and vice versa.
Nathan Whitehorn [Mon, 11 Nov 2013 17:37:50 +0000 (17:37 +0000)]
Follow up r223485, which made AIM use the ABI thread pointer instead of
PCPU fields for curthread, by doing the same to Book-E. This closes
some potential races switching between CPUs. As a side effect, it turns out
the AIM and Book-E swtch.S implementations were the same to within a few
registers, so move that to powerpc/powerpc.
Mark Johnston [Mon, 11 Nov 2013 16:57:57 +0000 (16:57 +0000)]
Consistently add the relocation offset only when the ELF type is not
ET_EXEC. This fixes several problems with the DTrace pid provider not
being able to match probes.
Nathan Whitehorn [Mon, 11 Nov 2013 16:14:25 +0000 (16:14 +0000)]
Rename the "bare" platform "mpc85xx", which is what it actually is, and
add actual platform probing based on PVR. Still needs a little more work:
in particular, the CCRS setup should move here.
Also turn "bare" into a truly bare platform that doesn't pretend to know how
to do anything except get the memory map. This should also be enhanced to
process the FDT reserved memory list, but that is for another day.
Nathan Whitehorn [Mon, 11 Nov 2013 15:43:21 +0000 (15:43 +0000)]
Make tsec work with the device tree present on the RB800. The previous code
assumed that the MDIO bus was a direct child of the Ethernet interface. It
may not be and indeed on many device trees is not. While here, add proper
locking for MII transactions, which may be on a bus shared by several MACs.
Nathan Whitehorn [Mon, 11 Nov 2013 15:23:35 +0000 (15:23 +0000)]
Allow OF_decode_addr() to also be able to map resources on big-endian
devices. To this end, make PCI device detection rely on the device_type
field rather than name, as per the standard.
Nathan Whitehorn [Mon, 11 Nov 2013 15:00:33 +0000 (15:00 +0000)]
Consolidate Apple firmware hacks and improve them by switching on the
presence of mac-io devices in the tree, which uniquely identifies Apple
hardware.
Fix panic with RADIX_MPATH, when RTFREE_LOCKED() called for already
unlocked route. Use in6_rtalloc() instead of in6_rtalloc1. This helps
simplify the code and remove several now unused variables.
Adrian Chadd [Mon, 11 Nov 2013 09:08:22 +0000 (09:08 +0000)]
If A-MPDU transmission fails entirely, then no BA is received from the
NIC and pushed up to the driver. Unfortunately this means there's
no rate control notification done. Thus, if the rate control code
makes a decision that hits a crappy rate that can't succeed, the
rate code would never lower the rate and packet loss would continue.
So, fake some rate control notification in this case.
Adrian Chadd [Mon, 11 Nov 2013 08:53:20 +0000 (08:53 +0000)]
Send EAPOL frames at the management rate, not the data rate.
Without this, a far away station with low signal strength would
associate using the management rate (by default the lowest rate)
and then the EAPOL frames would go out at the current AMRR best
guess. This would result in association failing authentication.
Devin Teske [Mon, 11 Nov 2013 02:13:47 +0000 (02:13 +0000)]
Check the partition scheme before blowing away disks, instead of after.
The effects of this patch would only be noticeable if you were purposefully
setting a bad value and trying to see what happens; and leaving the disks
intact if a bad value has been set seems fair.
Glen Barber [Mon, 11 Nov 2013 01:42:59 +0000 (01:42 +0000)]
Unbreak the installer on head/:
When bsdinstall(8) sources the bsdconfig(8) common.subr file,
PKG_ABI is set by calling 'pkg -vv' and searching for the ABI
pkg(8) will use.
When pkg(8) is run for the first time, the bootstrap process
is run, which prompts for 'y/N' input from stdin if running with
TERM set.
Since TERM is set and it is the first time pkg(8) is run, which
happens automatically, bsdinstall(8) hangs waiting for user input
which is never displayed since a specific line is expected by
awk(1), and stdin is expected by pkg(8).
Set ASSUME_ALWAYS_YES=1, which will cause pkg(8) to assume the
'-y' flag is also used for the bootstrap process, allowing
bsdinstall(8) to proceed to the keymap lookup, otherwise
bsdinstall(8) appears to hang after selecting 'Install' from the
menu on first boot from CDROM.