summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_prot.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2001-10-09 16:56:29 +0000
committerrwatson <rwatson@FreeBSD.org>2001-10-09 16:56:29 +0000
commit5157966d6330f372fe1f61ec43e22a3a8abb6edd (patch)
tree845383cdc1d460696af05b16cb585e06d8f45071 /sys/kern/kern_prot.c
parentdaacd5aa55a401e45aa9e87238c55f17e3902010 (diff)
downloadFreeBSD-src-5157966d6330f372fe1f61ec43e22a3a8abb6edd.zip
FreeBSD-src-5157966d6330f372fe1f61ec43e22a3a8abb6edd.tar.gz
o Recent addition of (p1==p2) exception in p_candebug() permitted
processes to attach debugging to themselves even though the global kern_unprivileged_procdebug_permitted policy might disallow this. o Move the kern_unprivileged_procdebug_permitted check above the (p1==p2) check. Reviewed by: des
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r--sys/kern/kern_prot.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index ed2965c..bc42d54 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1534,6 +1534,12 @@ p_candebug(struct proc *p1, struct proc *p2)
{
int error;
+ if (!kern_unprivileged_procdebug_permitted) {
+ error = suser_xxx(NULL, p1, PRISON_ROOT);
+ if (error)
+ return (error);
+ }
+
if (p1 == p2)
return (0);
@@ -1547,8 +1553,9 @@ p_candebug(struct proc *p1, struct proc *p2)
if (p1->p_ucred->cr_uid != p2->p_ucred->cr_uid ||
p1->p_ucred->cr_uid != p2->p_ucred->cr_svuid ||
p1->p_ucred->cr_uid != p2->p_ucred->cr_ruid ||
- p2->p_flag & P_SUGID || !kern_unprivileged_procdebug_permitted) {
- if ((error = suser_xxx(0, p1, PRISON_ROOT)) != 0)
+ p2->p_flag & P_SUGID) {
+ error = suser_xxx(NULL, p1, PRISON_ROOT);
+ if (error)
return (error);
}
OpenPOWER on IntegriCloud