lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140410144655.GA25316@redhat.com>
Date:	Thu, 10 Apr 2014 16:46:55 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH RESEND 2/2] tracing: syscall_regfunc() should not skip
	kernel threads

On 04/10, Steven Rostedt wrote:
>
> On Thu, 10 Apr 2014 15:38:55 +0200
> Oleg Nesterov <oleg@...hat.com> wrote:
>
> > > > However, this means that a user-space task spawned by
> > > > call_usermodehelper() won't report the system calls if
> > > > kernel_execve() is called when sys_tracepoint_refcount != 0.
> > >
> > > What about doing the set there? That is, we could add a check in the
> > > call_userspacehelper() just before it does the do_execve, that if
> > > sys_tracepoint_refcount is set, we set the TIF flag.
> >
> > But for what?
>
> Isn't call_usermodehelper() the reason you added this?

Sure. I meant, why complicate ____call_usermodehelper() and keep the
unnecessary complication (PF_KTHREAD check( in syscall_*regfunc() ?

> > And if we do this, ____call_usermodehelper() needs write_lock_irq(tasklist)
> > to serialize with syscall_*regfunc().
>
> You mean for the slight race between checking if its set and when the
> tracepoint is actually activated?

Or deactivated.

> I don't think we really care about that race.

OK, I won't argue. I agree, the problem is minor, but in this case imho
it is better to do nothing than add the racy fix.

> I mean, the tracepoint is
> activated usually by humans, and if they enabled it just as a usermode
> helper is activated, and those are really fast to run, do we even care
> if it is missed?

A user space task spawned by call_usermodehelper() can do everything, it
can run forever.

> Now, if tracing is on and we need to set the flag, that should take the
> task list lock to make sure that we don't miss clearing it. Missing the
> set isn't a big deal, but missing the clearing of the flag is.
>
> void tracepoint_check_syscalls(void)
> {
> 	if (!sys_tracepoint_refcount)
> 		return;
>
> 	read_lock(&tasklist_lock);
> 	/* Make sure it wasn't cleared since taking the lock */
> 	if (sys_tracepoint_refcount)
> 		set_tsk_thread_flag(current, TIF_SYSCALL_TRACEPOINT);
> 	read_unlock(&tasklist_lock);
> }

And how this can help to avoid the race? We need write_lock_irq().

Perhaps I missed something... and I simply do not understand why do you
want to do this.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ