Re: [PATCH] vfs: fix IMA lockdep circular locking dependency

From: Linus Torvalds
Date: Wed May 30 2012 - 18:52:37 EST


On Wed, May 30, 2012 at 2:36 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> The only difference is that for file-backed ones !MMU wants
> VM_MAYEXEC in that file's bdi flags (BDI_CAP_EXEC_MAP).  And
> that actually sounds reasonable in !MMU case.

Ok, I don't think it should be strictly necessary, but I guess I don't
mind either.

> Anyway, I've dumped the variant I've got into vfs.git@security_file_mmap;
> it should be at commit f12a0fd062b1d259a0b6bc6442019e6d4c45e9f5.
>
> Comments?

Two small ones:

- I really don't think you should use "goto out" in
security_mmap_file(). That implies that you're exiting the function,
but in fact you're jumping to the very *meat* of the function.

So I think you should rename "out" as "no_added_exec" or something.

And a small question: This code:

+ ret = security_mmap_file(file, prot, flags);
+ if (!ret) {
+ down_write(&current->mm->mmap_sem);
+ retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
+ up_write(&current->mm->mmap_sem);
+ }

now seems to exist in four places. And in fact, that pretty much seems
to *be* what vm_mmap() is, at this point. Why isn't there just one
single vm_mmap() implementation, and then the callers of that?

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/