Bug 1176 - sys_times return value
Summary: sys_times return value
Status: RESOLVED INVALID
Alias: None
Product: glibc
Classification: Unclassified
Component: ports (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: GOTO Masanori
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-05 13:06 UTC by Carl van Schaik
Modified: 2019-04-10 10:03 UTC (History)
2 users (show)

See Also:
Host: i386-linux-gnu
Target: arm-linux-gnu
Build: arm-linux-gnu
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carl van Schaik 2005-08-05 13:06:55 UTC
Quoting Russell King's explaination of original bug I filed.

ARM folk have recently pointed out a problem with sys_times().
When the kernel (2.6) boots, we set jiffies to -5 minutes. This causes
sys_times() to return a negative number, which increments through
zero.

However, some negative numbers are used to return error codes.
Hence, there's a period of time when sys_times() returns values
which are indistinguishable from error codes shortly after boot.

This probably only affects 32-bit architectures. However, one
wonders whether sys_times() needs force_successful_syscall_return().

Also, it appears that glibc does indeed interpret the return value
from sys_times in the way I describe above on at least ARM and x86.
Other architectures may be similarly affected.
Comment 1 Roland McGrath 2006-02-06 03:36:59 UTC
This is a kernel problem.  The kernel should not return negative values unless
it's due to true overflow.  I'd say the kernel ought to subtract INITIAL_JIFFIES
when converting to clock_t for sys_times.  But at any rate, it is not something
glibc can do anything about.