--- zzzz-none-000/linux-2.6.19.2/kernel/exit.c 2007-01-10 19:10:37.000000000 +0000 +++ davinci-8020-5505/linux-2.6.19.2/kernel/exit.c 2007-01-19 14:42:56.000000000 +0000 @@ -41,6 +41,11 @@ #include /* for audit_free() */ #include #include +#include + +#ifdef CONFIG_GRKERNSEC +extern rwlock_t grsec_exec_file_lock; +#endif #include #include @@ -118,6 +123,7 @@ __unhash_process(tsk); + gr_del_task_from_ip_table(tsk); tsk->signal = NULL; tsk->sighand = NULL; spin_unlock(&sighand->siglock); @@ -128,7 +134,6 @@ flush_sigqueue(&tsk->pending); if (sig) { flush_sigqueue(&sig->shared_pending); - taskstats_tgid_free(sig); __cleanup_signal(sig); } } @@ -275,6 +280,15 @@ { write_lock_irq(&tasklist_lock); +#ifdef CONFIG_GRKERNSEC + write_lock(&grsec_exec_file_lock); + if (current->exec_file) { + fput(current->exec_file); + current->exec_file = NULL; + } + write_unlock(&grsec_exec_file_lock); +#endif + ptrace_unlink(current); /* Reparent to init */ remove_parent(current); @@ -282,6 +296,8 @@ current->real_parent = child_reaper; add_parent(current); + gr_set_kernel_label(current); + /* Set the exit signal to SIGCHLD so we signal init on exit */ current->exit_signal = SIGCHLD; @@ -376,6 +392,17 @@ vsnprintf(current->comm, sizeof(current->comm), name, args); va_end(args); +#ifdef CONFIG_GRKERNSEC + write_lock(&grsec_exec_file_lock); + if (current->exec_file) { + fput(current->exec_file); + current->exec_file = NULL; + } + write_unlock(&grsec_exec_file_lock); +#endif + + gr_set_kernel_label(current); + /* * If we were started as result of loading a module, close all of the * user space pages. We don't need them, and if we didn't close them @@ -914,11 +941,15 @@ taskstats_exit_send(tsk, tidstats, group_dead, mycpu); taskstats_exit_free(tidstats); + gr_acl_handle_psacct(tsk, code); + gr_acl_handle_exit(); + exit_mm(tsk); if (group_dead) acct_process(); exit_sem(tsk); + gr_shm_exit(tsk); __exit_files(tsk); __exit_fs(tsk); exit_thread();