Commit Graph

74635 Commits

Author SHA1 Message Date
Konstantin Belousov
7564c4ad9a If ET_DYN binary has non-zero base address for some reason, honour it
and do not relocate the binary to ET_DYN_LOAD_ADDR. This allows for the
binary author to influence address map of the process. In particular,
when the binary is actually an interpeter, this allows to have almost
usual process address map.

Communicate the relocation bias of the mapping for interpeter-less
ET_DYN binary, that is interperter itself, in AT_BASE aux entry. This
way, rtld is able to find its dynamic structure and relocate itself.
Note that mapbase in the rtld is still wrong and requires further
fixing.

Reported and tested by:	rwatson
Discussed with:	kan
MFC after:	3 days
2009-10-18 12:57:48 +00:00
Konstantin Belousov
5c0e1c11a3 Remove spurious call to priv_check(PRIV_VM_SWAP_NOQUOTA).
Call priv_check(PRIV_VM_SWAP_NORLIMIT) only when per-uid limit is
actually exceed.

Both changes aim at calling priv_check(9) only for the cases when
privilege is actually exercised by the process.

Reported and tested by:	rwatson
Reviewed by:	alc
MFC after:	3 days
2009-10-18 12:55:39 +00:00
Robert Watson
33c89765f1 Line-wrap pfil.c so that it prints more nicely.
MFC after:	3 days
2009-10-18 11:27:34 +00:00
Robert Watson
6426657e9f Rewrap ip_input() comment so that it prints more nicely.
MFC after:	3 days
2009-10-18 11:23:56 +00:00
Weongyo Jeong
a0585a1450 overhauls urtw(4) for supporting RTL8187B devices properly that there
was major changes to initialize RF chipset and set H/W registers and
removed a lot of magic numbers on code.  Details are as follows:

  - uses the endpoint 0x89 to get TX status information which used to
    get TX complete or retry numbers or get a beacon interrupt.  It's
    only valuable for RTL8187B.
  - removes urtw_write[8|16|32]_i functions that it's useless now.
  - uses ic->ic_updateslot to set SLOT, SIFS, DIES, EIFS, CW_VAL
    registers that doesn't set these whenever the channel is changed.
  - code for initializing RF chipset for RTL8187B changed a lot that
    there was many problems on TX transfers so it doesn't work properly
    even if just for a ping/pong.  Now it becomes more stable than
    before that TX throughputs using netperf(1) were about 15 ~ 17Mbps/s
    though sometimes it encounters packet losses.
  - removes a lot of magic numbers that in the previous all of
    representing RX and TX descriptors were consisted of magic numbers
    and structures.  It'd be more readable rather than before.
  - calculates TX duration more accurately for urtw(4) devices.
  - style(9)
2009-10-18 00:11:49 +00:00
Ed Schouten
39410373b3 Print backspaces after echoing an EOF.
Applications like shells expect EOF to give no graphical output, while
our implementation prints ^D by default (tunable with stty echoctl).
Make the new implementation behave like the old TTY code. Print two
backspaces afterwards.

Reported by:	koitsu
MFC after:	1 month
2009-10-17 08:59:41 +00:00
John Baldwin
12ac99dc46 Close a race with caching of -ve name lookups in the NFS client.
Specifically, clients only trust -ve cache entries while the directory
remains unchanged and discard any -ve cache entries for a directory when
they notice that the modification time of a directory entry changes.  The
race involves two concurrent lookups as follows:
- Thread A does a lookup for file 'foo' which sends a lookup RPC to the
  server.  The lookup fails and the server replies.
- The 'foo' file is created (either by the same client or a different
  client) updating the modification time on the parent directory of 'foo'.
- Thread B does a lookup for a different file 'bar' which updates the
  cached attributes of the parent directory of 'foo' to reflect the new
  modification time after 'foo' was created.
- Thread A finally resumes execution to parse the reply from the NFS
  server.  It adds a -ve cache entry and sets the cached value of the
  directory's modification time that is used for invalidating -ve cached
  lookups to the new modification time set by thread B.

At this point, future lookups of 'foo' will honor the -ve cached entry
until the cached entry is pushed out of the name cache's LRU or the
modification time of the parent directory is changed again by some other
change.  The fix is to read the directory's modification time before
sending the lookup RPC and use that cached modification time when setting
the directory's cached modification time.  Also, we do not add a -ve cache
entry if another thread has added -ve cache entry that set the directory's
cached modification time to a newer value than the value we read before
sending the lookup RPC.

Reviewed by:	rmacklem
MFC after:	1 week
2009-10-16 19:30:48 +00:00
Konstantin Belousov
051f6f8a7a Move intr_describe() out of #ifdef SMP; the function is always required.
Reviewed by:	jhb
2009-10-16 12:00:59 +00:00
Andrew Thompson
290512231a Correct offset calcluation for the NCM implementation.
Submitted by:	HPS
2009-10-15 20:15:29 +00:00
Andrew Thompson
c3139ea6f9 Only poll ukbd if KDB is active.
Submitted by:	HPS
2009-10-15 20:09:27 +00:00
Andrew Thompson
1def609a63 Workaround buggy BIOS code in USB regard. By doing the BIOS to OS handover for
all host controllers at the same time, we avoid problems where the BIOS will
actually write to the USB registers of all the USB host controllers every time
we handover one of them, and consequently reset the OS programmed values.

Submitted by:	avg
Reviewed by:	jhb
2009-10-15 20:07:08 +00:00
John Baldwin
d0c9a29169 Use language more closely resembling English in a panic message.
Pointy hat to:	jhb
Submitted by:	pluknet
2009-10-15 18:51:19 +00:00
John Baldwin
8dfed8b0a1 Style fixes to the function prototypes for bus_alloc_resources() and
bus_release_resources().
2009-10-15 14:55:11 +00:00
John Baldwin
37b8ef16cd Add a facility for associating optional descriptions with active interrupt
handlers.  This is primarily intended as a way to allow devices that use
multiple interrupts (e.g. MSI) to meaningfully distinguish the various
interrupt handlers.
- Add a new BUS_DESCRIBE_INTR() method to the bus interface to associate
  a description with an active interrupt handler setup by BUS_SETUP_INTR.
  It has a default method (bus_generic_describe_intr()) which simply passes
  the request up to the parent device.
- Add a bus_describe_intr() wrapper around BUS_DESCRIBE_INTR() that supports
  printf(9) style formatting using var args.
- Reserve MAXCOMLEN bytes in the intr_handler structure to hold the name of
  an interrupt handler and copy the name passed to intr_event_add_handler()
  into that buffer instead of just saving the pointer to the name.
- Add a new intr_event_describe_handler() which appends a description string
  to an interrupt handler's name.
- Implement support for interrupt descriptions on amd64 and i386 by having
  the nexus(4) driver supply a custom bus_describe_intr method that invokes
  a new intr_describe() MD routine which in turn looks up the associated
  interrupt event and invokes intr_event_describe_handler().

Requested by:	many
Reviewed by:	scottl
MFC after:	2 weeks
2009-10-15 14:54:35 +00:00
John Baldwin
a0f1535205 Fix a sign bug in the handling of nice priorities when computing the
interactive score for a thread.

Submitted by:	Taku YAMAMOTO  taku of tackymt.homeip.net
Reviewed by:	jeff
MFC after:	3 days
2009-10-15 11:41:12 +00:00
Qing Li
93704ac5d7 This patch fixes the following issues in the ARP operation:
1. There is a regression issue in the ARP code. The incomplete
   ARP entry was timing out too quickly (1 second timeout), as
   such, a new entry is created each time arpresolve() is called.
   Therefore the maximum attempts made is always 1. Consequently
   the error code returned to the application is always 0.
2. Set the expiration of each incomplete entry to a 20-second
   lifetime.
3. Return "incomplete" entries to the application.

Reviewed by:	kmacy
MFC after:	3 days
2009-10-15 06:12:04 +00:00
Weongyo Jeong
941da6d392 fixes a TX hang that could be possible to happen when the trasfers are
in the high speed that some drivers don't call if_start callback after
marking ~IFF_DRV_OACTIVE.

MFC after:	3 days
2009-10-14 20:30:27 +00:00
Weongyo Jeong
db63fc93cc fixes a TX hang bug that it could happen when if_start callback didn't
be restarted by full of the output queue.

MFC after:	3 days
Tested by:	bsduser <bsd at acd.homelinux.org>
2009-10-14 20:09:09 +00:00
Robert Noland
e80d42dda2 Set the active flag in the PMBR when we install bootcode on a GPT
partitioned disk.  Some BIOS require this to be set before they will
boot the device.

Approved by:	marcel
MFC after:	2 weeks
2009-10-14 19:24:01 +00:00
John Baldwin
a944fb4cc3 Use zfs_read() instead of xfsread() to read /boot.config. xfsread() fails
short read requests, so the result was that a /boot.config smaller than 512
bytes was ignored.  boot2 uses fsread() instead of xfsread() to read
/boot.config already, so this makes zfsboot more like boot2.

Submitted by:	Johny Mattsson  johny-freebsd of earthmagic org
Reviewed by:	dfr
MFC after:	3 days
2009-10-14 14:13:42 +00:00
Bjoern A. Zeeb
14c129fc3e Explicitly compare to a return code.
Discussed with:	philip (after we both misread the logic there the 1st time)
MFC after:	6 weeks
2009-10-14 12:01:11 +00:00
Bjoern A. Zeeb
382e8b5ad9 Unbreak the VIMAGE build with IPSEC, broken with r197952 by
virtualizing the pfil hooks.
For consistency add the V_ to virtualize the pfil hooks in here as well.

MFC after:	55 days
X-MFC after:	julian MFCed r197952.
2009-10-14 11:55:55 +00:00
Bjoern A. Zeeb
852da713c3 Compare pointer to NULL rather than 0.
MFC after:	1 month
2009-10-13 20:29:14 +00:00
Bjoern A. Zeeb
44b636910b Immediately after clearing a pending callout that didn't make it due
to the lock we hold, disable interrupts, and announce to the firmware
that we are shutting down. Especially do this before disabling blocks.

This makes some types of machines with asf enabled no longer hang upon
boot, when we start configuring the interface.

PR:			i386/96382, kern/100410, kern/122252, kern/116328
Reported by:		erwin
Hardware provided by:	TDC A/S
Reviewed by:		stas
Tested by:		stas
2009-10-13 20:22:12 +00:00
John Baldwin
b675ebba10 Sync with other GENERIC kernel configs:
- Move USB serial drivers earlier to match their placement in other kernel
  configs.
- Add descriptions to various USB drivers.
- Move the USB wireless drivers into a new section.
- Add ulscom to the list of USB serial drivers.
2009-10-13 19:04:01 +00:00
John Baldwin
55b6a401ef Move the USB wireless drivers down into their own section next to the USB
ethernet drivers.

Submitted by:	Glen Barber  glen.j.barber @ gmail
MFC after:	1 month
2009-10-13 19:02:03 +00:00
John Baldwin
5c1f214c37 Fix this module so it at least builds. Note that it isn't hooked up to
the build however, and ubser(4) is also not present in any kernel configs
(including NOTES).
2009-10-13 18:07:56 +00:00
John Baldwin
9599da5de8 Correct a copy/paste bug in a comment. lptclose() checks once a second to
see if the ppc hardware has gone idle rather than four times a second.
2009-10-13 12:23:28 +00:00
Rui Paulo
fe1b9e2ada Properly initialize the mesh conf capabilities byte.
MFC after:	2 days
2009-10-13 10:43:17 +00:00
Robert Watson
03ce247827 EXPORT_SYMS is not, in fact, required, for a dependent module to access
non-static symbols in a module they depend on, so remove dtrace symbols
from nfsclient's EXPORT_SYMS again.

Suggested by:	jhb
2009-10-13 09:21:20 +00:00
Hiroki Sato
aea0c7f367 Fix the 106/109 USB Japanese keyboard "underscore" issue.
Sun Type 6 USB keyboard support added in rev 1.46 conflicted with
some scan codes used in Japanese keyboards because the scan code
conversion routine was ambiguous for the overlapped codes.

PR:		ports/134005
Submitted by:	YAMASHIRO Jun
2009-10-12 19:19:08 +00:00
Robert Watson
99b5e2f1d2 Export DTrace symbols from nfsclient so that dtnfsclient can get to them.
This fixes DTrace with nfsclient built as a module.

MFC after:	3 days
Reported by:	markm
2009-10-12 18:59:31 +00:00
Robert Watson
4347e9fd66 Add a MODULE_DEPEND() on the NFS client from dtnfsclient so that dtnfsclient
can access NFS client symbols.

MFC after:	3 days
Discussed with:	kib
Reported by:	markm
2009-10-12 18:58:42 +00:00
Hiroki Sato
27f13d5d0f - Do not assign a link-local address when ND6_IFF_IFDISABLED.
Adding a tentative address is useless.

- Comment out a confused warning message when
  in6_ifattach_linklocal() fails.  This can occur when the
  interface does not support ioctl(SIOCAIFADDR) (interfaces
  associated with 802.11 wireless network device drivers, for
  example).
2009-10-12 18:54:02 +00:00
Joseph Koshy
8b5adf9dd9 Improve the description of sysctl "kern.sugid_coredump".
Submitted by:	Mel Flynn <mel.flynn+fbsd.hackers at mailing.thruhere.net>
		on -hackers
2009-10-12 15:49:48 +00:00
Rui Paulo
f78595fa10 Fix a wrong initialization that snuck in the latest commit.
MFC after:	3 days
2009-10-12 10:30:15 +00:00
Konstantin Belousov
7df8f6ab6f Fix typo.
Submitted by:	rdivacky
MFC after:	1 month
2009-10-12 10:09:48 +00:00
Rui Paulo
6b8c18292c Another 3.03 draft bit that I missed in the previous 802.11s stack
update. The Mesh Configuration IE has changed quite a bit. Refactor the
code to handle this change.

MFC after:	3 days
2009-10-12 10:08:58 +00:00
Marcel Moolenaar
bbaa712c0f Scan for option ROMs on i386 and amd64 only. 2009-10-11 20:42:26 +00:00
Konstantin Belousov
6b286ee8b5 Currently, when signal is delivered to the process and there is a thread
not blocking the signal, signal is placed on the thread sigqueue. If
the selected thread is in kernel executing thr_exit() or sigprocmask()
syscalls, then signal might be not delivered to usermode for arbitrary
amount of time, and for exiting thread it is lost.

Put process-directed signals to the process queue unconditionally,
selecting the thread to deliver the signal only by the thread returning
to usermode, since only then the thread can handle delivery of signal
reliably. For exiting thread or thread that has blocked some signals,
check whether the newly blocked signal is queued for the process, and
try to find a thread to wakeup for delivery, in reschedule_signal(). For
exiting thread, assume that all signals are blocked.

Change cursig() and postsig() to look both into the thread and process
signal queues. When there is a signal that thread returning to usermode
could consume, TDF_NEEDSIGCHK flag is not neccessary set now. Do
unlocked read of p_siglist and p_pendingcnt to check for queued signals.

Note that thread that has a signal unblocked might get spurious wakeup
and EINTR from the interruptible system call now, due to the possibility
of being selected by reschedule_signals(), while other thread returned
to usermode earlier and removed the signal from process queue. This
should not cause compliance issues, since the thread has not blocked a
signal and thus should be ready to receive it anyway.

Reported by:	Justin Teller <justin.teller gmail com>
Reviewed by:	davidxu, jilles
MFC after:	1 month
2009-10-11 16:49:30 +00:00
Nathan Whitehorn
a8211b27b9 Correct another typo. Actually save the condition register instead
of overwriting r12 by mistake.
2009-10-11 16:44:58 +00:00
Nathan Whitehorn
b70b3ebfdd Correct a typo here and actually save DSISR instead of overwriting it. 2009-10-11 16:41:39 +00:00
Michael Tuexen
f71e78a1d9 Fix a race condition where a mutex was destroyed while sleeping on it.
Found while analyzing a report from julian. It might fix his bug.
Approved by: rrs (mentor)
MFC after: 3 days
2009-10-11 12:23:56 +00:00
Xin LI
82cf92d483 Add locking around access to parent node, and bail out when the parent
node is already freed rather than panicking the system.

PR:		kern/122038
Submitted by:	gk
Tested by:	pho
MFC after:	1 week
2009-10-11 07:03:56 +00:00
Julian Elischer
0b4b0b0fee Virtualize the pfil hooks so that different jails may chose different
packet filters. ALso allows ipfw to be enabled on on ejail and disabled
on another. In 8.0 it's a global setting.

Sitting aroung in tree waiting to commit for: 2 months
MFC after:	2 months
2009-10-11 05:59:43 +00:00
Robert Noland
33cba7feac Add support for Intel G41 chipset
Submitted by:	Artyom Mirgorodsky <man@email.com.ua>
MFC after:	3 days
2009-10-11 01:54:00 +00:00
Robert Noland
2d52bcc46b Add pci id's for Intel G41 chipset
Submitted by:	Artyom Mirgorodsky <man@email.com.ua>
MFC after:	3 days
2009-10-11 01:51:35 +00:00
Rui Paulo
4eaee90e39 Atheros EEPROM version 4K. This version is mostly based on version 1.4.
This is needed by the upcoming AR9285 support.
Information on the layout gathered from Linux ath9k.

Not yet connected to the build.

Tested by:	Eugeny Dzhurinsky
2009-10-10 22:29:34 +00:00
Edward Tomasz Napierala
7c3a3fbe95 Orphaning provider with EXDEV seems weird; perhaps the author meant
ENXIO here?
2009-10-10 21:49:04 +00:00
Konstantin Belousov
6728dc169d Refine r195509, instead of checking that vnode type is VBAD, that is
set quite late in the revocation path, properly verify that vnode is
not doomed before calling VOP.

Reported and tested by:	Harald Schmalzbauer <h.schmalzbauer omnilan de>
MFC after:	3 days
2009-10-10 21:17:30 +00:00
Konstantin Belousov
ab02d85f0d Map PIE binaries at non-zero base address.
Discussed with:	bz
Reviewed by:	kan
Tested by:	bz (i386, amd64), bsam (linux)
MFC after:	some time
2009-10-10 15:33:01 +00:00
Konstantin Belousov
023063938a Define architectural load bases for PIE binaries. Addresses were selected
by looking at the bases used for non-relocatable executables by gnu ld(1),
and adjusting it slightly.

Discussed with:	bz
Reviewed by:	kan
Tested by:	bz (i386, amd64), bsam (linux)
MFC after:	some time
2009-10-10 15:31:24 +00:00
Konstantin Belousov
5b33842a9b Do not map segments of zero length.
Discussed with:	bz
Reviewed by:	kan
Tested by:	bz (i386, amd64), bsam (linux)
MFC after:	some time
2009-10-10 15:28:52 +00:00
Konstantin Belousov
47d81c1b70 Postpone dropping fp till both kq_global and kqueue mutexes are
unlocked. fdrop() closes file descriptor when reference count goes to
zero. Close method for vnodes locks the vnode, resulting in "sleepable
after non-sleepable". For pipes, pipe mutex is before kqueue lock,
causing LOR.

Reported and tested by:	pho
MFC after:	2 weeks
2009-10-10 14:56:34 +00:00
Michael Tuexen
45623593fb Correct include order as indicated by bz.
Approved by: re (mentor)
MFC after: 3 days
2009-10-10 13:59:18 +00:00
Ermal Luçi
200b56607f Fix typo which has survived amazingly long!
Approved by:	mlaier(mentor)
MFC after:	3 days
2009-10-10 03:32:46 +00:00
Michael Tuexen
3b1de911e0 Do not include vnet.h twice.
Approved by: rrs (mentor)
MFC after: 3 days
2009-10-09 19:30:23 +00:00
Attilio Rao
8448afced8 atomic_cmpset_barr_* was added in order to cope with compilers willing to
specify their own version of atomic_cmpset_* which could have been
different than the membar version.

Right now, however, FreeBSD is bound mostly to GCC-like compilers and
it is desired to add new support and compat shim mostly when there is
a real necessity, in order to avoid too much compatibility bloats.

In this optic, bring back atomic_cmpset_{acq, rel}_* to be the same as
atomic_cmpset_* and unwind the atomic_cmpset_barr_* introduction.

Requested by:	jhb
Reviewed by:	jhb
Tested by:	Giovanni Trematerra <giovanni dot trematerra at
		gmail dot com>
2009-10-09 15:51:40 +00:00
Pawel Jakub Dawidek
f8727e71d7 If provider is open for writing when we taste it, skip it for classes that
depend on on-disk metadata. This was we won't attach to providers that are used
by other classes. For example we don't want to configure partitions on da0 if
it is part of gmirror, what we really want is partitions on mirror/foo.

During regular work it works like this: if provider is open for writing a class
receives the spoiled event from GEOM and detaches, once provider is closed the
taste event is send again and class can rediscover its metadata if it is still
there.  This doesn't work that way when new class arrives, because GEOM gives
all existing providers for it to taste, also those open for writing. Classes
have to decided on their own if they want to deal with such providers (eg.
geom_dev) or not (classes modified by this commit).

Reported by:	des, Oliver Lehmann <lehmann@ans-netz.de>
Tested by:	des, Oliver Lehmann <lehmann@ans-netz.de>
Discussed with:	phk, marcel
Reviewed by:	marcel
MFC after:	3 days
2009-10-09 09:42:22 +00:00
Pawel Jakub Dawidek
9cdcd1c520 Export disk serial numbers for adaX disks.
Reviewed by:	mav
MFC after:	3 days
2009-10-09 09:29:59 +00:00
Michael Tuexen
9dd512290c Use correct arguments when calling SCTP_RTALLOC().
Approved by: rrs (mentor)
MFC after: 0 days
2009-10-08 20:33:12 +00:00
Jung-uk Kim
a7e2341e20 Clean up amd64 suspend/resume code.
- Allocate memory for wakeup code after ACPI bus is attached.  The early
memory allocation hack was inherited from i386 but amd64 does not need it.
- Exclude real mode IVT and BDA explicitly.  Improve comments about memory
allocation and reason for the exclusions.  It is a no-op in reality, though.
- Remove an unnecessary CLD from wakeup code and re-align.
2009-10-08 17:41:53 +00:00
Pawel Jakub Dawidek
c217b20ef6 Allow file system owner to modify system flags if securelevel permits.
MFC after:	3 days
2009-10-08 16:05:17 +00:00
Pawel Jakub Dawidek
68c53ef849 File system owner is when uid matches and jail matches.
MFC after:	3 days
2009-10-08 16:03:19 +00:00
Randall Stewart
806a5b8414 Fix so that round robing stream scheduling works as advertised
MFC after:	0 days
2009-10-08 11:36:06 +00:00
Ed Schouten
4a11e7f142 Discard Device Control Strings and Operating System Commands.
These strings often contain things like:

- Window titles.
- Extended key map functionality.
- Color palette switching.

We could look at these features in the future (if people consider them
to be important enough), but we'd better discard them now. This fixes
some artifacts people reported when using TERM=xterm.

Reported by:	des@, Paul B. Mahol
2009-10-08 10:26:49 +00:00
Xin LI
3fa0694aaa Add a special workaround to handle UIO_NOCOPY case. This fixes data
corruption observed when sendfile() is being used.

PR:		kern/127213
Submitted by:	gk
MFC after:	2 weeks
2009-10-07 23:17:15 +00:00
Pawel Jakub Dawidek
3a6c0cbf26 On FreeBSD it is enough to report provider removal when orphan event is
received, we don't have to do it on every ENXIO error in I/O path.
Solaris has no GEOM so they have to handle it in a less clean way.

MFC after:	3 days
2009-10-07 20:56:15 +00:00
Pawel Jakub Dawidek
2ada529a14 Fix white-spaces.
MFC after:	3 days
2009-10-07 20:54:07 +00:00
Robert Watson
44a43f00ed Add a new errno, ENOTCAPABLE, to be returned when a process requests an
operation on a file descriptor that is not authorized by the descriptor's
capability flags.

MFC after:	1 month
Sponsored by:	Google
2009-10-07 20:20:51 +00:00
Zachary Loafman
fbaa591f50 Handle GRANTED_RES messages more gracefully: Send along a grant cookie
to reference the lock, look up the grant cookie when the GRANTED_RES
comes back. Properly handle the case of an error on the grant. Add a
short expiration window so that granted locks are not freed immediately.

Approved by:        dfr (mentor)
MFC after:          2 weeks
2009-10-07 19:50:14 +00:00
Alexander Motin
660d482a4e On command timeout handle frozen command first, to not run it inside
XXX_end_transaction().

Submitted by:	avg
2009-10-07 15:40:04 +00:00
Stanislav Sedov
3889907fb2 - Give a name to the host coalescing bug fix WDMA mode register bit instead
of using hardcoded value in the code.
Obtained from:	OpenBSD
2009-10-07 14:29:48 +00:00
Stanislav Sedov
a57795536a - Add support for new BGE chips (5761, 5784 and 57780). These chips uses new
BGE_PCI_PRODID_ASICREV register to store the chip identifier and its revision.
- Add new grouping macro for 7575+ chips (BGE_IS_5755_PLUS).
- Add IDs for Fujitsu-branded Broadcom adapters.

PR:             kern/127587
Tested by:      Thomas Quinot <thomas@quinot.org> (BCM7561 A0)
MFC after:	2 weeks
Obtained from:  OpenBSD
2009-10-07 13:12:43 +00:00
Pawel Jakub Dawidek
c0103003c0 Fix situation where Mac OS X NFS client creates a file and when it tries
to set ownership and mode in the same setattr operation, the mode was
overwritten by secpolicy_vnode_setattr().

PR:		kern/118320
Submitted by:	Mark Thompson <info-gentoo@mark.thompson.bz>
MFC after:	3 days
2009-10-07 12:38:19 +00:00
Attilio Rao
d9492a4483 - All the functions in atomic.h needs to be in "physical" form (like
not defined through macros or similar) in order to be later compiled in
  the kernel and offer this way the support for modules (and
  compatibility among the UP case and SMP case).
  Fix this for the newly introduced atomic_cmpset_barr_* cases by defining
  and specifying a template.  Note that the new DEFINE_CMPSET_GEN()
  template save more typing on amd64 than the current code. [1]
- Fix the style for memory barriers on amd64.

[1] Reported by:	Paul B. Mahol <onemda at gmail dot com>
2009-10-06 23:48:28 +00:00
Kip Macy
e6b112e274 Prevent paging pressure from draining arc too much
- always drain arc if above arc_c_max - never drain arc if arc is below arc_c_max

MFC after:	3 days
2009-10-06 21:40:50 +00:00
Robert Watson
f681a5fdd4 Remove tcp_input lock statistics; these are intended for debugging only
and are not intended to ship in 8.0 as they dirty additional cache
lines in a performance-critical per-packet path.

MFC after:	3 days
2009-10-06 20:35:41 +00:00
Attilio Rao
86d2e48c22 Per their definition, atomic instructions used in conjuction with
memory barriers should also ensure that the compiler doesn't reorder paths
where they are used.  GCC, however, does that aggressively, even in
presence of volatile operands.  The most reliable way GCC offers for avoid
instructions reordering is clobbering "memory" even if that is
theoretically an heavy-weight operation, flushing the content of all
the registers and forcing reload of them (We could rely, however, on
gcc DTRT by just understanding the purpose as this is a well-known
pattern for many modern operating-systems).

Not all our memory barriers, right now, clobber memory for GCC-like
compilers. The most notable cases are IA32 and amd64 where the memory
barrier are treacted the same as normal atomic instructions.
Fix this by offering the possibility to implement atomic instructions
with memory barriers separately from the normal version and implement
the GCC-like specific one using memory clobbering.
Thanks to Chris Lattner (@apple) for his discussion on llvm specifics.

Reported by:	jhb
Reviewed by:	jhb
Tested by:	rdivacky, Giovanni Trematerra
		<giovanni dot trematerra at gmail dot com>
2009-10-06 13:45:49 +00:00
Robert Watson
883e9bc41d In tcp_input(), we acquire a global write lock at first only if a
segment is likely to trigger a TCP state change (i.e., FIN/RST/SYN).
If we later have to upgrade the lock, we acquire an inpcb reference
and drop both global/inpcb locks before reacquiring in-order.  In
that gap, the connection may transition into TIMEWAIT, so we need
to loop back and reevaluate the inpcb after relocking.

MFC after:	3 days
Reported by:	Kamigishi Rei <spambox at haruhiism.net>
Reviewed by:	bz
2009-10-05 22:24:13 +00:00
Robert Watson
604f19c91e Fix build on amd64, where sysctl arg1 is a pointer.
Reported by:	Mr Tinderbox
MFC after:	3 months
2009-10-05 22:23:12 +00:00
Navdeep Parhar
c01f2b8301 cxgb(4) updates, including:
- support for the new Gen-2, BT, and LP-CR cards.
- T3 firmware 7.7.0
- shared "common code" updates.

Approved by:	gnn (mentor)
Obtained from:	Chelsio
MFC after:	1 month
2009-10-05 20:21:41 +00:00
Edward Tomasz Napierala
d5e0b21541 Fix NFSv4 ACLs on sparc64. Turns out that fuword(9) fetches 64 bits
instead of sizeof(int), and on sparc64 that resulted in fetching wrong
value for acl_maxcnt, which in turn caused __acl_get_link(2) to fail
with EINVAL.

PR:		sparc64/139304
Submitted by:	Dmitry Afanasiev <KOT at MATPOCKuH.Ru>
2009-10-05 19:56:56 +00:00
Jung-uk Kim
b6e6000971 - Revert r191568 partially. Forcing AHCI mode by changing device subclass
and progif is evil.  It doesn't work reliably[1] and we should honor BIOS
configuration by the user.
- If the SATA controller is enbled but combined mode is disabled, mask off
the emulated IDE channel on the legacy IDE controller.

Pointed out by:	mav[1]
2009-10-05 16:26:54 +00:00
Robert Watson
84d61770bc First cut at implementing SOCK_SEQPACKET support for UNIX (local) domain
sockets.  This allows for reliable bi-directional datagram communication
over UNIX domain sockets, in contrast to SOCK_DGRAM (M:N, unreliable) or
SOCK_STERAM (bi-directional bytestream).  Largely, this reuses existing
UNIX domain socket code.  This allows applications requiring record-
oriented semantics to do so reliably via local IPC.

Some implementation notes (also present in XXX comments):

- Currently we lack an sbappend variant able to do datagrams and control
  data without doing addresses, so we mark SOCK_SEQPACKET as PR_ADDR.
  Adding a new variant will solve this problem.

- UNIX domain sockets on FreeBSD provide back-pressure/flow control
  notification for stream sockets by manipulating the send socket
  buffer's size during pru_send and pru_rcvd.  This trick works less well
  for SOCK_SEQPACKET as sosend_generic() uses sb_hiwat not just to
  manage blocking, but also to determine maximum datagram size.  Fixing
  this requires rethinking how back-pressure is done for SOCK_SEQPACKET;
  in the mean time, it's possible to get EMSGSIZE when buffers fill,
  instead of blocking.

Discussed with:	benl
Reviewed by:	bz, rpaulo
MFC after:	3 months
Sponsored by:	Google
2009-10-05 14:49:16 +00:00
John Baldwin
432e1942d2 When the timeout backoff hits the maximum value, leave it capped at the
maximum value rather than setting it to the result of a boolean expression
that is always true.

Submitted by:	Joseph Kong
MFC after:	1 month
2009-10-05 14:13:16 +00:00
Stanislav Sedov
2c7cd48d3c - Drop unused pmap_use_l1 function and comment out currently unused
pmap_dcache_wbinv_all/pmap_copy_page functions which we might want
  to take advatage of later.  This fixes the build with PMAP_DEBUG
  defined.

Discussed with:	cognet
2009-10-05 10:08:58 +00:00
Ulf Lilleengen
a8a3cd7d9d - Improve error message consistency and wording. 2009-10-05 08:44:31 +00:00
Weongyo Jeong
f8b51ca5e9 updates device entries supported with the product name not magic numbers
and sorts entries.  WUSB54GCV2 is added.

Obtained from:	OpenBSD
2009-10-04 23:30:08 +00:00
Alan Cox
e67e0775e6 Align and pad the page queue and free page queue locks so that the linker
can't possibly place them together within the same cache line.

MFC after:	3 weeks
2009-10-04 18:53:10 +00:00
Xin LI
7441ac4618 Fix a bug that causes the fsx test case of mmap'ed page being out of sync
of read/write, inspired by ZFS's counterpart.

PR:		kern/139312
Submitted by:	gk@
MFC after:	1 week
2009-10-04 10:38:04 +00:00
Attilio Rao
7f9f80ce03 When releasing a lockmgr held in shared way we need to use a write memory
barrier in order to avoid, on architectures which doesn't have strong
ordered writes, CPU instructions reordering.

Diagnosed by:	fabio
2009-10-03 15:02:55 +00:00
Rui Paulo
bba017d6a0 Remove remaining bits of performance counter support.
Submitted by:	Tom Judge <tom at tomjudge.com>
2009-10-03 13:59:15 +00:00
Yoshihiro Takahashi
057b3c8c60 unifdef NFSCLIENT because the nlm depends on the nfsclient even if NFSCLIENT
is not defined.

Now the nfslockd module works with the nfsclient module.

Reviewed by:	kib
MFC after:	3 days
2009-10-03 12:22:12 +00:00
Bjoern A. Zeeb
52bf2041ac Make sure that the primary native brandinfo always gets added
first and the native ia32 compat as middle (before other things).
o(ld)brandinfo as well as third party like linux, kfreebsd, etc.
stays on SI_ORDER_ANY coming last.

The reason for this is only to make sure that even in case we would
overflow the MAX_BRANDS sized array, the native FreeBSD brandinfo
would still be there and the system would be operational.

Reviewed by:	kib
MFC after:	1 month
2009-10-03 11:57:21 +00:00
Bjoern A. Zeeb
db44ff4047 Put #ifdef INET around parts of the FLOWTABLE code, to unbreak
nooptions INET kernel builds.

MFC after:	3 days
X-MFC:		with r197687
2009-10-03 10:56:03 +00:00
Bjoern A. Zeeb
925c8b5b04 Print a warning in case we cannot add more brandinfo because
we would overflow the MAX_BRANDS sized array.

Reviewed by:	kib
MFC After:	1 month
2009-10-03 10:50:00 +00:00
Marcel Moolenaar
0acb3c4aac Fix RTS/CTS flow control, broken by the TTY overhaul. The new TTY
interface is fairly simple WRT dealing with flow control, but
needed 2 new RX buffer functions with "get-char-from-buf" separated
from "advance-buf-pointer" so that the pointer could be advanced
only when ttydisc_rint() succeeded.

MFC after:	1 week
2009-10-02 22:30:44 +00:00
Robert Watson
afd8e45b45 Don't comment on stream socket handling in sosend_dgram, since that's
not handled.

MFC after:	3 weeks
2009-10-02 21:31:15 +00:00
Bjoern A. Zeeb
fc50832731 Back out the functional parts from r197537. After r197711, affecting all
user mappings, mmap no longer needs special treatment.
2009-10-02 17:51:46 +00:00
Bjoern A. Zeeb
878adb8517 Add a mitigation feature that will prevent user mappings at
virtual address 0, limiting the ability to convert a kernel
NULL pointer dereference into a privilege escalation attack.

If the sysctl is set to 0 a newly started process will not be able
to map anything in the address range of the first page (0 to PAGE_SIZE).
This is the default. Already running processes are not affected by this.

You can either change the sysctl or the tunable from loader in case
you need to map at a virtual address of 0, for example when running
any of the extinct species of a set of a.out binaries, vm86 emulation, ..
In that case set security.bsd.map_at_zero="1".

Superseeds:		r197537
In collaboration with:	jhb, kib, alc
2009-10-02 17:48:51 +00:00
Yoshihiro Takahashi
a38f6f86d2 Fix build nfscl and/or nfsd.
MFC after:	3 days
2009-10-02 12:47:01 +00:00
Rui Paulo
f49e371d3b Reserve numbers for XScale.
Reviewed by:	jkoshy
2009-10-02 11:14:12 +00:00
Rui Paulo
f143a35bf1 Remove performance counter headers. This code came from NetBSD, but our
hardware perf. counter support is different, so we don't need these
files.

Reviewed by:	freebsd-arm (no comments)
2009-10-02 11:10:05 +00:00
Hiroki Sato
d7caaef2e5 Enable adding a link-local address even if ND6_IFF_IFDISABLED.
Note that when the interface has ND6_IFF_IFDISABLED, a newly-added
address is always marked as IN6_IFF_TENTATIVE so that the interface
can perform DAD after the ND6_IFF_IFDISABLED is cleared.
2009-10-02 07:00:20 +00:00
Qing Li
b4a22c365c Remove a log message from production code. This log message can be
triggered by a misconfigured host that is sending out gratuious ARPs.
This log message can also be triggered during a network renumbering
event when multiple prefixes co-exist on a single network segment.

MFC after:	immediately
2009-10-02 01:45:11 +00:00
Qing Li
fa3cfd39ff Previously, if an address alias is configured on an interface, and
this address alias has a prefix matching that of another address
configured on the same interface, then the ARP entry for the alias
is not deleted from the ARP table when that address alias is removed.
This patch fixes the aforementioned issue.

PR:		kern/139113
MFC after:	3 days
2009-10-02 01:34:55 +00:00
Kip Macy
46aba52a50 make read_eflags and write_eflags accomplish the same effect on PVM as native,
simplifying interrupt handling
2009-10-01 22:05:38 +00:00
Ed Maste
e380cc73ed In fill_kinfo_thread, copy the thread's name into struct kinfo_proc even
if it is empty.  Otherwise the previous thread's name would remain in the
struct and then be reported for this thread.

Submitted by:	Ryan Stone
MFC after:	1 week
2009-10-01 21:44:30 +00:00
Jung-uk Kim
165a00d1de Compile ACPI debugger and disassembler for kernel modules unconditionally.
These files will generate almost empty object files without ACPI_DEBUG/DDB
options.  As a result, size of acpi.ko will increase slightly.
2009-10-01 20:56:15 +00:00
Qing Li
e5c610d659 The flow-table associates TCP/UDP flows and IP destinations with
specific routes. When the routing table changes, for example,
when a new route with a more specific prefix is inserted into the
routing table, the flow-table is not updated to reflect that change.
As such existing connections cannot take advantage of the new path.
In some cases the path is broken. This patch will update the affected
flow-table entries when a more specific route is added. The route
entry is properly marked when a route is deleted from the table.
In this case, when the flow-table performs a search, the stale
entry is updated automatically. Therefore this patch is not
necessary for route deletion.

Submitted by:	simon, phk
Reviewed by:	bz, kmacy
MFC after:	3 days
2009-10-01 20:32:29 +00:00
John Baldwin
3538cf0cbe Put square backets ([]) around process names for system processes to patch
the behavior of ps(1).
2009-10-01 19:12:14 +00:00
Xin LI
6f62807611 Return EOPNOTSUPP instead of EINVAL when doing chflags(2) over an old
format ZFS, as defined in the manual page.

Submitted by:	pjd (response of my original patch but bugs are mine)
MFC after:	3 days
2009-10-01 18:58:26 +00:00
Andrew Thompson
c8a14b9124 EHCI Hardware BUG workaround
The EHCI HW can use the qtd_next field instead of qtd_altnext when a short
packet is received. This contradicts what is stated in the EHCI datasheet.
Also the total-bytes field in the status field of the following TD gets
corrupted upon reception of a short packet!  We work this around in software by
not queueing more than one job/TD at a time of up to 16Kbytes! The bug has been
seen on multiple INTEL based EHCI chips.  Other vendors have not been tested
yet.

- Applications using /dev/usb/X.Y.Z, where Z is non-zero are affected, but not
  applications using LibUSB v0.1, v1.2 and v2.0.
- Mass Storage (umass) is affected.

Submitted by:	Hans Petter Selasky
MFC after:	3 days
2009-10-01 18:37:16 +00:00
Edward Tomasz Napierala
2c29cfa083 Provide default implementation for VOP_ACCESS(9), so that filesystems which
want to provide VOP_ACCESSX(9) don't have to implement both.  Note that
this commit makes implementation of either of these two mandatory.

Reviewed by:	kib
2009-10-01 17:22:03 +00:00
VANHULLEBUS Yvan
a45bff047c Changed an IPSEC_ASSERT to a simple test, as such invalid packets
may come from outside without being discarded before.

Submitted by:	aurelien.ansel@netasq.com
Reviewed by:	bz (secteam)
Obtained from:	NETASQ
MFC after:	1m
2009-10-01 15:33:53 +00:00
Konstantin Belousov
b02395c64d As a workaround, for Intel CPUs, do not use CLFLUSH in
pmap_invalidate_cache_range() when self-snoop is apparently not reported
in cpu features. We get a reserved trap when clflushing APIC registers
window.

XEN in full system virtualization mode removes self-snoop from CPU
features, making this a problem.

Tested by:	csjp
Reviewed by:	alc
MFC after:	3 days
2009-10-01 12:52:48 +00:00
Konstantin Belousov
75ffdc4049 Do not dereference vp->v_mount without holding vnode lock and checking
that the vnode is not reclaimed.

Noted by:	Igor Sysoev <is rambler-co ru>
MFC after:	1 week
2009-10-01 12:50:26 +00:00
Konstantin Belousov
6fecb26b6b Move the annotation for vm_map_startup() immediately before the function.
MFC after:	3 days
2009-10-01 12:48:35 +00:00
Konstantin Belousov
15b7a831df Fix typo.
MFC after:	3 days
2009-10-01 12:46:58 +00:00
Coleman Kane
00e6b158be Fix a bad use of NULL instead of zero for int comparison. Sorry for the
breakage.

Submitted by:	bz, des, onemda
MFC after:	3 days
2009-10-01 11:52:06 +00:00
Andriy Gapon
7e936cef34 print machine in kernel boot version string
Discussed with:	gavin, kib, jhb
PR:		kern/126926
MFC after:	2 weeks
2009-10-01 10:53:12 +00:00
Yoshihiro Takahashi
eb8d03079d MFi386: revision 197653
Improve 802.11s comment.

MFC after:	1 day
2009-10-01 10:46:22 +00:00
Coleman Kane
ed44e7ec7d style(9) fixes (always compare pointers to NULL)
Also, the previous commit to sys/dev/if_ndis/if_ndis.c also included the
removal of a call to ndis_setstate_80211 that is no longer needed.

Submitted by:	sam
MFC after:	3 days
2009-10-01 02:43:51 +00:00
Rui Paulo
c16c6b65da Improve 802.11s comment.
Spotted by:	dougb
MFC after:	1 day
2009-10-01 02:08:42 +00:00
Edward Tomasz Napierala
5aea82db46 Fix typo in the comment. 2009-09-30 18:50:50 +00:00
John Baldwin
146672474f Do not hold the ACPI A/C adapter lock when changing the power profile.
MFC after:	2 weeks
2009-09-30 17:07:49 +00:00
John Baldwin
0032eb1acb Split the 'video' ACPI lock up into two locks to resolve a LOR with the
sysctl lock.  The 'video' lock now protects the 'bus' of video output
devices attached to a graphics adapter.  It is used when iterating over
the list of outputs, etc.  The 'video_output' lock is used to lock the
output-specific data similar to a driver lock for the individual video
outputs.

MFC after:	2 weeks
2009-09-30 17:05:26 +00:00
Andriy Gapon
beb2c1f3e9 cpufunc.h: unify/correct style of c extension names
i386 and amd64 archs only.
inline => __inline. [1]
__asm__ => __asm. [2]

Reviewed by:	kib, jhb [1]
Suggested by:	kib [2]
MFC after:	1 week
2009-09-30 16:34:50 +00:00
Andrew Gallatin
83d54b590f Two more mxge watchdog fixes:
1) Restore the PCI Express control register after a watchdog
   reset.  This is required because the device will come out
   of watchdog reset with the pectl reg at its default state,
   and important BIOS configuration (like max payload size)
   could be lost.

2) Call mxge_start_locked() for every tx queue before dropping
   the lock in the watchdog handler.   This is required, as
   the queue's buf ring may have filled during the reset.
2009-09-30 14:42:06 +00:00
Coleman Kane
d63581ec39 Correct a bug that could lead to a kernel panic if a user attempted to
perform 802.11 operations directly on the ndis0 interface before the
first VAP (wlan0) had been created. This would lead to a NULL-pointer
dereference in the kernel.

Submitted by:	Paul B. Mahol <onemda@gmail.com>
MFC after:	3 days
2009-09-30 14:28:38 +00:00
Attilio Rao
ddce63ca73 When releasing a read/shared lock we need to use a write memory barrier
in order to avoid, on architectures which doesn't have strong ordered
writes, CPU instructions reordering.

Diagnosed by:	fabio
Reviewed by:	jhb
Tested by:	Giovanni Trematerra
		<giovanni dot trematerra at gmail dot com>
2009-09-30 13:26:31 +00:00
Andriy Gapon
78edb09e67 print_caddr_t: drop incorrect __unused attribute from parameter
seems like a purely cosmetic change

Reviewed by:	jhb, kib
MFC after:	1 week
2009-09-30 11:14:13 +00:00
Alexander Motin
2ad05ba238 Fix typo in previous commit.
Add Realtek ALC887 codec ID.
2009-09-30 11:05:12 +00:00
Robert Watson
718dbcfeaa Regenerate system call files following r197636. 2009-09-30 08:48:59 +00:00
Robert Watson
72c35fc69c Reserve system call numbers for Capsicum security framework capabilities,
capability mode, and process descriptors: cap_new, cap_getrights, cap_enter,
cap_getmode, pdfork, pdkill, pdgetpid, and pdwait.

Obtained from:	TrustedBSD Project
Sponsored by:	Google
MFC after:	3 weeks
2009-09-30 08:46:01 +00:00
Pyun YongHyeon
cb2cdeceb5 Fix multicast handling. All Atheros controllers use big-endian form
in computing multicast hash.

PR:	kern/139137
2009-09-29 23:03:16 +00:00
Robert Watson
b2fc0323ae Add audit events for process descriptor system calls, which will appear in
a future OpenBSM release.

Sponsored by:	Google
Obtained from:	TrustedBSD Project
MFC after:	3 weeks
2009-09-29 21:25:59 +00:00
Alexander Motin
ef0097a6aa Add some bits of HDMI/DisplayPort support from later specification updates.
It may be not enough to make them work, but at least should give some
information about these beasts.
2009-09-29 09:36:38 +00:00
Marcel Moolenaar
b61808630d The first 96 bytes may not be zeroes. It can contain trivial boot
code that merely emits an error and waits for a key press before
rebooting. The error being that extended partitions are not
bootable. The origin is presumed to be Windows 2000; Windows XP
does not do this...

For now, ignore the first 96 bytes when checking that the EBR is
(for the most part) all zeroes.

Tested by:	Mario Lobo <mlobo@digiart.art.br>
MFC after:	1 week
2009-09-28 23:52:47 +00:00
Robert Noland
0893652a8c Fix offset handling
MFC after:	1 week
2009-09-28 22:41:28 +00:00
Robert Noland
3a1f3f56cc radeon_family is an enum, so ordering can be important.
sync up with what amd is shipping.

MFC after:	1 week
2009-09-28 22:40:29 +00:00
Robert Noland
d950002723 Fix blit pitch for 4 byte transfers on r600.
MFC after:	1 week
2009-09-28 22:38:44 +00:00
Robert Noland
0b6c99683c R600 doesn't support IRQs yet, so don't try to use them.
MFC after:	1 week
2009-09-28 22:37:07 +00:00
Pyun YongHyeon
e34135013b For AR8132 fast ethernet controller, do not report 1000baseT
capability to mii(4). Even though AR8132 uses the same model/
revision number of F1 gigabit PHY, the PHY has no ability to
establish 1000baseT link. I have no idea why Atheros use the same
device/model id for this PHY.
With this change atphy(4) does not report 1000baseT media
capability and manual 1000baseT configuration is also disabled
which is more desirable behavior for 10/100Mbps PHY.
2009-09-28 22:18:38 +00:00
Pyun YongHyeon
60d3251abb Add DGE-560SX(Yukon XL) to the supported device list. Many thanks
to "Eugene Perevyazko <john <> dnepro dot net>" who kindly gave
remote access to system with DGE-560SX.
2009-09-28 21:11:31 +00:00
Pyun YongHyeon
cde64af338 Add workaround for Yukon XL which has hardware bug that can't flush
FIFO.
2009-09-28 21:07:19 +00:00
Pyun YongHyeon
fcb62a8b01 Add hack to pass controller specific information to phy driver.
Unlike most other PHYs there is no easy way to know which media
type the PHY supports on Marvell PHYs. MIIF_HAVEFIBER flags is now
passed via bus-specific instance variable of a device. While I'm
here add 88E1112 specific work around to set SIGDET polarity low.
Many thanks "Eugene Perevyazko <john <> dnepro dot net>" who kindly
gave remote access to system with DGE-560SX.
2009-09-28 21:03:28 +00:00
Pyun YongHyeon
40d7192b1c Fix MIB statistics clear routine. This should fix alignment errors on sparc64.
Reported by:	Garrett Damore < gdamore <> opensolaris dot org >
2009-09-28 20:03:37 +00:00
Pyun YongHyeon
1a01dae1b9 Some fiber PHY(88E1112) does not seem to set resolved speed so
always assume we've got IFM_1000_SX.
2009-09-28 19:53:53 +00:00