LSM: Wrap binfmt calls to kernel_read() and pass bprm

Wrap all calls from binfmts to kernel_read() in bprm_read() and pass the exec
state (struct linux_binprm) pointer to it so that the new creds are available
for a later patch to use.

Also:

 (1) Provide a wrapper function - exec_read_header() - for filling the bprm
     buffer from a file.

 (2) Move the definition of kernel_read() to fs/splice.c so that it is next to
     kernel_write().

 (3) Make the buffer pointer of bprm_read() of 'void *' type and drop the
     casts required of some callers.

This should not be necessary if all filesystems correctly use file->f_cred
rather than current_cred() when it is available.  However, NFS and SunRPC
don't seem to do that.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 files changed