- x86_64  EL7: DFORCE_MONOTONIC_FIX
  aarch64 EL7: DFORCE_MONOTONIC_FIX and FORCE_PTHREAD_NONVER
  ppc64le EL7: DFORCE_MONOTONIC_FIX and FORCE_PTHREAD_NONVER
  ppc64le F30+ FORCE_PTHREAD_NONVER
This commit is contained in:
Warren Togami 2019-08-29 11:15:14 -07:00
parent 5d291a7459
commit 44caf292ef
6 changed files with 62 additions and 90 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/libfaketime-0.9.6.tar.gz
/libfaketime-0.9.8.tar.xz

View File

@ -1,13 +0,0 @@
diff --git a/src/libfaketime.c b/src/libfaketime.c
index 3ec372b..f70283b 100644
--- a/src/libfaketime.c
+++ b/src/libfaketime.c
@@ -1380,7 +1380,7 @@ void __attribute__ ((constructor)) ftpl_init(void)
real_clock_get_time = dlsym(RTLD_NEXT, "clock_get_time");
real_clock_gettime = apple_clock_gettime;
#else
- real_clock_gettime = dlsym(RTLD_NEXT, "clock_gettime");
+ real_clock_gettime = dlsym(RTLD_NEXT, "__clock_gettime");
#ifdef FAKE_TIMERS
real_timer_settime_22 = dlvsym(RTLD_NEXT, "timer_settime","GLIBC_2.2");
real_timer_settime_233 = dlvsym(RTLD_NEXT, "timer_settime","GLIBC_2.3.3");

View File

@ -1,64 +0,0 @@
From 628c70a67a94b3020cab79171545721dfd295fcd Mon Sep 17 00:00:00 2001
From: Mario Pareja <pareja.mario@gmail.com>
Date: Fri, 9 Jan 2015 18:15:53 +0000
Subject: [PATCH] Begin adding CLOCK_BOOTTIME support.
---
src/faketime_common.h | 2 ++
src/libfaketime.c | 9 ++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/faketime_common.h b/src/faketime_common.h
index ee0d627..7de6cd8 100644
--- a/src/faketime_common.h
+++ b/src/faketime_common.h
@@ -32,6 +32,8 @@ struct system_time_s
struct timespec mon;
/* System time according to CLOCK_MONOTONIC_RAW */
struct timespec mon_raw;
+ /* System time according to CLOCK_BOOTTIME */
+ struct timespec boot;
};
/* Data shared among faketime-spawned processes */
diff --git a/src/libfaketime.c b/src/libfaketime.c
index f4a26be..121bbf6 100644
--- a/src/libfaketime.c
+++ b/src/libfaketime.c
@@ -208,7 +208,7 @@ static int cache_duration = 10; /* cache fake time input for 10 seconds */
* Static timespec to store our startup time, followed by a load-time library
* initialization declaration.
*/
-static struct system_time_s ftpl_starttime = {{0, -1}, {0, -1}, {0, -1}};
+static struct system_time_s ftpl_starttime = {{0, -1}, {0, -1}, {0, -1}, {0, -1}};
static char user_faked_time_fmt[BUFSIZ] = {0};
@@ -319,6 +319,7 @@ static void system_time_from_system (struct system_time_s * systime)
DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_REALTIME, &systime->real));
DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_MONOTONIC, &systime->mon));
DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_MONOTONIC_RAW, &systime->mon_raw));
+ DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_BOOTTIME, &systime->boot));
#endif
}
@@ -1834,6 +1835,9 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp)
case CLOCK_MONOTONIC_RAW:
timespecsub(tp, &ftpl_starttime.mon_raw, &tmp_ts);
break;
+ case CLOCK_BOOTTIME:
+ timespecsub(tp, &ftpl_starttime.boot, &tmp_ts);
+ break;
default:
printf("Invalid clock_id for clock_gettime: %d", clk_id);
exit(EXIT_FAILURE);
@@ -1973,6 +1977,9 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp)
case CLOCK_MONOTONIC_RAW:
timespecsub(tp, &ftpl_starttime.mon_raw, &tdiff);
break;
+ case CLOCK_BOOTTIME:
+ timespecsub(tp, &ftpl_starttime.boot, &tdiff);
+ break;
default:
printf("Invalid clock_id for clock_gettime: %d", clk_id);
exit(EXIT_FAILURE);

View File

@ -0,0 +1,26 @@
From 108370f850e5efd18f4989370cdc6ea6a2f74206 Mon Sep 17 00:00:00 2001
From: Wolfgang Hommel <wolfgang.hommel@unibw.de>
Date: Thu, 29 Aug 2019 09:55:04 +0200
Subject: [PATCH] Adds FORCE_PTHREAD_NONVER flag for platforms where pthread
functions are not intercepted
---
src/libfaketime.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libfaketime.c b/src/libfaketime.c
index 5e7ebdf..b70a3d3 100644
--- a/src/libfaketime.c
+++ b/src/libfaketime.c
@@ -3157,7 +3157,7 @@ int pthread_cond_timedwait_232(pthread_cond_t *cond, pthread_mutex_t *mutex, con
}
__asm__(".symver pthread_cond_timedwait_225, pthread_cond_timedwait@GLIBC_2.2.5");
-#ifdef __ARM_ARCH
+#if defined __ARM_ARCH || defined FORCE_PTHREAD_NONVER
__asm__(".symver pthread_cond_timedwait_232, pthread_cond_timedwait@@");
__asm__(".symver pthread_cond_init_232, pthread_cond_init@@");
__asm__(".symver pthread_cond_destroy_232, pthread_cond_destroy@@");
--
2.21.0

View File

@ -1,14 +1,15 @@
Summary: Manipulate system time per process for testing purposes
Name: libfaketime
Version: 0.9.6
Release: 9%{?dist}
Version: 0.9.8
Release: 3%{?dist}
License: GPLv2+
Url: http://www.code-wizards.com/projects/libfaketime/
Source: http://www.code-wizards.com/projects/%{name}/%{name}-%{version}.tar.gz
Patch1: libfaketime-0.9.5-fix-infinite-recursion-on-real_clock_gettime.patch
Patch2: libfaketime-0.9.6-boottime.patch
Url: https://github.com/wolfcw/libfaketime
Source: libfaketime-0.9.8.tar.xz
Patch0: libfaketime-0.9.8-FORCE_PTHREAD_NONVER.patch
BuildRequires: gcc
BuildRequires: perl-interpreter
BuildRequires: perl-Time-HiRes
%description
libfaketime intercepts various system calls which programs use to
retrieve the current date and time. It can then report faked dates and
@ -18,15 +19,29 @@ time system- wide.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
# work around from upstream for autodetecting glibc version bug on i686
sed -i -e 's/__asm__(".symver timer_gettime_22/\/\/__asm__(".symver timer_gettime_22/' src/libfaketime.c
sed -i -e 's/__asm__(".symver timer_settime_22/\/\/__asm__(".symver timer_settime_22/' src/libfaketime.c
%patch0 -p1
%build
cd src ; CFLAGS="%{optflags} -Wno-nonnull-compare -Wno-strict-aliasing" make %{?_smp_mflags} \
cd src
%if 0%{?el7}
%ifarch x86_64
echo "old glibc https://github.com/wolfcw/libfaketime/issues/202"
export FAKETIME_COMPILE_CFLAGS="-DFORCE_MONOTONIC_FIX"
%endif
%ifarch aarch64 ppc64le
echo "old glibc and pthread_nonver https://github.com/wolfcw/libfaketime/issues/205"
export FAKETIME_COMPILE_CFLAGS="-DFORCE_MONOTONIC_FIX -DFORCE_PTHREAD_NONVER"
%endif
%else
%ifarch ppc64le
echo "pthread_nonver https://github.com/wolfcw/libfaketime/issues/204"
export FAKETIME_COMPILE_CFLAGS="-DFORCE_PTHREAD_NONVER"
%else
unset FAKETIME_COMPILE_CFLAGS
%endif
%endif
CFLAGS="%{optflags} -Wno-nonnull-compare -Wno-strict-aliasing" make %{?_smp_mflags} \
PREFIX="%{_prefix}" LIBDIRNAME="/%{_lib}/faketime" all
%check
@ -46,6 +61,13 @@ chmod a+rx %{buildroot}/%{_libdir}/faketime/*.so.*
%{_mandir}/man1/*
%changelog
* Wed Aug 28 2019 Warren Togami <warren@blocksream.com> - 0.9.8-3
- 0.9.8
- x86_64 EL7: DFORCE_MONOTONIC_FIX
aarch64 EL7: DFORCE_MONOTONIC_FIX and FORCE_PTHREAD_NONVER
ppc64le EL7: DFORCE_MONOTONIC_FIX and FORCE_PTHREAD_NONVER
ppc64le F30+ FORCE_PTHREAD_NONVER
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.6-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

View File

@ -1 +1 @@
f522f899d65a057ad69cff9896c75f78 libfaketime-0.9.6.tar.gz
SHA512 (libfaketime-0.9.8.tar.xz) = 6b0deab7aea6b68c3a1e77c022d7a907b7337f75cfce510044c239c7f789e73ed5f1ee3b23ea5b6c8b0cb723c41ed95c1dd9738cca49b9c9840b9022fbfb57b1