mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kir Kolyshkin <kolyshkin@gmail.com>
To: "Tejun Heo" <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Serge Hallyn" <serge@hallyn.com>,
	"Shakeel Butt" <shakeel.butt@linux.dev>,
	"Roman Gushchin" <roman.gushchin@linux.dev>,
	"Christian Brauner" <brauner@kernel.org>,
	"Shuah Khan" <shuah@kernel.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	 Oleg Nesterov <oleg@redhat.com>,
	cgroups@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	 Kir Kolyshkin <kolyshkin@gmail.com>
Subject: [PATCH 0/2] cgroup: fix cgroup.kill for exited thread group leader
Date: Sun, 18 Oct 2026 15:04:38 -0700	[thread overview]
Message-ID: <20261018-cgroup-kill-exited-leader-v1-0-c71ad94c20cc@gmail.com> (raw)

cgroup.kill fails to kill a process whose thread group leader has
exited while other threads are still running, leaving the cgroup
populated. This can be used by a process in a container to survive
the container being killed, including the case of a container with a
private PID namespace, where such a process is the container's init.

Patch 1 fixes __cgroup_kill() to walk all threads and to send a
thread-group-directed SIGKILL. Patch 2 adds selftests for both
scenarios described in patch 1; they fail without the fix.

Tested on v7.3-rc7 (x86_64 VM): test_kill passes (30 runs), other
cgroup selftests show no changes compared to the unpatched kernel.

The issue was found in crun, see patch 1 for details.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
---
Kir Kolyshkin (2):
      cgroup: fix cgroup.kill for exited thread group leader
      selftests/cgroup: test cgroup.kill with an exited thread group leader

 kernel/cgroup/cgroup.c                     |   4 +-
 tools/testing/selftests/cgroup/test_kill.c | 158 +++++++++++++++++++++++++++++
 2 files changed, 160 insertions(+), 2 deletions(-)
---
base-commit: f909e534f5e34feb2ea2701d54df63e21aa506fc
change-id: 20261018-cgroup-kill-exited-leader-a15159e8c230

Best regards,
-- 
Kir Kolyshkin <kolyshkin@gmail.com>


             reply	other threads:[~2026-10-18 22:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18 22:04 Kir Kolyshkin [this message]
2026-10-18 22:04 ` [PATCH 1/2] " Kir Kolyshkin
2026-10-19 12:57   ` Oleg Nesterov
2026-10-20  6:22     ` Kirill Kolyshkin
2026-10-18 22:04 ` [PATCH 2/2] selftests/cgroup: test cgroup.kill with an " Kir Kolyshkin
2026-10-19 23:27 ` [PATCH 0/2] cgroup: fix cgroup.kill for " Tejun Heo
2026-10-23 19:46   ` [PATCH] cgroup: don't kill migrated processes through their exiting threads Sasha Levin
2026-10-23 20:26     ` Tejun Heo

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=20261018-cgroup-kill-exited-leader-v1-0-c71ad94c20cc@gmail.com \
    --to=kolyshkin@gmail.com \
    --cc=brauner@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=oleg@redhat.com \
    --cc=roman.gushchin@linux.dev \
    --cc=serge@hallyn.com \
    --cc=shakeel.butt@linux.dev \
    --cc=shuah@kernel.org \
    --cc=tj@kernel.org \
    /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

all inboxes | Powered by JetHome®