From: Toshiyuki Okajima <toshi.okajima@jp.fujitsu.com>
To: Richard Guy Briggs <rgb@redhat.com>
Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org,
Eric Paris <eparis@redhat.com>, Gao feng <gaofeng@cn.fujitsu.com>,
Richard Guy Briggs <rgb@tricolour.ca>,
toshi.okajima@jp.fujitsu.com
Subject: Re: [PATCH 3/3] audit: drop audit_cmd_lock in AUDIT_USER family of cases
Date: Mon, 9 Dec 2013 11:31:34 +0900 [thread overview]
Message-ID: <20131209113134.23d1176bedbf6831dbf86e8c@jp.fujitsu.com> (raw)
In-Reply-To: <53733434b27dc65bd16b2e73211b823da1fa64cf.1386206544.git.rgb@redhat.com>
On Wed, 4 Dec 2013 21:45:56 -0500
Richard Guy Briggs <rgb@redhat.com> wrote:
> We do not need to hold the audit_cmd_mutex for this family of cases. The
> possible exception to this is the call to audit_filter_user(), so drop the lock
> immediately after. To help in fixing the race we are trying to avoid, make
> sure that nothing called by audit_filter_user() calls audit_log_start(). In
> particular, watch out for *_audit_rule_match().
>
> 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.
>
> Signed-off-by: Richard Guy Briggs <rgb@tricolour.ca>
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
When I have tested a patch with my reproducer,
a hangup by this problem doesn't occur.
//// reproducer ////
# auditctl -a exit,always -S all
# reboot
/////////////////////////
So, this fix looks good to me.
Please add:
Reported-by: toshi.okajima@jp.fujitsu.com
Tested-by: toshi.okajima@jp.fujitsu.com
Thanks.
> ---
> kernel/audit.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 4689012..4cbc945 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -713,6 +713,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
> if (err)
> break;
> }
> + mutex_unlock(&audit_cmd_mutex);
> audit_log_common_recv_msg(&ab, msg_type);
> if (msg_type != AUDIT_USER_TTY)
> audit_log_format(ab, " msg='%.1024s'",
> @@ -729,6 +730,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
> }
> audit_set_pid(ab, NETLINK_CB(skb).portid);
> audit_log_end(ab);
> + mutex_lock(&audit_cmd_mutex);
> }
> break;
> case AUDIT_ADD_RULE:
> --
> 1.7.1
>
--
Toshiyuki Okajima <toshi.okajima@jp.fujitsu.com>
next prev parent reply other threads:[~2013-12-09 2:31 UTC|newest]
Thread overview: 16+ 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
[not found] ` <5257EF15.6080209@jp.fujitsu.com>
[not found] ` <20131015134345.98d72df42a39e9e1ad77a73c@jp.fujitsu.com>
[not found] ` <525CE10A.90907@cn.fujitsu.com>
2013-10-23 19:55 ` [BUG][PATCH] audit: audit_log_start running on auditd should not stop 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 ` [PATCH 0/3] audit: remove audit_log_start() contention in AUDIT_USER type calls Richard Guy Briggs
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 [this message]
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=20131209113134.23d1176bedbf6831dbf86e8c@jp.fujitsu.com \
--to=toshi.okajima@jp.fujitsu.com \
--cc=eparis@redhat.com \
--cc=gaofeng@cn.fujitsu.com \
--cc=linux-audit@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rgb@redhat.com \
--cc=rgb@tricolour.ca \
/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