public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
* [RFC][PATCH] audit: get inode pathname patch
@ 2008-08-06 14:36 Mimi Zohar
  2008-08-06 18:26 ` Serge E. Hallyn
  2008-08-12 23:47 ` Steve Grubb
  0 siblings, 2 replies; 4+ messages in thread
From: Mimi Zohar @ 2008-08-06 14:36 UTC (permalink / raw)
  To: Linux Audit; +Cc: David Safford, Reiner Sailer

We are interested in using auditing's context pathname information.  
Is this the best way of accessing it?

Add support for accessing auditing's inode full pathname.

Signed-off-by: Mimi Zohar <zohar@us.ibm.com>

Index: security-testing-2.6/include/linux/audit.h
===================================================================
--- security-testing-2.6.orig/include/linux/audit.h
+++ security-testing-2.6/include/linux/audit.h
@@ -403,6 +403,8 @@ extern void audit_syscall_entry(int arch
 				unsigned long a2, unsigned long a3);
 extern void audit_syscall_exit(int failed, long return_code);
 extern void __audit_getname(const char *name);
+extern const char *audit_get_inode_pathname(struct task_struct *tsk,
+					    struct inode *inode);
 extern void audit_putname(const char *name);
 extern void __audit_inode(const char *name, const struct dentry *dentry);
 extern void __audit_inode_child(const char *dname, const struct dentry *dentry,
Index: security-testing-2.6/kernel/auditsc.c
===================================================================
--- security-testing-2.6.orig/kernel/auditsc.c
+++ security-testing-2.6/kernel/auditsc.c
@@ -1677,6 +1677,28 @@ retry:
 #endif
 }
 
+const char *audit_get_inode_pathname(struct task_struct *tsk,
+				     struct inode *inode)
+{
+	struct audit_context *context;
+	int idx;
+
+	context = tsk->audit_context;
+	if (!context)
+		return NULL;
+	for (idx = 0; idx < context->name_count; idx++) {
+		struct audit_names *n = &context->names[idx];
+
+		if (!n->name)
+			continue;
+
+		if (n->ino == inode->i_ino)
+			return n->name;
+	}
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(audit_get_inode_pathname);
+
 /**
  * audit_getname - add a name to the list
  * @name: name to add

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

* Re: [RFC][PATCH] audit: get inode pathname patch
  2008-08-06 14:36 [RFC][PATCH] audit: get inode pathname patch Mimi Zohar
@ 2008-08-06 18:26 ` Serge E. Hallyn
  2008-08-12 23:47 ` Steve Grubb
  1 sibling, 0 replies; 4+ messages in thread
From: Serge E. Hallyn @ 2008-08-06 18:26 UTC (permalink / raw)
  To: Mimi Zohar; +Cc: David Safford, Linux Audit, Reiner Sailer

Quoting Mimi Zohar (zohar@linux.vnet.ibm.com):
> We are interested in using auditing's context pathname information.  
> Is this the best way of accessing it?
> 
> Add support for accessing auditing's inode full pathname.

Interesting idea.  It does seem to do what you need.

-serge

> Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
> 
> Index: security-testing-2.6/include/linux/audit.h
> ===================================================================
> --- security-testing-2.6.orig/include/linux/audit.h
> +++ security-testing-2.6/include/linux/audit.h
> @@ -403,6 +403,8 @@ extern void audit_syscall_entry(int arch
>  				unsigned long a2, unsigned long a3);
>  extern void audit_syscall_exit(int failed, long return_code);
>  extern void __audit_getname(const char *name);
> +extern const char *audit_get_inode_pathname(struct task_struct *tsk,
> +					    struct inode *inode);
>  extern void audit_putname(const char *name);
>  extern void __audit_inode(const char *name, const struct dentry *dentry);
>  extern void __audit_inode_child(const char *dname, const struct dentry *dentry,
> Index: security-testing-2.6/kernel/auditsc.c
> ===================================================================
> --- security-testing-2.6.orig/kernel/auditsc.c
> +++ security-testing-2.6/kernel/auditsc.c
> @@ -1677,6 +1677,28 @@ retry:
>  #endif
>  }
> 
> +const char *audit_get_inode_pathname(struct task_struct *tsk,
> +				     struct inode *inode)
> +{
> +	struct audit_context *context;
> +	int idx;
> +
> +	context = tsk->audit_context;
> +	if (!context)
> +		return NULL;
> +	for (idx = 0; idx < context->name_count; idx++) {
> +		struct audit_names *n = &context->names[idx];
> +
> +		if (!n->name)
> +			continue;
> +
> +		if (n->ino == inode->i_ino)
> +			return n->name;
> +	}
> +	return NULL;
> +}
> +EXPORT_SYMBOL_GPL(audit_get_inode_pathname);
> +
>  /**
>   * audit_getname - add a name to the list
>   * @name: name to add
> 
> 
> --
> Linux-audit mailing list
> Linux-audit@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-audit

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

* Re: [RFC][PATCH] audit: get inode pathname patch
  2008-08-06 14:36 [RFC][PATCH] audit: get inode pathname patch Mimi Zohar
  2008-08-06 18:26 ` Serge E. Hallyn
@ 2008-08-12 23:47 ` Steve Grubb
  2008-08-13 22:28   ` Mimi Zohar
  1 sibling, 1 reply; 4+ messages in thread
From: Steve Grubb @ 2008-08-12 23:47 UTC (permalink / raw)
  To: linux-audit; +Cc: David Safford, Reiner Sailer

On Wednesday 06 August 2008 10:36:46 Mimi Zohar wrote:
> We are interested in using auditing's context pathname information.  
> Is this the best way of accessing it?
>
> Add support for accessing auditing's inode full pathname.

What would this be used for? Al could you comment on this? Would there be 
locking issues?

-Steve

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

* Re: [RFC][PATCH] audit: get inode pathname patch
  2008-08-12 23:47 ` Steve Grubb
@ 2008-08-13 22:28   ` Mimi Zohar
  0 siblings, 0 replies; 4+ messages in thread
From: Mimi Zohar @ 2008-08-13 22:28 UTC (permalink / raw)
  To: Steve Grubb; +Cc: David Safford, linux-audit, Reiner Sailer

On Tue, 2008-08-12 at 19:47 -0400, Steve Grubb wrote:
> On Wednesday 06 August 2008 10:36:46 Mimi Zohar wrote:
> > We are interested in using auditing's context pathname information.  
> > Is this the best way of accessing it?
> >
> > Add support for accessing auditing's inode full pathname.
> 
> What would this be used for? Al could you comment on this? Would there be 
> locking issues?

The IMA measurement hash list contains a file name hint. Using
a full pathname, when available, would be nice.

Mimi

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

end of thread, other threads:[~2008-08-13 22:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-06 14:36 [RFC][PATCH] audit: get inode pathname patch Mimi Zohar
2008-08-06 18:26 ` Serge E. Hallyn
2008-08-12 23:47 ` Steve Grubb
2008-08-13 22:28   ` Mimi Zohar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox