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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <749fdda3-7af5-2899-5c91-c9a1c57025d3@linaro.org>
Date:   Thu, 29 Nov 2018 10:18:29 +0100
From:   Daniel Lezcano <daniel.lezcano@...aro.org>
To:     Juri Lelli <juri.lelli@...hat.com>
Cc:     rjw@...ysocki.net, linux-kernel@...r.kernel.org,
        viresh.kumar@...aro.org, Sudeep Holla <sudeep.holla@....com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Morten Rasmussen <morten.rasmussen@....com>
Subject: Re: [PATCH V5 1/2] base/drivers/arch_topology: Replace mutex with
 READ_ONCE / WRITE_ONCE

On 29/11/2018 08:04, Juri Lelli wrote:

[ ... ]

>> With or without this patch, it is the case:
>>
>>                 task1                      task2
>>                   |                          |
>>   read("/sys/.../cpu1/cpu_capacity)          |
>>                   |                  write("/sys/.../cpu1/cpu_capacity")
>>   read("/sys/.../cpu2/cpu_capacity)          |
>>
>>
>> There is no guarantee userspace can have a consistent view of the
>> capacity. As soon as it reads a capacity, it can be changed in its back.
> 
> True, but w/o the mutex task1 could read different cpu_capacity values
> for a cluster (it actually can also with current implementation, we
> should grab the mutex in the read path as well if we want to avoid
> this). 

Even if the mutex is on the read path, the userspace can see different
capacities because it will read the cpu_capacity per cpu directory.

The mutex will be take when reading cpu0/cpu_capacity, not for
cpu[0-9]/cpu_capacity. Between two reads, a write can happen because the
lock is released in between.

Do you agree with the patch ? Or do you want me to drop it ?

-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ