public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
* [PATCH] Audit: EINTR instead of kernel private return codes in audit records
@ 2007-11-14 20:22 Eric Paris
  2007-11-14 20:29 ` Paul Moore
  2007-11-14 20:30 ` Steve Grubb
  0 siblings, 2 replies; 9+ messages in thread
From: Eric Paris @ 2007-11-14 20:22 UTC (permalink / raw)
  To: linux-audit; +Cc: pmoore

When a syscall gets interrupted by a signal and that signal is set to
not restart the syscall its return code will get collected by the audit
system before the registers are changed to the userspace valid EINTR;
See the discussion in include/linux/errno.h

Thus it is possible to get a syscall audit such as:

type=SYSCALL msg=audit(11/13/2007 23:47:34.648:80314) : arch=x86_64
syscall=accept success=no exit=-512(Unknown error 512) a0=3 [snip]

with this patch we clean up those kernel only return codes and give the
userspace equivalent.

type=SYSCALL msg=audit(11/13/2007 23:06:04.017:898) : arch=x86_64
syscall=accept success=no exit=-4(Interrupted system call) a0=3 [snip]

Signed-off-by: Eric Paris <eparis@redhat.com>

---

 kernel/auditsc.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index bce9ecd..447ad65 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -702,7 +702,14 @@ static inline struct audit_context *audit_get_context(struct task_struct *tsk,
 	if (likely(!context))
 		return NULL;
 	context->return_valid = return_valid;
-	context->return_code  = return_code;
+
+	if (unlikely((return_code == -ERESTART_RESTARTBLOCK) ||
+		     (return_code == -ERESTARTNOHAND) ||
+		     (return_code == -ERESTARTSYS) ||
+		     (return_code == -ERESTARTNOINTR)))
+		context->return_code = -EINTR;
+	else
+		context->return_code  = return_code;
 
 	if (context->in_syscall && !context->dummy && !context->auditable) {
 		enum audit_state state;

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

end of thread, other threads:[~2007-11-18 16:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-14 20:22 [PATCH] Audit: EINTR instead of kernel private return codes in audit records Eric Paris
2007-11-14 20:29 ` Paul Moore
2007-11-14 20:30 ` Steve Grubb
2007-11-14 21:07   ` Eric Paris
2007-11-14 21:17     ` Steve Grubb
2007-11-18  1:58       ` Eric Paris
2007-11-18 10:58         ` Steve Grubb
2007-11-18 16:52           ` Eric Paris
2007-11-14 21:13   ` Miloslav Trmac

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