Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3770424rwb; Sun, 9 Oct 2022 10:42:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Az5n8V5GmH9t6uGiXBI6IvKT7xUu50iPUKJEaQWRWULZeZfD9eLU+KexrZXMu2By+8Tmr X-Received: by 2002:a17:902:d48d:b0:178:306d:f75c with SMTP id c13-20020a170902d48d00b00178306df75cmr15086850plg.73.1665337334181; Sun, 09 Oct 2022 10:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665337334; cv=none; d=google.com; s=arc-20160816; b=CBouc2AO1V+qg5Hhfe1TcHhX4S/V9Nm/rE+L7qS4PqTqmDiYIJEWHbS6Kr8mcZxOyx JMU+E/J/9G+vyMOsi32wKpD3k3VLqErvU3kPG/I5cgoDSwHuv2TmHiVF63+IZi2djNG/ ud5fP7eojLXvn9/1v5FRwu7eAE6XEWKHRYT4c10VC9jhXSUES6ykaW2JMzZ9GYrmlIYT NAICafQhc5Td9h0CS0dFLgrQkH21Y/Sp0BCnCDi7zNTZ5xjvessSVejYt21RhhHSj5cw PBzHFC4yBQpMA9YVbKzlhqeRioisbn3Nztzi/nKWmO5vzjSs/RKDyPNO51HySVmwnOAE ePLQ== 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:dkim-signature; bh=YvPFr7WGigPVqcqPkf+syMoySq6UZpBvK4m55ME9KjY=; b=Hh/7L0dokhkZZyjqLCyfzJ/VrpWNZw3VWqRtPtsT3o59J8AH6OKS3CN0DQL32MzjuH Anv40JZiKqzqh7tyF85Q1V63IYDbHJ7Rw51YVIB3IDGvQ5l3QCJWVKKOy40RO5MkK4eX mVTe6tvgKTolm+Qi1nZBOyiqALzBuPJJq8N8lug9iIcBARXPEqq5b+8eiYylSZ2LBGqp SzK72uvGAU+rFnkHyrwuIqlZLZkF8yXSLCo1W0UYtL1VCR8lPHzn3Dn71DtK+/i+a7qH 4O9Cd+cUHxYbTQc6o+lNvw1KCwRmPkwrQE4a/iq631e3aFuwJSiow5/0zWh9hMAhbzu9 s+PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YbOZyjk6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nv9-20020a17090b1b4900b0020ad8a730dbsi10169879pjb.58.2022.10.09.10.42.01; Sun, 09 Oct 2022 10:42:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YbOZyjk6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230013AbiJIRhn (ORCPT + 99 others); Sun, 9 Oct 2022 13:37:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbiJIRhj (ORCPT ); Sun, 9 Oct 2022 13:37:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 154182A25B for ; Sun, 9 Oct 2022 10:37:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BDA5DB80D86 for ; Sun, 9 Oct 2022 17:37:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A385C433C1; Sun, 9 Oct 2022 17:35:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665337054; bh=4YKJ75aAYfVmuih5WjBkBqJZZGk12SfM0ZqEAhECx5w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YbOZyjk6bc5fW5z2bUreAFMwQDFZ//XoKW5IxwOlYXEDRSTTSXn6XANjG4Jqcs7cD jxvVj2NxP+UDVSXUNwe+OVSGUhOjD2FvSM6gu+2IMbpxzTLeR+j0yV+8TEayRJRFdk Y8FlaN1qDUjVAxccvs2sx/sqwJsFzvesKx7eHHzZrsgBGjan52mdpLMKPikpv7+Pxm eE/psrePVCPs8l3HZLYfR/DjjkPwFTokLDD9DviKDXGOasqdX/JmK6a5bTJsKt5wu/ MxLfx9ZsRUwwyaUOX/dGBaGesgxC2AFGjxHTLADtZQMVfzVsCShxDwRjfHd7uJd2t2 mlTqtxE1Lw91g== Date: Sun, 9 Oct 2022 19:35:19 +0200 From: Christian Brauner To: "Christian A. Ehrhardt" , Tejun Heo Cc: Tejun Heo , syzbot , gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Yosry Ahmed Subject: Re: [PATCH] cgroup: Fix crash with CLONE_INTO_CGROUP and v1 cgroups Message-ID: <20221009173519.jwuissylg5haicie@wittgenstein> References: <000000000000385cbf05ea3f1862@google.com> <00000000000028a44005ea40352b@google.com> <20221009084039.cw6meqbvy4362lsa@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 09, 2022 at 03:10:36PM +0200, Christian A. Ehrhardt wrote: > > Since commit f3a2aebdd6, Version 1 cgroups no longer cause an > error when used with CLONE_INTO_CGROUP. However, the permission > checks performed during clone assume a Version 2 cgroup. > > Restore the error check for V1 cgroups in the clone() path. > > Reported-by: syzbot+534ee3d24c37c411f37f@syzkaller.appspotmail.com > Link: https://lore.kernel.org/lkml/000000000000385cbf05ea3f1862@google.com/ > Fixes: f3a2aebdd6 ("cgroup: enable cgroup_get_from_file() on cgroup1") > Signed-off-by: Christian A. Ehrhardt > --- Thanks for fixing this, Reviewed-by: Christian Brauner (Microsoft) Fwiw, @Tejun, after f3a2aebdd6 ("cgroup: enable cgroup_get_from_file() on cgroup1") that non-me-Christian fixes with this patch cgroup_get_from_file() looks a bit odd. It could use sm like: From 0a8a5f7acbec0385ec16cd93a9cff2486fae0ecb Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sun, 9 Oct 2022 19:33:21 +0200 Subject: [PATCH] cgroup: remove unneeded local variable Since commit f3a2aebdd6 ("cgroup: enable cgroup_get_from_file() on cgroup1") the assigment to @cgrp has become pointless. Signed-off-by: Christian Brauner (Microsoft) --- kernel/cgroup/cgroup.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 8ad2c267ff47..550e7bd96b76 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6160,14 +6160,12 @@ void cgroup_fork(struct task_struct *child) static struct cgroup *cgroup_get_from_file(struct file *f) { struct cgroup_subsys_state *css; - struct cgroup *cgrp; css = css_tryget_online_from_dir(f->f_path.dentry, NULL); if (IS_ERR(css)) return ERR_CAST(css); - cgrp = css->cgroup; - return cgrp; + return css->cgroup; } /** -- 2.34.1