From: Eric Paris <eparis@redhat.com>
To: linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Cc: hch@infradead.org, zohar@us.ibm.com, warthog9@kernel.org,
david@fromorbit.com, jmorris@namei.org, kyle@mcmartin.ca,
hpa@zytor.com, akpm@linux-foundation.org,
torvalds@linux-foundation.org, mingo@elte.hu, eparis@redhat.com,
viro@zeniv.linux.org.uk
Subject: [PATCH 2/6] IMA: drop the inode opencount since it isn't needed for operation
Date: Tue, 19 Oct 2010 18:58:19 -0400 [thread overview]
Message-ID: <20101019225819.12396.50299.stgit@paris.rdu.redhat.com> (raw)
In-Reply-To: <20101019225813.12396.2564.stgit@paris.rdu.redhat.com>
The opencount was used to help depugging to make sure that everything which
created a struct file also correctly made the IMA calls. Since we moved
all of that into the VFS this isn't as necessary. We should be able to get
the same amount of debugging out of just the reader and write count.
Signed-off-by: Eric Paris <eparis@redhat.com>
---
include/linux/fs.h | 1 -
security/integrity/ima/ima_iint.c | 3 ---
security/integrity/ima/ima_main.c | 10 +++-------
3 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3a402b3..593bb4d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -780,7 +780,6 @@ struct inode {
/* all protected by i_mutex */
long i_readers; /* struct files open RO */
long i_writers; /* struct files open WR */
- long i_opencount; /* total open files (readers + writers) */
#endif
#ifdef CONFIG_FS_POSIX_ACL
struct posix_acl *i_acl;
diff --git a/security/integrity/ima/ima_iint.c b/security/integrity/ima/ima_iint.c
index c584938..2dc32d6 100644
--- a/security/integrity/ima/ima_iint.c
+++ b/security/integrity/ima/ima_iint.c
@@ -79,12 +79,9 @@ void ima_check_counters(struct inode *inode)
printk(KERN_INFO "%s: readcount: %ld\n", __func__, inode->i_readers);
if (inode->i_writers)
printk(KERN_INFO "%s: writers: %ld\n", __func__, inode->i_writers);
- if (inode->i_opencount)
- printk(KERN_INFO "%s: opencount: %ld\n", __func__, inode->i_opencount);
inode->i_readers = 0;
inode->i_writers = 0;
- inode->i_opencount = 0;
}
/* iint_free - called when the iint refcount goes to zero */
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index a70700b..92235a0 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -123,7 +123,6 @@ static void ima_inc_counts(struct inode *inode, fmode_t mode)
{
BUG_ON(!mutex_is_locked(&inode->i_mutex));
- inode->i_opencount++;
if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
inode->i_readers++;
if (mode & FMODE_WRITE)
@@ -185,7 +184,6 @@ static void ima_dec_counts(struct ima_iint_cache *iint, struct inode *inode,
BUG_ON(!mutex_is_locked(&iint->mutex));
BUG_ON(!mutex_is_locked(&inode->i_mutex));
- inode->i_opencount--;
if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
inode->i_readers--;
if (mode & FMODE_WRITE) {
@@ -196,13 +194,11 @@ static void ima_dec_counts(struct ima_iint_cache *iint, struct inode *inode,
}
}
- if (((inode->i_opencount < 0) ||
- (inode->i_readers < 0) ||
+ if (((inode->i_readers < 0) ||
(inode->i_writers < 0)) &&
!ima_limit_imbalance(file)) {
- printk(KERN_INFO "%s: open/free imbalance (r:%ld w:%ld o:%ld)\n",
- __func__, inode->i_readers, inode->i_writers,
- inode->i_opencount);
+ printk(KERN_INFO "%s: open/free imbalance (r:%ld w:%ld)\n",
+ __func__, inode->i_readers, inode->i_writers);
dump_stack();
}
}
next prev parent reply other threads:[~2010-10-19 22:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-19 22:58 [PATCH 1/6] IMA: move read/write counters into struct inode Eric Paris
2010-10-19 22:58 ` Eric Paris [this message]
2010-10-19 22:58 ` [PATCH 3/6] IMA: use unsigned int instead of long for counters Eric Paris
2010-10-19 22:58 ` [PATCH 4/6] IMA: only allocate iint when needed Eric Paris
2010-10-20 3:53 ` Al Viro
2010-10-19 22:58 ` [PATCH 5/6] IMA: use rbtree instead of radix tree for inode information cache Eric Paris
2010-10-19 23:17 ` Dave Chinner
2010-10-20 11:31 ` Peter Zijlstra
2010-10-20 22:05 ` Dave Chinner
2010-10-20 22:22 ` Linus Torvalds
2010-10-20 22:47 ` Trond Myklebust
2010-10-21 0:58 ` Linus Torvalds
2010-10-21 2:17 ` Dave Chinner
2010-10-19 22:58 ` [PATCH 6/6] IMA: use i_writecount rather than a private counter Eric Paris
2010-10-20 0:25 ` [PATCH 1/6] IMA: move read/write counters into struct inode Linus Torvalds
2010-10-23 3:01 ` Eric Paris
2010-10-24 6:52 ` Mimi Zohar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101019225819.12396.50299.stgit@paris.rdu.redhat.com \
--to=eparis@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=hpa@zytor.com \
--cc=jmorris@namei.org \
--cc=kyle@mcmartin.ca \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--cc=warthog9@kernel.org \
--cc=zohar@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome