All of lore.kernel.org
 help / color / mirror / Atom feed
* Getting the real task name in avc messages
@ 2005-03-30 19:53 Steve G
  2005-03-30 20:41 ` Stephen Smalley
  2005-03-30 20:50 ` James Morris
  0 siblings, 2 replies; 14+ messages in thread
From: Steve G @ 2005-03-30 19:53 UTC (permalink / raw)
  To: selinux

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

Hello,

Attached is a patch to the kernel that puts the program's name into the avc
message. This lets you know the script that caused the problem instead of
/bin/bash. Feedback would be appreciated.

-Steve Grubb

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[-- Attachment #2: linux-2.6.11-selinux-procname.patch --]
[-- Type: application/octet-stream, Size: 1765 bytes --]

diff -ur linux-2.6.11.orig/include/linux/audit.h linux-2.6.11/include/linux/audit.h
--- linux-2.6.11.orig/include/linux/audit.h	2005-03-07 13:45:33.000000000 -0500
+++ linux-2.6.11/include/linux/audit.h	2005-03-08 17:26:47.000000000 -0500
@@ -184,6 +184,7 @@
 					     const char *prefix,
 					     struct dentry *dentry,
 					     struct vfsmount *vfsmnt);
+extern void		    audit_log_task_info(struct audit_buffer *ab);
 extern int		    audit_set_rate_limit(int limit, uid_t loginuid);
 extern int		    audit_set_backlog_limit(int limit, uid_t loginuid);
 extern int		    audit_set_enabled(int state, uid_t loginuid);
diff -ur linux-2.6.11.orig/kernel/auditsc.c linux-2.6.11/kernel/auditsc.c
--- linux-2.6.11.orig/kernel/auditsc.c	2005-03-07 13:45:39.000000000 -0500
+++ linux-2.6.11/kernel/auditsc.c	2005-03-08 17:30:06.065237424 -0500
@@ -584,6 +584,17 @@
 		printk(KERN_ERR "audit: freed %d contexts\n", count);
 }
 
+void audit_log_task_info(struct audit_buffer *ab)
+{
+        char name[sizeof(current->comm)];
+
+        get_task_comm(name, current);
+        audit_log_format(ab, " procname=%s", name);
+        audit_log_format(ab, " syscall=%d per=%lx", 
+		current->audit_context->major,
+		current->audit_context->personality);
+}
+
 static void audit_log_exit(struct audit_context *context)
 {
 	int i;
diff -ur linux-2.6.11.orig/security/selinux/avc.c linux-2.6.11/security/selinux/avc.c
--- linux-2.6.11.orig/security/selinux/avc.c	2005-03-07 13:45:46.000000000 -0500
+++ linux-2.6.11/security/selinux/avc.c	2005-03-08 17:26:47.000000000 -0500
@@ -575,6 +575,7 @@
 						audit_log_d_path(ab, "exe=",
 							vma->vm_file->f_dentry,
 							vma->vm_file->f_vfsmnt);
+						audit_log_task_info(ab);
 						break;
 					}
 					vma = vma->vm_next;

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: Getting the real task name in avc messages
@ 2005-03-30 21:02 Steve G
  2005-03-30 21:14 ` Stephen Smalley
  0 siblings, 1 reply; 14+ messages in thread
From: Steve G @ 2005-03-30 21:02 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: selinux

>Note that anytime avc_audit generates an audit message, audit_log_exit
>will be called upon syscall exit, so by adding a call to your new function 
>to audit_log_exit, you'll ensure that this information is recorded for 
>every avc denial as well as every other audit message.

I'm not sure we need this information for regular auditing. I haven't seen
regular audit messages that showed the interpreter instead of the program. The
problem does exist for avc denials.

>Note that the comm field is less complete (not a full path and may even
>be truncated) and is not trustworthy (can be changed by the process to
>any arbitrary string).  So you can't rely on it, but it can be useful
>for debugging.

I know about that. I know where to find the full path (example code is over in
the proc file system), but I don't have time to improve this patch right now. I
just want to get this out in the open and show that the status quo can be
improved a little.

Thanks,
-Steve Grubb

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: Getting the real task name in avc messages
@ 2005-03-31 14:53 Steve G
  2005-03-31 15:00 ` Stephen Smalley
  0 siblings, 1 reply; 14+ messages in thread
From: Steve G @ 2005-03-31 14:53 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: selinux

>Steve, want to take the updated patch to linux-audit?

Ok. Let me compile it and see what the logs look like first.

Thanks,
-Steve Grubb

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-03-31 15:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-30 19:53 Getting the real task name in avc messages Steve G
2005-03-30 20:41 ` Stephen Smalley
2005-03-30 21:09   ` Stephen Smalley
2005-03-30 20:50 ` James Morris
2005-03-30 22:04   ` James Morris
2005-03-30 22:27     ` Darrel Goeddel
2005-03-31 12:30       ` Stephen Smalley
2005-03-31 13:36         ` Stephen Smalley
2005-03-31 15:21         ` Darrel Goeddel
2005-03-31 15:20           ` Stephen Smalley
  -- strict thread matches above, loose matches on Subject: below --
2005-03-30 21:02 Steve G
2005-03-30 21:14 ` Stephen Smalley
2005-03-31 14:53 Steve G
2005-03-31 15:00 ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.