From 5f5756ccd985cf37efe13532b0747e903e48c996 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Tue, 2 Mar 2021 19:53:07 -0500 Subject: [PATCH] Pass through syscall(__NR_clock_gettime) if FAKERANDOM is unset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If FAKERANDOM is unset, we were still intercepting syscall() and passing it through to clock_gettime, rather than letting it fall through to real_syscall. That would have the effect of diverting syscall(__NR_clock_gettime,…) into the libc invocation of clock_gettime(…) (via real_clock_gettime). While that probably does the same thing, it's probably a mistake to do such a diversion when FAKETIME is unset. --- src/libfaketime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libfaketime.c b/src/libfaketime.c index 071be7b..3076578 100644 --- a/src/libfaketime.c +++ b/src/libfaketime.c @@ -3772,7 +3772,7 @@ long syscall(long number, ...) { } #endif // static int (*real_clock_gettime) (clockid_t clk_id, struct timespec *tp); - if (number == __NR_clock_gettime) { + if (number == __NR_clock_gettime && getenv("FAKETIME")) { clockid_t clk_id; struct timespec *tp; clk_id = va_arg(ap, clockid_t);