Skip to contentSkip to conversation

anon_inode: set S_IFREG on the anon_inode

PATCH In review Eric Paris 2 participants 3 messages May 14, 2010 VFS

lore
Share & tools
lore

Eric Paris

author
#0 lore raw

PATCH 1/1 anon_inode: set S_IFREG on the anon_inode

anon_inode_mkinode() sets inode->i_mode = S_IRUSR | S_IWUSR; This means that (inode->i_mode & S_IFMT) == 0. This trips up some SELinux code that needs to determine if a given inode is a regular file, a directory, etc. The easiest solution is to just make sure that the anon_inode also sets S_IFREG.

---

 fs/anon_inodes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/anon_inodes.c +1 -1
index e4b75d6..9bd4b38 100644
@@ -205,7 +205,7 @@ static struct inode *anon_inode_mkinode(void)
 	 * that it already _is_ on the dirty list.
 	 */
 	inode->i_state = I_DIRTY;
-	inode->i_mode = S_IRUSR | S_IWUSR;
+	inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR;
 	inode->i_uid = current_fsuid();
 	inode->i_gid = current_fsgid();
 	inode->i_flags |= S_PRIVATE;
maintainer
#1 lore raw
Quoted 5 lines · Eric Paris

anon_inode_mkinode() sets inode->i_mode = S_IRUSR | S_IWUSR; This means that (inode->i_mode & S_IFMT) == 0. This trips up some SELinux code that needs to determine if a given inode is a regular file, a directory, etc. The easiest solution is to just make sure that the anon_inode also sets S_IFREG.

How urgent that one is? It is obvious enough, so I could include it into the pull request for -final, but...

author
#2 lore raw
Quoted 9 lines · Al Viro
Quoted 5 lines · Eric Paris

anon_inode_mkinode() sets inode->i_mode = S_IRUSR | S_IWUSR; This means that (inode->i_mode & S_IFMT) == 0. This trips up some SELinux code that needs to determine if a given inode is a regular file, a directory, etc. The easiest solution is to just make sure that the anon_inode also sets S_IFREG.

How urgent that one is? It is obvious enough, so I could include it into the pull request for -final, but...

printk spam. No hurry. Probably should have put that in the commit message.

-Eric