public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: linux-audit@redhat.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andi Kleen <andi@firstfloor.org>, Steve Grubb <sgrubb@redhat.com>,
	Eric Paris <eparis@redhat.com>
Subject: Re: [PATCH v2.1] audit: Only use the syscall slowpath when syscall audit rules exist
Date: Tue, 4 Feb 2014 20:11:29 +0100	[thread overview]
Message-ID: <20140204191129.GB8996@redhat.com> (raw)
In-Reply-To: <CALCETrXuBL3__bYWJ-wSQdbTx=n1jGiD71D4wN-Sm5bDU2=JSw@mail.gmail.com>

On 02/04, Andy Lutomirski wrote:
>
> On Tue, Feb 4, 2014 at 8:50 AM, Oleg Nesterov <oleg@redhat.com> wrote:
> > On 02/03, Andy Lutomirski wrote:
> >>
> >> +void audit_inc_n_rules()
> >> +{
> >> +     struct task_struct *p, *g;
> >> +     unsigned long flags;
> >> +
> >> +     read_lock_irqsave(&tasklist_lock, flags);
> >
> > Confused... read_lock(tasklist) doesn't need to disable irqs.
> >
> > (ftrace does this for no reason too, perhaps I should resend the patch)
>
> Is this because there are no interrupt handlers that write_lock(tasklist)?

Yes.

> >
> >> +     if (audit_n_rules++ == 0) {
> >
> > probably this can be done outside of read_lock?
>
> I don't think so.  I'm cheating and using the tasklist_lock to prevent
> audit_sync_flags

Ah, yes, you are right.

> >> +             do_each_thread(g, p) {
> >
> > for_each_process_thread ;) do_each_thread will die, I hope.
> >
>
> Sorry, forgot to mention: where is this mythical
> for_each_process_thread?

In Linus's tree, please see 0c740d0afc3bff.

> or you
> just hate do_each_thread so much that you imagined up an alternative
> :)

sort of ;)

> I think I'll wait for Eric to chime in.  I suspect that the real
> solution is to simplify all this stuff by relying on the fact that the
> syscall nr and args are saved by the (fast path and slow path) entry
> code, so the audit entry hook may be entirely unnecessary.

Perhaps... but even in this case we need to do something with, say,
__audit_log_bprm_fcaps().

At least this list should not grow indefinitely if the task skips
__audit_syscall_exit(). Although at first glance this can be probably
cleanuped too.

Oleg.


  reply	other threads:[~2014-02-04 19:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-03 19:11 [PATCH v2.1] audit: Only use the syscall slowpath when syscall audit rules exist Andy Lutomirski
2014-02-03 20:35 ` Eric Paris
2014-02-03 21:09   ` Andy Lutomirski
2014-02-04 16:50 ` Oleg Nesterov
2014-02-04 18:11   ` Andy Lutomirski
2014-02-04 19:11     ` Oleg Nesterov [this message]
2014-02-04 19:32       ` Andy Lutomirski
2014-02-05 13:46 ` Eric Paris

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=20140204191129.GB8996@redhat.com \
    --to=oleg@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=eparis@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=sgrubb@redhat.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