From owner-p4-projects Sun May 19 10:24: 5 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 23C8D37B405; Sun, 19 May 2002 10:23:59 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 521A137B406 for ; Sun, 19 May 2002 10:23:58 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g4JHNwk74620 for perforce@freebsd.org; Sun, 19 May 2002 10:23:58 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sun, 19 May 2002 10:23:58 -0700 (PDT) Message-Id: <200205191723.g4JHNwk74620@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 11544 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=11544 Change 11544 by rwatson@rwatson_curry on 2002/05/19 10:23:13 Cache td->td_proc in local variable p. Insert a neglected crcopy() from the new crget/crcopy credential update approach. This removes crashes/panics due to bogus credential data. I think. :-) Affected files ... ... //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#146 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#146 (text+ko) ==== @@ -1646,6 +1646,7 @@ __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) { struct ucred *newcred, *oldcred; + struct proc *p; struct mac newlabel; int error; @@ -1656,24 +1657,26 @@ return (error); } + p = td->td_proc; mtx_lock(&Giant); - PROC_LOCK(td->td_proc); - oldcred = td->td_proc->p_ucred; + PROC_LOCK(p); + oldcred = p->p_ucred; error = mac_cred_check_relabel_subject(oldcred, &newlabel); if (error) { - PROC_UNLOCK(td->td_proc); + PROC_UNLOCK(p); crfree(newcred); mtx_unlock(&Giant); return (error); } - setsugid(td->td_proc); + setsugid(p); + crcopy(newcred, oldcred); mac_relabel_subject(newcred, &newlabel); - td->td_proc->p_ucred = newcred; + p->p_ucred = newcred; - PROC_UNLOCK(td->td_proc); + PROC_UNLOCK(p); crfree(oldcred); mtx_unlock(&Giant); return (0); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message