cgroup: Fixes for v7.3-rc1

- After cgroup.kill was written to a cgroup, every child cloned into it
  with CLONE_INTO_CGROUP was spuriously killed because the fork path
  snapshotted the kill counter before resolving the target cgroup.

- Releasing an isolated cpuset partition dropped the isolation of CPUs
  isolated on the kernel command line.

- Selftest and documentation fixes.
selftests/cgroup: test clone3() into a previously killed cgroup

Once cgroup.kill had been written to a cgroup, a stale kill_seq
snapshot (taken in cgroup_css_set_fork() before the target cgroup was
resolved) caused every child subsequently cloned into that cgroup with
clone3(CLONE_INTO_CGROUP) to be SIGKILLed on the spot.

Add a regression test: create a cgroup, kill it while it is empty,
then clone a child into it and check that the child runs and exits
cleanly. On a kernel without the fix, the test fails:

  not ok 4 test_cgkill_clone_into_killed

The test is skipped on kernels without clone3() or without
CLONE_INTO_CGROUP.

Cc: Shakeel Butt <shakeel.butt@linux.dev>
Assisted-by: LLM
Signed-off-by: Etienne Perot <eperot@google.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
1 file changed