public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Eric Paris <eparis@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Zach Levis <zml@linux.vnet.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] audit_alloc: clear TIF_SYSCALL_AUDIT if !audit_context
Date: Wed, 7 Aug 2013 21:06:12 +0200	[thread overview]
Message-ID: <20130807190612.GA7168@redhat.com> (raw)
In-Reply-To: <CAGXu5jKuSp=c94xAQzdG4QenXnWs0X2n+jCyQb0b1Ncp6tbRMg@mail.gmail.com>

On 08/07, Kees Cook wrote:
>
> On Wed, Aug 7, 2013 at 11:05 AM, Oleg Nesterov <oleg@redhat.com> wrote:
> >
> > diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> > index 9845cb3..95293ab 100644
> > --- a/kernel/auditsc.c
> > +++ b/kernel/auditsc.c
> > @@ -943,8 +943,10 @@ int audit_alloc(struct task_struct *tsk)
> >                 return 0; /* Return if not auditing. */
> >
> >         state = audit_filter_task(tsk, &key);
> > -       if (state == AUDIT_DISABLED)
> > +       if (state == AUDIT_DISABLED) {
> > +               clear_tsk_thread_flag(tsk, TIF_SYSCALL_AUDIT);
> >                 return 0;
> > +       }
> >
> >         if (!(context = audit_alloc_context(state))) {
> >                 kfree(key);
> > --
> > 1.5.5.1
> >
> >
>
> Interestingly, I see no other callers of "clear_tsk_thread_flag(tsk,
> TIF_SYSCALL_AUDIT)" :)
>
> This patch seems right, since TIF_SYSCALL_AUDIT is set only when
> audit_filter_task != AUDIT_DISABLED. Though maybe this should be
> explicitly handled in dup_task_struct()?

Personally I agree.

But note that we have more clear-tif-after-fork's. IOW, I think we
should probably add copy_tif_flags() or something which acts like
copy_flags(). TIF_SYSCALL_TRACE, TIF_SYSCALL_EMU, TIF_NEED_RESCHED
at least. Until then we should follow the copy-them-all-then-clear
rule.

Besides, if we add the new clear_tsk_thread_flag() into copy_process's
path we probably need ifdef or ifdef'ed helper.

Oleg.


      reply	other threads:[~2013-08-07 19:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07 18:05 [PATCH 0/1] audit_alloc: clear TIF_SYSCALL_AUDIT if !audit_context Oleg Nesterov
2013-08-07 18:05 ` [PATCH 1/1] " Oleg Nesterov
2013-08-07 18:53   ` Kees Cook
2013-08-07 19:06     ` Oleg Nesterov [this message]

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=20130807190612.GA7168@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zml@linux.vnet.ibm.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