lkml.org 
[lkml]   [2006]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch 2/2] alarm unsigned signed conversion fixup
From
Date
On Sat, 2006-03-18 at 15:18 +0000, Thomas Gleixner wrote:
> plain text document attachment (alarm-fixup-unsigned-signed.patch)
> alarm() calls the kernel with an unsigend int timeout in seconds.
> The value is converted to a timeval which is used to setup the
> itimer. The tv_sec field of the timeval is a long, which causes
> the timeout to be negative on 32 bit machines if seconds > INT_MAX.
> Also this was silently caught before the hrtimer merge.
> To avoid fixups all over the place the duplicated sys_alarm code
> is moved to itimer.c.

Also this needs a better explanation.

The timeval_to_jiffies conversion converted the resulting negative value
to MAX_JIFFIES_PER_LONG.

hrtimer treats the negative value as expired. The valid range for
alarm() is 1 .. UINT_MAX, so ignoring the conversion problem would cause
early expiry and break valid userspace code.

tglx


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-03-18 21:04    [W:0.233 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site