[PATCH] sanitize handling of shared descriptor tables in failing execve()
* unshare_files() can fail; doing it after irreversible actions is wrong
and de_thread() is certainly irreversible.
* since we do it unconditionally anyway, we might as well do it in do_execve()
and save ourselves the PITA in binfmt handlers, etc.
* while we are at it, binfmt_som actually leaked files_struct on failure.
As a side benefit, unshare_files(), put_files_struct() and reset_files_struct()
become unexported.
Signed-off-by:
Al Viro <viro@zeniv.linux.org.uk>
Showing
- fs/binfmt_elf.c 1 addition, 22 deletionsfs/binfmt_elf.c
- fs/binfmt_misc.c 1 addition, 17 deletionsfs/binfmt_misc.c
- fs/binfmt_som.c 0 additions, 10 deletionsfs/binfmt_som.c
- fs/exec.c 18 additions, 16 deletionsfs/exec.c
- kernel/exit.c 0 additions, 3 deletionskernel/exit.c
- kernel/fork.c 0 additions, 2 deletionskernel/fork.c
Loading
Please register or sign in to comment