* [Ocfs2-devel] Invalid file rights
@ 2004-08-03 2:25 Chen, Yukun
2004-08-03 13:49 ` Mark Fasheh
0 siblings, 1 reply; 4+ messages in thread
From: Chen, Yukun @ 2004-08-03 2:25 UTC (permalink / raw)
To: ocfs2-devel
Hi All
I find a file rights bug on kernel 2.4 with svn 1313 code. Steps to
duplicate
Being root, create a file in a ocfs2 partition with the sentence below
open(filename, O_CREAT | O_RDWR )
Then the file will be created with a right 000 --- nobody can write/read
it at
all.
But, if I use "touch filename" , the file will be created with a right
of 644.
Any ideas on it? (a bug # 113 has been reported to oss.oracle.com
bugzilla)
Thanx.
Aaron
Intel China Software Lab
Tel: 8621-52574545 Ext.1587
E_mail:yukun.chen@intel.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Ocfs2-devel] Invalid file rights
2004-08-03 2:25 [Ocfs2-devel] Invalid file rights Chen, Yukun
@ 2004-08-03 13:49 ` Mark Fasheh
0 siblings, 0 replies; 4+ messages in thread
From: Mark Fasheh @ 2004-08-03 13:49 UTC (permalink / raw)
To: ocfs2-devel
On Tue, Aug 03, 2004 at 03:25:42PM +0800, Chen, Yukun wrote:
> Hi All
>
> I find a file rights bug on kernel 2.4 with svn 1313 code. Steps to
> duplicate
>
> Being root, create a file in a ocfs2 partition with the sentence below
>
> open(filename, O_CREAT | O_RDWR )
>
> Then the file will be created with a right 000 --- nobody can write/read
> it at all.
Right, and we get the mode from the kernel for this, right? Is there some
policy which we're missing? In ocfs_mknod_locked we do "fe->i_mode = mode;"
so it's definitely being set on disk. later on we also do "inode->i_mode =
mode;".
> But, if I use "touch filename" , the file will be created with a right
> of 644.
Well, that'd be because:
[mfasheh@expo ocfs2]$ strace touch file
<snip>
open("file", O_WRONLY|O_NONBLOCK|O_CREAT|O_NOCTTY|O_LARGEFILE, 0666) = 3
<snip>
So that's "touch" setting the mode there.
> Any ideas on it? (a bug # 113 has been reported to oss.oracle.com
> bugzilla)
So the "touch" case is obvious, but I'm not sure that the 1st one is a bug
either... If it is, please explain why.
--Mark
--
Mark Fasheh
Software Developer, Oracle Corp
mark.fasheh@oracle.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Ocfs2-devel] Invalid file rights
@ 2004-08-03 20:51 Chen, Yukun
2004-08-03 21:42 ` Kurt Hackel
0 siblings, 1 reply; 4+ messages in thread
From: Chen, Yukun @ 2004-08-03 20:51 UTC (permalink / raw)
To: ocfs2-devel
Yeah. You are right.
I take it for granted that a file will be granted some default rights =
for its owner, such as read/write, when it is created with =
open(...,...|O_CREAT) .
I traced the source code of ocfs2 and found the kernel return a mode =
8000 really that means nobody can access the file. Also, I checked it =
with ext3 filesystem and got the same results.
So, I think it is nature and it is not a bug yet.
Thanx.
Aaron
-----Original Message-----
From: Mark Fasheh [mailto:mark.fasheh@oracle.com]=20
Sent: 2004=C4=EA8=D4=C24=C8=D5 2:49
To: Chen, Yukun
Cc: ocfs2-devel@oss.oracle.com
Subject: Re: [Ocfs2-devel] Invalid file rights
On Tue, Aug 03, 2004 at 03:25:42PM +0800, Chen, Yukun wrote:
> Hi All
>=20
> I find a file rights bug on kernel 2.4 with svn 1313 code. Steps to
> duplicate
>=20
> Being root, create a file in a ocfs2 partition with the sentence below
>=20
> open(filename, O_CREAT | O_RDWR )
>=20
> Then the file will be created with a right 000 --- nobody can =
write/read
> it at all.=20
Right, and we get the mode from the kernel for this, right? Is there =
some
policy which we're missing? In ocfs_mknod_locked we do "fe->i_mode =3D =
mode;"
so it's definitely being set on disk. later on we also do "inode->i_mode =
=3D
mode;".
> But, if I use "touch filename" , the file will be created with a right
> of 644.
Well, that'd be because:
[mfasheh@expo ocfs2]$ strace touch file
<snip>
open("file", O_WRONLY|O_NONBLOCK|O_CREAT|O_NOCTTY|O_LARGEFILE, 0666) =3D =
3
<snip>
So that's "touch" setting the mode there.
=20
> Any ideas on it? (a bug # 113 has been reported to oss.oracle.com
> bugzilla)
So the "touch" case is obvious, but I'm not sure that the 1st one is a =
bug
either... If it is, please explain why.
--Mark
--
Mark Fasheh
Software Developer, Oracle Corp
mark.fasheh@oracle.com
^ permalink raw reply [flat|nested] 4+ messages in thread* [Ocfs2-devel] Invalid file rights
2004-08-03 20:51 Chen, Yukun
@ 2004-08-03 21:42 ` Kurt Hackel
0 siblings, 0 replies; 4+ messages in thread
From: Kurt Hackel @ 2004-08-03 21:42 UTC (permalink / raw)
To: ocfs2-devel
Yeah I think this is why libc provides...
int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);
That "overloaded" open with the mode is only used for the O_CREAT case.
Thanks!
-kurt
On Wed, Aug 04, 2004 at 09:51:20AM +0800, Chen, Yukun wrote:
> Yeah. You are right.
>
> I take it for granted that a file will be granted some default rights for its owner, such as read/write, when it is created with open(...,...|O_CREAT) .
> I traced the source code of ocfs2 and found the kernel return a mode 8000 really that means nobody can access the file. Also, I checked it with ext3 filesystem and got the same results.
>
> So, I think it is nature and it is not a bug yet.
> Thanx.
>
> Aaron
>
> -----Original Message-----
> From: Mark Fasheh [mailto:mark.fasheh@oracle.com]
> Sent: 2004??8??4?? 2:49
> To: Chen, Yukun
> Cc: ocfs2-devel@oss.oracle.com
> Subject: Re: [Ocfs2-devel] Invalid file rights
>
> On Tue, Aug 03, 2004 at 03:25:42PM +0800, Chen, Yukun wrote:
> > Hi All
> >
> > I find a file rights bug on kernel 2.4 with svn 1313 code. Steps to
> > duplicate
> >
> > Being root, create a file in a ocfs2 partition with the sentence below
> >
> > open(filename, O_CREAT | O_RDWR )
> >
> > Then the file will be created with a right 000 --- nobody can write/read
> > it at all.
> Right, and we get the mode from the kernel for this, right? Is there some
> policy which we're missing? In ocfs_mknod_locked we do "fe->i_mode = mode;"
> so it's definitely being set on disk. later on we also do "inode->i_mode =
> mode;".
>
> > But, if I use "touch filename" , the file will be created with a right
> > of 644.
> Well, that'd be because:
>
> [mfasheh@expo ocfs2]$ strace touch file
> <snip>
> open("file", O_WRONLY|O_NONBLOCK|O_CREAT|O_NOCTTY|O_LARGEFILE, 0666) = 3
> <snip>
>
> So that's "touch" setting the mode there.
>
> > Any ideas on it? (a bug # 113 has been reported to oss.oracle.com
> > bugzilla)
> So the "touch" case is obvious, but I'm not sure that the 1st one is a bug
> either... If it is, please explain why.
> --Mark
>
> --
> Mark Fasheh
> Software Developer, Oracle Corp
> mark.fasheh@oracle.com
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-08-03 21:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-03 2:25 [Ocfs2-devel] Invalid file rights Chen, Yukun
2004-08-03 13:49 ` Mark Fasheh
-- strict thread matches above, loose matches on Subject: below --
2004-08-03 20:51 Chen, Yukun
2004-08-03 21:42 ` Kurt Hackel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.