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: <20111012184443.GB21363@ghc17.ghc.andrew.cmu.edu>
Date:	Wed, 12 Oct 2011 14:44:43 -0400
From:	Ben Blum <bblum@...rew.cmu.edu>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Ben Blum <bblum@...rew.cmu.edu>, Tejun Heo <htejun@...il.com>,
	rjw@...k.pl, paul@...lmenage.org, lizf@...fujitsu.com,
	linux-pm@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
	containers@...ts.linux-foundation.org, fweisbec@...il.com,
	matthltc@...ibm.com, akpm@...ux-foundation.org
Subject: Re: [PATCH 3/4] threadgroup: extend threadgroup_lock() to cover
 exit and exec

On Wed, Oct 12, 2011 at 08:29:05PM +0200, Oleg Nesterov wrote:
> On 10/12, Ben Blum wrote:
> >
> > On Wed, Oct 12, 2011 at 07:51:04PM +0200, Oleg Nesterov wrote:
> > >
> > > > Also, it makes the mechanism unnecessarily cgroup-specific without
> > > > gaining much if anything.
> > >
> > > Yes! And _personally_ I think it should be cgroup-specific, that is
> > > why I dislike the very fact do_exit() uses it directly. To me it would
> > > be cleaner to shift it into cgroup hooks. Yes, sure, this is subjective.
> >
> > In the fork path, threadgroup_fork_read_...() is also called directly,
> > not through cgroups. Would that change too?
> 
> Well, if you ask me, I'd prefer to move lock/unlock into
> cgroup_fork/cgroup_post_fork ;) Although the error path plays with it
> too. But this is minor.
> 
> > > In fact I still hope we can kill this sem altogether, but so far I have
> > > no idea how we can do this. We do need the new per-process lock to
> > > protect (in particular) ->thread_group. It is quite possible that it
> > > should be rw_semaphore. But in this case we down_write(), not _read
> > > in exit/fork paths, and its scope should be small.
> >
> > I'm confused - taking a big rwsem for writing in the fork/exit paths?
> 
> Yes, we need the new lock to avoid tasklist_lock.

To avoid tasklist_lock in the cgroup path, or in the fork/exit path?

I'm not sure if "avoiding tasklist_lock" should be our goal. The only
real problem as I see it is that ss->attach() can still race exec *if*
it wants to iterate over the whole thread_group, since the "leader"
passed in might not be the leader anymore.

Unless this is just all about trying to avoid taking a global lock?
(which in cgroups we agreed could be done with the sighand lock instead)

As for the ss->attach problem again: Ummm, I have an idea. Why don't we
just alter the ss->attach() interface to pass in the flex_array of
task_structs that are being moved? The flex_array is how we solved the
problem of "having to check thread_group_leader() everywhere before the
commit point" nastiness. No need for the fork_lock to be in the exit
path at all; its current place in the fork path would suffice for this.

Thoughts?

-- Ben

> 
> > The point here is that even though fork/exit modify thread_group, they
> > are logical "readers"
> 
> Yes I see. And this is one of the reasons why we can't use this lock
> for above.
> 
> 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