linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 12:45:42 -0500	[thread overview]
Message-ID: <1327427142.4131.4.camel@localhost> (raw)
In-Reply-To: <1327426472-25275-1-git-send-email-zohar@linux.vnet.ibm.com>

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?


  reply	other threads:[~2012-01-24 17:45 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 [this message]
2012-01-24 18:40   ` Mimi Zohar
2012-01-24 18:51     ` Eric Paris

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=1327427142.4131.4.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).