linux-kernel March 2009 archive
Main Archive Page > Month Archives  > linux-kernel archives
linux-kernel: Re: [PATCH] CRED: Fix check_unsafe_exec()

Re: [PATCH] CRED: Fix check_unsafe_exec()

From: David Howells <dhowells_at_nospam>
Date: Tue Mar 10 2009 - 23:01:07 GMT
To: Hugh Dickins <hugh@veritas.com>


Hugh Dickins <hugh@veritas.com> wrote:

> Surely we'd prefer to avoid the overhead of additional confusing
> counts if they can be avoided?

As long as they are properly commented, it shouldn't be too confusing.

> We already have what I think is a satisfactory patch for the struct fs
> part of it:

We do?

> /proc can easily manage root and pwd while holding the lock
> instead of raising fs->count.

I'm assume you mean by extending the time we hold task->alloc_lock until we've completed the path_get().

> I don't understand why check_unsafe_exec() needs to check
> current->files->count at all, since do_execve() has already
> done an unshare_files() to get its own copy - and proceeds with
> that one if the exec succeeds.
>
> My belief is that the files->count check could/should have been
> removed when that unshare_files() was put in. Please explain why
> I'm wrong on that - I can quite accept that I'm muddled about it,
> but please do explain it to me.

It seems you're right about that. I think someone else on the security list probably needs to answer that.

David -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html