|author||Rich Felker <email@example.com>||2020-01-30 11:25:07 -0500|
|committer||Rich Felker <firstname.lastname@example.org>||2020-01-30 11:25:07 -0500|
remove legacy clock_gettime and gettimeofday from public syscall.h
some nontrivial number of applications have historically performed direct syscalls for these operations rather than using the public functions. such usage is invalid now that time_t is 64-bit and these syscalls no longer match the types they are used with, and it was already harmful before (by suppressing use of vdso). since syscall() has no type safety, incorrect usage of these syscalls can't be caught at compile-time. so, without manually inspecting or running additional tools to check sources, the risk of such errors slipping through is high. this patch renames the syscalls on 32-bit archs to clock_gettime32 and gettimeofday_time32, so that applications using the original names will fail to build without being fixed. note that there are a number of other syscalls that may also be unsafe to use directly after the time64 switchover, but (1) these are the main two that seem to be in widespread use, and (2) most of the others continue to have valid usage with a null timeval/timespec argument, as the argument is an optional timeout or similar.
Diffstat (limited to 'src/internal/syscall.h')
1 files changed, 7 insertions, 0 deletions
diff --git a/src/internal/syscall.h b/src/internal/syscall.h
index d768fb64..0b61f34e 100644
@@ -193,6 +193,13 @@ hidden long __syscall_ret(unsigned long),
#define SYS_sendfile SYS_sendfile64
+#define SYS_clock_gettime SYS_clock_gettime32
+#define SYS_gettimeofday SYS_gettimeofday_time32
/* Ensure that the plain syscall names are defined even for "time64-only"
* archs. These facilitate callers passing null time arguments, and make