From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org, dmitry.kasatkin@intel.com,
akpm@linux-foundation.org, ebiederm@xmission.com,
Al Viro <viro@ZenIV.linux.org.uk>
Subject: Re: [PATCH 4/4] binfmt_elf: Elf executable signature verification
Date: Wed, 20 Mar 2013 13:41:30 -0400 [thread overview]
Message-ID: <1363801290.2580.44.camel@falcor1.watson.ibm.com> (raw)
In-Reply-To: <20130320152134.GA2273@redhat.com>
On Wed, 2013-03-20 at 11:21 -0400, Vivek Goyal wrote:
> On Tue, Mar 19, 2013 at 10:39:01AM -0400, Mimi Zohar wrote:
>
> [..]
> > > +#ifdef CONFIG_BINFMT_ELF_SIG
> > > + /* If executable is digitally signed. Lock down in memory */
> > > + /* Get file signature, if any */
> > > + retval = ima_file_signature_alloc(bprm->file, &signature);
> > > +
> > > + /*
> > > + * If there is an error getting signature, bail out. Having
> > > + * no signature is fine though.
> > > + */
> > > + if (retval < 0 && retval != -ENODATA && retval != -EOPNOTSUPP)
> > > + goto out_free_dentry;
> > > +
> > > + if (signature != NULL) {
> > > + siglen = retval;
> > > + retval = ima_signature_type(signature, &sig_type);
> > > + if (!retval && sig_type == EVM_IMA_XATTR_DIGSIG_ASYMMETRIC)
> > > + mlock_mappings = true;
> > > + }
> > > +
> > > + if (mlock_mappings)
> > > + current->mm->def_flags |= VM_LOCKED;
> >
> > Vivek, we've already discussed this. Hard coding policy in the kernel
> > is unacceptable, whether it is inlined, here, or as part of IMA.
> > Defining a policy, that mlocks all signed ELF executables, does not
> > scale. The 'ima_appraise_tcb' policy requires all files owned by root
> > to be signed. Please define some other mechanism, other than a
> > signature, for identifying files that you want to mlock.
> > (Recommendations were previously made, which you rejected.)
>
> Hi Mimi,
>
> How about just just defining another config option CONFIG_BINFMT_MEMLOCK_SIGNED.
>
> So CONFIG_BINFMT_ELF_SIG takes care of signature verification and
> CONFIG_BINFMT_MEMLOCK_SIGNED will determine whether executable is locked
> in memory or not.
>
> If I define any command line options to enable/disable it, then root can
> easily bypass this. And that's the problem I am trying to solve. In
> secureboot environment we don't trust root.
>
> And what's the use case for some of the signed executables locked but
> not others. I am able to visualize only two states. Either we lock down
> every signed process or we don't lock anything in (Assuming we have
> signed all the user space and no unsigned process can execute now so
> hopefully it is safe to not lock down process memory).
>
> That's why I think it is not per file attribute. It is in general system
> attribute whether on this system signed files should be locked or not. And
> given the fact we don't trust root in secureboot environment, we can't
> define external mechanism to trigger policy and it has to be built-in.
>
> So it is not same as ima_appraise_tcb as there you trust root. Even if you
> don't there are ways to detect that things are not right (by remote
> attestation). But in case of secureboot no such mechanism is there. So one
> can not trust root to configure a policy.
Defining another Kconfig option will either memlock all signed
executables or none. If a distro ships with this new Kconfig enabled,
then the 'ima_appraise_tcb' boot command line option would result in all
executables, owned by root, being memlocked. Giving of privileges based
on the existence of a signature, does not scale. Again, do not hard
code policy in the kernel.
> >
> > Lastly, adding 'VM_LOCKED' here seems to change existing, expected
> > behavior. According to the mlock(2) man pages, "Memory locks are not
> > inherited by a child created via fork(2) and are automatically removed
> > (unlocked) during an execve(2) or when the process terminates." Someone
> > else needs to comment on this sort of change. Andrew? Al?
>
> I will read more about it. I know that some more work is needed here. For
> example, one can say munlock()/munlockall() on already locked pages. I
> was thinkingof defining a new flag say VM_LOCKED_PERM. So any pages which
> have been locked by kernel are permanent and can not be unlocked by user
> space until and unless process exits.
>
> I just need to spend more time in this memory locking area to cover all
> the corner cases and make sure kernel mlocked pages are not unlocked.
Vivek, there must be a good reason that execve intentionally,
automatically unlocks the memory. Are there any interrupt or locking
implications? I'm not qualified to answer any of these questions. As
the entire patchset is based on using VM_LOCKED, before we continue any
further discussions, these basic questions need to be answered first.
thanks,
Mimi
next prev parent reply other threads:[~2013-03-20 17:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-15 20:35 [RFC PATCH 0/4] IMA: Export functions for file integrity verification Vivek Goyal
2013-03-15 20:35 ` [PATCH 1/4] integrity: Identify asymmetric digital signature using new type Vivek Goyal
2013-03-15 20:35 ` [PATCH 2/4] ima: export new IMA functions for signature verification Vivek Goyal
2013-03-15 20:35 ` [PATCH 3/4] capability: Create a new capability CAP_SIGNED Vivek Goyal
2013-03-15 21:12 ` Casey Schaufler
2013-03-18 17:05 ` Vivek Goyal
2013-03-18 17:50 ` Casey Schaufler
2013-03-18 18:30 ` Vivek Goyal
2013-03-18 19:19 ` Casey Schaufler
2013-03-18 22:32 ` Eric W. Biederman
2013-03-19 21:01 ` Serge E. Hallyn
2013-03-20 5:07 ` James Morris
2013-03-20 14:41 ` Vivek Goyal
2013-03-20 14:50 ` Matthew Garrett
2013-03-15 20:35 ` [PATCH 4/4] binfmt_elf: Elf executable signature verification Vivek Goyal
2013-03-18 20:23 ` Josh Boyer
2013-03-18 20:33 ` Vivek Goyal
2013-03-19 14:39 ` Mimi Zohar
2013-03-20 15:21 ` Vivek Goyal
2013-03-20 17:41 ` Mimi Zohar [this message]
2013-03-20 18:39 ` Vivek Goyal
2013-03-20 15:59 ` Vivek Goyal
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=1363801290.2580.44.camel@falcor1.watson.ibm.com \
--to=zohar@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=dmitry.kasatkin@intel.com \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=vgoyal@redhat.com \
--cc=viro@ZenIV.linux.org.uk \
/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