An error occurred fetching the project authors.
  1. 03 Jul, 2018 1 commit
  2. 19 Jun, 2018 2 commits
  3. 14 May, 2018 1 commit
  4. 20 Apr, 2018 1 commit
  5. 27 Mar, 2018 1 commit
  6. 26 Mar, 2018 1 commit
  7. 21 Mar, 2018 1 commit
  8. 09 Mar, 2018 2 commits
  9. 06 Mar, 2018 1 commit
    • Greg Edwards's avatar
      audit: do not panic on invalid boot parameter · 11dd2666
      Greg Edwards authored
      If you pass in an invalid audit boot parameter value, e.g. "audit=off",
      the kernel panics very early in boot before the regular console is
      initialized.  Unless you have earlyprintk enabled, there is no
      indication of what the problem is on the console.
      
      Convert the panic() calls to pr_err(), and leave auditing enabled if an
      invalid parameter value was passed in.
      
      Modify the parameter to also accept "on" or "off" as valid values, and
      update the documentation accordingly.
      Signed-off-by: default avatarGreg Edwards <gedwards@ddn.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      11dd2666
  10. 23 Feb, 2018 1 commit
  11. 21 Feb, 2018 1 commit
  12. 14 Feb, 2018 1 commit
  13. 13 Feb, 2018 1 commit
  14. 10 Nov, 2017 7 commits
  15. 05 Sep, 2017 2 commits
    • Geliang Tang's avatar
      audit: update the function comments · 196a5085
      Geliang Tang authored
      Update the function comments to match the code.
      Signed-off-by: default avatarGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      196a5085
    • Mel Gorman's avatar
      audit: Reduce overhead using a coarse clock · e832bf48
      Mel Gorman authored
      Commit 2115bb25 ("audit: Use timespec64 to represent audit timestamps")
      noted that audit timestamps were not y2038 safe and used a 64-bit
      timestamp. In itself, this makes sense but the conversion was from
      CURRENT_TIME to ktime_get_real_ts64() which is a heavier call to record
      an accurate timestamp which is required in some, but not all, cases. The
      impact is that when auditd is running without any rules that all syscalls
      have higher overhead. This is visible in the sysbench-thread benchmark as
      a 11.5% performance hit. That benchmark is dumb as rocks but it's also
      visible in redis as an 8-10% hit on all operations which is of greater
      concern. It is somewhat stupid of audit to track syscalls without any
      rules related to syscalls but that is how it behaves.
      
      The overhead can be directly measured with perf comparing 4.9 with 4.12
      
      4.9
           7.76%  sysbench         [kernel.vmlinux]    [k] __schedule
           7.62%  sysbench         [kernel.vmlinux]    [k] _raw_spin_lock
           7.37%  sysbench         libpthread-2.22.so  [.] __lll_lock_elision
           7.29%  sysbench         [kernel.vmlinux]    [.] syscall_return_via_sysret
           6.59%  sysbench         [kernel.vmlinux]    [k] native_sched_clock
           5.21%  sysbench         libc-2.22.so        [.] __sched_yield
           4.38%  sysbench         [kernel.vmlinux]    [k] entry_SYSCALL_64
           4.28%  sysbench         [kernel.vmlinux]    [k] do_syscall_64
           3.49%  sysbench         libpthread-2.22.so  [.] __lll_unlock_elision
           3.13%  sysbench         [kernel.vmlinux]    [k] __audit_syscall_exit
           2.87%  sysbench         [kernel.vmlinux]    [k] update_curr
           2.73%  sysbench         [kernel.vmlinux]    [k] pick_next_task_fair
           2.31%  sysbench         [kernel.vmlinux]    [k] syscall_trace_enter
           2.20%  sysbench         [kernel.vmlinux]    [k] __audit_syscall_entry
      .....
           0.00%  swapper          [kernel.vmlinux]    [k] read_tsc
      
      4.12
           7.84%  sysbench         [kernel.vmlinux]    [k] __schedule
           7.05%  sysbench         [kernel.vmlinux]    [k] _raw_spin_lock
           6.57%  sysbench         libpthread-2.22.so  [.] __lll_lock_elision
           6.50%  sysbench         [kernel.vmlinux]    [.] syscall_return_via_sysret
           5.95%  sysbench         [kernel.vmlinux]    [k] read_tsc
           5.71%  sysbench         [kernel.vmlinux]    [k] native_sched_clock
           4.78%  sysbench         libc-2.22.so        [.] __sched_yield
           4.30%  sysbench         [kernel.vmlinux]    [k] entry_SYSCALL_64
           3.94%  sysbench         [kernel.vmlinux]    [k] do_syscall_64
           3.37%  sysbench         libpthread-2.22.so  [.] __lll_unlock_elision
           3.32%  sysbench         [kernel.vmlinux]    [k] __audit_syscall_exit
           2.91%  sysbench         [kernel.vmlinux]    [k] __getnstimeofday64
      
      Note the additional overhead from read_tsc which goes from 0% to 5.95%.
      This is on a single-socket E3-1230 but similar overheads have been measured
      on an older machine which the patch also eliminates.
      
      The patch in question has no explanation as to why a fully-accurate timestamp
      is required and is likely an oversight.  Using a coarser, but monotically
      increasing, timestamp the overhead can be eliminated.  While it can be
      worked around by configuring or disabling audit, it's tricky enough to
      detect that a kernel fix is justified. With this patch, we see the following;
      
      sysbenchthread
                                    4.9.0                 4.12.0                 4.12.0
                                  vanilla                vanilla            coarse-v1r1
      Amean     1         1.49 (   0.00%)        1.66 ( -11.42%)        1.51 (  -1.34%)
      Amean     3         1.48 (   0.00%)        1.65 ( -11.45%)        1.50 (  -0.96%)
      Amean     5         1.49 (   0.00%)        1.67 ( -12.31%)        1.51 (  -1.83%)
      Amean     7         1.49 (   0.00%)        1.66 ( -11.72%)        1.50 (  -0.67%)
      Amean     12        1.48 (   0.00%)        1.65 ( -11.57%)        1.52 (  -2.89%)
      Amean     16        1.49 (   0.00%)        1.65 ( -11.13%)        1.51 (  -1.73%)
      
      The benchmark is reporting the time required for different thread counts to
      lock/unlock a private mutex which, while dense, demonstrates the syscall
      overhead. This is showing that 4.12 took a 11-12% hit but the overhead is
      almost eliminated by the patch. While the variance is not reported here,
      it's well within the noise with the patch applied.
      Signed-off-by: default avatarMel Gorman <mgorman@techsingularity.net>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      e832bf48
  16. 19 Jul, 2017 1 commit
    • Shu Wang's avatar
      audit: fix memleak in auditd_send_unicast_skb. · b0659ae5
      Shu Wang authored
      Found this issue by kmemleak report, auditd_send_unicast_skb
      did not free skb if rcu_dereference(auditd_conn) returns null.
      
      unreferenced object 0xffff88082568ce00 (size 256):
      comm "auditd", pid 1119, jiffies 4294708499
      backtrace:
      [<ffffffff8176166a>] kmemleak_alloc+0x4a/0xa0
      [<ffffffff8121820c>] kmem_cache_alloc_node+0xcc/0x210
      [<ffffffff8161b99d>] __alloc_skb+0x5d/0x290
      [<ffffffff8113c614>] audit_make_reply+0x54/0xd0
      [<ffffffff8113dfa7>] audit_receive_msg+0x967/0xd70
      ----------------
      (gdb) list *audit_receive_msg+0x967
      0xffffffff8113dff7 is in audit_receive_msg (kernel/audit.c:1133).
      1132    skb = audit_make_reply(0, AUDIT_REPLACE, 0,
                                      0, &pvnr, sizeof(pvnr));
      ---------------
      [<ffffffff8113e402>] audit_receive+0x52/0xa0
      [<ffffffff8166c561>] netlink_unicast+0x181/0x240
      [<ffffffff8166c8e2>] netlink_sendmsg+0x2c2/0x3b0
      [<ffffffff816112e8>] sock_sendmsg+0x38/0x50
      [<ffffffff816117a2>] SYSC_sendto+0x102/0x190
      [<ffffffff81612f4e>] SyS_sendto+0xe/0x10
      [<ffffffff8176d337>] entry_SYSCALL_64_fastpath+0x1a/0xa5
      [<ffffffffffffffff>] 0xffffffffffffffff
      Signed-off-by: default avatarShu Wang <shuwang@redhat.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      b0659ae5
  17. 16 Jun, 2017 1 commit
  18. 13 Jun, 2017 1 commit
    • Paul Moore's avatar
      audit: fix a race condition with the auditd tracking code · c81be52a
      Paul Moore authored
      Originally reported by Adam and Dusty, it appears we have a small
      race window in kauditd_thread(), as documented in the Fedora BZ:
      
       * https://bugzilla.redhat.com/show_bug.cgi?id=1459326#c35
      
       "This issue is partly due to the read-copy nature of RCU, and
        partly due to how we sync the auditd_connection state across
        kauditd_thread and the audit control channel.  The kauditd_thread
        thread is always running so it can service the record queues and
        emit the multicast messages, if it happens to be just past the
        "main_queue" label, but before the "if (sk == NULL || ...)"
        if-statement which calls auditd_reset() when the new auditd
        connection is registered it could end up resetting the auditd
        connection, regardless of if it is valid or not.  This is a rather
        small window and the variable nature of multi-core scheduling
        explains why this is proving rather difficult to reproduce."
      
      The fix is to have functions only call auditd_reset() when they
      believe that the kernel/auditd connection is still valid, e.g.
      non-NULL, and to have these callers pass their local copy of the
      auditd_connection pointer to auditd_reset() where it can be compared
      with the current connection state before resetting.  If the caller
      has a stale state tracking pointer then the reset is ignored.
      
      We also make a small change to kauditd_thread() so that if the
      kernel/auditd connection is dead we skip the retry queue and send the
      records straight to the hold queue.  This is necessary as we used to
      rely on auditd_reset() to occasionally purge the retry queue but we
      are going to be calling the reset function much less now and we want
      to make sure the retry queue doesn't grow unbounded.
      Reported-by: default avatarAdam Williamson <awilliam@redhat.com>
      Reported-by: default avatarDusty Mabe <dustymabe@redhat.com>
      Reviewed-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      c81be52a
  19. 23 May, 2017 1 commit
    • Richard Guy Briggs's avatar
      audit: unswing cap_* fields in PATH records · 4b3e4ed6
      Richard Guy Briggs authored
      The cap_* fields swing in and out of PATH records.
      If no capabilities are set, the cap_* fields are completely missing and when
      one of the cap_fi or cap_fp values is empty, that field is omitted.
      
      Original:
      type=PATH msg=audit(04/20/2017 12:17:11.222:193) : item=1 name=/lib64/ld-linux-x86-64.so.2 inode=787694 dev=08:03 mode=file,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:ld_so_t:s0 nametype=NORMAL
      type=PATH msg=audit(04/20/2017 12:17:11.222:193) : item=0 name=/home/sleep inode=1319469 dev=08:03 mode=file,suid,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:bin_t:s0 nametype=NORMAL cap_fp=sys_admin cap_fe=1 cap_fver=2
      
      Normalize the PATH record by always printing all 4 cap_* fields.
      
      Fixed:
      type=PATH msg=audit(04/20/2017 13:01:31.679:201) : item=1 name=/lib64/ld-linux-x86-64.so.2 inode=787694 dev=08:03 mode=file,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:ld_so_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0
      type=PATH msg=audit(04/20/2017 13:01:31.679:201) : item=0 name=/home/sleep inode=1319469 dev=08:03 mode=file,suid,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:bin_t:s0 nametype=NORMAL cap_fp=sys_admin cap_fi=none cap_fe=1 cap_fver=2
      
      See: https://github.com/linux-audit/audit-kernel/issues/42Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      4b3e4ed6
  20. 02 May, 2017 6 commits
  21. 13 Apr, 2017 1 commit
  22. 10 Apr, 2017 1 commit
    • Paul Moore's avatar
      audit: make sure we don't let the retry queue grow without bounds · 264d5096
      Paul Moore authored
      The retry queue is intended to provide a temporary buffer in the case
      of transient errors when communicating with auditd, it is not meant
      as a long life queue, that functionality is provided by the hold
      queue.
      
      This patch fixes a problem identified by Seth where the retry queue
      could grow uncontrollably if an auditd instance did not connect to
      the kernel to drain the queues.  This commit fixes this by doing the
      following:
      
      * Make sure we always call auditd_reset() if we decide the connection
      with audit is really dead.  There were some cases in
      kauditd_hold_skb() where we did not reset the connection, this patch
      relocates the reset calls to kauditd_thread() so all the error
      conditions are caught and the connection reset.  As a side effect,
      this means we could move auditd_reset() and get rid of the forward
      definition at the top of kernel/audit.c.
      
      * We never checked the status of the auditd connection when
      processing the main audit queue which meant that the retry queue
      could grow unchecked.  This patch adds a call to auditd_reset()
      after the main queue has been processed if auditd is not connected,
      the auditd_reset() call will make sure the retry and hold queues are
      correctly managed/flushed so that the retry queue remains reasonable.
      
      Cc: <stable@vger.kernel.org> # 4.10.x-: 5b52330bReported-by: default avatarSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      264d5096
  23. 21 Mar, 2017 1 commit
    • Paul Moore's avatar
      audit: fix auditd/kernel connection state tracking · 5b52330b
      Paul Moore authored
      What started as a rather straightforward race condition reported by
      Dmitry using the syzkaller fuzzer ended up revealing some major
      problems with how the audit subsystem managed its netlink sockets and
      its connection with the userspace audit daemon.  Fixing this properly
      had quite the cascading effect and what we are left with is this rather
      large and complicated patch.  My initial goal was to try and decompose
      this patch into multiple smaller patches, but the way these changes
      are intertwined makes it difficult to split these changes into
      meaningful pieces that don't break or somehow make things worse for
      the intermediate states.
      
      The patch makes a number of changes, but the most significant are
      highlighted below:
      
      * The auditd tracking variables, e.g. audit_sock, are now gone and
      replaced by a RCU/spin_lock protected variable auditd_conn which is
      a structure containing all of the auditd tracking information.
      
      * We no longer track the auditd sock directly, instead we track it
      via the network namespace in which it resides and we use the audit
      socket associated with that namespace.  In spirit, this is what the
      code was trying to do prior to this patch (at least I think that is
      what the original authors intended), but it was done rather poorly
      and added a layer of obfuscation that only masked the underlying
      problems.
      
      * Big backlog queue cleanup, again.  In v4.10 we made some pretty big
      changes to how the audit backlog queues work, here we haven't changed
      the queue design so much as cleaned up the implementation.  Brought
      about by the locking changes, we've simplified kauditd_thread() quite
      a bit by consolidating the queue handling into a new helper function,
      kauditd_send_queue(), which allows us to eliminate a lot of very
      similar code and makes the looping logic in kauditd_thread() clearer.
      
      * All netlink messages sent to auditd are now sent via
      auditd_send_unicast_skb().  Other than just making sense, this makes
      the lock handling easier.
      
      * Change the audit_log_start() sleep behavior so that we never sleep
      on auditd events (unchanged) or if the caller is holding the
      audit_cmd_mutex (changed).  Previously we didn't sleep if the caller
      was auditd or if the message type fell between a certain range; the
      type check was a poor effort of doing what the cmd_mutex check now
      does.  Richard Guy Briggs originally proposed not sleeping the
      cmd_mutex owner several years ago but his patch wasn't acceptable
      at the time.  At least the idea lives on here.
      
      * A problem with the lost record counter has been resolved.  Steve
      Grubb and I both happened to notice this problem and according to
      some quick testing by Steve, this problem goes back quite some time.
      It's largely a harmless problem, although it may have left some
      careful sysadmins quite puzzled.
      
      Cc: <stable@vger.kernel.org> # 4.10.x-
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      5b52330b
  24. 18 Jan, 2017 1 commit
  25. 14 Dec, 2016 2 commits