exec: Compute file based creds only once
Eric W. Biederman authored
Move the computation of creds from prepare_binfmt into begin_new_exec
so that the creds need only be computed once.  This is just code
reorganization no semantic changes of any kind are made.

Moving the computation is safe.  I have looked through the kernel and
verified none of the binfmts look at bprm->cred directly, and that
there are no helpers that look at bprm->cred indirectly.  Which means
that it is not a problem to compute the bprm->cred later in the
execution flow as it is not used until it becomes current->cred.

A new function bprm_creds_from_file is added to contain the work that
needs to be done.  bprm_creds_from_file first computes which file
bprm->executable or most likely bprm->file that the bprm->creds
will be computed from.

The funciton bprm_fill_uid is updated to receive the file instead of
accessing bprm->file.  The now unnecessary work needed to reset the
bprm->cred->euid, and bprm->cred->egid is removed from brpm_fill_uid.
A small comment to...
56305aa9
Name Last commit Last update
Documentation exec: Rename flush_old_exec begin_new_exec
LICENSES LICENSES: Rename other to deprecated
arch exec: Remove recursion from search_binary_handler
block blk-iocost: Fix error on iocost_ioc_vrate_adj
certs .gitignore: add SPDX License Identifier
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
drivers Merge tag 'usb-5.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
fs exec: Compute file based creds only once
include exec: Compute file based creds only once
init Merge tag 'kbuild-v5.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
ipc ipc/util.c: sysvipc_find_ipc() should increase position index
kernel exec: Teach prepare_exec_creds how exec treats uids & gids
lib lib/mpi: Fix building for powerpc with clang
mm mm: check that mm is still valid in madvise()
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
samples vmalloc: fix remap_vmalloc_range() bounds checks
scripts Merge tag 'kbuild-fixes-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
security exec: Compute file based creds only once
sound Merge tag 'sound-5.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
tools selftests/exec: Add binfmt_script regression test
usr kbuild: fix comment about missing include guard detection
virt KVM: Pass kvm_init()'s opaque param to additional arch funcs
.clang-format clang-format: Update with the latest for_each macro list
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl
.gitattributes .gitattributes: use 'dts' diff driver for dts files
.gitignore .gitignore: add SPDX License Identifier
.mailmap mailmap: Add Sedat Dilek (replacement for expired email address)
COPYING COPYING: state that all contributions really are covered by this file
CREDITS MAINTAINERS: Hand MIPS over to Thomas
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y
Kconfig docs: kbuild: convert docs to ReST and rename to *.rst
MAINTAINERS Merge tag 'staging-5.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Makefile Linux 5.7-rc3
README Drop all 00-INDEX files from Documentation/
Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.