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]
Date:	Thu, 09 Nov 2006 11:59:45 +0530
From:	Balbir Singh <balbir@...ibm.com>
To:	Mauricio Lin <mauriciolin@...il.com>
CC:	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: Jiffies wraparound is not treated in the schedstats

Mauricio Lin wrote:
> Hi Balbir,
> 
> Do you know why in the sched_info_arrive() and sched_info_depart()
> functions the calculation of delta_jiffies does not use the time_after
> or time_before macro to prevent  the miscalculation when jiffies
> overflow?
> 
> For instance the delta_jiffies variable is simply calculated as:
> 
> delta_jiffies = now - t->sched_info.last_queued;
> 
> Do not you think the more logical way should be
> 
> if (time_after(now, t->sched_info.last_queued))
>    delta_jiffies = now - t->sched_info.last_queued;
> else
>    delta_jiffies = (MAX_JIFFIES - t->sched_info.last_queued) + now
> 

What's MAX_JIFFIES? Is it MAX_ULONG? jiffies is unsigned long
so you'll have to be careful with unsigned long arithmetic.

Consider that now is 5 and t->sched_info.last_queued is 10.

On my system

perl -e '{printf("%lu\n", -5 + (1<<32) - 1);}'
4294967291

perl -e '{printf("%lu\n", -5 );}'
4294967291


> I have included more variables to measure some issues of schedule in
> the kernel (following schedstat idea) and I noticed that jiffies
> wraparound has led to wrong values, since the user space tool when
> collecting the values is producing negative values.
> 

hmm.. jiffies wrapped around in sched_info_depart()? I've never seen
that happen. Could you post the additions and user space tool to look at?
What additional features are you planning to measure in the scheduler?

> Any comments?
> 
> Can I provide a patch for that?
> 

Please feel free to provide patches, this is open source!!

> BR,
> 
> Mauricio Lin.


-- 

	Balbir Singh,
	Linux Technology Center,
	IBM Software Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ