From: James Morris <jmorris@namei.org>
To: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, safford@watson.ibm.com,
serue@linux.vnet.ibm.com, sailer@watson.ibm.com,
zohar@us.ibm.com, Stephen Smalley <sds@tycho.nsa.gov>,
CaseySchaufler <casey@schaufler-ca.com>
Subject: Re: [RFC][Patch 4/4]integrity: IMA as an integrity service provider
Date: Thu, 22 May 2008 12:39:26 +1000 (EST) [thread overview]
Message-ID: <Xine.LNX.4.64.0805221212110.32056@us.intercode.com.au> (raw)
In-Reply-To: <1211385314.20922.28.camel@localhost.localdomain>
On Wed, 21 May 2008, Mimi Zohar wrote:
> +#define IMA_HASH_KEY(digest) (hash_long(\
> + (unsigned long)(*digest), IMA_HASH_BITS));
Please make this a static inline and use hash_ptr().
> + i_size = i_size_read(file->f_dentry->d_inode);
> + while (offset < i_size) {
> + int error;
> +
> + rbuf_len = kernel_read(file, offset, rbuf, PAGE_SIZE);
> + if (rbuf_len <= 0)
> + break;
Why is the return value of kernel_read() not being propagated to the
caller?
> + error = crypto_hash_update(desc, sg, rbuf_len);
> + if (error) {
> + result = -EINVAL;
> + break;
> + }
Why are you replacing the error code from crypto_hash_update() with
-EINVAL ?
> + tfm = crypto_alloc_hash(ima_hash, 0, CRYPTO_ALG_ASYNC);
> + if (IS_ERR(tfm)) {
> + printk(KERN_INFO "%s: failed to load %s transform: %ld\n",
> + __func__, ima_hash, PTR_ERR(tfm));
> + return -ENOSYS;
> + }
Similarly, why not propagate the actual error ?
(This kind of thing happens quite a lot in the code).
> +static int __init init_ima(void)
> +{
> + int error;
> + tfm_hash = crypto_alloc_hash(ima_hash, 0, CRYPTO_ALG_ASYNC);
> +
> + error = ima_init();
> + if (error)
> + goto out;
> + ima_fixup_inodes();
> + if (ima_base_hooks)
> + error = register_integrity(&ima_base_ops);
> + else
> + error = register_integrity(&ima_integrity_ops);
> + register_template("ima", &ima_template_ops);
> +out:
> + return error;
> +}
What if crypto_alloc_hash() fails ? Actually, where is it used?
- James
--
James Morris
<jmorris@namei.org>
next prev parent reply other threads:[~2008-05-22 2:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-21 15:55 Mimi Zohar
2008-05-22 2:39 ` James Morris [this message]
2008-05-22 18:39 ` 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=Xine.LNX.4.64.0805221212110.32056@us.intercode.com.au \
--to=jmorris@namei.org \
--cc=casey@schaufler-ca.com \
--cc=linux-kernel@vger.kernel.org \
--cc=safford@watson.ibm.com \
--cc=sailer@watson.ibm.com \
--cc=sds@tycho.nsa.gov \
--cc=serue@linux.vnet.ibm.com \
--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
all inboxes | Powered by JetHome®