summaryrefslogtreecommitdiffstats
path: root/sys/kern/exec_script.c
AgeCommit message (Collapse)AuthorFilesLines
2019-07-15Do not relock fdp in fdrelease(). This prevents unnecessary lockingvisa1-2/+2
in the common case. OK mpi@
2018-06-18Put file descriptors on shared data structures when they are completelympi1-5/+8
setup, take 3. LARVAL fd still exist, but they are no longer marked with a flag and no longer reachable via `fd_ofiles[]' or the global linked list. This allows us to simplifies a lot code grabbing new references to fds. All of this is now possible because dup2(2) refuses to clone LARVAL fds. Note that the `fdplock' could now be release in all open(2)-like syscalls, just like it is done in accept(2). With inputs from Mathieu Masson, visa@, guenther@ and art@ Previous version ok bluhm@, ok visa@, sthen@
2018-06-05Revert introduction of fdinsert(), a sanitify check triggers whenmpi1-8/+5
closing a LARVAL file. Found the hardway by sthen@.
2018-06-02Put file descriptors on shared data structures when they are completelympi1-5/+8
setup. LARVAL fd still exist, but they are no longer marked with a flag and no longer reachable via `fd_ofiles[]'. This allows us to simplifies a lot code grabbing new references to fds. All of this is now possible because dup2(2) refuses to clone LARVAL fds. Note that the `fdplock' could now be release in all open(2)-like syscalls, just like it is done in accept(2). With inputs from Mathieu -, visa@, guenther@ and art@ ok visa@, bluhm@
2018-05-02Remove proc from the parameters of vn_lock(). The parameter isvisa1-2/+2
unnecessary because curproc always does the locking. OK mpi@
2018-04-28Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysvisa1-2/+2
curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
2018-01-02Stop assuming <sys/file.h> will pull in fcntl.h when _KERNEL is defined.guenther1-1/+2
ok millert@ sthen@
2018-01-01We are either allocating 2 or three array members. Unroll while loopflorian1-6/+8
to be able to call free(9) with sizes. off-by-one pointed out by guenther OK visa
2017-02-11Add a flags argument to falloc() that lets it optionally set theguenther1-2/+2
close-on-exec flag on the newly allocated fd. Make falloc()'s return arguments non-optional: assert that they're not NULL. ok mpi@ millert@
2016-04-25boom goes the dynamitetedu1-22/+3
2016-03-19Remove the unused flags argument from VOP_UNLOCK().natano1-2/+2
torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
2015-12-31NULL-terminate a pointer array to prevent an invalid free, and simplifymmcc1-8/+9
the associated pointer incrementing logic. Reported by Maxim Pugachev. Looks good to tedu@
2015-09-10sizes for free(); ok sthenderaadt1-2/+2
2015-03-14Remove some includes include-what-you-use claims don'tjsg1-2/+1
have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
2014-12-16primary change: move uvm_vnode out of vnode, keeping only a pointer.tedu1-1/+2
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
2014-11-19panic should be reserved for unrecoverable errors, not things we merelytedu1-5/+2
hope don't happen. also, always check for errors. ok deraadt
2014-11-18unifdef SETUIDSCRIPT and FDSCRIPT. we always use them. ok deraadttedu1-27/+3
2014-07-13use mallocarray for multiplied value checkingtedu1-2/+2
2014-07-12add a size argument to free. will be used soon, but for now default to 0.tedu1-3/+3
after discussions with beck deraadt kettenis.
2014-07-08decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hderaadt1-2/+1
don't need to be married. ok guenther miod beck jsing kettenis
2012-04-22Add struct proc * argument to FRELE() and FILE_SET_MATURE() inguenther1-2/+2
anticipation of further changes to closef(). No binary change. ok krw@ miod@ deraadt@
2012-02-15Hold struct filedesc's fd_lock when writing to the fd_ofiles, fd_ofileflags,guenther1-2/+7
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@
2011-07-07Add new syscall entries to support the openat(2) family of functionsmatthew1-1/+2
added in POSIX Issue 7: openat(), mknodat(), mkfifoat(), linkat(), symlinkat(), unlinkat(), faccessat(), fstatat(), readlinkat(), fchmodat(), fchownat(), utimensat(), renameat(), and mkdirat(). This diff mostly just refactors the existing sys_foo() logic into a common dofooat() function that can then be called by both sys_foo() and sys_fooat(). Some of the new system calls support new flags to control their behavior, and proper support for these will be added in subsequent diffs. Incorporating suggestions from thib@, guenther@, and tedu@. ok tedu@, thib@, deraadt@, guenther@
2007-10-29MALLOC/FREE -> malloc/freechl1-3/+3
replace an hard coded value with M_WAITOK ok krw@
2006-11-14grammar, spelling, and style fixes from bret lambert;jmc1-5/+5
kern_descrip.c change ok deraadt
2005-11-12ansi. No binary change.jsg1-4/+2
2005-08-01 - We shouldn't allocate MAXPATHLEN from the stack.art1-11/+12
- Don't copy the pathbuf into kernel space unless we're systracing. deraadt@ ok
2004-07-07fix an issue when scripts are exec'd under systrace wheremarius1-4/+16
the argv[0] would be normalized, and hence break scripts that depend on how they were called. this fixes an issue in the ports builds. ok provos@ deraadt@; lots of testing during hackathon sturm@ naddy@
2004-06-23a few fixes to systracemarius1-2/+13
- add an exec message so that whenever a set-uid/gid process exec's a new image which we may control, the exec does not go by unnoticed. - take special care to check for P_SUGIDEXEC as well as P_SUGID, corresponding to the same changes that were made in the ptrace code a while ago ok niels@, sturm@; thanks to naddy for testing
2004-05-14use pool for namei pathbuf. testing ok millert@ tdeval@tedu1-3/+4
2003-05-03string fixes; tedu okderaadt1-4/+4
2002-09-18We can jump to the fail: label before shellargp is initialized.art1-7/+8
Make sure that we don't free random memory when that happens. From <j at pureftpd.org> deraadt@ ok
2002-08-22Change the vnode locking in exec to not keep the vnode locked almost allart1-12/+13
the time. This could lead to problems when a process wants to do an exec on the same vnode it's being run from and needs to copy in arguments from an uncached page in the data segment. When that happens uvm detects a vnode deadlock and returns an error causing execve() return EFAULT. This fixes the regress test in regress/sys/kern/exec_self Also, initialize scriptvp early in exec_script because it could be used uninitialized in a failure case.
2001-11-06Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.miod1-2/+2
(Look ma, I might have broken the tree)
2001-10-26 - every new fd created by falloc() is marked as larval and should not be usedart1-1/+2
any anyone. Every caller of falloc matures the fd when it's usable. - Since every lookup in the fd table must now check this flag and all of them do the same thing, move all the necessary checks into a function - fd_getfile.
2001-06-22KNFderaadt1-12/+12
2001-05-14ifdef FOO inside an ifdef FOO feels like overkill.art1-2/+2
2000-09-26Don't use MALLOC/FREE on variable sized allocations.art1-5/+5
2000-02-01remove superflous declaration of vnops, it's now in <sys/file.h>assar1-2/+1
1999-10-18force FDSCRIPTS after include files are pulled inderaadt1-5/+5
1999-01-11panic prints a newline for you, don't do it in the panic stringmillert1-2/+2
1997-11-06Updates for VFS Lite 2 + soft update.csapuntz1-2/+2
1997-10-06back out vfs lite2 till after 2.2deraadt1-2/+2
1997-10-06VFS Lite2 Changescsapuntz1-2/+2
1996-10-20Make it build with -Wparentheses.dm1-2/+2
1996-06-12warning: variable might be used uninitialized -- sucksderaadt1-3/+3
1996-03-03From NetBSD: 960217 mergeniklas1-2/+5
1995-10-18initial import of NetBSD treederaadt1-0/+294