diff options
author | Richard Guy Briggs <rgb@redhat.com> | 2013-12-11 13:52:26 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2014-03-20 10:11:55 -0400 |
commit | f1dc4867ff41b7bcca57fa19449d1fe7ad517ac1 (patch) | |
tree | 873f8e7625dc54ae20a0cc2513fb6a33027f36d7 /security | |
parent | c92cdeb45eea38515e82187f48c2e4f435fb4e25 (diff) |
audit: anchor all pid references in the initial pid namespace
Store and log all PIDs with reference to the initial PID namespace and
use the access functions task_pid_nr() and task_tgid_nr() for task->pid
and task->tgid.
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
(informed by ebiederman's c776b5d2)
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/integrity/integrity_audit.c | 2 | ||||
-rw-r--r-- | security/lsm_audit.c | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/security/integrity/integrity_audit.c b/security/integrity/integrity_audit.c index d7efb30404aa..85253b584791 100644 --- a/security/integrity/integrity_audit.c +++ b/security/integrity/integrity_audit.c | |||
@@ -39,7 +39,7 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode, | |||
39 | 39 | ||
40 | ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno); | 40 | ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno); |
41 | audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u", | 41 | audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u", |
42 | current->pid, | 42 | task_pid_nr(current), |
43 | from_kuid(&init_user_ns, current_cred()->uid), | 43 | from_kuid(&init_user_ns, current_cred()->uid), |
44 | from_kuid(&init_user_ns, audit_get_loginuid(current)), | 44 | from_kuid(&init_user_ns, audit_get_loginuid(current)), |
45 | audit_get_sessionid(current)); | 45 | audit_get_sessionid(current)); |
diff --git a/security/lsm_audit.c b/security/lsm_audit.c index 9a62045e6282..69fdf3bc765b 100644 --- a/security/lsm_audit.c +++ b/security/lsm_audit.c | |||
@@ -220,7 +220,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, | |||
220 | */ | 220 | */ |
221 | BUILD_BUG_ON(sizeof(a->u) > sizeof(void *)*2); | 221 | BUILD_BUG_ON(sizeof(a->u) > sizeof(void *)*2); |
222 | 222 | ||
223 | audit_log_format(ab, " pid=%d comm=", tsk->pid); | 223 | audit_log_format(ab, " pid=%d comm=", task_pid_nr(tsk)); |
224 | audit_log_untrustedstring(ab, tsk->comm); | 224 | audit_log_untrustedstring(ab, tsk->comm); |
225 | 225 | ||
226 | switch (a->type) { | 226 | switch (a->type) { |
@@ -278,9 +278,12 @@ static void dump_common_audit_data(struct audit_buffer *ab, | |||
278 | } | 278 | } |
279 | case LSM_AUDIT_DATA_TASK: | 279 | case LSM_AUDIT_DATA_TASK: |
280 | tsk = a->u.tsk; | 280 | tsk = a->u.tsk; |
281 | if (tsk && tsk->pid) { | 281 | if (tsk) { |
282 | audit_log_format(ab, " pid=%d comm=", tsk->pid); | 282 | pid_t pid = task_pid_nr(tsk); |
283 | audit_log_untrustedstring(ab, tsk->comm); | 283 | if (pid) { |
284 | audit_log_format(ab, " pid=%d comm=", pid); | ||
285 | audit_log_untrustedstring(ab, tsk->comm); | ||
286 | } | ||
284 | } | 287 | } |
285 | break; | 288 | break; |
286 | case LSM_AUDIT_DATA_NET: | 289 | case LSM_AUDIT_DATA_NET: |