Skip to contentSkip to conversation

Fixed reason field in audit signal logging

PATCH In review Paul Davies C 4 participants 12 messages Nov 7, 2013 Audit

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixed reason field in audit signal logging

The audit system logs the signals that leads to abnormal end of a process. However , as of now , it always states the reason for failure of a process as "memory violation" regardless of the signal delivered. This is due to the audit_core_dumps() function pass the reason for failure blindly to the audit_log_abend() as "memory violation".

This patch changes the audit_core_dumps() function as to pass on the right reason to the audit_log_abend based on the signal received.

Signed-off-by Paul Davies C
---
 kernel/auditsc.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
kernel/auditsc.c +30 -1
index 9845cb3..3cafd13 100644
@@ -2395,7 +2395,36 @@ void audit_core_dumps(long signr)
 	ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
 	if (unlikely(!ab))
 		return;
-	audit_log_abend(ab, "memory violation", signr);
+
+	/*Identify the reason for failure based on signal delivered.*/
+	switch (signr) {
+	case SIGABRT:
+			audit_log_abend(ab, "received abort", signr);
+			break;
+	case SIGBUS:
+			audit_log_abend(ab, "invalid pointer dereference", signr);
+			break;
+	case SIGFPE:
+			audit_log_abend(ab, "invalid floating point instruction", signr);
+			break;
+	case SIGILL:
+			audit_log_abend(ab, "illegal instruction", signr);
+			break;
+	case SIGSEGV:
+			audit_log_abend(ab, "memory violation", signr);
+			break;
+	case SIGTRAP:
+			audit_log_abend(ab, "bad instruction / debugger generated signal", signr);
+			break;
+	case SIGXCPU:
+			audit_log_abend(ab, "cpu time violation", signr);
+			break;
+	case SIGXFSZ:
+			audit_log_abend(ab, "file size violation", signr);
+			break;
+	default:
+			audit_log_abend(ab, "not defined", signr);
+	}
 	audit_log_end(ab);
 }
 
Signature · 1 line
1.7.9.5
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Paul Davies C

The audit system logs the signals that leads to abnormal end of a process. However , as of now , it always states the reason for failure of a process as "memory violation" regardless of the signal delivered. This is due to the audit_core_dumps() function pass the reason for failure blindly to the audit_log_abend() as "memory violation".

This patch changes the audit_core_dumps() function as to pass on the right reason to the audit_log_abend based on the signal received.

Signed-off-by Paul Davies C

But we really should wait for an Ack and thoughts from steve grubb....

Quoted 46 lines
---
 kernel/auditsc.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
kernel/auditsc.c +30 -1
index 9845cb3..3cafd13 100644
@@ -2395,7 +2395,36 @@ void audit_core_dumps(long signr)
 	ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
 	if (unlikely(!ab))
 		return;
-	audit_log_abend(ab, "memory violation", signr);
+
+	/*Identify the reason for failure based on signal delivered.*/
+	switch (signr) {
+	case SIGABRT:
+			audit_log_abend(ab, "received abort", signr);
+			break;
+	case SIGBUS:
+			audit_log_abend(ab, "invalid pointer dereference", signr);
+			break;
+	case SIGFPE:
+			audit_log_abend(ab, "invalid floating point instruction", signr);
+			break;
+	case SIGILL:
+			audit_log_abend(ab, "illegal instruction", signr);
+			break;
+	case SIGSEGV:
+			audit_log_abend(ab, "memory violation", signr);
+			break;
+	case SIGTRAP:
+			audit_log_abend(ab, "bad instruction / debugger generated signal", signr);
+			break;
+	case SIGXCPU:
+			audit_log_abend(ab, "cpu time violation", signr);
+			break;
+	case SIGXFSZ:
+			audit_log_abend(ab, "file size violation", signr);
+			break;
+	default:
+			audit_log_abend(ab, "not defined", signr);
+	}
 	audit_log_end(ab);
 }
 
#2 lore raw
Quoted 7 lines · Eric Paris
Quoted 6 lines · Paul Davies C

The audit system logs the signals that leads to abnormal end of a process. However , as of now , it always states the reason for failure of a process as "memory violation" regardless of the signal delivered. This is due to the audit_core_dumps() function pass the reason for failure blindly to the audit_log_abend() as "memory violation".

Quoted 8 lines
Quoted 4 lines

This patch changes the audit_core_dumps() function as to pass on the right reason to the audit_log_abend based on the signal received.

Signed-off-by Paul Davies C

But we really should wait for an Ack and thoughts from steve grubb....

FWIW I really like this fix. It will be valuable to me (once I get it in my RHEL-6.2 systems); thanks!

LCB

Signature · 2 lines
LC (Lenny) Bruzenak
[email protected]
#3 lore raw
In reply to Eric Paris
Quoted 7 lines · Eric Paris
Quoted 6 lines · Paul Davies C

The audit system logs the signals that leads to abnormal end of a process. However , as of now , it always states the reason for failure of a process as "memory violation" regardless of the signal delivered. This is due to the audit_core_dumps() function pass the reason for failure blindly to the audit_log_abend() as "memory violation".

Quoted 8 lines
Quoted 4 lines

This patch changes the audit_core_dumps() function as to pass on the right reason to the audit_log_abend based on the signal received.

Signed-off-by Paul Davies C

But we really should wait for an Ack and thoughts from steve grubb....

I am confused. This is the abnormal end event I have:

type=ANOM_ABEND msg=audit(1303339663.307:142): auid=4325 uid=0 gid=0 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0 pid=3775 comm="aureport" sig=11

Why / when did we start adding text explanations? We should not do that. We didn't have it before and it should not have been added. The signal number is enough to identify the problem.

If we did need a reason= field, all these strings with spaces will get separated on parsing. They should be like "memory-violation" or "recieved- abort". And would it be better to hide this in the audit_log_abend function? I honestly don't understand why this was added.

-Steve

Quoted 16 lines
Quoted 16 lines

---

 kernel/auditsc.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
kernel/auditsc.c +0 -0
index 9845cb3..3cafd13 100644
@@ -2395,7 +2395,36 @@ void audit_core_dumps(long signr)
 
 	ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
 	if (unlikely(!ab))
 
 		return;
 
Quoted 12 lines

kernel/auditsc.c void audit_core_dumps(long signr)

Quoted 12 lines
kernel/auditsc.c +11 -1
-	audit_log_abend(ab, "memory violation", signr);
+
+	/*Identify the reason for failure based on signal delivered.*/
+	switch (signr) {
+	case SIGABRT:
+			audit_log_abend(ab, "received abort", signr);
+			break;
+	case SIGBUS:
+			audit_log_abend(ab, "invalid pointer dereference", signr);
+			break;
+	case SIGFPE:
+			audit_log_abend(ab, "invalid floating point instruction", 

signr);

Quoted 9 lines

kernel/auditsc.c void audit_core_dumps(long signr)

Quoted 9 lines
kernel/auditsc.c +9 -0
+			break;
+	case SIGILL:
+			audit_log_abend(ab, "illegal instruction", signr);
+			break;
+	case SIGSEGV:
+			audit_log_abend(ab, "memory violation", signr);
+			break;
+	case SIGTRAP:
+			audit_log_abend(ab, "bad instruction / debugger generated 

signal",

Quoted 14 lines
Quoted 14 lines

signr); + break;

kernel/auditsc.c +9 -0
+	case SIGXCPU:
+			audit_log_abend(ab, "cpu time violation", signr);
+			break;
+	case SIGXFSZ:
+			audit_log_abend(ab, "file size violation", signr);
+			break;
+	default:
+			audit_log_abend(ab, "not defined", signr);
+	}
 
 	audit_log_end(ab);
 
 }
#4 lore raw
Quoted 10 lines · Steve Grubb

I am confused. This is the abnormal end event I have:

type=ANOM_ABEND msg=audit(1303339663.307:142): auid=4325 uid=0 gid=0 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0 pid=3775 comm="aureport" sig=11

Why / when did we start adding text explanations? We should not do that. We didn't have it before and it should not have been added. The signal number is enough to identify the problem.

Quoted 6 lines

If we did need a reason= field, all these strings with spaces will get separated on parsing. They should be like "memory-violation" or "recieved- abort". And would it be better to hide this in the audit_log_abend function? I honestly don't understand why this was added.

-Steve

Whoops; looks like I jumped the gun. I also have the same results:
node=test1 type=ANOM_ABEND msg=audit(1383674813.174:5025253):
auid=4294967295 uid=0 gid=0 ses=4294967295 subj=system_u:system_r:xserver_t:s0-s15:c0.c1023 pid=5537 comm="X" sig=6

It looked like it would add value at first read.

LCB

Signature · 2 lines
LC (Lenny) Bruzenak
[email protected]
maintainer
#5 lore raw
In reply to Steve Grubb
Quoted 17 lines · Steve Grubb
Quoted 7 lines · Eric Paris
Quoted 6 lines · Paul Davies C

The audit system logs the signals that leads to abnormal end of a process. However , as of now , it always states the reason for failure of a process as "memory violation" regardless of the signal delivered. This is due to the audit_core_dumps() function pass the reason for failure blindly to the audit_log_abend() as "memory violation".

Quoted 8 lines
Quoted 4 lines

This patch changes the audit_core_dumps() function as to pass on the right reason to the audit_log_abend based on the signal received.

Signed-off-by Paul Davies C

But we really should wait for an Ack and thoughts from steve grubb....

Quoted 8 lines

I am confused. This is the abnormal end event I have:

type=ANOM_ABEND msg=audit(1303339663.307:142): auid=4325 uid=0 gid=0 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0 pid=3775 comm="aureport" sig=11

Why / when did we start adding text explanations? We should not do that. We didn't have it before and it should not have been added. The signal number is enough to identify the problem.

We started adding a reason when seccomp started sending ANOM_ABEND events as well. It doesn't do so with a signal. Agreed, the " " is/was a bad idea...

Quoted 63 lines

If we did need a reason= field, all these strings with spaces will get separated on parsing. They should be like "memory-violation" or "recieved- abort". And would it be better to hide this in the audit_log_abend function? I honestly don't understand why this was added.

-Steve

Quoted 16 lines
Quoted 16 lines

---

 kernel/auditsc.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
kernel/auditsc.c +0 -0
index 9845cb3..3cafd13 100644
@@ -2395,7 +2395,36 @@ void audit_core_dumps(long signr)
 
 	ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
 	if (unlikely(!ab))
 
 		return;
 
Quoted 12 lines

kernel/auditsc.c void audit_core_dumps(long signr)

Quoted 12 lines
kernel/auditsc.c +11 -1
-	audit_log_abend(ab, "memory violation", signr);
+
+	/*Identify the reason for failure based on signal delivered.*/
+	switch (signr) {
+	case SIGABRT:
+			audit_log_abend(ab, "received abort", signr);
+			break;
+	case SIGBUS:
+			audit_log_abend(ab, "invalid pointer dereference", signr);
+			break;
+	case SIGFPE:
+			audit_log_abend(ab, "invalid floating point instruction", 

signr);

Quoted 9 lines

kernel/auditsc.c void audit_core_dumps(long signr)

Quoted 9 lines
kernel/auditsc.c +9 -0
+			break;
+	case SIGILL:
+			audit_log_abend(ab, "illegal instruction", signr);
+			break;
+	case SIGSEGV:
+			audit_log_abend(ab, "memory violation", signr);
+			break;
+	case SIGTRAP:
+			audit_log_abend(ab, "bad instruction / debugger generated 

signal",

Quoted 14 lines
Quoted 14 lines

signr); + break;

kernel/auditsc.c +9 -0
+	case SIGXCPU:
+			audit_log_abend(ab, "cpu time violation", signr);
+			break;
+	case SIGXFSZ:
+			audit_log_abend(ab, "file size violation", signr);
+			break;
+	default:
+			audit_log_abend(ab, "not defined", signr);
+	}
 
 	audit_log_end(ab);
 
 }
#6 lore raw

So rather than logging the "reason=memory violation" when process ends abnormally due to any signal delivery , it will be be better if we leave
"reason=undefined" .

Your thoughts?

Quoted 111 lines · Eric Paris
Quoted 3 lines · Steve Grubb
Quoted 2 lines · Eric Paris
Quoted 1 line · Paul Davies C

The audit system logs the signals that leads to abnormal end of a

process.

Quoted 1 line
Quoted 1 line
Quoted 1 line

However , as of now , it always states the reason for failure of a

process

Quoted 1 line
Quoted 1 line
Quoted 1 line

as "memory violation" regardless of the signal delivered. This is

due to

Quoted 1 line
Quoted 1 line
Quoted 1 line

the audit_core_dumps() function pass the reason for failure blindly

to

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

the audit_log_abend() as "memory violation".

This patch changes the audit_core_dumps() function as to pass on the

right

Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

reason to the audit_log_abend based on the signal received.

Signed-off-by Paul Davies C

But we really should wait for an Ack and thoughts from steve grubb....

I am confused. This is the abnormal end event I have:

type=ANOM_ABEND msg=audit(1303339663.307:142): auid=4325 uid=0 gid=0

ses=1

Quoted 1 line

subj=unconfined_u:unconfined_r:unconfined_t:s0 pid=3775 comm="aureport"

sig=11

Quoted 2 lines

Why / when did we start adding text explanations? We should not do that.

We

Quoted 1 line

didn't have it before and it should not have been added. The signal

number is

Quoted 1 line

enough to identify the problem.

We started adding a reason when seccomp started sending ANOM_ABEND events as well. It doesn't do so with a signal. Agreed, the " " is/was a bad idea...

Quoted 3 lines

If we did need a reason= field, all these strings with spaces will get separated on parsing. They should be like "memory-violation" or

"recieved-

Quoted 1 line

abort". And would it be better to hide this in the audit_log_abend

function? I

Quoted 21 lines

honestly don't understand why this was added.

-Steve

Quoted 16 lines
Quoted 16 lines

---

 kernel/auditsc.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
kernel/auditsc.c +0 -0
index 9845cb3..3cafd13 100644
@@ -2395,7 +2395,36 @@ void audit_core_dumps(long signr)
 
  ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
  if (unlikely(!ab))
 
          return;
 
Quoted 9 lines
Quoted 9 lines

kernel/auditsc.c void audit_core_dumps(long signr)

Quoted 9 lines
kernel/auditsc.c +8 -1
- audit_log_abend(ab, "memory violation", signr);
+
+ /*Identify the reason for failure based on signal delivered.*/
+ switch (signr) {
+ case SIGABRT:
+                 audit_log_abend(ab, "received abort", signr);
+                 break;
+ case SIGBUS:
+                 audit_log_abend(ab, "invalid pointer dereference",

signr);

Quoted 3 lines
Quoted 3 lines

kernel/auditsc.c void audit_core_dumps(long signr)

Quoted 3 lines
kernel/auditsc.c +3 -0
+                 break;
+ case SIGFPE:
+                 audit_log_abend(ab, "invalid floating point

instruction",

Quoted 10 lines

signr);

Quoted 9 lines
Quoted 9 lines
kernel/auditsc.c +9 -0
+                 break;
+ case SIGILL:
+                 audit_log_abend(ab, "illegal instruction", signr);
+                 break;
+ case SIGSEGV:
+                 audit_log_abend(ab, "memory violation", signr);
+                 break;
+ case SIGTRAP:
+                 audit_log_abend(ab, "bad instruction / debugger

generated

Quoted 16 lines

signal",

Quoted 14 lines
Quoted 14 lines

signr); + break;
+ case SIGXCPU:

kernel/auditsc.c +8 -0
+                 audit_log_abend(ab, "cpu time violation", signr);
+                 break;
+ case SIGXFSZ:
+                 audit_log_abend(ab, "file size violation", signr);
+                 break;
+ default:
+                 audit_log_abend(ab, "not defined", signr);
+ }
 
  audit_log_end(ab);
 
 }
Signature · 3 lines
*Regards,*
*Paul Davies C*
vivafoss.blogspot.com
maintainer
#7 lore raw
Quoted 3 lines · Paul Davies C

So rather than logging the "reason=memory violation" when process ends abnormally due to any signal delivery , it will be be better if we leave "reason=undefined" .

reason=memory_violation or invalid_pointer etc

although maybe it should be just 'signal'... and you can get the signal number from the record....

Quoted 137 lines

Your thoughts?

On Thu, Nov 7, 2013 at 9:12 PM, Eric Paris <[email protected]> wrote:

        On Thu, 2013-11-07 at 10:05 -0500, Steve Grubb wrote:
        > On Thursday, November 07, 2013 09:43:24 AM Eric Paris wrote:
        > > On Thu, 2013-11-07 at 19:09 +0530, Paul Davies C wrote:
        > > > The audit system logs the signals that leads to abnormal
        end of a process.
        > > > However , as of now , it always states the reason for
        failure of a process
        > > > as "memory violation" regardless of the signal
        delivered. This is due to
        > > > the audit_core_dumps() function pass the reason for
        failure blindly to
        > > > the audit_log_abend() as "memory violation".
        > > >
        > > > This patch changes the audit_core_dumps() function as to
        pass on the right
        > > > reason to the audit_log_abend based on the signal
        received.
        > > >
        > > > Signed-off-by:Paul Davies C
        > >
        > > Acked-by: Eric Paris <[email protected]>
        > >
        > > But we really should wait for an Ack and thoughts from
        steve grubb....
        >
        > I am confused. This is the abnormal end event I have:
        >
        > type=ANOM_ABEND msg=audit(1303339663.307:142): auid=4325
        uid=0 gid=0 ses=1
        > subj=unconfined_u:unconfined_r:unconfined_t:s0 pid=3775
        comm="aureport" sig=11
        >
        > Why / when did we start adding text explanations? We should
        not do that. We
        > didn't have it before and it should not have been added. The
        signal number is
        > enough to identify the problem.
        
        
        We started adding a reason when seccomp started sending
        ANOM_ABEND
        events as well.  It doesn't do so with a signal.  Agreed, the
        " " is/was
        a bad idea...
        
        >
        > If we did need a reason= field, all these strings with
        spaces will get
        > separated on parsing. They should be like "memory-violation"
        or "recieved-
        > abort". And would it be better to hide this in the
        audit_log_abend function? I
        > honestly don't understand why this was added.
        >
        > -Steve
        >
        >
        > > > ---
        > > >
        > > >  kernel/auditsc.c |   31 ++++++++++++++++++++++++++++++-
        > > >  1 file changed, 30 insertions(+), 1 deletion(-)
        > > >
        > > > diff --git a/kernel/auditsc.c b/kernel/auditsc.c
        > > > index 9845cb3..3cafd13 100644
        > > > --- a/kernel/auditsc.c
        > > > +++ b/kernel/auditsc.c
        > > > @@ -2395,7 +2395,36 @@ void audit_core_dumps(long signr)
        > > >
        > > >   ab = audit_log_start(NULL, GFP_KERNEL,
        AUDIT_ANOM_ABEND);
        > > >   if (unlikely(!ab))
        > > >
        > > >           return;
        > > >
        > > > - audit_log_abend(ab, "memory violation", signr);
        > > > +
        > > > + /*Identify the reason for failure based on signal
        delivered.*/
        > > > + switch (signr) {
        > > > + case SIGABRT:
        > > > +                 audit_log_abend(ab, "received abort",
        signr);
        > > > +                 break;
        > > > + case SIGBUS:
        > > > +                 audit_log_abend(ab, "invalid pointer
        dereference", signr);
        > > > +                 break;
        > > > + case SIGFPE:
        > > > +                 audit_log_abend(ab, "invalid floating
        point instruction",
        > signr);
        > > > +                 break;
        > > > + case SIGILL:
        > > > +                 audit_log_abend(ab, "illegal
        instruction", signr);
        > > > +                 break;
        > > > + case SIGSEGV:
        > > > +                 audit_log_abend(ab, "memory
        violation", signr);
        > > > +                 break;
        > > > + case SIGTRAP:
        > > > +                 audit_log_abend(ab, "bad instruction /
        debugger generated
        > signal",
        > > > signr); +                 break;
        > > > + case SIGXCPU:
        > > > +                 audit_log_abend(ab, "cpu time
        violation", signr);
        > > > +                 break;
        > > > + case SIGXFSZ:
        > > > +                 audit_log_abend(ab, "file size
        violation", signr);
        > > > +                 break;
        > > > + default:
        > > > +                 audit_log_abend(ab, "not defined",
        signr);
        > > > + }
        > > >
        > > >   audit_log_end(ab);
        > > >
        > > >  }
        >
Signature · 3 lines
Regards,
Paul Davies C
vivafoss.blogspot.com
#8 lore raw

So we must drop the "reason" field for abnormal end due to signal delivery.

Quoted 150 lines · Eric Paris
Quoted 3 lines · Paul Davies C

So rather than logging the "reason=memory violation" when process ends abnormally due to any signal delivery , it will be be better if we leave "reason=undefined" .

reason=memory_violation or invalid_pointer etc

although maybe it should be just 'signal'... and you can get the signal number from the record....

Quoted 137 lines

Your thoughts?

On Thu, Nov 7, 2013 at 9:12 PM, Eric Paris <[email protected]> wrote:

        On Thu, 2013-11-07 at 10:05 -0500, Steve Grubb wrote:
        > On Thursday, November 07, 2013 09:43:24 AM Eric Paris wrote:
        > > On Thu, 2013-11-07 at 19:09 +0530, Paul Davies C wrote:
        > > > The audit system logs the signals that leads to abnormal
        end of a process.
        > > > However , as of now , it always states the reason for
        failure of a process
        > > > as "memory violation" regardless of the signal
        delivered. This is due to
        > > > the audit_core_dumps() function pass the reason for
        failure blindly to
        > > > the audit_log_abend() as "memory violation".
        > > >
        > > > This patch changes the audit_core_dumps() function as to
        pass on the right
        > > > reason to the audit_log_abend based on the signal
        received.
        > > >
        > > > Signed-off-by:Paul Davies C
        > >
        > > Acked-by: Eric Paris <[email protected]>
        > >
        > > But we really should wait for an Ack and thoughts from
        steve grubb....
        >
        > I am confused. This is the abnormal end event I have:
        >
        > type=ANOM_ABEND msg=audit(1303339663.307:142): auid=4325
        uid=0 gid=0 ses=1
        > subj=unconfined_u:unconfined_r:unconfined_t:s0 pid=3775
        comm="aureport" sig=11
        >
        > Why / when did we start adding text explanations? We should
        not do that. We
        > didn't have it before and it should not have been added. The
        signal number is
        > enough to identify the problem.


        We started adding a reason when seccomp started sending
        ANOM_ABEND
        events as well.  It doesn't do so with a signal.  Agreed, the
        " " is/was
        a bad idea...

        >
        > If we did need a reason= field, all these strings with
        spaces will get
        > separated on parsing. They should be like "memory-violation"
        or "recieved-
        > abort". And would it be better to hide this in the
        audit_log_abend function? I
        > honestly don't understand why this was added.
        >
        > -Steve
        >
        >
        > > > ---
        > > >
        > > >  kernel/auditsc.c |   31 ++++++++++++++++++++++++++++++-
        > > >  1 file changed, 30 insertions(+), 1 deletion(-)
        > > >
        > > > diff --git a/kernel/auditsc.c b/kernel/auditsc.c
        > > > index 9845cb3..3cafd13 100644
        > > > --- a/kernel/auditsc.c
        > > > +++ b/kernel/auditsc.c
        > > > @@ -2395,7 +2395,36 @@ void audit_core_dumps(long signr)
        > > >
        > > >   ab = audit_log_start(NULL, GFP_KERNEL,
        AUDIT_ANOM_ABEND);
        > > >   if (unlikely(!ab))
        > > >
        > > >           return;
        > > >
        > > > - audit_log_abend(ab, "memory violation", signr);
        > > > +
        > > > + /*Identify the reason for failure based on signal
        delivered.*/
        > > > + switch (signr) {
        > > > + case SIGABRT:
        > > > +                 audit_log_abend(ab, "received abort",
        signr);
        > > > +                 break;
        > > > + case SIGBUS:
        > > > +                 audit_log_abend(ab, "invalid pointer
        dereference", signr);
        > > > +                 break;
        > > > + case SIGFPE:
        > > > +                 audit_log_abend(ab, "invalid floating
        point instruction",
        > signr);
        > > > +                 break;
        > > > + case SIGILL:
        > > > +                 audit_log_abend(ab, "illegal
        instruction", signr);
        > > > +                 break;
        > > > + case SIGSEGV:
        > > > +                 audit_log_abend(ab, "memory
        violation", signr);
        > > > +                 break;
        > > > + case SIGTRAP:
        > > > +                 audit_log_abend(ab, "bad instruction /
        debugger generated
        > signal",
        > > > signr); +                 break;
        > > > + case SIGXCPU:
        > > > +                 audit_log_abend(ab, "cpu time
        violation", signr);
        > > > +                 break;
        > > > + case SIGXFSZ:
        > > > +                 audit_log_abend(ab, "file size
        violation", signr);
        > > > +                 break;
        > > > + default:
        > > > +                 audit_log_abend(ab, "not defined",
        signr);
        > > > + }
        > > >
        > > >   audit_log_end(ab);
        > > >
        > > >  }
        >

--
Regards,
Paul Davies C
vivafoss.blogspot.com

Signature · 3 lines
*Regards,*
*Paul Davies C*
vivafoss.blogspot.com
maintainer
#9 lore raw

I don't suggest dropping the reason field entirely. I thought your patch to add signal information in the reason field was a good idea, but steve pointed out, the signal information is in the sig= field. So now I do not believe we need such fine grained 'reasons'

That brought me to the question is "memory violation" the right reason
when really it was a 'signal' which caused such a record... Maybe a
patch which just did s/memory violation/signal/ would be a good idea...

Quoted 199 lines · Paul Davies C

So we must drop the "reason" field for abnormal end due to signal delivery.

On Thu, Nov 7, 2013 at 9:23 PM, Eric Paris <[email protected]> wrote:
On Thu, 2013-11-07 at 21:21 +0530, Paul Davies C wrote:
> So rather than logging the "reason=memory violation" when process ends
> abnormally due to any signal delivery , it will be be better if we
> leave "reason=undefined" .

reason=memory_violation or invalid_pointer etc

although maybe it should be just 'signal'... and you can get the signal
number from the record....

> Your thoughts?
>
>
> On Thu, Nov 7, 2013 at 9:12 PM, Eric Paris <[email protected]> wrote:
> On Thu, 2013-11-07 at 10:05 -0500, Steve Grubb
wrote:
> > On Thursday, November 07, 2013 09:43:24 AM Eric
Paris wrote:
> > > On Thu, 2013-11-07 at 19:09 +0530, Paul Davies C
wrote:
> > > > The audit system logs the signals that leads
to abnormal
> end of a process.
> > > > However , as of now , it always states the
reason for
> failure of a process
> > > > as "memory violation" regardless of the signal
> delivered. This is due to
> > > > the audit_core_dumps() function pass the
reason for
> failure blindly to
> > > > the audit_log_abend() as "memory violation".
> > > >
> > > > This patch changes the audit_core_dumps()
function as to
> pass on the right
> > > > reason to the audit_log_abend based on the
signal
> received.
> > > >
> > > > Signed-off-by:Paul Davies C
> > >
> > > Acked-by: Eric Paris <[email protected]>
> > >
> > > But we really should wait for an Ack and
thoughts from
> steve grubb....
> >
> > I am confused. This is the abnormal end event I
have:
> >
> > type=ANOM_ABEND msg=audit(1303339663.307:142):
auid=4325
> uid=0 gid=0 ses=1
> > subj=unconfined_u:unconfined_r:unconfined_t:s0
pid=3775
> comm="aureport" sig=11
> >
> > Why / when did we start adding text explanations?
We should
> not do that. We
> > didn't have it before and it should not have been
added. The
> signal number is
> > enough to identify the problem.
>
>
> We started adding a reason when seccomp started
sending
> ANOM_ABEND
> events as well. It doesn't do so with a signal.
Agreed, the
> " " is/was
> a bad idea...
>
> >
> > If we did need a reason= field, all these strings
with
> spaces will get
> > separated on parsing. They should be like
"memory-violation"
> or "recieved-
> > abort". And would it be better to hide this in the
> audit_log_abend function? I
> > honestly don't understand why this was added.
> >
> > -Steve
> >
> >
> > > > ---
> > > >
> > > > kernel/auditsc.c | 31
++++++++++++++++++++++++++++++-
> > > > 1 file changed, 30 insertions(+), 1
deletion(-)
> > > >
> > > > diff --git a/kernel/auditsc.c
b/kernel/auditsc.c
> > > > index 9845cb3..3cafd13 100644
> > > > --- a/kernel/auditsc.c
> > > > +++ b/kernel/auditsc.c
> > > > @@ -2395,7 +2395,36 @@ void
audit_core_dumps(long signr)
> > > >
> > > > ab = audit_log_start(NULL, GFP_KERNEL,
> AUDIT_ANOM_ABEND);
> > > > if (unlikely(!ab))
> > > >
> > > > return;
> > > >
> > > > - audit_log_abend(ab, "memory violation",
signr);
> > > > +
> > > > + /*Identify the reason for failure based on
signal
> delivered.*/
> > > > + switch (signr) {
> > > > + case SIGABRT:
> > > > + audit_log_abend(ab,
"received abort",
> signr);
> > > > + break;
> > > > + case SIGBUS:
> > > > + audit_log_abend(ab, "invalid
pointer
> dereference", signr);
> > > > + break;
> > > > + case SIGFPE:
> > > > + audit_log_abend(ab, "invalid
floating
> point instruction",
> > signr);
> > > > + break;
> > > > + case SIGILL:
> > > > + audit_log_abend(ab, "illegal
> instruction", signr);
> > > > + break;
> > > > + case SIGSEGV:
> > > > + audit_log_abend(ab, "memory
> violation", signr);
> > > > + break;
> > > > + case SIGTRAP:
> > > > + audit_log_abend(ab, "bad
instruction /
> debugger generated
> > signal",
> > > > signr); + break;
> > > > + case SIGXCPU:
> > > > + audit_log_abend(ab, "cpu
time
> violation", signr);
> > > > + break;
> > > > + case SIGXFSZ:
> > > > + audit_log_abend(ab, "file
size
> violation", signr);
> > > > + break;
> > > > + default:
> > > > + audit_log_abend(ab, "not
defined",
> signr);
> > > > + }
> > > >
> > > > audit_log_end(ab);
> > > >
> > > > }
> >
>
>
>
>
>
>
>
> --
> Regards,
> Paul Davies C
> vivafoss.blogspot.com

Signature · 3 lines
Regards,
Paul Davies C
vivafoss.blogspot.com
#10 lore raw
In reply to Eric Paris
Quoted 9 lines · Eric Paris
Quoted 9 lines

I am confused. This is the abnormal end event I have:

type=ANOM_ABEND msg=audit(1303339663.307:142): auid=4325 uid=0 gid=0 ses=1
subj=unconfined_u:unconfined_r:unconfined_t:s0 pid=3775 comm="aureport" sig=11>

Quoted 7 lines
Quoted 3 lines

Why / when did we start adding text explanations? We should not do that. We didn't have it before and it should not have been added. The signal number is enough to identify the problem.

We started adding a reason when seccomp started sending ANOM_ABEND events as well. It doesn't do so with a signal. Agreed, the " " is/was a bad idea...

Does seccomp still send these? I see there is an AUDIT_SECCOMP event being sent by __audit_seccomp(). Does seccomp do anything with ABEND at this point?

-Steve

#11 lore raw
Quoted 14 lines · Steve Grubb
Quoted 13 lines · Eric Paris
Quoted 12 lines

I am confused. This is the abnormal end event I have:

type=ANOM_ABEND msg=audit(1303339663.307:142): auid=4325 uid=0 gid=0 ses=1
subj=unconfined_u:unconfined_r:unconfined_t:s0 pid=3775 comm="aureport" sig=11>

Why / when did we start adding text explanations? We should not do that. We didn't have it before and it should not have been added. The signal number is enough to identify the problem.

Quoted 7 lines
Quoted 3 lines

We started adding a reason when seccomp started sending ANOM_ABEND events as well. It doesn't do so with a signal. Agreed, the " " is/was a bad idea...

Does seccomp still send these? I see there is an AUDIT_SECCOMP event being sent by __audit_seccomp(). Does seccomp do anything with ABEND at this point?

As far as I can see via grepping around, seccomp does not call audit_log_abend(). As a matter of fact, only audit_core_dumps() does. meaning there is no reason for audit_log_abend anymore. Its code can be pushed back into audit_core_dumps() and the reason= can be removed entirely.

-Steve