summaryrefslogtreecommitdiff
path: root/sys/kern
AgeCommit message (Collapse)Author
2014-04-18Have each thread keeps its own (counted!) reference to the process's ucredsPhilip Guenther
to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds. Inspired by FreeBSD and NetBSD "right time" deraadt@
2014-04-17Make sure the original thread is blocked until any other threads arePhilip Guenther
completely detached from the process before letting it exit, so that sleeping in systrace_exit() doesn't reorder them and lead to a panic. Panic reported by Fabian Raetz (fabian.raetz (at) gmail.com) ok tedu@
2014-04-14"struct pkthdr" holds a routing table ID, not a routing domain one.Martin Pieuchot
Avoid the confusion by using an appropriate name for the variable. Note that since routing domain IDs are a subset of the set of routing table IDs, the following idiom is correct: rtableid = rdomain But to get the routing domain ID corresponding to a given routing table ID, you must call rtable_l2(9). claudio@ likes it, ok mikeb@
2014-04-12revert falloc change, as it causes all new processes to get stuck after a whileMarc Espie
(race condition ?) problem noticed by me, aja, sthen, brynet, rpe. vanishing after this revert, okay aja@, sthen@ tedu, you probably want to look into re-checking the fcreate/fpublish addition first, then if it's stable, see about tweaking doopenat ?
2014-04-10pull the bufcache freelist code out into separate functions to allow newTed Unangst
algorithms to be tested. in the process, drop support for unused B_AGE and b_synctime options. previous versions ok beck deraadt
2014-04-07Retire kernel support for SO_DONTROUTE, this time without breakingMartin Pieuchot
localhost connections. The plan is to always use the routing table for addresses and routes resolutions, so there is no future for an option that wants to bypass it. This option has never been implemented for IPv6 anyway, so let's just remove the IPv4 bits that you weren't aware of. Tested a least by lteo@, guenther@ and chrisz@, ok mikeb@, benno@
2014-04-03bcopy -> memcpyTed Unangst
2014-04-03if it's ok to wait, it must also be ok to give the kernel lock. do so.Ted Unangst
(then immediately reacquire it). this has the effect of giving interrupts on other CPUs to a chance to run and reduces latency in many cases. ok deraadt
2014-04-03fix $OpenBSD$, noticed by philipBob Beck
2014-04-03I have discussed these licenses with Poul-Henning Kamp and he has agreed toBob Beck
this license change. We will remember that we all still like beer.
2014-03-31Grab the kernel lock before autoconf. This way device drivers can drop it inMark Kettenis
any context if they feel like it. ok deraadt@, guenther@ (who both suggested we could probably grab it even earlier)
2014-03-30Eliminates struct pcred by moving the real and saved ugids intoPhilip Guenther
struct ucred; struct process then directly links to the ucred Based on a discussion at c2k10 or so before noting that FreeBSD and NetBSD did this too. ok matthew@
2014-03-29It's been a quarter century: we can assume volatile is present with that name.Philip Guenther
ok dlg@ mpi@ deraadt@
2014-03-28Reduce uvm include madness. Use <uvm/uvm_extern.h> instead ofMartin Pieuchot
<uvm/uvm.h> if possible and remove double inclusions. ok beck@, mlarkin@, deraadt@
2014-03-28revert "Retire kernel support for SO_DONTROUTE" diff, which does bad thingsStuart Henderson
for localhost connections. discussed with deraadt@
2014-03-27Retire kernel support for SO_DONTROUTE, since the plan is to alwaysMartin Pieuchot
use the routing table there's no future for an option that wants to bypass it. This option has never been implemented for IPv6 anyway, so let's just remove the IPv4 bits that you weren't aware of. Tested by florian@, man pages inputs from jmc@, ok benno@
2014-03-27Store an ifp index instead of a pointer in the "struct mbuf_ext".Martin Pieuchot
This is part of the plan to remove the ifp pointer from the packet header that will allow us to stop garbage collecting mbuf(9)s when an ifp is detached/destroyed. ok mikeb@, lteo@, benno@
2014-03-26Simply cansignal(), passing it processes instead of procs andPhilip Guenther
dropping the pcred argument. Fix handling of kill(-1, sig) from a thread other than the original thread. ok deraadt@
2014-03-26Move p_emul and p_sigcode from proc to process.Philip Guenther
Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself. ok deraadt@ millert@
2014-03-25As long as we're pulling in "systrace.h", might as well conditionalizePhilip Guenther
the inclusion of <dev/systrace.h>
2014-03-24The kernel isn't involved in times(3); <sys/times.h> should never bePhilip Guenther
included there
2014-03-24Split the API: struct ucred remains the kernel internal structure whilePhilip Guenther
struct xucred becomes the structure for syscalls (mount(2) and nfssvc(2)). ok deraadt@ beck@
2014-03-22Move p_sigacts from struct proc to struct process.Philip Guenther
testing help mpi@
2014-03-21Fix missing brackets: longitude/latitude status set to critical every timeandre
nmea_timeout() is triggered introduced in rev 1.37. ok sthen@
2014-03-21Some knf, no functional changes.andre
ok sthen@
2014-03-21Allow for two more pmap-specific bits in vm_page pg_flags. DefineMiod Vallat
PG_PMAPMASK as all the possible pmap-specific bits (similar to the other PG_fooMASK) to make sure MI code does not need to be updated, the next time more bits are allocated to greedy pmaps. No functional change, soon to be used by the (greedy) mips64 pmap.
2014-03-19Properly align the stack using _STACKALIGNBYTES, rather that the ALIGN()Theo de Raadt
macro which is unaware that stacks may need larger alignment. This may mean that some workarounds in crt0 can go away (here's looking at you mips64..) Tested on about half the architectures (the most special cases), so let's see what happens. with tobiasu
2014-03-18Retire hp300, mvme68k and mvme88k ports. These ports have no users, keepingMiod Vallat
this hardware alive is becoming increasingly difficult, and I should heed the message sent by the three disks which have died on me over the last few days. Noone sane will mourn these ports anyway. So long, and thanks for the fish.
2014-03-18When creating a unix socket, save the PID for pf's log(user), even whenPhilip Guenther
not in the original thread. ok matthew@
2014-03-18In prep for killing ps_mainproc, use pr->ps_pid instead ofPhilip Guenther
pr->ps_mainproc->p_pid to get the PID. ok matthew@
2014-03-13get rid of the assumption that the head of the alldevs list is theDavid Gwynne
"mainbus" device. this breaks when mpath is enabled because it attaches before mainbus and therefore takes the head position. have autoconf provide device_mainbus() which looks up mainbus_cd, and use that instead. discussed with deraadt who just wants mpath stuff to move forward despite there being many ways to shine this particular turd.
2014-03-11lint is gone, and the 'lint' conditional was never in the implementationPhilip Guenther
namespace, so stop changing behavior when it's #defined ok beck@ krw@
2014-03-08split falloc into two functions, the allocation and the publication.Ted Unangst
the first part is likely to fail, but we can generally prevent the second part from failing. use these two functions to drop the fdp lock around vn_open in sys_open, but still maintain the original semantics of allocate then open. the goal here is to fix the blocked fifo deadlock in a threaded program. testing volunteers in short supply, resorting to conscription
2014-02-12Eliminate the exit sig handling, which was only invokable via thePhilip Guenther
Linux-compat clone() syscall when *not* using CLONE_THREAD. pirofti@ confirms Opera runs in compat without this, so out it goes; one less hair to choke on in kern_exit.c ok tedu@ pirofti@
2014-02-10arc4random_uniform() returns a value strictly less than its argument; fixPhilip Guenther
arithmetic so that PID_MAX can be reached. ok otto@ zhuk@ miod@
2014-02-09Fix the lock order reversal problem in the code that stops tracedMark Kettenis
multi-threaded processes when they receive a signal: 1. Make the parent of the process (the tracer) wait for all threads to be stopped (in wait4(2)) instead of the thread that received the signal. This prevents us from calling tsleep(9) recursively. 2. Assume that we already hold the kernel lock if the P_SINTR flag is set (just like we already assumed we were holding the scheduler lock) and don't try to grab it again. This should fix the panic that many people reported when debugging multi-threaded programs with gdb(1). ok & lots of help from guenther@
2014-02-09regenPhilip Guenther
2014-02-09nanosleep() isn't actually NOLOCK safe yet: tsleep() still requires kernelPhilip Guenther
lock for PCATCH and ktrace(CSW) handling ok kettenis@
2014-02-01Remove some of the excessive cache and TLB flushing going on duringMike Larkin
hibernate unpack - these were added a while ago when we were fighting different issues that have now been solved. Tested by myself and dcoppa on a variety of machines
2014-01-30Simplyfy adjtime(2) by keeping track of the adjustment as a number ofMark Kettenis
microsecond in a 64-bit integer. Fixes the issue where ntpd loses sync because the struct timeval currently used to hold the adjustment is not properly normalized after the changes guenther@ made. ok guenther@, millert@
2014-01-25get rid of the kernel high and low water marks for pages and replace withBob Beck
a single target of used pages in the cache - so we don't to a ton of work throwing away pages sporadically while holding the biglock - noticed by dlg. ok dlg@ deraadt@
2014-01-24When a disklabel is read from a MBR partitioned disk, don'tKenneth R Westerback
replace the OpenBSD bounds with the A6 MBR partition limits. Thus preserving any changes the user makes with the 'b' command in disklabel. Reported, tested & ok blambert@, ok deraadt@
2014-01-24Copy timespecs member by member in fo_stat callback functions, to avoidPhilip Guenther
leaking values in the padding bytes on LP64. Also, vn_stat() was lacking the zero-fill to clean its padding. ok kettenis@ deraadt@ phessler@
2014-01-24exit1() needs to do a final aggregation of the thread's [us]ticksPhilip Guenther
and runtime to the process totals. Also, add ktracing of struct rusage in wait4() and getrusage(). problem pointed out by tedu@ ok deraadt@
2014-01-23msleep() with a NULL mtx argument is a programming error.Philip Guenther
ok matthew@ phessler@ dlg@
2014-01-23Waiting on a condition without a lock is an error: you need *some* lockPhilip Guenther
to guarantee there isn't a window in which you can lose a wakeup. The exception for tsleep() is when it's just being used to sleep for a period of time, so permit that too. ok jsing@ deraadt@
2014-01-23Delete spurious if statement.Kenneth R Westerback
ok phessler@ deraadt@ jsing@ guenther@
2014-01-22Write disklabel in correct spot on devices with non-512-byte sectors.Kenneth R Westerback
For now and until 5.5 is cut, also read from current/incorrect spot so people don't immediately lose their existing disklabels on such devices. Problem spotted by David Vasek.
2014-01-22Delete casts in assignments to void* and passed void* arguments.Philip Guenther
bcopy() can be memcpy() because target is freshly malloced. &array[n] is simpler than (char*)array + n*sizeof(array[0]) ok tedu@
2014-01-22timeval, timespec, and itimerval have padding on many archs. If we'rePhilip Guenther
going to copyout one, memset the structure and then set it member by member. sys_adjtime() does that on copyin instead, as it already has to munge the members as it goes. ok deraadt@