[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFzDeZQeFY1i1xLES4ijtDeGBk3EBOh-mA0dhEH2yaGf9A@mail.gmail.com>
Date: Wed, 30 May 2012 17:40:54 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Eric Paris <eparis@...isplace.org>,
Mimi Zohar <zohar@...ux.vnet.ibm.com>,
Mimi Zohar <zohar@...ibm.com>,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vfs: fix IMA lockdep circular locking dependency
On Wed, May 30, 2012 at 5:28 PM, Al Viro <viro@...iv.linux.org.uk> wrote:
>
> FWIW, I think it's cleaner to take the whole thing into an inlined helper.
Even better.
I notice that your inlined helper doesn't do what I did: if PROT_EXEC
is already set, stop all the stupid games. IOW, the first test in that
function could as well be
if (prot & (PROT_READ | PROT_EXEC) != PROT_READ)
return prot;
because if PROT_EXEC is already set, or if PROT_READ wasn't set, none
of the rest of the checks make any sense at all.
But that's just me being anal. It doesn't really *matter* if we end up
setting PROT_EXEC again.
> It can be reorganized a bit, though. vm_mmap() aside, there are only two
> callers of do_mmap(), both passing it 0 as the last argument. So let's
> lift these checks on offset into vm_mmap() and kill do_mmap() completely -
> all that remains of it would be a call of do_mmap_pgoff(). And there's no
> reason to put those sanity checks (now in vm_mmap()) under ->mmap_sem,
> of course. At that point we *do* get 4 identical pieces of code. Let's
> call that vm_mmap_pgoff() and put it (and vm_mmap()) to mm/util.c. Voila...
Good.
End result looks fine to me.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists