| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|\
| |
| | |
faketime.c: default to GNU date as "gdate" on Sun-related OSes
|
| | |
|
|\ \
| | |
| | | |
faketime.c: allow user to select their implementation of GNU date
|
| |/ |
|
|/
|
|
|
| |
For pedantic compilers this is actually a fatal error, since per
(older?) C standards the file should end with an EOL.
|
|
|
|
|
| |
By stating these assumptions in src/faketime_common.h, we can reuse
them in the tests as well as in the code.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
faketime: add -p option to wrapper for setting PID
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I had to decide what to do if FAKE_PID wasn't defined during the
build. I decided that since the wrapper can't be sure it is preloading
the same library that it was built with (someone could somehow mix and
match the library and the wrapper tool), it should just warn and pass
along the value anyway.
This reserves the option space, but shouldn't annoy people too much if
they are running it on a system that doesn't have FAKE_PID enabled.
I note that this happens regardless of whether it is a "direct"
invocation or not. I don't fully understand all the tradeoffs here,
so I would appreciate another set of eyes reviewing this choice.
Closes: #308
|
|/
|
|
|
| |
Without this fix, the test_library_constructors test was failing on
use_lib_syscall.
|
| |
|
|
|
|
| |
This addresses part of the concerns raised in #297
|
|\
| |
| | |
better testing for interception of randomness from the kernel, including getentropy()
|
| |
| |
| |
| | |
Closes: #303
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an attempt at an implementation to address #301.
Some things worth noting:
- I am not particularly confident in my reverse of the variadic C
ABI. While the code appears to work for me on x86_64, I could
imagine some variations between platforms that I'm not
understanding.
- This works to intercept the invocation of syscall as seen in
test/syscalltest.sh, as long as it was compiled with -DFAKE_RANDOM
- defining -DINTERCEPT_SYSCALL on non-Linux platforms should result
in a compile-time error.
- This does *not* work to intercept the syscall sent by `openssl
rand`, for some reason I don't yet understand. Perhaps openssl has
some platform-specific syscall mechanism that doesn't route them
through libc's syscall() shim?
|
|\
| |
| | |
Enable intercepting getpid()
|
| |
| |
| |
| |
| |
| |
| | |
I went with the runtime environment variable being FAKETIME_FAKEPID
since it seems less likely to collide with anything else.
Closes: #297
|
|/
|
|
|
|
|
|
|
| |
This avoids potential failure if another library calls getrandom()
within its constructor before we are loaded.
For me, it lets "make randomtest" succeed in tests/
Closes: #295
|
| |
|
| |
|
|\
| |
| | |
Try to fix warning about clobbering under optimization (Closes #284)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Without this fix, when compiling with `-O1` or more, we see:
```
libfaketime.c: In function ‘fake_clock_gettime’:
libfaketime.c:2843:7: error: variable ‘ret’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
2843 | int ret = INT_MAX;
| ^~~
cc1: all warnings being treated as errors
```
This error doesn't happen when using `-O0`.
The warning appears to happen when the compiler optimizes `ret`
because it is the return value for the function call (meaning maybe
preserved in a register, or some other more risky placement that might
break during the `goto` error cases?). Explicitly marking it as
volatile should keep the compiler from optimizing that way, regardless
of the level of optimization the user asks for.
I got the idea to use `volatile` here from the rather confused
discussion in
https://cboard.cprogramming.com/c-programming/147829-help-me-warning-argument-fmtstring-might-clobbered-longjmp-vfork.html
I admit I don't fully understand what's going on here, and would be
grateful for review by someone who understands the machinery here at a
deeper level than I do.
|
|/ |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Fix the utime() and utimes() functions to work with a NULL arg
(which is a request for "now").
- Add missing utimensat() & futimens() functions.
- Add support for a FAKE_UTIME define and enable it by default. This
is like defining FAKE_FILE_TIMESTAMPS except that the code defaults
to NO utime faking unless FAKE_UTIME environment var enables it.
- When utime values are not being faked, the use of a NULL arg or a
UTIME_NOW nsec value gives the user NOW translated into their fake
current time. This is because the caller's fake times are otherwise
being preserved, so we should help their NOW request also be handled
as a fake time.
- Mention FAKE_FILE_TIMESTAMPS & FAKE_UTIME in the src/Makefile.
- Move a sanity check in fake_clock_gettime() to where it is actually
prior to all the pointer dereferences it should protect.
- Get rid of an errant tab in the src/Makefile's comments.
|
|\
| |
| | |
Fixes #247, FAKE_SETTIME has effect even if rcfile is present
|
| | |
|
|/
|
|
|
|
|
|
| |
When the environment variable FAKETIME_TIMESTAMP_FILE is set, points to
a writeable (creatable) custom config file and the environment variable
FAKETIME_UPDATE_TIMESTAMP_FILE is "1", then the file also is updated on
each call. By this, a common "virtual time" can be shared by several
processes, where each can adjust the time for all.
|
|\
| |
| | |
Add lazy ftpl_init() to pthread_cond_init_232(), fixes #245.
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
|
|
| |
global mutex variable
this fixes the `{ 0 }` initializer not compiling on some platforms
fix issue 231
fix issue 235
|
|
|
|
|
|
|
| |
we're safely inside the mutex.
Otherwise, we might be overwriting the global lock state from two different
threads at once.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These gymnastics are necessary because pthread_cleanup_push
and pthread_cleanup_pop must match exactly 1:1 and appear at
the same level of indentation.
This is because pthread_cleanup_push/pop are implemented in
such a way that pthread_cleanup_push opens a scope and
pthread_cleanup_pop closes it.
They're macros with unbalanced brackets.
C, ladies and gentlemen.
So instead of returning, we have to set a field indicating our
intent to return and then jump to the unlock site.
|
|
|
|
| |
pthread_sigmask is the one meant for threaded programs.
|
| |
|
| |
|
|\
| |
| |
| | |
Refresh the monotonic faketime setting envvar when cache expires.
|
| | |
|
| |
| |
| |
| |
| | |
In 32 bit platforms, timespecmul2() macro function, overflow occurs during multiplication.
Size of `long` type in 32 bit platform is 4 bytes, but the size of `long` type in 64 bit platform is 8 bytes.
|
| | |
|
|/ |
|
| |
|
| |
|
|\
| |
| | |
Automake branch
|
| |\
| | |
| | | |
We no longer need the OSX-specific test. Tests are passing, too.
|