JDK using gettimeofday and not clock_gettime?

Rohit Mohta rmohta.coder at gmail.com
Fri Jul 23 17:48:42 UTC 2021


  Yeah it’s a vDSO call. Our tool changes the pointer to vDSO clock_get time to our function to skew time and look at system behavior from integrity standpoint.

I’m running JDK 11 this on RHEL 7.8, will check the change log for the glibc version. 

Rohit Mohta

> On Jul 23, 2021, at 05:23, Florian Weimer <fweimer at redhat.com> wrote:
> * Rohit Mohta:
>>  While developing an in-house tool on system time related manipulation, we
>> learnt Java uses gettimeofday() on linux-x86_64 system call for fetching
>> System.currentTimeMillis().
> You should not see any system call at all.  The call should go to the
> vDSO and handled in userspace.
> In current glibc, the implementation of gettimeofday is based on
> clock_gettime (with CLOCK_REALTIME).  Calling clock_gettime directly
> would avoid converting from nanoseconds to milliseconds in two stages, I
> guess, but that's the only difference.
> Thanks,
> Florian

More information about the jdk-dev mailing list