Re: [PATCH v3] x86/vdso: Handle clock_gettime(CLOCK_TAI) in vDSO

From: Florian Weimer
Date: Thu Sep 13 2018 - 15:53:29 EST


On 09/13/2018 09:35 PM, Andy Lutomirski wrote:

Somewhat special, yes, but not overly so, and not in the type-polymorphic sense. We can't give direct access of the vDSO implementation to applications because the kernel does not know about the userspace errno variable. We do that for time on x86_64, where applications call into the vDSO directly, bypassing glibc completely after binding.

If the vDSO adds special helpers for CLOCK_MONOTONIC and CLOCK_REALTIME, I think we can reasonably safely promise that they never fail. (seccomp can obviously break that promise if thereâs no TSC, but I think that seccomp users who do that get to keep both pieces.)

I agree, I thought about the same thing. We already do not return EFAULT for invalid pointers, for obvious reasons. And if the clock ID is fixed, the EINVAL error is impossible.

That would shave off a few nanoseconds more if the calling convention is identical to what glibc exposes to applications. If the vDSO is not available or the symbol is missing, we can provide an implementation based on the current clock_gettime in glibc.

Thanks,
Florian