]> git.baikalelectronics.ru Git - kernel.git/commit
selinux: add basic filtering for audit trace events
authorPeter Enderborg <peter.enderborg@sony.com>
Fri, 21 Aug 2020 14:08:22 +0000 (16:08 +0200)
committerPaul Moore <paul@paul-moore.com>
Fri, 21 Aug 2020 21:07:29 +0000 (17:07 -0400)
commit42d18133a20f20ef3704b00ee53710a1d0c4f257
tree3dbfb349a001a347a91b52e0fe4c2f9b287d4de1
parent218f0ab4253781b4937e961517448096fc1d8110
selinux: add basic filtering for audit trace events

This patch adds further attributes to the event. These attributes are
helpful to understand the context of the message and can be used
to filter the events.

There are three common items. Source context, target context and tclass.
There are also items from the outcome of operation performed.

An event is similar to:
           <...>-1309  [002] ....  6346.691689: selinux_audited:
       requested=0x4000000 denied=0x4000000 audited=0x4000000
       result=-13
       scontext=system_u:system_r:cupsd_t:s0-s0:c0.c1023
       tcontext=system_u:object_r:bin_t:s0 tclass=file

With systems where many denials are occurring, it is useful to apply a
filter. The filtering is a set of logic that is inserted with
the filter file. Example:
 echo "tclass==\"file\" " > events/avc/selinux_audited/filter

This adds that we only get tclass=file.

The trace can also have extra properties. Adding the user stack
can be done with
   echo 1 > options/userstacktrace

Now the output will be
         runcon-1365  [003] ....  6960.955530: selinux_audited:
     requested=0x4000000 denied=0x4000000 audited=0x4000000
     result=-13
     scontext=system_u:system_r:cupsd_t:s0-s0:c0.c1023
     tcontext=system_u:object_r:bin_t:s0 tclass=file
          runcon-1365  [003] ....  6960.955560: <user stack trace>
 =>  <00007f325b4ce45b>
 =>  <00005607093efa57>

Signed-off-by: Peter Enderborg <peter.enderborg@sony.com>
Reviewed-by: ThiƩbaud Weksteen <tweek@google.com>
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
include/trace/events/avc.h
security/selinux/avc.c