From owner-freebsd-current Sat Feb 9 11:20:43 2002 Delivered-To: freebsd-current@freebsd.org Received: from rwcrmhc51.attbi.com (rwcrmhc51.attbi.com [204.127.198.38]) by hub.freebsd.org (Postfix) with ESMTP id 8E98437B434; Sat, 9 Feb 2002 11:20:06 -0800 (PST) Received: from InterJet.elischer.org ([12.232.206.8]) by rwcrmhc51.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020209192006.EZCK1672.rwcrmhc51.attbi.com@InterJet.elischer.org>; Sat, 9 Feb 2002 19:20:06 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id LAA07917; Sat, 9 Feb 2002 11:04:31 -0800 (PST) Date: Sat, 9 Feb 2002 11:04:29 -0800 (PST) From: Julian Elischer To: Bruce Evans Cc: John Baldwin , FreeBSD current users Subject: Re: cred stuff.. In-Reply-To: <20020210012027.E3321-100000@gamplex.bde.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 10 Feb 2002, Bruce Evans wrote: > On Fri, 8 Feb 2002, Julian Elischer wrote: > > > I'd like to commit the code to keep the ucred across userland, > > with the code to clear it to NULL kept under DEBUG ifdefs. > > > > i.e. > > > > > in trap(), ast() and syscall() > > > > > > if (td->td_ucred != p->p_ucred) { > > > if (td->td_ucred != NULL) { > > > mtx_lock(&Giant); > > > crfree(td->td_ucred); > > > td->td_ucred = NULL; > > > mtx_unlock(&Giant); > > > } > > > if (p->p_ucred != NULL) { > > > PROC_LOCK(p); > > > td->td_ucred = crhold(p->p_ucred); > > > PROC_UNLOCK(p); > > > } > > > } > > Please fix the style bugs in this before committing: > - explicit NULL in only one null pointer checks > - excessive braces for one of the ifs. fixed > > > and in userret() and ast() > > > > >#ifdef DEBUG /*your choice of variable here*/ > > > if (td->td_ucred != NULL) { > > > mtx_lock(&Giant); > > > crfree(td->td_ucred); > > > td->td_ucred = NULL; > > > mtx_unlock(&Giant); > > > } > > >#endif > > I think this is better left where it is in the functions that aquire > the locks. It can then be done unconditionally, and not in a loop. AST is not always called and userret is always called, but unfortunatly sometimes multiple times if someone were to clean up AST/userret it would be easier, but I am not sure I understand all the issues.. Particularly the interraction between ast() and userret() and the various possible ASTs > > The style of the null pointer check in this is bug for bug compatible > with the corresponding one above. which way would you prefer? > > Bruce > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message