Re: Q: selinux_bprm_committed_creds() && signals/do_wait

From: David Howells
Date: Thu Apr 30 2009 - 20:45:01 EST


Roland McGrath <roland@xxxxxxxxxx> wrote:

> There is a wrinkle here I don't like. The fatal signal is "committed to"
> (sender approved by security modules, etc.) "before" the exec, but gets
> delivered "after" the exec.

That's because the signal is delivered between the system call function
returning to entry.S and userspace resuming. We could put a lot of
check...abort clauses in exec.c and the binfmts, but is it worth the hassle?

> I don't understand why install_exec_creds() is called as late as it is.
> Can't we do that in flush_old_exec()--you know, where it says:
> /* install the new credentials */
> ?

I believe it's something to do with the binfmt driver needing to access files
in the old security context between calling flush_old_exec() and calling
install_exec_creds() [compute_creds() as was]. It can't do some of the
accesses before calling flush_old_exec() because it has to do funky things
with mmap().

Actually, that comment should probably be removed. IIRC, at one time I was
trying to set all the credentials there, but was told I couldn't do that.

David
--
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/