Commit Graph

197006 Commits

Author SHA1 Message Date
Jilles Tjoelker
b90eeb5fb4 Ensure #include <semaphore.h> is sufficient for using SEM_VALUE_MAX.
Discussed with:	pluknet
2015-01-31 16:39:26 +00:00
Pedro F. Giffuni
4a7f186ea6 MFV r277981:
Upstream fixes for issues found with afl (Issue #417).

- Fix length checking.

Check both the captured length and the on-the-wire length (the latter
*should* be greater than or equal to the former, but that's not
guaranteed).

Add some additional length checks, so neither caplen nor length
underflow.

If we stop dissecting because the packet is too short, return 1, not 0,
as we've "dissected" what we can; 0 means "this is LLC+SNAP with an OUI
of 0 and an unknown Ethertype".

commit:	743bcecdc92f88b118ec7aac4f68b606601205cc

- Clean up length checks.

Check only the amount of length that matters at any given point; yes,
this means we do multiple checks, but so it goes.

We don't need to check for LLC+SNAP - llc_print() does that for us.  We
do, however, need to check to make sure we can safely skip the Fore
header.

commit:	5c65e7532fa16308e01299988852b0dc5b027559
2015-01-31 16:34:39 +00:00
Pedro F. Giffuni
d3b6650ba6 Upstream fixes for issues found with afl (Issue #417).
- Fix length checking.

Check both the captured length and the on-the-wire length (the latter
*should* be greater than or equal to the former, but that's not
guaranteed).

Add some additional length checks, so neither caplen nor length
underflow.

If we stop dissecting because the packet is too short, return 1, not 0,
as we've "dissected" what we can; 0 means "this is LLC+SNAP with an OUI
of 0 and an unknown Ethertype".

commit:	743bcecdc92f88b118ec7aac4f68b606601205cc

- Clean up length checks.

Check only the amount of length that matters at any given point; yes,
this means we do multiple checks, but so it goes.

We don't need to check for LLC+SNAP - llc_print() does that for us.  We
do, however, need to check to make sure we can safely skip the Fore
header.

commit:	5c65e7532fa16308e01299988852b0dc5b027559
2015-01-31 16:26:21 +00:00
Luiz Otavio O Souza
2b8b8321e3 Implement a new method to retrieve the gpiobus reference from a GPIO
controller.

The gpiobus is responsible to keep track of the used pins and serialize
the access to pins.

Some of these features are important to devices that do not descend
directly from gpiobus and as such cannot make use of its features (one
classic example is gpioc that is attached to the GPIO controller and could
not, until now, make use of the gpiobus locking).
2015-01-31 15:50:19 +00:00
Pedro F. Giffuni
484f578134 Prevent access to an uninitialized variable
The "-h" option may access an uninitialized value. Prevent it
by properly initializing the value.

CID:	1006559
2015-01-31 15:41:01 +00:00
Edward Tomasz Napierala
872d2d9276 Use proper module name in MODULE_VERSION().
Sponsored by:	The FreeBSD Foundation
2015-01-31 15:22:45 +00:00
Edward Tomasz Napierala
a6ad7194e0 Drop unneeded include.
Sponsored by:	The FreeBSD Foundation
2015-01-31 15:21:54 +00:00
Edward Tomasz Napierala
e73ebd6840 Fix build with "device iscsi" in kernel config.
Sponsored by:	The FreeBSD Foundation
2015-01-31 15:20:58 +00:00
Dimitry Andric
620d4f3c0b Fix a bunch of -Wcast-qual warnings in sys/dev/usb/input/uhid.c, by
using __DECONST.  No functional change.

Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D1743
2015-01-31 14:18:46 +00:00
Jilles Tjoelker
edebe56497 sh: Abort a wait builtin on any trapped signal.
This is required by POSIX.

PR:		197210
Reported by:	ache
MFC after:	2 weeks
2015-01-31 13:53:29 +00:00
Konstantin Belousov
f1a90a7bac Remove single-use boolean.
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-01-31 12:58:04 +00:00
Luiz Otavio O Souza
0398637236 Replace spaces with tabs, this will easier future changes on softc
structure.

No functional changes.
2015-01-31 12:43:30 +00:00
Konstantin Belousov
6690381ef1 The dependency chain for priority-inheritance mutexes could be
subverted by userspace into cycle.  Both umtx_propagate_priority() and
umtx_repropagate_priority() would then loop infinitely, owning the
spinlock.

Check for the cycle using standard Floyd' algorithm before doing the
pass in the affected functions.  Add simple check for condition of
tricking the thread into a wait for itself, which could be easily
simulated by usermode without race.

Found by:	Eric van Gyzen <eric@vangyzen.net>
In collaboration with:	Eric van Gyzen <eric@vangyzen.net>
Tested by:	pho
MFC after:	1 week
2015-01-31 12:27:40 +00:00
Konstantin Belousov
311d39f2ee POSIX states that write(2) "shall mark for update the last data
modification and last file status change timestamps of the file".
Currently, tmpfs only modifies ctime when file was extended.  Since
r277828 followed tmpfs_write(), mmaped writes also do not modify
ctime.

Fix this, by updating both ctime and mtime for writes to tmpfs files.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-01-31 12:27:18 +00:00
Luiz Otavio O Souza
876c1bd8b0 Clean up and fix the device detach routine and the failure path on GPIO
drivers.

This paves the way for upcoming work.
2015-01-31 12:17:07 +00:00
Edward Tomasz Napierala
9e46a88722 Add two files missed in r277963.
Sponsored by:	The FreeBSD Foundation
2015-01-31 08:03:56 +00:00
Edward Tomasz Napierala
321b17ec15 Add kobj interface between ICL and the rest of the iSCSI stack.
Review note - icl.c was moved to icl_soft.c.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-01-31 07:49:50 +00:00
Nathan Whitehorn
5bfb054e01 Add support for booting relocatable kernels on PowerPC. 2015-01-31 07:22:29 +00:00
Mark Johnston
c7fa6f0bb0 Stop iterating and return if the caller-supplied callback function returns
a non-zero value.

MFC after:	1 week
2015-01-31 03:22:00 +00:00
John Baldwin
4c99145742 Add a WITNESS_WARN check to STOPEVENT() to match the one in _STOPEVENT(). 2015-01-31 02:15:16 +00:00
Adrian Chadd
29fa5c67e4 Fix backlight for ivybridge based laptops (and whatever else comes through
this codepath.)

(1<<30) is documented as BLM_PCH_OVERRIDE_ENABLE, which the current
i915 driver in Linux only sets for broadwell chips.

This fixes the backlight control on the Lenovo X230.

Approved by:	kib
Obtained from:	Linux 7aa1e7f06d6ea1bce3b27630d50769d13da28b1a
2015-01-31 02:13:25 +00:00
Rui Paulo
c0a9702f95 ti_pruss: make sure the mmap'ed memory region is uncacheable.
MFC after:	1 week
2015-01-31 02:12:57 +00:00
Michael Gmelin
be0acc1ced Fix order of functions in smbios.c (corrects r277949), since this corrects
a build error I committed this directly, sorry.
2015-01-31 00:06:05 +00:00
Colin Percival
803deb9a21 Fix 7-year-old typo: The default directory searched for fortunes is
/usr/share/games/fortune, not /usr/games/fortune (which is the path
to the fortune binary itself).
2015-01-30 23:26:03 +00:00
Dimitry Andric
7f4daa88f1 Fix a -Wcast-qual warning in smbfs_subr.c, by using __DECONST. No
functional change.

MFC after:	3 days
2015-01-30 22:02:32 +00:00
Dimitry Andric
38fc0aa484 Fix a -Wcast-qual warning in udf_vnops.c, by using __DECONST. No
functional change.

MFC after:	3 days
2015-01-30 22:01:45 +00:00
Dimitry Andric
1bb25a82ab Fix a bunch of -Wcast-qual warnings in netgraph's ng_parse.c, by using
__DECONST.  No functional change.

MFC after:	3 days
2015-01-30 21:59:53 +00:00
Nathan Whitehorn
04e98a3724 Use MBR by default on BIOS systems. An increasing number of motherboards
assume that GPT means UEFI boot, resulting in the installation of
uninstallable systems. This needs a little more work before MFC, in
particular based on disk size (> 2 TB + BIOS + MBR is not workable). That
will come soon.
2015-01-30 21:22:18 +00:00
Michael Gmelin
26066a530f New function smbios_match to detect BIOS versions during boot
Motivation is to introduce BIOS specific quirks early in the boot
process. smbios_match can be called before malloc is avaible, that's
why parts of smbios_detect have been moved into a separate function
smbios_probe that will be called by smbios_detect as well as
smbios_match.

Reviewed by:	jhb
Approved by:	jhb
Differential Revision: 	https://reviews.freebsd.org/D1679
2015-01-30 19:47:25 +00:00
Pedro F. Giffuni
311449a4e3 msun: use previously ignored value.
This fixes evaluation of exceptional values in scalblnl().
While here, simplify the code as suggested by Bruce Evans.

Reported by:	clang static analyzer
MFC after:	1 week
2015-01-30 19:19:03 +00:00
Dimitry Andric
09a4a1f2d8 Partially revert r273382, to reduce diffs against upstream. This was a
temporary fix to solve a conflict with an older version of libc++, and
it is no longer relevant.

MFC after:	3 days
2015-01-30 18:26:38 +00:00
Doug Ambrisko
b6a6b77b12 Fix UEFI PXE boot on a NIC that isn't the first NIC.
In UEFI it appears all available NICS are present to pass network traffic.
This gives the capability to load the loader.efi from disk then set
currdev="net3:" and then all I/O will over over the 2nd NIC.  On this
machine is appears the first handle is the first NIC in IPv4 mode and
then the 2nd handle is the first NIC in IPv6 mode.  The 3rd handle is
the 2nd NIC in IPv4 mode.  The fix is to index into the handle based
on the unit cached from boot device passed into the loader.

Some testing info from a test boot via kenv:
	currdev="net3:"
	loaddev="net3:"
	boot.netif.name="igb1"
2015-01-30 18:25:53 +00:00
Eric Joyner
e3bf410907 Add myself (erj) to committers-src.dot.
Approved by:	gnn (mentor), jfv (mentor)
2015-01-30 18:19:22 +00:00
Luiz Otavio O Souza
c213658943 The BCM2835 GPIO controller uses has interrupt lines and not only one.
Allocate all four, we will use them soon.

Simplificate the allocation of memory and interrupt resources with a single
bus_alloc_resources() call instead of doing them separately.

Destroy the mutex in case of errors.
2015-01-30 18:18:09 +00:00
Dimitry Andric
c234c2de73 For clang, disable -Wcast-qual warnings for specific aesni files, since
clang 3.6.0 will emit a number of such warnings for those files, and
they are partially contributed code.
2015-01-30 18:17:17 +00:00
Enji Cooper
b7c2ba84c9 Create MANLINKS for lzgrep, etc when MK_LZMA_SUPPORT != no
MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2015-01-30 18:07:46 +00:00
Hiren Panchasara
ec446b1375 Make syncookie_mac() use 'tcp_seq irs' in computing hash.
This fixes what seems like a simple oversight when the function was added in
r253210.

Reported by:            Daniel Borkmann <dborkman@redhat.com>
                        Florian Westphal <fw@strlen.de>
Differential Revision:  https://reviews.freebsd.org/D1628
Reviewed by:            gnn
MFC after:              1 month
Sponsored by:           Limelight Networks
2015-01-30 17:29:07 +00:00
Michael Reifenberger
c47ef15f23 Keep original images, dont compile tests,
makefs for iso images translates labes to uppercase, so adopt fstab for this case.
2015-01-30 15:42:52 +00:00
Konstantin Belousov
803fc2ca26 Use powerof2(). Remove single-use variable.
Submitted by:	Conrad Meyer
Differential Revision:	https://reviews.freebsd.org/D1724
MFC after:	1 week
2015-01-30 15:32:35 +00:00
Luiz Otavio O Souza
99a2011188 Allow the retrieving of the reserved pins state.
With this change, it is now possible to verify the pin function and level
of reserved pins (but not set them).

The use of reserved pins on Raspberry pi can lead to short circuits and
real damage to the SoC.

While here, remove duplicated code, make use of OF_getencprop_alloc()
instead of using fixed sized variables and reduce the dmesg spam by
printing reserved pin ranges (when possible) instead of printing each pin
in the range.
2015-01-30 14:35:04 +00:00
Luiz Otavio O Souza
9855acef2a Do not leak the OFW memory when the result does not satisfy our alignment
requirement.

While here, fix style(9) issues.
2015-01-30 14:09:07 +00:00
Pawel Jakub Dawidek
33c380b096 Make gcc happy.
Reported by:	bz
2015-01-30 13:03:36 +00:00
Pawel Jakub Dawidek
b4b884751b Add missing nvlist_get_parent(3) link.
Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
2015-01-30 12:57:35 +00:00
Pawel Jakub Dawidek
c06165279d Handle empty nvlists correctly.
Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
2015-01-30 12:31:29 +00:00
Konstantin Belousov
1c9b585695 When mounting SU-enabled mount point, wait until the softdep_flush()
thread started and incremented the stat_flush_threads [1].

Unconditionally wakeup softdep_flush threads when needed, do not try
to check wchan, which is racy and breaks abstraction.

Reported by and discussed with:	glebius, neel
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-01-30 11:41:46 +00:00
Pawel Jakub Dawidek
aa2e2bdaf2 Modify nvlist_get_parent() API to take additional cookie argument.
This allow for non-recursive iteration over nested nvlists, as in documented
example.

Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
2015-01-30 10:08:38 +00:00
Pawel Jakub Dawidek
00294559aa If moving descriptor or binary data to an nvlist fails, we need to close the
descriptor or free the memory before returning.

Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>

While here, protect errno, so it won't be overwritted by close(2) or free(3).
2015-01-30 09:44:29 +00:00
Kenneth D. Merry
e761f855a0 Improve SCSI Extended Inquiry VPD page (0x86) support.
sys/cam/scsi/scsi_all.h:
	In struct scsi_extended_inquiry_data:
	- Increase the length field to 2 bytes, as it is 2 bytes in SPC-4.
	- Add bit definitions for the various Activiate Microcode actions.
	- Add the Sequential Access Logical Block Protection support bit,
	  since we need that in the sa(4) driver.  (For modifications
	  that will come later.)
	- Add definitions for the various Multi I_T Nexus Microcode
	  Download modes.

sys/cam/ctl/ctl.c:
	As of SPC-4, a single report of "REPORTED LUNS DATA HAS CHANGED"
	is to be given per I_T nexus.  Once it is reported, the unit
	attention condition should be cleared for all LUNS attached to
	an I_T nexus.

	Previously that only happened when a REPORT LUNS command was
	processed.

	This behavior may be different (according to SAM-5) when the
	UA_INTLCK_CTRL bits are non-zero in the control mode page but
	CTL does not currently support that.

	So, in view of the spec, whenever we report a LUN inventory
	change unit attention, clear it on all LUNs for that
	particular I_T nexus.

	Add a new function, ctl_clear_ua() that will clear a unit
	attention on all LUNs for the given I_T nexus.

	One field in the extended inquiry data that we could potentially
	report at some point is the maximum supported sense data length.
	To do that, we would the SIM to report (via path inquiry
	perhaps) how much sense data it is able to send.

	Add comments to explain some of the bits that are set in the
	Extended Inquiry VPD page.

	Add a few comments to make it more clear which functions handle
	various VPD pages.

Sponsored by:	Spectra Logic
MFC after:	1 week
2015-01-30 05:23:39 +00:00
Mark Johnston
2afbb2e1b8 pause() isn't a system call on FreeBSD; use sigsuspend(2) instead.
MFC after:	1 week
2015-01-30 05:14:01 +00:00
Mark Johnston
a70a59ea73 Don't attempt to disable enabled fasttrap probes in an exiting process.
There's no need to do so, and we can't hold an exiting process, so this
race can result in panics.

MFC after:	1 week
2015-01-30 05:03:23 +00:00