linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] anon_inode: set S_IFREG on the anon_inode
@ 2010-05-14 20:05 Eric Paris
  2010-05-14 20:23 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Paris @ 2010-05-14 20:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: viro, akpm, npiggin

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.

Signed-off-by: Eric Paris <eparis@redhat.com>
---

 fs/anon_inodes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index e4b75d6..9bd4b38 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -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;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] anon_inode: set S_IFREG on the anon_inode
  2010-05-14 20:05 [PATCH] anon_inode: set S_IFREG on the anon_inode Eric Paris
@ 2010-05-14 20:23 ` Al Viro
  2010-05-14 20:26   ` Eric Paris
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2010-05-14 20:23 UTC (permalink / raw)
  To: Eric Paris; +Cc: linux-kernel, akpm, npiggin

On Fri, May 14, 2010 at 04:05:59PM -0400, Eric Paris wrote:
> 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...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] anon_inode: set S_IFREG on the anon_inode
  2010-05-14 20:23 ` Al Viro
@ 2010-05-14 20:26   ` Eric Paris
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Paris @ 2010-05-14 20:26 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-kernel, akpm, npiggin

On Fri, 2010-05-14 at 21:23 +0100, Al Viro wrote:
> On Fri, May 14, 2010 at 04:05:59PM -0400, Eric Paris wrote:
> > 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-14 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-14 20:05 [PATCH] anon_inode: set S_IFREG on the anon_inode Eric Paris
2010-05-14 20:23 ` Al Viro
2010-05-14 20:26   ` Eric Paris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).