linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Guy Briggs <rgb@redhat.com>
To: linux-audit@redhat.com, linux-kernel@vger.kernel.org
Cc: Richard Guy Briggs <rgb@redhat.com>,
	Eric Paris <eparis@redhat.com>, Gao feng <gaofeng@cn.fujitsu.com>,
	Toshiyuki Okajima <toshi.okajima@jp.fujitsu.com>
Subject: [PATCH 0/3] audit: remove audit_log_start() contention in AUDIT_USER type calls
Date: Wed,  4 Dec 2013 21:45:53 -0500	[thread overview]
Message-ID: <cover.1386206544.git.rgb@redhat.com> (raw)
In-Reply-To: <1382713941.2954.19.camel@flatline.rdu.redhat.com>

There is a race condition between systemd and auditd:

systemd                                    |auditd
-------------------------------------------+-----------------------------------
...                                        |
-> audit_receive                           |...
   -> mutex_lock(&audit_cmd_mutex)         |-> audit_receive
      ... -> audit_log_start               |   -> mutex_lock(&audit_cmd_mutex)
             -> wait_for_auditd            |      // wait for systemd
                -> schedule_timeout(60*HZ) |

This fix will take care of systemd and anything USING audit.  It still means
that we could race with something configuring audit and auditd shutting down.

The idea of dropping the lock at the top of audit_receive_msg() isn't as clean
as I had hoped, with AUDIT_ADD_RULE, AUDIT_TRIM, AUDIT_MAKE_EQUIV all
potentially allocating additional audit buffers indirectly through
trim_marked().  It may make sense to have trim_marked() send its queue through
a new thread.

Richard Guy Briggs (3):
  selinux: call WARN_ONCE() instead of calling audit_log_start()
  smack: call WARN_ONCE() instead of calling audit_log_start()
  audit: drop audit_cmd_lock in AUDIT_USER family of cases

 kernel/audit.c                 |    2 ++
 security/selinux/ss/services.c |   12 ++++--------
 security/smack/smack_lsm.c     |    5 ++---
 3 files changed, 8 insertions(+), 11 deletions(-)


  parent reply	other threads:[~2013-12-05  2:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11  1:36 [BUG][PATCH][RFC] audit: hang up in audit_log_start executed on auditd Toshiyuki Okajima
2013-10-11  9:33 ` Gao feng
2013-10-11 12:29   ` Toshiyuki Okajima (smtp-b.css)
2013-10-15  4:43     ` [BUG][PATCH] audit: audit_log_start running on auditd should not stop Toshiyuki Okajima
2013-10-15  6:30       ` Gao feng
2013-10-15  7:07         ` Toshiyuki Okajima
2013-10-15  7:58           ` [BUG][PATCH V3] " Toshiyuki Okajima
2013-10-15  9:41             ` Gao feng
2013-10-23 19:55         ` [BUG][PATCH] " Richard Guy Briggs
2013-10-24  5:55           ` Gao feng
2013-10-24 19:35             ` Richard Guy Briggs
2013-10-25  1:36           ` Toshiyuki Okajima
2013-10-25 15:12             ` Eric Paris
2013-10-28  9:20               ` Toshiyuki Okajima
2013-12-05  2:45               ` Richard Guy Briggs [this message]
2013-12-05  2:45                 ` [PATCH 1/3] selinux: call WARN_ONCE() instead of calling audit_log_start() Richard Guy Briggs
2013-12-05  2:45                 ` [PATCH 2/3] smack: " Richard Guy Briggs
2013-12-06 18:40                   ` Casey Schaufler
2013-12-08 22:17                     ` Richard Guy Briggs
2013-12-05  2:45                 ` [PATCH 3/3] audit: drop audit_cmd_lock in AUDIT_USER family of cases Richard Guy Briggs
2013-12-09  2:31                   ` Toshiyuki Okajima
2013-12-05  7:15                 ` [RESEND][BUG][PATCH V3] audit: audit_log_start running on auditd should not stop Toshiyuki Okajima

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1386206544.git.rgb@redhat.com \
    --to=rgb@redhat.com \
    --cc=eparis@redhat.com \
    --cc=gaofeng@cn.fujitsu.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=toshi.okajima@jp.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).