From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: /proc/pid/fd/ shows strange mode when executed via sudo. Date: Fri, 18 May 2012 19:08:12 +0100 Message-ID: <20120518180812.GR22082@ZenIV.linux.org.uk> References: <201205022240.GBB13566.VOtHFOLFOMSJFQ@I-love.SAKURA.ne.jp> <20120503154222.GA8776@sergelap> <201205040125.FEI34871.QHOFFJOFMVtOSL@I-love.SAKURA.ne.jp> <201205181139.IAI65153.OQOtFVJFHLSMOF@I-love.SAKURA.ne.jp> <201205181827.BAF57803.OLQMFVtFFOHSJO@I-love.SAKURA.ne.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Tetsuo Handa , ebiederm@xmission.com, linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org To: Linus Torvalds Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:36369 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757978Ab2ERSIS (ORCPT ); Fri, 18 May 2012 14:08:18 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: > I would suggest just moving the i_mode initialization from > proc_fd_instantiate() into the revalidate function that we already > have, and that already fixes up i_uid/i_gid etc. Attached is a TOTALLY > UNTESTED patch that does this, and actually seems to simplify things > in the process. I think this is bogus. We don't give a fuck about *any* of those fields for symlinks; the only problem here is that default ->getattr() uses them to fill ->st_mode et.al. The same goes for ->i_uid/->i_gid. So how about simply adding ->getattr() for those guys? And to hell with assignments in that ->d_revalidate() instance...