Skip to contentSkip to conversation

xattr

DISCUSSION James Carter 1 participant 2 messages Dec 2, 2003 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 1 line · Russell Coker

Please send me the patch Steve mentioned:

Here is the ext2 patch.

This patch is relative to linux 2.4.22 with the ea+acl+nfsacl-2.4.22-0.8.61.diff applied. (It will also apply cleanly with the ea and acl patches applied.) It is a backport of the extended attribute handler in the 2.5/6 kernel for security modules.

For the 2.4.21 kernel I used the ea+acl+nfsacl because that was the only patch available, in the 2.4.22 kernel I used only the ea patch, since that was all that was needed to support SELinux. For 2.4.23, I plan on going back to the full patch (or at least ea and acl) since there seems to be interest in using acls along with SELinux.

 Documentation/Configure.help |   10 ++++++
 fs/Config.in                 |    2 +
 fs/ext2/Makefile             |    1 
 fs/ext2/super.c              |    8 ++++
 fs/ext2/xattr_security.c     |   69 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/ext2_xattr.h   |   21 +++++++++++++
 6 files changed, 110 insertions(+), 1 deletion(-)

Index: linux-2.4/Documentation/Configure.help

Documentation/Configure.help renamed from Documentation/Configure.help:1.1.1.2 +10 -0
diff -u linux-2.4/Documentation/Configure.help:1.1.1.2 linux-2.4/Documentation/Configure.help:1.10
@@ -15653,6 +15653,16 @@
 
   If unsure, say N.
 
+Ext2 Security Labels
+CONFIG_EXT2_FS_SECURITY
+  Security labels support alternative access control models
+  implemented by security modules like SELinux.  This option
+  enables an extended attribute handler for file security
+  labels in the ext2 filesystem.
+
+  If you are not using a security module that requires using
+  extended attributes for file security labels, say N.
+
 Ext2 POSIX Access Control Lists
 CONFIG_EXT2_FS_POSIX_ACL
   POSIX Access Control Lists (ACLs) support permissions for users and

Index: linux-2.4/fs/Config.in

fs/Config.in renamed from fs/Config.in:1.1.1.2 +2 -0
diff -u linux-2.4/fs/Config.in:1.1.1.2 linux-2.4/fs/Config.in:1.7
@@ -104,6 +104,8 @@
     CONFIG_EXT2_FS_XATTR_USER $CONFIG_EXT2_FS_XATTR
 dep_bool '    Ext2 trusted extended attributes' \
     CONFIG_EXT2_FS_XATTR_TRUSTED $CONFIG_EXT2_FS_XATTR
+dep_bool '    Ext2 security labels' \
+    CONFIG_EXT2_FS_SECURITY $CONFIG_EXT2_FS_XATTR
 dep_bool '    Ext2 POSIX Access Control Lists' \
 	CONFIG_EXT2_FS_POSIX_ACL $CONFIG_EXT2_FS_XATTR
 

Index: linux-2.4/fs/ext2/Makefile

fs/ext2/Makefile renamed from fs/ext2/Makefile:1.1.1.2 +1 -0
diff -u linux-2.4/fs/ext2/Makefile:1.1.1.2 linux-2.4/fs/ext2/Makefile:1.3
@@ -17,6 +17,7 @@
 obj-$(CONFIG_EXT2_FS_XATTR) += xattr.o
 obj-$(CONFIG_EXT2_FS_XATTR_USER) += xattr_user.o
 obj-$(CONFIG_EXT2_FS_XATTR_TRUSTED) += xattr_trusted.o
+obj-$(CONFIG_EXT2_FS_SECURITY) += xattr_security.o
 obj-$(CONFIG_EXT2_FS_POSIX_ACL) += acl.o
 
 include $(TOPDIR)/Rules.make

Index: linux-2.4/fs/ext2/super.c

fs/ext2/super.c renamed from fs/ext2/super.c:1.1.1.2 +7 -1
diff -u linux-2.4/fs/ext2/super.c:1.1.1.2 linux-2.4/fs/ext2/super.c:1.3
@@ -869,14 +869,20 @@
 	error = init_ext2_xattr_trusted();
 	if (error)
 		goto fail2;
-	error = init_ext2_acl();
+	error = init_ext2_xattr_security();
 	if (error)
 		goto fail3;
+	error = init_ext2_acl();
+	if (error)
+		goto fail4;
+
 	error = register_filesystem(&ext2_fs_type);
 	if (!error)
 		return 0;
 
 	exit_ext2_acl();
+fail4:
+	exit_ext2_xattr_security();
 fail3:
 	exit_ext2_xattr_trusted();
 fail2:

Index: linux-2.4/fs/ext2/xattr_security.c

fs/ext2/xattr_security.c new file +69 -0

69 lines not on this page · raw message

Index: linux-2.4/include/linux/ext2_xattr.h

include/linux/ext2_xattr.h renamed from include/linux/ext2_xattr.h:1.1.1.2 +21 -0
diff -u linux-2.4/include/linux/ext2_xattr.h:1.1.1.2 linux-2.4/include/linux/ext2_xattr.h:1.5
@@ -22,6 +22,7 @@
 #define EXT2_XATTR_INDEX_POSIX_ACL_ACCESS	2
 #define EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT	3
 #define EXT2_XATTR_INDEX_TRUSTED		4
+#define EXT2_XATTR_INDEX_SECURITY		6
 
 struct ext2_xattr_header {
 	__u32	h_magic;	/* magic number for identification */
@@ -175,6 +176,26 @@
 }
 
 # endif  /* CONFIG_EXT2_FS_XATTR_TRUSTED */
+
+# ifdef CONFIG_EXT2_FS_SECURITY
+
+extern int init_ext2_xattr_security(void) __init;
+extern void exit_ext2_xattr_security(void);
+
+# else  /* CONFIG_EXT2_FS_SECURITY */
+
+static inline int
+init_ext2_xattr_security(void)
+{
+	return 0;
+}
+
+static inline void
+exit_ext2_xattr_security(void)
+{
+}
+
+#endif	/* CONFIG_EXT2_FS_SECURITY */
 
 #endif  /* __KERNEL__ */
 
Signature · 7 lines
James Carter <[email protected]>
National Security Agency

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
In reply to a message not in the archive
Quoted 1 line · Russell Coker

Please send me the patch Steve mentioned:

Here is the ext3 patch.

This patch is relative to linux 2.4.22 with the ea+acl+nfsacl-2.4.22-0.8.61.diff applied. (It will also apply cleanly with the ea and acl patches applied.) It is a backport of the extended attribute handler in the 2.5/6 kernel for security modules.

For the 2.4.21 kernel I used the ea+acl+nfsacl because that was the only patch available, in the 2.4.22 kernel I used only the ea patch, since that was all that was needed to support SELinux. For 2.4.23, I plan on going back to the full patch (or at least ea and acl) since there seems to be interest in using acls along with SELinux.

 Documentation/Configure.help |   10 ++++++
 fs/Config.in                 |    2 +
 fs/ext3/Makefile             |    1 
 fs/ext3/super.c              |    8 ++++-
 fs/ext3/xattr_security.c     |   68 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/ext3_xattr.h   |   23 ++++++++++++++
 6 files changed, 111 insertions(+), 1 deletion(-)

Index: linux-2.4/Documentation/Configure.help

Documentation/Configure.help renamed from Documentation/Configure.help:1.1.1.2 +10 -0
diff -u linux-2.4/Documentation/Configure.help:1.1.1.2 linux-2.4/Documentation/Configure.help:1.10
@@ -15722,6 +15722,16 @@
 
   If unsure, say N.
 
+Ext3 Security Labels
+CONFIG_EXT3_FS_SECURITY
+  Security labels support alternative access control models
+  implemented by security modules like SELinux.  This option
+  enables an extended attribute handler for file security
+  labels in the ext3 filesystem.
+
+  If you are not using a security module that requires using
+  extended attributes for file security labels, say N.
+
 Ext3 POSIX Access Control Lists
 CONFIG_EXT3_FS_POSIX_ACL
   POSIX Access Control Lists (ACLs) support permissions for users and

Index: linux-2.4/fs/Config.in

fs/Config.in renamed from fs/Config.in:1.1.1.2 +2 -0
diff -u linux-2.4/fs/Config.in:1.1.1.2 linux-2.4/fs/Config.in:1.7
@@ -36,6 +36,8 @@
     CONFIG_EXT3_FS_XATTR_USER $CONFIG_EXT3_FS_XATTR
 dep_bool '    Ext3 trusted extended attributes' \
     CONFIG_EXT3_FS_XATTR_TRUSTED $CONFIG_EXT3_FS_XATTR
+dep_bool '    Ext3 security labels' \
+    CONFIG_EXT3_FS_SECURITY $CONFIG_EXT3_FS_XATTR
 dep_bool '    Ext3 POSIX Access Control Lists' \
     CONFIG_EXT3_FS_POSIX_ACL $CONFIG_EXT3_FS_XATTR
 # CONFIG_JBD could be its own option (even modular), but until there are

Index: linux-2.4/fs/ext3/Makefile

fs/ext3/Makefile renamed from fs/ext3/Makefile:1.1.1.2 +1 -0
diff -u linux-2.4/fs/ext3/Makefile:1.1.1.2 linux-2.4/fs/ext3/Makefile:1.5
@@ -17,6 +17,7 @@
 obj-$(CONFIG_EXT3_FS_XATTR) += xattr.o
 obj-$(CONFIG_EXT3_FS_XATTR_USER) += xattr_user.o
 obj-$(CONFIG_EXT3_FS_XATTR_TRUSTED) += xattr_trusted.o
+obj-$(CONFIG_EXT3_FS_SECURITY) += xattr_security.o
 obj-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
 
 include $(TOPDIR)/Rules.make

Index: linux-2.4/fs/ext3/super.c

fs/ext3/super.c renamed from fs/ext3/super.c:1.1.1.2 +7 -1
diff -u linux-2.4/fs/ext3/super.c:1.1.1.2 linux-2.4/fs/ext3/super.c:1.3
@@ -1882,14 +1882,20 @@
 	error = init_ext3_xattr_trusted();
 	if (error)
 		goto fail2;
-	error = init_ext3_acl();
+	error = init_ext3_xattr_security();
 	if (error)
 		goto fail3;
+	error = init_ext3_acl();
+	if (error)
+		goto fail4;
+
 	error = register_filesystem(&ext3_fs_type);
 	if (!error)
 		return 0;
 	
 	exit_ext3_acl();
+fail4:
+	exit_ext3_xattr_security();
 fail3:
 	exit_ext3_xattr_trusted();
 fail2:

Index: linux-2.4/fs/ext3/xattr_security.c

fs/ext3/xattr_security.c new file +68 -0

68 lines not on this page · raw message

Index: linux-2.4/include/linux/ext3_xattr.h

include/linux/ext3_xattr.h renamed from include/linux/ext3_xattr.h:1.1.1.2 +23 -0
diff -u linux-2.4/include/linux/ext3_xattr.h:1.1.1.2 linux-2.4/include/linux/ext3_xattr.h:1.6
@@ -22,6 +22,7 @@
 #define EXT3_XATTR_INDEX_POSIX_ACL_ACCESS	2
 #define EXT3_XATTR_INDEX_POSIX_ACL_DEFAULT	3
 #define EXT3_XATTR_INDEX_TRUSTED		4
+#define EXT3_XATTR_INDEX_SECURITY		6
 
 struct ext3_xattr_header {
 	__u32	h_magic;	/* magic number for identification */
@@ -178,5 +179,27 @@
 
 #endif  /* CONFIG_EXT3_FS_XATTR_TRUSTED */
 
+# ifdef CONFIG_EXT3_FS_SECURITY
+
+extern int init_ext3_xattr_security(void) __init;
+extern void exit_ext3_xattr_security(void);
+
+# else  /* CONFIG_EXT3_FS_SECURITY */
+
+static inline int
+init_ext3_xattr_security(void)
+{
+	return 0;
+}
+
+static inline void
+exit_ext3_xattr_security(void)
+{
+}
+
+#endif	/* CONFIG_EXT3_FS_SECURITY */
+
 #endif  /* __KERNEL__ */
+
+
 
Signature · 7 lines
James Carter <[email protected]>
National Security Agency

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.