From owner-freebsd-current@FreeBSD.ORG Thu Aug 6 16:33:23 2009 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45BBA1065673; Thu, 6 Aug 2009 16:33:23 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 18EE58FC0A; Thu, 6 Aug 2009 16:33:23 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 8DBB246B45; Thu, 6 Aug 2009 12:33:22 -0400 (EDT) Date: Thu, 6 Aug 2009 17:33:22 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Rick Macklem In-Reply-To: Message-ID: References: <20090804225806.GA54680@hub.freebsd.org> <20090805054115.O93661@maildrop.int.zabbadoz.net> <20090805063417.GA10969@doormat.home> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: jeff@FreeBSD.org, "Bjoern A. Zeeb" , freebsd-current@FreeBSD.org, kib@FreeBSD.org, Navdeep Parhar , Navdeep Parhar , Larry Rosenman , lstewart@FreeBSD.org Subject: Re: reproducible panic in netisr X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2009 16:33:23 -0000 On Thu, 6 Aug 2009, Rick Macklem wrote: > On Thu, 6 Aug 2009, Robert Watson wrote: > >> other places where we have very strong alignment requirements on >> i386/amd64, such as the td_ucred pointer that we check for change on system >> calls/traps to see if we need to refresh the thread's credential from the >> process credential. >> > Does this imply that the nfs/krpc hack of: > oldcred = td->td_ucred; > td->td_ucred = "some other cred ptr" > ... > td->td_ucred = oldcred; > > could be dangerous? > > Maybe it should be converted to code that replaces the contents instead of > replacing the *cred? (Variants of the above live in a bunch of places in the > krpc, nlm and nfs code, due to the fact that the socket functions use > td->td_ucred in various places.) td->td_ucred is a thread-local variable, meaning that it will only be accessed and modified from the current thread. So the above construct is fine. Also, struct thread should be properly aligned. :-) Robert N M Watson Computer Laboratory University of Cambridge