public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* sys_times() return value
@ 2005-07-17 23:24 Russell King
  2005-07-23  5:35 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King @ 2005-07-17 23:24 UTC (permalink / raw)
  To: linux-kernel

Guys,

ARM folk have recently pointed out a problem with sys_times().
When the kernel 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.  Hopefully the ARM
glibc folk will raise a cross-architecture bug in glibc for this.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sys_times() return value
  2005-07-17 23:24 sys_times() return value Russell King
@ 2005-07-23  5:35 ` Andrew Morton
  2005-07-29 10:37   ` Russell King
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2005-07-23  5:35 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel

Russell King <rmk+lkml@arm.linux.org.uk> wrote:
>
> Guys,
> 
> ARM folk have recently pointed out a problem with sys_times().
> When the kernel 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.

What a strange system call.

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

I'd say so, yes.  But lots of architectures seem to have a no-op there.

> 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.  Hopefully the ARM
> glibc folk will raise a cross-architecture bug in glibc for this.
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sys_times() return value
  2005-07-23  5:35 ` Andrew Morton
@ 2005-07-29 10:37   ` Russell King
  0 siblings, 0 replies; 3+ messages in thread
From: Russell King @ 2005-07-29 10:37 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

On Sat, Jul 23, 2005 at 03:35:31PM +1000, Andrew Morton wrote:
> Russell King <rmk+lkml@arm.linux.org.uk> wrote:
> > ARM folk have recently pointed out a problem with sys_times().
> > When the kernel 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.
> 
> What a strange system call.
> 
> > This probably only affects 32-bit architectures.  However, one
> > wonders whether sys_times() needs force_successful_syscall_return().
> 
> I'd say so, yes.  But lots of architectures seem to have a no-op there.

As I mentioned below, these other architectures need glibc to be fixed.

> > 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.  Hopefully the ARM
> > glibc folk will raise a cross-architecture bug in glibc for this.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-07-29 10:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-17 23:24 sys_times() return value Russell King
2005-07-23  5:35 ` Andrew Morton
2005-07-29 10:37   ` Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox