summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix #424HEADmasterWolfgang Hommel2023-04-301-1/+1
|
* Swapped out pthread_rwlock_xxlock(), which doesn't return if it can't obtain ↵Dixin Fan2023-02-241-9/+9
| | | | the lock, with pthread_rwlock_xxtrylock() followed by sched yield and error code return. The issue is sometimes a thread calling pthread_cond_init() or pthread_cond_destroy() can't acquire the lock when another thread is waiting on a condition variable notification via pthread_cond_timedwait(), and thus the thread calling pthread_cond_init() or pthread_cond_destroy() end up hanging indefinitely.
* ensure faketime can't be initialized more than onceValentin Gatien-Baron2023-01-161-133/+41
| | | | | | | | | | | | One callsite of ftpl_init wasn't protected by the "if (!initialized)" condition, specifically: static void ftpl_init (void) __attribute__ ((constructor)); If another "constructor" was called before this one, and that other constructor used time or filesystem functions, ftlp_init would be initialized by that other constructor, and then reinitialized by the ftpl_init constructor. At that point, confusion ensues.
* libfaketime.c: wrap timespec_get in TIME_UTC macroSamuel Tam2022-12-201-0/+8
| | | | | | | | | | Function `timespec_get` is not guaranteed to be declared in MacOS since its standard library is non-conformance to modern standards. Therefore, skip patching `timespec_get` if it is undeclared by the standard library. The detection of `timespec_get` is based on the conjecture that the macro `TIME_UTC` is only defined when `timespec_get` is declared.
* Fix for Debian Bug#1017865 as provided by Samuel ThibaultWolfgang Hommel2022-08-281-3/+3
|
* Handle short reads from timestamp fileDag Lem2022-08-221-2/+6
|
* Merge pull request #404 from perldude/perldude-issue-403Wolfgang Hommel2022-07-251-0/+3
|\ | | | | issue#403
| * issue#403Michael Sullivan2022-07-251-0/+3
| | | | | | | | Disable including `sys/time.h` on ARM to prevent conflicting declarations of `gettimeofday()`.
* | Merge pull request #397 from j-xella/sun_compilerWolfgang Hommel2022-07-251-9/+24
|\ \ | |/ |/| Refactor to get rid of some non-standard gcc extensions
| * Refactor to get rid of some non-standard gcc extensionsAleksandr Jakusev2022-05-261-9/+24
| | | | | | | | | | | | | | | | Without the changes Sun studio 12.8 compiler fails, for example Note that only the errors are fixed. On the compiler above, some warnings still remain, so -Werror has to be removed as well from the compiler switches in order for the compilation to succeed.
* | Reset shared memory when start time is resetStéphane Veyret2022-06-171-2/+21
|/
* honor dont_fake_monotonic in experimental sem_clockwait() (addresses #390)Wolfgang Hommel2022-05-161-0/+6
|
* fix reverse user_rate in sem_clockwait() (addresses #390)Wolfgang Hommel2022-05-141-6/+6
|
* Experimental sem_clockwait() support (addresses #390)Wolfgang Hommel2022-05-111-0/+50
|
* Fix another hang under ASANUli Schlachter2022-05-091-28/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a long-running program that we want to run under sanitizers for extra error checking and under faketime to speed up the clock. This program hangs after a while. Backtraces suggest that the hangs occur because of recursion in the memory allocator, which apparently locks a non-recursive mutex. Specifically, what we see is that due to our use of FAKETIME_NO_CACHE=1, libfaketime wants to reload the config file inside a (random) call to clock_gettime(). libfaketime then uses fopen() / fclose() for reading the config files. These function allocate / free a buffer for reading data and specifically the call to free() that happens inside fclose() ends up calling clock_gettime() again. At this point, libfaketime locks up because it has a time_mutex that is locked and none-recursive. Sadly, I did not manage to come up with a stand-alone reproducer for this problem. Also, the above description is from memory after half a week of vacation, so it might be (partially) wrong. More information can be found here: - https://github.com/wolfcw/libfaketime/issues/365#issuecomment-1115802530 - https://github.com/wolfcw/libfaketime/issues/365#issuecomment-1116178907 This commit first adds a test case. This new test uses the already existing libmallocintercept.so to cause calls to clock_gettime() during memory allocation routines. The difference to the already existing version is that additionally FAKETIME_NO_CACHE and FAKETIME_TIMESTAMP_FILE are set. This new test hung with its last output suggesting a recursive call to malloc: Called malloc() from libmallocintercept...successfully Called free() on from libmallocintercept...successfully Called malloc() from libmallocintercept...Called malloc() from libmallocintercept... Sadly, gdb was unable to provide a meaningful backtrace for this hang. Next, I replaced the use of fopen()/fgets()/fgets() with open()/read()/close(). This code no longer reads the config file line-by-line, but instead it reads all of it at once and then "filters out" the result (ignores comment lines, removes end of line markers). I tried to keep the behaviour of the code the same, but I know at least one difference: Previously, the config file was read line-by-line and lines that began with a comment character were immediately ignored. The new code only reads the config once and then removes comment lines. Since the buffer that is used contains only 256 characters, it is possible that config files that were previously parsed correctly now longer parse. A specific example: if a file begins with 500 '#' characters in its first line and then a timestamp in the second line, the old code was able to parse this file while the new code would only see an empty file. After this change, the new test no longer hangs. Sadly, I do not actually know its effect on the "actual bug" that I wanted to fix, but since there are no longer any calls to fclose(), there cannot be any hangs inside fclose(). Signed-off-by: Uli Schlachter <psychon@znc.in>
* Disable FAILRE_PRE_INIT_CALLS by defaultUli Schlachter2022-05-081-6/+6
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* Add FAIL_PRE_INIT_CALLS defineUli Schlachter2022-05-042-1/+17
| | | | | | | | | | | | | | This commit adds a new define FAIL_PRE_INIT_CALLS. When that define is set, calls to clock_gettime() that occur before ftpl_init() was called (due to being marked with __attribute__((constructor))) will just fail and return -1. After this commit, the test case added in the previous commit no longer hangs. To make this actually work, this new define is enabled by default. Fixes: https://github.com/wolfcw/libfaketime/issues/365 Signed-off-by: Uli Schlachter <psychon@znc.in>
* Honor tv_nsec in timeouts on ppoll() calls (addresses #381)Wolfgang Hommel2022-04-021-1/+1
|
* select(): Scale timeout parameter by user rate on return (addresses #382)Wolfgang Hommel2022-04-021-0/+15
|
* fixes #374 fix compiling without FAKE_STATIan Norton2022-03-181-4/+10
|
* Limit glibc auto-sensing to compilation on glibc systems (addresses #369)Wolfgang Hommel2022-02-281-6/+8
|\
| * Exclude glibc versioning on macOS; bump autosense lower threshold to 2.24Wolfgang Hommel2022-02-261-8/+10
| |
* | Limit glibc auto-sensing to compilation on glibc systems (addresses #369)Wolfgang Hommel2022-02-281-0/+11
|/
* dynamic forced monotonic fix autosense (addresses #366)Wolfgang Hommel2022-02-251-2/+17
|
* run-time envvar FAKETIME_FORCE_MONOTONIC_FIX, autosense stub (addresses #366)Wolfgang Hommel2022-02-251-3/+42
|
* Honor x/i flags also with frozen faketime stamps (closes #360)Wolfgang Hommel2022-02-201-0/+1
|
* faketime wrapper complains when env vars are set unless comp/w SILENT ↵Wolfgang Hommel2022-02-202-0/+10
| | | | (closes #307)
* Version bump to 0.9.10 (prepares for #366)Wolfgang Hommel2022-02-203-4/+4
|
* Further dyld interposing for macOS Monterey support (addresses #357)Wolfgang Hommel2022-02-202-20/+135
|
* Merge pull request #363 from sirainen/new-callsWolfgang Hommel2022-02-181-330/+103
|\ | | | | Add fstat(), stat() and lstat() calls
| * Add fstat(), stat() and lstat() callsTimo Sirainen2022-02-161-0/+21
| |
| * Implement all stat-like functions with STAT_HANDLER() and STAT64_HANDLER() ↵Timo Sirainen2022-02-161-169/+37
| | | | | | | | macros
| * Check missing real_* functions using CHECK_MISSING_REAL() macroTimo Sirainen2022-02-161-154/+38
| |
| * Fix disabling all *stat*() faking during initializationTimo Sirainen2022-02-161-7/+7
| | | | | | | | Only __xstat() variant was handling the dont_fake variable.
| * Rename real_*stat* variables to correspond to the actual function namesTimo Sirainen2022-02-161-32/+32
| |
* | Additional dyld interposing for macOS Monterey support (addresses #357)Wolfgang Hommel2022-02-162-5/+72
|/
* Merge branch 'macos'Wolfgang Hommel2022-02-062-1/+139
|\
| * Change dyld interposing for basic macOS Monterey support (addresses #357)Wolfgang Hommel2022-02-062-1/+139
| |
* | Avoid spurious "Success" error message.Daniel Kahn Gillmor2022-02-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | strptime(3) doesn't set errno, so when it was failing, calling perror() meant producing messages like: Failed to parse FAKETIME timestamp: Success Rather than use perror(), just send the warning message directly to stderr. This was first reported in https://bugs.debian.org/939789
* | stackoverflow uses httpsDaniel Kahn Gillmor2022-02-041-1/+1
|/
* add explicit data type conversion to avoid integer overflowluochunbei2021-10-101-1/+1
|
* Fix codestyle deviationsa13460542021-09-212-8/+8
|
* Fix spellinga13460542021-09-212-3/+3
|
* fix do/while guard for DONT_FAKE_TIME macroGranBurguesa2021-09-171-1/+1
| | | | | the newer version gcc warns `this ‘while’ clause does not guard... [-Werror=misleading-indentation]`. looks like the author just omitted the `do` and the `while(0) counts as a separate statement. in practice this isn't causing any actual problem now afaict.
* add a build variable to opt-out of some behaviorsValentin Gatien-Baron2021-08-012-0/+18
| | | | | | Specifically behaviors that increase the chance that a wrapped program will not behave like an unwrapped program does, thus causing reliability issues.
* try to clarify the help of a couple of compilatoin variablesValentin Gatien-Baron2021-08-011-3/+4
|
* group cpp variables according to whether they are set by defaultValentin Gatien-Baron2021-08-011-18/+20
|
* wrap timespec_getValentin Gatien-Baron2021-07-301-0/+36
|
* Fix in __xstat regarding dont_fake handlingWolfgang Hommel2021-06-221-3/+4
|
* Do not cache '%' in parse_ft_string (addresses #337)Wolfgang Hommel2021-06-221-1/+1
|