Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp94184pxb; Tue, 31 Aug 2021 16:01:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+iAnEgtxSfc4Y/2FEozHr2fHjVKVwYeYcorLzQDFV+lyAY6w/2bwXAj8gESAD8hNZFeBR X-Received: by 2002:a05:6e02:1c27:: with SMTP id m7mr22719926ilh.190.1630450916266; Tue, 31 Aug 2021 16:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630450916; cv=none; d=google.com; s=arc-20160816; b=i9RHWnrvoqVyR6FBR1lghQ41JNiuA3wbwX1ys7WkPHZ3/+7bJ7EVof0dJxZaw14XKg WOz2e2MtKvQBhQUw1dKyNds5mb4uqk+HHOk+wu35/jsK7c3DCAMJbiOjY9pn0Th48mcz io1NZin6a9dki6Pnv6ElVzrE00WdhZCQu0Nlu9DvNuEcz8+2vuT3i4HKxKfYUfc5z7Dz JGg792VwZJIpu6QD2oRJoD/3rFX0oRguy8ow5tGRIGb5O8h9eBFxXG72btbaE0bP4BZl K1tbLIps0HRBNgWVKxkScSBlmGGx4kef6EkGttu0Dzn0J8DBWwwwLShxCI2zwi326P1q ModQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=HY8zH7yQ9cgwovIx437Yv1hZRTnYGVBVhXtxvcQqz/k=; b=POZaOg6yg8l46QG4LczliGu0iYI/vzsfSXZISXPtFwsW4t4J7hBA8hd73tIvbPas9X UBEcHdJ/S6+uzEi+nVj6yevZC1ImwyaTPcXLAmWHgq9U59j19cX8Bygm8q0iHgtFUnOy UHIkxIM7t0XHvaeLM2Yc/K7SjVeQhysMErhAfXRECY+x1CmCBBbYdqIriXFdcovCzOlH uXu6ydoulzYSjmpi5i9kq0ZBp1rLkgWBsaK0DyLs3PxqfKIHdTlvZhrqqffwqSIcY6SJ RpMjXf008kS4GO88H2WbLRU0aR5PyXHCXo3HaWsD0VsKIV0kNoTNP3V4BfT6jazIDFVN gUqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EpBnh6hf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i7si18790345ilk.127.2021.08.31.16.01.28; Tue, 31 Aug 2021 16:01:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EpBnh6hf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239914AbhHaXA0 (ORCPT + 99 others); Tue, 31 Aug 2021 19:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230291AbhHaXAZ (ORCPT ); Tue, 31 Aug 2021 19:00:25 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B738BC061575 for ; Tue, 31 Aug 2021 15:59:29 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id y23so774859pgi.7 for ; Tue, 31 Aug 2021 15:59:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HY8zH7yQ9cgwovIx437Yv1hZRTnYGVBVhXtxvcQqz/k=; b=EpBnh6hfCpQMKtJdrRIrsOfxm1jDct99+/SjhAEQRtWj2rlrZSfWSptzM/4BZKX4EY a0S99dnypF/xz+l87um5yPdmrsdfogZjLL8pvmukkhD6SZsuP8PX4EDQM1AcQJESOxRL QHaGE707O7gf6dLOi8zX2hcnYJbfLGfQoEPoha8UVwdzgonGrEfKesgYi8TT7JeMiCvV UG36oQEavUheTpZJC5WRRZfKbKQea3lR7xlj2tLGbyEqQgFJJcwxdxzizrazgSb3zdVz Fp/33z9RZy0UU0eC3b3j0a9Q3zc4wr23k5v/XuUI4IXGOHCiiGn2EoAJNSmk7xFOkGsi l3Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=HY8zH7yQ9cgwovIx437Yv1hZRTnYGVBVhXtxvcQqz/k=; b=BIN4plrpkaViI5Qqo0Xwrxjm++TIIy89G8p7ol8NQSy83YGw+dLIq1gmUt+ybXdgsG Sm3Accr1xDpV7xpTEnEHP/xMD0fbpYA3z1oxJyiysPGcBUDZ8qpAel6OlsjKKAetZPsE LItSxZVAW7DsQExqkfaqqxh4VIqs4aTiGeILHwuFpiGG0TOrrN6HYK3/gOzAnKhX+M9W f/jKZQcNKd0iycIUZehjd9cr2kX/Xzy8FtEuAzG0Tx+U4ZLGpqfTSK6UdGWXlewmf1US DAo/24Af4DpOiY5TdMOM79qRa+qRYhhY2+x2c3i/4vKddNV0mUtq8m8/AvalbMl8qyUW hGLw== X-Gm-Message-State: AOAM530LYvdGClzWfR0oXtgaqEEOn4rLQDrixBVXt801eGeEdx2A5p40 koSbTl2WeJ5svOyPox08P30= X-Received: by 2002:a62:2c51:0:b029:329:932b:9484 with SMTP id s78-20020a622c510000b0290329932b9484mr30309030pfs.13.1630450769078; Tue, 31 Aug 2021 15:59:29 -0700 (PDT) Received: from localhost (2603-800c-1a02-1bae-e24f-43ff-fee6-449f.res6.spectrum.com. [2603:800c:1a02:1bae:e24f:43ff:fee6:449f]) by smtp.gmail.com with ESMTPSA id s15sm14268290pfu.67.2021.08.31.15.59.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 15:59:28 -0700 (PDT) Sender: Tejun Heo Date: Tue, 31 Aug 2021 12:59:27 -1000 From: Tejun Heo To: Zhang Qiao Cc: peterz@infradead.org, juri.lelli@redhat.com, linux-kernel@vger.kernel.org, mingo@redhat.com, vincent.guittot@linaro.org Subject: Re: [PATCH] kernel/sched: Fix sched_fork() access an invalid sched_task_group Message-ID: References: <20210826112635.7404-1-zhangqiao22@huawei.com> <1f0cd867-9c6d-4e22-cadd-06af9f852f7a@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1f0cd867-9c6d-4e22-cadd-06af9f852f7a@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Tue, Aug 31, 2021 at 03:58:42PM +0800, Zhang Qiao wrote: > > I think this would allow cgroup migrations to take place before > > sched_post_fork() is run, which likely will break stuff. The right > > thing to do likely is taking sched_task_group (and whatever other > > fields) after cgroup_can_fork(), which fixates the cgroup memberships, > > But it still seems possible that it accessed an invalid sched_task_group? > because the child process does not update its sched_task_group util > cgroup_post_fork(). Between cgroup_can_fork() and cgroup_post_fork(), the cgroup membership and thus sched_task_group can't change, so if the child sets it to the parent's inbetween, the sched_task_group can't go away. Thanks. -- tejun