diff options
| author | Greg Kroah-Hartman <greg@kroah.com> | 2002-07-19 02:01:00 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <greg@kroah.com> | 2002-07-19 02:01:00 -0700 |
| commit | 1c0fe622c8847e1caab384a81cf96de2f1ac05d8 (patch) | |
| tree | ea83fc894fbd386dba63ddeac33c7be5a729978d /kernel/fork.c | |
| parent | 2b15fe6334aebd7d3340f8b826acb79b138afa74 (diff) | |
LSM: Enable the security framework. This includes basic task control hooks.
Diffstat (limited to 'kernel/fork.c')
| -rw-r--r-- | kernel/fork.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index c0fb979902fe..f99f9e69521a 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -24,7 +24,7 @@ #include <linux/file.h> #include <linux/binfmts.h> #include <linux/fs.h> -#include <linux/mm.h> +#include <linux/security.h> #include <asm/pgtable.h> #include <asm/pgalloc.h> @@ -618,6 +618,10 @@ struct task_struct *do_fork(unsigned long clone_flags, if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS)) return ERR_PTR(-EINVAL); + retval = security_ops->task_create(clone_flags); + if (retval) + goto fork_out; + retval = -ENOMEM; p = dup_task_struct(current); if (!p) @@ -697,13 +701,16 @@ struct task_struct *do_fork(unsigned long clone_flags, p->array = NULL; p->lock_depth = -1; /* -1 = no lock */ p->start_time = jiffies; + p->security = NULL; INIT_LIST_HEAD(&p->local_pages); retval = -ENOMEM; + if (security_ops->task_alloc_security(p)) + goto bad_fork_cleanup; /* copy all the process information */ if (copy_semundo(clone_flags, p)) - goto bad_fork_cleanup; + goto bad_fork_cleanup_security; if (copy_files(clone_flags, p)) goto bad_fork_cleanup_semundo; if (copy_fs(clone_flags, p)) @@ -812,6 +819,8 @@ bad_fork_cleanup_files: exit_files(p); /* blocking */ bad_fork_cleanup_semundo: exit_semundo(p); +bad_fork_cleanup_security: + security_ops->task_free_security(p); bad_fork_cleanup: put_exec_domain(p->thread_info->exec_domain); if (p->binfmt && p->binfmt->module) |
