Messages in this thread Patch in this message | | | Date | Wed, 8 Sep 1999 19:27:30 +0000 (GMT) | From | Thomas Habets <> | Subject | Immutable file bug |
| |
I was looking into how security levels are implemented in linux and I stumbled on what I think is a bug.
An immutable file can still be touched to change its date. I'm not really sure if immutable should prohibit that but I think so (since you can't change permissions on an immutable file) and I think it should.
I traced it to sys_utime() and sys_utimes() in fs/open.c and patched it there. But after seing directories turning into files (spooky) i tried again and patched inode_change_ok() in fs/attr.c.
Oh, and a question: does linux even *have* security levels? I assumed it did since it has immutable files but people say it doesn't have it.
IMPORTANT NOTE: This patch works for me but am sure Linus will beat me silly for patching absolutely wrong.
--- linux-2.2.12/fs/attr.c Fri Nov 13 19:07:26 1998 +++ marvin-2.2.12/fs/attr.c Wed Sep 8 20:57:39 1999 @@ -17,6 +17,10 @@ int retval = -EPERM; unsigned int ia_valid = attr->ia_valid;
+ /* don't touch if immutable */ + if (IS_IMMUTABLE(inode)) { + goto error; + } + /* If force is set do it anyway. */ if (ia_valid & ATTR_FORCE) goto fine;
--------- typedef struct me_s { char name[] = { "Thomas Habets" }; char email[] = { "thomas@habets.pp.se" }; char os[] = { "Linux 2.2" }; char *pgpKey[] = { "finger -m thompa@nss.nu" }; } me_t;
- 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/
| |