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: <1eef45a5-e418-e3c6-631f-58b9e52afedf@redhat.com>
Date:   Wed, 31 Aug 2022 16:56:32 -0400
From:   Waiman Long <longman@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Valentin Schneider <vschneid@...hat.com>,
        Tejun Heo <tj@...nel.org>, Zefan Li <lizefan.x@...edance.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Will Deacon <will@...nel.org>, linux-kernel@...r.kernel.org,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Lai Jiangshan <jiangshanlai@...il.com>
Subject: Re: [PATCH v6 4/5] sched: Handle set_cpus_allowed_ptr() &
 sched_setaffinity() race

On 8/31/22 05:47, Peter Zijlstra wrote:
> On Thu, Aug 25, 2022 at 09:01:18PM -0400, Waiman Long wrote:
>> @@ -2722,6 +2734,7 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag
>>   			complete = true;
>>   		}
>>   
>> +		swap_user_cpus_ptr(p, puser_mask);
>>   		task_rq_unlock(rq, p, rf);
>>   
>>   		if (push_task) {
>> @@ -2793,6 +2806,7 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag
>>   		if (flags & SCA_MIGRATE_ENABLE)
>>   			p->migration_flags &= ~MDF_PUSH;
>>   
>> +		swap_user_cpus_ptr(p, puser_mask);
>>   		task_rq_unlock(rq, p, rf);
>>   
>>   		if (!stop_pending) {
>> @@ -2813,6 +2827,8 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag
>>   				complete = true;
>>   			}
>>   		}
>> +
>> +		swap_user_cpus_ptr(p, puser_mask);
>>   		task_rq_unlock(rq, p, rf);
>>   
>>   		if (complete)
> I'm not at all sure about those.
>
> Would it not be much simpler to keep the update of cpus_mask and
> cpus_user_mask together, always ensuring that cpus_user_mask is a strict
> superset of cpus_mask ? That is, set_cpus_allowed_common() seems like
> the right place to me.
>
> I'm thinking this also means blowing away user_mask when we do a full
> reset of the cpus_mask when we do an affnity break.

Thanks for the suggestion. I will need to think about what will be best 
way to pass in those additional parameters there.

Cheers,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ