Open
Description
It looks like libfaketime does not intercept fstatat()
.
This can be reproduced with the following example:
#include <fcntl.h>
#include <sys/stat.h>
#include <stdio.h>
int main() {
struct stat st;
stat("1", &st);
printf("%ld\n", st.st_mtime);
fstatat(AT_FDCWD, "1", &st, 0);
printf("%ld\n", st.st_mtime);
return 0;
}
$ touch 1
$ FAKETIME='2024-01-01 00:00:00' LD_PRELOAD=/tmp/libfaketime/src/libfaketime.so.1 ./a.out
1704063600
1727378293
Apparently the code is referring to __fxstatat*()
but it looks like glibc is using plain fstatat
and fstatat64
since 2.33:
$ readelf -W -s /usr/lib64/libc.so.6 | grep f.*statat
607: 00000000001043f0 50 FUNC WEAK DEFAULT 13 fstatat@@GLIBC_2.33
725: 00000000001043f0 50 FUNC WEAK DEFAULT 13 fstatat64@@GLIBC_2.33
2588: 00000000001163a0 100 FUNC GLOBAL DEFAULT 13 __fxstatat@@GLIBC_2.4
3033: 00000000001163a0 100 FUNC GLOBAL DEFAULT 13 __fxstatat64@@GLIBC_2.4
Metadata
Metadata
Assignees
Labels
No labels