mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-24 19:45:06 +08:00
7d2aa4bb90
The libc provides a discovery mechanism for vDSO library and its symbols. When a symbol is not exposed by the vDSOs the libc falls back on the system calls. With the introduction of the unified vDSO library on mips this behavior is not honored anymore by the kernel in the case of gettimeofday(). The issue has been noticed and reported due to a dhclient failure on the CI20 board: root@letux:~# dhclient ../../../../lib/isc/unix/time.c:200: Operation not permitted root@letux:~# Restore the original behavior fixing gettimeofday() in the vDSO library. Reported-by: H. Nikolaus Schaller <hns@goldelico.com> Tested-by: H. Nikolaus Schaller <hns@goldelico.com> # CI20 with JZ4780 Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Signed-off-by: Paul Burton <paulburton@kernel.org> Cc: mips-creator-ci20-dev@googlegroups.com Cc: letux-kernel@openphoenux.org Cc: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org
79 lines
1.9 KiB
C
79 lines
1.9 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* MIPS64 and compat userspace implementations of gettimeofday()
|
|
* and similar.
|
|
*
|
|
* Copyright (C) 2015 Imagination Technologies
|
|
* Copyright (C) 2018 ARM Limited
|
|
*
|
|
*/
|
|
#include <linux/time.h>
|
|
#include <linux/types.h>
|
|
|
|
#if _MIPS_SIM != _MIPS_SIM_ABI64
|
|
int __vdso_clock_gettime(clockid_t clock,
|
|
struct old_timespec32 *ts)
|
|
{
|
|
return __cvdso_clock_gettime32(clock, ts);
|
|
}
|
|
|
|
#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
|
|
|
|
/*
|
|
* This is behind the ifdef so that we don't provide the symbol when there's no
|
|
* possibility of there being a usable clocksource, because there's nothing we
|
|
* can do without it. When libc fails the symbol lookup it should fall back on
|
|
* the standard syscall path.
|
|
*/
|
|
int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
|
|
struct timezone *tz)
|
|
{
|
|
return __cvdso_gettimeofday(tv, tz);
|
|
}
|
|
|
|
#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
|
|
|
|
int __vdso_clock_getres(clockid_t clock_id,
|
|
struct old_timespec32 *res)
|
|
{
|
|
return __cvdso_clock_getres_time32(clock_id, res);
|
|
}
|
|
|
|
int __vdso_clock_gettime64(clockid_t clock,
|
|
struct __kernel_timespec *ts)
|
|
{
|
|
return __cvdso_clock_gettime(clock, ts);
|
|
}
|
|
|
|
#else
|
|
|
|
int __vdso_clock_gettime(clockid_t clock,
|
|
struct __kernel_timespec *ts)
|
|
{
|
|
return __cvdso_clock_gettime(clock, ts);
|
|
}
|
|
|
|
#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
|
|
|
|
/*
|
|
* This is behind the ifdef so that we don't provide the symbol when there's no
|
|
* possibility of there being a usable clocksource, because there's nothing we
|
|
* can do without it. When libc fails the symbol lookup it should fall back on
|
|
* the standard syscall path.
|
|
*/
|
|
int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
|
|
struct timezone *tz)
|
|
{
|
|
return __cvdso_gettimeofday(tv, tz);
|
|
}
|
|
|
|
#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
|
|
|
|
int __vdso_clock_getres(clockid_t clock_id,
|
|
struct __kernel_timespec *res)
|
|
{
|
|
return __cvdso_clock_getres(clock_id, res);
|
|
}
|
|
|
|
#endif
|