From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Subject: Re: /proc/pid/fd/ shows strange mode when executed via sudo. Date: Fri, 18 May 2012 13:55:09 -0600 Message-ID: <87ehqh2rj6.fsf@xmission.com> 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 , Al Viro , linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org To: Linus Torvalds Return-path: Received: from out03.mta.xmission.com ([166.70.13.233]:39727 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967137Ab2ERTzV (ORCPT ); Fri, 18 May 2012 15:55:21 -0400 In-Reply-To: (Linus Torvalds's message of "Fri, 18 May 2012 09:25:50 -0700") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Linus Torvalds writes: > On Fri, May 18, 2012 at 9:08 AM, Linus Torvalds > wrote: >> >> 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. > > Ok, so it's now "tested" in the sense that it works for me, and fixes > both my and your test-cases. > > Which doesn't mean that it is bug-free of course, but it does seem to > be a sane patch that actually cleans things up. > > I'll delay committing it in case somebody hollers, but I think I'll > mark it for stable too since this issue seems age-old, and the fix > looks good. > > Ack/nak? Can anybody find anything wrong in that patch? Acked-by: "Eric W. Biederman" It looks reasonable. I am a tad leery of the d_add without setting inode->i_mode but the dcache lookup will have to call revalidate before we access the inode so I don't expect a problem there. Eric