Commit Graph

67625 Commits

Author SHA1 Message Date
Robert Watson
2a61d63038 Remove spls from NFS server setup call; expand receive socket buffer
locking to cover full setup of socket upcalls; remove XXX about
locking.

MFC after:	3 weeks
2008-06-30 20:43:06 +00:00
Robert Watson
119d85f6e0 In udp_append() and udp_input(), make use of read locking on incpbs
rather than write locking: while we need to maintain a valid reference
to the inpcb and fix its state, no protocol layer state is modified
during an IPv4 UDP receive -- there are only changes at the socket
layer, which is separately protected by socket locking.

While parallel concurrent receive on a single UDP socket is currently
relatively unusual, introducing read locking in the transmit path,
allowing concurrent receive and transmit, will significantly improve
performance for loads such as BIND, memcached, etc.

MFC after:	2 months
Tested by:	gnn, kris, ps
2008-06-30 18:26:43 +00:00
Xin LI
6c97c325ff Avoid NULL deference.
Reviewed by:	ivoras
2008-06-30 15:21:42 +00:00
Xin LI
f8635870a4 Correct SB600 AC97 Audio PCI ID, otherwise we will attach to the
SBx00 PCI to PCI Bridge which causes problems.
2008-06-30 05:14:44 +00:00
Alan Cox
17e2138882 Document the layout of the address space, borrowing heavily from
http://lists.freebsd.org/pipermail/freebsd-amd64/2005-July/005578.html
2008-06-30 03:14:39 +00:00
Alan Cox
67ce249ac9 Compute NKPDPE from NKPT. This reduces the number of knobs that must be
turned in order to change the size of the kernel virtual address space.
2008-06-30 02:35:55 +00:00
Alan Cox
ce3cb38836 Strictly speaking, the definition of VM_MAX_KERNEL_ADDRESS is wrong. However,
in practice, the error (currently) makes no difference because the computation
performed by KVADDR() hides the error.  This revision fixes the error.

Also, eliminate a (now) unused definition.
2008-06-29 19:13:27 +00:00
Alan Cox
f4f491d095 Increase the size of the kernel virtual address space to 6GB. Until the
maximum size of the kmem map can be greater than 4GB, there is little point
in making the kernel virtual address space larger than 6GB.

Tested by:	kris@
2008-06-29 18:35:00 +00:00
Bjoern A. Zeeb
04a58b9d5f Remove an unneeded error variable to make clear that if reaching
the end of the function we never return an error.
2008-06-29 18:26:07 +00:00
Bjoern A. Zeeb
ba931c0855 Add a new priv 'PRIV_SCHED_CPUSET' to check if manipulating cpusets is
allowed and replace the suser() call. Do not allow it in jails.

Reviewed by:	rwatson
2008-06-29 17:58:16 +00:00
Ed Schouten
6db9940f5f Remove the unused softc from the lo(4) driver.
Now that the pseudo-interface cloner has an internal list of instances,
there is no need to create a softc. The softc only contains a pointer to
the ifp, which means there is no valid reason to keep it. While there,
remove the corresponding malloc-pool.

Approved by:	philip (mentor)
2008-06-29 13:17:01 +00:00
Bjoern A. Zeeb
2d8bba43bd Try to fix errors introduced in svn180085/cvs rev. 1.10:
* Include ip6_var.h for ip6stat.
* Use the correct name under ip6stat: `ip6s_cantforward' instead
  of its IPv4 counterpart.

MFC after:	10 days
2008-06-29 07:34:21 +00:00
Alexander Kabaev
2ce7b410dc Repair botched variable rename.
Pointy hat to:	julian
2008-06-29 04:33:45 +00:00
Julian Elischer
316151d290 It may be #if 0'd out code, but change a varname to not shadow a global. 2008-06-29 01:04:48 +00:00
Julian Elischer
c2ff90ef96 Enter the 1990s. Use real function declaration. 2008-06-29 00:49:50 +00:00
Julian Elischer
b3fb530c76 Oops, we've been incrementing the wrong cantforward variable.
Obtained from:	vimage tree
2008-06-29 00:25:16 +00:00
Julian Elischer
5f9a5768d2 Rename two vars so that they are different from the same vars in ipv4.
They are static so it was not a problem 'per se' but it was confusing to
the reader.

Obtained from:	vimage tree
2008-06-29 00:17:45 +00:00
Philip Paeps
01895a25f3 Remove stray "miibus0" reference from ancient kernel config file times.
MFC after:	1 day
2008-06-28 13:38:53 +00:00
Remko Lodder
aa219554e0 Style fix (space into tab).
Approved by:	imp (mentor, implicit)
2008-06-28 08:36:47 +00:00
Marius Strobl
e344c57bcb Improve r180011 by explicitly adding the condition codes to the
clobber list.

Suggested by:	Christoph Mallon
2008-06-27 22:17:14 +00:00
Ed Maste
1f56858361 Add explicit PCI IDs for the following Adaptec RAID Series 2 adapters:
Adaptec RAID 2045
  Adaptec RAID 2405
  Adaptec RAID 2445
  Adaptec RAID 2805

Without this change these devices are supported by the driver's family
support, but they then appear as "Adaptec RAID Controller" in boot
messages and the dev.aac.0.%desc sysctl.
2008-06-27 19:34:47 +00:00
Tai-hwa Liang
5461c0b226 Fixing NO_INET6 build. 2008-06-27 15:29:48 +00:00
Doug Rabson
9458af1853 Include <sys/pcpu.h> for curthread. 2008-06-27 14:35:05 +00:00
Rui Paulo
aea6188719 Add the missing support for Asus Eee PC in acpi_asus(4).
This includes hotkeys support and sysctl variables to control camera
and card reader. These new sysctls don't have CTFLAG_ANYBODY set.

While there add entries to devd.conf related to the Eee volume keys.

Reviewed by:	phillip
MFC after:	1 week
Also tested by:	lme (previous version)
2008-06-27 12:04:36 +00:00
Luigi Rizzo
b562fe75e6 Add USB ids for the Epson DX7400 / CX7300 multifunction scanner printer
card reader. Tested operation of the scanner part with Sane,
card and printer correctly recognised as /dev/da0 and /dev/ulpt0

MFC after:	3 days
2008-06-27 10:30:08 +00:00
John Baldwin
6bc1e9cd84 Rework the lifetime management of the kernel implementation of POSIX
semaphores.  Specifically, semaphores are now represented as new file
descriptor type that is set to close on exec.  This removes the need for
all of the manual process reference counting (and fork, exec, and exit
event handlers) as the normal file descriptor operations handle all of
that for us nicely.  It is also suggested as one possible implementation
in the spec and at least one other OS (OS X) uses this approach.

Some bugs that were fixed as a result include:
- References to a named semaphore whose name is removed still work after
  the sem_unlink() operation.  Prior to this patch, if a semaphore's name
  was removed, valid handles from sem_open() would get EINVAL errors from
  sem_getvalue(), sem_post(), etc.  This fixes that.
- Unnamed semaphores created with sem_init() were not cleaned up when a
  process exited or exec'd.  They were only cleaned up if the process
  did an explicit sem_destroy().  This could result in a leak of semaphore
  objects that could never be cleaned up.
- On the other hand, if another process guessed the id (kernel pointer to
  'struct ksem' of an unnamed semaphore (created via sem_init)) and had
  write access to the semaphore based on UID/GID checks, then that other
  process could manipulate the semaphore via sem_destroy(), sem_post(),
  sem_wait(), etc.
- As part of the permission check (UID/GID), the umask of the proces
  creating the semaphore was not honored.  Thus if your umask denied group
  read/write access but the explicit mode in the sem_init() call allowed
  it, the semaphore would be readable/writable by other users in the
  same group, for example.  This includes access via the previous bug.
- If the module refused to unload because there were active semaphores,
  then it might have deregistered one or more of the semaphore system
  calls before it noticed that there was a problem.  I'm not sure if
  this actually happened as the order that modules are discovered by the
  kernel linker depends on how the actual .ko file is linked.  One can
  make the order deterministic by using a single module with a mod_event
  handler that explicitly registers syscalls (and deregisters during
  unload after any checks).  This also fixes a race where even if the
  sem_module unloaded first it would have destroyed locks that the
  syscalls might be trying to access if they are still executing when
  they are unloaded.

  XXX: By the way, deregistering system calls doesn't do any blocking
  to drain any threads from the calls.
- Some minor fixes to errno values on error.  For example, sem_init()
  isn't documented to return ENFILE or EMFILE if we run out of semaphores
  the way that sem_open() can.  Instead, it should return ENOSPC in that
  case.

Other changes:
- Kernel semaphores now use a hash table to manage the namespace of
  named semaphores nearly in a similar fashion to the POSIX shared memory
  object file descriptors.  Kernel semaphores can now also have names
  longer than 14 chars (up to MAXPATHLEN) and can include subdirectories
  in their pathname.
- The UID/GID permission checks for access to a named semaphore are now
  done via vaccess() rather than a home-rolled set of checks.
- Now that kernel semaphores have an associated file object, the various
  MAC checks for POSIX semaphores accept both a file credential and an
  active credential.  There is also a new posixsem_check_stat() since it
  is possible to fstat() a semaphore file descriptor.
- A small set of regression tests (using the ksem API directly) is present
  in src/tools/regression/posixsem.

Reported by:	kris (1)
Tested by:	kris
Reviewed by:	rwatson (lightly)
MFC after:	1 month
2008-06-27 05:39:04 +00:00
Robert Watson
02f4879d3a Introduce locking around use of ifindex_table, whose use was previously
unsynchronized.  While races were extremely rare, we've now had a
couple of reports of panics in environments involving large numbers of
IPSEC tunnels being added very quickly on an active system.

- Add accessor functions ifnet_byindex(), ifaddr_byindex(),
  ifdev_byindex() to replace existing accessor macros.  These functions
  now acquire the ifnet lock before derefencing the table.
- Add IFNET_WLOCK_ASSERT().
- Add static accessor functions ifnet_setbyindex(), ifdev_setbyindex(),
  which set values in the table either asserting of acquiring the ifnet
  lock.
- Use accessor functions throughout if.c to modify and read
  ifindex_table.
- Rework ifnet attach/detach to lock around ifindex_table modification.

Note that these changes simply close races around use of ifindex_table,
and make no attempt to solve the probem of disappearing ifnets.  Further
refinement of this work, including with respect to ifindex_table
resizing, is still required.

In a future change, the ifnet lock should be converted from a mutex to an
rwlock in order to reduce contention.

Reviewed and tested by:	brooks
2008-06-26 23:05:28 +00:00
Julian Elischer
a54eadd8c4 change a variable name ot stop it from colliding with other names in
some situations. (i.e. in vimage)

MFC after:	1 week
2008-06-26 22:59:49 +00:00
Julian Elischer
9dcc73ed79 Someone cut and pasted a bunch of stuff here so lots of
indents were spaces when they should have been tabs,
screwing up diffs and patches..

Whitespace commit as my first SVN commit. (yay)

MFC after:	1 week
2008-06-26 22:45:04 +00:00
John Baldwin
2137b017d7 Tweak the output of event log messages from the controller:
- Each log entry contains a text description in the "description" field of
  the entry.  The existing decode logic always ended up duplicating
  information that was already in the description string.  This made the
  logs overly verbose.  Now we just print out the description string.
- Add some simple parsing of the timestamp and event classes.

Reviewed by:	ambrisko, scottl
MFC after:	2 weeks
2008-06-26 22:36:38 +00:00
John Baldwin
c1ed06a84b Adjust the handling of pending log events during boot:
- Fetch events from the controller in batches of 15 rather than a single
  event at a time.
- When fetching events from the controller, honor the event class and
  locale settings (via hw.mfi tunables).  This also allows the firmware to
  skip over unwanted log entries resulting in fewer requests to the
  controller if there many unwanted log entries since the last clean
  shutdown.
- Don't drop the driver mutex while decoding an event.
- If we get an error other than MFI_STAT_NOT_FOUND (basically EOF for
  hitting the end of the event log) then emit a warning and bail on
  processing further log entries.

Reviewed by:	ambrisko, scottl
MFC after:	2 weeks
2008-06-26 22:33:24 +00:00
Andrew Thompson
39978059cc Remove the non-existent rt2860 subdir. Note, the ralfw module is not used in
the build yet.

PR:		kern/125015
Submitted by:	Dan Cojocar
2008-06-26 18:58:01 +00:00
John Baldwin
f4c1db8901 Change SEM_VALUE_MAX (maximum value of a POSIX semaphore) from UINT_MAX
to INT_MAX.  Otherwise, a process could create a semaphore (or increase
its value via ksem_post()) beyond INT_MAX and sem_getvalue() would return
a negative value.  sem_getvalue() is only supposed to return a negative
value if that is the number of waiters for that semaphore.

MFC after:	2 weeks
2008-06-26 13:51:25 +00:00
John Baldwin
127cc7673d Add missing counter increments for posix shm checks. 2008-06-26 13:49:32 +00:00
Doug Rabson
c675522fc4 Re-implement the client side of rpc.lockd in the kernel. This implementation
provides the correct semantics for flock(2) style locks which are used by the
lockf(1) command line tool and the pidfile(3) library. It also implements
recovery from server restarts and ensures that dirty cache blocks are written
to the server before obtaining locks (allowing multiple clients to use file
locking to safely share data).

Sponsored by:	Isilon Systems
PR:		94256
MFC after:	2 weeks
2008-06-26 10:21:54 +00:00
Ruslan Ermilov
cae17430bf Fix a fallout from SSP commit, and make this compile again.
Bonus: including kern.mk just to pick kernel warning flags
was an extremely bad idea anyway, because it also picked
up CFLAGS (it probably wasn't the case at the time of CVS
rev. 1.1, I haven't checked).  Remove duplicate CWARNFLAGS
from CFLAGS.
2008-06-26 07:56:16 +00:00
Ruslan Ermilov
d03c587ffa Fix a chicken-and-egg problem: this files implements SSP support,
so we cannot compile it with -fstack-protector[-all] flags (or
it will self-recurse); this is ensured in sys/conf/files.  This
OTOH means that checking for defines __SSP__ and __SSP_ALL__ to
determine if we should be compiling the support is impossible
(which it was trying, resulting in an empty object file).  Fix
this by always compiling the symbols in this files.  It's good
because it allows us to always have SSP support, and then compile
with SSP selectively.

Repoted by:	tinderbox
2008-06-26 07:52:45 +00:00
Ruslan Ermilov
042df2e2da Enable GCC stack protection (aka Propolice) for userland:
- It is opt-out for now so as to give it maximum testing, but it may be
  turned opt-in for stable branches depending on the consensus.  You
  can turn it off with WITHOUT_SSP.
- WITHOUT_SSP was previously used to disable the build of GNU libssp.
  It is harmless to steal the knob as SSP symbols have been provided
  by libc for a long time, GNU libssp should not have been much used.
- SSP is disabled in a few corners such as system bootstrap programs
  (sys/boot), process bootstrap code (rtld, csu) and SSP symbols themselves.
- It should be safe to use -fstack-protector-all to build world, however
  libc will be automatically downgraded to -fstack-protector because it
  breaks rtld otherwise.
- This option is unavailable on ia64.

Enable GCC stack protection (aka Propolice) for kernel:
- It is opt-out for now so as to give it maximum testing.
- Do not compile your kernel with -fstack-protector-all, it won't work.

Submitted by:	Jeremie Le Hen <jeremie@le-hen.org>
2008-06-25 21:33:28 +00:00
Marius Strobl
0d9e99b6ca Use "__asm __volatile" rather than "__asm" for instruction sequences
that modify condition codes (the carry bit, in this case). Without
"__volatile", the compiler might add the inline assembler instructions
between unrelated code which also uses condition codes, modifying the
latter.
This prevents the TCP pseudo header checksum calculation done in
tcp_output() from having effects on other conditions when compiled
with GCC 4.2.1 at "-O2" and "options INET6" left out. [1]

Reported & tested by:	Boris Kochergin [1]
MFC after:		3 days
2008-06-25 21:04:59 +00:00
Marius Strobl
1239136645 Given that sun4u uses sparc64/sparc64/in_cksum.c, use the sparc64
<machine/in_cksum.h> here also.

MFC after:	3 days
2008-06-25 21:03:26 +00:00
Ed Schouten
9d7a57e916 Remove the unused M_MEMDEV from the kernel.
The M_MEMDEV memory allocation pool does not seem to be used. We can
live without it.

Approved by:	philip (mentor)
2008-06-25 07:52:10 +00:00
Ed Schouten
721351876c Remove the unused major/minor numbers from iodev and memdev.
Now that st_rdev is being automatically generated by the kernel, there
is no need to define static major/minor numbers for the iodev and
memdev. We still need the minor numbers for the memdev, however, to
distinguish between /dev/mem and /dev/kmem.

Approved by:	philip (mentor)
2008-06-25 07:45:31 +00:00
Jung-uk Kim
1427b09672 Emit opcodes closer to GNU as(1) generated codes and micro-optimize. 2008-06-24 20:12:44 +00:00
Jung-uk Kim
b86977a5ab Emit opcodes closer to GNU as(1) generated codes and micro-optimize. 2008-06-24 20:12:12 +00:00
George V. Neville-Neil
a13c239b91 Make it simpler to build netgraph modules outside of the kernel source
tree.  This change follows similar ones in the device tree.

MFC after:	2 weeks
2008-06-24 18:49:49 +00:00
Oleksandr Tymoshenko
cf77b84879 In case of interface initialization failure remove struct in_ifaddr* from
in_ifaddrhashtbl in in_ifinit because error handler in in_control removes
entries only for AF_INET addresses. If in_ifinit is called for the cloned
inteface that has just been created its address family is not AF_INET and
therefor LIST_REMOVE is not called for respective LIST_INSERT_HEAD and
freed entries remain in in_ifaddrhashtbl and lead to memory corruption.

PR:	kern/124384
2008-06-24 13:58:28 +00:00
David Xu
7de1ecef2d Add two commands to _umtx_op system call to allow a simple mutex to be
locked and unlocked completely in userland. by locking and unlocking mutex
in userland, it reduces the total time a mutex is locked by a thread,
in some application code, a mutex only protects a small piece of code, the
code's execution time is less than a simple system call, if a lock contention
happens, however in current implemenation, the lock holder has to extend its
locking time and enter kernel to unlock it, the change avoids this disadvantage,
it first sets mutex to free state and then enters kernel and wake one waiter
up. This improves performance dramatically in some sysbench mutex tests.

Tested by: kris
Sounds great: jeff
2008-06-24 07:32:12 +00:00
Ed Maste
ef0b687ced Fix test for waiting AIFs in aac_poll(). This seems to solve the
problem where Adaptec's arcconf monitoring tool hangs after producing
its expected output.

Submitted by:	Adaptec, via driver ver 15317
MFC after:	1 week
2008-06-24 03:26:41 +00:00
Jung-uk Kim
6a9748abc8 Rehash and clean up BPF JIT compiler macros to match AT&T notations. 2008-06-23 23:10:11 +00:00
Jung-uk Kim
292f013c88 Rehash and clean up BPF JIT compiler macros to match AT&T notations. 2008-06-23 23:09:52 +00:00