From: Roger Willcocks <roger@filmlight.ltd.uk>
To: xfs@oss.sgi.com
Subject: bug: truncate to zero + setuid
Date: Sun, 28 Oct 2007 14:36:42 +0000 [thread overview]
Message-ID: <47249E7A.7060709@filmlight.ltd.uk> (raw)
The nfsv3 setattr call permits a simultaneous truncate + setuid/gid
operation. Normally XFS handles this fine, but if the file's being
truncated to zero, and the file's already empty, XFS simply ignores the
setuid/gid part, returning 'success'.
The error's in xfs_vnodeops.c/xfs_setattr below the comment
'Short circuit the truncate case for zero length files', which bypasses
all other changes.
The simplest fix is to test whether this is the only change that's
happening, otherwise you get tangled in transactions.
if (mask & XFS_AT_SIZE) {
/* Short circuit the truncate case for zero length files */
- if ((vap->va_size == 0) &&
+ if (((mask & ~XFS_AT_SIZE) == 0) && (vap->va_size == 0) &&
(ip->i_d.di_size == 0) && (ip->i_d.di_nextents == 0)) {
--
Roger
next reply other threads:[~2007-10-28 15:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-28 14:36 Roger Willcocks [this message]
2007-10-29 0:54 ` bug: truncate to zero + setuid Tim Shimmin
2007-10-29 18:56 ` Roger Willcocks
2007-10-30 4:06 ` Timothy Shimmin
2007-10-30 17:28 ` Roger Willcocks
2007-11-02 1:11 ` Timothy Shimmin
2007-11-04 11:59 ` Roger Willcocks
2007-11-08 3:13 ` Timothy Shimmin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47249E7A.7060709@filmlight.ltd.uk \
--to=roger@filmlight.ltd.uk \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox