From: Andrew Morton <akpm@linux-foundation.org>
To: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, zohar@linux.vnet.ibm.com,
jmorris@namei.org, hch@infradead.org, viro@ZenIV.linux.org.uk,
safford@watson.ibm.com, serue@linux.vnet.ibm.com,
zohar@us.ibm.com
Subject: Re: [PATCH 2/4] integrity: Linux Integrity Module(LIM)
Date: Fri, 14 Nov 2008 14:15:10 -0800 [thread overview]
Message-ID: <20081114141510.6f04404d.akpm@linux-foundation.org> (raw)
In-Reply-To: <9395c0a4110469d19100084664900789c34ebd42.1226547084.git.zohar@linux.vnet.ibm.com>
On Wed, 12 Nov 2008 22:47:12 -0500
Mimi Zohar <zohar@linux.vnet.ibm.com> wrote:
> This version resolves the merge issues resulting from the removal
> of the nameidata parameter to inode_permission(), by moving the
> integrity_inode_permission() call from inode_permission() to
> may_open(), and renaming the hook to integrity_nameidata_check().
> The nameidata is needed in order to open and read the file, so
> that the file can be hashed(a cryptographically strong checksum.)
>
> This patch also fixes the template locking, preventing the template
> from being freed while being used.
>
> This patch is a redesign of the integrity framework, which address a
> number of issues, including
> - generalizing the measurement API beyond just inode measurements.
> - separation of the measurement into distinct collection, appraisal,
> and commitment phases, for greater flexibility.
>
> Extended Verification Module(EVM) and the Integrity Measurement
> Architecture(IMA) were originally implemented as an LSM module. Based
> on discussions on the LSM mailing list, a decision was made that the
> LSM hooks should only be used to enforce mandatory access control
> decisions and a new set of hooks should be defined specifically for
> integrity.
>
> EVM/IMA was limited to verifying and measuring a file's (i.e. an inode)
> integrity and the metadata associated with it. Current research is
> looking into other types of integrity measurements. (i.e. "Linux kernel
> integrity measurement using contextual inspection", by Peter A. Loscocco,
> Perry W. Wilson, J. Aaron Pendergrass, C. Durward McDonell,
> http://doi.acm.org/10.1145/1314354.1314362). As a result, a requirement
> of the new integrity framework is support for different types of integrity
> measurements.
> This patch provides an integrity framework(api and hooks) and placement
> of the integrity hooks in the appropriate places in the fs directory.
> Collecting, appraising, and storing of file and other types of integrity
> data is supported. Multiple integrity templates, which implement the
> integrity API, may register themselves. For now, only a single integrity
> provider can register itself for the integrity hooks. (Support for multiple
> providers registering themselves for the integrity hooks would require
> some form of stacking.)
>
> The six integrity hooks are:
> nameidata_check_integrity, inode_alloc_integrity, inode_free_integrity,
> bprm_check_integrity, file_free_integrity, file_mmap
>
> The five integrity API calls provided are:
> integrity_must_measure, integrity_collect_measurement,
> integrity_appraise_measurement, integrity_store_measurement,
> and integrity_display_template.
>
> The type of integrity data being collected, appraised, stored, or
> displayed is template dependent.
>
>
> ...
>
> +int integrity_register_template(const char *template_name,
> + const struct template_operations *template_ops)
> +{
> + int template_len;
> + struct template_list_entry *entry;
> +
> + entry = kzalloc(sizeof(*entry), GFP_KERNEL);
> + if (!entry)
> + return -ENOMEM;
> + INIT_LIST_HEAD(&entry->template);
> +
> + atomic_set(&entry->refcount, 1);
> + template_len = strlen(template_name);
> + if (template_len > TEMPLATE_NAME_LEN_MAX) {
It would be much neater to perform this check before running kzalloc().
> + kfree(entry);
> + return -EINVAL;
> + }
> + strcpy(entry->template_name, template_name);
> + entry->template_ops = template_ops;
> +
> + mutex_lock(&integrity_templates_mutex);
> + list_add_rcu(&entry->template, &integrity_templates);
> + mutex_unlock(&integrity_templates_mutex);
> + synchronize_rcu();
> +
> + return 0;
> +}
> +
> +EXPORT_SYMBOL_GPL(integrity_register_template);
someone forgot to run checkpatch.
>
> ...
>
> +static inline void tget(struct template_list_entry *entry)
> +{
> + if (!entry)
> + return;
> + atomic_inc(&entry->refcount);
> +}
> +
> +static inline void tput(struct template_list_entry *entry)
> +{
> + if (!entry)
> + return;
> + if (atomic_dec_and_test(&entry->refcount))
> + kfree(entry);
> +}
Do these _really_ need to test for a NULL pointer? It's an extra
test-n-branch in many fastpaths. It would be better to avoid doing
this here, if poss.
next prev parent reply other threads:[~2008-11-14 22:16 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-13 3:47 [PATCH 0/4] integrity Mimi Zohar
2008-11-13 3:47 ` [PATCH 1/4] integrity: TPM internel kernel interface Mimi Zohar
2008-11-13 3:47 ` [PATCH 2/4] integrity: Linux Integrity Module(LIM) Mimi Zohar
2008-11-14 22:15 ` Andrew Morton [this message]
2008-11-17 19:04 ` Mimi Zohar
2008-11-17 16:05 ` Christoph Hellwig
2008-11-17 19:09 ` Mimi Zohar
2008-11-18 13:29 ` Christoph Hellwig
2008-11-13 3:47 ` [PATCH 3/4] integrity: IMA as an integrity service provider Mimi Zohar
2008-11-14 22:15 ` Andrew Morton
2008-11-17 19:05 ` Mimi Zohar
2008-11-13 3:47 ` [PATCH 4/4] integrity: IMA radix tree Mimi Zohar
2008-11-14 22:15 ` Andrew Morton
2008-11-17 19:05 ` Mimi Zohar
2008-11-14 22:18 ` [PATCH 0/4] integrity Andrew Morton
2008-11-17 20:42 ` david safford
2008-12-03 23:29 ` James Morris
-- strict thread matches above, loose matches on Subject: below --
2008-11-20 16:43 Mimi Zohar
2008-11-20 16:43 ` [PATCH 2/4] integrity: Linux Integrity Module(LIM) Mimi Zohar
2008-11-20 17:45 ` Christoph Hellwig
2008-11-20 19:21 ` david safford
2008-11-20 19:26 ` Christoph Hellwig
2008-11-21 12:37 ` david safford
2008-11-21 17:45 ` Dave Hansen
2008-11-21 17:46 ` Dave Hansen
2008-11-21 19:10 ` Mimi Zohar
2008-11-21 17:48 ` Dave Hansen
2008-11-21 19:09 ` Mimi Zohar
2008-11-21 17:53 ` Dave Hansen
2008-11-21 19:10 ` 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=20081114141510.6f04404d.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=safford@watson.ibm.com \
--cc=serue@linux.vnet.ibm.com \
--cc=viro@ZenIV.linux.org.uk \
--cc=zohar@linux.vnet.ibm.com \
--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