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] [day] [month] [year] [list]
Date:   Fri, 7 Jul 2017 16:44:04 +0800
From:   Wanpeng Li <kernellwp@...il.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Wanpeng Li <wanpeng.li@...mail.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Luiz Capitulino <lcapitulino@...hat.com>,
        Frederic Weisbecker <fweisbec@...il.com>,
        Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH] sched/cputime: Fix using smp_processor_id() in preemptible

2017-07-07 16:11 GMT+08:00 Peter Zijlstra <peterz@...radead.org>:
> On Thu, Jul 06, 2017 at 08:18:41PM -0700, Wanpeng Li wrote:
>> --- a/kernel/sched/cputime.c
>> +++ b/kernel/sched/cputime.c
>> @@ -683,7 +683,7 @@ static u64 vtime_delta(struct vtime *vtime)
>>  {
>>       unsigned long long clock;
>>
>> -     clock = sched_clock_cpu(smp_processor_id());
>> +     clock = sched_clock();
>>       if (clock < vtime->starttime)
>>               return 0;
>>
>
> This is broken. sched_clock_cpu() and sched_clock() do not have the
> exact same value :-/
>
> So this ends up doing:
>
>         vtime->starttime = sched_clock_cpu(cpu);
>
>         /* ... */
>
>         clock = sched_clock();
>
>         delta = clock - vtime->starttime;
>
>
> And you compute a delta using two different clocks.

How about adding preempt_disable/enable() pair around vtime_delta() in
task_cputime()?

Regards,
Wanpeng Li

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ