summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2007-12-27 22:44:01 +0000
committerrwatson <rwatson@FreeBSD.org>2007-12-27 22:44:01 +0000
commit010adfaab6719b6321767381d578b9b8e6dfaf1f (patch)
tree264e61b5759e72f96889fd639fd6ff06b2d54144 /sys
parent4ab9fbda4e0893ef03ebc2e4dbb6e45b3eac0b19 (diff)
downloadFreeBSD-src-010adfaab6719b6321767381d578b9b8e6dfaf1f.zip
FreeBSD-src-010adfaab6719b6321767381d578b9b8e6dfaf1f.tar.gz
Return ESRCH when a kernel stack is queried on a process in execve() --
p_candebug() will return EAGAIN which, if the other process never leaves execve(), will result in the sysctl spinning and never returning to userspace. Processes should always eventually leave execve(), but spinning in kernel while we wait is bad for countless reasons, and particularly harmful if execve() itself is deadlocked. Possibly we should return another error, or return a marker indicating the thread is in execve() so it can be reported that way in userspace. Reported by: kris
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_proc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 7fca5dd..c2e33a7 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -1461,7 +1461,8 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS)
name = (int *)arg1;
if ((p = pfind((pid_t)name[0])) == NULL)
return (ESRCH);
- if (p->p_flag & P_WEXIT) {
+ /* XXXRW: Not clear ESRCH is the right error during proc execve(). */
+ if (p->p_flag & P_WEXIT || p->p_flag & P_INEXEC) {
PROC_UNLOCK(p);
return (ESRCH);
}
OpenPOWER on IntegriCloud