summaryrefslogtreecommitdiff
path: root/sys/kern
AgeCommit message (Collapse)Author
2008-11-11for ^T support, grab all the information from the process before goingTheo de Raadt
into a potentially sleeping function... ok tedu.
2008-11-11slightly optimized the ptrace stat allocation to only happen when needed.Ted Unangst
ok deraadt
2008-11-11make sure that any messing we do with a process's directories happens ↵Ted Unangst
atomically and not after sleeping. ok deraadt pedro
2008-11-10Fix typo in comment, okay jmc@.Pedro Martelletto
2008-11-10vm_map_lock() around calls to uvm_map_findspace(); ok teduTheo de Raadt
2008-11-09systrace activation happens in the middle of a rather sensitive piece ofTheo de Raadt
fork(), i worry about it a lot but cannot prove yet that sleeping there is bad. Anyways, this change makes us never sleep in that area -- the memory needed is allocated ealier like the ptrace state. tested by many developers.
2008-11-08Use atop() and ptoa() in buf_free_pages() to make it consistent withPedro Martelletto
the rest of the code, okay art@.
2008-11-06Some paranoia and deconfusion.Artur Grabowski
- setrunnable should never be run on SIDL processes. That's a bug and will cause all kinds of trouble. Change the switch statement to panic if that happens. - p->p_stat == SRUN implies that p != curproc since curproc will always be SONPROC. This is a leftover from before SONPROC. deraadt@ "commit"
2008-11-06remove a really stupid comment. Duh, of course it can blockTheo de Raadt
2008-11-06oopsTheo de Raadt
2008-11-06panic if cpu_switchto() returns from a dead processTheo de Raadt
2008-11-03pre-allocate the ptrace_state we may need to tie to the new processTheo de Raadt
in case we need it. the idea is to try to get rid of some potential sleeps.. ok tedu
2008-11-01Grab a reference to the trace vnode of the process when traversing thePedro Martelletto
global process list and calling ktrsettracevnode() in ktrwrite(), so that we don't sleep in vrele(). Discussed with deraadt@, okay beck@, tedu@ and thib@.
2008-11-01change vrele() to return an int. if it returns 0, it can gaurantee thatTheo de Raadt
it did not sleep. this is used to avoid checkdirs() to avoid having to restart the allproc walk every time through idea from tedu, ok thib pedro
2008-11-01change all callers of enterpgrp() to pre-allocate a pgrp or session ifTheo de Raadt
it might be needed later -- before calling pfind(), so that enterpgrp() can operate without sleeping ok tedu
2008-10-31Do not assume that a pointer to another process will live over a set ofTheo de Raadt
sleeping calls. Since we are simply operating on another process' vmspace, grab a (refcounted) copy of that pointer and use that instead. Similar to the bug just fixed in sysctl_proc_args. discussed with art
2008-10-31Do not assume that a pointer to another process will live over a set ofTheo de Raadt
sleeping calls. Since we are simply operating on another process' vmspace, grab a (refcounted) copy of that pointer and use that instead. originally spotted by kurt, discussed with art
2008-10-31accidental commit ... backoutTheo de Raadt
2008-10-31accidental commit ... backoutTheo de Raadt
2008-10-31kern_sysctl.cTheo de Raadt
2008-10-31checkdirs() walks allproc and calls sleeping functions if directories haveTheo de Raadt
to be snapped. Change it so that everytime it sleeps it restarts from the top of the list. ok art
2008-10-30reintroduce mutexes to workqs for locking.David Gwynne
tested by many on many archs including several alpha test. ok tedu@ go for it deraadt@
2008-10-30Use msleep() in the reaper to make it not lose events. Based on discussionTheo de Raadt
PR 5609, and revisited with dlg. Tested on all platforms. ok miod
2008-10-27when shutting workq threads down, dont try to take the big kernelDavid Gwynne
lock when we've never given it up. this is a remnant of the mpsafe workq stuff we had that wasnt cleaned up properly. found by and fix tested by oga@
2008-10-24another oops.Ted Unangst
2008-10-24yet again i prove unable to commit what i really wanted. spotted by deraadtTed Unangst
2008-10-23a better fix for the "uvm_km thread runs out of memory" problem.Ted Unangst
add a new arg to the backend so it can tell pool to slow down. when we get this flag, yield *after* putting the page in the pool's free list. whatever we do, don't let the thread sleep. this makes things better by still letting the thread run when a huge pf request comes in, but without artificially increasing pressure on the backend by eating pages without feeding them forward. ok deraadt
2008-10-22Add timeout_add_msec(), for timeouts in milliseconds.Bret Lambert
Idea and original patch mk@ ok mk@, krw@
2008-10-20The optimization done in 1.19 (and repaired in 1.20) results inTheo de Raadt
cache entries which are freed (and potentially reused), but which are currently in use by another kernel thread which was sleeping in vput() or vget(). This causes the crash in PR 5960, but potentially a bunch of other side effects. figured out with pedro. ok kettenis
2008-10-18Revert the change to use pools for <= PAGE_SIZE allocations. ItMark Kettenis
changes the pressure on the uvm system, uncovering several bugs. Some of those bugs result in provable deadlocks. We'll have to reconsider integrating this diff again after fixing those bugs. ok art@
2008-10-15make random(9) return per-cpu values (by saving the seed in the cpuinfo),Theo de Raadt
which are uniform for the profclock on each cpu in a SMP system (but using a different seed for each cpu). on all cpus, avoid seeding with a value out of the [0, 2^31-1] range (since that is not stable) ok kettenis drahn
2008-10-14Back-in; problems were apparently elsewhere.Philip Guenthe
Put a reference count in struct process to prevent use-after-free if the main thread reaches the reaper ahead of some other thread in the process. Use the reference count to update the user process count correctly when changin real uid. "please re-commit before something else nasty comes in" deraadt@
2008-10-14Change m_devget()'s outdated and unused "offset" argument: It isChristian Weisgerber
now the offset into the first mbuf of the target chain before copying the source data over. From FreeBSD. Convert drivers' use of m_devget(). Mostly from thib@. Update mbuf(9) man page. ok claudio@, thib@
2008-10-11Since malloc_page_alloc() is a pool allocator it should check for PR_WAITOKMark Kettenis
instead of M_NOWAIT. Checking for M_NOWAIT made many malloc calls that used that flag actually wait. This probably explains many if the strange hangs people have seen recently. ok miod@
2008-10-10backout; is causing some people difficultyTheo de Raadt
2008-10-09Change sb_timeo to unsigned, so that even if some calculation (ie. n * HZ)Theo de Raadt
becomes a very large number it will not wrap the short into a negative number and screw up timeouts. It will simply become a max of 65535. Since this happens when HZ is cranked to a high number, this will still only take n seconds, or less. Safer than crashing. Prompted by PR 5511 ok guenther
2008-10-09pass NULL rather than 0 for interrupt time usage to calcru()Kevin Lo
ok art@
2008-10-09Use the reference count in struct process to update the proc countPhilip Guenthe
for users by the correct amount when changing real UID on (r)threaded processes. ok art@ tedu@
2008-10-09Put a reference count in struct process to prevent use-after-freePhilip Guenthe
if the main thread reaches the reaper ahead of some other thread in the process. ok art@ tedu@
2008-10-07Do not display file offsets and a few other pieces of information, exceptTheo de Raadt
to the user or the superuser. Display * for those fields instead. From PR 5113, but modified to use copyout correctly. comments from tedu, ok from others
2008-10-05In malloc_page_free(), restore the correct wire_count value.Miod Vallat
2008-10-04At clock initialization, if we discover that tickadj is 0 (due to veryTheo de Raadt
high HZ) set it to 1, to avoid various divide-by-zero errors later Based on discussion in PR 5511 ok miod
2008-10-03Make sigwait() work correctly. In particular, it'll work when thePhilip Guenthe
signal is already pending in the calling thread or the main thread and there's no longer a race condition where the signal could be diverted but sigwait() would still block. There were some off-by-one errors too. (The checking of the main thread's pending list is just until a pending list for the process can be added to struct process. For now, such signals end up as pending on the main thread.) oks tedu@ and art@
2008-10-02A closed, disconnected, or otherwise failed socket is still a socketTheo de Raadt
and should return stat information instead of EINVAL from deep in the guts of tcp_usrreq. While there, put some more information into struct stat, inspired by FreeBSD. EINVAL problem reported in PR 5943
2008-09-29Use pools to do allocations for all sizes <= PAGE_SIZE.Artur Grabowski
This will allow us to escape the limitations of kmem_map. At this moment, the per-type limits are still enforced for all sizes, but we might loosen that limit in the future after some thinking. Original diff from Mickey in kernel/5761 , I massaged it a little to obey the per-type limits. miod@ ok
2008-09-28initialize the ether_vtag field like the rest of the packet headerChristian Weisgerber
2008-09-19system/5918: fix clearing of ITIMER_VIRTUAL and ITIMER_PROF it_intervalDamien Miller
ok tedu@
2008-09-19Fix a bunch of problems and races with posix file locking.Artur Grabowski
- file descriptor table becomes the owner of the lock instead of the proc. - When grabbing the lock, we check if the fd hasn't changed under our feet, this is more or less impossible to solve without a hack like this. I've banged my head against the wall, I figured out a solution, but implementing it correctly would cost me 12 gray hairs. Screw it, this is ugly, but it works. - Wait until usecount drains before releasing the posix lock in closef. - Add missing FREF/FRELE to sys_flock - keep the pid in the flock struct instead of abusing the fact that we used to use the proc as the lock owner. Pointed out by and discussed with Al Viro, big thanks. miod@ ok
2008-09-19increase MAXINTERP from 64 to 128 and allow a little extra room on topDamien Miller
of that for shell scripts to cover the #!, an optional space following it and a newline at the end. feedback and ok miod@
2008-09-16Add PIOD_READ_AUXV, a way to get the ELF auxilliary vector through ptrace(2).Mark Kettenis
ok miod@