Commit Graph

167396 Commits

Author SHA1 Message Date
John Baldwin
19b0c9b246 Use the mli_relinmhead list normally used to defer calls to
in6m_release_locked() to defer calls to mld_v1_transmit_report() until
after the IF_ADDR_LOCK is dropped.  This removes a race where the lock
is dropped and reacquired while attempting to walk an interface's
address list.

Reviewed by:	bz
MFC after:	1 week
2012-01-04 13:35:20 +00:00
John Baldwin
0f188ebb1d Use a helper variable to wrap a long line. 2012-01-04 13:29:26 +00:00
John Baldwin
56d6e1292d In the handling of the SIOC[DG]LIFADDR icotls in in_lifaddr_ioctl(), add
missing interface address list locking and grab a reference on the
matching interface address after dropping the lock while it is used to
avoid a potential use after free.

Reviewed by:	bz
MFC after:	1 week
2012-01-04 13:26:56 +00:00
John Baldwin
0823c29b81 Fix the SIOC[DG]LIFADDR ioctls in in_lifaddr_ioctl() to work with IPv4
interface address rather than IPv6.

Submitted by:	hrs
Reviewed by:	bz
MFC after:	1 week
2012-01-04 13:23:51 +00:00
Fabien Thomas
ba89031aea Update PMC events from October 2011 Intel documentation.
Submitted by:	Davide Italiano <davide.italiano@gmail.com>
MFC after:	3 days
2012-01-04 07:58:36 +00:00
Fabien Thomas
3444c31af6 Add missing MSR programming for some events.
Submitted by:	Davide Italiano <davide.italiano@gmail.com>
MFC after:	3 days
2012-01-04 07:33:06 +00:00
Pawel Jakub Dawidek
d8e3baac46 Add missing file permission to open(O_CREAT) call. This doesn't really matter
here, as we open /dev/null for test purposes, but it is useful for consistency
and further grepping for such bugs.
2012-01-04 07:25:10 +00:00
Pawel Jakub Dawidek
9a492fd171 Add an missing argument to open(2). If O_CREAT flag is specified,
file permission has to be specified as well.
2012-01-04 07:21:37 +00:00
Pawel Jakub Dawidek
24bc5224c6 Add an missing argument to open(2). If O_CREAT flag is specified,
file permission has to be specified as well.
2012-01-04 07:04:43 +00:00
Gleb Smirnoff
1331bbc33f Use correct locking when traversing interface address list.
Reviewed by:	bz
2012-01-04 07:01:23 +00:00
Adrian Chadd
450a186c06 Add a couple more SPI flash device IDs found in commercial
consumer wireless kit.

Submitted by:	Stefan Bethke <stb@lassitu.de>
2012-01-04 04:17:03 +00:00
Yoshihiro Takahashi
a57b8b9e02 MFi386: revision 229435
Add special loader environment variables 'comconsole_port' and
  'comconsole_pcidev'.

MFC after:	2 weeks
2012-01-04 03:54:30 +00:00
Yoshihiro Takahashi
da5f7df3a6 Fix 230MB MO support.
Submitted by:	Kaho Toshikazu
MFC after:	1 week
2012-01-04 03:49:41 +00:00
Xin LI
6fe5169cff Document the fact that chroot(2) is no longer part of POSIX since SUSv3
and add a SECURITY CONSIDERATIONS section for recommended practices.
2012-01-04 02:04:20 +00:00
Ed Schouten
112f210647 Simply disallow <stdnoreturn.h> to be used in combination with C++.
There is no way one could possibly use this header file in combination
with C++ code. The problem is that in C11 the `noreturn' macro expands
to the `_Noreturn' function specifier, while in C++11 the `noreturn'
keyword is an attribute.

So in C11 you have to write:

	noreturn void exit(int status);

While in C++11 you have to write:

	[[noreturn]] void exit(int status);

It is impossible to #define noreturn for C++ in such a way that it
allows both conventions.

By intentionally breaking this header this way, we prevent people from
using this header in their C++<11 sources.
2012-01-03 23:05:23 +00:00
Pawel Jakub Dawidek
ba804f54f9 Fix an obvious typo. We do want to specify file permission when we pass O_CREAT. 2012-01-03 22:52:29 +00:00
Konstantin Belousov
5a1e37174f Add special loader environment variables 'comconsole_port' and
'comconsole_pcidev'. The former allows to set the base address of the
serial console i/o port. The later takes the string of the format
'bus:device:function:[bar]' as a value and uses the serial port attached
as PCI device at the specified location for console.

Both variants pass 'hw.uart.console' variable to the uart driver to
properly hand-over the kernel console.

Change allows to use ISA serial ports other than COM1 for the
loader/kernel console without loader recompilation. Also, you can use
PCI-attached port as the console, e.g. Intel AMT serial pseudo-port on
some motherboards based on Q67 chipset.

Reviewed by:	jhb
MFC after:	2 weeks
2012-01-03 22:36:12 +00:00
Konstantin Belousov
dd0f9532f3 Do the vput() for the lowervp in the null_nodeget() for error case too.
Several callers of null_nodeget() did the cleanup itself, but several
missed it, most prominent being null_bypass(). Remove the cleanup from
the callers, now null_nodeget() handles lowervp free itself.

Reported and tested by:	pho
MFC after:	1 week
2012-01-03 21:09:07 +00:00
Pedro F. Giffuni
c7e0c9db2b Replace a GPL'd header in the emu10k1 snd driver code.
This brings in the emuxkireg.h from NetBSD (dev/pci) which
is used for the same purpose but is smaller. The emu10k1
is now free from the GPL.

PR:		153901
Obtained from:	NetBSD
Approved by:	core (mentor implicit)
MFC after:	2 weeks
2012-01-03 21:04:54 +00:00
John Baldwin
7e3a96ea37 Some small fixes to CPU accounting for threads:
- Only initialize the per-cpu switchticks and switchtime in sched_throw()
  for the very first context switch on APs during boot.  This avoids a
  small gap between the middle of thread_exit() and sched_throw() where
  time is not accounted to any thread.
- In thread_exit(), update the timestamp bookkeeping to track the changes
  to mi_switch() introduced by td_rux so that the code once again matches
  the comment claiming it is mimicing mi_switch().  Specifically, only
  update the per-thread stats directly and depend on ruxagg() to update
  p_rux rather than adjusting p_rux directly.  While here, move the
  timestamp bookkeeping as late in the function as possible.

Reviewed by:	bde, kib
MFC after:	1 week
2012-01-03 21:03:28 +00:00
Konstantin Belousov
48a1e3f624 Document the state of the lowervp vnode for null_nodeget().
Tested by:	pho
MFC after:	1 week
2012-01-03 21:03:20 +00:00
John Baldwin
289908743e Fix a few bugs in the SRAT parsing code:
- Actually increment ndomain when building our list of known domains
  so that we can properly renumber them to be 0-based and dense.
- If the number of domains exceeds the configured maximum (VM_NDOMAIN),
  bail out of processing the SRAT and disable NUMA rather than hitting an
  obscure panic later.
- Don't bother parsing the SRAT at all if VM_NDOMAIN is set to 1 to
  disable NUMA (the default).

Reported by:	phk (2)
MFC after:	1 week
2012-01-03 20:53:58 +00:00
Dimitry Andric
a5988eb997 In sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c, check the
the number of links against LINK_MAX (which is INT16_MAX), not against
UINT32_MAX.  Otherwise, the constant would implicitly be converted to
-1.

Reviewed by:	pjd
MFC after:	1 week
2012-01-03 20:53:07 +00:00
Dimitry Andric
7c864d7df9 In sys/dev/qlxgb/qla_misc.c, fix a copy/paste issue. Clang complained
the variable 'val' was uninitialized when used.  Instead, 'sig' should
have been printed.

Reviewed by:	davidcs
MFC after:	1 week
2012-01-03 20:51:26 +00:00
John Baldwin
c6f4ea8062 When cancelling multicast timers on an interface, don't release the
reference on a group in the leaving state while iterating over the loop.
Instead, use the same approach used in igmp_ifdetach() and mld_ifdetach()
of placing the groups to free on pending release list and then releasing
the references after dropping the IF_ADDR_LOCK.  This closes an ugly race
where the code was dropping the lock in the middle of iterating over the
list.  It also fixes some additional potential use-after-free bugs since
the cancellation routine also applied other changes to the group after
dropping the reference.  Now those changes are performed before the
reference is dropped and the group is potentially freed.

Prodded to fix by:	glebius
Reviewed by:	bz
MFC after:	1 week
2012-01-03 20:34:52 +00:00
Xin LI
3093cb15fb Don't forget to release queue lock when allocation of memory failed.
Submitted by:	Sascha Wildner <saw online de>
Obtained from:	DragonFly
MFC after:	2 weeks
2012-01-03 20:17:35 +00:00
Pedro F. Giffuni
4c995944af Integrate the line drawing algorithm from the book "Graphic Gems 1".
http://www.graphicsgems.org/

At the time it claimed to be 3-4 times faster than the traditional
algorithm.

PR:		18769
Approved by:	jhb (mentor)
MFC after:	2 weeks
2012-01-03 19:47:32 +00:00
John Baldwin
9f745f61b8 Grab a reference on the matching interface address (ifa) in the handling
of the SIOC[DG]LIFADDR icotls before dropping the IF_ADDR_LOCK() and
release the reference after using it.  This prevents the address from
being potentially freed out from under the ioctl handler.

Reviewed by:	bz
MFC after:	1 week
2012-01-03 19:44:36 +00:00
Ed Schouten
30293fda4b Import compiler-rt r147467.
The compiler-rt shipped with FreeBSD is now based on unmodified upstream
sources.
2012-01-03 19:41:36 +00:00
Ed Schouten
864a7b98b5 Import compiler-rt r147467. 2012-01-03 19:38:56 +00:00
Oleksandr Tymoshenko
1f74cf8ccf - Octeon-SDK strictly requires multi_count to be zero for
full and low speed devices.
2012-01-03 19:10:37 +00:00
Pedro F. Giffuni
5eda6329b2 Minor cleanups to ntfs code
bzero -> memset
rename variables to avoid shadowing.

PR:		142401
Obtained from:	NetBSD
Approved by	jhb (mentor)
2012-01-03 19:09:01 +00:00
Ed Schouten
b3608ae18f Replace index() and rindex() calls with strchr() and strrchr().
The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.

This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.
2012-01-03 18:51:58 +00:00
Dimitry Andric
69ee3e2f52 In sys/compat/linux/linux_ioctl.c, work around a warning when a pointer
is compared to an integer, by casting the pointer to l_uintptr_t.  No
functional difference on both i386 and amd64.

Reviewed by:	ed, jhb
MFC after:	1 week
2012-01-03 18:49:39 +00:00
Dimitry Andric
54a55725a3 In sys/dev/if_ndis/if_ndis_pccard.c, fix a bug where a garbage rid was
passed to resource_list_add().  The rid that was just returned by
bus_alloc_resource_any() should have been used instead.

Reviewed by:	jhb
MFC after:	1 week
2012-01-03 18:40:41 +00:00
John Baldwin
debfd27f8e Improve the cscope target's handling of MD directories. Automatically
include the MACHINE_CPUARCH directory if it differents from MACHINE when
building an index for a single machine.  Also, include the 'x86' directory
when building an index for i386, pc98, or amd64.

MFC after:	1 week
2012-01-03 17:31:27 +00:00
Alexander Motin
2cb9ba56ca Add support for CDRIOCGETBLOCKSIZE and CDRIOCSETBLOCKSIZE IOCTLs to control
sector size same as acd driver does. Together with r228808 and r228847 this
allows existing multimedia/vlc to play Audio CDs via CAM cd driver.

PR:		ports/162190
MFC after:	1 week
2012-01-03 17:04:09 +00:00
John Baldwin
f5b50e25ec Use TAILQ_FOREACH() instead of TAILQ_FOREACH_SAFE() for some loops that
do not modify the queues they iterate over.

Submitted by:	glebius
2012-01-03 16:22:29 +00:00
Ed Schouten
75ac3edf1d Remove hand-written version of strcspn().
The code searches for the first occurence of @, : or !. Upon failure, it
returns the index of \0. This is exactly what strcspn() does.
2012-01-03 11:13:07 +00:00
Ed Schouten
b589816c74 Fix subtle typo: compare against idx -- not index.
In this contest, index refers to the index(3) function. In this case it
doesn't really harm, as this function is never called with idx == NULL.

MFC after:	2 weeks
2012-01-03 11:10:15 +00:00
Ed Schouten
c70a327b9f Simply use getprogname() to obtain the name of the process. 2012-01-03 11:08:58 +00:00
Kevin Lo
1a74905fee Add support for Intel EG20T serial ports 2012-01-03 10:01:12 +00:00
Bernhard Schmidt
3e51210689 Don't rely on MCS7 being at index 7 while determining the amount
of antennas to use. Not all APs enable all MCS rates.

Poked by:	Lucius Windschuh <lwindschuh at googlemail dot com>
MFC after:	1 week
2012-01-03 09:42:31 +00:00
Ed Schouten
46632c18bd Merge index() and strchr() together.
As I looked through the C library, I noticed the FreeBSD MIPS port has a
hand-written version of index(). This is nice, if it weren't for the
fact that most applications call strchr() instead.

Also, on the other architectures index() and strchr() are identical,
meaning we have two identical pieces of code in the C library and
statically linked applications.

Solve this by naming the actual file strchr.[cS] and let it use
__strong_reference()/STRONG_ALIAS() to provide the index() routine. Do
the same for rindex()/strrchr().

This seems to make the C libraries and static binaries slightly smaller,
but this reduction in size seems negligible.
2012-01-03 07:14:01 +00:00
Ed Schouten
766992d738 Add support for strong aliasing of symbols in i386 assembly.
This macro is a literal copy from the MIPS version of <machine/asm.h>.
2012-01-03 07:06:35 +00:00
Ed Schouten
22fec34a57 Implement extensions on top of standards instead of the other way around.
Now that index() and rindex() have become unused, simply turn them into
wrappers around strchr() and strrchr(), respectively.
2012-01-03 07:05:30 +00:00
Alan Cox
04f883d798 Don't pass VM_ALLOC_ZERO to vm_page_grab() in tmpfs_mappedwrite() and
tmpfs_nocacheread().  It is both unnecessary and a pessimization.  It
results in either the page being zeroed twice or zeroed first and then
overwritten by an I/O operation.

MFC after:	3 weeks
2012-01-03 03:29:01 +00:00
Glen Barber
2bfabe4196 Trivial standardization to a few comments in kern.pre.mk.
Submitted by:		arundel
MFC after:		3 days
2012-01-03 00:22:08 +00:00
Ed Schouten
1e234009e3 Remove extraneous semicolons.
These macros are supposed to be invoked as regular functions, so remove
them.
2012-01-02 22:58:32 +00:00
Robert Watson
6508f34eb6 Add WITHOUT_CAPSICUM src.conf(5) define, which can be used to compile out
use of Capsicum by userspace applications.

MFC after:	3 weeks
Sponsored by:	Google, Inc.
2012-01-02 21:57:58 +00:00