From mboxrd@z Thu Jan 1 00:00:00 1970 From: Amerigo Wang Subject: Re: [patch 12/12] vfs: allow file truncations when both suid and write permissions set Date: Fri, 07 Aug 2009 17:20:12 +0800 Message-ID: <4A7BF1CC.1020201@redhat.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: OGAWA Hirofumi Return-path: Received: from mx2.redhat.com ([66.187.237.31]:60165 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751831AbZHGJS1 (ORCPT ); Fri, 7 Aug 2009 05:18:27 -0400 In-Reply-To: <878whwuq9k.fsf@devron.myhome.or.jp> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 will update the patch now... Thanks for your review!