* SELinux inode size gotcha in btrfs.
@ 2012-02-27 22:18 Alex
2012-02-27 23:09 ` Hugo Mills
2012-02-27 23:17 ` David Sterba
0 siblings, 2 replies; 5+ messages in thread
From: Alex @ 2012-02-27 22:18 UTC (permalink / raw)
To: linux-btrfs
Hi All,
I've come across the 'gotcha' in XFS where the inode size defaults to 256 [1]
whereas for SELinux the attributes play better when you initialise it at
creation to 512.
>From my reading of the btrfs specs [2] it doesn't look like you'll get caught
with that as the inodes "will not contain embedded file data or extended
attribute data. These things are stored in other item types."
Have I read that right? I've seen xattr bugs patches etc but nothing that would
hit the SE Linux domain.
[1]
http://www.gentoo.org/proj/en/hardened/selinux/selinux-handbook.xml?part=2&chap=1
[2] http://btrfs.ipv5.de/index.php?title=Btrfs_design#Inodes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SELinux inode size gotcha in btrfs. 2012-02-27 22:18 SELinux inode size gotcha in btrfs Alex @ 2012-02-27 23:09 ` Hugo Mills 2012-02-27 23:17 ` David Sterba 1 sibling, 0 replies; 5+ messages in thread From: Hugo Mills @ 2012-02-27 23:09 UTC (permalink / raw) To: Alex; +Cc: linux-btrfs [-- Attachment #1: Type: text/plain, Size: 1361 bytes --] On Mon, Feb 27, 2012 at 10:18:55PM +0000, Alex wrote: > I've come across the 'gotcha' in XFS where the inode size defaults to 256 [1] > whereas for SELinux the attributes play better when you initialise it at > creation to 512. A btrfs inode structure is 136 bytes in size. xattrs and any inline file data are separate from the inode structure, stored with additional keys in the FS tree (which means that they're quite likely to appear in the same page, as the inode data, but not guaranteed). > From my reading of the btrfs specs [2] it doesn't look like you'll get caught > with that as the inodes "will not contain embedded file data or extended > attribute data. These things are stored in other item types." > > Have I read that right? I've seen xattr bugs patches etc but nothing that would > hit the SE Linux domain. It's not clear from looking at the gentoo doc what the problem actually is with different inode sizes... Without some kind of indication what the issue really is, it's kind of hard to say how this might affect btrfs. Hugo. -- === Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk === PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk --- The enemy have elected for Death by Powerpoint. That's what --- they shall get. -- gdb [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SELinux inode size gotcha in btrfs. 2012-02-27 22:18 SELinux inode size gotcha in btrfs Alex 2012-02-27 23:09 ` Hugo Mills @ 2012-02-27 23:17 ` David Sterba 2012-02-28 11:30 ` Alex 1 sibling, 1 reply; 5+ messages in thread From: David Sterba @ 2012-02-27 23:17 UTC (permalink / raw) To: Alex; +Cc: linux-btrfs On Mon, Feb 27, 2012 at 10:18:55PM +0000, Alex wrote: > From my reading of the btrfs specs [2] it doesn't look like you'll get caught > with that as the inodes "will not contain embedded file data or extended > attribute data. These things are stored in other item types." > > Have I read that right? I've seen xattr bugs patches etc but nothing that would > hit the SE Linux domain. That's right. Inode represented as btrfs_inode_item does not contain any xattr fields, they're stored independently as a btrfs_dir_item of type BTRFS_FT_XATTR . Due to the way the b-tree keys are built, the xattr item key should be stored near the inode item key, that's for the tree search side. The xattr data are always stored inline in the b-tree leaf. david ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SELinux inode size gotcha in btrfs. 2012-02-27 23:17 ` David Sterba @ 2012-02-28 11:30 ` Alex 2012-02-28 11:37 ` Hugo Mills 0 siblings, 1 reply; 5+ messages in thread From: Alex @ 2012-02-28 11:30 UTC (permalink / raw) To: linux-btrfs David Sterba <dave <at> jikos.cz> writes: > > That's right. Inode represented as btrfs_inode_item does not contain any > xattr fields, they're stored independently as a btrfs_dir_item of type > BTRFS_FT_XATTR . Due to the way the b-tree keys are built, the xattr > item key should be stored near the inode item key, that's for the tree > search side. The xattr data are always stored inline in the b-tree leaf. > Thank you David and Hugo, My bad on three counts: 1) My courtesy close seems to have gone missing. Sorry and thank you for replying. 2) I, perhaps, should have pointed to https://wiki.debian.org/SELinux/Setup#Prerequisites _.28kernel_and_filesystems.29 which gives a better explanation. 3) Made it clear that I wasn't attacking XFS, It's my fs of (non /boot) choice for some years now; I'm exploring SELinux (after the recent Linux conf au 2012 talk) and know I have used inode size defaults for my xfs init back in the day! Best Al. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SELinux inode size gotcha in btrfs. 2012-02-28 11:30 ` Alex @ 2012-02-28 11:37 ` Hugo Mills 0 siblings, 0 replies; 5+ messages in thread From: Hugo Mills @ 2012-02-28 11:37 UTC (permalink / raw) To: Alex; +Cc: linux-btrfs [-- Attachment #1: Type: text/plain, Size: 1788 bytes --] On Tue, Feb 28, 2012 at 11:30:26AM +0000, Alex wrote: > David Sterba <dave <at> jikos.cz> writes: > > > > > That's right. Inode represented as btrfs_inode_item does not contain any > > xattr fields, they're stored independently as a btrfs_dir_item of type > > BTRFS_FT_XATTR . Due to the way the b-tree keys are built, the xattr > > item key should be stored near the inode item key, that's for the tree > > search side. The xattr data are always stored inline in the b-tree leaf. > > > > > Thank you David and Hugo, > > My bad on three counts: > 1) My courtesy close seems to have gone missing. > Sorry and thank you for replying. > 2) I, perhaps, should have pointed to > https://wiki.debian.org/SELinux/Setup#Prerequisites > _.28kernel_and_filesystems.29 > which gives a better explanation. Aaah, OK, that makes sense now. So: we don't have the issue over xattr sizes at all. The main issue would then seem to be over atomicity of writing xattrs -- I don't know what the APIs for this look like, or whether we've implemented them, so I can't comment any further on btrfs's suitability I'm afraid. > 3) Made it clear that I wasn't attacking > XFS, It's my fs of (non /boot) choice > for some years now; I'm exploring SELinux > (after the recent Linux conf au 2012 > talk) and know I have used inode size defaults > for my xfs init back in the day! I certainly didn't read it as such. Hugo. -- === Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk === PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk --- In the future, terrorists won't be carrying their ID cards. --- They'll be carrying yours. -- Henry Porter, Suspect Nation [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-02-28 11:37 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-02-27 22:18 SELinux inode size gotcha in btrfs Alex 2012-02-27 23:09 ` Hugo Mills 2012-02-27 23:17 ` David Sterba 2012-02-28 11:30 ` Alex 2012-02-28 11:37 ` Hugo Mills
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).