xattr
What is the status of xattr support in 2.5.x?
How is journalling of xattr's being handled?
For correct operation of SE Linux we need to have the xattr that is used for the security context be changed atomically, and if a file is created and immediately has the xattr set then ideally we would have the file creation and the xattr creation in the same journal entry.
Is this possible? If doing this requires that the file system be mounted with data=journal then this will be fine.
Signature · 4 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page
Quoted 2 lines · Russell Coker
What is the status of xattr support in 2.5.x?
Please read www.namesys.com/v4/v4.html. I will be happy to add support for desired security attributes using the V4 plugin infrastructure, and especially pleased to accept patches that do so. It is trivially easy to compose plugins that commit atomically, and most of them do so by default.
I note that we are not listed in spamcop, and thank you for that. Our itanium is now installed, and work has started on moving our mail+web server to new hardware and OS version. When that is complete, the mailing list software will be given to a kind volunteer to de-spam.
Quoted 9 lines
How is journalling of xattr's being handled?
For correct operation of SE Linux we need to have the xattr that is used for the security context be changed atomically, and if a file is created and immediately has the xattr set then ideally we would have the file creation and the xattr creation in the same journal entry.
Is this possible? If doing this requires that the file system be mounted with data=journal then this will be fine.
Namesys generally avoids disturbing the stability of V3 with new features. V4 is coming out this summer, and it is better to focus developers on V4. This is not a categorical rejection, just a gut first reaction.
Signature · 1 line
Hans
Quoted 11 lines · Russell Coker
What is the status of xattr support in 2.5.x?
How is journalling of xattr's being handled?
For correct operation of SE Linux we need to have the xattr that is used for the security context be changed atomically, and if a file is created and immediately has the xattr set then ideally we would have the file creation and the xattr creation in the same journal entry.
Is this possible? If doing this requires that the file system be mounted with data=journal then this will be fine.
How big are the xattrs you have in mind? We can get atomic writes of 4k in length but beyond that things get more difficult.
As for the xattr and the create in the same transaction, that's a little harder. We'd probably need a new syscall, or to change the semantics of the xattr call such that creating an xattr on a file that doesn't exist also creates the file.
-chris
On the topic of atomic xattr operations on ReiserFS as needed for the new LSM/SE Linux operations.
Quoted 2 lines · Chris Mason
How big are the xattrs you have in mind? We can get atomic writes of 4k in length but beyond that things get more difficult.
Most of them will be less than 80 bytes. They are currently of the form:
user-name:object_r:type
The user-name is the Unix account name which usually isn't much more than 8 bytes. The "type" is usually less than 15 bytes (the longest I've used so far is 20 bytes).
So the longest value I've used is 38 bytes.
Also they can't be chosen arbitarily by the user. The user gets some small control over the type within a range of types that the administrator permits. If the administrator permits overly long type names and has to deal with non-atomicity as a result then it's their issue.
If you can guarantee atomic operations on 160 byte operations (twice what I expect anyone to use) then it'll be fine.
Quoted 4 lines
As for the xattr and the create in the same transaction, that's a little harder. We'd probably need a new syscall, or to change the semantics of the xattr call such that creating an xattr on a file that doesn't exist also creates the file.
Creating a file by creating the xattr sounds like a bad idea as you can't control the Unix permissions of the file. This isn't much of a big deal with SE Linux as the security type determines who can access the file. But for other uses it may be a serious problem.
I agree that we need a new syscall and other people had the same idea before either of us.
Maybe ReiserFS could be used as the first implementation of this proposed new syscall...
Signature · 4 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page
Quoted 7 lines · Russell Coker
On the topic of atomic xattr operations on ReiserFS as needed for the new LSM/SE Linux operations.
Quoted 2 lines · Chris Mason
How big are the xattrs you have in mind? We can get atomic writes of 4k in length but beyond that things get more difficult.
Quoted 9 lines
Most of them will be less than 80 bytes. They are currently of the form:
user-name:object_r:typeThe user-name is the Unix account name which usually isn't much more than 8 bytes. The "type" is usually less than 15 bytes (the longest I've used so far is 20 bytes).
So the longest value I've used is 38 bytes.
Then data=journal mode will do what you want. You'll get atomic writes up to 4k. If you really don't want data=journal for the rest of the FS, we can make an option for using data logging on xattr files only. Jeff and I had wanted to avoid the complication but it is at least possible.
Quoted 18 lines
Also they can't be chosen arbitarily by the user. The user gets some small control over the type within a range of types that the administrator permits. If the administrator permits overly long type names and has to deal with non-atomicity as a result then it's their issue.
If you can guarantee atomic operations on 160 byte operations (twice what I expect anyone to use) then it'll be fine.
Quoted 4 lines
As for the xattr and the create in the same transaction, that's a little harder. We'd probably need a new syscall, or to change the semantics of the xattr call such that creating an xattr on a file that doesn't exist also creates the file.
Creating a file by creating the xattr sounds like a bad idea as you can't control the Unix permissions of the file. This isn't much of a big deal with SE Linux as the security type determines who can access the file. But for other uses it may be a serious problem.
Quoted 5 lines
I agree that we need a new syscall and other people had the same idea before either of us.
Maybe ReiserFS could be used as the first implementation of this proposed new syscall...
It would be best to go through Andreas Gruenbacher for xattr API changes. He's quite reasonable.
-chris
Quoted 6 lines · Chris Mason
Quoted 1 line
So the longest value I've used is 38 bytes.
Then data=journal mode will do what you want. You'll get atomic writes up to 4k. If you really don't want data=journal for the rest of the FS, we can make an option for using data logging on xattr files only. Jeff and I had wanted to avoid the complication but it is at least possible.
OK. Initially just using data=journal should be fine, and even for wide-spread use, forcing everyone to use data=journal shouldn't be too much of a hardship - although I'm sure that some people will prefer to journal only the xattr's.
Signature · 4 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page
Quoted 6 lines · Russell Coker
On the topic of atomic xattr operations on ReiserFS as needed for the new LSM/SE Linux operations.
Quoted 2 lines · Chris Mason
How big are the xattrs you have in mind? We can get atomic writes of 4k in length but beyond that things get more difficult.
4k should be fine.
Quoted 10 lines
Quoted 4 lines
As for the xattr and the create in the same transaction, that's a little harder. We'd probably need a new syscall, or to change the semantics of the xattr call such that creating an xattr on a file that doesn't exist also creates the file.
Creating a file by creating the xattr sounds like a bad idea as you can't control the Unix permissions of the file. This isn't much of a big deal with SE Linux as the security type determines who can access the file. But for other uses it may be a serious problem.
Quoted 5 lines
I agree that we need a new syscall and other people had the same idea before either of us.
Maybe ReiserFS could be used as the first implementation of this proposed new syscall...
No, this doesn't have to be done in the same transaction, even under the old SELinux API. The setting of the file security label is performed by the security_inode_post_create/mkdir/... hook call in fs/namei.c, which is done while the parent directory semaphore is still held. In the old API, the desired file security label was specified via open_secure/mkdir_secure/etc system calls and saved in the per-task security field for use by the security_inode_post_create/mkdir/... hook. In the new API, the desired file security label is specified by writing it to /proc/pid/attr/fscreate and then performing an ordinary open()/mkdir()/etc call. It is an attribute of the task that is applied to subsequent file creations, similar to the umask.
I seem to be missing a little context; last I looked, reiser in mainline kernels still didn't provide xattr support. Will this be changing soon?
Signature · 2 lines
Stephen Smalley <[email protected]> National Security Agency
Quoted 11 lines · Stephen Smalley
Quoted 10 lines
Creating a file by creating the xattr sounds like a bad idea as you can't control the Unix permissions of the file. This isn't much of a big deal with SE Linux as the security type determines who can access the file. But for other uses it may be a serious problem.
I agree that we need a new syscall and other people had the same idea before either of us.
Maybe ReiserFS could be used as the first implementation of this proposed new syscall...
Quoted 12 lines
No, this doesn't have to be done in the same transaction, even under the old SELinux API. The setting of the file security label is performed by the security_inode_post_create/mkdir/... hook call in
fs/namei.c, which is done while the parent directory semaphore is still held. In the old API, the desired file security label was specified via open_secure/mkdir_secure/etc system calls and saved in the per-task security field for use by the security_inode_post_create/mkdir/... hook. In the new API, the desired file security label is specified by writing it to/proc/pid/attr/fscreateand then performing an ordinary open()/mkdir()/etc call. It is an attribute of the task that is applied to subsequent file creations, similar to the umask.
Ok, so in the new api, the xattr information is available at the time of the create. reiserfs would be able to include it all into the same transaction but doesn't do it right now.
Quoted 2 lines
I seem to be missing a little context; last I looked, reiser in mainline kernels still didn't provide xattr support. Will this be changing soon?
First we need to get the data logging code in (which Hans has agreed to), getting the xattr code in depends on Hans, Jeff Mahoney will be maintaining as an external patch otherwise.
-chris
Quoted 3 lines · Chris Mason
Ok, so in the new api, the xattr information is available at the time of the create. reiserfs would be able to include it all into the same transaction but doesn't do it right now.
This was true of the old API as well; the only difference is whether the attribute is specified as a parameter to an extended open/mkdir/etc call or whether it is set separately as a process attribute that is applied to subsequent ordinary open/mkdir/etc calls. Including the setxattr in the same transaction as the create is not strictly necessary, although it would be nice. The SELinux API change didn't change the create+set atomicity, which is still provided by performing the set before the parent directory semaphore is released.
Quoted 3 lines
First we need to get the data logging code in (which Hans has agreed to), getting the xattr code in depends on Hans, Jeff Mahoney will be maintaining as an external patch otherwise.
My impression (possibly wrong) is that Hans prefers a EA-as-file model, which I understand is also the Solaris model. The key question then becomes whether mainline reiser{3,4} will ever support the xattr inode operations (e.g. implementing them as reads/writes of the EA files associated with the inode). If not, then neither the SELinux "module" nor the SELinux userland will be able to access file security attributes on reiser{3,4} in the same manner as on ext[23], xfs, or jfs.
Signature · 2 lines
Stephen Smalley <[email protected]> National Security Agency
Quoted 5 lines · Stephen Smalley
Quoted 3 lines · Chris Mason
Ok, so in the new api, the xattr information is available at the time of the create. reiserfs would be able to include it all into the same transaction but doesn't do it right now.
Quoted 9 lines
This was true of the old API as well; the only difference is whether the attribute is specified as a parameter to an extended open/mkdir/etc call or whether it is set separately as a process attribute that is applied to subsequent ordinary open/mkdir/etc calls. Including the setxattr in the same transaction as the create is not strictly necessary, although it would be nice. The SELinux API change didn't change the create+set atomicity, which is still provided by performing the set before the parent directory semaphore is released.
Ok, I get it. You would need a special reiserfs xattr add on patch to get the atomicity right.
Quoted 11 lines
Quoted 3 lines
First we need to get the data logging code in (which Hans has agreed to), getting the xattr code in depends on Hans, Jeff Mahoney will be maintaining as an external patch otherwise.
My impression (possibly wrong) is that Hans prefers a EA-as-file model, which I understand is also the Solaris model. The key question then becomes whether mainline reiser{3,4} will ever support the xattr inode operations (e.g. implementing them as reads/writes of the EA files associated with the inode). If not, then neither the SELinux "module" nor the SELinux userland will be able to access file security attributes on reiser{3,4} in the same manner as on ext[23], xfs, or jfs.
The reiserfsv3 xattr patches maintained by SuSE implement the xattr api (acl.bestbits.at). The xattrs happen to be implemented as individual files on disk because reiserfs is so well suited for it, and because it allowed Jeff to code them without changing the v3 disk format.
But, these files are only available through the xattr api right now, and they are not visible via tools like ls etc.
Not sure how namesys is doing things in version 4, but I'd bet they are willing to talk about making it work with SELinux.
-chris
Quoted 2 lines · Chris Mason
Ok, I get it. You would need a special reiserfs xattr add on patch to get the atomicity right.
I don't think so. If you crash between the create and the setxattr, you'll just have an empty file that has no xattr, which will effectively just cause it to be mapped to a default security label until an xattr is set administratively. No real harm.
Quoted 7 lines
The reiserfsv3 xattr patches maintained by SuSE implement the xattr api (acl.bestbits.at). The xattrs happen to be implemented as individual files on disk because reiserfs is so well suited for it, and because it allowed Jeff to code them without changing the v3 disk format.
But, these files are only available through the xattr api right now, and they are not visible via tools like ls etc.
Which is what we would want. SELinux userland will only access them via xattr API (actually via a SELinux API wrapped around the xattr calls to encapsulate the use of xattr and the specific xattr name).
Signature · 2 lines
Stephen Smalley <[email protected]> National Security Agency
how to fix the file system which has a dangling file?
In reply to Chris MasonHello!
I accidently ran a novice application to create a big file, that was bigger than the size of available disk space.
So it created a dangling file which can not be removed, even I can not remove the directory including that file.
I ran "fsck -f" , it did not help.
It is on EX2 file system.
Please provide me any idea to remove it.
Thanks,
Bo
Quoted 7 lines · Chris Mason
Quoted 4 lines · Russell Coker
What is the status of xattr support in 2.5.x?
How is journalling of xattr's being handled?
Quoted 9 lines
Quoted 5 lines
For correct operation of SE Linux we need to have the xattr that is used for the security context be changed atomically, and if a file is created and immediately has the xattr set then ideally we would have the file creation and the xattr creation in the same journal entry.
Is this possible? If doing this requires that the file system be mounted with data=journal then this will be fine.
How big are the xattrs you have in mind? We can get atomic writes of 4k in length but beyond that things get more difficult.
it is complete trivial to do it in reiser4.
Quoted 4 lines
As for the xattr and the create in the same transaction, that's a little harder.
equally easy in reiser4.
Quoted 11 lines
We'd probably need a new syscall, or to change the semantics of the xattr call such that creating an xattr on a file that doesn't exist also creates the file.
-chris
V3 should not have new features added to it. It needs to be zero defect, and avoiding new features is the only way.
Signature · 1 line
Hans