From f01492784049d31b694caa93d8f283626ab12430 Mon Sep 17 00:00:00 2001 From: Philip Guenthe Date: Tue, 2 Jun 2009 11:04:56 +0000 Subject: A process should always be able to attach kevent filters to its own threads, even when it has changed uid or gid in the past. As is, a P_SUGID process using rthreads leaks the stack on thread exit. requested and approved by tedu@ a while ago --- sys/kern/kern_event.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index dce96e93300..4295a8cda84 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.33 2008/05/06 20:57:19 thib Exp $ */ +/* $OpenBSD: kern_event.c,v 1.34 2009/06/02 11:04:55 guenther Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon @@ -201,7 +201,8 @@ filt_procattach(struct knote *kn) * Fail if it's not owned by you, or the last exec gave us * setuid/setgid privs (unless you're root). */ - if ((p->p_cred->p_ruid != curproc->p_cred->p_ruid || + if (p->p_p != curproc->p_p && + (p->p_cred->p_ruid != curproc->p_cred->p_ruid || (p->p_flag & P_SUGID)) && suser(curproc, 0) != 0) return (EACCES); -- cgit v1.2.3