settimeofday¶
Intro¶
settimeofday - sets the system's time and date, and optional timezone
Description¶
The settimeofday() system call is used to set the system's time, and optionally also the timezone if the tz parameter is not NULL. This is usually used when synchronizing the system's time with an external time source. In order to set the timezone, there must also be an associated time value. When setting the time only, the tz parameter should be NULL.
There are some caveats when it comes to setting the time or the timezone. The kernel will not accept values which are out of valid ranges, or are otherwise invalid. Additionally, there can be side effects depending on the system where settimeofday() is called. For example, on some systems setting the time may cause certain user tasks to be interrupted.
Arguments¶
tv
:const struct timeval*
[K] - Pointer to const struct timeval. Should contain the desired time to be set.tz
:const struct timezone*
[K] - Pointer to const struct timezone. Should contain the desired timezone to be set.
Available Tags¶
- K - Originated from kernel-space.
Hooks¶
settimeofday¶
Type¶
kprobe
Purpose¶
Monitoring timezone changes and time changes
Example Use Case¶
One can use settimeofday() to monitor changes in system time or timezone.
Issues¶
settimeofday() is vulnerable to TOCTOU (time of check, time of use) attacks.
Related Events¶
setitimer() - set interval timer
This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.