diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-04-22 05:11:59 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-04-25 09:23:53 -0400 |
commit | fd8328be874f4190a811c58cd4778ec2c74d2c05 (patch) | |
tree | b44ae8e99ce96a1a4739b04d4d1a23c40ab8b163 /kernel | |
parent | 6b335d9c80d7f3c2a3f6545f664ae9007a0f3821 (diff) |
[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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/exit.c | 3 | ||||
-rw-r--r-- | kernel/fork.c | 2 |
2 files changed, 0 insertions, 5 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index cece89f80ab4..3d320003cc03 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -507,8 +507,6 @@ void put_files_struct(struct files_struct *files) | |||
507 | } | 507 | } |
508 | } | 508 | } |
509 | 509 | ||
510 | EXPORT_SYMBOL(put_files_struct); | ||
511 | |||
512 | void reset_files_struct(struct task_struct *tsk, struct files_struct *files) | 510 | void reset_files_struct(struct task_struct *tsk, struct files_struct *files) |
513 | { | 511 | { |
514 | struct files_struct *old; | 512 | struct files_struct *old; |
@@ -519,7 +517,6 @@ void reset_files_struct(struct task_struct *tsk, struct files_struct *files) | |||
519 | task_unlock(tsk); | 517 | task_unlock(tsk); |
520 | put_files_struct(old); | 518 | put_files_struct(old); |
521 | } | 519 | } |
522 | EXPORT_SYMBOL(reset_files_struct); | ||
523 | 520 | ||
524 | void exit_files(struct task_struct *tsk) | 521 | void exit_files(struct task_struct *tsk) |
525 | { | 522 | { |
diff --git a/kernel/fork.c b/kernel/fork.c index 76f05a08062b..2fc11f2e2b21 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -870,8 +870,6 @@ int unshare_files(void) | |||
870 | return error; | 870 | return error; |
871 | } | 871 | } |
872 | 872 | ||
873 | EXPORT_SYMBOL(unshare_files); | ||
874 | |||
875 | static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk) | 873 | static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk) |
876 | { | 874 | { |
877 | struct sighand_struct *sig; | 875 | struct sighand_struct *sig; |