From owner-freebsd-current@FreeBSD.ORG Thu Aug 6 15:35:14 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 CDFB0106566C; Thu, 6 Aug 2009 15:35:14 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id E8E128FC0A; Thu, 6 Aug 2009 15:35:13 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAAOVekqDaFvI/2dsb2JhbADRQIQYBYFM X-IronPort-AV: E=Sophos;i="4.43,333,1246852800"; d="scan'208";a="43583454" Received: from darling.cs.uoguelph.ca ([131.104.91.200]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 06 Aug 2009 11:35:13 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by darling.cs.uoguelph.ca (Postfix) with ESMTP id 068FA940102; Thu, 6 Aug 2009 11:35:13 -0400 (EDT) X-Virus-Scanned: amavisd-new at darling.cs.uoguelph.ca Received: from darling.cs.uoguelph.ca ([127.0.0.1]) by localhost (darling.cs.uoguelph.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eTBwEoSF8nqR; Thu, 6 Aug 2009 11:35:12 -0400 (EDT) Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102]) by darling.cs.uoguelph.ca (Postfix) with ESMTP id EF00D940100; Thu, 6 Aug 2009 11:35:11 -0400 (EDT) Received: from localhost (rmacklem@localhost) by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id n76Fd0l07329; Thu, 6 Aug 2009 11:39:00 -0400 (EDT) X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing -bs Date: Thu, 6 Aug 2009 11:39:00 -0400 (EDT) From: Rick Macklem X-X-Sender: rmacklem@muncher.cs.uoguelph.ca To: Julian Elischer In-Reply-To: <4A7AF25D.40608@elischer.org> Message-ID: References: <20090804225806.GA54680@hub.freebsd.org> <20090805054115.O93661@maildrop.int.zabbadoz.net> <20090805063417.GA10969@doormat.home> <4A7AF25D.40608@elischer.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: jeff@FreeBSD.org, "Bjoern A. Zeeb" , lstewart@FreeBSD.org, freebsd-current@FreeBSD.org, kib@FreeBSD.org, Navdeep Parhar , Larry Rosenman , Robert Watson 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 15:35:15 -0000 On Thu, 6 Aug 2009, Julian Elischer wrote: > 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 krpc/nlm/nfs hack of: >> oldcred = td->td_ucred; >> td->td_ucred = "some other cred ptr, such as the mount one" >> ... >> 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.) > > no, creds are read-only .. you never change a cred. > You alwasy make a new one ans use it, becasue you may be shareing your cred > with hundreds of other sibling threads or processes. (they are refcounted) > Righto, yes. So does that imply that the alignment provided by crget() { which uses malloc() } is sufficient for td->td_ucred or is td->td_ucred a special case? rick ps: The above hack, which came up in a separate discussion yesterday, isn't gonna be easy to get rid of, imho. A whole bunch of network related functions use td->td_ucred and the only fix I can see would be to add "*cred" arguments to them all, so that the krpc/nlm/nfs code could pass the correct *cred in. (It is set to the one used at mount time for network reconnects, etc.)