From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 14 01:29:33 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90345106566B for ; Thu, 14 Apr 2011 01:29:33 +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 4AC418FC18 for ; Thu, 14 Apr 2011 01:29:32 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwEALxGpk2DaFvO/2dsb2JhbACETKJPiG+oV5FGgSmDTXgEjWk X-IronPort-AV: E=Sophos;i="4.64,208,1301889600"; d="scan'208";a="118228226" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 13 Apr 2011 21:00:22 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 85955B3F52; Wed, 13 Apr 2011 21:00:21 -0400 (EDT) Date: Wed, 13 Apr 2011 21:00:21 -0400 (EDT) From: Rick Macklem To: Jonathan Stuart Message-ID: <11353544.443834.1302742821487.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <32AB5C9615CC494997D9ABB1DB12783C024E929FE5@SJ-EXCH-1.adaranet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.203] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: freebsd-hackers@freebsd.org, Matthew Fleming Subject: Re: Getting vnode + credentials of a file from a struct mount and UFS inode # X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2011 01:29:33 -0000 > Hi, > > Yes, I am.. that was my suspicion (e.g., that it was the parameters of > the process which called open()/creat()/socket()/... originally). > What's the quickest way to get back to the v/inode's uid/gid? > > Also, calling VFS_VGET() seems to give me a lockmgr panic with unknown > type 0x0. VFS_VGET() returns a vnode ptr, it doesn't need the argument set to one. The flags argument (assuming a recent kernel) needs to be LK_EXCLUSIVE or LK_SHARED, not 0 (I suspect that's your panic). > What is odd is that the only way I can get a vnode for VFS_VGET is > through struct file, and then shouldn't I be able to use that? I tried > using the flipping that vnode->inode with VTOI() and it was also > giving me zeros for i_uid, i_gid, etc., when it shouldn't have been. > After VFS_VGET returns a vp, I'd do a VOP_GETATTR() and then vput() the vp to release it. Look for examples of these calls in the kernel sources. The "struct vattr" filled in by VOP_GETATTR() has va_uid and va_gid in it, which are the uid,gid that owns the file, which is what I think you are trying to get. (Credentials generally refer to the effective uid + gids etc of the process/thread trying to do the syscall.) rick