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: <20181120162529.GU2509588@devbig004.ftw2.facebook.com>
Date:   Tue, 20 Nov 2018 08:25:29 -0800
From:   Tejun Heo <tj@...nel.org>
To:     Roman Gushchin <guroan@...il.com>
Cc:     Oleg Nesterov <oleg@...hat.com>, cgroups@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-team@...com,
        Roman Gushchin <guro@...com>
Subject: Re: [PATCH v3 4/7] cgroup: cgroup v2 freezer

On Fri, Nov 16, 2018 at 04:38:27PM -0800, Roman Gushchin wrote:
> +void cgroup_freezer_migrate_task(struct task_struct *task,
> +				 struct cgroup *src, struct cgroup *dst)
> +{
> +	lockdep_assert_held(&css_set_lock);
> +
> +	/*
> +	 * Kernel threads are not supposed to be frozen at all.
> +	 */
> +	if (task->flags & PF_KTHREAD)
> +		return;
> +
> +	/*
> +	 * Adjust counters of freezing and frozen tasks.
> +	 */
> +	if (test_bit(CGRP_FREEZE, &src->flags)) {
> +		src->freezer.nr_tasks_to_freeze--;
> +		WARN_ON_ONCE(src->freezer.nr_tasks_to_freeze < 0);
> +	}
> +
> +	/*
> +	 * If the task is frozen, let's bump nr_tasks_to_freeze even
> +	 * if the target cgroup isn't frozen: the counter will be decreased
> +	 * in cgroup_leave_frozen().
> +	 */
> +	if (test_bit(CGRP_FREEZE, &dst->flags) || task->frozen)
> +		dst->freezer.nr_tasks_to_freeze++;
> +
> +	if (task->frozen) {
> +		src->freezer.nr_frozen_tasks--;
> +		dst->freezer.nr_frozen_tasks++;
> +		WARN_ON_ONCE(src->freezer.nr_frozen_tasks < 0);
> +		WARN_ON_ONCE(dst->freezer.nr_frozen_tasks >
> +			     dst->freezer.nr_tasks_to_freeze);
> +	}

If a non-frozen task is being moved into a frozen cgroup, shouldn't
that also trigger frozen state update?

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ