public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* sys_gettimeofday racy or not?
@ 2004-06-25  0:20 Wichert Akkerman
  2004-06-25  4:53 ` Chris Friesen
  0 siblings, 1 reply; 2+ messages in thread
From: Wichert Akkerman @ 2004-06-25  0:20 UTC (permalink / raw)
  To: linux-kernel

This just happened to catch my eye and it's probably perfectly
valid, but if so please educate me on why it is. In kernel/time.c
sys_gettimeofday() there is this code:

        if (unlikely(tz != NULL)) {
                if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
                        return -EFAULT;
        }

what prevents sys_tz from being changed while this code runs?

Wichert.

-- 
Wichert Akkerman <wichert@wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.

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

* Re: sys_gettimeofday racy or not?
  2004-06-25  0:20 sys_gettimeofday racy or not? Wichert Akkerman
@ 2004-06-25  4:53 ` Chris Friesen
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Friesen @ 2004-06-25  4:53 UTC (permalink / raw)
  To: Wichert Akkerman; +Cc: linux-kernel

Wichert Akkerman wrote:
> This just happened to catch my eye and it's probably perfectly
> valid, but if so please educate me on why it is. In kernel/time.c
> sys_gettimeofday() there is this code:
> 
>         if (unlikely(tz != NULL)) {
>                 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
>                         return -EFAULT;
>         }
> 
> what prevents sys_tz from being changed while this code runs?

Nothing at all.

I suspect most people don't worry about it, since its use is deprecated.  The 
man page for gettimeofday() says "The use of the timezone struct is obsolete".

Chris

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

end of thread, other threads:[~2004-06-25  4:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-25  0:20 sys_gettimeofday racy or not? Wichert Akkerman
2004-06-25  4:53 ` Chris Friesen

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