From: Tejun Heo <tj@kernel.org>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Zefan Li <lizefan.x@bytedance.com>,
Johannes Weiner <hannes@cmpxchg.org>, Yonghong Song <yhs@fb.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, "Christian A . Ehrhardt" <lk@c--e.de>
Subject: Re: [PATCH v1 1/3] Revert "cgroup: enable cgroup_get_from_file() on cgroup1"
Date: Mon, 10 Oct 2022 14:03:08 -1000 [thread overview]
Message-ID: <Y0SyvJvzFQOhSFsC@slm.duckdns.org> (raw)
In-Reply-To: <20221010235845.3379019-2-yosryahmed@google.com>
Hello,
Already queued the following to cgroup/for-6.1-fixes. Will send it out soon.
Thanks.
----- 8< -----
From 03db7716159477b595e9af01be8003b7e994cc79 Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Mon, 10 Oct 2022 11:08:17 -1000
Subject: [PATCH] Revert "cgroup: enable cgroup_get_from_file() on cgroup1"
This reverts commit f3a2aebdd6fb90e444d595e46de64e822af419da.
The commit enabled looking up v1 cgroups via cgroup_get_from_file().
However, there are multiple users, including CLONE_INTO_CGROUP, which have
been assuming that it would only look up v2 cgroups. Returning v1 cgroups
breaks them.
Let's revert the commit and retry later with a separate lookup interface
which allows both v1 and v2.
Signed-off-by: Tejun Heo <tj@kernel.org>
Link: http://lkml.kernel.org/r/000000000000385cbf05ea3f1862@google.com
Cc: Yosry Ahmed <yosryahmed@google.com>
---
kernel/cgroup/cgroup.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index ecf409e3c3a7..6d8a5a40c24d 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -6234,6 +6234,11 @@ static struct cgroup *cgroup_get_from_file(struct file *f)
return ERR_CAST(css);
cgrp = css->cgroup;
+ if (!cgroup_on_dfl(cgrp)) {
+ cgroup_put(cgrp);
+ return ERR_PTR(-EBADF);
+ }
+
return cgrp;
}
--
2.37.3
next prev parent reply other threads:[~2022-10-11 0:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 23:58 [PATCH v1 0/3] Fix cgroup1 support in get from fd/file interfaces Yosry Ahmed
2022-10-10 23:58 ` [PATCH v1 1/3] Revert "cgroup: enable cgroup_get_from_file() on cgroup1" Yosry Ahmed
2022-10-11 0:03 ` Tejun Heo [this message]
[not found] ` <20221010235845.3379019-1-yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2022-10-10 23:58 ` [PATCH v1 2/3] cgroup: add cgroup_all_get_from_[fd/file]() Yosry Ahmed
2022-10-11 0:11 ` Tejun Heo
[not found] ` <Y0S0nFSyivpU4H0n-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-10-11 0:14 ` Yosry Ahmed
2022-10-11 0:18 ` Tejun Heo
2022-10-11 1:43 ` kernel test robot
2022-10-11 6:47 ` kernel test robot
2022-10-10 23:58 ` [PATCH v1 3/3] bpf: cgroup_iter: support cgroup1 using cgroup fd Yosry Ahmed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y0SyvJvzFQOhSFsC@slm.duckdns.org \
--to=tj@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hannes@cmpxchg.org \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=lk@c--e.de \
--cc=martin.lau@linux.dev \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=yhs@fb.com \
--cc=yosryahmed@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox