From: Andrew Morton <akpm@linux-foundation.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 5/5]integrity: IMA as an integrity service provider
Date: Wed, 28 May 2008 01:22:42 -0700 [thread overview]
Message-ID: <20080528012242.a0e98d87.akpm@linux-foundation.org> (raw)
In-Reply-To: <1211555145.16195.18.camel@new-host>
On Fri, 23 May 2008 11:05:45 -0400 Mimi Zohar <zohar@linux.vnet.ibm.com> wrote:
> This is a re-release of Integrity Measurement Architecture(IMA) as an
> independent Linunx Integrity Module(LIM) service provider, which implements
> the new LIM must_measure(), collect_measurement(), store_measurement(), and
> display_template() API calls. The store_measurement() call supports two
> types of data, IMA (i.e. file data) and generic template data.
>
> When store_measurement() is called for the IMA type of data, the file
> measurement and the file name hint are used to form an IMA template.
> IMA then calculates the IMA template measurement(hash) and submits it
> to the TPM chip for inclusion in one of the chip's Platform Configuration
> Registers (PCR).
>
> When store_measurement() is called for generic template data, IMA
> calculates the measurement(hash) of the template data, and submits
> the template measurement to the TPM chip for inclusion in one of the
> chip's Platform Configuration Registers(PCR).
>
> In order to view the contents of template data through securityfs, the
> template_display() function must be defined in the registered
> template_operations. In the case of the IMA template, the list of
> file names and files hashes submitted can be viewed through securityfs.
>
> IMA can be included or excluded in the kernel configuration. If
> included in the kernel and the IMA_BOOTPARAM is selected, IMA can
> also be enabled/disabled on the kernel command line with 'ima='.
>
- I see lots of user file I/O being done from within the kernel.
This makes eyebrows raise. Also some other eyebrow-raising
file-related things in there.
- A complicated-looking in-kernel string parser which is implementing
an new and apparently-undocumented user->kernel ABI.
- Some GFP_ATOMICs which can hopefully become GFP_KERNEL.
- timespec_set() is unneeeded - just use struct assignment (ie: "=")
- timespec_recent() looks a bit hacky. The problems which are being
solved here should be described in the changelog. Perhaps we can
think of a better way, but first we have to know about it.
- shouldn't ima_inode_init() initialise tv_usec too?
- All the games with mtimes should be described in the changelog too.
- All the `static struct integrity_operations' instances could be
made const. And lots of other foo_operations too, I expect.
That will lead to a constification chase all over the place, but
it's probably for the best. This is after all a "security" feature
and there is perhaps some benefit in getting your eminently
hijackable function pointers into read-only memory.
- ima_fixup_inodes looks like it will race and crash against a
well-timed unmount. I expect you will need to bump s_count before
dropping sb_lock. See writeback_inodes() for an example.
- bug: ima_fixup_inodes() does a GFP_KERNEL allocation inside
inode->i_lock. This bug shouldn't have got this far. Please always
enable all kernel debugging features when testing code.
Documentation/SubmitChecklist has useful things.
- inode.i_lock is defined as an innermost lock which is used for
protecting data internal to the inode. You appear to be using it for
way too much stuff in here.
- It would be useful to add a comment explaining why
late_initcall(init_ima) is using late_initcall() rather than plain
old module_init(). Because it is impossible for the reader to
determine this information from the implementation.
- mutex_init(&ima_extend_list_mutex) is unneeded.
- Does ima_add_digest_entry() need to use the unreliable GFP_ATOMIC?
This matters. This is a security feature and if that
kmalloc(GFP_ATOMIC) fails (as it easily can do) then I expect the
system will either be insecure or will outright malfunction.
- Why does CONFIG_IMA_BOOTPARAM exist, and can it be removed (ie:
made unconditional)?
- Similarly CONFIG_IMA_BOOTPARAM_VALUE. Let's be decisive here -
distributors only get one shot at setting these things.
- mode_setup() will identify itself as "mode_setup" in its KERN_INFO
printk. That's a bit unhelpful. I'd suggest that all/most printks
here be prefixed with "integrity:".
- GFP_ATOMICs everywhere :(
- As ima_htable.violations "can overflow", atomic_long_t might be a
better choice of type.
- skip_measurement(): the hard-coded test for PROC_SUPER_MAGIC,
SYSFS_MAGIC etc is quite unpleasant. Surely there is a better way.
-
+/**
+ * ima_must_measure - measure decision based on policy.
+ * @d - pointer to struct ima_data containing ima_args_data
So if we know the type of d, did we _have_ to make it void*? It's
much better to use the C yype system if at all possible.
- ditto ima_collect_measurement()
Generally: the code is all moderately intrusive into the VFS and this
sort of thing does need careful explanation and justification, please.
Once we have some understanding of what you're trying to achieve here
we will inevitably ask "can't that be done in userspace". So it would
be best if your description were to preemptively answer all that.
next prev parent reply other threads:[~2008-05-28 8:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-23 15:05 [RFC][Patch 5/5]integrity: IMA as an integrity service provider Mimi Zohar
2008-05-23 23:30 ` Randy Dunlap
2008-05-27 1:02 ` Mimi Zohar
2008-05-27 14:36 ` Mimi Zohar
2008-06-11 22:31 ` Randy Dunlap
2008-05-28 8:22 ` Andrew Morton [this message]
2008-05-29 3:17 ` Mimi Zohar
2008-05-29 3:30 ` Andrew Morton
2008-05-29 21:50 ` Mimi Zohar
2008-05-29 23:35 ` Andrew Morton
2008-05-30 1:58 ` Mimi Zohar
2008-05-30 2:04 ` Andrew Morton
2008-05-30 13:06 ` Mimi Zohar
2008-05-29 3:33 ` Mimi Zohar
2008-05-31 7:54 ` Pavel Machek
2008-06-24 16:28 ` david safford
2008-08-05 17:35 ` Pavel Machek
2008-06-24 16:28 ` david safford
2008-08-05 17:32 ` Pavel Machek
[not found] <20080627131946.225566613@linux.vnet.ibm.com>
2008-06-27 16:23 ` [RFC][PATCH 5/5] integrity: " 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=20080528012242.a0e98d87.akpm@linux-foundation.org \
--to=akpm@linux-foundation.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