On Wed, Aug 30, 2006 at 10:44:28AM +0200, Thomas Gleixner wrote: > Frank v. Waveren pointed out that on 64bit machines the timespec to > ktime_t conversion might overflow. This is also true for timeval to > ktime_t conversions. This breaks a "sleep inf" on 64bit machines. ... > Check the seconds argument to the conversion and limit it to the maximum > time which can be represented by ktime_t. It's a solution, and it more or less fixes things without any changes to userspace, which is nice. I still prefer my patch in <[email protected]> though, possibly with modifications so it doesn't affect all timespec users but only nanosleep (we'd have to check if the other timespec users aren't converting to ktime_t). With this patch, we sleep shorter than specified, and don't signal this in any way. Returning EINVAL for anything except negative tv_sec or invalid tv_nsec breaks the spec too, but I prefer errors to silently sleeping too short. I'll grant this is more of an aesthetic point than something that'll cause real-world problems (300 years is a long time for any sleep), but if things break I like them to do so as loudly as possible, as a general rule. -- Frank v Waveren Key fingerprint: BDD7 D61E [email protected] 5D39 CF05 4BFC F57A Public key: hkp://wwwkeys.pgp.net/468D62C8 FA00 7D51 468D 62C8
Attachment:
signature.asc
Description: Digital signature
- Follow-Ups:
- Re: [PATCH] prevent timespec/timeval to ktime_t overflow
- From: Thomas Gleixner <[email protected]>
- Re: [PATCH] prevent timespec/timeval to ktime_t overflow
- References:
- [PATCH] prevent timespec/timeval to ktime_t overflow
- From: Thomas Gleixner <[email protected]>
- [PATCH] prevent timespec/timeval to ktime_t overflow
- Prev by Date: Re: [PATCH 17/17] BLOCK: Make it possible to disable the block layer [try #2]
- Next by Date: Re: Ultra Sparc T1 port
- Previous by thread: [PATCH] prevent timespec/timeval to ktime_t overflow
- Next by thread: Re: [PATCH] prevent timespec/timeval to ktime_t overflow
- Index(es):