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>] [day] [month] [year] [list]
Date:   Fri, 17 Nov 2017 11:35:25 +0000
From:   "Arayuru, Rajendra" <Rajendra.Arayuru@....com>
To:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: schedule_delayed_work off by one jiffy

Hi,

We are using Kernel 4.10.0-19-generic. In one of our test drivers, we assign a task to the global work queue, using schedule_delayed_work().  

The issue we observe, is that when we call schedule_delayed_work(task, n)  with delay of "n" jiffies, the task is getting scheduled after a delay of "n+1" and not "n" jiffies as expected.

This worked fine till the kernel version 4.4.0-87-generic. The observation is on kernel 4.10.0-19-generic and above. 

A sample test code to highlight the difference between the kernel is given below:

        static struct tq_struct g_Task = { routine:interrupt_handler,  data:NULL };

        static void interrupt_handler( struct work_struct *irrelevant )  {
                printk("check 1 Jiffies: %llu \n", get_jiffies_64());	
                schedule_delayed_work( &g_Task, 1);
                printk("Check 2 Jiffies: %llu \n", get_jiffies_64());	
        }

The dmesg output on 4.10 is as below (diff of 2 jiffies)
    [ 1047.975259] check 1 Jiffies: 4295153276
    [ 1047.975263] Check 2 Jiffies: 4295153276
    [ 1047.983255] check 1 Jiffies: 4295153278
    [ 1047.983259] Check 2 Jiffies: 4295153278
    [ 1047.991255] check 1 Jiffies: 4295153280
    [ 1047.991260] Check 2 Jiffies: 4295153280

The dmesg output on 4.4 is as below (diff of 1 jiffies)
    [  830.490657] check 1 Jiffies: 4295098955
    [  830.490664] Check 2 Jiffies: 4295098955
    [  830.494657] check 1 Jiffies: 4295098956
    [  830.494667] Check 2 Jiffies: 4295098956
    [  830.498656] check 1 Jiffies: 4295098957
    [  830.498663] Check 2 Jiffies: 4295098957

Thanks,
Rajendra

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ