-
Notifications
You must be signed in to change notification settings - Fork 643
Description
x86
ubuntu 22.04
wine10
When running rr record with some wine programs . rr record encounters file copy issue(try_copy_file_by_copy_all) with wine program
The stack trace is shown below. Due to certain reasons, I cannot provide a test case at the moment, but I may provide more useful information later.
1550 struct stat src_stat;
1551 if (0 != fstat(src_fd, &src_stat)) {
1552 return false;
1553 }
1554 size_t remaining_size = src_stat.st_size;
→ 1555 while (remaining_size > 0) {
1556 ssize_t ncopied = syscall(NativeArch::copy_file_range, src_fd, NULL,
1557 dest_fd, NULL, remaining_size, 0);
1558 if (ncopied == -1) {
1559 if (errno == ENOSYS) {
1560 should_try_copy_all = false;
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── threads ────
[#0] Id 1, Name: "rr", stopped 0x5eb9325cab4d in rr::try_copy_file_by_copy_all (), reason: SINGLE STEP
[#1] Id 2, Name: "TraceeAttention", stopped 0x78d90111488c in __GI___libc_read (), reason: SINGLE STEP
[#2] Id 3, Name: "compress events", stopped 0x78d901091117 in __futex_abstimed_wait_common64 (), reason: SINGLE STEP
[#3] Id 4, Name: "compress data", stopped 0x78d901091117 in __futex_abstimed_wait_common64 (), reason: SINGLE STEP
[#4] Id 5, Name: "compress data", stopped 0x78d901091117 in __futex_abstimed_wait_common64 (), reason: SINGLE STEP
[#5] Id 6, Name: "compress data", stopped 0x78d901091117 in __futex_abstimed_wait_common64 (), reason: SINGLE STEP
[#6] Id 7, Name: "compress data", stopped 0x78d901091117 in __futex_abstimed_wait_common64 (), reason: SINGLE STEP
[#7] Id 8, Name: "compress data", stopped 0x78d901091117 in __futex_abstimed_wait_common64 (), reason: SINGLE STEP
[#8] Id 9, Name: "compress data", stopped 0x78d901091117 in __futex_abstimed_wait_common64 (), reason: SINGLE STEP
[#9] Id 10, Name: "compress data", stopped 0x78d901091117 in __futex_abstimed_wait_common64 (), reason: SINGLE STEP
[#10] Id 11, Name: "compress data", stopped 0x78d901091117 in __futex_abstimed_wait_common64 (), reason: SINGLE STEP
[#11] Id 12, Name: "compress mmaps", stopped 0x78d901091117 in __futex_abstimed_wait_common64 (), reason: SINGLE STEP
[#12] Id 13, Name: "compress tasks", stopped 0x78d901091117 in __futex_abstimed_wait_common64 (), reason: SINGLE STEP
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── trace ────
[#0] 0x5eb9325cab4d → rr::try_copy_file_by_copy_all(src_fd=0x1f, dest_fd=0x21)
[#1] 0x5eb9325cab4d → rr::copy_file(dest_fd=0x21, src_fd=0x1f)
[#2] 0x5eb9325bdcb7 → rr::TraceWriter::copy_file(this=<optimized out>, real_file_name=<optimized out>, access_file_name=<optimized out>, new_name=<optimized out>)
[#3] 0x5eb9325be040 → rr::TraceWriter::write_mapped_region(rr::RecordTask*, rr::KernelMapping const&, stat const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<rr::TraceRemoteFd, std::allocator<rr::TraceRemoteFd> > const&, rr::TraceWriter::MappingOrigin, bool)::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)#1}::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) const [clone .lto_priv.0]()
[#4] 0x5eb9325c155d → rr::TraceWriter::write_mapped_region(this=0x5eb936402768, t=0x5eb9365b6f10, km=@0x7ffe52c649b0, stat=@0x7ffe52c64a70, file_name="/proc/644399/fd/8", extra_fds=<optimized out>, origin=rr::TraceWriter::SYSCALL_MAPPING, skip_monitoring_mapped_fd=0x0)
[#5] 0x5eb9324ea98c → rr::process_mmap(t=0x5eb9365b6f10, length=<optimized out>, prot=0x7, flags=<optimized out>, fd=0x8, offset=0x0)
[#6] 0x5eb93251559c → rr::rec_process_syscall_arch<rr::X64Arch>(t=0x5eb9365b6f10, syscall_state=@0x5eb9365b7810)
[#7] 0x5eb9324e5b0d → rr::rec_process_syscall_internal(syscall_state=@0x5eb9365b7810, arch=<optimized out>, t=0x5eb9365b6f10)
[#8] 0x5eb9324e5b0d → rr::rec_process_syscall(t=0x5eb9365b6f10)
[#9] 0x5eb9324d4f97 → rr::RecordSession::syscall_state_changed(this=0x5eb936402660, t=0x5eb9365b6f10, step_state=0x7ffe52c6758c)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
gef? p remaining_size
$16 = 0x1ece3696000
0x1ece3696000 is really a huge file.
the file size obtained via fstat is 2 TB.
file /proc/644312/fd/31
/proc/644312/fd/31: symbolic link to /tmp/.wine-1000/server-802-1381c4c/tmpmap-7c1b922c (deleted)
file /proc/644312/fd/33
/proc/644312/fd/33: symbolic link to /home/ubu/.local/share/rr/wine-0/mmap_copy_6781_tmpmap-7c1b922c (deleted)
ls -lh /home/ubu/.local/share/rr/wine-0/mmap_copy_6781_tmpmap-7c1b922c\ (deleted)
-rwx------ 1 ubu ubu 77G '/home/ubu/.local/share/rr/wine-0/mmap_copy_6781_tmpmap-7c1b922c (deleted)'
ls -lh /tmp/.wine-1000/server-802-1381c4c/
lock socket
gef? p remaining_size
$16 = 0x1ece3696000
0x1ece3696000 is really a huge file
When attaching gdb for debugging, 77 GB of files had already been copied to /home/ubu/.local/share/rr/wine-0/mmap_copy_6781_tmpmap-7c1b922.
Is this data required by rr?
================== Details for File Descriptor 31 ==================
File Path: /tmp/.wine-1000/server-802-1381c4c/tmpmap-3d840f8a (deleted)
File Size: 2199023255552 bytes (2,147,483,648.00 KB, 2,097,152.00 MB)
file_stat.st_size get 2199023255552 bytes
Permissions (octal): 0600
Permissions (rwx): rw-------
strace this wine program
882978 openat(AT_FDCWD, "tmpmap-da0c3f18", O_RDWR|O_CREAT|O_EXCL, 0600) = 191
882978 ftruncate(191, 2199023255552) = 0
882978 unlink("tmpmap-da0c3f18") = 0