Re: [patch 2/2] alarm unsigned signed conversion fixup
From: Thomas Gleixner
Date: Sat Mar 18 2006 - 14:59:16 EST
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
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.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/