--- /dev/null
+ fs/ext3/xattr.c | 12 +++++-
+ fs/ext3/xattr_trusted.c | 86 +++++++++++++++++++++++++++++++++++++++++++++
+ include/linux/ext3_xattr.h | 6 +++
+ 3 files changed, 102 insertions(+), 2 deletions(-)
+
+Index: linux-2.4.18-chaos/fs/ext3/xattr.c
+===================================================================
+--- linux-2.4.18-chaos.orig/fs/ext3/xattr.c 2003-10-22 14:23:53.000000000 +0400
++++ linux-2.4.18-chaos/fs/ext3/xattr.c 2003-10-24 01:01:03.000000000 +0400
+@@ -1789,18 +1789,25 @@
+ int __init
+ init_ext3_xattr(void)
+ {
++ int error;
++
+ ext3_xattr_cache = mb_cache_create("ext3_xattr", NULL,
+ sizeof(struct mb_cache_entry) +
+ sizeof(struct mb_cache_entry_index), 1, 61);
+ if (!ext3_xattr_cache)
+ return -ENOMEM;
+
+- return 0;
++ error = init_ext3_xattr_trusted();
++ if (error)
++ mb_cache_destroy(ext3_xattr_cache);
++
++ return error;
+ }
+
+ void
+ exit_ext3_xattr(void)
+ {
++ exit_ext3_xattr_trusted();
+ if (ext3_xattr_cache)
+ mb_cache_destroy(ext3_xattr_cache);
+ ext3_xattr_cache = NULL;
+@@ -1811,12 +1818,13 @@
+ int __init
+ init_ext3_xattr(void)
+ {
+- return 0;
++ return init_ext3_xattr_trusted();
+ }
+
+ void
+ exit_ext3_xattr(void)
+ {
++ exit_ext3_xattr_trusted();
+ }
+
+ #endif /* CONFIG_EXT3_FS_XATTR_SHARING */
+Index: linux-2.4.18-chaos/fs/ext3/xattr_trusted.c
+===================================================================
+--- linux-2.4.18-chaos.orig/fs/ext3/xattr_trusted.c 2003-10-24 01:01:03.000000000 +0400
++++ linux-2.4.18-chaos/fs/ext3/xattr_trusted.c 2003-10-24 01:01:03.000000000 +0400
+@@ -0,0 +1,86 @@
++/*
++ * linux/fs/ext3/xattr_trusted.c
++ * Handler for trusted extended attributes.
++ *
++ * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
++ */
++
++#include <linux/module.h>
++#include <linux/string.h>
++#include <linux/fs.h>
++#include <linux/ext3_jbd.h>
++#include <linux/ext3_fs.h>
++#include <linux/ext3_xattr.h>
++
++#define XATTR_TRUSTED_PREFIX "trusted."
++
++static size_t
++ext3_xattr_trusted_list(char *list, struct inode *inode,
++ const char *name, int name_len)
++{
++ const int prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1;
++
++ if (!capable(CAP_SYS_ADMIN))
++ return 0;
++
++ if (list) {
++ memcpy(list, XATTR_TRUSTED_PREFIX, prefix_len);
++ memcpy(list+prefix_len, name, name_len);
++ list[prefix_len + name_len] = '\0';
++ }
++ return prefix_len + name_len + 1;
++}
++
++static int
++ext3_xattr_trusted_get(struct inode *inode, const char *name,
++ void *buffer, size_t size)
++{
++ if (strcmp(name, "") == 0)
++ return -EINVAL;
++ if (!capable(CAP_SYS_ADMIN))
++ return -EPERM;
++ return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name,
++ buffer, size);
++}
++
++static int
++ext3_xattr_trusted_set(struct inode *inode, const char *name,
++ const void *value, size_t size, int flags)
++{
++ handle_t *handle;
++ int error;
++
++ if (strcmp(name, "") == 0)
++ return -EINVAL;
++ if (!capable(CAP_SYS_ADMIN))
++ return -EPERM;
++ handle = ext3_journal_start(inode, EXT3_XATTR_TRANS_BLOCKS);
++ if (IS_ERR(handle))
++ return PTR_ERR(handle);
++ error = ext3_xattr_set(handle, inode, EXT3_XATTR_INDEX_TRUSTED, name,
++ value, size, flags);
++ ext3_journal_stop(handle, inode);
++
++ return error;
++}
++
++struct ext3_xattr_handler ext3_xattr_trusted_handler = {
++ .prefix = XATTR_TRUSTED_PREFIX,
++ .list = ext3_xattr_trusted_list,
++ .get = ext3_xattr_trusted_get,
++ .set = ext3_xattr_trusted_set,
++};
++
++int __init
++init_ext3_xattr_trusted(void)
++{
++ return ext3_xattr_register(EXT3_XATTR_INDEX_TRUSTED,
++ &ext3_xattr_trusted_handler);
++}
++
++void
++exit_ext3_xattr_trusted(void)
++{
++ ext3_xattr_unregister(EXT3_XATTR_INDEX_TRUSTED,
++ &ext3_xattr_trusted_handler);
++}
+Index: linux-2.4.18-chaos/include/linux/ext3_xattr.h
+===================================================================
+--- linux-2.4.18-chaos.orig/include/linux/ext3_xattr.h 2003-10-22 14:23:51.000000000 +0400
++++ linux-2.4.18-chaos/include/linux/ext3_xattr.h 2003-10-24 01:01:03.000000000 +0400
+@@ -19,6 +19,10 @@
+ /* Name indexes */
+ #define EXT3_XATTR_INDEX_MAX 10
+ #define EXT3_XATTR_INDEX_USER 1
++#define EXT3_XATTR_INDEX_TRUSTED 4
++#define EXT3_XATTR_INDEX_LUSTRE 5
++#define EXT3_XATTR_INDEX_SECURITY 6
++
+
+ struct ext3_xattr_header {
+ __u32 h_magic; /* magic number for identification */
+@@ -82,6 +86,9 @@
+ extern int init_ext3_xattr(void) __init;
+ extern void exit_ext3_xattr(void);
+
++extern int init_ext3_xattr_trusted(void) __init;
++extern void exit_ext3_xattr_trusted(void);
++
+ # else /* CONFIG_EXT3_FS_XATTR */
+ # define ext3_setxattr NULL
+ # define ext3_getxattr NULL
+Index: linux-2.4.18-chaos/fs/ext3/Makefile
+===================================================================
+--- linux-2.4.18-chaos.orig/fs/ext3/Makefile 2003-10-22 14:23:53.000000000 +0400
++++ linux-2.4.18-chaos/fs/ext3/Makefile 2003-10-24 01:02:28.000000000 +0400
+@@ -13,7 +13,7 @@
+
+ obj-y := balloc.o iopen.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
+ ioctl.o namei.o super.o symlink.o xattr.o ext3-exports.o \
+- extents.o
++ extents.o xattr_trusted.o
+ obj-m := $(O_TARGET)
+
+ include $(TOPDIR)/Rules.make
--- /dev/null
+ fs/ext3/xattr.c | 12 +++++-
+ fs/ext3/xattr_trusted.c | 86 +++++++++++++++++++++++++++++++++++++++++++++
+ include/linux/ext3_xattr.h | 6 +++
+ 3 files changed, 102 insertions(+), 2 deletions(-)
+
+Index: linux-2.4.20/fs/ext3/xattr.c
+===================================================================
+--- linux-2.4.20.orig/fs/ext3/xattr.c 2003-10-22 02:29:40.000000000 +0400
++++ linux-2.4.20/fs/ext3/xattr.c 2003-10-24 01:03:22.000000000 +0400
+@@ -1771,18 +1771,25 @@
+ int __init
+ init_ext3_xattr(void)
+ {
++ int error;
++
+ ext3_xattr_cache = mb_cache_create("ext3_xattr", NULL,
+ sizeof(struct mb_cache_entry) +
+ sizeof(struct mb_cache_entry_index), 1, 61);
+ if (!ext3_xattr_cache)
+ return -ENOMEM;
+
+- return 0;
++ error = init_ext3_xattr_trusted();
++ if (error)
++ mb_cache_destroy(ext3_xattr_cache);
++
++ return error;
+ }
+
+ void
+ exit_ext3_xattr(void)
+ {
++ exit_ext3_xattr_trusted();
+ if (ext3_xattr_cache)
+ mb_cache_destroy(ext3_xattr_cache);
+ ext3_xattr_cache = NULL;
+@@ -1793,12 +1800,13 @@
+ int __init
+ init_ext3_xattr(void)
+ {
+- return 0;
++ return init_ext3_xattr_trusted();
+ }
+
+ void
+ exit_ext3_xattr(void)
+ {
++ exit_ext3_xattr_trusted();
+ }
+
+ #endif /* CONFIG_EXT3_FS_XATTR_SHARING */
+Index: linux-2.4.20/fs/ext3/xattr_trusted.c
+===================================================================
+--- linux-2.4.20.orig/fs/ext3/xattr_trusted.c 2003-10-24 01:03:22.000000000 +0400
++++ linux-2.4.20/fs/ext3/xattr_trusted.c 2003-10-24 01:03:22.000000000 +0400
+@@ -0,0 +1,86 @@
++/*
++ * linux/fs/ext3/xattr_trusted.c
++ * Handler for trusted extended attributes.
++ *
++ * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
++ */
++
++#include <linux/module.h>
++#include <linux/string.h>
++#include <linux/fs.h>
++#include <linux/ext3_jbd.h>
++#include <linux/ext3_fs.h>
++#include <linux/ext3_xattr.h>
++
++#define XATTR_TRUSTED_PREFIX "trusted."
++
++static size_t
++ext3_xattr_trusted_list(char *list, struct inode *inode,
++ const char *name, int name_len)
++{
++ const int prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1;
++
++ if (!capable(CAP_SYS_ADMIN))
++ return 0;
++
++ if (list) {
++ memcpy(list, XATTR_TRUSTED_PREFIX, prefix_len);
++ memcpy(list+prefix_len, name, name_len);
++ list[prefix_len + name_len] = '\0';
++ }
++ return prefix_len + name_len + 1;
++}
++
++static int
++ext3_xattr_trusted_get(struct inode *inode, const char *name,
++ void *buffer, size_t size)
++{
++ if (strcmp(name, "") == 0)
++ return -EINVAL;
++ if (!capable(CAP_SYS_ADMIN))
++ return -EPERM;
++ return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name,
++ buffer, size);
++}
++
++static int
++ext3_xattr_trusted_set(struct inode *inode, const char *name,
++ const void *value, size_t size, int flags)
++{
++ handle_t *handle;
++ int error;
++
++ if (strcmp(name, "") == 0)
++ return -EINVAL;
++ if (!capable(CAP_SYS_ADMIN))
++ return -EPERM;
++ handle = ext3_journal_start(inode, EXT3_XATTR_TRANS_BLOCKS);
++ if (IS_ERR(handle))
++ return PTR_ERR(handle);
++ error = ext3_xattr_set(handle, inode, EXT3_XATTR_INDEX_TRUSTED, name,
++ value, size, flags);
++ ext3_journal_stop(handle, inode);
++
++ return error;
++}
++
++struct ext3_xattr_handler ext3_xattr_trusted_handler = {
++ .prefix = XATTR_TRUSTED_PREFIX,
++ .list = ext3_xattr_trusted_list,
++ .get = ext3_xattr_trusted_get,
++ .set = ext3_xattr_trusted_set,
++};
++
++int __init
++init_ext3_xattr_trusted(void)
++{
++ return ext3_xattr_register(EXT3_XATTR_INDEX_TRUSTED,
++ &ext3_xattr_trusted_handler);
++}
++
++void
++exit_ext3_xattr_trusted(void)
++{
++ ext3_xattr_unregister(EXT3_XATTR_INDEX_TRUSTED,
++ &ext3_xattr_trusted_handler);
++}
+Index: linux-2.4.20/include/linux/ext3_xattr.h
+===================================================================
+--- linux-2.4.20.orig/include/linux/ext3_xattr.h 2003-10-22 02:29:39.000000000 +0400
++++ linux-2.4.20/include/linux/ext3_xattr.h 2003-10-24 01:03:22.000000000 +0400
+@@ -21,6 +21,9 @@
+ #define EXT3_XATTR_INDEX_USER 1
+ #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_LUSTRE 5
++#define EXT3_XATTR_INDEX_SECURITY 6
+
+ struct ext3_xattr_header {
+ __u32 h_magic; /* magic number for identification */
+@@ -84,6 +87,9 @@
+ extern int init_ext3_xattr(void) __init;
+ extern void exit_ext3_xattr(void);
+
++extern int init_ext3_xattr_trusted(void) __init;
++extern void exit_ext3_xattr_trusted(void);
++
+ # else /* CONFIG_EXT3_FS_XATTR */
+ # define ext3_setxattr NULL
+ # define ext3_getxattr NULL
+Index: linux-2.4.20/fs/ext3/Makefile
+===================================================================
+--- linux-2.4.20.orig/fs/ext3/Makefile 2003-10-22 02:29:40.000000000 +0400
++++ linux-2.4.20/fs/ext3/Makefile 2003-10-24 01:03:47.000000000 +0400
+@@ -12,7 +12,8 @@
+ export-objs := ext3-exports.o
+
+ obj-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
+- ioctl.o namei.o super.o symlink.o hash.o ext3-exports.o
++ ioctl.o namei.o super.o symlink.o hash.o ext3-exports.o \
++ xattr_trusted.o
+ obj-m := $(O_TARGET)
+
+ export-objs += xattr.o
nfs_export_kernel-2.4.20-hp.patch
ext3-ea-in-inode-2.4.20.patch
listman-2.4.20.patch
+ext3-trusted_ea-2.4.20.patch
nfs_export_kernel-2.4.20-rh.patch
ext3-ea-in-inode-2.4.20.patch
listman-2.4.20.patch
+ext3-trusted_ea-2.4.20.patch
nfs_export_kernel-2.4.22-rh.patch
ext3-ea-in-inode-2.4.22-rh.patch
listman-2.4.20.patch
+ext3-trusted_ea-2.4.20.patch