summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Map the sigcode page with MAP_INHERIT_COPY to make sure it isn't shared aterkettenis2015-01-151-2/+2
| | | | | | a fork. ok deraadt@
* Map the sigcode page copy-on-write. This allows userland to put breakpointskettenis2015-01-151-2/+3
| | | | | | | in the signal trampoline. Solves some long-standing issues with debugging signal handlers in GDB. ok deraadt@
* Prefer MADV_* over POSIX_MADV_* in kernel for consistency: the latterguenther2014-12-171-3/+3
| | | | | | doesn't have all the values and therefore can't be used everywhere. ok deraadt@ kettenis@
* primary change: move uvm_vnode out of vnode, keeping only a pointer.tedu2014-12-161-1/+3
| | | | | | objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt
* Use MAP_INHERIT_* for the 'inh' argument to the UMV_MAPFLAG() macro,guenther2014-12-151-3/+3
| | | | | | eliminating the must-be-kept-in-sync UVM_INH_* macros ok deraadt@ tedu@
* convert bcopy to memcpy. ok millerttedu2014-12-101-2/+2
|
* move arc4random prototype to systm.h. more appropriate for most codetedu2014-11-181-3/+1
| | | | to include that than rdnvar.h. ok deraadt dlg
* Replace a plethora of historical protection options with justderaadt2014-11-161-5/+5
| | | | | | | PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
* Don't assume that ep_taddr and ep_daddr are page-aligned. It is possible tokettenis2014-10-181-5/+7
| | | | | | | | construct ELF executables for which ep_daddr ends up not being properly aligned. Sanitize the addresses before setting up the address space for the new executable. Should fix the panic discovered by Alejandro Hernandez. ok miod@
* Replace uvm_km_alloc(9) and uvm_km_free(9) with the equivalent km_alooc(9)kettenis2014-09-281-5/+10
| | | | | | and km_free(9) calls. ok tedu@, mlarkin@
* Delete procfs; it's always had races and is now unused: no one noticed forguenther2014-09-081-13/+2
| | | | | | months that I broke it before the 5.5 release. confirmed as not being required by ports by sthen@, ajacoutot@, dcoppa@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-8/+8
| | | | after discussions with beck deraadt kettenis.
* decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hderaadt2014-07-081-3/+1
| | | | | don't need to be married. ok guenther miod beck jsing kettenis
* Move from struct proc to process the reference-count-holding pointersguenther2014-05-151-10/+9
| | | | | | | | | | to the process's vmspace and filedescs. struct proc continues to keep copies of the pointers, copying them on fork, clearing them on exit, and (for vmspace) refreshing on exec. Also, make uvm_swapout_threads() thread aware, eliminating p_swtime in kernel. particular testing by ajacoutot@ and sebastia@
* Have each thread keeps its own (counted!) reference to the process's ucredsguenther2014-04-181-2/+14
| | | | | | | | | 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@
* Eliminates struct pcred by moving the real and saved ugids intoguenther2014-03-301-11/+18
| | | | | | | | | 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@
* Move p_emul and p_sigcode from proc to process.guenther2014-03-261-9/+9
| | | | | | | | | 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@
* Properly align the stack using _STACKALIGNBYTES, rather that the ALIGN()deraadt2014-03-191-11/+10
| | | | | | | | | 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
* bzero -> memsettedu2014-01-211-2/+2
|
* Move p_textvp from struct proc to struct process so that the exit codeguenther2014-01-201-3/+3
| | | | | | can be further simplified. ok kettenis@
* Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,guenther2013-06-171-1/+5
| | | | | | | | including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and {clock,pthread}_getcpuclockid() functions. Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@ ok matthew@
* vrele() is a tricky beast. it can sleep if the refcount hits zero,tedu2013-03-301-3/+5
| | | | | | leaving us with a free type function that isn't atomic. deal with this by erasing any reachable pointers to the vnode first, then free it. ok deraadt guenther
* do not include machine/cpu.h from a .c file; it is the responsibility ofderaadt2013-03-281-2/+1
| | | | | .h files to pull it in, if needed ok tedu
* Apply profiling to all threads instead of just the thread that calledguenther2012-08-021-2/+2
| | | | | | | profil() by moving P_PROFIL from proc->p_flag to process->ps_flags with matching adjustment in fork1() and exit1() ok matthew@
* Correct the error path in execve when there's a race to single threadguenther2012-05-011-2/+2
| | | | | | the process. noted and ok markus@
* Add struct proc * argument to FRELE() and FILE_SET_MATURE() inguenther2012-04-221-2/+2
| | | | | | anticipation of further changes to closef(). No binary change. ok krw@ miod@ deraadt@
* First stab at making ptrace(2) usable for debugging multi-threaded programs.kettenis2012-04-131-3/+3
| | | | | | | | | | It implements a full-stop model where all threads are stopped before handing over control to the debugger. Events are reported as before through wait(2); you will have to call ptrace(PT_GET_PROCESS_STATE, ...) to find out which thread hit the event. Since this changes the size of struct ptrace_state, you will have to recompile gdb. ok guenther@
* move accounting flags to struct process; idea and ok guenthermikeb2012-04-121-2/+2
|
* clear junk in p_comm before copying shorter names into itderaadt2012-03-261-2/+2
| | | | ok jsing guenther miod
* Make rusage totals, itimers, and profile settings per-process insteadguenther2012-03-231-8/+5
| | | | | | | of per-rthread. Handling of per-thread tick and runtime counters inspired by how FreeBSD does it. ok kettenis@
* New vmmap implementation.ariane2012-03-091-4/+2
| | | | | | | | | | | | no oks (it is really a pain to review properly) extensively tested, I'm confident it'll be stable 'now is the time' from several icb inhabitants Diff provides: - ability to specify different allocators for different regions/maps - a simpler implementation of the current allocator - currently in compatibility mode: it will generate similar addresses as the old allocator
* First steps for making ptrace work with rthreads:guenther2012-02-201-6/+6
| | | | | | | | | | - move the P_TRACED and P_INEXEC flags, and p_oppid, p_ptmask, and p_ptstat member from struct proc to struct process - sort the PT_* requests into those that take a PID vs those that can also take a TID - stub in PT_GET_THREAD_FIRST and PT_GET_THREAD_NEXT ok kettenis@
* Hold struct filedesc's fd_lock when writing to the fd_ofiles, fd_ofileflags,guenther2012-02-151-4/+11
| | | | | | | | or fd_{lo,hi}maps members, or when doing a read for a write. Fixes hangs when an rthreaded processes sleeps while copying the fd table for fork() and catches another thread with the lock. ok jsing@ tedu@
* Handle rthreads consistently in ktrace by moving the flags and vnode intoguenther2011-12-141-5/+3
| | | | | | | | struct process; KTRFAC_ACTIVE becomes P_INKTR. Also, save the credentials used to open the file in sys_ktrace() and use them for all writes to the vnode. much feedback and ok jsing@
* Suspend other rthreads before dumping core or execing; make them exitguenther2011-12-111-1/+14
| | | | | | when exec succeeds. ok jsing@
* TCB address should be reset when execing, to provide a clean setup forguenther2011-10-161-1/+6
| | | | the new image
* Backout vmmap in order to repair virtual address selection algorithmsariane2011-06-061-1/+2
| | | | outside the tree.
* Reimplement uvm/uvm_map.ariane2011-05-241-2/+1
| | | | | | | | | | | | | vmmap is designed to perform address space randomized allocations, without letting fragmentation of the address space go through the roof. Some highlights: - kernel address space randomization - proper implementation of guardpages - roughly 10% system time reduction during kernel build Tested by alot of people on tech@ and developers. Theo's machines are still happy.
* Move P_EXEC flag from struct proc to process, so that setpgid() willguenther2011-04-041-2/+2
| | | | | | fail regardless of which rthread calls execve() ok blambert@
* Move PPWAIT flag from struct proc to process, so that rthreads inguenther2011-04-031-3/+4
| | | | | | | | | a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created. ok blambert@
* Move P_SUGID and P_SUGIDEXEC from struct proc to struct process, soguenther2011-04-021-15/+14
| | | | | | that you can't evade the checks by doing the dirty work in an rthread ok blambert@, deraadt@
* Allow MD code to setup MD-specific mappings (kinda similar to the signalmiod2010-11-241-1/+7
| | | | | trampoline) in sys_execve(), if MD <machine/_types.h> defines __HAVE_EXEC_MD_MAP.
* Correct the links between threads, processes, pgrps, and sessions,guenther2010-07-261-4/+4
| | | | | | | | | so that the process-level stuff is to/from struct process and not struct proc. This fixes a bunch of problem cases in rthreads. Based on earlier work by blambert and myself, but mostly written at c2k10. Tested by many: deraadt, sthen, krw, ray, and in snapshots
* move knote list to struct process. ok guenthertedu2010-05-181-2/+2
|
* fix typos in comments, no code changes;schwarze2010-01-141-2/+2
| | | | | from Brad Tilley <brad at 16systems dot com>; ok oga@
* Remove the VREF() macro and replaces all instances with a call to verf(),thib2009-07-091-2/+2
| | | | | | | | | | | which is exactly what the macro does. Macro's that are nothing more then: #define FUNCTION(arg) function(arg) are almost always pointless and should go away. OK blambert@ Agreed by many.
* properly terminate fake argument list.thib2009-01-041-2/+2
| | | | | | From NetBSD; OK deraadt@
* accidental commit ... backoutderaadt2008-10-311-5/+2
|
* kern_sysctl.cderaadt2008-10-311-2/+5
|
* Make sure we reserve enough stack space on MACHINE_STACK_GROWS_UP architectureskettenis2008-02-131-3/+6
| | | | | | by aligning the stack gap. Fixes gettext port build (and probably many others). ok miod@, tedu@, tested by sthen@