public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] audit_alloc: clear TIF_SYSCALL_AUDIT if !audit_context
@ 2013-09-15 17:10 Oleg Nesterov
  2013-09-15 17:11 ` Oleg Nesterov
  0 siblings, 1 reply; 4+ messages in thread
From: Oleg Nesterov @ 2013-09-15 17:10 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Eric Paris, Kees Cook, Richard Guy Briggs, Steve Grubb,
	Zach Levis, linux-audit, linux-kernel

Hello,

v2:
	- update the changelog

	- add the ack from Steve

Oleg.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/1] audit_alloc: clear TIF_SYSCALL_AUDIT if !audit_context
  2013-09-15 17:10 [PATCH v2 1/1] audit_alloc: clear TIF_SYSCALL_AUDIT if !audit_context Oleg Nesterov
@ 2013-09-15 17:11 ` Oleg Nesterov
  2013-09-20 16:08   ` Eric Paris
  0 siblings, 1 reply; 4+ messages in thread
From: Oleg Nesterov @ 2013-09-15 17:11 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Eric Paris, Kees Cook, Richard Guy Briggs, Steve Grubb,
	Zach Levis, linux-audit, linux-kernel

If audit_filter_task() nacks the new thread it makes sense
to clear TIF_SYSCALL_AUDIT which can be copied from parent
by dup_task_struct().

A wrong TIF_SYSCALL_AUDIT is not really bad but it triggers
the "slow" audit paths in entry.S to ensure the task can not
miss audit_syscall_*() calls, this is pointless if the task
has no ->audit_context.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Steve Grubb <sgrubb@redhat.com>
---
 kernel/auditsc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] audit_alloc: clear TIF_SYSCALL_AUDIT if !audit_context
  2013-09-15 17:11 ` Oleg Nesterov
@ 2013-09-20 16:08   ` Eric Paris
  2013-09-23 21:55     ` Richard Guy Briggs
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Paris @ 2013-09-20 16:08 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Kees Cook, Richard Guy Briggs, Steve Grubb,
	Zach Levis, linux-audit, linux-kernel

On Sun, 2013-09-15 at 19:11 +0200, Oleg Nesterov wrote:
> If audit_filter_task() nacks the new thread it makes sense
> to clear TIF_SYSCALL_AUDIT which can be copied from parent
> by dup_task_struct().
> 
> A wrong TIF_SYSCALL_AUDIT is not really bad but it triggers
> the "slow" audit paths in entry.S to ensure the task can not
> miss audit_syscall_*() calls, this is pointless if the task
> has no ->audit_context.
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> Acked-by: Steve Grubb <sgrubb@redhat.com>

Acked-by: Eric Paris <eparis@redhat.com>

Richard, please pick this up into your tree.

> ---
>  kernel/auditsc.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> 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);



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] audit_alloc: clear TIF_SYSCALL_AUDIT if !audit_context
  2013-09-20 16:08   ` Eric Paris
@ 2013-09-23 21:55     ` Richard Guy Briggs
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Guy Briggs @ 2013-09-23 21:55 UTC (permalink / raw)
  To: Eric Paris
  Cc: Oleg Nesterov, Andrew Morton, Kees Cook, Steve Grubb, Zach Levis,
	linux-audit, linux-kernel

On Fri, Sep 20, 2013 at 12:08:02PM -0400, Eric Paris wrote:
> On Sun, 2013-09-15 at 19:11 +0200, Oleg Nesterov wrote:
> > If audit_filter_task() nacks the new thread it makes sense
> > to clear TIF_SYSCALL_AUDIT which can be copied from parent
> > by dup_task_struct().
> > 
> > A wrong TIF_SYSCALL_AUDIT is not really bad but it triggers
> > the "slow" audit paths in entry.S to ensure the task can not
> > miss audit_syscall_*() calls, this is pointless if the task
> > has no ->audit_context.
> > 
> > Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> > Acked-by: Steve Grubb <sgrubb@redhat.com>
> 
> Acked-by: Eric Paris <eparis@redhat.com>
> 
> Richard, please pick this up into your tree.

Ack.

> > ---
> >  kernel/auditsc.c |    4 +++-
> >  1 files changed, 3 insertions(+), 1 deletions(-)
> > 
> > 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);

- RGB

--
Richard Guy Briggs <rbriggs@redhat.com>
Senior Software Engineer
Kernel Security
AMER ENG Base Operating Systems
Remote, Ottawa, Canada
Voice: +1.647.777.2635
Internal: (81) 32635
Alt: +1.613.693.0684x3545

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-23 21:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-15 17:10 [PATCH v2 1/1] audit_alloc: clear TIF_SYSCALL_AUDIT if !audit_context Oleg Nesterov
2013-09-15 17:11 ` Oleg Nesterov
2013-09-20 16:08   ` Eric Paris
2013-09-23 21:55     ` Richard Guy Briggs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox