lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240610105028.GA21586@redhat.com>
Date: Mon, 10 Jun 2024 12:50:28 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Tejun Heo <tj@...nel.org>
Cc: linux-kernel@...r.kernel.org, Zefan Li <lizefan.x@...edance.com>,
	Johannes Weiner <hannes@...xchg.org>
Subject: Q: css_task_iter_advance() && dying_tasks

I never understood the code in kernel/cgroup/ even remotely, most probably
I missed something, but let me ask a couple of stupid questions anyway.

cgroup_exit() does

	css_set_move_task(tsk, cset, NULL, false);
	list_add_tail(&tsk->cg_list, &cset->dying_tasks);

but unless I am totally confused css_task_iter_advance() always ignores
the "dying" sub-threads, so perhaps it should do, say,

	css_set_move_task(tsk, cset, NULL, false);
	if (delay_group_leader(tsk))
		list_add_tail(&tsk->cg_list, &cset->dying_tasks);

and then cgroup_release() can check list_empty(cg_list) before it takes
css_set_lock.

No ?

Or, perhaps we can do even better? Can't cgroup_exit() do something like

	// group_dead should be passed from do_exit()

	css_set_move_task(tsk, cset, NULL, false);

	if (thread_group_leader(tsk) && !group_dead)
		list_add_tail(&tsk->cg_list, &cset->dying_tasks);

	else if (!thread_group_leader(tsk) && group_dead) {
		leader = tsk->group_leader;
		if (!list_empty(leader->cg_list) {
			css_set_skip_task_iters(task_css_set(leader), leader);
			list_del_init(&leader->cg_list);
		}
	}

and then

	- kill the atomic_read(&task->signal->live)) check in
	  css_task_iter_advance()

	- kill the code under css_set_lock in cgroup_release()

Oleg.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ