Commit graph

60722 commits

Author SHA1 Message Date
Robert Watson 5add74b4a7 Add "FreeBSD" trademark statement to copyright section of boot messages.
MFC after:	3 days
Approved by:	core, board at FreeBSDFoundation dot org
2006-09-25 23:19:01 +00:00
Robert Watson d038d0bd66 Merge OpenBSM 1.0 alpha 12 import changes into src/sys/bsm. New events
for the Linuxulator.

MFC after:	3 days
Obtained from:	TrustedBSD Project
2006-09-25 12:22:07 +00:00
Bruce M Simpson 13c8384424 Fix an incompatibility between CARP and IPv4 multicast routing, whereby
the VRRPv2 advertisements will originate from the wrong source address.
This only affects kernels compiled with MROUTING and after the MRT_INIT
ioctl() has been issued.
Set imo_multicast_vif in carp's softc to the invalid value -1 after it is
zeroed by softc allocation, to stop the ip_output() path looking up the
incorrect source address thinking a vif is set.

PR:		kern/100532
Submitted by:	Bohus Plucinsky
MFC after:	1 week
2006-09-25 11:53:54 +00:00
Bruce M Simpson e2fd806b36 Spleling
Submitted by:	pjd
2006-09-25 11:48:07 +00:00
Scott Long 40218a48e0 Update the mfi module build with the mfi_debug.c file. 2006-09-25 11:42:12 +00:00
Scott Long 6b31d3f79d Add the mfi_debug.c file and MFI_DEBUG option. 2006-09-25 11:40:14 +00:00
Scott Long 5ba21ff136 Add a command debugging module and a periodic watchdog timer.
Sponsored by: IronPort
2006-09-25 11:35:34 +00:00
Søren Schmidt 6182698f19 add support for the ALI/ULI M5288 AHCI part.
patch by: Sven Petai
2006-09-25 11:26:29 +00:00
Bruce M Simpson 07ea6709ea Account for output IP datagrams on the ifaddr where they originated from,
*not* the first ifaddr on the ifp.  This is similar to what NetBSD does.

PR:		kern/72936
Submitted by:	alfred
Reviewed by:	andre
2006-09-25 10:11:16 +00:00
John-Mark Gurney 4dc630cdd2 if min is greater than max, prefer max over min... I managed to get a
retransmit timer that was going to take 19 days to trigger...

Reviewed by:	silby
2006-09-25 07:22:39 +00:00
John-Mark Gurney 33fabe46da remove unnecessary NULL check...
Coverity ID:	1545
2006-09-25 01:29:48 +00:00
Warner Losh 2dca50b6a1 Add a newline to the printf. 2006-09-24 19:24:26 +00:00
Alexander Leidinger 18c15b598d Fix uninitialized variable warning.
Submitted by:	dhw
Reviewed by:	ryanb
2006-09-24 17:37:03 +00:00
Robert Watson 22b7bca620 Rework the way errors are handled with respect to how audit records are
written to the audit trail file:

- audit_record_write() now returns void, and all file system specific
  error handling occurs inside this function.  This pushes error handling
  complexity out of the record demux routine that hands off to both the
  trail and audit pipes, and makes trail behavior more consistent with
  pipes as a record destination.

- Rate limit kernel printfs associated with running low on space.  Rate
  limit audit triggers for low space.  Rate limit printfs for fail stop
  events.  Rate limit audit worker write error printfs.

- Document in detail the types of limits and space checks we perform, and
  combine common cases.

This improves the audit subsystems tolerance to low space conditions by
avoiding toasting the console with printfs are waking up the audit daemon
continuously.

MFC after:	3 days
Obtained from:	TrustedBSD Project
2006-09-24 13:35:58 +00:00
Hiroki Sato 8ee0930a99 Disable an overly-verbose warning message by default.
Suggested by:	njl
MFC after:	3 days
2006-09-24 09:39:17 +00:00
John-Mark Gurney 4db71d27a1 hide kqueue_register from public view, and replace it w/ kqfd_register...
this eliminates a possible race in aio registering a kevent..
2006-09-24 04:47:47 +00:00
John-Mark Gurney aeab19b21f return EBADF instead of successfully attaching (and then panicing) when
an fd is dieing..

Convinced by:	jhb
PR:		103127
2006-09-24 02:29:53 +00:00
John-Mark Gurney 9edac6f3f9 add KTRACE hooks into kevent... This will help people debug their kqueue
programs to find out exactly which events were registered and which were
returned...  This should be lower in kern_kevent, but that would require
special munging due to locks and the functions used to copyin/copyout
kevents...

If someone wants to teach ktrace how to output pretty kevents, I have a
kevent prety printer that can be used...
2006-09-24 02:23:29 +00:00
Warner Losh 4e53810378 Cleanup sloppy ifdef. 2006-09-24 00:26:33 +00:00
Alexander Leidinger b611c801f0 MFp4 the sound Google Summer of Code project:
The goal was to sync with the OSSv4 API 4Front Technologies uses in their
proprietary OSS driver. This was successful as far as possible. The part
of the API which is stable is implemented, for the rest there are some
stubs already.

New system ioctls:
 - SNDCTL_SYSINFO - obtain audio system info (version, # of audio/midi/
   mixer devices, etc.)
 - SNDCTL_AUDIOINFO - fetch details about a specific audio device
 - SNDCTL_MIXERINFO - fetch details about a specific mixer device

New audio ioctls:
 - Sync groups (SNDCTL_DSP_SYNCGROUP/SNDCTL_DSP_SYNCSTART) which allow
   triggered playback/recording on multiple devices (even across processes
   simultaneously).
 - Peak meters (SNDCTL_DSP_GETIPEAKS/SNDCTL_DSP_GETOPEAKS) - can query
   audio drivers for peak levels (needs driver support, disabled for now).
 - Per channel playback/recording levels -
   SNDCTL_DSP_{GET,SET}{PLAY,REC}VOL.  Note that these are still in name
   only, just wrapping around the AC97-style mixer at the moment. The next
   step is to push them down to the drivers.

Audio ioctls still under development by 4Front (for which stubs may exist
in this commit):
 - SNDCTL_GETNAME, SNDCTL_{GET,SET}{SONG,LABEL}
 - SNDCTL_DSP_{GET,SET}_CHNORDER
 - SNDCTL_MIX_ENUMINFO, SNDCTL_MIX_EXTINFO - (might be documented enough in
   the OSS releases to work on this.  These ioctls cover the cool "twiddle
   any knob on your card" features.)

Missing:
 - SNDCTL_DSP_COOKEDMODE -- this ioctl is used to give applications direct
   access to a card's buffers, bypassing the feeder architecture.  It's
   a toughy -- "someone" needs to decide :
   (a) if this is desireable, and (b) if it's reasonably feasible.

Updates for driver writers:
 So far, only two routines to the channel class (in channel_if.m) are added.
 One is for fetching a list of discrete supported playback/recording rates
 of a channel, and the other is for fetching peak level info (useful for
 drawing peak meters).  Interested parties may want to help pushing down
 SNDCTL_DSP_{GET,SET}{PLAY,REC}VOL into the drivers.

To use the new stuff you need to rebuild the sound drivers or your kernel
(depending on if you use modules or not) and to install soundcard.h (a
buildworld/installworld handles this).

Sponsored by:	Google SoC 2006
Submitted by:	ryanb
Many thanks to:	4Front Technologies for their cooperation, explanations
		and the nice license of their soundcard.h.
2006-09-23 20:45:47 +00:00
John-Mark Gurney 402865f637 now that we don't automagicly increase the MTU of host routes, when we copy
the loopback interface, copy it's mtu also..  This means that we again have
large mtu support for local ip addresses...
2006-09-23 19:24:10 +00:00
Alexander Leidinger d4b7423fa1 MFp4:
- Linux returns ENOPROTOOPT in a case of not supported opt to setsockopt.
- Return EISDIR in pread() when arg is a directory.
- Return EINVAL instead of EFAULT when namelen is not correct in accept().
- Return EINVAL instead of EACCESS if invalid access mode is entered in
  access().
- Return EINVAL instead of EADDRNOTAVAIL in a case of bad salen param
  to bind().

Submitted by:	rdivacky
Tested with:	LTP (vfork01 fails now, but it seems to be a race and
		not caused by those changes)
MFC after:	1 week
2006-09-23 19:06:54 +00:00
Scott Long f1a7e6d559 Allow the ASF feature to be disabled via a tunable. On one of my systems,
bringing up the bge interface results in a complete system freeze when
this feature is enabled.  Leave it enabled by default.
2006-09-23 18:55:49 +00:00
Martin Blapp 45e6819160 Protect enterpgrp() against another tty/proc race case until the tty locking work
has been fixed.

MFC after:	1 week
2006-09-23 17:35:24 +00:00
Bruce M Simpson f1edc3bde5 Always set the IP version in the TCP input path, to preserve
the header field for possible later IPSEC SPD lookup, even
when the kernel is built without 'options INET6'.

PR:		kern/57760
MFC after:	1 week
Submitted by:	Joachim Schueth
2006-09-23 16:26:31 +00:00
Martin Blapp 7c56049e6d Check for tp->t_refcnt == 0 before doing anything in tty_open().
PR:		103520
MFC after:	1 week
2006-09-23 14:52:46 +00:00
Martin Blapp 153c21c8c1 If /dev/tty gets opened after your controlling terminal has been revoked
you can't call tty_clone afterwords. OpenBSD and NetBSD both fail the
open call in that case, so we should do so as well. This can
be done in ctty_clone by returning with *dev==NULL. Admittedly this
causes open to return ENOENT, instead of ENXIO as on the other BSDs,
but this way requires the least touching of code.

Submitted by:  Nate Eldredge <nge@cs.hmc.edu>
PR:            83375

MFC:           1 week
2006-09-23 14:44:14 +00:00
David Xu 07a8ebcc75 Stop reloading %fs and %gs, since it causes the base address from
GDT to be loaded into FS.base and GS.base, these values of course
are not the values set by sysarch() with I386_SET_FSBASE and
I386_SET_GSBASE, the change fixed a crash for 32bit libthr after
signal handler returned and normal code is accessing thread pointer,
for example: movl %gs:8, %eax.
2006-09-23 13:42:09 +00:00
David Xu 4af4fcb71a Regenerate. 2006-09-23 00:27:53 +00:00
David Xu 5c26f4cea8 Enable sigwait. 2006-09-23 00:27:11 +00:00
John Baldwin 157f14ae25 Map pmap_{un,}mapbios() to pmap_{un,}mapdev() on 6.x and earlier. 2006-09-22 22:16:20 +00:00
John Baldwin d72a078647 Update the ipmi(4) driver:
- Split out the communication protocols into their own files and use
  a couple of function pointers in the softc that the commuication
  protocols setup in their own attach routine.
- Add support for the SSIF interface (talking to IPMI over SMBus).
- Add an ACPI attachment.
- Add a PCI attachment that attaches to devices with the IPMI interface
  subclass.
- Split the ISA attachment out into its own file: ipmi_isa.c.
- Change the code to probe the SMBIOS table for an IPMI entry to just use
  pmap_mapbios() to map the table in rather than trying to setup a fake
  resource on an isa device and then activating the resource to map in the
  table.
- Make bus attachments leaner by adding attach functions for each
  communication interface (ipmi_kcs_attach(), ipmi_smic_attach(), etc.)
  that setup per-interface data.
- Formalize the model used by the driver to handle requests by adding an
  explicit struct ipmi_request object that holds the state of a given
  request and reply for the entire lifetime of the request.  By bundling
  the request into an object, it is easier to add retry logic to the various
  communication backends (as well as eventually support BT mode which uses
  a slightly different message format than KCS, SMIC, and SSIF).
- Add a per-softc lock and remove D_NEEDGIANT as the driver is now MPSAFE.
- Add 32-bit compatibility ioctl shims so you can use a 32-bit ipmitool
  on FreeBSD/amd64.
- Add ipmi(4) to i386 and amd64 NOTES.

Submitted by:	ambrisko (large portions of 2 and 3)
Sponsored by:	IronPort Systems, Yahoo!
MFC after:	6 days
2006-09-22 22:11:29 +00:00
Andrew Thompson 0a6f8a5050 Revert r1.80 as the ethernet header was inadvertently stripped from ARP
packets. Reimplement this correctly and use a sysctl that defaults to off so
the user doesnt get any suprises if ipfw blocks the ARP packet.

MFC after:	3 days
2006-09-22 21:57:52 +00:00
Ruslan Ermilov 43e5f4b8cd Update a comment about M_VLANTAG. 2006-09-22 19:50:04 +00:00
Bruce M Simpson 4a75dc2585 Fix a case where socket I/O atomicity is violated due to not dropping
the entire record when a non-data mbuf is removed in the soreceive() path.
This only triggers a panic directly when compiled with INVARIANTS.

PR:		38495
Submitted by:	James Juran
MFC after:	1 week
2006-09-22 15:34:16 +00:00
David Xu ac3674aa52 Regenerate. 2006-09-22 15:05:34 +00:00
David Xu cda9a0d1c2 Add compatible code to let 32bit libthr work on 64bit kernel. 2006-09-22 15:04:28 +00:00
David Xu e58b17ea53 Fix umtx command order error for freebsd 32bit. 2006-09-22 14:59:10 +00:00
Olivier Houchard b098674792 Use usbd_clear_endpoint_stall_async() when clearing endpoint stalls in
an interrupt context.

Obtained from:	NetBSD
MFC after:	1 week
2006-09-22 12:45:42 +00:00
Alan Cox 6b5e9c85b0 The fix in revision 1.152 converted in the wrong direction.
Fix a typo in a comment.

Submitted by: Michael Plass
2006-09-22 07:16:36 +00:00
Alan Cox b8a4b36974 The sparc64/sparc64/pmap.c implementations of pmap_remove(),
pmap_protect(), and pmap_copy() have optimizations for regions
larger than PMAP_TSB_THRESH (which works out to 16MB).  This
caused a panic in tsb_foreach for kernel mappings, since
pm->pm_tsb is NULL in that case.  This fix teaches tsb_foreach
to use the kernel's tsb in that case.

Submitted by: Michael Plass
MFC after: 3 days
2006-09-22 07:02:15 +00:00
SUZUKI Shinsuke 831c32014e fixed a bug that IPv6 packets arriving to stf are not accepted.
(a degrade introduced in in6.c Rev 1.61)

PR: kern/103415
Submitted by: JINMEI Tatuya
MFC after: 1 week
2006-09-22 01:42:22 +00:00
SUZUKI Shinsuke 8343821b87 fixed a bug that local IPv6 traffic (to an address configured on an
interface other than lo0) does not show up properly on any bpf.

Reported by: mlaier
Reviewed by: gnn, csjp
MFC after: 1 week
2006-09-22 01:31:22 +00:00
David Xu 27bbb2e71f Regenerate. 2006-09-22 00:53:43 +00:00
David Xu 1eec02f538 Add umtx support for 32bit process on AMD64 machine. 2006-09-22 00:52:54 +00:00
Matt Jacob 4542a3798e Connect up a QUEUE FULL event with CAM and adjust openings.
Unfortunately, the QUEUE FULL event only tells you Bus && Target.
It doesn't tell you lun. In order for the XPT_REL_SIMQ action to
work, we have to have a real lun. But which one? For now, just
iterate over MPT_MAX_LUNS.

Practically speaking, this is only going to be happening for lower
quality SAS or SATA drives behind the SAS controller, which means
only lun 0, so it's not so bad.

Helpful Reminder Nagging from: John Baldwin, Fred Whiteside

MFC after:	5 days
2006-09-21 20:35:12 +00:00
Andre Oppermann ba04adb0f9 Move the initialization of the hardware capabilities in em_init_locked()
before em_setup_transmit_structures() as it needs this information to
properly set up TSO parameters.

Reviewed by:	jfv
2006-09-21 19:14:51 +00:00
John Baldwin e7a975adbe Fix a sign bug in acpi_release_resource(). acpi_sysres_find() returns !=
NULL if the specified resource is a sub-alloc of a system resource.
2006-09-21 18:56:03 +00:00
Robert Watson 827f0e85a6 Regenerate. 2006-09-21 16:20:38 +00:00
Robert Watson e6f188152c Use AUE_CREAT instead of AUE_O_CREAT for linux_creat().
Obtained from:	TrustedBSD Project
2006-09-21 16:18:33 +00:00
Robert Watson 753a5e888c Regenerate. 2006-09-21 16:13:16 +00:00
Robert Watson b5ca51459a Use AUE_GETDIRENTRIES instead of AUE_O_GETDENTS and AUE_NULL for a number
of directory reading system calls.

Respell a mis-spelled event name.

Clean up white space/line wraps in a couple of places.

Assign event numbers to some new system call entries that have turned
up in the list since audit support was added.

Obtained from:	TrustedBSD Project
2006-09-21 16:12:58 +00:00
Martin Blapp 1c1d411bee Back out rev. 1.258. The real race cause has been fixed
in rev. 1.241 of kern_proc.c.

Requested by:	jhb
2006-09-21 14:09:26 +00:00
Randall Stewart adf5d1c6d0 atomic_fetchadd_int is used by mb_free_ext(), but it
returns the previous value that the "add" effected (In
this case we are adding -1), afterwhich we compare it
to '0'... to see if we free the mbuf... we should
be comparing it to '1'... Note that this only effects
when there is contention since there is a first part
to the comparison that checks to see if its '1'. So
this bug would only crop up if two CPU's are trying
to free the same mbuf refcount at the same time. This
will happen in SCTP but I doubt can happen in TCP or
UDP.
PR:		N/A
Submitted by:	rrs
Reviewed by:	gnn,sam
Approved by:	gnn,sam
2006-09-21 09:55:43 +00:00
Robert Watson 2ecf07cb25 Merge OpenBSM 1.0 alpha 11 changes into src/sys/bsm and src/sys/security;
primarily, add new event identifiers and update trigger names.

Obtained from:	TrustedBSD Project
2006-09-21 07:27:02 +00:00
David Xu ecc313475b Regenerate. 2006-09-21 04:50:38 +00:00
David Xu 47bd78d24d sync with master. 2006-09-21 04:49:36 +00:00
David Xu cca0a557dd Regenerate. 2006-09-21 04:19:48 +00:00
David Xu 73fa3e5b88 Replace system call thr_getscheduler, thr_setscheduler, thr_setschedparam
with rtprio_thread, while rtprio system call is for process only, the new
system call rtprio_thread is responsible for LWP.
2006-09-21 04:18:46 +00:00
Alexander Kabaev fa034a084b Use __builtin_offsetof for GCC 4.1. 2006-09-21 01:38:58 +00:00
Alexander Kabaev d9cb97ff9d Use __builtin_va_start instead of __builtin_stdarg_start. GCC4 obsoletes
the former and  __builtin_va_start was present in all GCC version 3.1 and
later.
2006-09-21 01:37:02 +00:00
Wojciech A. Koszek dec10b39fd Correct 'interrupt interrupt' -> 'interrupt' in the comment.
Requested by:	jhb
Approved by:	cognet (mentor)
2006-09-20 20:52:11 +00:00
Alexander Leidinger 6dc4e81071 style(9)
While I'm here add a MFC reminder, I forgot it in the previous commit.

Noticed by:	ssouhlal
MFC after:	1 week
2006-09-20 19:27:11 +00:00
Doug Ambrisko 796ddce11d Add a new 'bce_mgmt_init_locked' function to enable the minimal parts
of the chip to let ASF/IPMI firmware to respond to IPMI after attaching
and when the chip is down.  David looked at it but could really say
what they right minimal config. stuff would be.  It's not documented.
I figured this out via trial and error.

Reviewed by:	davidch
2006-09-20 18:55:16 +00:00
Doug Ambrisko a1adc445ed Allow hw.mfi.event_locale/hw.mfi.event_class to be set via loader.
If an event doesn't match the criteria then don't print it.  Some
events are not saved in the log (<0 class events).
2006-09-20 18:49:35 +00:00
Alexander Leidinger a312f6a30a Bring the i386 linux mmap code more into line with how linux (2.4.x)
behaves. This fixes a lot of test which failed before. For amd64 there
are still some problems, but without any testers which apply patches
and run some predefines tests we can't do more ATM.

Submitted by:	Marcin Cieslak <saper@SYSTEM.PL> (minor fixups by myself)
Tested with:	LTP
2006-09-20 17:24:20 +00:00
Robert Watson f50c4fd817 Remove MAC_DEBUG + MPRINTF debugging from System V IPC. This no longer
appears to be serving a useful purpose, as it was used during initial
development of MAC support for System V IPC.

MFC after:	1 month
Obtained from:	TrustedBSD Project
Suggested by:	Christopher dot Vance at SPARTA dot com
2006-09-20 13:40:00 +00:00
Robert Watson 738f14d4b1 Remove MAC_DEBUG label counters, which were used to debug leaks and
other problems while labels were first being added to various kernel
objects.  They have outlived their usefulness.

MFC after:	1 month
Suggested by:	Christopher dot Vance at SPARTA dot com
Obtained from:	TrustedBSD Project
2006-09-20 13:33:41 +00:00
Robert Watson 04f11621df Rather than allocating all buffer memory for the completed BSM record
when allocating the record in the first place, allocate the final buffer
when closing the BSM record.  At that point, more size information is
available, so a sufficiently large buffer can be allocated.

This allows the kernel to generate audit records in excess of
MAXAUDITDATA bytes, but is consistent with Solaris's behavior.  This only
comes up when auditing command line arguments, in which case we presume
the administrator really does want the data as they have specified the
policy flag to gather them.

Obtained from:	TrustedBSD Project
MFC after:	3 days
2006-09-20 13:23:40 +00:00
Robert Watson 1db97bc63b Add missing white space in au_to_exec_{args,env}().
MFC after:	 3 days
2006-09-20 13:14:47 +00:00
Wojciech A. Koszek 6a535c2e4a Fix 'interrupt interrupt' -> 'interrupt' in the comment.
Approved by:	cognet (mentor)
2006-09-20 12:23:33 +00:00
Ruslan Ermilov 8ad58ac6ee Revert back to always using *(int *)arg for now. While this
is incorrect, and causes endianness bugs on 64-bit big-endian
machines (sparc64), it's the best choice for now, as many of
these IOCTLs are used inside the kernel, and bogusly pass an
argument as "int *" which results in unaligned access panics
on sparc64 when attempting to dereference them via *(intptr_t *).

(Several of us are working on a real fix, which is uneasy.)
2006-09-20 11:43:36 +00:00
Konstantin Belousov 28de2218ec Fix the glitch introduced in rev. 1.93. In softdep_sync_metadata(),
switch by worklist type contains two for() loops, for D_INDIRDEP and
D_PAGEDEP. On error, these loops are exited by break, where the switch
actually shall be leaved. Use goto instead of break to reach the error
handling code.

Reported by:	Peter Holm
Reviewed by:	tegge
Approved by:	pjd (mentor)
MFC after:	2 weeks
2006-09-20 07:49:28 +00:00
Pawel Jakub Dawidek 783deec19e There is no need to set 'sp' to NULL anymore. 2006-09-20 07:27:05 +00:00
Scott Long 78e36c279b Change some variable names and update some comments to help clarify some
confusing issues.
2006-09-20 06:58:02 +00:00
John-Mark Gurney b70c1daf97 spell PCIS_CRYPTO_ENTERTAIN properly...
MFC after:	3 days
2006-09-20 06:47:14 +00:00
Tor Egge 4e59868e08 Copy stat information from mount structure before it can change identity. 2006-09-20 00:32:07 +00:00
Tor Egge 60b0b1aa18 Don't try to obtain a reference to a nonexisting (NULL) mount structure in
default VOP_GETWRITEMOUNT().
2006-09-20 00:27:02 +00:00
Martin Blapp d7b167b57b Fix races between tty.c and sessrele() / doenterpgrp() / leavepgrp(). The tty
code is still under giant lock, but the session/pgrp release code just used
proctree_locks. This explains why moving the proctree_lock in sys/kern/tty.c
rev. 1.258 did fix the panics in our SMP systems.

This should also fix some race panics with revoked ttys.

Reviewed by:	jhb
MFC after:	1 week
2006-09-19 19:25:11 +00:00
Konstantin Belousov f37e633887 Fix the bug in rev. 1.232. If vfs_suser returned false, coveredvp shall be
unlocked only if it really exists.

Found with:	Coverity Prevent(tm)
CID:	1535
Approved by:	pjd (mentor)
2006-09-19 14:04:12 +00:00
Konstantin Belousov af72db7175 Fix the bug in rev. 1.134. In devfs_allocv_drop_refs(), when not_found == 2
and drop_dm_lock is true, no unlocking shall be attempted. The lock is
already dropped and memory is freed.

Found with:	Coverity Prevent(tm)
CID:	1536
Approved by:	pjd (mentor)
2006-09-19 14:03:02 +00:00
Ruslan Ermilov 9e24e7f60b Make typecast expressions comply with style(9). 2006-09-19 13:03:09 +00:00
Ruslan Ermilov 9cd96497d6 This time, really fix endian bugs accessing ioctl arguments that
are passed by value.  These are KDSKBMODE, KDSETLED, KDSKBSTATE,
and KDSETRAD.

Tested on:	amd64, sparc64 (demo code)
2006-09-19 13:01:20 +00:00
Ruslan Ermilov 225fcb2690 Back out revision 1.8. The only thing it did was to break LEDs (and
some other less noticeable things) on little-endian 64-bit platforms
such as amd64.

PR:		kern/101931
Discussed with:	emax, marius
MFC after:	1 day
2006-09-19 09:34:25 +00:00
Andre Oppermann 9fd7a4e705 Don't forget to add curly braces when doing more than one line of actions
after a 'if' statement.

Pointy hat to:	andre
2006-09-18 23:44:12 +00:00
Maksim Yevmenkin 8c3c9a505f Do not try to call keyboard callback unless keyboard is active and busy.
This should fix 'kbdcontrol -K < /dev/console' panic on sparc64 with sunkbd(4).

PR:		sparc64/96798
MFC after:	1 week
2006-09-18 22:56:59 +00:00
Jung-uk Kim 3e9b1bcabf Do not strip VLAN tag in promiscuous mode. 2006-09-18 22:18:21 +00:00
Jung-uk Kim f9004b6d2d Simplify promiscuous mode check and make ALLMULTI independent from it. 2006-09-18 20:54:40 +00:00
John Baldwin d4a5bcc95c Update prototype for smbus callback change.
Reported by:	Ian FREISLICH <if at hetzner dot co dot za>
2006-09-18 20:17:42 +00:00
Christian S.J. Peron 600d74bfa1 Make sure that lutimes(2) gets processed and converted into a BSM record.
Submitted by:	rwatson
MFC after:	1 day
2006-09-18 17:55:32 +00:00
Sam Leffler 72845968fa remove local change
Spotted by:	Gavin Atkinson
2006-09-18 17:23:35 +00:00
Sam Leffler d9994d8bb4 remove this from HEAD too since it got taken off the vendor branch 2006-09-18 17:01:35 +00:00
Sam Leffler e73ceabdc0 fixup build after move of ah_osdep.?
MFC after:	2 weeks
2006-09-18 16:50:59 +00:00
Sam Leffler 6432da677c This commit was generated by cvs2svn to compensate for changes in r162413,
which included commits to RCS files with non-trunk default branches.
2006-09-18 16:49:15 +00:00
Sam Leffler 3fe92528af o move ath hal os glue code from the hal to the driver: this code was
part of the hal distribution early on when the hal was built for
  each os but it's been portable for a long time so move the os-specific
  code out (and off the vendor branch)
o correct the copyright on ah_osdep.?; it was mistakenly given a
  restricted license and not a dual-bsd/gpl license
o remove the module api definition as it was never used
o fixup include paths for move of ah_osdep.h

MFC after:	2 weeks
2006-09-18 16:49:15 +00:00
Sam Leffler 3da8df6081 nuke unused support for building ath hal from src code
MFC after:	1 week
2006-09-18 16:30:28 +00:00
Sam Leffler 5901d2d38a Add support for newer parts that do not require separate keycache
entries for tx+rx mic keys.  This requires a newer hal, but works
fine with the current hal in cvs.

MFC after:	2 weeks
2006-09-18 16:26:19 +00:00
Sam Leffler a7ee023101 remove stub radar support; it's never been used and future
hal's will not include the calls (due to redesign)

MFC after:	1 week
2006-09-18 16:16:02 +00:00
Konstantin Belousov 4dec8579bd Fix the race while waiting for coveredvp lock during unmount. The vnode may
be recycled during the sleep, wrap the vn_lock with vhold/vdrop.
Check that coveredvp still points to the same mp after sleep (needed
because sleep dropped Giant).
Move check for user rights for unmount after coveredvp lock is obtained.

Tested by:	Peter Holm
Reviewed by:	tegge
Approved by:	kan (mentor)
MFC after:	2 weeks
2006-09-18 15:35:22 +00:00
Konstantin Belousov e7f9b74438 Resolve the devfs deadlock caused by LOR between devfs_mount->dm_lock and
vnode lock in devfs_allocv. Do this by temporary dropping dm_lock around
vnode locking.

For safe operation, add hold counters for both devfs_mount and devfs_dirent,
and DE_DOOMED flag for devfs_dirent. The facilities allow to continue after
dropping of the dm_lock, by making sure that referenced memory does not
disappear.

Reviewed by:	tegge
Tested by:	kris
Approved by:	kan (mentor)
PR:		kern/102335
2006-09-18 13:23:08 +00:00
Robert Watson 5702e0965e Declare security and security.bsd sysctl hierarchies in sysctl.h along
with other commonly used sysctl name spaces, rather than declaring them
all over the place.

MFC after:	1 month
Sponsored by:	nCircle Network Security, Inc.
2006-09-17 20:00:36 +00:00
Christian S.J. Peron f07b836981 Correct a slight regression which was introduced with the implementation of
audit pipes. If the kernel record was not selected for the trail or the pipe,
any user supplied record attached to it would be tossed away, resulting in
otherwise selected events being lost.

- Introduce two new masks: AR_PRESELECT_USER_TRAIL AR_PRESELECT_USER_PIPE,
  currently we have AR_PRESELECT_TRAIL and AR_PRESELECT_PIPE, which tells
  the audit worker that we are interested in the kernel record, with
  the additional masks we can determine if either the pipe or trail is
  interested in seeing the kernel or user record.

- In audit(2), we unconditionally set the AR_PRESELECT_USER_TRAIL and
  AR_PRESELECT_USER_PIPE masks under the assumption that userspace has
  done the preselection [1].

Currently, there is work being done that allows the kernel to parse and
preselect user supplied records, so in the future preselection could occur
in either layer. But there is still a few details to work out here.

[1] At some point we need to teach au_preselect(3) about the interests of
    all the individual audit pipes.

This is a RELENG_6 candidate.

Reviewed by:	rwatson
Obtained from:	TrustedBSD Project
MFC after:	1 week
2006-09-17 17:52:57 +00:00
David Xu 103c065406 Make cpu_set_upcall_kse() and cpu_set_user_tls() work for 32bit process. 2006-09-17 14:54:14 +00:00
Andre Oppermann a855e2b4c0 Remove VLAN mtag UMA zones and initialize ether_vtag and tso_segsz packet
header fields to zero on mbuf allocation.

Sponsored by:	TCP/IP Optimization Fundraise 2005
2006-09-17 13:44:32 +00:00
Andre Oppermann 7ff0b850a6 Make tcp_usr_send() free the passed mbufs on error in all cases as the
comment to it claims.

Sponsored by:	TCP/IP Optimization Fundraise 2005
2006-09-17 13:39:35 +00:00
Andre Oppermann 78ba57b9e1 Move ethernet VLAN tags from mtags to its own mbuf packet header field
m_pkthdr.ether_vlan.  The presence of the M_VLANTAG flag on the mbuf
signifies the presence and validity of its content.

Drivers that support hardware VLAN tag stripping fill in the received
VLAN tag (containing both vlan and priority information) into the
ether_vtag mbuf packet header field:

	m->m_pkthdr.ether_vtag = vlan_id;	/* ntohs()? */
	m->m_flags |= M_VLANTAG;

to mark the packet m with the specified VLAN tag.

On output the driver should check the mbuf for the M_VLANTAG flag to
see if a VLAN tag is present and valid:

	if (m->m_flags & M_VLANTAG) {
		... = m->m_pkthdr.ether_vtag;	/* htons()? */
		... pass tag to hardware ...
	}

VLAN tags are stored in host byte order.  Byte swapping may be necessary.

(Note: This driver conversion was mechanic and did not add or remove any
byte swapping in the drivers.)

Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition.  No more tag
memory allocation have to be done.

Reviewed by:	thompsa, yar
Sponsored by:	TCP/IP Optimization Fundraise 2005
2006-09-17 13:33:30 +00:00
Robert Watson da7cbdc2b3 Regenerate. 2006-09-17 13:29:36 +00:00
Robert Watson 6c2d307a0e AUE_SIGALTSTACK instead of AUE_SIGPENDING for sigaltstack().
Obtained from:	TrustedBSD Project
MFC after:	3 days
2006-09-17 13:28:11 +00:00
Robert Watson 31214759fa Add AUE_SYSARCH to the list of audit events during BSM conversion to prevent
a console warning.  Eventually, we will capture more arguments for sysarch.

Obtained from:	TrustedBSD Project
MFC after:	3 days
2006-09-17 11:42:40 +00:00
Robert Watson 101581b082 Expore kern.acct_configured, a sysctl that reflects the configured/
unconfigured state of the kernel accounting system.  This is used by
the accounting privilege regression test to determine whether
accounting is in use and will be disrupted by the regression test.

Sponsored by:	nCircle Network Security, Inc.
Obtained from:	TrustedBSD Project
MFC after:	1 month
2006-09-17 11:00:36 +00:00
Andrew Thompson 781dd9ae05 Rearrange things so that ARP packets can be filtered or rate limited with IPFW.
Requested by:	Jon Otterholm
Tested by:	Jon Otterholm
2006-09-17 08:20:56 +00:00
Matt Jacob 059cce1a75 Don't allow attachment of disks that could cause GEOM to panic. 2006-09-16 21:21:07 +00:00
Matt Jacob 1190a85bef New Dell 1950/2950 SES backplane drops off the bus if you poke
at greater then lun 0.

MFC after:	1 week
2006-09-16 17:35:47 +00:00
Robert Watson ef0d1723db Add audit hooks for ppc, ia64 system call paths.
Reviewed by:	marcel (ia64)
Obtained from:	TrustedBSD Project
MFC after:	3 days
2006-09-16 17:03:02 +00:00
Alexander Leidinger 18f81b3dfa - don't reboot() when feed with wrong parameters (and enough permissions) [1]
- add support to power off the system [2]
- check the linux magic values [3]

Submitted by:	Marcin Cieslak <saper@SYSTEM.PL> [1,2]
Modelled after:	linux man page of the reboot() syscall [3]
Found by:	LTP testcase "reboot02" [1]
Tested with:	LTP testcase "reboot02" [1,3]
MFC after:	1 week
2006-09-16 14:12:04 +00:00
Pawel Jakub Dawidek f8aa16c66c Fix detecting of UFS1 label when mediasize%fragsize != 0.
Submitted by:	Stanislav Sedov
PR:		kern/84637
MFC after:	1 week
2006-09-16 11:24:41 +00:00
Pawel Jakub Dawidek 8abd1ad101 Add 'configure' subcommand which for now only allows setting and removing
of the BOOT flag. It can be performed on both attached and detached
providers.

Requested by:	Matthias Lederhofer <matled@gmx.net>
MFC after:	1 week
2006-09-16 10:43:17 +00:00
Pawel Jakub Dawidek 5e165262f1 Add __printflike() to gctl_error().
Approved by:	phk
MFC after:	1 week
2006-09-16 10:39:07 +00:00
John Hay 724e825a16 Handle a list of IPv6 src and dst addresses correctly, eg.
ipfw add allow ip6 from any to 2000::/16,2002::/16

PR:		102422 (part 3)
Submitted by:	Andrey V. Elsukov <bu7cher at yandex dot ru>
MFC after:	5 days
2006-09-16 10:27:05 +00:00
Pawel Jakub Dawidek 5a20446db8 Small fixes after adding __printflike() to gctl_error().
Approved by:	phk
MFC after:	3 days
2006-09-16 09:48:29 +00:00
Pawel Jakub Dawidek dec53cdd32 Remove extra arguments.
MFC after:	3 days
2006-09-16 07:47:57 +00:00
John Hay f129892448 Make it possible to add an IPv6 host route to a host directly connected.
Use something like this:
route add -inet6 <dest_addr> <my_addr_on_that_interface> -interface -llinfo

This is usefull for wireless adhoc mesh networks.

MFC after:	5 days
2006-09-16 06:24:28 +00:00
Ruslan Ermilov 85fcf1ba07 Fix input byte counting. Now the sum of the ipackets/ibytes counters
of individual interfaces should match the ipackets/ibytes counter of
the aggregate (FEC) interface.

PR:		kern/82189
Submitted by:	Stikheev Andrew <sand AT zunet DOT ru>
MFC after:	3 days
2006-09-15 20:17:45 +00:00
Andrew Gallatin 0fa7f68197 - Updated to the latest myri10ge firmware
- Added support for multicast filtering, now that the firmware
  supports it.  Note that this is not yet tested, as multicast
  seems to panic -current (even w/o mxge loaded)
- Added workaround to cope with different irq data struct size on
  pre-multicast firmware which can found running on nics.
- Added Intel E5000 PCIe chipsets to list providing aligned completions.
- Replaced various magic constants with #defines, now that they are
  defined in the firmware headers.
2006-09-15 19:24:45 +00:00
Pawel Jakub Dawidek 679f8b7e7a Add 'show geom [addr]' ddb(4) command, which prints entire GEOM topology if
no additional argument is given or details about the given GEOM object
(class, geom, provider or consumer).

Approved by:	phk
2006-09-15 16:36:45 +00:00
Andre Oppermann 31ecb34a4e When doing TSO subtract hdrlen from TCP_MAXWIN to prevent ip->ip_len
from wrapping when we generate a maximally sized packet for later
segmentation.

Noticed by:	gallatin
Sponsored by:	TCP/IP Optimization Fundraise 2005
2006-09-15 16:08:09 +00:00
Ruslan Ermilov 7f01dc25c4 Make it possible to set a larger MTU by attempting to set MTUs on all
trunk ports first.  If that succeeds, and we're inside our own bounds,
so be it.

Still not ideal -- adding a port after changing an MTU doesn't change
port's MTU, but a step in the right direction.

PR:		kern/95417
Submitted by:	Vladimir Ivanov <wawa AT yandex-team DOT ru>
MFC after:	3 days

I've slightly edited a patch to make the conditional logic positive
and remove (what I think was) a redundant ng_fec_init() call.
2006-09-15 16:06:27 +00:00
Ruslan Ermilov 3d82b87057 SIOCSIFFLAGS doesn't require an argument in kernel land; instead, flags
are supposed to be set directly in ifnet already.  This change fixes a
panic when ng_eiface node is attached to ng_fec node and the latter is
shut down (ng_fec sets flags and then calls SIOCSIFFLAGS with a NULL
argument).

MFC after:	3 days
2006-09-15 15:53:09 +00:00
Andrew Gallatin aed8e389c1 - Added TSO support. This entailed increasing the number of send descriptors
in the transmit busdma tag, so I moved the segment list off the
stack.

- Fixed transmit routine to ensure it doesn't read past the end
of an mbuf when parsing headers.

- Corrected handling of odd length segments.  Setting MXGEFW_FLAGS_ALIGN_ODD
is required only when offloading the checksum of that frame.

Sponsored by: Myricom Inc.
2006-09-15 15:41:28 +00:00
Gleb Smirnoff 6b9f5c941c - Consistently use if_printf() only in interface methods: if_start(),
if_watchdog, etc., or in functions used only in these methods.
  In all other functions in the driver use device_printf().
- Use __func__ instead of typing function name.

Submitted by:	Alex Lyashkov <umka sevcity.net>
2006-09-15 15:16:12 +00:00
Ruslan Ermilov aaf10c46c7 Whitespace nits. 2006-09-15 11:01:23 +00:00
Pawel Jakub Dawidek ef7c47775f Less magic.
MFC after:	3 days
2006-09-15 10:44:55 +00:00
Gleb Smirnoff cc4c1b6971 Consistently use if_printf() only in interface methods: if_start,
if_ioctl, if_watchdog, etc, or in functions that are used by
these methods only. In all other cases use device_printf().

This also fixes several panics, when if_printf() is called before
softc->ifp was initialized.

Submitted by:	Alex Lyashkov <umka sevcity.net>
2006-09-15 10:40:54 +00:00
Søren Schmidt abd7633203 If current_heads or current_sectors in the disk cap page are zero, dont try to use the current_ geometry.
This avoids a panic with BIOS'n that sets these to zero.
2006-09-14 19:12:29 +00:00
Mohan Srinivasan 3c5b80d6c2 Fix for a potential bug caught by Coverity. Pointed out to me by Kris Kennaway. 2006-09-14 17:57:02 +00:00
Andrey A. Chernov 239e71c612 Add missing #ifdef INET6 (can't be compiled) 2006-09-14 10:22:35 +00:00
John-Mark Gurney 9773a00fa7 Only treat positive values as errors...
Pointed out by:	wsk
Message-ID: <45060FC4.2090308@gddsn.org.cn>
2006-09-14 03:47:59 +00:00
John Baldwin fcf43477b8 intpm(4) meet style(9). style(9) meet intpm(4). 2006-09-13 18:56:39 +00:00
Mohan Srinivasan 7d7d9e2242 Fixes up the handling of shared vnode lock lookups in the NFS client,
adds a FS type specific flag indicating that the FS supports shared
vnode lock lookups, adds some logic in vfs_lookup.c to test this flag
and set lock flags appropriately.

- amd on 6.x is a non-starter (without this change). Using amd under
  heavy load results in a deadlock (with cascading vnode locks all the
  way to the root) very quickly.
- This change should also fix the more general problem of cascading
  vnode deadlocks when an NFS server goes down.

Ideally, we wouldn't need these changes, as enabling shared vnode lock
lookups globally would work. Unfortunately, UFS, for example isn't
ready for shared vnode lock lookups, crashing pretty quickly.

This change is the result of discussions with Stephan Uphoff (ups@).

Reviewed by:	ups@
2006-09-13 18:39:09 +00:00
Scott Long 988129b824 Introduce a spinlock for synchronizing access to the video output hardware
in syscons.  This replaces a simple access semaphore that was assumed to be
protected by Giant but often was not.  If two threads that were otherwise
SMP-safe called printf at the same time, there was a high likelyhood that
the semaphore would get corrupted and result in a permanently frozen video
console.  This is similar to what is already done in the serial console
drivers.
2006-09-13 15:48:15 +00:00
Christian S.J. Peron 7ca6b7823d Back out one of the Giant removals from revision 1.272. Giant was not here to
protect the vnode, it was present to synchronize access to TTY session
information between exit(2) and the TTY code. While we are here, note that
Giant is required for TTY protection.

Clue from:	bde
Discussed with:	jhb
MFC after:	1 week
2006-09-13 15:47:53 +00:00
Pawel Jakub Dawidek 8e007c52fd Fix synchronization in gmirror and graid3 which I broken. Synchronization
request can still have bio_to set to sc_provider (this is READ part of a
synchronization request) and in this case g_{mirror,raid3}_sync() wasn't
called as it should be.

MFC after:	1 week
2006-09-13 15:46:49 +00:00
Andre Oppermann 67d828b162 Remove unessary includes and follow common ordering style. 2006-09-13 13:21:17 +00:00
Andre Oppermann bf6d304ab2 Rewrite of TCP syncookies to remove locking requirements and to enhance
functionality:

 - Remove a rwlock aquisition/release per generated syncookie.  Locking
   is now integrated with the bucket row locking of syncache itself and
   syncookies no longer add any additional lock overhead.
 - Syncookie secrets are different for and stored per syncache buck row.
   Secrets expire after 16 seconds and are reseeded on-demand.
 - The computational overhead for syncookie generation and verification
   is one MD5 hash computation as before.
 - Syncache can be turned off and run with syncookies only by setting the
   sysctl net.inet.tcp.syncookies_only=1.

This implementation extends the orginal idea and first implementation
of FreeBSD by using not only the initial sequence number field to store
information but also the timestamp field if present.  This way we can
keep track of the entire state we need to know to recreate the session in
its original form.  Almost all TCP speakers implement RFC1323 timestamps
these days.  For those that do not we still have to live with the known
shortcomings of the ISN only SYN cookies.  The use of the timestamp field
causes the timestamps to be randomized if syncookies are enabled.

The idea of SYN cookies is to encode and include all necessary information
about the connection setup state within the SYN-ACK we send back and thus
to get along without keeping any local state until the ACK to the SYN-ACK
arrives (if ever).  Everything we need to know should be available from
the information we encoded in the SYN-ACK.

A detailed description of the inner working of the syncookies mechanism
is included in the comments in tcp_syncache.c.

Reviewed by:	silby (slightly earlier version)
Sponsored by:	TCP/IP Optimization Fundraise 2005
2006-09-13 13:08:27 +00:00
Scott Long adab0fdc4f Remove duplicated code. Declare functions non-static that shouldn't be
inlined.
2006-09-13 09:35:59 +00:00
Pawel Jakub Dawidek 689f94bfe6 Fix a lock leak in an error case.
Reported by:	netchild
Reviewed by:	rwatson
2006-09-13 06:58:40 +00:00
John-Mark Gurney c14c65ed52 document that PAE kernels needs twice the value of non-PAE kernels
for KVA_PAGES, and that it it likely needed for >4GB memory boxes..

MFC after:	3 days
2006-09-13 01:23:08 +00:00
Søren Schmidt 8a0b22718a Busmaster DMA address fix in VIA 6421 case. 2006-09-12 22:06:39 +00:00
Søren Schmidt d5bddfcbfc Format mask lacks one bit.
Reported by:	jkim
2006-09-12 20:37:22 +00:00
Warner Losh b4583894aa Put the osta.c license on osta.h. The license is the same.
Approved by: scottl@
2006-09-12 19:02:34 +00:00
John Baldwin 9d042fe7aa Trim some unneeded includes. 2006-09-12 15:01:19 +00:00
Christian S.J. Peron d94f2a68f8 Introduce a new entry point, mac_create_mbuf_from_firewall. This entry point
exists to allow the mandatory access control policy to properly initialize
mbufs generated by the firewall. An example where this might happen is keep
alive packets, or ICMP error packets in response to other packets.

This takes care of kernel panics associated with un-initialize mbuf labels
when the firewall generates packets.

[1] I modified this patch from it's original version, the initial patch
    introduced a number of entry points which were programmatically
    equivalent. So I introduced only one. Instead, we should leverage
    mac_create_mbuf_netlayer() which is used for similar situations,
    an example being icmp_error()

    This will minimize the impact associated with the MFC

Submitted by:	mlaier [1]
MFC after:	1 week

This is a RELENG_6 candidate
2006-09-12 04:25:13 +00:00
John Baldwin 3bb00f61a2 - Revert making bus_generic_add_child() the default for BUS_ADD_CHILD().
Instead, we want busses to explicitly specify an add_child routine if they
  want to support identify routines, but by default disallow having outside
  drivers add devices.
- Give smbus(4) an explicit bus_add_child() method.

Requested by:	imp
2006-09-11 22:20:37 +00:00
Prafulla Deuskar a21ff306d8 Fix issues found by Coverity (223392, 223393) due to TSO additions
Submitted by:	Matthew Jacob
2006-09-11 20:59:01 +00:00
John Baldwin 7048a99c30 Minor overhaul of SMBus support:
- Change smbus_callback() to pass a void * rather than caddr_t.
- Change smbus_bread() to pass a pointer to the count and have it be an
  in/out parameter.  The input is the size of the buffer (same as before),
  but on return it will contain the actual amount of data read back from
  the bus.  Note that this value may be larger than the input value.  It
  is up to the caller to treat this as an error if desired.
- Change the SMB_BREAD ioctl to write out the updated struct smbcmd which
  will contain the actual number of bytes read in the 'count' field.  To
  preserve the previous ABI, the old ioctl value is mapped to SMB_OLD_BREAD
  which doesn't copy the updated smbcmd back out to userland.  I doubt anyone
  actually used the old BREAD anyway as it was rediculous to do a bulk-read
  but not tell the using program how much data was actually read.
- Make the smbus driver and devclass public in the smbus module and
  push all the DRIVER_MODULE()'s for attaching the smbus driver to
  various foosmb drivers out into the foosmb modules.  This makes all
  the foosmb logic centralized and allows new foosmb modules to be
  self-contained w/o having to hack smbus.c everytime a new smbus driver
  is added.
- Add a new SMB_EINVAL error bit and use it in place of EINVAL to return
  an error for bad arguments (such as invalid counts for bread and bwrite).
- Map SMB bus error bits to EIO in smbus_error().
- Make the smbus driver call bus_generic_probe() and require child drivers
  such as smb(4) to create device_t's via identify routines.  Previously,
  smbus just created one anonymous device during attach, and if you had
  multiple drivers that could attach it was just random chance as to which
  driver got to probe for the sole device_t first.
- Add a mutex to the smbus(4) softc and use it in place of dummy splhigh()
  to protect the 'owner' field and perform necessary synchronization for
  smbus_request_bus() and smbus_release_bus().
- Change the bread() and bwrite() methods of alpm(4), amdpm(4), and
  viapm(4) to only perform a single transaction and not try to use a
  loop of multiple transactions for a large request.  The framing and
  commands to use for a large transaction depend on the upper-layer
  protocol (such as SSIF for IPMI over SMBus) from what I can tell, and the
  smb(4) driver never allowed bulk read/writes of more than 32-bytes
  anyway.  The other smb drivers only performed single transactions.
- Fix buffer overflows in the bread() methods of ichsmb(4), alpm(4),
  amdpm(4), amdsmb(4), intpm(4), and nfsmb(4).
- Use SMB_xxx errors in viapm(4).
- Destroy ichsmb(4)'s mutex after bus_generic_detach() to avoid problems
  from child devices making smb upcalls that would use the mutex during
  their detach methods.

MFC after:	1 week
Reviewed by:	jmg (mostly)
2006-09-11 20:52:41 +00:00
John Baldwin 884ff1813f Add a new ddb command 'show lapic' to dump details about the local APIC
registers for the current CPU.

MFC after:	3 days
2006-09-11 20:12:42 +00:00
John Baldwin 5c15c7e71d Actually hook up the IPI_INVLCACHE IDT vectors backing
pmap_invalidate_cache() in the SMP case so pmap_mapdev() in multiuser
doesn't panic with a trap 30.  I broke this many months ago when I
added pmap_invalidate_cache() as early parts of the PAT work.

Patience from:	jmg
Pointy hat:	jhb
2006-09-11 20:10:42 +00:00
Andre Oppermann 384a05bfd0 Fix a NULL pointer dereference of ro->ro_rt->rt_flags by checking for the
validity of ro->ro_rt first.  This prevents crashing on any non-normally
routed IP packet.

Coverity CID:	162 (incorrectly, it was re-introduced by previous commit)
2006-09-11 19:56:10 +00:00
Søren Schmidt 594e3d5d6f Add support for a few more Serverworks and lookalikes chips. 2006-09-11 19:48:30 +00:00
Søren Schmidt 92dc84876a Update to fit latest USB cleanup crusade. 2006-09-11 19:47:53 +00:00
John Baldwin bd4b6eb964 Add prototype for bus_generic_add_child() missed in previous commit. 2006-09-11 19:42:27 +00:00
John Baldwin 4288462f38 Add a default method for BUS_ADD_CHILD() that just calls
device_add_child_ordered().  Previously, a device driver that wanted to
add a new child device in its identify routine had to know if the parent
driver had a custom bus_add_child method and use BUS_ADD_CHILD() in that
case, otherwise use device_add_child().  Getting it wrong in either
direction would result in panics or failure to add the child device.  Now,
BUS_ADD_CHILD() always works isolating child drivers from having to know
intimate details about the parent driver.

Discussed with:	imp
MFC after:	1 week
2006-09-11 19:41:31 +00:00
John Baldwin 0bba6acf85 Give the ACPI I/O rman's unique description strings to make 'devinfo -u'
output less confusing.

MFC after:	3 days
2006-09-11 19:32:54 +00:00
John Baldwin 9914a8cc7d - Fix rman_manage_region() to be a lot more intelligent. It now checks
for overlaps, but more importantly, it collapses adjacent free regions.
  This is needed to cope with BIOSen that split up ports for system devices
  (like IPMI controllers) across multiple system resource entries.
- Now that rman_manage_region() is not so dumb, remove extra logic in the
  x86 nexus drivers to populate the IRQ rman that manually coalesced the
  regions.

MFC after:	1 week
2006-09-11 19:31:52 +00:00
Søren Schmidt a4ed04c719 CF devices are ATA not ATAPI. 2006-09-11 18:33:59 +00:00
Matt Jacob 9fdecced07 null commit to provide commit message to previous
at the request of Sam Leffler: The previous commit
established min and maxtags for VMware pseudo disks
to fix a submitted PR.
2006-09-11 17:57:23 +00:00
Matt Jacob df4b14f436 PR: 103130
Submitted by:	Shusuke Shinomiya
MFC after:	1 day
2006-09-11 17:34:28 +00:00
David E. O'Brien 3e232000c0 Add support for MCP61 and MCP65 adaptors.
Submitted by:	Peer Chen at nVIDIA
2006-09-11 07:31:55 +00:00
Scott Long 88591e04af The run_filter() procedure is a means of working around DMA engine bugs in
old/broken hardware.  Unfortunately, it adds cache pressure and possible
mispredicted branches to the fast path of the bus_dmamap_load collection of
functions.  Since it's meant for slow path exception processing, de-inline
it and allow its conditions to be pre-computed at tag_create time and thus
short-circuited at runtime.

While here, cut down on the size of _bus_dmamap_load_buffer() by pushing the
bounce page logic into a non-inlined function.  Again, this helps with
cache pressure and mispredicted branches.

According to the TSC, this shaves off a few cycles on average.  Unfortunately,
the data varies quite a bit due to interrupts and preemption, so it's hard to
get a good measurement.  Real world measurements of network PPS are welcomed.
A merge to amd64 and other arches is pending more testing.
2006-09-11 06:48:53 +00:00
Prafulla Deuskar 66387cee8f Fix style(9) issues in the TSO specific changes.
Pointed out by: jmallett
2006-09-10 19:23:27 +00:00
John-Mark Gurney 3ae2ad088e make use of the host route's mtu for processing. This means we can now
support a network w/ split mtu's by assigning each host route the correct
mtu.  an aspiring programmer could write a daemon to probe hosts and find
out if they support a larger mtu.
2006-09-10 17:49:09 +00:00
Andre Oppermann 805def2e04 New sockets created by incoming connections into listen sockets should
inherit all settings and options except listen specific options.

Add the missing send/receive timeouts and low watermarks.
Remove inheritance of the field so_timeo which is unused.

Noticed by:	phk
Reviewed by:	rwatson
Sponsored by:	TCP/IP Optimization Fundraise 2005
MFC after:	3 days
2006-09-10 17:08:06 +00:00
Martin Blapp f976eefa00 Fix locking race in ttymodem(). The locking of the proctree happens too late
and opens a small race window before tp->t_session->s_leader is accessed. In case
tp->t_session has just been set to NULL elsewhere, we get a panic().

This fix is a bandaid until someone else fixes the whole locking in the tty subsystem.
Definitly more work needs to be done.

MFC after:	1 week
Reviewed by:	mlaier
PR:		kern/103101
2006-09-10 16:51:56 +00:00
Tom Rhodes 16b392d51d Yank FreeBSD specific code out from under ifdef.
Remove compatibility ifdefs.

Reviewed/Ok'ed by:	imp
2006-09-10 15:20:39 +00:00
Alexander Leidinger db0d964062 The Linux unlink syscall uses a different errno value when trying to unlink
a directory.

PR:		102897 [1]
Noticed by:	Knut Anders Hatlen <kahatlen@gmail.com>, testrun with LTP [1]
Submitted by:	Marcin Cieslak <saper@SYSTEM.PL>
Tested by:	netchild (LTP test run)
2006-09-10 13:47:56 +00:00
Pawel Jakub Dawidek d6b910d295 Delay an orphan event if provider has still in-flight I/O requests.
This way GEOM classes can safely detach from provider when an orphan
event is received. This fixes 'detach with active requests' panic for
gstripe/gconcat under load.

PR:		kern/102766
Submitted by:	mjacob
OK'ed by:	phk
MFC after:	1 week
2006-09-10 09:11:54 +00:00
John-Mark Gurney 0cca572e64 move created/detected/activated under debug level 1 to quiet the common case..
add count of active and total components to the launched line so you can
see at a glance if your mirror/raid3 is complete...

now:
GEOM_MIRROR: Device mirror/sam launched (2/2).

Reviewed by:	pjd
2006-09-09 21:45:37 +00:00
Prafulla Deuskar d1215a3738 Second attempt at fixing module build
Pointyhat: pdeuskar
2006-09-09 20:05:24 +00:00
Prafulla Deuskar f2449c9bcc Fix build breakage while compiling em as a module. 2006-09-09 19:55:13 +00:00
Alexander Leidinger 20a2cc13b7 Build linprocfs and linsysfs as modules on amd64.
Sponsored by:	Google SoC 2006
Submitted by:	rdivacky
2006-09-09 16:58:22 +00:00
Alexander Leidinger 8618fd85a3 - Extend the coverage of PROC_LOCK to cover wakeup(&p->p_emuldata);
- Lock the emuldata in a case when we just created it.

Sponsored by:	Google SoC 2006
Submitted by:	rdivacky
Suggested by:	jhb
2006-09-09 16:55:55 +00:00
Robert Watson 198e7d90f9 Add struct msg to the forwarded declared data structures in mac_policy.h.
Obtained from:	TrustedBSD Project
2006-09-09 16:35:44 +00:00
Alexander Leidinger bb59e63f8f Change futex lock from mutex to sx. Make futex_get atomic (protected by the
futex lock).

Sponsored by:	Google SoC 2006
Submitted by:	rdivacky
Suggested by:	jhb
2006-09-09 16:25:25 +00:00
Robert Watson 484cc85edb Remove slightly oddly placed suser() call from the KTR/ALQ setup sysctl:
it was present only in the enable path, not the disable path, which one
presumes would be equally of interest.  Either way, it was not needed,
as the sysctl framework already calls suser() if the operation is a
write operation, which configuration requests are.

Sponsored by:	nCircle Network Security, Inc.
2006-09-09 16:09:01 +00:00
Alexander Leidinger f3ed5ebbcf Fix the check where we want to use the end of the supported range if the
value is out of the supported range.

Noticed by:	Ed Schouten <ed@fxq.nl>
Reviewed by:	Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>
2006-09-09 14:43:03 +00:00
Alexander Leidinger c19ddeda07 - don't wake every sleeper just the first one [1]
- remove debuging printf			[2]

Submitted by:	intron <mag@intron.ac> [1], rdivacky [2]
2006-09-09 13:04:28 +00:00
Robert Watson af8bc757de Add a BSM conversion switch case for AUE_GETCWD, so that a console
warning isn't generated when __getcwd() is invoked.

MFC after:	3 days
Obtained from:	TrustedBSD Project
2006-09-09 10:23:44 +00:00
Robert Watson 4b0b93261a Small style cleanup.
MFC after:	3 days
2006-09-09 10:23:00 +00:00
Robert Watson 98bf5a707d Audit sysarch() operation argument.
MFC after:	3 days
2006-09-09 10:20:31 +00:00
Prafulla Deuskar 87b18800d4 Add support for TSO. Thanks to Andre for adding support in the stack
and Jack Vogel for driver changes.

Submitted by: Jack Vogel
2006-09-09 06:19:20 +00:00
Konstantin Belousov 6c71207db5 Bump __FreeBSD_version for rev. 1.117 of libexec/rtld-elf/rtld.c.
Requested by:	jkim
Approved by:	kan (mentor)
2006-09-09 04:41:40 +00:00
Doug Ambrisko 8cb1383cb1 Add support to bge(4) to not break IPMI support when the driver attaches
to it.  Try to co-operate with the IPMI/ASF firmware accessing the PHY.
One we get link we don't mess with the PHY.  If we do then over time
the NIC will go off line.  It would be nice if we could tell if IPMI
was enabled on the chip but I can't figure out a reliable way to do
that.  The scheme I tried worked on a Dell PE850 but not on an HP machine.
So we assume any NIC that has ASF capability needs to deal with it.

The code was inspired by the support in Linux from kernel.org and Broadcom.
Broadcom did give me some info. but it is rather limited and is mostly
just what is in the Linux driver.  Thanks to the numerous people that
helped debug the many prior versions and that I didn't break other
bge(4) HW.

Reviewed by:	several people
Tested by:	even more
2006-09-09 03:36:57 +00:00
David Xu c0ba6c1783 The following functions need not to be reimplemented, reuse 64bit
syscalls instead:
sigqueue, thr_set_name, thr_setscheduler, thr_getscheduler,
thr_setschedparam.
2006-09-09 01:22:13 +00:00
Jung-uk Kim 0da90eb878 Fix style nits. No md5 changes in .o's. ;-) 2006-09-08 21:46:01 +00:00
Ruslan Ermilov 2054a074c1 MF6: Attach if_bce.ko to the build.
Noticed by:	davidch
2006-09-08 15:40:36 +00:00
Pawel Jakub Dawidek 46ee0837c2 Fix format character.
Reported by:	andre
2006-09-08 13:46:18 +00:00
Gleb Smirnoff 3e630ef9a9 Add a sysctl net.inet.tcp.nolocaltimewait that allows to suppress
creating a compress TIME WAIT states, if both connection endpoints
are local. Default is off.
2006-09-08 13:09:15 +00:00
Pawel Jakub Dawidek fc024f7a45 Bump copyright year. 2006-09-08 10:20:44 +00:00
Pawel Jakub Dawidek c076790223 Use __FBSDID in .c files. 2006-09-08 10:19:24 +00:00
Pawel Jakub Dawidek 6a146a1989 - Split failure probability configuration into read failure probability and
write failure probability.
- Allow to specify an error number to return of failure.

MFC after:	3 days
2006-09-08 09:21:21 +00:00