diff options
Diffstat (limited to 'kernel/auditsc.c')
| -rw-r--r-- | kernel/auditsc.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 5276b7ef05f1..e36481ed61b4 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
| @@ -2037,3 +2037,42 @@ int __audit_signal_info(int sig, struct task_struct *t) | |||
| 2037 | 2037 | ||
| 2038 | return 0; | 2038 | return 0; |
| 2039 | } | 2039 | } |
| 2040 | |||
| 2041 | /** | ||
| 2042 | * audit_core_dumps - record information about processes that end abnormally | ||
| 2043 | * @sig: signal value | ||
| 2044 | * | ||
| 2045 | * If a process ends with a core dump, something fishy is going on and we | ||
| 2046 | * should record the event for investigation. | ||
| 2047 | */ | ||
| 2048 | void audit_core_dumps(long signr) | ||
| 2049 | { | ||
| 2050 | struct audit_buffer *ab; | ||
| 2051 | u32 sid; | ||
| 2052 | |||
| 2053 | if (!audit_enabled) | ||
| 2054 | return; | ||
| 2055 | |||
| 2056 | if (signr == SIGQUIT) /* don't care for those */ | ||
| 2057 | return; | ||
| 2058 | |||
| 2059 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND); | ||
| 2060 | audit_log_format(ab, "auid=%u uid=%u gid=%u", | ||
| 2061 | audit_get_loginuid(current->audit_context), | ||
| 2062 | current->uid, current->gid); | ||
| 2063 | selinux_get_task_sid(current, &sid); | ||
| 2064 | if (sid) { | ||
| 2065 | char *ctx = NULL; | ||
| 2066 | u32 len; | ||
| 2067 | |||
| 2068 | if (selinux_sid_to_string(sid, &ctx, &len)) | ||
| 2069 | audit_log_format(ab, " ssid=%u", sid); | ||
| 2070 | else | ||
| 2071 | audit_log_format(ab, " subj=%s", ctx); | ||
| 2072 | kfree(ctx); | ||
| 2073 | } | ||
| 2074 | audit_log_format(ab, " pid=%d comm=", current->pid); | ||
| 2075 | audit_log_untrustedstring(ab, current->comm); | ||
| 2076 | audit_log_format(ab, " sig=%ld", signr); | ||
| 2077 | audit_log_end(ab); | ||
| 2078 | } | ||
