Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp230369pxb; Mon, 13 Sep 2021 17:48:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEu7dx3tw+AueDHBIy6eCrOBK9gz5T8iOiFRnnKGtFCZhuZo+MzbRq6r7Az+Qj3ohyJ4dW X-Received: by 2002:a17:906:f15:: with SMTP id z21mr15617259eji.177.1631580511772; Mon, 13 Sep 2021 17:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631580511; cv=none; d=google.com; s=arc-20160816; b=yNj6F65gsbYirkEhkSuqWH1xdT3f2yQlUTQ1OKM93UZUjLT2zSLTXWkb1G5idXi6zW ONbGkLWzxxLZApFVM1Qr7rB/k4cB2pcU14q43Pl6KAj9MN9ePxveqE1q02eO+wVgo0g7 q463OyUr6PWXYcWhPhyxz6NGF9FzAYFXv5oGarfuhi5ZK6WFuO8NqzcNVOIzb+3F1uhD PDJ6v1VFZZKEhsaeS2jPjV/7MnK5yhekoK1N9UOmkw+UI2LtZHQNzxTefWCGouVL5Trb E19XizJXIYOsiDiLbkRl34hvUn2ANqOxjNKxv1oisrhPG6KNe3MXLvUUv0xtEJvk0sP8 CW0w== 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=rQ0g6XucybidUQ32/zOjQbHjv/JiyzGbAkIREo++RIA=; b=G4QV2qC/BZw5Mp69F67XISScP2erKBYU2/O94MPb9SyHQt25bT8Lqp7EtBGdLyjG4E IH0mkDZgj5B7xRMhHUjrd01+jPWejmPvMC1gCfx7Ch90YH+NMxasCgi4Evo0gZlendsE fpHrJabrgKvQXQuyPeLnXCPwB3c/MORPF2Z/Oyi59NEDUCvABz0Is2AYYo52I6xfcDaA e6CM9WyBQ4VQyERUzbCDIot40EZ+xbtHu9yUDROxCyWnQ33NA9Hlq7XY9t+5Wc3YchhD f26tWNJr8s3gCHMcRDTxk/WFobSVdgfB8Vo3GVAhFxlY4ji7WProCXumz7M4Ms0IcJb/ 5W9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kRhVWV7Y; 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 x18si9502321edl.617.2021.09.13.17.48.07; Mon, 13 Sep 2021 17:48:31 -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=20210112 header.b=kRhVWV7Y; 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 S1346044AbhIMSCT (ORCPT + 99 others); Mon, 13 Sep 2021 14:02:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345955AbhIMSCS (ORCPT ); Mon, 13 Sep 2021 14:02:18 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0004BC061760 for ; Mon, 13 Sep 2021 11:01:02 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id f21so4130325plb.4 for ; Mon, 13 Sep 2021 11:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rQ0g6XucybidUQ32/zOjQbHjv/JiyzGbAkIREo++RIA=; b=kRhVWV7Y8vznKIlC6QEoW/HdLY+lVkKAFP4div/K+WTBqlIl5xjTyYfDQVGL7F7VKv 9eWpX8e8rel3vBVCADsnzHsqlDfqICyvzm/OxhIERfxo9vCgKjbq5h72SFdhOTL2k8BS nNTJjDjEXE7hlWI3JcpKW5WjTNwcMCjr8i9uPQBq5Bs2qZsGT8ZWu+dYne/Uzdwqmb5N HWGxr3LMifEKPQX/KZiXGK1reU9t1twBld2Z9qUfaLBDRHjKErbjy30f7OV83kH80dfA 2Otmw8uX0ug3WIGbU/oKo8cxQDAsGlbRPBIN1mV3kJzMlRajUY06Ms9LE1BQSB6Slu1m qeWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=rQ0g6XucybidUQ32/zOjQbHjv/JiyzGbAkIREo++RIA=; b=1vFQvr6vU7hPnK4plTLGD4ZGSeGJsl3dHwfvLCxNz03YZSIvp5ysUKa5l9rQT7/Te0 j/P23Qoa6hW/1zCyBVu3nWnl6J5HGFl4U2gyDN3Y9llKZahzMalZWL7nTXHCyonmPCNy KALk2G5g857eh/Ncb9cHOmWFztN10FuVxVBiVr0CSBY1crwjI5Zbql2FhdNwvhEc757g BLQXGdprMQPc8eocbpg9Eu7ziotXQqDXWNr4HniAz/arBMiAQoZ7Zomn0P4VkIzPEzf5 +ARstHXmVD97OIhl8Nm6xgG6CUN9vvXg2XaO+5k5k43UpKa4dwueoFAUNNzWm2PAXd43 iKmw== X-Gm-Message-State: AOAM532+xdds5LMl3Gu5iTHKf9ulPj4rlqaDEi+Q9JBIpJKRDzdvc0AI Ge4WowGpuleTrV6IK4Rhg5I= X-Received: by 2002:a17:90a:2e82:: with SMTP id r2mr748614pjd.151.1631556062441; Mon, 13 Sep 2021 11:01:02 -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 ch19sm7816708pjb.33.2021.09.13.11.01.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 11:01:01 -0700 (PDT) Sender: Tejun Heo Date: Mon, 13 Sep 2021 08:01:00 -1000 From: Tejun Heo To: Zhang Qiao Cc: mingo@redhat.com, peterz@infradead.org, linux-kernel@vger.kernel.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com Subject: Re: [PATCH v2] kernel/sched: Fix sched_fork() access an invalid sched_task_group Message-ID: References: <20210911075054.6358-1-zhangqiao22@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210911075054.6358-1-zhangqiao22@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Sat, Sep 11, 2021 at 03:50:54PM +0800, Zhang Qiao wrote: > Between cgroup_can_fork() and cgroup_post_fork(), the cgroup > membership is fixed and thus sched_task_group can't change. So > call sched_fork() after cgroup_can_fork() and update the child's > sched_task_group before it is used. The part being fixed looks correct to me but it's difficult to for me to assess whether the whole relocation of the sched_fork() hook doesn't change anything else. Besides, even if we decide to relocate the sched_fork hook, I think it'd be better to separate the two changes - one is a relatively safe bug fix, the other is a code reorganization with possibly subtle side effects. So, I think it'd be better to produce a patch which just fixes the bug even if that ends up introducing another function in the flow. Thanks. -- tejun