-
Notifications
You must be signed in to change notification settings - Fork 1
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
renameat2 on redhat8 & ubuntu18 #145
Comments
@reidsunderland I reproduced it on ubuntu 18. |
perhaps relevant: https://www.phoronix.com/news/Glibc-2.28-Unicode-11-Renameat2 glibc added the renameat2 routine after the release of these two OS's. |
From the shim_post test, Moving a file when the destination file already exists (works):
Moving a file when the destination does not exist:
From the RENAME(2) man page:
and SYSCALL(2):
@petersilva and I are guessing that
I added a basic implementation of But there's still work to do to get it to call renameorlink when __sysno==316 and the real syscall otherwise. |
fwiw... googling a bit, I found this: https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=c50cf67bd7ff70525f3cb4074f0d9cc1f5c6cf9c
and I think bits/syscalls.h provides SYS_renameat2 |
./x86_64-linux-gnu/asm/unistd_64.h:#define __NR_renameat2 316 |
I have an implementation of renameat2 via syscall() working on branch issue145. The syscall_init_done, syscall_fn_ptr stuff isn't needed if we can't/don't want to try to deal with any syscalls other than 316/renameat2. |
I think the ordinary message needs the syscall number (users usually don't run shimdebug.) when it's not renameat2. I expect we won't run into other such syscalls, but without the ability to run a wide variety of jobs (like the user has), we don't know. Printing the syscall number would be necessary for that eventuality. The other thing is... we need some kind of test or macro for the problem... like: #ifdef MISSING_RENAMEAT2
#endif
then in the compilation flags with -DMISSING_RENAMEAT2 so that we don't include it on newer OS versions. We don't want to override syscall for all future versions, |
last comment deleted... was wrong... ok... so renameorlink does the rename... but how it does it when glibc is missing the renameat2 wrapper might be a problem. we might need an other #ifdef stanza that does syscall( 316... there in place of renameat2. I worry that if flags are non-zero, we won't behave the way the caller expects. |
put the syscall_fn_ptr call in the else. Testing will hopefully reveal if any other syscalls are used. If it's a small number, we can handle them as well. |
After more investigation, I discovered:
Both have support for renameat2 in the kernel (added to the kernel in 3.15). This explains why 3741afc worked on RedHat 8; our implementation of the syscall function called renameorlink, which successfully called renameat2. The problem on RedHat 8 is that its We will control whether we intercept syscall by manually defining INTERCEPT_SYSCALL at compile time.. |
Testing on our own RedHat 8 VM works fine, but now that we've started testing on the HPC RedHat 8 installs, we've found more syscalls that are being intercepted by the shim but not passed along: On ppc:
On x86_64:
Instead of hardcoding the number, we need to include <sys/syscall.h> |
I started writing code to generate the syscall passthroughs, and have found some interesting differences between the man pages and between the function signatures in For example, In the manpage, it does have a note that says:
So I think going with the type defined in syscalls.h is probably the correct thing to do in our case. |
Even with the automatic generation of syscall passthrough code, we still ran into problems. I posted the following internally on GitLab, and thought I should copy it here for documentation:
|
We realized that any other code that uses syscall(...) to call a file operation, like close, rmdir, truncate, etc. would also be ignored by the shim. In the most recent commit (3.24.10p1rc3) I modified those syscalls, so they call the already-implemented corresponding function in libsr3shim (i.e. close(...) for syscall(SYS_close, ...)) that will call the glibc version of the function of the same name and post a message for that operation. |
running mirroring tests, we noticed that some renames are just not caught... ones that use renameat2 ... they are... strange. Running an strace, we see the renameat2 calls happen... but they do not get intercepted as renameat or rename calls do. It just short-circuits the shim library and passes directly to the lower level one.
This is observed on both ubuntu 18, and redhat 8.
It's fine on ubuntu22 and redhat 9.
The text was updated successfully, but these errors were encountered: