diff options
author | Eric Paris <eparis@redhat.com> | 2010-10-25 14:41:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-26 14:37:18 -0400 |
commit | a178d2027d3198b0a04517d764326ab71cd73da2 (patch) | |
tree | d81b9336328ba1741231b318a6f8187f627581fd /security/integrity/ima/ima.h | |
parent | b9593d309d17c57e9ddc3934d641902533896ca9 (diff) |
IMA: move read counter into struct inode
IMA currently allocated an inode integrity structure for every inode in
core. This stucture is about 120 bytes long. Most files however
(especially on a system which doesn't make use of IMA) will never need
any of this space. The problem is that if IMA is enabled we need to
know information about the number of readers and the number of writers
for every inode on the box. At the moment we collect that information
in the per inode iint structure and waste the rest of the space. This
patch moves those counters into the struct inode so we can eventually
stop allocating an IMA integrity structure except when absolutely
needed.
This patch does the minimum needed to move the location of the data.
Further cleanups, especially the location of counter updates, may still
be possible.
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/integrity/ima/ima.h')
-rw-r--r-- | security/integrity/ima/ima.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h index b546b90f5fa8..27849e1656dc 100644 --- a/security/integrity/ima/ima.h +++ b/security/integrity/ima/ima.h | |||
@@ -70,6 +70,7 @@ int ima_init(void); | |||
70 | void ima_cleanup(void); | 70 | void ima_cleanup(void); |
71 | int ima_fs_init(void); | 71 | int ima_fs_init(void); |
72 | void ima_fs_cleanup(void); | 72 | void ima_fs_cleanup(void); |
73 | int ima_inode_alloc(struct inode *inode); | ||
73 | int ima_add_template_entry(struct ima_template_entry *entry, int violation, | 74 | int ima_add_template_entry(struct ima_template_entry *entry, int violation, |
74 | const char *op, struct inode *inode); | 75 | const char *op, struct inode *inode); |
75 | int ima_calc_hash(struct file *file, char *digest); | 76 | int ima_calc_hash(struct file *file, char *digest); |
@@ -106,8 +107,6 @@ struct ima_iint_cache { | |||
106 | unsigned char flags; | 107 | unsigned char flags; |
107 | u8 digest[IMA_DIGEST_SIZE]; | 108 | u8 digest[IMA_DIGEST_SIZE]; |
108 | struct mutex mutex; /* protects: version, flags, digest */ | 109 | struct mutex mutex; /* protects: version, flags, digest */ |
109 | /* protected by inode->i_lock */ | ||
110 | unsigned int readcount; /* measured files readcount */ | ||
111 | struct kref refcount; /* ima_iint_cache reference count */ | 110 | struct kref refcount; /* ima_iint_cache reference count */ |
112 | }; | 111 | }; |
113 | 112 | ||