Re: [PATCH 2.2.11-pre2] chmod() too permissive

Kevin Buhr (buhr@stat.wisc.edu)
29 Jul 1999 12:53:58 -0500


Chip Salzenberg <chip@perlsupport.com> writes:
>
> Also, a bit of overly restrictive code that hides this first problem
> for ext2 filesystems appears in ext2_notify_change().

Chip's patch to "ext2_notify_change" also fixes another problem:
without it, "sys_truncate" and "sys_ftruncate" return EPERM if you
don't own the file you're trying to truncate. Obviously, this
function never worked as intended; it was just luck that it was left
out of the "ext2_sops" structure before "proposed-2.2.11pre2".

Also, I see that the "ATTR_FLAG_*" code in "ext2_notify_change" is
still broken. It needs the included patch, in addition to Chip's
patch. Currently, "notify_change" is never called with
"ATTR_ATTR_FLAGS" set, so the patch won't have any affect, but if
you're going to include dead code, it might as well be *correct* dead
code. Also, it might save us from some surprises down the road.

All this stuff is still broken in 2.3.12, too: "ext2_sops" has "NULL"
for the "notify_change" function and the "ext2_notify_change" is the
same old hopeless mess. Alan, has Linus already gotten patches for
this, or does someone still need to do them (and maybe move the
non-ext2-specific RLIMIT_FSIZE checks into the generic filesystem code
while they're at it)?

Kevin <buhr@stat.wisc.edu>

* * *

--- linux/fs/ext2/inode.c.bak Thu Jul 29 14:35:55 1999
+++ linux/fs/ext2/inode.c Thu Jul 29 14:36:18 1999
@@ -757,28 +757,28 @@
flags = iattr->ia_attr_flags;
if (flags & ATTR_FLAG_SYNCRONOUS) {
inode->i_flags |= MS_SYNCHRONOUS;
- inode->u.ext2_i.i_flags = EXT2_SYNC_FL;
+ inode->u.ext2_i.i_flags |= EXT2_SYNC_FL;
} else {
inode->i_flags &= ~MS_SYNCHRONOUS;
inode->u.ext2_i.i_flags &= ~EXT2_SYNC_FL;
}
if (flags & ATTR_FLAG_NOATIME) {
inode->i_flags |= MS_NOATIME;
- inode->u.ext2_i.i_flags = EXT2_NOATIME_FL;
+ inode->u.ext2_i.i_flags |= EXT2_NOATIME_FL;
} else {
inode->i_flags &= ~MS_NOATIME;
inode->u.ext2_i.i_flags &= ~EXT2_NOATIME_FL;
}
if (flags & ATTR_FLAG_APPEND) {
inode->i_flags |= S_APPEND;
- inode->u.ext2_i.i_flags = EXT2_APPEND_FL;
+ inode->u.ext2_i.i_flags |= EXT2_APPEND_FL;
} else {
inode->i_flags &= ~S_APPEND;
inode->u.ext2_i.i_flags &= ~EXT2_APPEND_FL;
}
if (flags & ATTR_FLAG_IMMUTABLE) {
inode->i_flags |= S_IMMUTABLE;
- inode->u.ext2_i.i_flags = EXT2_IMMUTABLE_FL;
+ inode->u.ext2_i.i_flags |= EXT2_IMMUTABLE_FL;
} else {
inode->i_flags &= ~S_IMMUTABLE;
inode->u.ext2_i.i_flags &= ~EXT2_IMMUTABLE_FL;

Kevin <buhr@stat.wisc.edu>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/