From: OGAWA Hirofumi Subject: Re: [patch 12/12] vfs: allow file truncations when both suid and write permissions set Date: Fri, 07 Aug 2009 20:06:46 +0900 Message-ID: <87iqgzsx15.fsf@devron.myhome.or.jp> References: <200908062310.n76NAIEo013014@imap1.linux-foundation.org> <87ocqs2w17.fsf@devron.myhome.or.jp> <4A7B9DC5.7080700@redhat.com> <871vno1cn7.fsf@devron.myhome.or.jp> <878whwuq9k.fsf@devron.myhome.or.jp> <4A7BF1CC.1020201@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: akpm@linux-foundation.org, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, eparis@redhat.com, esandeen@redhat.com, eteo@redhat.com To: Amerigo Wang Return-path: Received: from mail.parknet.ad.jp ([210.171.162.6]:53895 "EHLO mail.officemail.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757493AbZHGLGr (ORCPT ); Fri, 7 Aug 2009 07:06:47 -0400 In-Reply-To: <4A7BF1CC.1020201@redhat.com> (Amerigo Wang's message of "Fri, 07 Aug 2009 17:20:12 +0800") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Amerigo Wang writes: > OGAWA Hirofumi wrote: >> I found the SuSv3 says for ftruncate(): >> >> Upon successful completion, if fildes refers to a regular file, >> ftruncate() shall mark for update the last data modification and last >> file status change timestamps of the file and the S_ISUID and S_ISGID >> bits of the file mode may be cleared. If the ftruncate() function is >> unsuccessful, the file is unaffected. >> >> And vmtruncate() can return error easily with RLIMIT_FSIZE or >> ->s_maxbytes. So, I think clearing s[ug]id first may be bad behavior >> without good reason. >> > > Hmm, you mean we should clear suid after we do notify_change()? > Good point! I guess it would be better than current patch in practice, although it's not perfect. Thanks. -- OGAWA Hirofumi