Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fstatat() not intercepted (with glibc >= 2.33?) #477

Open
mgorny opened this issue Sep 26, 2024 · 0 comments
Open

fstatat() not intercepted (with glibc >= 2.33?) #477

mgorny opened this issue Sep 26, 2024 · 0 comments

Comments

@mgorny
Copy link

mgorny commented Sep 26, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant