Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 245
b: refs/heads/master
c: 219f081
h: refs/heads/master
i:
  243: e7b4ff6
v: v3
  • Loading branch information
Stephen Smalley authored and Linus Torvalds committed Apr 18, 2005
1 parent 6f6e93c commit ec04ef4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 865108d13801d39ec038bdc82b5bec5e1eaffa9d
refs/heads/master: 219f0817038cabc722968e914490adf6b686499e
28 changes: 28 additions & 0 deletions trunk/kernel/auditsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,33 @@ static inline void audit_free_context(struct audit_context *context)
printk(KERN_ERR "audit: freed %d contexts\n", count);
}

static void audit_log_task_info(struct audit_buffer *ab)
{
char name[sizeof(current->comm)];
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;

get_task_comm(name, current);
audit_log_format(ab, " comm=%s", name);

if (!mm)
return;

down_read(&mm->mmap_sem);
vma = mm->mmap;
while (vma) {
if ((vma->vm_flags & VM_EXECUTABLE) &&
vma->vm_file) {
audit_log_d_path(ab, "exe=",
vma->vm_file->f_dentry,
vma->vm_file->f_vfsmnt);
break;
}
vma = vma->vm_next;
}
up_read(&mm->mmap_sem);
}

static void audit_log_exit(struct audit_context *context)
{
int i;
Expand Down Expand Up @@ -639,6 +666,7 @@ static void audit_log_exit(struct audit_context *context)
context->gid,
context->euid, context->suid, context->fsuid,
context->egid, context->sgid, context->fsgid);
audit_log_task_info(ab);
audit_log_end(ab);
while (context->aux) {
struct audit_aux_data *aux;
Expand Down
34 changes: 0 additions & 34 deletions trunk/security/selinux/avc.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ void avc_audit(u32 ssid, u32 tsid,
u16 tclass, u32 requested,
struct av_decision *avd, int result, struct avc_audit_data *a)
{
struct task_struct *tsk = current;
struct inode *inode = NULL;
u32 denied, audited;
struct audit_buffer *ab;
Expand All @@ -556,39 +555,6 @@ void avc_audit(u32 ssid, u32 tsid,
audit_log_format(ab, "avc: %s ", denied ? "denied" : "granted");
avc_dump_av(ab, tclass,audited);
audit_log_format(ab, " for ");
if (a && a->tsk)
tsk = a->tsk;
if (tsk && tsk->pid) {
struct mm_struct *mm;
struct vm_area_struct *vma;
audit_log_format(ab, " pid=%d", tsk->pid);
if (tsk == current)
mm = current->mm;
else
mm = get_task_mm(tsk);
if (mm) {
if (down_read_trylock(&mm->mmap_sem)) {
vma = mm->mmap;
while (vma) {
if ((vma->vm_flags & VM_EXECUTABLE) &&
vma->vm_file) {
audit_log_d_path(ab, "exe=",
vma->vm_file->f_dentry,
vma->vm_file->f_vfsmnt);
break;
}
vma = vma->vm_next;
}
up_read(&mm->mmap_sem);
} else {
audit_log_format(ab, " comm=%s", tsk->comm);
}
if (tsk != current)
mmput(mm);
} else {
audit_log_format(ab, " comm=%s", tsk->comm);
}
}
if (a) {
switch (a->type) {
case AVC_AUDIT_DATA_IPC:
Expand Down

0 comments on commit ec04ef4

Please sign in to comment.