summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Give a more reasonable CPU time to the threads which are using schedulerobrien2004-03-211-6/+3
| | | | | | | | | | | | | activation (i.e., applications are using libpthread). This is because SCHED_ULE sometimes puts P_SA processes into ksq_next unnecessarily. Which doesn't give fair amount of CPU time to processes which are using scheduler-activation-based threads when other (semi-)CPU-intensive, non-P_SA processes are running. Further work will no doubt be done by jeffr at a later date. Submitted by: Taku YAMAMOTO <taku@cent.saitama-u.ac.jp> Reviewed by: rwatson, freebsd-current@
* Massively up the (artificial) limit on system scope threadsjulian2004-03-212-4/+4
| | | | | | | in a process from 50 to 500 Also up the number of process scope threads allowed to be in the kernel at one time from 150 to 1500 (per process)
* Add the missing Giant when doing anything with VFS -- in this case,green2004-03-181-1/+4
| | | | releasing the ktrace vnode.
* Verify more bits of the ELF header: the program header tablenectar2004-03-181-6/+6
| | | | | | | | | | | | | entry size and the ELF version. Also, avoid a potential integer overflow when determining whether the ELF header fits entirely within the first page. Reviewed by: jdp A panic when attempting to execute an ELF binary with a bogus program header table entry size was Reported by: Christer Öberg <christer.oberg@texonet.com>
* Revise socow_iodone() in light of recent sf_buf changes. Specifically,alc2004-03-171-5/+9
| | | | | | use sf_buf_free() instead of sf_buf_mext() to consolidate all actions that require the page queues lock in one critical section. While I'm here remove unnecessary splvm() and splx() calls.
* - Replace wait1() with a kern_wait() function that accepts the pid,jhb2004-03-171-81/+42
| | | | | | | | | | | | | | | options, status pointer and rusage pointer as arguments. It is up to the caller to copyout the status and rusage to userland if needed. This lets us axe the 'compat' argument and hide all that functionality in owait(), by the way. This also cleans up some locking in kern_wait() since it no longer has to drop locks around copyout() since all the copyout()'s are deferred. - Convert owait(), wait4(), and the various ABI compat wait() syscalls to use kern_wait() rather than wait1() or wait4(). This removes a bit more stackgap usage. Tested on: i386 Compiled on: i386, alpha, amd64
* Fix information leakage.pjd2004-03-171-1/+6
| | | | | | | | | | | | | Without this fix it is possible to cheat policies like: - sysctl security.bsd.see_other_[gu]ids=0, - mac_seeotheruids(4), - jail(2) and get full processes list with their arguments. This problem exists from revision 1.62 of kern_proc.c when it was introduced. Reviewed by: nectar, rwatson.
* Adjust the number of processes waiting on a semaphore properly if we'recperciva2004-03-171-6/+12
| | | | | | | | woken up in the middle of sleeping. PR: misc/64347 Reviewed by: tjr MFC after: 7 days
* Refactor the existing machine-dependent sf_buf_free() into a machine-alc2004-03-162-3/+25
| | | | | | | | | | dependent function by the same name and a machine-independent function, sf_buf_mext(). Aside from the virtue of making more of the code machine- independent, this change also makes the interface more logical. Before, sf_buf_free() did more than simply undo an sf_buf_alloc(); it also unwired and if necessary freed the page. That is now the purpose of sf_buf_mext(). Thus, sf_buf_alloc() and sf_buf_free() can now be used as a general-purpose emphemeral map cache.
* Remove a bogus assertion and readd it in a more correct location. A threadjhb2004-03-161-1/+1
| | | | | | | | | might be enqueued on a sleep queue but not be asleep when the timeout fires if it is blocked on a lock trying to check for pending signals before going to sleep. In the case of fixing up the TDF_TIMEOUT race, however, the thread must be marked asleep. Reported by: kan (the bogus one)
* Add powerpc to temporary fix. The new cpu device claims allgrehan2004-03-161-2/+2
| | | | | 'generic' OpenFirmware nexus nodes, since it uses bus_generic_probe. Maybe the cpu device probe should be MD.
* Nudge Giant as far as I can into kern_open(). Mark open() as MPSAFE.dwmalone2004-03-164-23/+27
| | | | | | | | Use kern_open() to implement creat() rather than taking the long route through open(). Mark creat as MPSAFE. While I'm at it, mark nosys() (syscall 0) as MPSAFE, for all the difference it will make.
* Get ready to mark open, creat and nosys as MPSAFE.dwmalone2004-03-161-3/+3
|
* Make vfs_nmount() public. The Linux emulator needs this in order to mounttjr2004-03-161-2/+1
| | | | linprocfs filesystems.
* Rename the wiredlen member of struct sysctl_req to validlen and alwaystruckman2004-03-161-14/+16
| | | | | | | | | | | | set it to avoid the need for a bunch of code that tests whether or not the lock member is set to REQ_WIRED in order to determine which length member should be used. Fix another bug in the oldlen return value code. Fix a potential wired memory leak if a sysctl handler uses sysctl_wire_old_buffer() and returns an EAGAIN error to trigger a retry.
* Don't bother calling vslock() and vsunlock() if oldlen is zero.truckman2004-03-161-7/+9
| | | | | | | | | | | | If vslock() returns ENOMEM, sysctl_wire_old_buffer() should set wiredlen to zero and return zero (success) so that the handler will operate according to sysctl(3): The size of the buffer is given by the location specified by oldlenp before the call, and that location gives the amount of data copied after a successful call and after a call that returns with the error code ENOMEM. The handler will return an ENOMEM error because the zero length buffer will overflow.
* Regen for ptrace being safe again.jhb2004-03-152-3/+3
|
* Drop the proc lock around calls to the MD functions ptrace_single_step(),jhb2004-03-152-7/+12
| | | | | | | | | | ptrace_set_pc(), and cpu_ptrace() so that those functions are free to acquire Giant, sleep, etc. We already do a PHOLD/PRELE around them so that it is safe to sleep inside of these routines if necessary. This allows ptrace() to be marked MP safe again as it no longer triggers lock order reversals on Alpha. Tested by: wilko
* Remove sysctl security.jail.list_allowed.pjd2004-03-151-6/+1
| | | | | | | This functionality was a misfeature, sysctl was added and turned off by default just to check if nobody complains. Reviewed by: rwatson
* Revert to the original vslock() and vsunlock() API with the followingtruckman2004-03-151-6/+3
| | | | | | | | | exceptions: Retain the recently added vslock() error return. The type of the len argument should be size_t, not u_int. Suggested by: bde
* Annual NTP kernel code spring-cleaning:phk2004-03-141-8/+11
| | | | | | Use int64_t rather than long long for the fixpoint type. Don't discard fractional nanosecond frequency correction.
* Set default HZ to 1024 for amd64. The comment in kern/tty.c doesn'tpeter2004-03-141-0/+4
| | | | | apply here because we have 64 bit longs and don't suffer the hz > 169 overflows.
* Make the process_exit eventhandler run without Giant. Add Giant hookspeter2004-03-144-4/+3
| | | | | | in the two consumers that need it.. processes using AIO and netncp. Update docs. Say that process_exec is called with Giant, but not to depend on it. All our consumers can handle it without Giant.
* Move the process_fork event out from under Giant. This one is easy,peter2004-03-141-1/+3
| | | | since there are no consumers in the tree. Document this.
* Regen for mpsafe kse_create()peter2004-03-132-3/+3
|
* Push Giant down a little further:peter2004-03-137-29/+14
| | | | | | | | | | | | | | | - no longer serialize on Giant for thread_single*() and family in fork, exit and exec - thread_wait() is mpsafe, assert no Giant - reduce scope of Giant in exit to not cover thread_wait and just do vm_waitproc(). - assert that thread_single() family are not called with Giant - remove the DROP/PICKUP_GIANT macros from thread_single() family - assert that thread_suspend_check() s not called with Giant - remove manual drop_giant hack in thread_suspend_check since we know it isn't held. - remove the DROP/PICKUP_GIANT macros from thread_suspend_check() family - mark kse_create() mpsafe
* Add annotations to mtx_lock(&Giant) in kern_select() and poll() thatrwatson2004-03-131-0/+8
| | | | | | we always grab Giant, even if we're actually only polling objects that don't require giant. Once socket locking is merged, there will be strong motivation to fix this.
* Align the offset in vn_rdwr_inchunks() so that at most the first andbde2004-03-131-1/+11
| | | | | | | | | | | | | the last chunk are misaligned relative to a MAXBSIZE byte boundary. vn_rdwr_inchunks() is used mainly for elf core dumps, and elf sections are usually perfectly misaligned relative to MAXBSIZE, and chunking prevents the file system from doing much realigning. This gives a surprisingly large speedup for core dumps -- from 50 to 13 seconds for a 512MB core dump here. The pessimization was mostly from an interaction of the misalignment with IO_DIRECT. It increased the number of i/o's for each chunk by a factor of 5 (3 writes and 2 read-before-writes instead of 1 write).
* These are changes to allow to use the Intel C/C++ compiler (lang/icc)trhodes2004-03-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to build the kernel. It doesn't affect the operation if gcc. Most of the changes are just adding __INTEL_COMPILER to #ifdef's, as icc v8 may define __GNUC__ some parts may look strange but are necessary. Additional changes: - in_cksum.[ch]: * use a generic C version instead of the assembly version in the !gcc case (ASM code breaks with the optimizations icc does) -> no bad checksums with an icc compiled kernel Help from: andre, grehan, das Stolen from: alpha version via ppc version The entire checksum code should IMHO be replaced with the DragonFly version (because it isn't guaranteed future revisions of gcc will include similar optimizations) as in: ---snip--- Revision Changes Path 1.12 +1 -0 src/sys/conf/files.i386 1.4 +142 -558 src/sys/i386/i386/in_cksum.c 1.5 +33 -69 src/sys/i386/include/in_cksum.h 1.5 +2 -0 src/sys/netinet/igmp.c 1.6 +0 -1 src/sys/netinet/in.h 1.6 +2 -0 src/sys/netinet/ip_icmp.c 1.4 +3 -4 src/contrib/ipfilter/ip_compat.h 1.3 +1 -2 src/sbin/natd/icmp.c 1.4 +0 -1 src/sbin/natd/natd.c 1.48 +1 -0 src/sys/conf/files 1.2 +0 -1 src/sys/conf/files.amd64 1.13 +0 -1 src/sys/conf/files.i386 1.5 +0 -1 src/sys/conf/files.pc98 1.7 +1 -1 src/sys/contrib/ipfilter/netinet/fil.c 1.10 +2 -3 src/sys/contrib/ipfilter/netinet/ip_compat.h 1.10 +1 -1 src/sys/contrib/ipfilter/netinet/ip_fil.c 1.7 +1 -1 src/sys/dev/netif/txp/if_txp.c 1.7 +1 -1 src/sys/net/ip_mroute/ip_mroute.c 1.7 +1 -2 src/sys/net/ipfw/ip_fw2.c 1.6 +1 -2 src/sys/netinet/igmp.c 1.4 +158 -116 src/sys/netinet/in_cksum.c 1.6 +1 -1 src/sys/netinet/ip_gre.c 1.7 +1 -2 src/sys/netinet/ip_icmp.c 1.10 +1 -1 src/sys/netinet/ip_input.c 1.10 +1 -2 src/sys/netinet/ip_output.c 1.13 +1 -2 src/sys/netinet/tcp_input.c 1.9 +1 -2 src/sys/netinet/tcp_output.c 1.10 +1 -1 src/sys/netinet/tcp_subr.c 1.10 +1 -1 src/sys/netinet/tcp_syncache.c 1.9 +1 -2 src/sys/netinet/udp_usrreq.c 1.5 +1 -2 src/sys/netinet6/ipsec.c 1.5 +1 -2 src/sys/netproto/ipsec/ipsec.c 1.5 +1 -1 src/sys/netproto/ipsec/ipsec_input.c 1.4 +1 -2 src/sys/netproto/ipsec/ipsec_output.c and finally remove sys/i386/i386 in_cksum.c sys/i386/include in_cksum.h ---snip--- - endian.h: * DTRT in C++ mode - quad.h: * we don't use gcc v1 anymore, remove support for it Suggested by: bde (long ago) - assym.h: * avoid zero-length arrays (remove dependency on a gcc specific feature) This change changes the contents of the object file, but as it's only used to generate some values for a header, and the generator knows how to handle this, there's no impact in the gcc case. Explained by: bde Submitted by: Marius Strobl <marius@alchemy.franken.de> - aicasm.c: * minor change to teach it about the way icc spells "-nostdinc" Not approved by: gibbs (no reply to my mail) - bump __FreeBSD_version (lang/icc needs to know about the changes) Incarnations of this patch survive gcc compiles since a loooong time, I use it on my desktop. An icc compiled kernel works since Nov. 2003 (exceptions: snd_* if used as modules), it survives a build of the entire ports collection with icc. Parts of this commit contains suggestions or submissions from Marius Strobl <marius@alchemy.franken.de>. Reviewed by: -arch Submitted by: netchild
* Do what the execve(2) manpage says and enforce what a Strictlyru2004-03-121-1/+2
| | | | | | | | | Conforming POSIX application should do by disallowing the argv argument to be NULL. PR: kern/33738 Submitted by: Marc Olzheim, Serge van den Boom OK'ed by: nectar
* This is a temporary fix to solve a regression issue on sparc64 thatkensmith2004-03-121-0/+4
| | | | | | | is caused by the way sparc64 registers its CPUs. Nate will work on a real fix shortly. Approved by: njl
* - Remove old sleep queues.jhb2004-03-123-16/+4
| | | | | - Remove sleepqueue argument from sleepq_set_timeout() since it is not used.
* Fixup a comment.jhb2004-03-121-1/+1
|
* Replace a manual check of a VMIO candidate with vn_canvmio(). Thisdes2004-03-121-2/+3
| | | | | | | | | silences an annoying warning in getblk() when VMIO'ing on a directory vnode, which can happen when vfs.vmiodirenable is 1. Bring the warning message in line with reality at the same time. Submitted by: hmp
* When I was a kid my work table was one cluttered mess an cleaning it upphk2004-03-111-3/+5
| | | | | | | | | | | | | were a rather overwhelming task. I soon learned that if you don't know where you're going to store something, at least try to pile it next to something slightly related in the hope that a pattern emerges. Apply the same principle to the ffs/snapshot/softupdates code which have leaked into specfs: Add yet a buf-quasi-method and call it from the only two places I can see it can make a difference and implement the magic in ffs_softdep.c where it belongs. It's not pretty, but at least it's one less layer violated.
* Properly vector all bwrite() and BUF_WRITE() calls through the same pathphk2004-03-112-14/+24
| | | | and s/BUF_WRITE()/bwrite()/ since it now does the same as bwrite().
* Remove unused mnt_reservedvnlist field.phk2004-03-111-1/+0
|
* Remove unused second arg to vfinddev().phk2004-03-111-9/+7
| | | | Don't call addaliasu() on VBLK nodes.
* Correctly account for extra bits in unit numbers when looking forphk2004-03-111-3/+3
| | | | next free unit.
* Add clone_setup() function rather than rely on lazy initialization.phk2004-03-111-9/+13
| | | | Requested by: rwatson
* make sure we had the filedesc lock when calling fdinit when RFCFDG is setjmg2004-03-101-0/+4
| | | | | | | on call to rfork. Submitted by: Brian Buchanan Semi-Reviewed by: rwatson
* Hook CPUs up to newbus. CPUs will ultimately be a bus driver so thatnjl2004-03-091-0/+67
| | | | | | | multiple CPU-specific drivers can attach. This is a work in progress so children aren't supported yet. Help from: jhb
* Mark loadaverage callout as CALLOUT_MPSAFE.rwatson2004-03-081-1/+1
| | | | Reviewed by: jhb
* Add two new sysctls:pjd2004-03-082-4/+92
| | | | | | | | | | | - security.bsd.hardlink_check_uid, when set, means, that unprivileged users are not permitted to create hard links to files not owned by them, - security.bsd.hardlink_check_gid, when set, means, that unprivileged users are not permitted to create hard links to files owned by group they don't belong to. OK'ed by: rwatson
* Move a vref call outside of proc locks and Giant. By virtue of the factpeter2004-03-081-5/+4
| | | | | | | that we (p1) are currently running, we hold a reference on p_textvp which means the vnode cannot go away. p2 cannot run yet (and hence cannot exit) so this should be safe to do at this point. As a bonus, it removes a block of under-Giant code that was there to support the vref.
* Remove GIANT_REQUIRED from vunmapbuf().alc2004-03-071-2/+0
|
* Giant is not required for vm_thread_new_altkstack().alc2004-03-071-4/+1
|
* Always call vn_finished_write after vn_start_write was called. Allkan2004-03-061-2/+3
| | | | | occurences of 'goto done' after vn_start_write invocation were cleaning up incompletely.
* Add a missing part of jhb's previous commit. It looks like he had apeter2004-03-061-1/+5
| | | | | | | patch chunk rejected that he missed. This would manifest as a lock assertion panic at boot (Giant not locked in kern_fork.c). Obtained from: jhb
* kthread_exit() no longer requires Giant, so don't force callers to acquirejhb2004-03-051-1/+0
| | | | | | Giant just to call kthread_exit(). Requested by: many
OpenPOWER on IntegriCloud