From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938796AbcKLMNU (ORCPT ); Sat, 12 Nov 2016 07:13:20 -0500 Received: from mout.gmx.net ([212.227.17.20]:62597 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964833AbcKLMNS (ORCPT ); Sat, 12 Nov 2016 07:13:18 -0500 Message-ID: <1478952749.14557.36.camel@gmx.de> Subject: Re: sched/autogroup: race if !sysctl_sched_autogroup_enabled ? From: Mike Galbraith To: Peter Zijlstra , Oleg Nesterov Cc: Ingo Molnar , Linus Torvalds , hartsjc@redhat.com, vbendel@redhat.com, vlovejoy@redhat.com, linux-kernel@vger.kernel.org Date: Sat, 12 Nov 2016 13:12:29 +0100 In-Reply-To: <20161109175005.GS3142@twins.programming.kicks-ass.net> References: <20161109165933.GA26071@redhat.com> <20161109175005.GS3142@twins.programming.kicks-ass.net> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:r6q2MWdhTxbgbzT59c7Vw7H9TDa/lpkZZgoK933VTcJ7GtBkIoe 5upHNi8PzrVsu85b7QRDVmt5KALCwwjTVBE022+LRJt6SlHYoC623x5PJXdLChe1VQDmpj7 z3Ty2PYObQuPouHGby3Dbadx6dJe7Rs0cpud/i0adq3/lfq1ibo/mEiySoT5deoYlORAJON MrUFDZowTCZFZoA2adQqg== X-UI-Out-Filterresults: notjunk:1;V01:K0:OrPBZ8nHMxM=:rG4TD8t4H+Zn3s8BApxkoL qut6741tYPJtX2LYMT+i2cjFCqxYc1veTQJtQxQ9rY9+uyiP6ls7///96piKqpVT+J/uRx9Ku alFzMywzAytw4kbXz1EExWjdiFuP35ONpk4wGQhSHdgRhkRIzpx4inhA34SNbEBmAUil2RJqy OVP5bHsk9whMhNlZau2Bc7fJAU2vp4tgHpavchxt72/bTj8C/ltK5CUTFqvsJPCB512w5iNB5 JhUNIdAchIcA2wDZl6W96If5ntsSa8ohOZU+FTW4TzydSlp+eP7DOvybp10Oo7xkSmSqhRGA5 O/W2BQyjnZER5aOPwcf18XImjcAzlvSq9yhyGbQk2QnWAxnTlR8oKLZ4auq2kYurkzsFkIQ64 ofawrer9euiABHbnQ7g4HqbmANXydxATCpLCKexKg0oIOlKzzW4kDvppS1KCYcBYqJNO5VF6x Z9yM4IwsTNk5UXgIzhMEjhFGg34v49egcoaFwTRFmfDmaqc5aRXMcmd0P+vXqjC504GZBUzYC jtk1T80yOQfXsPCPciimqqwSEP2cbxQ+NjTmRDY7QHf3BkI4tkLOFOdMjH3r/f0+MFzMlqNY4 FvKxeGgK0NkCiau76OZxeCiOwIaIKqpS9FOAZxhFZ73up9gpyKyklEmRdAXRfmznxNpkeG0Vr sjEPRllD4kjIpDKbNM9SqiNC5YkoqsDaPwbdNPt5zF3dBcVi24JneUADViv8FVqRIqQw3dJID 28Qm6UX85a++k4VC0oYQvWe9i6IJMVDRuLBEpPisAMtN+XwBSXCC/k+15nD37GvyTATR07J7Y NfAwoV0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2016-11-09 at 18:50 +0100, Peter Zijlstra wrote: > On Wed, Nov 09, 2016 at 05:59:33PM +0100, Oleg Nesterov wrote: > > > We need to ensure that autogroup/tg returned by autogroup_task_group() > > can't go away if we race with autogroup_move_group(), and unless the > > caller holds ->siglock we rely on fact that autogroup_move_group() > > will a) see this task and b) do sched_move_task() which needs the same > > same rq->lock. > > > > However. autogroup_move_group() skips for_each_thread/sched_move_task > > if sysctl_sched_autogroup_enabled == 0. > > > > So. Doesn't this mean that cgroup migration to the root cgroup can race > > with autogroup_move_group() and use the soon-to-be-freed autogroup->tg? > > Argh, its too late for this, also jet-lag. But maybe, I can sort of feel > a hole here but cannot for the life of me still think. > > > > although this is a bit off-topic. Another question is that I fail to > > understand why sched_autogroup_create_attach() does autogroup_create() > > and changes signal->autogroup even if !sysctl_sched_autogroup_enabled. > > I really cannot remember back that far, but it could be to allow > flipping it back on. Then again, I don't think the fork path puts new > tasks in, even if the autogroup exists. Yeah, I've forgotten nearly everything about it too. I do recall that the autogroup always existed for both manual on/off and migrations cgroup <--> root. I think autogroup should go away. Systemthing infestation is nearly everywhere these days, and it wants to do ever more stupid shite that will render it useless anyway. -Mike