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: <20120323133404.GA9095@redhat.com>
Date:	Fri, 23 Mar 2012 14:34:04 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Boaz Harrosh <bharrosh@...asas.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
	"Rafael J. Wysocki" <rjw@...k.pl>, keyrings@...ux-nfs.org,
	linux-security-module@...r.kernel.org,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	NFS list <linux-nfs@...r.kernel.org>,
	Trond Myklebust <Trond.Myklebust@...app.com>,
	"Bhamare, Sachin" <sbhamare@...asas.com>,
	David Howells <dhowells@...hat.com>,
	Eric Paris <eparis@...hat.com>,
	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
	Kay Sievers <kay.sievers@...y.org>,
	James Morris <jmorris@...ei.org>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Greg KH <gregkh@...uxfoundation.org>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Tejun Heo <tj@...nel.org>, David Rientjes <rientjes@...gle.com>
Subject: Re: [RFC 4/4] {RFC} kmod.c: Add new call_usermodehelper_timeout()
	API

On 03/22, Boaz Harrosh wrote:
>
> On 03/22/2012 07:27 AM, Oleg Nesterov wrote:
> >>
> >>     usermodehelper: implement UMH_KILLABLE
> >>
> >>     Implement UMH_KILLABLE, should be used along with UMH_WAIT_EXEC/PROC.  The
> >>     caller must ensure that subprocess_info->path/etc can not go away until
> >>     call_usermodehelper_freeinfo().
> >> ...
> >>
> >> I think that my patch above does a much better/cleaner lifetime management of the
> >> subprocess_info struct, with the use of a kref.
> >
> > This is subjective, you know ;) I specially tried to avoid the
> > refcounting.
> >
>
> Why?
>
> The all kref_ abstraction comes to a simple atomic_inc/dec.

Again, this is subjective, but kref_ looks like the unnecessary
complication to me. But I won't insist, see below.

> > In any case. I do not know why do we need timeout, but this is
> > orthogonal to KILLABLE. Please redo your patches on top of -mm
> > tree? Please note that in this case the change becomes trivial.
> >
>
> Yes you are right.

OK, good.

> > Hmm. For example, exit_mm() does xchg().
> >
>
> Again, Personally I like xchg, but not here, not for an object
> life-time management. Two threads share a structure, that needs
> to go when the last one ends.

And xchg(info->complete) implements the simplest counter,
xchg() == NULL is equivalent to atomic_dec_and_test() == T.

But again, again, I won't argue if you send the patch which uses
kref_ instead. I do not maintain this code and I do not really mind.
And I never pretended my taste is good ;)

My point is, this is completely orthogonal to "add the timeout",
and if you want to change the refcounting I'd suggest a separate
patch.

What we need is wait_for_completion_state_timeout() to avoid
the horror like

	if (UMH_KILLABLE && !timeout)
		wait_for_completion_killable(...);
	else if (UMH_KILLABLE && timeout)
		wait_for_completion_killable_timeout(...);
	else if (!UMH_KILLABLE && !timeout)
		...

IOW, I think we need to export wait_for_common() first.

This is the only complication afaics. After that "add the timeout"
becomes almost one-liner, with or without "switch to kref_".


> Is there an mm git tree?

No, afaik

> random linux-next/master point. Which should do the job.

Yes, I think this should work.

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