Commit graph

118504 commits

Author SHA1 Message Date
Alexander Kabaev d11c07ba56 Handle a race condition where NULLFS vnode can be cleaned while threads
can still be asleep waiting for lowervp lock.

Tested by:	kkenn
Discussed with: ssouhlal, jeffr
2005-09-15 19:21:26 +00:00
John Baldwin b27dbfbf4a - Enforce an implicit lock order that Giant cannot be locked while holding
any other non-sleepable lock.  In plain English: Giant comes before all
  other mutexes.
- Add some extra description to the lock order reversal printf's to indicate
  when a reversal is triggered by a hard-coded implicit rule.

Requested by:	truckman (2)
MFC after:	1 week
2005-09-15 19:07:14 +00:00
Ruslan Ermilov 72293673f0 Don't recommend re_detach() (like in vr(4)) as another
possible method to prevent panicing in interrupt handler
after re_shutdown(), sometimes seen on SMP systems.
This would work here only because re_detach() clears
IFF_UP (to prevent another race) and it was demonstrated
that it's not enough to call vr_detach() in vr_shutdown()
to prevent a panic.
2005-09-15 19:07:10 +00:00
John Baldwin 51460da87f - Add a new simple facility for marking the current thread as being in a
state where sleeping on a sleep queue is not allowed.  The facility
  doesn't support recursion but uses a simple private per-thread flag
  (TDP_NOSLEEPING).  The sleepq_add() function will panic if the flag is
  set and INVARIANTS is enabled.
- Use this new facility to replace the g_xup and g_xdown mutexes that were
  (ab)used to achieve similar behavior.
- Disallow sleeping in interrupt threads when invoking interrupt handlers.

MFC after:	1 week
Reviewed by:	phk
2005-09-15 19:05:37 +00:00
John Baldwin b7b51ed01d - Adjust a comment, we do program the performance counter LVT entry now
if hwpmc(4) is included.
- Don't recursively panic if we are unable to send an IPI, just bail and
  hope for the best.

MFC after:	1 week
2005-09-15 19:02:01 +00:00
Ruslan Ermilov 525e6a870e re_detach() fixes:
- Fixed if_free() logic screw-up that can either result
  in freeing a NULL pointer or leaking "struct ifnet".
- Move if_free() after re_stop(); the latter accesses
  "struct ifnet".  This bug was masked by a previous bug.
- Restore the fix for a panic on detach caused by racing
  with BPF detach code by Bill by moving ether_ifdetach()
  after re_stop() and resetting IFF_UP; this got screwed
  up in revs. 1.30 and 1.36.
2005-09-15 18:59:34 +00:00
Giorgos Keramidas 4f867c2d17 When bus_alloc_resource_any() fails, dc_detach() is called and it
attempts to deallocate busdma tags and resources that haven't been
allocated yet, causing a panic every time a dc interface fails to
attach.  Fix by checking that we really have something to dealloc
before calling bus_dma*() functions.

Approved by:	jhb
MFC after:	1 week
2005-09-15 17:51:39 +00:00
John Baldwin f726a87319 Explicitly switch to the new TSS by updating the current CPU's TSS selector
and reloading it in i386_extend_pcb() rather than trying to force a context
switch to reload the TSS via the TDF_NEEDRESCHED flag.  Optimizations to
avoid calling cpu_switch() when the new thread was identical to the old
thread defeated the attempt to force a TSS reload.  Explicitly loading the
new TSS is what we really want to do anyway.

PR:		i386/84842
Reported by:	Alexander Best arundel at h3c dot de
MFC after:	1 week
Reviewed by:	bde (mostly)
2005-09-15 17:30:08 +00:00
Andrey A. Chernov b9fb13f573 Cosmetic fixes to prev. commit.
Change first MAXPATHLEN to more standard PATH_MAX
Change second MAXPATHLEN to 1024 (it is temp buffer not related)
Change comment to reflect that.

Suggested by:   bde
2005-09-15 17:25:52 +00:00
John Baldwin 8d75d3087d - Fixup locking and mark MPSAFE.
- Use callout_init_mtx() and static callouts rather than timeout().
- m_getcl() in one place to simplify the code.

Tested by:	Gavin Atkinson gavin dot atkinson at ury dot york dot ac dot uk
MFC after:	1 week
2005-09-15 17:12:29 +00:00
John Baldwin 8eebae090b Add a memory barrier for PREWRITE operations to ensure all writes by the
CPU have drained before further writes to kick off the operation.

MFC after:	1 week
2005-09-15 17:09:42 +00:00
Robert Watson 8ed695309f Use sysctl -q when querying for kern.bootp_cookie in order to avoid
printing boot-time errors that don't reflect true error conditions.

MFC after:	1 week
2005-09-15 16:09:28 +00:00
Christian S.J. Peron 8729849a45 Use is '-' to imply that the flag is not set, rather than '.'. 2005-09-15 16:09:24 +00:00
Robert Watson f93d36fd92 Add "-q" argument to sysctl(8), which suppresses a limited set of warnings/
errors generated.  In particular, it suppresses "unknown oid" when
attempting to get or set a sysctl not present in the kernel.

MFC after:	1 week
2005-09-15 16:08:04 +00:00
Robert Watson ca17bccaa1 The socket pointers in fifoinfo are not permitted to be NULL, so
don't check if they are, it just confuses the fifo code more.

MFC after:	3 days
2005-09-15 15:45:34 +00:00
Christian S.J. Peron 68ff2a4397 Improve the MP safeness associated with the creation of symbolic
links and the execution of ELF binaries. Two problems were found:

1) The link path wasn't tagged as being MP safe and thus was not properly
   protected.
2) The ELF interpreter vnode wasnt being locked in namei(9) and thus was
   insufficiently protected.

This commit makes the following changes:

-Sets the MPSAFE flag in NDINIT for symbolic link paths
-Sets the MPSAFE flag in NDINIT and introduce a vfslocked variable which
 will be used to instruct VFS_UNLOCK_GIANT to unlock Giant if it has been
 picked up.
-Drop in an assertion into vfs_lookup which ensures that if the MPSAFE
 flag is NOT set, that we have picked up giant. If not panic (if WITNESS
 compiled into the kernel). This should help us find conditions where vnode
 operations are in-sufficiently protected.

This is a RELENG_6 candidate.

Discussed with:	jeff
MFC after:	4 days
2005-09-15 15:03:48 +00:00
Colin Percival ac8189712e Portsnap uses host(1) to search for mirrors, but this is only available
when the base system is not compiled with NO_BIND set.  Before we start
searching for mirrors, make sure that host(1) can be found, and if it
doesn't exist then fallback to the A record instead of the SRV records.

Submitted by:	Luca Morettoni
2005-09-15 13:29:10 +00:00
Poul-Henning Kamp 346fa63189 Add tnt4882 driver to the build 2005-09-15 13:28:33 +00:00
Poul-Henning Kamp aed1189d1f First cut at a driver for National Instruments PCI-GPIB hardware.
Hardware donated by:	"Greg Maciejewski" <gregm@serverpit.com>
2005-09-15 13:27:16 +00:00
Maxim Konovalov be875755ce Remove checks for shutdown(2) on non-connected socket. 2005-09-15 13:20:39 +00:00
Maxim Konovalov aada5cccd8 Backout rev. 1.246, it breaks code uses shutdown(2) on non-connected
sockets.

Pointed out by:	rwatson
2005-09-15 13:18:05 +00:00
Ralf S. Engelschall 724447ac41 Fix system shutdown timeout handling by again supporting longer running
shutdown procedures (which have a duration of more than 120 seconds).

We have two user-space affecting shutdown timeouts: a "soft" one in
/etc/rc.shutdown and a "hard" one in init(8). The first one can be
configured via /etc/rc.conf variable "rcshutdown_timeout" and defaults
to 30 seconds. The second one was originally (in 1998) intended to be
configured via sysctl(8) variable "kern.shutdown_timeout" and defaults
to 120 seconds.

Unfortunately, the "kern.shutdown_timeout" was declared "unused" in 1999
(as it obviously is actually not used within the kernel itself) and
hence was intentionally but misleadingly removed in revision 1.107 from
init_main.c. Kernel sysctl(8) variables are certainly a wrong way to
control user-space processes in general, but in this particular case the
sysctl(8) variable should have remained as it supports init(8), which
isn't passed command line flags (which in turn could have been set via
/etc/rc.conf), etc.

As there is already a similar "kern.init_path" sysctl(8) variable which
directly affects init(8), resurrect the init(8) shutdown timeout under
sysctl(8) variable "kern.init_shutdown_timeout". But this time document
it as being intentionally unused within the kernel and used by init(8).
Also document it in the manpages init(8) and rc.conf(5).

Reviewed by: phk
MFC after: 2 weeks
2005-09-15 13:16:07 +00:00
Poul-Henning Kamp f6a157fb88 Allocate unit numbers with unr, implement detach function. 2005-09-15 13:07:38 +00:00
Maxim Konovalov c5cff17017 o Return ENOTCONN when shutdown(2) on non-connected socket.
PR:		kern/84761
Submitted by:	James Juran
R-test:		tools/regression/sockets/shutdown
MFC after:	1 month
2005-09-15 11:45:36 +00:00
Poul-Henning Kamp 214c8ff0e4 Various minor polishing. 2005-09-15 10:28:19 +00:00
Poul-Henning Kamp 6556102dcb Protect the devfs rule internal global lists with a sx lock, the per
mount locks are not enough.  Finer granularity (x)locking could be
implemented, but I prefer to keep it simple for now.
2005-09-15 08:50:16 +00:00
Poul-Henning Kamp ab32e95296 Absolve devfs_rule.c from locking responsibility and call it with
all necessary locking held.
2005-09-15 08:36:37 +00:00
Poul-Henning Kamp 74f46f19aa Retire unused dev_named() function. 2005-09-15 08:01:57 +00:00
Poul-Henning Kamp 5e080af41f Close a race which could result in unwarranted "ruleset %d already
running" panics.

Previously, recursion through the "include" feature was prevented by
marking each ruleset as "running" when applied.  This doesn't work for
the case where two DEVFS instances try to apply the same ruleset at
the same time.

Instead introduce the sysctl vfs.devfs.rule_depth (default == 1) which
limits how many levels of "include" we will traverse.

Be aware that traversal of "include" is recursive and kernel stack
size is limited.

MFC:	after 3 days
2005-09-15 06:57:28 +00:00
Warner Losh 4062f4e78e When stopping the card, and returning to page 0, it is best if you do
that with the NIC set of registers rather than the ASIC registers.  I
believe this was a harmless oversight, since we set ED_P0_CR to the
same value 5ms later, but just to be safe...
2005-09-15 04:05:09 +00:00
Craig Rodrigues 318c3a55f0 Fix so that when a slice or a partition is removed through g_slice_config(),
it is destroyed in GEOM, in addition to being removed from /dev.
Before this patch, if you applied a new MBR which deleted a slice,
the deleted slice would not be in /dev, but it would still appear
in kern.geom.conftxt and kern.geom.confxml, which would confused
the diskPartitionEditor in sysinstall.

Submitted by:   pjd
Tested by:      pjd, rodrigc
MFC after:	1 week
2005-09-14 21:38:35 +00:00
Joseph Koshy 60f918ef43 Determine where the runtime loader got mapped to when a dynamically
linked process was exec()'ed, and map samples in that address range
into the appropriate buckets in the runtime loader's profile.
Improve a few comments.

MFC after:	3 days
2005-09-14 21:15:50 +00:00
Andrey A. Chernov dedaf3ca1f Remove any hardcoded assumptions about malloc's way of allocating,
just use MAXPATHLEN. It prevents potential buffer overflow with other
malloc implementations.
(this change based on submitted patch)

PR:             86135
Submitted by:   Trevor Blackwell <tlb@tlb.org>
2005-09-14 20:35:46 +00:00
Andrey A. Chernov 369316a848 Don't reuse *pl to skip [], it is already used for {} parts in the loop above
(submitted patch slightly modified)

PR:             86038
Submitted by:   Gerd Rausch <gerd@juniper.net>
2005-09-14 19:14:32 +00:00
Ruslan Ermilov 9abf4b7a1d Make device_detach methods really work. 2005-09-14 19:03:14 +00:00
Andre Oppermann 035ba19027 Undo a tad little optimization to bpf_mtap() introduced in rev. 1.95
which broke the correct handling of the BIOCGSEESENT flag in the bpf
listener.

PR:		kern/56441
Submitted by:	<vys at renet.ru>
MFC after:	3 days
2005-09-14 16:37:05 +00:00
Joel Dahl abca6092a9 Xref msdosfs(5)
Approved by:	brueffer (mentor)
2005-09-14 16:36:19 +00:00
Joel Dahl 9e40ae709f Remove superfluous reference to the FreeBSD handbook.
Approved by:	brueffer (mentor)
2005-09-14 16:32:21 +00:00
Andre Oppermann fb2c9853a7 Increase boot-time DigiBIOS initialization timeout to allow
for a larger number of chained port modules.

PR:		kern/55018
Submitted by:	Cyrill Shevchuk <cyrill at cyrills.net>
2005-09-14 15:18:12 +00:00
Andre Oppermann db1240661f Do not ignore all other TCP options (eg. timestamp, window scaling)
when responding to TCP SYN packets with TCP_MD5 enabled and set.

PR:		kern/82963
Submitted by:	<demizu at dd.iij4u.or.jp>
MFC after:	3 days
2005-09-14 15:06:22 +00:00
Andre Oppermann 17a8471fcd Remove bogous semicolons at the end of the definitions of
'do { ... } while (0)' macros.

PR:		kern/83088
Sumbitted by:	<antoine.brodin at laposte.net>
2005-09-14 14:57:04 +00:00
Søren Schmidt 0387836deb Harden the hotplug support for SATA devices.
This also fixes a few races that was present in the timeout/detach code.

Sponsored by: pair.com
2005-09-14 12:45:06 +00:00
Yoshihiro Takahashi f7b1bf814d Add some defines for EPSON machines and use them. 2005-09-14 12:42:39 +00:00
Yoshihiro Takahashi 42244f27c2 Remove EPSON PC-386 note A/W/AE/WR support. 2005-09-14 12:39:06 +00:00
Ruslan Ermilov 8d7a953fb2 Fixed "Memory modified after free" panic in rl_detach() due
to rl_stop() accessing already freed "struct ifnet".

Fixed LOR between rl mutex and some ACPI mutex in rl_detach().
2005-09-14 12:33:23 +00:00
Pawel Jakub Dawidek febd1f4df1 Correct type.
OK'ed by:	cperciva
2005-09-14 10:42:51 +00:00
Ruslan Ermilov 5e6e79f718 Fix "Memory modified after free" panic on detach, caused by accessing
already freed struct ifnet.
2005-09-14 10:28:01 +00:00
Stefan Farfeleder efe444ea48 Back out 1.247. On ia64 <osreldate.h> is included from assembler source,
the prototype broke buildword.

Noticed by:	marcel
2005-09-14 09:01:06 +00:00
Bjoern A. Zeeb 75398603ad Fix panic when kernel compiled without INET6 by rejecting
IPv6 opcodes which are behind #if(n)def INET6 now.

PR:		kern/85826
MFC after:	3 days
2005-09-14 07:53:54 +00:00
Christian Brueffer 5f9c8a6a9e Note acpi_sony(4) manpage addition. 2005-09-14 05:50:09 +00:00