summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Whitespace cleanupdes2004-02-241-4/+4
|
* Fix two oversights here: don't trash the freelist, and properly cleanupphk2004-02-231-1/+4
| | | | | | the cdevsw{}. Submitted by: tegge
* Correct some major SMP-harmful problems in the pipe implementation. Firstgreen2004-02-221-41/+66
| | | | | | | | | | | | of all, PIPE_EOF is not checked pervasively after everything that can drop the pipe mutex and msleep(), so fix. Additionally, though it might not harm anything, pipelock() and pipeunlock() are not used consistently. Third, the kqueue support functions do not use the pipe mutex correctly. Last, but absolutely not least, is a race: if pipe_busy is not set on the closing side of the pipe, the other side that is trying to write to that will crash BECAUSE PIPE_EOF IS NOT SET! Unconditionally set PIPE_EOF, and get rid of all the lockups/crashes I have seen trying to build ports.
* Add sysctls to allow showing threads for pgrp, tty, uid, ruid,deischen2004-02-221-7/+31
| | | | and pid.
* Reimplement sysctls handling by MAC framework.pjd2004-02-221-15/+15
| | | | | | | | | | | Now I believe it is done in the right way. Removed some XXMAC cases, we now assume 'high' integrity level for all sysctls, except those with CTLFLAG_ANYBODY flag set. No more magic. Reviewed by: rwatson Approved by: rwatson, scottl (mentor) Tested with: LINT (compilation), mac_biba(4) (functionality)
* If we're going to panic(), do it before dereferencing a NULL pointer.cperciva2004-02-221-1/+1
| | | | | Reported by: "Ted Unangst" <tedu@coverity.com> Approved by: rwatson (mentor)
* Update my personal copyrights and NETA copyrights in the kernelrwatson2004-02-224-5/+5
| | | | | | | | to use the "year1-year3" format, as opposed to "year1, year2, year3". This seems to make lawyers more happy, but also prevents the lines from getting excessively long as the years start to add up. Suggested by: imp
* Check for NODEV return from udev2dev()phk2004-02-211-0/+2
|
* Device megapatch 6/6:phk2004-02-213-33/+163
| | | | | | | | | | | | | | | | | | | | | | | | | This is what we came here for: Hang dev_t's from their cdevsw, refcount cdevsw and dev_t and generally keep track of things a lot better than we used to: Hold a cdevsw reference around all entrances into the device driver, this will be necessary to safely determine when we can unload driver code. Hold a dev_t reference while the device is open. KASSERT that we do not enter the driver on a non-referenced dev_t. Remove old D_NAG code, anonymous dev_t's are not a problem now. When destroy_dev() is called on a referenced dev_t, move it to dead_cdevsw's list. When the refcount drops, free it. Check that cdevsw->d_version is correct. If not, set all methods to the dead_*() methods to prevent entrance into driver. Print warning on console to this effect. The device driver may still explode if it is also incompatible with newbus, but in that case we probably didn't get this far in the first place.
* Device megapatch 5/6:phk2004-02-212-10/+13
| | | | | | | | | | | | Remove the unused second argument from udev2dev(). Convert all remaining users of makedev() to use udev2dev(). The semantic difference is that udev2dev() will only locate a pre-existing dev_t, it will not line makedev() create a new one. Apart from the tiny well controlled windown in D_PSEUDO drivers, there should no longer be any "anonymous" dev_t's in the system now, only dev_t's created with make_dev() and make_dev_alias()
* Device megapatch 4/6:phk2004-02-218-4/+18
| | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
* Device megapatch 3/6:phk2004-02-213-4/+26
| | | | | | | | | | | | Add missing D_TTY flags to various drivers. Complete asserts that dev_t's passed to ttyread(), ttywrite(), ttypoll() and ttykqwrite() have (d_flags & D_TTY) and a struct tty pointer. Make ttyread(), ttywrite(), ttypoll() and ttykqwrite() the default cdevsw methods for D_TTY drivers and remove the explicit initializations in various drivers cdevsw structures.
* Device megapatch 2/6:phk2004-02-211-8/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a couple of functions for pseudodrivers to use for implementing cloning in a manner we will be able to lock down (shortly). Basically what happens is that pseudo drivers get a way to ask for "give me the dev_t with this unit number" or alternatively "give me a dev_t with the lowest guaranteed free unit number" (there is unfortunately a lot of non-POLA in the exact numeric value of this number, just live with it for now) Managing the unit number space this way removes the need to use rman(9) to do so in the drivers this greatly simplifies the code in the drivers because even using rman(9) they still needed to manage their dev_t's anyway. I have taken the if_tun, if_tap, snp and nmdm drivers through the mill, partly because they (ab)used makedev(), but mostly because together they represent three different problems for device-cloning: if_tun and snp is the plain case: just give me a device. if_tap has two kinds of devices, with a flag for device type. nmdm has paired devices (ala pty) can you can clone either of them.
* Make sure to wake up any select waiters when closing a kqueue (also, notgreen2004-02-201-0/+4
| | | | | | | crash). I am fairly sure that only people with SMP and multi-threaded apps using kqueue will be affected by this, so I have a stress-testing program on my web site: <URL:http://green.homeunix.org/~green/getaddrinfo-pthreads-stresstest.c>
* Tidy up the thread taskqueue implementation and close a lost wakeup race.jhb2004-02-191-14/+9
| | | | | | | Instead of creating a mutex that we msleep on but don't actually lock when doing the corresponding wakeup(), in the kthread, lock the mutex associated with our taskqueue and msleep while the queue is empty. Assert that the queue is locked when the callback function is called to wake the kthread.
* Rework jail_attach(2) so that an already jailed process cannot hopnectar2004-02-191-12/+12
| | | | | | to another jail. Submitted by: rwatson
* Added sysctl security.jail.jailed.pjd2004-02-191-0/+13
| | | | | | | | | | | | It returns 1 is process is inside of jail and 0 if it is not. Information if we are in jail or not is not a secret, there is plenty of ways to discover it. Many people are using own hack to check this and this will be a legal way from now on. It will be great if our starting scripts will take advantage of this sysctl to allow clean "boot" inside jail. Approved by: rwatson, scottl (mentor)
* Simplify check. We are only able to check exclusive lock and ifpjd2004-02-191-1/+5
| | | | | | 2nd condition is true, first one is true for sure. Approved by: jhb, scottl (mentor)
* When reparenting a process in the PT_DETACH code, only set p_sigparenttruckman2004-02-191-1/+2
| | | | | | to SIGCHLD if the new parent process is initproc. MFC after: 2 weeks
* A Linux thread created using clone() should not send SIGCHLD to itstruckman2004-02-191-3/+3
| | | | | | | parent if no signal is specified in the clone() flags argument. PR: 42457 MFC after: 2 weeks
* Add support for 'h' and 'hh' modifiers for printf(9).njl2004-02-191-2/+21
| | | | | Submitted by: Bruno Ducrot <ducrot AT poupinou.org> Reviewed by: bde
* Don't ignore errors from vfs_allocate_syncvnode.cperciva2004-02-181-1/+1
| | | | | | PR: kern/18503 Submitted by: Anatoly Vorobey <mellon@pobox.com> Approved by: rwatson (mentor)
* Checkpoint a hack to enable running i386 libc_r binaries on a 64 bitpeter2004-02-181-4/+22
| | | | | | kernel. I'm not happy with it yet - refinements are to come. This hack allows the kern.ps_strings and kern.usrstack sysctls to respond to a 32 bit request, such as those coming from emulated i386 binaries.
* Correct a comment.dwmalone2004-02-172-2/+2
| | | | Reviewed by: alfred, tanimura
* Mechanical whistespace cleanup.des2004-02-171-19/+19
|
* Don't bother storing a result when all you need are the side effects.des2004-02-161-5/+5
|
* In fdcheckstd the descriptor table should never be shared, so justdwmalone2004-02-151-9/+7
| | | | | KASSERT this rather than trying to deal with what happens when file descriptors change out from under us.
* Fixed style bugs near previous commit (mainly formatting errors andbde2004-02-151-16/+13
| | | | | | missing parentheses). Use default handling (trap to debugger) for udev2dev(x, 1) since it is an error and doesn't happen anywhere in the sys tree except in bogusly commented out code in coda.
* Remove opv_desc_vector from vfs_add_vnodeops, since it is definedcperciva2004-02-151-2/+0
| | | | | | | | and given a value, but never used. This has no effect on the resulting binaries, since gcc optimizes the variable away anyway. PR: kern/62684 Approved by: rwatson (mentor)
* Split the initialization of the cdevsw into a separate function.phk2004-02-151-7/+14
|
* Remove excess brackets.rwatson2004-02-151-3/+2
|
* Use standard style for cdevsw initialization.phk2004-02-141-5/+5
|
* By default, don't allow processes in a jail to list the set ofrwatson2004-02-141-0/+7
| | | | | jails in the system. Previous behavior (allowed) may be restored by setting security.jail.list_allowed=1.
* Fix mismerge in last commit: check that cred->cr_prison is NULLrwatson2004-02-141-1/+1
| | | | before dereferencing the prison pointer.
* By default, when a process in jail calls getfsstat(), only return therwatson2004-02-143-0/+36
| | | | | | | | data for the file system on which the jail's root vnode is located. Previous behavior (show data for all mountpoints) can be restored by setting security.jail.getfsstatroot_only to 0. Note: this also has the effect of hiding other mounts inside a jail, such as /dev, /tmp, and /proc, but errs on the side of leaking less information.
* Remove the check which used to protect us against make_dev() beingphk2004-02-141-19/+0
| | | | | | called until DEVFS had a chance to initialize. Since DEVFS is mandatory and things over in that department coincidentally works from without any initialization now, this is safe.
* T -CURRENT DO NOT CRASH UPON ^T K PLZ THX.green2004-02-141-1/+2
| | | | Also, use sched_pctcpu() instead of assuming td->td_kse is non-NULL.
* Always socantsendmore() before deallocating a socket. This, in turn,green2004-02-121-0/+7
| | | | | | | calls selwakeup() if necessary (which it is, if you don't want freed memory hanging around on your td->td_selq). Props to: alfred
* When reparenting a process to init, make sure that p_sigparent istruckman2004-02-112-0/+2
| | | | | | | | | set to SIGCHLD. This avoids the creation of orphaned Linux-threaded zombies that init is unable to reap. This can occur when the parent process sets its SIGCHLD to SIG_IGN. Fix a similar situation in the PT_DETACH code. Tested by: "Steven Hartland" <killing AT multiplay.co.uk>
* Argh! Fix a bogon. lim_cur() was returning the hard (max) limit ratherjhb2004-02-111-1/+1
| | | | | | than the soft (cur) limit. Submitted by: bde
* Add the SF_NODISKIO flag to sendfile. This flag causes sendfile to besilby2004-02-081-19/+22
| | | | | | | | | | | | | | | mindful of blocking on disk I/O and instead return EBUSY when such blocking would occur. Results from the DeBox project indicate that blocking on disk I/O can slow the performance of a kqueue/poll based webserver. Using a flag such as SF_NODISKIO and throwing connections that would block to helper processes/threads helped increase performance. Currently, only the Flash webserver uses this flag, although it could probably be applied to thttpd with relative ease. Idea by: Yaoping Ruan & Vivek Pai
* swp_pager_async_iodone() no longer requires Giant. Modify bufdone()alc2004-02-071-1/+0
| | | | | | and swapgeom_done() to perform swp_pager_async_iodone() without Giant. Reviewed by: tegge
* - Convert the plimit lock to a pool mutex lock.jhb2004-02-061-3/+3
| | | | | | - Hide struct plimit from userland. Submitted by: bde (2)
* - Correct the translation of old rlimit values to properly handle the oldjhb2004-02-061-21/+28
| | | | | | | | | | | | | RLIM_INFINITY case for ogetrlimit(). - Use %jd and intmax_t to output negative time in usec in calcru(). - Rework getrusage() to make a copy of the rusage struct into a local variable while holding Giant and then do the copyout from the local variable to avoid having to have the original process rusage struct locked while doing the copyout (which would not be safe). This also includes a few style fixes from Bruce to getrusage(). Submitted by: bde (1, parts of 3) Suggested by: bde (2)
* A few more style fixes from Bruce including a few I missed last time.jhb2004-02-061-18/+12
| | | | Submitted by: bde
* Always set a process' state to normal when it is fully constructed injhb2004-02-052-6/+9
| | | | | fork1() rather than only doing it for the RFSTOPPED case and then having to fix it up in other places later on.
* - A lot of style and whitespace fixes.jhb2004-02-051-60/+53
| | | | | | - Update a few comments regarding locking notes. Submitted by: bde (1, mostly)
* Correct a reference counting bug in shmat(2). If vm_map_find(9)nectar2004-02-051-0/+1
| | | | | | | | failed, the reference count for the virtual memory object referenced by the specified shared memory segment would have been erroneously incremented. Reported by: Joost Pol <joost@pine.nl>
* Rename cn_unavailable to cnunavailable for little more consistency.kan2004-02-051-14/+2
| | | | | | Garbage collect unused cndebug() function. Suggested by: bde
* Style fixes: don't indent variable names.silby2004-02-051-6/+6
| | | | Submitted by: bde
OpenPOWER on IntegriCloud