From: Eric Paris <eparis@redhat.com>
To: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: linux-security-module@vger.kernel.org,
Al Viro <viro@zeniv.linux.org.uk>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Mimi Zohar <zohar@us.ibm.com>
Subject: Re: [PATCH v1] vfs: fix IMA lockdep circular locking dependency
Date: Tue, 24 Jan 2012 13:51:38 -0500 [thread overview]
Message-ID: <1327431098.4131.6.camel@localhost> (raw)
In-Reply-To: <1327430451.2129.22.camel@falcor>
On Tue, 2012-01-24 at 13:40 -0500, Mimi Zohar wrote:
> On Tue, 2012-01-24 at 12:45 -0500, Eric Paris wrote:
> > On Tue, 2012-01-24 at 12:34 -0500, Mimi Zohar wrote:
> > > The circular lockdep is caused by allocating the 'iint' for mmapped
> > > files. Originally when an 'iint' was allocated for every inode
> > > in inode_alloc_security(), before the inode was accessible, no
> > > locking was necessary. Commits bc7d2a3e and 196f518 changed this
> > > behavior and allocated the 'iint' on a per need basis, resulting in
> > > the mmap_sem being taken before the i_mutex for mmapped files.
> > >
> > > Possible unsafe locking scenario:
> > > CPU0 CPU1
> > > ---- ----
> > > lock(&mm->mmap_sem);
> > > lock(&sb->s_type->i_mutex_key);
> > > lock(&mm->mmap_sem);
> > > lock(&sb->s_type->i_mutex_key);
> > >
> > > The existing security_file_mmap() hook is after the mmap_sem is taken.
> > > This patch moves the ima_file_mmap() call from security_file_mmap() to
> > > prior to the mmap_sem being taken.
> > >
> > > Changelog v1:
> > > - Instead of just pre-allocating the iint in a new hook, do ALL of the
> > > work in the new/moved ima_file_mmap() hook. (Based on Eric Paris' suggestion.)
> > > - Removed do_mmap_with_sem() helper function.
> > > - export ima_file_mmap()
> >
> > Why does it need to be exported? What module might call this?
>
> Without it, I'm getting:
>
> Kernel: arch/x86/boot/bzImage is ready (#246)
> ERROR: "ima_file_mmap" [arch/x86/ia32/ia32_aout.ko] undefined!
> make[1]: *** [__modpost] Error 1
> make: *** [modules] Error 2
Ok, that's what I was wondering (and guessing). Sorry!
Acked-by: Eric Paris <eparis@redhat.com>
prev parent reply other threads:[~2012-01-24 18:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-24 17:34 [PATCH v1] vfs: fix IMA lockdep circular locking dependency Mimi Zohar
2012-01-24 17:45 ` Eric Paris
2012-01-24 18:40 ` Mimi Zohar
2012-01-24 18:51 ` Eric Paris [this message]
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=1327431098.4131.6.camel@localhost \
--to=eparis@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).