summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Close two different races with concurrent opens of pty master devicesjhb2008-08-041-5/+24
| | | | | | that could result in leaked ttys or a leaked pty + tty pair. MFC after: 1 week
* - Close a race with concurrent open's of a pts master device which couldjhb2008-08-041-7/+13
| | | | | | | | result in leaked tty structures. - When constructing a new pty, allocate it's tty structure before adding it to the list. MFC after: 1 week
* Kill a dead variableantoine2008-08-031-2/+0
| | | | | PR: 126223 Submitted by: Mateusz Guzik
* Remove broken code to replace st_mode value with ACCESSPERMS whenrwatson2008-08-031-5/+0
| | | | | | | | | | | | | | | | | lstat(2) is called on symlinks -- this code appears never to have worked. The PR this addresses suggests that the intended original behavior is the right one, but as bde points out in the PR comments, we do actually support storing a mode on symlinks, so returning it seems reasonable. This is consistent with Mac OS X, which despite documentation to the contrary does return the mode set on a symlink, but not some other platforms. The Single Unix Spec requires only that the returned bits be "meaningful", which seems at best unhelpful as advice goes. PR: 25018 MFC after: 3 days
* Calling linker_load_dependencies() while holding the module'kib2008-08-032-0/+4
| | | | | | | | | vnode lock may cause a LOR between kld_sx lock and vnode lock. linker_load_dependencies() drops kld_sx, and another thread may attempt to load the same kld. Reported and tested by: pjd MFC after: 1 week
* add callout_schedule; besides being useful it also improvessam2008-08-021-0/+15
| | | | | | compatibility with other systems Reviewed by: ed, battlez
* Currently, BSM audit pathname token generation for chrooted or jailedcsjp2008-07-311-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | processes are not producing absolute pathname tokens. It is required that audited pathnames are generated relative to the global root mount point. This modification changes our implementation of audit_canon_path(9) and introduces a new function: vn_fullpath_global(9) which performs a vnode -> pathname translation relative to the global mount point based on the contents of the name cache. Much like vn_fullpath, vn_fullpath_global is a wrapper function which called vn_fullpath1. Further, the string parsing routines have been converted to use the sbuf(9) framework. This change also removes the conditional acquisition of Giant, since the vn_fullpath1 method will not dip into file system dependent code. The vnode locking was modified to use vhold()/vdrop() instead the vref() and vrele(). This will modify the hold count instead of modifying the user count. This makes more sense since it's the kernel that requires the reference to the vnode. This also makes sure that the vnode does not get recycled we hold the reference to it. [1] Discussed with: rwatson Reviewed by: kib [1] MFC after: 2 weeks
* Remove the use of lbolt from the VFS syncer.ed2008-07-301-9/+7
| | | | | | | | | | | | | | It seems we only use `lbolt' inside the VFS syncer and the TTY layer now. Because I'm planning to replace the TTY layer next month, there's no reason to keep `lbolt' if it's only used in a single thread inside the kernel. Because the syncer code wanted to wake up the syncer thread before the timeout, it called sleepq_remove(). Because we now just use a condvar(9) with a timeout value of `hz', we can wake it up using cv_broadcast() without waking up any unrelated threads. Reviewed by: phk
* Don't make subr_clist.c depend on the TTY layer.ed2008-07-301-5/+6
| | | | | | | | | | | After the import of the new TTY layer, the TTY_QUOTE definition will not be present anymore. To make sure clists will still work as expected, introduce an internal definition called QUOTEMASK. Maybe we can decide to remove the quote bits entirely, but we still have to look into this. There may be drivers that still use the quote bits. Obtained from: //depot/projects/mpsafetty
* When choosing a CPU for a thread in a cpuset, prefer the last CPU that thejhb2008-07-281-1/+4
| | | | | thread ran on if there are no other CPUs in the set with a shorter per-CPU runqueue.
* Really fix this.jhb2008-07-281-2/+1
|
* Properly check if td_name is empty and if it is, print process name,pjd2008-07-281-2/+2
| | | | | | instead of empty thread name. Reviewed by: jhb
* Implement support for cpusets in the 4BSD scheduler.jhb2008-07-281-0/+116
| | | | | | | | | | | | | | | | | | | | | | - When a cpuset is applied to a thread, walk the cpuset to see if it is a "full" cpuset (includes all available CPUs). If not, set a new TDS_AFFINITY flag to indicate that this thread can't run on all CPUs. When inheriting a cpuset from another thread during thread creation, the new thread also inherits this flag. It is in a new ts_flags field in td_sched rather than using one of the TDF_SCHEDx flags because fork() clears td_flags after invoking sched_fork(). - When placing a thread on a runqueue via sched_add(), if the thread is not pinned or bound but has the TDS_AFFINITY flag set, then invoke a new routine (sched_pickcpu()) to pick a CPU for the thread to run on next. sched_pickcpu() walks the cpuset and picks the CPU with the shortest per-CPU runqueue length. Note that the reason for the TDS_AFFINITY flag is to avoid having to walk the cpuset and examine runq lengths in the common case. - To avoid walking the per-CPU runqueues in sched_pickcpu(), add an array of counters to hold the length of the per-CPU runqueues and update them when adding and removing threads to per-CPU runqueues. MFC after: 2 weeks
* Various and sundry style and whitespace fixes.jhb2008-07-281-74/+74
|
* - track maximum wait timekmacy2008-07-271-4/+9
| | | | | | - resize columns based on actual observed numerical values MFC after: 3 days
* Assert for exclusive vnode lock in vinactive(), vrecycle() and vgonel()pjd2008-07-271-3/+3
| | | | | | functions. Reviewed by: kib
* - Move vp test for beeing NULL under IGNORE_LOCK().pjd2008-07-271-10/+7
| | | | | | | | | - Check if panicstr isn't set, if it is ignore the lock. This helps to avoid confusion, because lockmgr is a no-op when panicstr isn't NULL, so asserting anything at this point doesn't make sense and can just race with other panic. Discussed with: kib
* Fill in a few sysctl descriptions.trhodes2008-07-261-7/+10
| | | | Approved by: rwatson
* Move ttyinfo() into its own C file.ed2008-07-252-269/+317
| | | | | | | | | | | | The ttyinfo() routine generates the fancy output when pressing ^T. Right now it is stored in tty.c. In the MPSAFE TTY code it is already stored in tty_info.c. To make integration of the MPSAFE TTY code a little easier, take the same approach. This makes the TTY code a little bit more readable, because having the proc_*/thread_* routines in tty.c is very distractful. Approved by: philip (mentor)
* Call pargs_drop() unconditionally in do_execve(), the function correctlykib2008-07-252-5/+4
| | | | | | | handles the NULL argument. Make pargs_free() static. MFC after: 1 week
* s/alredy/already/ in the comments and the log message.kib2008-07-251-5/+5
|
* Do the pargs_hold() on the copy of the pointer to the p_args of thekib2008-07-231-1/+1
| | | | | | | | | | | | | | | child process immediately after bulk bcopy() without dropping the process lock. Since process is not single-threaded when forking, dropping and reacquiring the lock allows an other thread to change the process title of the parent in between, and results in hold being done on the invalid pointer. The problem manifested itself as the double free of the old p_args. Reported by: kris Reviewed by: jhb MFC after: 1 week
* - Disallow XFS mounting in write mode. The write support never worked reallyattilio2008-07-211-0/+2
| | | | | | | | | | | | and there is no need to maintain it. - Fix vn_get() in order to let it call vget(9) with a valid locking request. vget(9) returns the vnode locked in order to prevent recycling, but in this case internal XFS locks alredy prevent it from happening, so it is safe to drop the vnode lock before to return by vn_get(). - Add a VNASSERT() in vget(9) in order to catch malformed locking requests. Discussed with: kan, kib Tested by: Lothar Braun <lothar at lobraun dot de>
* If run_interrupt_driven_config_hooks() waits 360 seconds and INVARIANTSrwatson2008-07-211-10/+15
| | | | | | | is compiled into the kernel, then panic. MFC after: 3 days Discussed with: scottl
* Implement the following macros for completeness:pjd2008-07-211-0/+8
| | | | | | | | | SYSCTL_QUAD() SYSCTL_ADD_QUAD() TUNABLE_QUAD() TUNABLE_QUAD_FETCH() Now we can use 64bit tunables on 32bit systems.
* Add accessor functions for socket fields.kmacy2008-07-211-0/+139
| | | | MFC after: 1 week
* Eliminate dead code. (The commit message for revision 1.287 explains whyalc2008-07-201-13/+0
| | | | this code is dead.)
* Rather than simply waiting silently and indefinitely for allrwatson2008-07-191-3/+35
| | | | | | | | | | | | | | | interrupt-driven configuration handlers to complete, print out a diagnostic message every 60 second indicating which handlers are still running. Do this at most 5 times per run so as to avoid scrolling out any useful information from the kernel message buffer. The interval of 60 seconds was selected based on a best guess as to the nature of "long enough" and may want to be tuned higher or lower depending on real-world tolerances. MFC after: 3 days Discussed with: scottl
* witness_addgraph() is required even if DDB isn't compiled into the kernel,rwatson2008-07-191-0/+2
| | | | | | so exclude it from #ifdef DDB. Submitted by: attilio
* Add DDB "show conifhk" command, which lists hooks currently waitingrwatson2008-07-191-0/+27
| | | | | | | | for completion in run_interrupt_driven_config_hooks(). This is helpful when trying to figure out which device drivers have gone into la-la land during boot-time autoconfiguration. MFC after: 3 days
* Fix a race which could result in some timeout buckets being skipped.jeff2008-07-191-6/+11
| | | | | | | | | | | | - When a tick occurs on a cpu, iterate from cs_softticks until ticks. The per-cpu tick processing happens asynchronously with the actual adjustment of the 'ticks' variable. Sometimes the results may be visible before the local call and sometimes after. Previously this could cause a one tick window where we didn't evaluate the bucket. - In softclock fetch curticks before incrementing cc_softticks so we don't skip insertions which were made for the current time. Sponsored by: Nokia
* - Check whether we've recorded this tick in ts_ticks on another cpu injeff2008-07-191-0/+6
| | | | | | | | | | sched_tick() to prevent multiple increments for one tick. This pushes the value out of range and breaks priority calculation. Reviewed by: kib Found by: pho/nokia Sponsored by: Nokia MFC after: 3 days
* revert local changekmacy2008-07-181-176/+27
|
* revert change from local treekmacy2008-07-181-6/+0
|
* import vendor fixes to cxgbkmacy2008-07-182-27/+182
|
* Pair the VOP_OPEN call from do_execve() with the reciprocal VOP_CLOSE.kib2008-07-171-0/+9
| | | | | | | | This was unnoticed because local filesystems usually do nothing non-trivial in the close vop. Reported and tested by: Rick Macklem MFC after: 2 weeks
* Staticize M_STACK.antoine2008-07-131-1/+1
| | | | | Approved by: rwatson (mentor) MFC after: 1 month
* In nmount(), if we see "update" in the mount options,rodrigc2008-07-121-4/+5
| | | | | | | | | | | | | | | | | | | set MNT_UPDATE in fsflags, and delete the "update" option from the global mount options. MNT_UPDATE is a command, and not a property of a mount that should persist after the command is executed. We need to do similar things for MNT_FORCE and MNT_RELOAD. All mount flags are prefixed by MNT_..... it would be nice if flags which were commands were named differently from flags which are persistent properties of a mount. This was not such a big deal in the pre-nmount() days, but with nmount() it is more important. Requested by: yar MFC after: 2 weeks
* Improve readability and cscope searches a little bit by not using theobrien2008-07-111-38/+38
| | | | same variable name in closely related (but not conflicting) contexts.
* Make it atomic for the devfs_populate_loop() to see the setting ofkib2008-07-111-1/+2
| | | | | | | | | | | | SI_ALIAS flag and initialization of the si_parent when alias is created. Assert that supplied parent device is not NULL. Both situations could cause NULL dereference in the devfs_populate_loop() when creating a symlink for SI_ALIAS'ed device. Namely, cdp->cdp_c.si_parent may be NULL. Reported by: mav MFC after: 2 weeks
* Revert r180431.obrien2008-07-111-0/+47
| | | | r180431 broke the AMD64 build (the only arch using kern/link_elf_obj.c)
* Allow 'elf_file_t' to be used in a wider scope.obrien2008-07-101-47/+0
|
* Improve the output of kldload(8) to show which module can't be loaded.edwin2008-07-082-20/+26
| | | | | | | | | | Was: kldload: Unsupported file type Is now: kldload: /boot/modules/test.ko: Unsupported file type PR: kern/121276 Submitted by: Edwin Groothuis <edwin@mavetju.org> Approved by: bde (mentor) MFC after: 1 week
* Add a `show cpusets' DDB command to print numbered root andbz2008-07-071-0/+33
| | | | | | assigned CPU affinity sets. Reviewed by: brooks
* MFp4 144659:bz2008-07-071-0/+4
| | | | | | | | Plug a memory leak with jail services. PR: 125257 Submitted by: Mateusz Guzik <mjguzik gmail.com> MFC after: 6 days
* Move cpuset_refroot and cpuset_refbase functions up, grouping thebz2008-07-071-32/+32
| | | | | | cpuset_ref* functions together. Will make it easier to read and add code without forward declarations. No functional changes.
* The kqueue_register() function assumes that it is called from the top ofkib2008-07-072-19/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | the syscall code and acquires various event subsystem locks as needed. The handling of the NOTE_TRACK for EVFILT_PROC is currently done by calling the kqueue_register() from filt_proc() filter, causing recursive entrance of the kqueue code. This results in the LORs and recursive acquisition of the locks. Implement the variant of the knote() function designed to only handle the fork() event. It mostly copies the knote() body, but also handles the NOTE_TRACK, removing the handling from the filt_proc(), where it causes problems described above. The function is called from the fork1() instead of knote(). When encountering NOTE_TRACK knote, it marks the knote as influx and drops the knlist and kqueue lock. In this context call to kqueue_register is safe from the problems. An error from the kqueue_register() is reported to the observer as NOTE_TRACKERR fflag. PR: 108201 Reviewed by: jhb, Pramod Srinivasan <pramod juniper net> (previous version) Discussed with: jmg Tested by: pho MFC after: 2 weeks
* The r178914 I erronously put the setting of the KQ_FLUXWAIT flag beforekib2008-07-071-2/+1
| | | | | | | | | | KQ_FLUX_WAKEUP(). Since the later macro clears the KQ_FLUXWAIT, the kqueue_scan() thread may be not woken up. Move the setting of KQ_FLUXWAIT after wakeup to correct the issue. Reported and tested by: pho MFC after: 3 days
* Enable the creation of a kmem map larger than 4GB.alc2008-07-051-11/+11
| | | | | | | Submitted by: Tz-Huan Huang Make several variables related to kmem map auto-sizing static. Found by: CScout
* Introduce a new lock, hostname_mtx, and use it to synchronize accessrwatson2008-07-053-22/+63
| | | | | | | | | | | | to global hostname and domainname variables. Where necessary, copy to or from a stack-local buffer before performing copyin() or copyout(). A few uses, such as in cd9660 and daemon_saver, remain under-synchronized and will require further updates. Correct a bug in which a failed copyin() of domainname would leave domainname potentially corrupted. MFC after: 3 weeks
OpenPOWER on IntegriCloud