Closed reidsunderland closed 4 months ago
I also commented out the renameat2_fn_ptr = (renameat2_fn) dlsym(RTLD_NEXT, "renameat2");
line and tested to confirm that this code works:
} else if (syscall_fn_ptr) {
sr_shimdebug_msg(1, " renameorlink using renameat2 via syscall(316, ...)\n");
status = syscall_fn_ptr(316, olddirfd, oldpath, newdirfd, newpath, flags);
it does.
[pid 3949195] write(2, "SR_SHIMDEBUG 1 3949195 0.411893 ", 32SR_SHIMDEBUG 1 3949195 0.411893 ) = 32
[pid 3949195] write(2, "syscall 316\n", 12syscall 316
) = 12
[pid 3949195] write(2, "SR_SHIMDEBUG 1 3949195 0.411921 ", 32SR_SHIMDEBUG 1 3949195 0.411921 ) = 32
[pid 3949195] write(2, "syscall 316\n --> renameat2, will"..., 50syscall 316
--> renameat2, will call renameorlink) = 50
[pid 3949195] write(2, "SR_SHIMDEBUG 1 3949195 0.411946 ", 32SR_SHIMDEBUG 1 3949195 0.411946 ) = 32
[pid 3949195] write(2, "-100, sub_dir1, -100, sub_dir2, "..., 33-100, sub_dir1, -100, sub_dir2, 1) = 33
[pid 3949195] write(2, "SR_SHIMDEBUG 1 3949195 0.411979 ", 32SR_SHIMDEBUG 1 3949195 0.411979 ) = 32
[pid 3949195] write(2, " renameorlink sub_dir1 sub_dir2\n", 32 renameorlink sub_dir1 sub_dir2
) = 32
[pid 3949195] write(2, "SR_SHIMDEBUG 1 3949195 0.412007 ", 32SR_SHIMDEBUG 1 3949195 0.412007 ) = 32
[pid 3949195] write(2, " renameorlink using renameat2 vi"..., 52 renameorlink using renameat2 via syscall(316, ...)
) = 52
[pid 3949195] renameat2(AT_FDCWD, "sub_dir1", AT_FDCWD, "sub_dir2", RENAME_NOREPLACE) = 0
[pid 3949195] write(2, "SR_SHIMDEBUG 3 3949195 0.412063 ", 32SR_SHIMDEBUG 3 3949195 0.412063 ) = 32
[pid 3949195] write(2, "srshim_initialize shim starting."..., 34srshim_initialize shim starting..
) = 34
[pid 3949195] write(2, "SR_SHIMDEBUG 9 3949195 0.412088 ", 32SR_SHIMDEBUG 9 3949195 0.412088 ) = 32
[pid 3949195] write(2, "srshim_initialize shim about to "..., 47srshim_initialize shim about to sr_config_init
) = 47
RedHat 8 has glibc 2.28 which provides renameat2, but its
mv
command usessyscall(316...)
instead of renameat2 provided by glibc.On RHEL8, we have to manually define INTERCEPT_SYSCALL at compile time. On systems with glibc < 2.28, it's automatically defined with
With INTERCEPT_SYSCALL defined, test_shim_post fails on RHEL8 with 19 good and 2 bad (RESULT: BAD! missing expected {'sha512': 1} for 160 stdout redirection in a subdir) instead of 5 bad without it.
With INTERCEPT_SYSCALL:
Without INTERCEPT_SYSCALL: