[Letux-kernel] MIPS: bug: gettimeofday syscall broken on CI20 board

H. Nikolaus Schaller hns at goldelico.com
Thu Nov 28 16:42:01 CET 2019

> Am 28.11.2019 um 15:01 schrieb Vincenzo Frascino <vincenzo.frascino at arm.com>:
>> What still does not fit into the picture is the errno = 1 i.e. EPERM.
>> Maybe I have to study the libc code that tries to read the ELF symbols
>> you have mentioned. It may fail for unknown reasons.
> This is what I was going to suggest next. It might be that something is not
> working there.
> Let us know your findings.

Well, my findings are that the gettimeofday() function in glibc-2.24 (used by
Debian Stretch) is simple:

> #include <errno.h>
> #include <sys/time.h>
> #undef __gettimeofday
> # define HAVE_VSYSCALL
> #endif
> #include <sysdep-vdso.h>
> /* Get the current time of day and timezone information,
>    putting it into *tv and *tz.  If tz is null, *tz is not filled.
>    Returns 0 on success, -1 on errors.  */
> int
> __gettimeofday (struct timeval *tv, struct timezone *tz)
> {
>   return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
> }
> libc_hidden_def (__gettimeofday)
> weak_alias (__gettimeofday, gettimeofday)
> libc_hidden_weak (gettimeofday)

but the macro INLINE_VSYSCALL is not immediately understandable.

So I have no idea how to patch the kernel to check why that
sets errno. And patching libc is beyond my range of experience.

It is only clear that your kernel patch did break it for MIPS
(at least for CI20) but for obvious reasons not for ARM.

BTW: kernel v5.4 works with Debian Jessie, i.e. glibc-2.19.
Maybe it triggers a fallback.

BR and thanks,

More information about the Letux-kernel mailing list