9011 Commits

Author SHA1 Message Date
andre
d097823b38 MFC: Make sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS) generally available instead
of being private to tcp_timer.c.

Sponsored by:	TCP/IP Optimization Fundraise 2005
Approved by:	re (scottl)
2006-03-01 21:08:53 +00:00
andre
5a2c39cf68 MFC uipc_domain.c rev. 1.45 and uipc_mbuf.c rev. 1.162:
Make kern.ipc.[max_linkhdr|max_protohdr|max_hdr|max_datalen] read-only.

Sponsored by:	TCP/IP Optimization Fundraise 2005
Approved by:	re (scottl)
2006-03-01 20:58:36 +00:00
jhb
7d639ae56e MFC: Remove extraneous PHOLD() in kthread_create().
Approved by:	re (scottl)
2006-03-01 20:53:24 +00:00
andre
0d82649a50 MFC: Replace 4k mbuf clusters with PAGE_SIZE clusters.
Note: The jumbo mbuf cluster API has been MFC'd only recently and
never shipped in a release.  Thus the API change does not violate
our stable branch guidelines with regard to API compatibility.

Requested by:	glebius, gallatin
Sponsored by:	TCP/IP Optimization Fundraise 2005
Approved by:	re (scottl)
2006-03-01 20:51:49 +00:00
davidxu
f5028de3c4 MFC revision 1.325.
Approved by: re (scottl)
2006-02-27 00:22:04 +00:00
davidxu
c3b8740b48 MFC following revisions to fix sleep queue and thread
suspension race:
    sys/proc.h                  revision 1.453
    sys/sleepqueue.h            revision 1.7
    kern/subr_sleepqueue        revision 1.24 - 1.26
    kern/kern_sig.c             revision 1.321, 1.323, 1.324
    kern/kern_synch.c           revision 1.276, 1.278
    kern/kern_condvar.c         revision 1.54, 1.55
    kern/kern_kse.c             revision 1.325
    kern/kern_thread.c          revision 1.228, 1.229

Approved by: re (scottl)
2006-02-27 00:19:40 +00:00
davidxu
c60c425416 MFC revision 1.219.
Approved by: re (scottl)
2006-02-27 00:01:15 +00:00
davidxu
b8ee4ad4ee MFC revision 1.42.
Approved by: re (scottl)
2006-02-26 23:59:00 +00:00
jhb
35b2a57ba2 MFC: Sync up to rev 1.80 from HEAD:
- Use a dedicated kthread to call acctwatch() periodically rather than
  a callout from softclock().
- Validate new values for the kern.acct_chkfreq sysctl.
- Whitespace and include sorting.

Approved by:	re (scottl)
2006-02-14 23:13:17 +00:00
rwatson
4b2bdfb9e4 Merge vfs_mount.c:1.213 from HEAD to RELENG_6:
Cast VFS_STATFS() in vfs_domount() to (void) to indicate that ignoring the
  return value is intentional: this is simply an attempt to pre-cache the
  statfs state.

  Found with:     Coverity Prevent (tm)

Approved by:	re (scottl)
2006-02-14 21:57:09 +00:00
rwatson
b765ebeb75 Merge subr_disk.c:1.86 from HEAD to RELENG_6:
When calling bioq_first() to see if a queue is empty in bioq_disksort(),
  don't save the return value as we won't use it.

  Noticed by:     Coverity Prevent analysis tool

Approved by:	re (scottl)
2006-02-14 03:29:31 +00:00
rwatson
48d1eb882f Merge kern_ktrace.c:1.103, ktrace.h:1.31 from HEAD to RELENG_6:
Reuse ktr_unused field in ktr_header structure as ktr_tid; populate
  ktr_tid as part of gathering of ktr header data for new ktrace
  records.  The continued use of intptr_t is required for file layout
  reasons, and cannot be changed to lwpid_t at this point.

  Reviewed by:    davidxu

Approved by:	re (scottl)
2006-02-14 00:02:01 +00:00
rwatson
24a7189e9d Merge uipc_sem.c:1.22 from HEAD to RELENG_6:
Convert remaining functions to ANSI C function declarations.

Approved by:	re (scottl)
2006-02-13 23:51:19 +00:00
cvs2svn
de143a5b92 This commit was manufactured by cvs2svn to create branch 'RELENG_6'. 2006-02-03 01:35:37 +00:00
glebius
fbdc4a3cd4 MFC:
- In pipe() return the error returned by pipe_create(), rather then
    hardcoded ENFILES, which is incorrect. pipe_create() can fail due
    to ENOMEM.
  - Update manual page, describing ENOMEM return code.

  Reviewed by:    arch
2006-01-31 15:44:51 +00:00
ssouhlal
e7d3440442 MFC r1.215:
Don't try to load KLDs if we're mounting the root. We'd otherwise panic.

  Tested by:      kris
2006-01-31 06:00:32 +00:00
scottl
6abd390244 MFC rev 1.31: Allow the fast taskqueue to run without Giant 2006-01-30 07:51:10 +00:00
truckman
059cbb8ba3 MFC kern_sysctl.c 1.168
Touch all the pages wired by sysctl_wire_old_buffer() to avoid PTE
  modified bit emulation traps on Alpha while holding locks in the
  sysctl handler.
2006-01-28 00:31:56 +00:00
truckman
b3b099c112 MFC vfs_lookup.c 1.84 and 1.85, and vfs_syscalls.c 1.400
Return EINVAL from lookup() if cn_nameiop is DELETE or RENAME and
the last component of the path name is "..".  This keeps VOP_LOOKUP()
from locking vnodes in reverse order.

In kern_unlink(), remap EINVAL errors returned from namei() to EPERM
to match existing (and POSIX required) behaviour.
2006-01-25 02:12:09 +00:00
csjp
8c659df4e5 MFC revision 1.214
date: 2006/01/15 20:14:11;  author: csjp;  state: Exp;  lines: +1 -1
vfs_busy can only return something useful if MNTK_UNMOUNT has been set.
Since we are using vfs_busy() on a freshly allocated mount structure, use
(void) to show that we do not care about the return value.
2006-01-24 04:20:24 +00:00
dds
c2d4c40d7e MFC: Return EINVAL if the tv_usec part of the utimes(2) arguments
contains incorrect fractional second values (outside the range
0-999999).
Prior to this change users could create files with values outside
that range.  Moreover, on 32-bit machines tv_usec offsets larger than
4.3s would result in an unnormalized AND wrong timestamp value,
due to overflow.
2006-01-22 13:52:10 +00:00
glebius
8060d3cc2c Remove another bogus KASSERT(). Examination of mb_free_ext() shows
that RELENG_6 is not yet ready for this KASSERT.
2006-01-22 13:16:13 +00:00
tegge
637c08fadb MFC: Set flag in needsbuffer while still holding bqlock to avoid lost wakeup. 2006-01-21 20:41:42 +00:00
glebius
479b6a9013 This KASSERT() shouldn't have been merged. It checks the stuff done
in mb_free_ext() in HEAD, that wasn't merged.
2006-01-21 12:08:03 +00:00
yongari
090d60f537 MFC rev. 1.48 to RELENG_6:
Prefer NULL to 0.
  Add missing lock/unlock in sysctl handler.
2006-01-20 07:38:01 +00:00
andre
814aba4977 MFC jumbo mbuf cluster allocation API providing 4k, 9k and 16k clusters:
struct mbuf *m_getjcl(int how, short type, int flags, int size)
 void *m_cljget(struct mbuf *m, int how, int size)

For size both take MCLBYTES, MJUM4BYTES, MJUM9BYTES, MJUM16BYTES.

Tested by:	glebius
Sponsored by:	TCP/IP Optimization Fundraise 2005
2006-01-18 13:24:24 +00:00
pjd
652705ad2e MFC: sys/kern/kern_malloc.c 1.150
In realloc(9), determine size of the original block based on
UMA_SLAB_MALLOC flag.
In some circumstances (I observed it when I was doing a lot of reallocs)
UMA_SLAB_MALLOC can be set even if us_keg != NULL.

If this is the case we have wonderful, silent data corruption, because less
data is copied to the newly allocated region than should be.
2006-01-17 10:19:37 +00:00
pjd
911efbaebd MFC: sys/kern/kern_malloc.c 1.149
Detect memory leaks when memory type is being destroyed.
This is very helpful for detecting kernel modules memory leaks on unload.
2006-01-17 10:17:37 +00:00
davidxu
a3ce51935a MFC revision 1.40:
Add a new feature to thr_kill, if thread ID argument is -1, send
	signals to all threads except current sender.
2006-01-16 06:25:32 +00:00
davidxu
bbb7464427 MFC following revisions:
sys/umtx.h		revision 1.17
	kern/kern_umtx.c	revision 1.34
	kern/kern_thr.c		revision 1.36

	call kern_umtx_wake on thread exit.
2006-01-16 05:48:40 +00:00
delphij
ac58eacb60 MFC revision 1.185
date: 2005/12/16 18:32:39;  author: delphij;  state: Exp;  lines: +2 -0
In pipe_write(): when uiomove() fails, do not spin on it forever.

Submitted by:   Kostik Belousov <kostikbel at gmail.com> on -current@
Message-ID:     <20051216151016.GE84442@deviant.zoral.local>
Security:	Local DoS
2006-01-14 19:57:48 +00:00
tegge
81ceadf72a MFC: Add marker vnodes to ensure that all vnodes associated with the mount
point are iterated over when using MNT_VNODE_FOREACH.
2006-01-14 01:18:03 +00:00
sobomax
34c0164bb4 MFC: allow execution of ET_DYN elf binaries (aka shared libraries) when
emulating architectures that allow this (Linux so far).

To preserve kernel modules ABI, unlike the version commited into the trunk,
which adds new flag field into Brandinfo structure for this purpose, this
one checks if brand field of Brandinfo matches ELFOSABI_LINUX.

PR:		kern/87615
Submitted by:	Marcin Koziej <creep@desk.pl>
2006-01-10 00:52:07 +00:00
davidxu
6d44b4ab34 MFC following revisions:
kern_sig.c	revision 1.319
	sys_process.c	revision 1.134

	Avoid kernel panic when attaching a process which
	may not be stopped by debugger, e.g process is dumping core.
2006-01-07 11:53:49 +00:00
truckman
d53465b76e Diff reduction to HEAD:
Call fill_kinfo_proc_only() instead of fill_kinfo_proc()
        before calling fill_kinfo_thread(), because fill_kinfo_proc()
        calls both fill_kinfo_proc_only() and fill_kinfo_thread().
        This is a minor optimization and there should be no change
        in functionality.

        Leading whitespace cleanup.
2006-01-05 20:23:10 +00:00
sam
9b6df8d651 parse nmount options enough to use a current mount binary; this
allows people to boot releng_6 kernels with a current user install
(for now at least)

Reviewed by:	rodrigc
2006-01-04 22:18:10 +00:00
truckman
d344122606 MFC subr_witness.c 1.198 and 1.200.
Original commit messages:

  Log:
  Track all lock relationships instead of pruning direct relationships
  if an indirect relationship exists (keep both A->B->C and A->C).
  This allows witness_checkorder() to use isitmychild() instead of
  the much more expensive isitmydescendant() to check for valid lock
  ordering.

  Don't do an expensive tree walk to update the w_level values when
  the tree is updated.  Only update the w_level values when using the
  debugger to display the tree.

  Nuke the experimental "witness_watch > 1" mode that only compared
  w_level for the two locks.  This information is no longer maintained
  at run time, and the use of isitmychild() in witness_checkorder
  should bring performance close enough to the acceptable level that
  this hack is not needed.

  Report witness data structure allocation statistics under the
  debug.witness sysctl.

  Reviewed by:    jhb
  MFC after:      30 days

  Log:
  Relocate witness_levelall(), witness_leveldescendents(), and
  witness_displaydescendants() so that they are protected by
  "#ifdef DDB/#endif" to unbreak kernels not using "option DDB".

  MFC after:      3 weeks
2006-01-04 19:27:22 +00:00
jhb
0f303e9a3c MFC: Fix a deadlock in the recently added printf to warn about spin locks
that are not in the static order list.
2006-01-03 20:43:01 +00:00
emaste
3d086f3f57 MFC kern_clock.c:1.181
In watchdog_config enable the software watchdog iff the WD_ACTIVE flag
  is set.  When watchdogd(1) is terminated intentionally it clears the
  bit, which should then disable it in the kernel.

PR:             kern/74386
Submitted by:   Alex Hoff <ahoff at sandvine dot com>
Approved by:    rwatson (mentor)
2006-01-03 16:43:33 +00:00
davidxu
367aa83314 MFC revision 1.236:
Add code to report zombie state.
2006-01-01 08:31:48 +00:00
marcel
14fe1a0c49 MFC standardization of the ELF types and update of the ELF constants:
lib/libc/gen/nlist.c:1.19
	libexec/rtld-elf/rtld.c:1.108
	libexec/rtld-elf/rtld.h:1.36
	libexec/rtld-elf/alpha/reloc.c:1.21
	libexec/rtld-elf/amd64/reloc.c:1.16
	libexec/rtld-elf/ia64/reloc.c:1.16
	libexec/rtld-elf/sparc64/reloc.c:1.11
	share/man/man5/elf.5:1.32-1.33
	sys/alpha/alpha/elf_machdep.c:1.20
	sys/amd64/amd64/elf_machdep.c:1.24
	sys/boot/common/bootstrap.h:1.42
	sys/boot/common/load_elf.c:1.33
	sys/boot/common/load_elf_obj.c:1.2
	sys/boot/common/reloc_elf.c:1.2
	sys/ia64/ia64/elf_machdep.c:1.21
	sys/kern/link_elf.c:1.87
	sys/kern/link_elf_obj.c:1.90
	sys/sparc64/sparc64/elf_machdep.c:1.20
	sys/sys/elf32.h:1.9-1.10
	sys/sys/elf64.h:1.11-1.13
	sys/sys/elf_common.h:1.16
	sys/sys/elf_generic.h:1.7
	sys/sys/imgact_elf.h:1.28
	sys/sys/linker.h:1.40
	usr.bin/elf2aout/elf2aout.c:1.10
	usr.bin/elfdump/elfdump.c:1.13
	usr.sbin/crunch/crunchide/exec_elf32.c:1.15
	usr.sbin/kldxref/ef.c:1.9
	usr.sbin/kldxref/ef.h:1.6
	usr.sbin/kldxref/ef_amd64.c:1.3
	usr.sbin/kldxref/ef_i386.c:1.3
	usr.sbin/kldxref/ef_obj.c:1.4
	usr.sbin/kldxref/ef_powerpc.c:1.3
	usr.sbin/kldxref/ef_sparc64.c:1.4-1.5
2005-12-30 22:13:59 +00:00
ps
a2a837b8b0 MFC: 32bit compat for recvmsg, sendmsg, osigaction, osigprocmask,
osigpending, osigvec, osigblock, osigsetmask, osigsuspend, osigstack,
clock_gettime, clock_settime, and clock_getres.

Also correct the prototype for freebsd32_nanosleep in syscalls.master.
2005-12-28 19:30:41 +00:00
ps
0c8404b902 MFC: rev 1.250
Allow 32bit get/setsockopt with SO_SNDTIMEO or SO_RECVTIMEO to work.
2005-12-28 18:05:13 +00:00
ps
d3bd7d36e5 MFC: rev 1.150
Calling setrlimit from 32bit apps could potentially increase certain
limits beyond what should be capiable in a 32bit process, so we
must fixup the limits.

This is slightly different than HEAD to not change the ABI.
2005-12-28 17:35:55 +00:00
dds
3459412dad MFC changes from 2005.10.26:
Move execve's access time update functionality into a
new vfs_mark_atime() function, and use the new function
for performing efficient atime updates in mmap().
2005-12-26 13:47:20 +00:00
emaste
3a89523d62 MFC r1.160:
When using m_dup(9) to copy more than MHLEN bytes of data, don't
  create an mbuf chain that starts with a cluster containing just MHLEN
  bytes.  This happened because m_dup called m_get or m_getcl depending
  on the amount of data to copy, but then always set the size available
  in the first mbuf to MHLEN.

Approved by:	jmg
Silence from:	rwatson (mentor)
2005-12-22 04:23:10 +00:00
jhb
e4c2908f0b MFC: Add a new 'show lock' command to ddb that can dump information about
mutexes and sx locks including current owners, etc.
2005-12-20 19:28:24 +00:00
csjp
a9e526e70f MFC revision 1.272
Giant clean up for exit(2)
2005-12-10 20:14:42 +00:00
jhb
cd05b25213 MFC: Use >= rather than > to check for a process exceeding its time limit. 2005-12-05 20:14:40 +00:00
rwatson
c078111780 Merge kern_acct.c:1.76 from HEAD to RELENG_6:
Significant refactoring of the accounting code to improve locking and VFS
  happiness, as well as correct other bugs:

  - Replace notion of current and saved accounting credential/vnode with a
    single credential/vnode and an acct_suspended flag.  This simplifies the
    accounting logic substantially.

  - Replace acct_mtx with acct_sx, a sleepable lock held exclusively during
    reconfiguration and space polling, but shared during log entry
    generation.  This avoids holding a mutex over sleepable VFS operations.

  - Hold the sx lock over the duration of the I/O so that the vnode I/O
    cannot occur after vnode close, which could occur previously if
    accounting was disabled as a process exited.

  - Write the accounting log entry with Giant conditionally acquired based
    on the file system where the log is stored.  Previously, the accounting
    code relied on the caller acquiring Giant.

  - Acquire Giant conditionally in the accounting callout based on the file
    system where the accounting log is stored.  Run the callout MPSAFE.

  - Expose acct_suspended via a read-only sysctl so it is possibly to
    programmatically determine whether accounting is suspended or not without
    attempting to parse logs.

  - Check both acct_vp and acct_suspended lock-free before entering the
    accounting sx lock in acct().

  - When accounting is disabled due to a VBAD vnode (i.e., forceable unmount),
    generate a log message indicating accounting has been disabled.

  - Correct a long-standing bug in how free space is calculated and compared
    to the required space: generate and compare signed results, not unsigned
    results, or negative free space will cause accounting to not be suspended
    when required, or worse, incorrectly resumed once negative free space is
    reached.
2005-11-27 19:09:10 +00:00