diff options
author | Matt Helsley <matthltc@us.ibm.com> | 2005-11-07 03:59:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:35 -0500 |
commit | 9f46080c41d5f3f7c00b4e169ba4b0b2865258bf (patch) | |
tree | e2c029ef7f0cd5fb8ea9b78db3f7be5badaf59b1 /kernel | |
parent | 49364ce2534418462d681ad99e52e79a00b0f40b (diff) |
[PATCH] Process Events Connector
This patch adds a connector that reports fork, exec, id change, and exit
events for all processes to userspace. It replaces the fork_advisor patch
that ELSA is currently using. Applications that may find these events
useful include accounting/auditing (e.g. ELSA), system activity monitoring
(e.g. top), security, and resource management (e.g. CKRM).
Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/exit.c | 2 | ||||
-rw-r--r-- | kernel/fork.c | 2 | ||||
-rw-r--r-- | kernel/sys.c | 9 |
3 files changed, 13 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 537394b25e8d..452a1d116178 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/cpuset.h> | 28 | #include <linux/cpuset.h> |
29 | #include <linux/syscalls.h> | 29 | #include <linux/syscalls.h> |
30 | #include <linux/signal.h> | 30 | #include <linux/signal.h> |
31 | #include <linux/cn_proc.h> | ||
31 | 32 | ||
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
33 | #include <asm/unistd.h> | 34 | #include <asm/unistd.h> |
@@ -863,6 +864,7 @@ fastcall NORET_TYPE void do_exit(long code) | |||
863 | module_put(tsk->binfmt->module); | 864 | module_put(tsk->binfmt->module); |
864 | 865 | ||
865 | tsk->exit_code = code; | 866 | tsk->exit_code = code; |
867 | proc_exit_connector(tsk); | ||
866 | exit_notify(tsk); | 868 | exit_notify(tsk); |
867 | #ifdef CONFIG_NUMA | 869 | #ifdef CONFIG_NUMA |
868 | mpol_free(tsk->mempolicy); | 870 | mpol_free(tsk->mempolicy); |
diff --git a/kernel/fork.c b/kernel/fork.c index 8a069612eac3..efac2c58ec7d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/profile.h> | 42 | #include <linux/profile.h> |
43 | #include <linux/rmap.h> | 43 | #include <linux/rmap.h> |
44 | #include <linux/acct.h> | 44 | #include <linux/acct.h> |
45 | #include <linux/cn_proc.h> | ||
45 | 46 | ||
46 | #include <asm/pgtable.h> | 47 | #include <asm/pgtable.h> |
47 | #include <asm/pgalloc.h> | 48 | #include <asm/pgalloc.h> |
@@ -1143,6 +1144,7 @@ static task_t *copy_process(unsigned long clone_flags, | |||
1143 | __get_cpu_var(process_counts)++; | 1144 | __get_cpu_var(process_counts)++; |
1144 | } | 1145 | } |
1145 | 1146 | ||
1147 | proc_fork_connector(p); | ||
1146 | if (!current->signal->tty && p->signal->tty) | 1148 | if (!current->signal->tty && p->signal->tty) |
1147 | p->signal->tty = NULL; | 1149 | p->signal->tty = NULL; |
1148 | 1150 | ||
diff --git a/kernel/sys.c b/kernel/sys.c index 2fa1ed18123c..1e1f41b3fdf6 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/suspend.h> | 28 | #include <linux/suspend.h> |
29 | #include <linux/tty.h> | 29 | #include <linux/tty.h> |
30 | #include <linux/signal.h> | 30 | #include <linux/signal.h> |
31 | #include <linux/cn_proc.h> | ||
31 | 32 | ||
32 | #include <linux/compat.h> | 33 | #include <linux/compat.h> |
33 | #include <linux/syscalls.h> | 34 | #include <linux/syscalls.h> |
@@ -623,6 +624,7 @@ asmlinkage long sys_setregid(gid_t rgid, gid_t egid) | |||
623 | current->egid = new_egid; | 624 | current->egid = new_egid; |
624 | current->gid = new_rgid; | 625 | current->gid = new_rgid; |
625 | key_fsgid_changed(current); | 626 | key_fsgid_changed(current); |
627 | proc_id_connector(current, PROC_EVENT_GID); | ||
626 | return 0; | 628 | return 0; |
627 | } | 629 | } |
628 | 630 | ||
@@ -662,6 +664,7 @@ asmlinkage long sys_setgid(gid_t gid) | |||
662 | return -EPERM; | 664 | return -EPERM; |
663 | 665 | ||
664 | key_fsgid_changed(current); | 666 | key_fsgid_changed(current); |
667 | proc_id_connector(current, PROC_EVENT_GID); | ||
665 | return 0; | 668 | return 0; |
666 | } | 669 | } |
667 | 670 | ||
@@ -751,6 +754,7 @@ asmlinkage long sys_setreuid(uid_t ruid, uid_t euid) | |||
751 | current->fsuid = current->euid; | 754 | current->fsuid = current->euid; |
752 | 755 | ||
753 | key_fsuid_changed(current); | 756 | key_fsuid_changed(current); |
757 | proc_id_connector(current, PROC_EVENT_UID); | ||
754 | 758 | ||
755 | return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_RE); | 759 | return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_RE); |
756 | } | 760 | } |
@@ -798,6 +802,7 @@ asmlinkage long sys_setuid(uid_t uid) | |||
798 | current->suid = new_suid; | 802 | current->suid = new_suid; |
799 | 803 | ||
800 | key_fsuid_changed(current); | 804 | key_fsuid_changed(current); |
805 | proc_id_connector(current, PROC_EVENT_UID); | ||
801 | 806 | ||
802 | return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_ID); | 807 | return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_ID); |
803 | } | 808 | } |
@@ -846,6 +851,7 @@ asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid) | |||
846 | current->suid = suid; | 851 | current->suid = suid; |
847 | 852 | ||
848 | key_fsuid_changed(current); | 853 | key_fsuid_changed(current); |
854 | proc_id_connector(current, PROC_EVENT_UID); | ||
849 | 855 | ||
850 | return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_RES); | 856 | return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_RES); |
851 | } | 857 | } |
@@ -898,6 +904,7 @@ asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid) | |||
898 | current->sgid = sgid; | 904 | current->sgid = sgid; |
899 | 905 | ||
900 | key_fsgid_changed(current); | 906 | key_fsgid_changed(current); |
907 | proc_id_connector(current, PROC_EVENT_GID); | ||
901 | return 0; | 908 | return 0; |
902 | } | 909 | } |
903 | 910 | ||
@@ -940,6 +947,7 @@ asmlinkage long sys_setfsuid(uid_t uid) | |||
940 | } | 947 | } |
941 | 948 | ||
942 | key_fsuid_changed(current); | 949 | key_fsuid_changed(current); |
950 | proc_id_connector(current, PROC_EVENT_UID); | ||
943 | 951 | ||
944 | security_task_post_setuid(old_fsuid, (uid_t)-1, (uid_t)-1, LSM_SETID_FS); | 952 | security_task_post_setuid(old_fsuid, (uid_t)-1, (uid_t)-1, LSM_SETID_FS); |
945 | 953 | ||
@@ -968,6 +976,7 @@ asmlinkage long sys_setfsgid(gid_t gid) | |||
968 | } | 976 | } |
969 | current->fsgid = gid; | 977 | current->fsgid = gid; |
970 | key_fsgid_changed(current); | 978 | key_fsgid_changed(current); |
979 | proc_id_connector(current, PROC_EVENT_GID); | ||
971 | } | 980 | } |
972 | return old_fsgid; | 981 | return old_fsgid; |
973 | } | 982 | } |