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]
Date:	Tue, 17 Apr 2012 18:29:42 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	David Howells <dhowells@...hat.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Alexander Gordeev <agordeev@...hat.com>,
	Chris Zankel <chris@...kel.net>,
	David Smith <dsmith@...hat.com>,
	"Frank Ch. Eigler" <fche@...hat.com>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Larry Woodman <lwoodman@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/3] genirq: reimplement exit_irq_thread() hook via
	task_work_add()

On 04/17, David Howells wrote:
>
> Oleg Nesterov <oleg@...hat.com> wrote:
>
> > 2. change irq_thread() to do task_queue_work(irq_thread_dtor)
> >    at the start and task_work_cancel() before return.
> >
> >    tracehook_notify_resume() can never play with kthreads,
> >    only do_exit()->exit_task_work() can call the callback
> >    and this is what we want.
>
> Hmmm...  This seems wrong.

I don't agree...

> You're now using the hook in two distinct ways:
> the primary use of that the hook is to detect that userspace is about to
> resume processing (via TIF_NOTIFY_RESUME)

Yes,

> and then you're abusing the fact
> that the hook is also invoked via do_exit() to perform a clean up because
> we've got to get rid of it somehow under that circumstance.

Yes, and please note that this cleanup is only needed if irq thread
crashes.

> This only works for you because you're operating in a kernel thread which
> doesn't have a userspace (and so will never see TIF_NOTIFY_RESUME).

Yes,

> However,
> if someone tries that in an ordinary thread,

Sure, nobody should do this with the ordinary thread. At least
exactly this.

> it is liable to malfunction as
> the record could be executed and deleted at some unpredictable point in the
> future.

"In the future" is not possible (and this doesn't depend on
PF_KTHREAD). irq_thread() does task_work_cancel() before return.
And until it returns it returns the work can't be executed
unless this task exits in between.

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