[COMMITTED] aarch64: Use an ifunc/VDSO to implement gettimeofday in shared glibc

Szabolcs Nagy szabolcs.nagy@arm.com
Thu Jun 14 13:03:00 GMT 2018


On 22/05/18 21:25, Steve Ellcey wrote:
> Any chance you could add the comments that you think are needed and
> check the patch in?  It seems like you and Adhemerval are both happy
> with the code, it is just the comments (and the test if you want to use
> the nanosleep test instead of adding the new ones) that need fixing.

i removed the test as it cannot really test if vdso is in use or not,
i might do something with ifunc + bindnow testing separately.
committed as:

This patch uses an ifunc to implement gettimeofday in the shared libc.
This is faster compared to the vsyscall mechanism that has to check a
global pointer, demangle it and call it indirectly when the VDSO is
present. Resolving the gettimeofday symbol directly to the VDSO code
is safe because there are no failures that the libc has to handle by
setting errno like in a generic vsyscall (the only failure when the
VDSO code falls back to a syscall is EFAULT, but passing an invalid
pointer is undefined behaviour so returning -EFAULT is fine).

If the kernel supports the VDSO interface we use it for extern calls,
otherwise the old vsyscall method is used which falls back to a syscall.
The static version of gettimeofday continues to use a syscall, libc.so
internal calls use the old vsyscall method.

2018-06-14  Steve Ellcey  <sellcey@caviumnetworks.com>
	    Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c: New file.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vdso_gettimeofday.diff
Type: text/x-patch
Size: 2579 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20180614/320d1b7a/attachment.bin>


More information about the Libc-alpha mailing list