From 61e695f05fc1aa122fcabc8d77aedf462195f8d8 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Jun 02 2017 21:31:12 +0000 Subject: 3.13.0-0.1.RC1 - Update description as suggested by Ivo Raisr. - Workaround gdb/python bug in testsuite (#1434601) - Update to upstream 3.13.0-RC1. - Drop all upstreamed patches. --- diff --git a/.gitignore b/.gitignore index e188dbd..1294002 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ /valgrind-3.12.0.BETA1.tar.bz2 /valgrind-3.12.0.RC2.tar.bz2 /valgrind-3.12.0.tar.bz2 +/valgrind-3.13.0.RC1.tar.bz2 diff --git a/sources b/sources index fc6c779..46a2f06 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -6eb03c0c10ea917013a7622e483d61bb valgrind-3.12.0.tar.bz2 +SHA512 (valgrind-3.13.0.RC1.tar.bz2) = c23b761f295dd05373e755ef86e0c82d677ea932b588098aedd74c5782c673219f1a7fef8bb8fa676dee9d9963cc28082375f5af8f6e329bd5e86b042f922ec8 diff --git a/valgrind-3.12.0-aarch64-syscalls.patch b/valgrind-3.12.0-aarch64-syscalls.patch deleted file mode 100644 index cc67009..0000000 --- a/valgrind-3.12.0-aarch64-syscalls.patch +++ /dev/null @@ -1,444 +0,0 @@ -diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c -index f8b5b7c..60482d7 100644 ---- a/coregrind/m_syswrap/syswrap-arm64-linux.c -+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c -@@ -666,10 +666,11 @@ static SyscallTableEntry syscall_main_table[] = { - LINX_(__NR_unlinkat, sys_unlinkat), // 35 - LINX_(__NR_symlinkat, sys_symlinkat), // 36 - LINX_(__NR_linkat, sys_linkat), // 37 -- LINX_(__NR_renameat, sys_renameat), // 38 -+ LINX_(__NR_renameat, sys_renameat), // 38 - LINX_(__NR_umount2, sys_umount), // 39 - LINX_(__NR_mount, sys_mount), // 40 -- -+ LINX_(__NR_pivot_root, sys_pivot_root), // 41 -+ // (__NR_nfsservctl, sys_ni_syscall), // 42 - GENXY(__NR_statfs, sys_statfs), // 43 - GENXY(__NR_fstatfs, sys_fstatfs), // 44 - GENX_(__NR_truncate, sys_truncate), // 45 -@@ -711,7 +712,7 @@ static SyscallTableEntry syscall_main_table[] = { - GENX_(__NR_sync, sys_sync), // 81 - GENX_(__NR_fsync, sys_fsync), // 82 - GENX_(__NR_fdatasync, sys_fdatasync), // 83 -- -+ LINX_(__NR_sync_file_range, sys_sync_file_range), // 84 - LINXY(__NR_timerfd_create, sys_timerfd_create), // 85 - LINXY(__NR_timerfd_settime, sys_timerfd_settime), // 86 - LINXY(__NR_timerfd_gettime, sys_timerfd_gettime), // 87 -@@ -724,27 +725,27 @@ static SyscallTableEntry syscall_main_table[] = { - LINX_(__NR_exit_group, sys_exit_group), // 94 - LINXY(__NR_waitid, sys_waitid), // 95 - LINX_(__NR_set_tid_address, sys_set_tid_address), // 96 -- -+ LINX_(__NR_unshare, sys_unshare), // 97 - LINXY(__NR_futex, sys_futex), // 98 - LINX_(__NR_set_robust_list, sys_set_robust_list), // 99 -- -+ LINXY(__NR_get_robust_list, sys_get_robust_list), // 100 - GENXY(__NR_nanosleep, sys_nanosleep), // 101 - GENXY(__NR_getitimer, sys_getitimer), // 102 - GENXY(__NR_setitimer, sys_setitimer), // 103 - GENX_(__NR_kexec_load, sys_ni_syscall), // 104 - LINX_(__NR_init_module, sys_init_module), // 105 -- -+ LINX_(__NR_delete_module, sys_delete_module), // 106 - LINXY(__NR_timer_create, sys_timer_create), // 107 -- LINXY(__NR_timer_settime, sys_timer_settime), // 108 -- LINXY(__NR_timer_gettime, sys_timer_gettime), // 109 -- LINX_(__NR_timer_getoverrun, sys_timer_getoverrun), // 110 -+ LINXY(__NR_timer_gettime, sys_timer_gettime), // 108 -+ LINX_(__NR_timer_getoverrun, sys_timer_getoverrun), // 109 -+ LINXY(__NR_timer_settime, sys_timer_settime), // 110 - LINX_(__NR_timer_delete, sys_timer_delete), // 111 - LINX_(__NR_clock_settime, sys_clock_settime), // 112 - LINXY(__NR_clock_gettime, sys_clock_gettime), // 113 - LINXY(__NR_clock_getres, sys_clock_getres), // 114 - LINXY(__NR_clock_nanosleep, sys_clock_nanosleep), // 115 - LINXY(__NR_syslog, sys_syslog), // 116 -- -+ // (__NR_ptrace, sys_ptrace), // 117 - LINXY(__NR_sched_setparam, sys_sched_setparam), // 118 - LINX_(__NR_sched_setscheduler,sys_sched_setscheduler),// 119 - LINX_(__NR_sched_getscheduler,sys_sched_getscheduler),// 120 -@@ -754,9 +755,10 @@ static SyscallTableEntry syscall_main_table[] = { - LINX_(__NR_sched_yield, sys_sched_yield), // 124 - LINX_(__NR_sched_get_priority_max, sys_sched_get_priority_max),// 125 - LINX_(__NR_sched_get_priority_min, sys_sched_get_priority_min),// 126 -- -+ LINXY(__NR_sched_rr_get_interval, sys_sched_rr_get_interval),// 127 -+ // (__NR_restart_syscall, sys_ni_syscall), // 128 - GENX_(__NR_kill, sys_kill), // 129 -- -+ LINXY(__NR_tkill, sys_tkill), // 130 - LINX_(__NR_tgkill, sys_tgkill), // 131 - GENXY(__NR_sigaltstack, sys_sigaltstack), // 132 - LINX_(__NR_rt_sigsuspend, sys_rt_sigsuspend), // 133 -@@ -768,7 +770,7 @@ static SyscallTableEntry syscall_main_table[] = { - PLAX_(__NR_rt_sigreturn, sys_rt_sigreturn), // 139 - GENX_(__NR_setpriority, sys_setpriority), // 140 - GENX_(__NR_getpriority, sys_getpriority), // 141 -- -+ // (__NR_reboot, sys_ni_syscall), // 142 - GENX_(__NR_setregid, sys_setregid), // 143 - GENX_(__NR_setgid, sys_setgid), // 144 - GENX_(__NR_setreuid, sys_setreuid), // 145 -@@ -787,13 +789,14 @@ static SyscallTableEntry syscall_main_table[] = { - GENXY(__NR_getgroups, sys_getgroups), // 158 - GENX_(__NR_setgroups, sys_setgroups), // 159 - GENXY(__NR_uname, sys_newuname), // 160 -- -+ GENX_(__NR_sethostname, sys_sethostname), // 161 -+ // (__NR_setdomainname, sys_ni_syscall), // 162 - GENXY(__NR_getrlimit, sys_old_getrlimit), // 163 - GENX_(__NR_setrlimit, sys_setrlimit), // 164 - GENXY(__NR_getrusage, sys_getrusage), // 165 - GENX_(__NR_umask, sys_umask), // 166 - LINXY(__NR_prctl, sys_prctl), // 167 -- -+ LINXY(__NR_getcpu, sys_getcpu), // 168 - GENXY(__NR_gettimeofday, sys_gettimeofday), // 169 - GENX_(__NR_settimeofday, sys_settimeofday), // 170 - LINXY(__NR_adjtimex, sys_adjtimex), // 171 -@@ -843,13 +846,14 @@ static SyscallTableEntry syscall_main_table[] = { - GENXY(__NR_munmap, sys_munmap), // 215 - GENX_(__NR_mremap, sys_mremap), // 216 - LINX_(__NR_add_key, sys_add_key), // 217 -- -+ LINX_(__NR_request_key, sys_request_key), // 218 - LINXY(__NR_keyctl, sys_keyctl), // 219 - LINX_(__NR_clone, sys_clone), // 220 - GENX_(__NR_execve, sys_execve), // 221 - PLAX_(__NR_mmap, sys_mmap), // 222 - PLAX_(__NR_fadvise64, sys_fadvise64), // 223 -- -+ // (__NR_swapon, sys_swapon), // 224 -+ // (__NR_swapoff, sys_swapoff), // 225 - GENXY(__NR_mprotect, sys_mprotect), // 226 - GENX_(__NR_msync, sys_msync), // 227 - GENX_(__NR_mlock, sys_mlock), // 228 -@@ -858,301 +862,47 @@ static SyscallTableEntry syscall_main_table[] = { - LINX_(__NR_munlockall, sys_munlockall), // 231 - GENXY(__NR_mincore, sys_mincore), // 232 - GENX_(__NR_madvise, sys_madvise), // 233 -- -+ // (__NR_remap_file_pages, sys_ni_syscall) // 234 - LINX_(__NR_mbind, sys_mbind), // 235 - LINXY(__NR_get_mempolicy, sys_get_mempolicy), // 236 - LINX_(__NR_set_mempolicy, sys_set_mempolicy), // 237 -- -+ // (__NR_migrate_pages, sys_ni_syscall), // 238 -+ LINXY(__NR_move_pages, sys_move_pages), // 239 -+ LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo), // 240 - LINXY(__NR_perf_event_open, sys_perf_event_open), // 241 - LINXY(__NR_accept4, sys_accept4), // 242 - LINXY(__NR_recvmmsg, sys_recvmmsg), // 243 -- - GENXY(__NR_wait4, sys_wait4), // 260 - LINXY(__NR_prlimit64, sys_prlimit64), // 261 -- -+ LINXY(__NR_fanotify_init, sys_fanotify_init), // 262 -+ LINX_(__NR_fanotify_mark, sys_fanotify_mark), // 263 - LINXY(__NR_name_to_handle_at, sys_name_to_handle_at), // 264 - LINXY(__NR_open_by_handle_at, sys_open_by_handle_at), // 265 -- -+ LINXY(__NR_clock_adjtime, sys_clock_adjtime), // 266 - LINX_(__NR_syncfs, sys_syncfs), // 267 -- -+ // (__NR_setns, sys_ni_syscall), // 268 - LINXY(__NR_sendmmsg, sys_sendmmsg), // 269 - LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 270 - LINX_(__NR_process_vm_writev, sys_process_vm_writev), // 271 -- -+ LINX_(__NR_kcmp, sys_kcmp), // 272 -+ // (__NR_finit_module, sys_ni_syscall), // 273 -+ // (__NR_sched_setattr, sys_ni_syscall), // 274 -+ // (__NR_sched_getattr, sys_ni_syscall), // 275 - LINX_(__NR_renameat2, sys_renameat2), // 276 -- -+ // (__NR_seccomp, sys_ni_syscall), // 277 - LINXY(__NR_getrandom, sys_getrandom), // 278 - LINXY(__NR_memfd_create, sys_memfd_create), // 279 -- --// The numbers below are bogus. (See comment further down.) --// When pulling entries above this line, change the numbers --// to be correct. -- --//ZZ //zz // (restart_syscall) // 0 --//ZZ GENX_(__NR_fork, sys_fork), // 2 --//ZZ --//ZZ GENXY(__NR_open, sys_open), // 5 --//ZZ // GENXY(__NR_waitpid, sys_waitpid), // 7 --//ZZ GENXY(__NR_creat, sys_creat), // 8 --//ZZ GENX_(__NR_link, sys_link), // 9 --//ZZ --//ZZ GENX_(__NR_unlink, sys_unlink), // 10 --//ZZ GENXY(__NR_time, sys_time), // 13 --//ZZ GENX_(__NR_mknod, sys_mknod), // 14 --//ZZ --//ZZ GENX_(__NR_chmod, sys_chmod), // 15 --//ZZ //zz LINX_(__NR_lchown, sys_lchown16), // 16 --//ZZ // GENX_(__NR_break, sys_ni_syscall), // 17 --//ZZ //zz // (__NR_oldstat, sys_stat), // 18 (obsolete) --//ZZ LINX_(__NR_lseek, sys_lseek), // 19 --//ZZ --//ZZ GENX_(__NR_getpid, sys_getpid), // 20 --//ZZ LINX_(__NR_umount, sys_oldumount), // 22 --//ZZ LINX_(__NR_setuid, sys_setuid16), // 23 ## P --//ZZ LINX_(__NR_getuid, sys_getuid16), // 24 ## P --//ZZ //zz --//ZZ //zz // (__NR_stime, sys_stime), // 25 * (SVr4,SVID,X/OPEN) --//ZZ PLAXY(__NR_ptrace, sys_ptrace), // 26 --//ZZ GENX_(__NR_alarm, sys_alarm), // 27 --//ZZ //zz // (__NR_oldfstat, sys_fstat), // 28 * L -- obsolete --//ZZ GENX_(__NR_pause, sys_pause), // 29 --//ZZ --//ZZ LINX_(__NR_utime, sys_utime), // 30 --//ZZ // GENX_(__NR_stty, sys_ni_syscall), // 31 --//ZZ // GENX_(__NR_gtty, sys_ni_syscall), // 32 --//ZZ GENX_(__NR_access, sys_access), // 33 --//ZZ GENX_(__NR_nice, sys_nice), // 34 --//ZZ --//ZZ // GENX_(__NR_ftime, sys_ni_syscall), // 35 --//ZZ GENX_(__NR_rename, sys_rename), // 38 --//ZZ GENX_(__NR_mkdir, sys_mkdir), // 39 --//ZZ --//ZZ GENX_(__NR_rmdir, sys_rmdir), // 40 --//ZZ LINXY(__NR_pipe, sys_pipe), // 42 --//ZZ // GENX_(__NR_prof, sys_ni_syscall), // 44 -- --//ZZ LINX_(__NR_getgid, sys_getgid16), // 47 --//ZZ //zz // (__NR_signal, sys_signal), // 48 */* (ANSI C) --//ZZ LINX_(__NR_geteuid, sys_geteuid16), // 49 --//ZZ --//ZZ LINX_(__NR_getegid, sys_getegid16), // 50 --//ZZ // GENX_(__NR_lock, sys_ni_syscall), // 53 --//ZZ --//ZZ LINXY(__NR_fcntl, sys_fcntl), // 55 --//ZZ // GENX_(__NR_mpx, sys_ni_syscall), // 56 --//ZZ // GENX_(__NR_ulimit, sys_ni_syscall), // 58 --//ZZ //zz // (__NR_oldolduname, sys_olduname), // 59 Linux -- obsolete --//ZZ //zz --//ZZ //zz // (__NR_ustat, sys_ustat) // 62 SVr4 -- deprecated --//ZZ GENXY(__NR_dup2, sys_dup2), // 63 --//ZZ GENX_(__NR_getppid, sys_getppid), // 64 --//ZZ --//ZZ GENX_(__NR_getpgrp, sys_getpgrp), // 65 --//ZZ LINXY(__NR_sigaction, sys_sigaction), // 67 --//ZZ //zz // (__NR_sgetmask, sys_sgetmask), // 68 */* (ANSI C) --//ZZ //zz // (__NR_ssetmask, sys_ssetmask), // 69 */* (ANSI C) --//ZZ //zz --//ZZ PLAX_(__NR_sigsuspend, sys_sigsuspend), // 72 --//ZZ LINXY(__NR_sigpending, sys_sigpending), // 73 --//ZZ //zz // (__NR_sethostname, sys_sethostname), // 74 */* --//ZZ //zz --//ZZ GENXY(__NR_getrlimit, sys_old_getrlimit), // 76 --//ZZ --//ZZ LINXY(__NR_getgroups, sys_getgroups16), // 80 --//ZZ LINX_(__NR_setgroups, sys_setgroups16), // 81 --//ZZ // PLAX_(__NR_select, old_select), // 82 --//ZZ GENX_(__NR_symlink, sys_symlink), // 83 --//ZZ //zz // (__NR_oldlstat, sys_lstat), // 84 -- obsolete --//ZZ //zz --//ZZ GENX_(__NR_readlink, sys_readlink), // 85 --//ZZ //zz // (__NR_uselib, sys_uselib), // 86 */Linux --//ZZ //zz // (__NR_swapon, sys_swapon), // 87 */Linux --//ZZ //zz // (__NR_reboot, sys_reboot), // 88 */Linux --//ZZ //zz // (__NR_readdir, old_readdir), // 89 -- superseded --//ZZ //zz --//ZZ // _____(__NR_mmap, old_mmap), // 90 --//ZZ GENXY(__NR_munmap, sys_munmap), // 91 --//ZZ GENX_(__NR_truncate, sys_truncate), // 92 --//ZZ GENX_(__NR_ftruncate, sys_ftruncate), // 93 --//ZZ --//ZZ LINX_(__NR_fchown, sys_fchown16), // 95 --//ZZ // GENX_(__NR_profil, sys_ni_syscall), // 98 --//ZZ GENXY(__NR_statfs, sys_statfs), // 99 --//ZZ --//ZZ GENXY(__NR_fstatfs, sys_fstatfs), // 100 --//ZZ // LINX_(__NR_ioperm, sys_ioperm), // 101 --//ZZ LINXY(__NR_socketcall, sys_socketcall), // 102 --//ZZ --//ZZ GENXY(__NR_stat, sys_newstat), // 106 --//ZZ GENXY(__NR_lstat, sys_newlstat), // 107 --//ZZ GENXY(__NR_fstat, sys_newfstat), // 108 --//ZZ //zz // (__NR_olduname, sys_uname), // 109 -- obsolete --//ZZ //zz --//ZZ // GENX_(__NR_iopl, sys_iopl), // 110 --//ZZ // GENX_(__NR_idle, sys_ni_syscall), // 112 --//ZZ // PLAXY(__NR_vm86old, sys_vm86old), // 113 __NR_syscall... weird --//ZZ //zz --//ZZ //zz // (__NR_swapoff, sys_swapoff), // 115 */Linux --//ZZ // _____(__NR_ipc, sys_ipc), // 117 --//ZZ GENX_(__NR_fsync, sys_fsync), // 118 --//ZZ PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux --//ZZ --//ZZ //zz // (__NR_setdomainname, sys_setdomainname), // 121 */*(?) --//ZZ // PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 --//ZZ //zz --//ZZ LINXY(__NR_sigprocmask, sys_sigprocmask), // 126 --//ZZ //zz // Nb: create_module() was removed 2.4-->2.6 --//ZZ // GENX_(__NR_create_module, sys_ni_syscall), // 127 --//ZZ LINX_(__NR_delete_module, sys_delete_module), // 129 --//ZZ //zz --//ZZ //zz // Nb: get_kernel_syms() was removed 2.4-->2.6 --//ZZ // GENX_(__NR_get_kernel_syms, sys_ni_syscall), // 130 --//ZZ GENX_(__NR_getpgid, sys_getpgid), // 132 --//ZZ //zz // (__NR_bdflush, sys_bdflush), // 134 */Linux --//ZZ //zz --//ZZ //zz // (__NR_sysfs, sys_sysfs), // 135 SVr4 --//ZZ // GENX_(__NR_afs_syscall, sys_ni_syscall), // 137 --//ZZ --//ZZ LINXY(__NR__llseek, sys_llseek), // 140 --//ZZ GENXY(__NR_getdents, sys_getdents), // 141 --//ZZ GENX_(__NR__newselect, sys_select), // 142 --//ZZ --//ZZ LINXY(__NR__sysctl, sys_sysctl), // 149 --//ZZ --//ZZ //zz //LINX?(__NR_sched_rr_get_interval, sys_sched_rr_get_interval), // 161 */* --//ZZ LINX_(__NR_setresuid, sys_setresuid16), // 164 --//ZZ --//ZZ LINXY(__NR_getresuid, sys_getresuid16), // 165 --//ZZ // PLAXY(__NR_vm86, sys_vm86), // 166 x86/Linux-only --//ZZ // GENX_(__NR_query_module, sys_ni_syscall), // 167 --//ZZ GENXY(__NR_poll, sys_poll), // 168 --//ZZ //zz // (__NR_nfsservctl, sys_nfsservctl), // 169 */Linux --//ZZ //zz --//ZZ LINX_(__NR_setresgid, sys_setresgid16), // 170 --//ZZ LINXY(__NR_getresgid, sys_getresgid16), // 171 --//ZZ LINXY(__NR_prctl, sys_prctl), // 172 --//ZZ LINXY(__NR_rt_sigaction, sys_rt_sigaction), // 174 --//ZZ --//ZZ LINXY(__NR_rt_sigtimedwait, sys_rt_sigtimedwait),// 177 --//ZZ --//ZZ LINX_(__NR_chown, sys_chown16), // 182 --//ZZ --//ZZ LINXY(__NR_sendfile, sys_sendfile), // 187 --//ZZ // GENXY(__NR_getpmsg, sys_getpmsg), // 188 --//ZZ // GENX_(__NR_putpmsg, sys_putpmsg), // 189 --//ZZ --//ZZ // Nb: we treat vfork as fork --//ZZ GENX_(__NR_vfork, sys_fork), // 190 --//ZZ GENXY(__NR_ugetrlimit, sys_getrlimit), // 191 --//ZZ GENX_(__NR_truncate64, sys_truncate64), // 193 --//ZZ GENX_(__NR_ftruncate64, sys_ftruncate64), // 194 --//ZZ --//ZZ PLAXY(__NR_stat64, sys_stat64), // 195 --//ZZ PLAXY(__NR_lstat64, sys_lstat64), // 196 --//ZZ PLAXY(__NR_fstat64, sys_fstat64), // 197 --//ZZ GENX_(__NR_lchown32, sys_lchown), // 198 --//ZZ GENX_(__NR_getuid32, sys_getuid), // 199 --//ZZ --//ZZ GENX_(__NR_getgid32, sys_getgid), // 200 --//ZZ GENX_(__NR_geteuid32, sys_geteuid), // 201 --//ZZ GENX_(__NR_getegid32, sys_getegid), // 202 --//ZZ GENX_(__NR_setreuid32, sys_setreuid), // 203 --//ZZ GENX_(__NR_setregid32, sys_setregid), // 204 --//ZZ --//ZZ LINX_(__NR_setresuid32, sys_setresuid), // 208 --//ZZ LINXY(__NR_getresuid32, sys_getresuid), // 209 --//ZZ --//ZZ LINX_(__NR_setresgid32, sys_setresgid), // 210 --//ZZ LINXY(__NR_getresgid32, sys_getresgid), // 211 --//ZZ GENX_(__NR_chown32, sys_chown), // 212 --//ZZ GENX_(__NR_setuid32, sys_setuid), // 213 --//ZZ GENX_(__NR_setgid32, sys_setgid), // 214 --//ZZ --//ZZ LINX_(__NR_setfsuid32, sys_setfsuid), // 215 --//ZZ LINX_(__NR_setfsgid32, sys_setfsgid), // 216 --//ZZ //zz // (__NR_pivot_root, sys_pivot_root), // 217 */Linux --//ZZ --//ZZ LINXY(__NR_fcntl64, sys_fcntl64), // 221 --//ZZ // GENX_(222, sys_ni_syscall), // 222 --//ZZ // PLAXY(223, sys_syscall223), // 223 // sys_bproc? --//ZZ --//ZZ LINXY(__NR_tkill, sys_tkill), // 238 */Linux --//ZZ --//ZZ LINXY(__NR_futex, sys_futex), // 240 --//ZZ LINXY(__NR_sched_getaffinity, sys_sched_getaffinity), // 242 --//ZZ // PLAX_(__NR_set_thread_area, sys_set_thread_area), // 243 --//ZZ // PLAX_(__NR_get_thread_area, sys_get_thread_area), // 244 --//ZZ --//ZZ // LINX_(__NR_fadvise64, sys_fadvise64), // 250 */(Linux?) --//ZZ GENX_(251, sys_ni_syscall), // 251 --//ZZ LINXY(__NR_epoll_create, sys_epoll_create), // 254 --//ZZ --//ZZ LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 255 --//ZZ LINXY(__NR_epoll_wait, sys_epoll_wait), // 256 --//ZZ //zz // (__NR_remap_file_pages, sys_remap_file_pages), // 257 */Linux --//ZZ LINX_(__NR_set_tid_address, sys_set_tid_address), // 258 --//ZZ --//ZZ LINXY(__NR_clock_getres, sys_clock_getres), // (timer_create+7) --//ZZ GENXY(__NR_statfs64, sys_statfs64), // 268 --//ZZ GENXY(__NR_fstatfs64, sys_fstatfs64), // 269 --//ZZ --//ZZ GENX_(__NR_utimes, sys_utimes), // 271 --//ZZ // LINX_(__NR_fadvise64_64, sys_fadvise64_64), // 272 */(Linux?) --//ZZ GENX_(__NR_vserver, sys_ni_syscall), // 273 --//ZZ LINX_(__NR_mbind, sys_mbind), // 274 ?/? --//ZZ --//ZZ LINXY(__NR_get_mempolicy, sys_get_mempolicy), // 275 ?/? --//ZZ LINX_(__NR_set_mempolicy, sys_set_mempolicy), // 276 ?/? --//ZZ --//ZZ LINX_(__NR_send, sys_send), --//ZZ LINXY(__NR_recv, sys_recv), --//ZZ LINXY(__NR_recvfrom, sys_recvfrom), // 292 --//ZZ LINX_(__NR_semget, sys_semget), // 299 --//ZZ LINXY(__NR_semctl, sys_semctl), // 300 --//ZZ --//ZZ LINX_(__NR_request_key, sys_request_key), // 287 --//ZZ LINX_(__NR_inotify_init, sys_inotify_init), // 291 --//ZZ // LINX_(__NR_migrate_pages, sys_migrate_pages), // 294 --//ZZ --//ZZ LINX_(__NR_futimesat, sys_futimesat), // 326 on arm --//ZZ --//ZZ PLAXY(__NR_fstatat64, sys_fstatat64), // 300 --//ZZ LINX_(__NR_renameat, sys_renameat), // 302 --//ZZ LINX_(__NR_symlinkat, sys_symlinkat), // 304 --//ZZ --//ZZ LINX_(__NR_shmget, sys_shmget), //307 --//ZZ // LINX_(__NR_pselect6, sys_pselect6), // --//ZZ --//ZZ // LINX_(__NR_unshare, sys_unshare), // 310 --//ZZ LINX_(__NR_set_robust_list, sys_set_robust_list), // 311 --//ZZ LINXY(__NR_get_robust_list, sys_get_robust_list), // 312 --//ZZ // LINX_(__NR_sync_file_range, sys_sync_file_range), // 314 --//ZZ --//ZZ LINXY(__NR_move_pages, sys_move_pages), // 317 --//ZZ // LINX_(__NR_getcpu, sys_ni_syscall), // 318 --//ZZ --//ZZ LINXY(__NR_signalfd, sys_signalfd), // 321 --//ZZ LINXY(__NR_eventfd, sys_eventfd), // 323 --//ZZ --//ZZ --//ZZ /////////////// --//ZZ --//ZZ // JRS 2010-Jan-03: I believe that all the numbers listed --//ZZ // in comments in the table prior to this point (eg "// 326", --//ZZ // etc) are bogus since it looks to me like they are copied --//ZZ // verbatim from syswrap-x86-linux.c and they certainly do not --//ZZ // correspond to what's in include/vki/vki-scnums-arm-linux.h. --//ZZ // From here onwards, please ensure the numbers are correct. --//ZZ --//ZZ --//ZZ LINXY(__NR_epoll_pwait, sys_epoll_pwait), // 346 --//ZZ --//ZZ --//ZZ LINXY(__NR_eventfd2, sys_eventfd2), // 356 --//ZZ LINXY(__NR_epoll_create1, sys_epoll_create1), // 357 --//ZZ LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 363 --//ZZ --//ZZ LINXY(__NR_clock_adjtime, sys_clock_adjtime) // 372 -+ // (__NR_bpf, sys_ni_syscall) // 280 -+ // (__NR_execveat, sys_ni_syscall), // 281 -+ // (__NR_userfaultfd, sys_ni_syscall), // 282 -+ // (__NR_membarrier, sys_ni_syscall), // 283 -+ // (__NR_mlock2, sys_ni_syscall), // 284 -+ // (__NR_copy_file_range, sys_ni_syscall), // 285 -+ // (__NR_preadv2, sys_ni_syscall), // 286 -+ // (__NR_pwritev2, sys_ni_syscall), // 287 -+ // (__NR_pkey_mprotect, sys_ni_syscall), // 288 -+ // (__NR_pkey_alloc, sys_ni_syscall), // 289 -+ // (__NR_pkey_free, sys_ni_syscall), // 290 - }; - - diff --git a/valgrind-3.12.0-arm64-hint.patch b/valgrind-3.12.0-arm64-hint.patch deleted file mode 100644 index 561444f..0000000 --- a/valgrind-3.12.0-arm64-hint.patch +++ /dev/null @@ -1,33 +0,0 @@ -commit cd685e0ff55060e9ec341c86b23c6dbb2d3127f4 -Author: tom -Date: Sat Feb 11 10:44:29 2017 +0000 - - Handle unknown HINT instructions on aarch64 by ignoring them. BZ#376279. - - - git-svn-id: svn://svn.valgrind.org/vex/trunk@3302 8f6e269a-dfd6-0310-a8e1-e2731360e62c - -diff --git a/VEX/priv/guest_arm64_toIR.c b/VEX/priv/guest_arm64_toIR.c -index e527447..484a26e 100644 ---- a/VEX/priv/guest_arm64_toIR.c -+++ b/VEX/priv/guest_arm64_toIR.c -@@ -7022,6 +7022,19 @@ Bool dis_ARM64_branch_etc(/*MB_OUT*/DisResult* dres, UInt insn, - return True; - } - -+ /* -------------------- HINT ------------------- */ -+ /* 31 23 15 11 4 3 -+ 1101 0101 0000 0011 0010 imm7 1 1111 -+ */ -+ if (INSN(31,24) == BITS8(1,1,0,1,0,1,0,1) -+ && INSN(23,16) == BITS8(0,0,0,0,0,0,1,1) -+ && INSN(15,12) == BITS4(0,0,1,0) -+ && INSN(4,0) == BITS5(1,1,1,1,1)) { -+ UInt imm7 = INSN(11,5); -+ DIP("hint #%u\n", imm7); -+ return True; -+ } -+ - /* ------------------- CLREX ------------------ */ - /* 31 23 15 11 7 - 1101 0101 0000 0011 0011 m 0101 1111 CLREX CRm diff --git a/valgrind-3.12.0-arm64-ppc64-prlimit64.patch b/valgrind-3.12.0-arm64-ppc64-prlimit64.patch deleted file mode 100644 index 4b4e9ac..0000000 --- a/valgrind-3.12.0-arm64-ppc64-prlimit64.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c -index 1be6629..f8b5b7c 100644 ---- a/coregrind/m_syswrap/syswrap-arm64-linux.c -+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c -@@ -868,6 +868,7 @@ static SyscallTableEntry syscall_main_table[] = { - LINXY(__NR_recvmmsg, sys_recvmmsg), // 243 - - GENXY(__NR_wait4, sys_wait4), // 260 -+ LINXY(__NR_prlimit64, sys_prlimit64), // 261 - - LINXY(__NR_name_to_handle_at, sys_name_to_handle_at), // 264 - LINXY(__NR_open_by_handle_at, sys_open_by_handle_at), // 265 -diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c -index f90140d..ce5cbbb 100644 ---- a/coregrind/m_syswrap/syswrap-ppc64-linux.c -+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c -@@ -905,6 +905,7 @@ static SyscallTableEntry syscall_table[] = { - LINX_(__NR_pwritev, sys_pwritev), // 321 - LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 322 - -+ LINXY(__NR_prlimit64, sys_prlimit64), // 325 - LINXY(__NR_socket, sys_socket), // 326 - LINX_(__NR_bind, sys_bind), // 327 - LINX_(__NR_connect, sys_connect), // 328 diff --git a/valgrind-3.12.0-cd-dvd-ioctl.patch b/valgrind-3.12.0-cd-dvd-ioctl.patch deleted file mode 100644 index 54edf91..0000000 --- a/valgrind-3.12.0-cd-dvd-ioctl.patch +++ /dev/null @@ -1,97 +0,0 @@ -commit 9e00f6ed1e84a3b251aded21ef98ed9e4adc6936 -Author: sewardj -Date: Wed Nov 23 13:15:22 2016 +0000 - - Bug 352767 - Wine/valgrind: Warning: noted but unhandled ioctl 0x5307 - with no size/direction hints. (CDROMSTOP). - - Patch from Austin English (austinenglish@gmail.com). - - - git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16152 a5019735-40e9-0310-863c-91ae7b9d1cf9 - -diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c -index fda8dd1..5e540e8 100644 ---- a/coregrind/m_syswrap/syswrap-linux.c -+++ b/coregrind/m_syswrap/syswrap-linux.c -@@ -5672,6 +5672,7 @@ PRE(sys_ioctl) - - /* CDROM stuff. */ - case VKI_CDROM_DISC_STATUS: -+ case VKI_CDROMSTOP: - - /* KVM ioctls that dont check for a numeric value as parameter */ - case VKI_KVM_S390_ENABLE_SIE: -@@ -9188,6 +9189,7 @@ POST(sys_ioctl) - - /* CD ROM stuff (??) */ - case VKI_CDROM_DISC_STATUS: -+ case VKI_CDROMSTOP: - break; - case VKI_CDROMSUBCHNL: - POST_MEM_WRITE(ARG3, sizeof(struct vki_cdrom_subchnl)); -diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h -index bdb8f33..7f6a117 100644 ---- a/include/vki/vki-linux.h -+++ b/include/vki/vki-linux.h -@@ -1865,6 +1865,7 @@ struct vki_scsi_idlun { - (struct cdrom_tochdr) */ - #define VKI_CDROMREADTOCENTRY 0x5306 /* Read TOC entry - (struct cdrom_tocentry) */ -+#define VKI_CDROMSTOP 0x5307 /* Stop the cdrom drive */ - #define VKI_CDROMSUBCHNL 0x530b /* Read subchannel data - (struct cdrom_subchnl) */ - #define VKI_CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) - -commit 88c8d843f64fcb56a0ddd492fb560e6594c3f2e6 -Author: sewardj -Date: Wed Nov 23 13:26:23 2016 +0000 - - Bug 348616 - Wine/valgrind: Warning: noted but unhandled ioctl 0x5390 - with no size/direction hints. (DVD_READ_STRUCT) - - Patch from Austin English (austinenglish@gmail.com). - - - - git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16153 a5019735-40e9-0310-863c-91ae7b9d1cf9 - -diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c -index 5e540e8..af10b92 100644 ---- a/coregrind/m_syswrap/syswrap-linux.c -+++ b/coregrind/m_syswrap/syswrap-linux.c -@@ -5674,7 +5674,10 @@ PRE(sys_ioctl) - case VKI_CDROM_DISC_STATUS: - case VKI_CDROMSTOP: - -- /* KVM ioctls that dont check for a numeric value as parameter */ -+ /* DVD stuff */ -+ case VKI_DVD_READ_STRUCT: -+ -+ /* KVM ioctls that don't check for a numeric value as parameter */ - case VKI_KVM_S390_ENABLE_SIE: - case VKI_KVM_CREATE_IRQCHIP: - case VKI_KVM_S390_INITIAL_RESET: -@@ -9226,6 +9229,10 @@ POST(sys_ioctl) - case VKI_CDROM_GET_CAPABILITY: /* 0x5331 */ - break; - -+ /* DVD stuff */ -+ case VKI_DVD_READ_STRUCT: -+ break; -+ - case VKI_FIGETBSZ: - POST_MEM_WRITE(ARG3, sizeof(unsigned long)); - break; -diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h -index 7f6a117..b64b521 100644 ---- a/include/vki/vki-linux.h -+++ b/include/vki/vki-linux.h -@@ -1885,6 +1885,7 @@ struct vki_scsi_idlun { - #define VKI_CDROM_DISC_STATUS 0x5327 /* get CD type information */ - #define VKI_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ - -+#define VKI_DVD_READ_STRUCT 0x5390 /* read structure */ - #define VKI_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ - - struct vki_cdrom_msf0 diff --git a/valgrind-3.12.0-clone-spawn.patch b/valgrind-3.12.0-clone-spawn.patch deleted file mode 100644 index f30e7aa..0000000 --- a/valgrind-3.12.0-clone-spawn.patch +++ /dev/null @@ -1,3325 +0,0 @@ -commit e31d72da6cb415d0856ad53dac78e307548cd831 -Author: philippe -Date: Sun Dec 11 21:39:23 2016 +0000 - - Fix 342040 Valgrind mishandles clone with CLONE_VFORK | CLONE_VM that clones to a different stack - Fix 373192 Calling posix_spawn in glibc 2.24 completely broken - - Functionally, this patch just does the following 2 changes to the - fork clone handling: - * It does not mask anymore CLONE_VFORK : - The only effect of this flag is to suspend the parent, waiting for - the child to either exit or execve. - If some applications depends on this synchronisation, better keep it, - as it will not harm to suspend the parent valgrind waiting for the - child valgrind to exit or execve. - * In case the guest calls the clone syscall providing a non zero client stack, - set the child guest SP after the syscall, before executing guest instructions. - Not setting the guest stack ptr was the source of the problem reported - in the bugs. - - This also adds a test case none/tests/linux/clonev. - Before this patch, test gives a SEGV, which is fixed by the patch. - - The patch is however a lot bigger : this fix was touching some (mostly - identical/duplicated) code in all the linux platforms. - So, the clone/fork code has been factorised as much as possible. - This removes about 1700 lines of code. - - This has been tested on: - * amd64 - * x86 - * ppc64 be and le - * ppc32 - * arm64 - - This has been compiled on but *not really tested* on: - * mips64 (not too clear how to properly build and run valgrind on gcc22) - - It has *not* been compiled and *not* tested on: - * arm - * mips32 - * tilegx - * darwin (normally, no impact) - * solaris (normally, no impact) - - The changes are relatively mechanical, so it is not impossible that - it will compile and work out of the box on these platforms. - Otherwise, questions welcome. - - A few points of interest: - * Some platforms did have a typedef void vki_modify_ldt_t, - and some platforms had no definition for this type at all. - To make it easier to factorise, for such platforms, the following has - been used: - typedef char vki_modify_ldt_t; - When the sizeof vki_modify_ldt_t is > 1, then the arg syscall is checked. - This is somewhat a hack, but was simplifying the factorisation. - - * for mips32/mips64 and tilegx, there is a strange unconditional assignment - of 0 to a register (guest_r2 on mips, guest_r0 on tilegx). - Unclear what this is, in particular because this is assigned whatever - the result of the syscall (success or not). - - - - - git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16186 a5019735-40e9-0310-863c-91ae7b9d1cf9 - -diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h -index 38fcd7b..06ea7cd 100644 ---- a/coregrind/m_syswrap/priv_syswrap-linux.h -+++ b/coregrind/m_syswrap/priv_syswrap-linux.h -@@ -39,12 +39,10 @@ extern Word ML_(start_thread_NORETURN) ( void* arg ); - extern Addr ML_(allocstack) ( ThreadId tid ); - extern void ML_(call_on_new_stack_0_1) ( Addr stack, Addr retaddr, - void (*f)(Word), Word arg1 ); --extern SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags, -- Int* parent_tidptr, Int* child_tidptr ); -- - - // Linux-specific (but non-arch-specific) syscalls - -+DECL_TEMPLATE(linux, sys_clone) - DECL_TEMPLATE(linux, sys_mount); - DECL_TEMPLATE(linux, sys_oldumount); - DECL_TEMPLATE(linux, sys_umount); -@@ -61,6 +59,10 @@ DECL_TEMPLATE(linux, sys_vmsplice); - DECL_TEMPLATE(linux, sys_readahead); - DECL_TEMPLATE(linux, sys_move_pages); - -+// clone is similar enough between linux variants to have a generic -+// version, but which will call an extern defined in syswrap--linux.c -+DECL_TEMPLATE(linux, sys_clone); -+ - // POSIX, but various sub-cases differ between Linux and Darwin. - DECL_TEMPLATE(linux, sys_fcntl); - DECL_TEMPLATE(linux, sys_fcntl64); -@@ -368,7 +370,83 @@ DECL_TEMPLATE(linux, sys_getpeername); - DECL_TEMPLATE(linux, sys_socketpair); - DECL_TEMPLATE(linux, sys_kcmp); - --#endif // __PRIV_SYSWRAP_LINUX_H -+// Some arch specific functions called from syswrap-linux.c -+extern Int do_syscall_clone_x86_linux ( Word (*fn)(void *), -+ void* stack, -+ Int flags, -+ void* arg, -+ Int* child_tid, -+ Int* parent_tid, -+ void* tls_ptr); -+extern SysRes ML_(x86_sys_set_thread_area) ( ThreadId tid, -+ vki_modify_ldt_t* info ); -+extern void ML_(x86_setup_LDT_GDT) ( /*OUT*/ ThreadArchState *child, -+ /*IN*/ ThreadArchState *parent ); -+ -+extern Long do_syscall_clone_amd64_linux ( Word (*fn)(void *), -+ void* stack, -+ Long flags, -+ void* arg, -+ Int* child_tid, -+ Int* parent_tid, -+ void* tls_ptr); -+extern ULong do_syscall_clone_ppc32_linux ( Word (*fn)(void *), -+ void* stack, -+ Int flags, -+ void* arg, -+ Int* child_tid, -+ Int* parent_tid, -+ void* tls_ptr); -+extern ULong do_syscall_clone_ppc64_linux ( Word (*fn)(void *), -+ void* stack, -+ Int flags, -+ void* arg, -+ Int* child_tid, -+ Int* parent_tid, -+ void* tls_ptr ); -+extern ULong do_syscall_clone_s390x_linux ( void *stack, -+ ULong flags, -+ Int *parent_tid, -+ Int *child_tid, -+ void* tls_ptr, -+ Word (*fn)(void *), -+ void *arg); -+extern Long do_syscall_clone_arm64_linux ( Word (*fn)(void *), -+ void* stack, -+ Long flags, -+ void* arg, -+ Int* child_tid, -+ Int* parent_tid, -+ void* tls_ptr ); -+extern ULong do_syscall_clone_arm_linux ( Word (*fn)(void *), -+ void* stack, -+ Int flags, -+ void* arg, -+ Int* child_tid, -+ Int* parent_tid, -+ void* tls_ptr ); -+extern ULong do_syscall_clone_mips64_linux ( Word (*fn) (void *), /* a0 - 4 */ -+ void* stack, /* a1 - 5 */ -+ Int flags, /* a2 - 6 */ -+ void* arg, /* a3 - 7 */ -+ Int* parent_tid, /* a4 - 8 */ -+ void* tls_ptr, /* a5 - 9 */ -+ Int* child_tid ); /* a6 - 10 */ -+extern UInt do_syscall_clone_mips_linux ( Word (*fn) (void *), //a0 0 32 -+ void* stack, //a1 4 36 -+ Int flags, //a2 8 40 -+ void* arg, //a3 12 44 -+ Int* child_tid, //stack 16 48 -+ Int* parent_tid, //stack 20 52 -+ void* tls_ptr); //stack 24 56 -+extern Long do_syscall_clone_tilegx_linux ( Word (*fn) (void *), //r0 -+ void* stack, //r1 -+ Long flags, //r2 -+ void* arg, //r3 -+ Long* child_tid, //r4 -+ Long* parent_tid, //r5 -+ void* tls_ptr ); //r6 -+ #endif // __PRIV_SYSWRAP_LINUX_H - - /*--------------------------------------------------------------------*/ - /*--- end ---*/ -diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c -index 08e9a93..3fe9938 100644 ---- a/coregrind/m_syswrap/syswrap-amd64-linux.c -+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c -@@ -130,14 +130,7 @@ asm( - #define __NR_CLONE VG_STRINGIFY(__NR_clone) - #define __NR_EXIT VG_STRINGIFY(__NR_exit) - --extern --Long do_syscall_clone_amd64_linux ( Word (*fn)(void *), -- void* stack, -- Long flags, -- void* arg, -- Long* child_tid, -- Long* parent_tid, -- vki_modify_ldt_t * ); -+// See priv_syswrap-linux.h for arg profile. - asm( - ".text\n" - ".globl do_syscall_clone_amd64_linux\n" -@@ -183,126 +176,6 @@ asm( - #undef __NR_EXIT - - --// forward declaration --static void setup_child ( ThreadArchState*, ThreadArchState* ); -- --/* -- When a client clones, we need to keep track of the new thread. This means: -- 1. allocate a ThreadId+ThreadState+stack for the thread -- -- 2. initialize the thread's new VCPU state -- -- 3. create the thread using the same args as the client requested, -- but using the scheduler entrypoint for EIP, and a separate stack -- for ESP. -- */ --static SysRes do_clone ( ThreadId ptid, -- ULong flags, Addr rsp, -- Long* parent_tidptr, -- Long* child_tidptr, -- Addr tlsaddr ) --{ -- static const Bool debug = False; -- -- ThreadId ctid = VG_(alloc_ThreadState)(); -- ThreadState* ptst = VG_(get_ThreadState)(ptid); -- ThreadState* ctst = VG_(get_ThreadState)(ctid); -- UWord* stack; -- SysRes res; -- Long rax; -- vki_sigset_t blockall, savedmask; -- -- VG_(sigfillset)(&blockall); -- -- vg_assert(VG_(is_running_thread)(ptid)); -- vg_assert(VG_(is_valid_tid)(ctid)); -- -- stack = (UWord*)ML_(allocstack)(ctid); -- if (stack == NULL) { -- res = VG_(mk_SysRes_Error)( VKI_ENOMEM ); -- goto out; -- } -- -- /* Copy register state -- -- Both parent and child return to the same place, and the code -- following the clone syscall works out which is which, so we -- don't need to worry about it. -- -- The parent gets the child's new tid returned from clone, but the -- child gets 0. -- -- If the clone call specifies a NULL rsp for the new thread, then -- it actually gets a copy of the parent's rsp. -- */ -- setup_child( &ctst->arch, &ptst->arch ); -- -- /* Make sys_clone appear to have returned Success(0) in the -- child. */ -- ctst->arch.vex.guest_RAX = 0; -- -- if (rsp != 0) -- ctst->arch.vex.guest_RSP = rsp; -- -- ctst->os_state.parent = ptid; -- -- /* inherit signal mask */ -- ctst->sig_mask = ptst->sig_mask; -- ctst->tmp_sig_mask = ptst->sig_mask; -- -- /* Start the child with its threadgroup being the same as the -- parent's. This is so that any exit_group calls that happen -- after the child is created but before it sets its -- os_state.threadgroup field for real (in thread_wrapper in -- syswrap-linux.c), really kill the new thread. a.k.a this avoids -- a race condition in which the thread is unkillable (via -- exit_group) because its threadgroup is not set. The race window -- is probably only a few hundred or a few thousand cycles long. -- See #226116. */ -- ctst->os_state.threadgroup = ptst->os_state.threadgroup; -- -- ML_(guess_and_register_stack) (rsp, ctst); -- -- /* Assume the clone will succeed, and tell any tool that wants to -- know that this thread has come into existence. If the clone -- fails, we'll send out a ll_exit notification for it at the out: -- label below, to clean up. */ -- vg_assert(VG_(owns_BigLock_LL)(ptid)); -- VG_TRACK ( pre_thread_ll_create, ptid, ctid ); -- -- if (flags & VKI_CLONE_SETTLS) { -- if (debug) -- VG_(printf)("clone child has SETTLS: tls at %#lx\n", tlsaddr); -- ctst->arch.vex.guest_FS_CONST = tlsaddr; -- } -- -- flags &= ~VKI_CLONE_SETTLS; -- -- /* start the thread with everything blocked */ -- VG_(sigprocmask)(VKI_SIG_SETMASK, &blockall, &savedmask); -- -- /* Create the new thread */ -- rax = do_syscall_clone_amd64_linux( -- ML_(start_thread_NORETURN), stack, flags, &VG_(threads)[ctid], -- child_tidptr, parent_tidptr, NULL -- ); -- res = VG_(mk_SysRes_amd64_linux)( rax ); -- -- VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL); -- -- out: -- if (sr_isError(res)) { -- /* clone failed */ -- VG_(cleanup_thread)(&ctst->arch); -- ctst->status = VgTs_Empty; -- /* oops. Better tell the tool the thread exited in a hurry :-) */ -- VG_TRACK( pre_thread_ll_exit, ctid ); -- } -- -- return res; --} -- -- - /* --------------------------------------------------------------------- - More thread stuff - ------------------------------------------------------------------ */ -@@ -311,16 +184,6 @@ void VG_(cleanup_thread) ( ThreadArchState *arch ) - { - } - --void setup_child ( /*OUT*/ ThreadArchState *child, -- /*IN*/ ThreadArchState *parent ) --{ -- /* We inherit our parent's guest state. */ -- child->vex = parent->vex; -- child->vex_shadow1 = parent->vex_shadow1; -- child->vex_shadow2 = parent->vex_shadow2; --} -- -- - /* --------------------------------------------------------------------- - PRE/POST wrappers for AMD64/Linux-specific syscalls - ------------------------------------------------------------------ */ -@@ -333,7 +196,6 @@ void setup_child ( /*OUT*/ ThreadArchState *child, - the right thing to do is to make these wrappers 'static' since they - aren't visible outside this file, but that requires even more macro - magic. */ --DECL_TEMPLATE(amd64_linux, sys_clone); - DECL_TEMPLATE(amd64_linux, sys_rt_sigreturn); - DECL_TEMPLATE(amd64_linux, sys_arch_prctl); - DECL_TEMPLATE(amd64_linux, sys_ptrace); -@@ -342,108 +204,6 @@ DECL_TEMPLATE(amd64_linux, sys_mmap); - DECL_TEMPLATE(amd64_linux, sys_syscall184); - - --PRE(sys_clone) --{ -- ULong cloneflags; -- -- PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5); -- PRE_REG_READ2(int, "clone", -- unsigned long, flags, -- void *, child_stack); -- -- if (ARG1 & VKI_CLONE_PARENT_SETTID) { -- if (VG_(tdict).track_pre_reg_read) { -- PRA3("clone", int *, parent_tidptr); -- } -- PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- if (ARG1 & VKI_CLONE_SETTLS) { -- if (VG_(tdict).track_pre_reg_read) { -- PRA4("clone", vki_modify_ldt_t *, tlsinfo); -- } -- PRE_MEM_READ("clone(tlsinfo)", ARG4, sizeof(vki_modify_ldt_t)); -- if (!VG_(am_is_valid_for_client)(ARG4, sizeof(vki_modify_ldt_t), -- VKI_PROT_READ)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) { -- if (VG_(tdict).track_pre_reg_read) { -- PRA5("clone", int *, child_tidptr); -- } -- PRE_MEM_WRITE("clone(child_tidptr)", ARG4, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG4, sizeof(Int), VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- -- cloneflags = ARG1; -- -- if (!ML_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) { -- SET_STATUS_Failure( VKI_EINVAL ); -- return; -- } -- -- /* Only look at the flags we really care about */ -- switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS -- | VKI_CLONE_FILES | VKI_CLONE_VFORK)) { -- case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES: -- /* thread creation */ -- SET_STATUS_from_SysRes( -- do_clone(tid, -- ARG1, /* flags */ -- (Addr)ARG2, /* child ESP */ -- (Long *)ARG3, /* parent_tidptr */ -- (Long *)ARG4, /* child_tidptr */ -- (Addr)ARG5)); /* set_tls */ -- break; -- -- case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */ -- /* FALLTHROUGH - assume vfork == fork */ -- cloneflags &= ~(VKI_CLONE_VFORK | VKI_CLONE_VM); -- -- case 0: /* plain fork */ -- SET_STATUS_from_SysRes( -- ML_(do_fork_clone)(tid, -- cloneflags, /* flags */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG4)); /* child_tidptr */ -- break; -- -- default: -- /* should we just ENOSYS? */ -- VG_(message)(Vg_UserMsg, -- "Unsupported clone() flags: 0x%lx\n", ARG1); -- VG_(message)(Vg_UserMsg, -- "\n"); -- VG_(message)(Vg_UserMsg, -- "The only supported clone() uses are:\n"); -- VG_(message)(Vg_UserMsg, -- " - via a threads library (LinuxThreads or NPTL)\n"); -- VG_(message)(Vg_UserMsg, -- " - via the implementation of fork or vfork\n"); -- VG_(unimplemented) -- ("Valgrind does not support general clone()."); -- } -- -- if (SUCCESS) { -- if (ARG1 & VKI_CLONE_PARENT_SETTID) -- POST_MEM_WRITE(ARG3, sizeof(Int)); -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) -- POST_MEM_WRITE(ARG4, sizeof(Int)); -- -- /* Thread creation was successful; let the child have the chance -- to run */ -- *flags |= SfYieldAfter; -- } --} -- - PRE(sys_rt_sigreturn) - { - /* This isn't really a syscall at all - it's a misuse of the -@@ -761,7 +521,7 @@ static SyscallTableEntry syscall_table[] = { - LINX_(__NR_setsockopt, sys_setsockopt), // 54 - - LINXY(__NR_getsockopt, sys_getsockopt), // 55 -- PLAX_(__NR_clone, sys_clone), // 56 -+ LINX_(__NR_clone, sys_clone), // 56 - GENX_(__NR_fork, sys_fork), // 57 - GENX_(__NR_vfork, sys_fork), // 58 treat as fork - GENX_(__NR_execve, sys_execve), // 59 -diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c -index 3bbd109..b417428 100644 ---- a/coregrind/m_syswrap/syswrap-arm-linux.c -+++ b/coregrind/m_syswrap/syswrap-arm-linux.c -@@ -102,14 +102,7 @@ asm( - #define __NR_CLONE VG_STRINGIFY(__NR_clone) - #define __NR_EXIT VG_STRINGIFY(__NR_exit) - --extern --ULong do_syscall_clone_arm_linux ( Word (*fn)(void *), -- void* stack, -- Int flags, -- void* arg, -- Int* child_tid, -- Int* parent_tid, -- void* tls ); -+// See priv_syswrap-linux.h for arg profile. - asm( - ".text\n" - ".globl do_syscall_clone_arm_linux\n" -@@ -148,104 +141,8 @@ asm( - #undef __NR_EXIT - - // forward declarations --static void setup_child ( ThreadArchState*, ThreadArchState* ); --static void assign_guest_tls(ThreadId ctid, Addr tlsptr); - static SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ); - --/* -- When a client clones, we need to keep track of the new thread. This means: -- 1. allocate a ThreadId+ThreadState+stack for the thread -- -- 2. initialize the thread's new VCPU state -- -- 3. create the thread using the same args as the client requested, -- but using the scheduler entrypoint for IP, and a separate stack -- for SP. -- */ --static SysRes do_clone ( ThreadId ptid, -- UInt flags, Addr sp, -- Int *parent_tidptr, -- Int *child_tidptr, -- Addr child_tls) --{ -- ThreadId ctid = VG_(alloc_ThreadState)(); -- ThreadState* ptst = VG_(get_ThreadState)(ptid); -- ThreadState* ctst = VG_(get_ThreadState)(ctid); -- UInt r0; -- UWord *stack; -- SysRes res; -- vki_sigset_t blockall, savedmask; -- -- VG_(sigfillset)(&blockall); -- -- vg_assert(VG_(is_running_thread)(ptid)); -- vg_assert(VG_(is_valid_tid)(ctid)); -- -- stack = (UWord*)ML_(allocstack)(ctid); -- -- if(stack == NULL) { -- res = VG_(mk_SysRes_Error)( VKI_ENOMEM ); -- goto out; -- } -- -- setup_child( &ctst->arch, &ptst->arch ); -- -- ctst->arch.vex.guest_R0 = 0; -- if(sp != 0) -- ctst->arch.vex.guest_R13 = sp; -- -- ctst->os_state.parent = ptid; -- -- ctst->sig_mask = ptst->sig_mask; -- ctst->tmp_sig_mask = ptst->sig_mask; -- -- /* Start the child with its threadgroup being the same as the -- parent's. This is so that any exit_group calls that happen -- after the child is created but before it sets its -- os_state.threadgroup field for real (in thread_wrapper in -- syswrap-linux.c), really kill the new thread. a.k.a this avoids -- a race condition in which the thread is unkillable (via -- exit_group) because its threadgroup is not set. The race window -- is probably only a few hundred or a few thousand cycles long. -- See #226116. */ -- ctst->os_state.threadgroup = ptst->os_state.threadgroup; -- -- ML_(guess_and_register_stack) (sp, ctst); -- -- vg_assert(VG_(owns_BigLock_LL)(ptid)); -- VG_TRACK ( pre_thread_ll_create, ptid, ctid ); -- -- if (flags & VKI_CLONE_SETTLS) { -- /* Just assign the tls pointer in the guest TPIDRURO. */ -- assign_guest_tls(ctid, child_tls); -- } -- -- flags &= ~VKI_CLONE_SETTLS; -- -- VG_(sigprocmask)(VKI_SIG_SETMASK, &blockall, &savedmask); -- -- r0 = do_syscall_clone_arm_linux( -- ML_(start_thread_NORETURN), stack, flags, &VG_(threads)[ctid], -- child_tidptr, parent_tidptr, NULL -- ); -- //VG_(printf)("AFTER SYSCALL, %x and %x CHILD: %d PARENT: %d\n",child_tidptr, parent_tidptr,*child_tidptr,*parent_tidptr); -- -- res = VG_(mk_SysRes_arm_linux)( r0 ); -- -- VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL); -- --out: -- if (sr_isError(res)) { -- VG_(cleanup_thread)(&ctst->arch); -- ctst->status = VgTs_Empty; -- VG_TRACK( pre_thread_ll_exit, ctid ); -- } -- -- return res; --} -- -- -- - /* --------------------------------------------------------------------- - More thread stuff - ------------------------------------------------------------------ */ -@@ -256,26 +153,13 @@ void VG_(cleanup_thread) ( ThreadArchState* arch ) - { - } - --void setup_child ( /*OUT*/ ThreadArchState *child, -- /*IN*/ ThreadArchState *parent ) --{ -- child->vex = parent->vex; -- child->vex_shadow1 = parent->vex_shadow1; -- child->vex_shadow2 = parent->vex_shadow2; --} -- --static void assign_guest_tls(ThreadId tid, Addr tlsptr) --{ -- VG_(threads)[tid].arch.vex.guest_TPIDRURO = tlsptr; --} -- - /* Assigns tlsptr to the guest TPIDRURO. - If needed for the specific hardware, really executes - the set_tls syscall. - */ - static SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ) - { -- assign_guest_tls(tid, tlsptr); -+ VG_(threads)[tid].arch.vex.guest_TPIDRURO = tlsptr; - - if (KernelVariantiS(KernelVariant_android_no_hw_tls, - VG_(clo_kernel_variant))) { -@@ -333,7 +217,6 @@ DECL_TEMPLATE(arm_linux, sys_stat64); - DECL_TEMPLATE(arm_linux, sys_lstat64); - DECL_TEMPLATE(arm_linux, sys_fstatat64); - DECL_TEMPLATE(arm_linux, sys_fstat64); --DECL_TEMPLATE(arm_linux, sys_clone); - DECL_TEMPLATE(arm_linux, sys_sigreturn); - DECL_TEMPLATE(arm_linux, sys_rt_sigreturn); - DECL_TEMPLATE(arm_linux, sys_sigsuspend); -@@ -424,100 +307,6 @@ POST(sys_fstat64) - POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); - } - --PRE(sys_clone) --{ -- UInt cloneflags; -- -- PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5); -- PRE_REG_READ5(int, "clone", -- unsigned long, flags, -- void *, child_stack, -- int *, parent_tidptr, -- void *, child_tls, -- int *, child_tidptr); -- -- if (ARG1 & VKI_CLONE_PARENT_SETTID) { -- PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), -- VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) { -- PRE_MEM_WRITE("clone(child_tidptr)", ARG5, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG5, sizeof(Int), -- VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- if (ARG1 & VKI_CLONE_SETTLS) { -- PRE_MEM_READ("clone(tls_user_desc)", ARG4, sizeof(vki_modify_ldt_t)); -- if (!VG_(am_is_valid_for_client)(ARG4, sizeof(vki_modify_ldt_t), -- VKI_PROT_READ)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- -- cloneflags = ARG1; -- -- if (!ML_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) { -- SET_STATUS_Failure( VKI_EINVAL ); -- return; -- } -- -- /* Only look at the flags we really care about */ -- switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS -- | VKI_CLONE_FILES | VKI_CLONE_VFORK)) { -- case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES: -- /* thread creation */ -- SET_STATUS_from_SysRes( -- do_clone(tid, -- ARG1, /* flags */ -- (Addr)ARG2, /* child ESP */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG5, /* child_tidptr */ -- (Addr)ARG4)); /* set_tls */ -- break; -- -- case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */ -- /* FALLTHROUGH - assume vfork == fork */ -- cloneflags &= ~(VKI_CLONE_VFORK | VKI_CLONE_VM); -- -- case 0: /* plain fork */ -- SET_STATUS_from_SysRes( -- ML_(do_fork_clone)(tid, -- cloneflags, /* flags */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG5)); /* child_tidptr */ -- break; -- -- default: -- /* should we just ENOSYS? */ -- VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx\n", ARG1); -- VG_(message)(Vg_UserMsg, "\n"); -- VG_(message)(Vg_UserMsg, "The only supported clone() uses are:\n"); -- VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)\n"); -- VG_(message)(Vg_UserMsg, " - via the implementation of fork or vfork\n"); -- VG_(message)(Vg_UserMsg, " - for the Quadrics Elan3 user-space driver\n"); -- VG_(unimplemented) -- ("Valgrind does not support general clone()."); -- } -- -- if (SUCCESS) { -- if (ARG1 & VKI_CLONE_PARENT_SETTID) -- POST_MEM_WRITE(ARG3, sizeof(Int)); -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) -- POST_MEM_WRITE(ARG5, sizeof(Int)); -- -- /* Thread creation was successful; let the child have the chance -- to run */ -- *flags |= SfYieldAfter; -- } --} -- - PRE(sys_sigreturn) - { - /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for -@@ -901,7 +690,7 @@ static SyscallTableEntry syscall_main_table[] = { - GENX_(__NR_fsync, sys_fsync), // 118 - PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux - -- PLAX_(__NR_clone, sys_clone), // 120 -+ LINX_(__NR_clone, sys_clone), // 120 - //zz // (__NR_setdomainname, sys_setdomainname), // 121 */*(?) - GENXY(__NR_uname, sys_newuname), // 122 - // PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 -diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c -index 6b579e8..1be6629 100644 ---- a/coregrind/m_syswrap/syswrap-arm64-linux.c -+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c -@@ -138,14 +138,7 @@ asm( - #define __NR_CLONE VG_STRINGIFY(__NR_clone) - #define __NR_EXIT VG_STRINGIFY(__NR_exit) - --extern --Long do_syscall_clone_arm64_linux ( Word (*fn)(void *), -- void* child_stack, -- Long flags, -- void* arg, -- Int* child_tid, -- Int* parent_tid, -- void* tls ); -+// See priv_syswrap-linux.h for arg profile. - asm( - ".text\n" - ".globl do_syscall_clone_arm64_linux\n" -@@ -196,121 +189,6 @@ static void setup_child ( ThreadArchState*, ThreadArchState* ); - static void assign_guest_tls(ThreadId ctid, Addr tlsptr); - //ZZ static SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ); - --/* -- When a client clones, we need to keep track of the new thread. This means: -- 1. allocate a ThreadId+ThreadState+stack for the thread -- -- 2. initialize the thread's new VCPU state -- -- 3. create the thread using the same args as the client requested, -- but using the scheduler entrypoint for IP, and a separate stack -- for SP. -- */ --static SysRes do_clone ( ThreadId ptid, -- ULong flags, -- Addr child_xsp, -- Int* parent_tidptr, -- Int* child_tidptr, -- Addr child_tls ) --{ -- ThreadId ctid = VG_(alloc_ThreadState)(); -- ThreadState* ptst = VG_(get_ThreadState)(ptid); -- ThreadState* ctst = VG_(get_ThreadState)(ctid); -- UWord* stack; -- SysRes res; -- ULong x0; -- vki_sigset_t blockall, savedmask; -- -- VG_(sigfillset)(&blockall); -- -- vg_assert(VG_(is_running_thread)(ptid)); -- vg_assert(VG_(is_valid_tid)(ctid)); -- -- stack = (UWord*)ML_(allocstack)(ctid); -- if (stack == NULL) { -- res = VG_(mk_SysRes_Error)( VKI_ENOMEM ); -- goto out; -- } -- -- /* Copy register state -- -- Both parent and child return to the same place, and the code -- following the clone syscall works out which is which, so we -- don't need to worry about it. -- -- The parent gets the child's new tid returned from clone, but the -- child gets 0. -- -- If the clone call specifies a NULL xsp for the new thread, then -- it actually gets a copy of the parent's xsp. -- */ -- setup_child( &ctst->arch, &ptst->arch ); -- -- /* Make sys_clone appear to have returned Success(0) in the -- child. */ -- ctst->arch.vex.guest_X0 = 0; -- -- if (child_xsp != 0) -- ctst->arch.vex.guest_XSP = child_xsp; -- -- ctst->os_state.parent = ptid; -- -- /* inherit signal mask */ -- ctst->sig_mask = ptst->sig_mask; -- ctst->tmp_sig_mask = ptst->sig_mask; -- -- /* Start the child with its threadgroup being the same as the -- parent's. This is so that any exit_group calls that happen -- after the child is created but before it sets its -- os_state.threadgroup field for real (in thread_wrapper in -- syswrap-linux.c), really kill the new thread. a.k.a this avoids -- a race condition in which the thread is unkillable (via -- exit_group) because its threadgroup is not set. The race window -- is probably only a few hundred or a few thousand cycles long. -- See #226116. */ -- ctst->os_state.threadgroup = ptst->os_state.threadgroup; -- -- ML_(guess_and_register_stack)(child_xsp, ctst); -- -- /* Assume the clone will succeed, and tell any tool that wants to -- know that this thread has come into existence. If the clone -- fails, we'll send out a ll_exit notification for it at the out: -- label below, to clean up. */ -- vg_assert(VG_(owns_BigLock_LL)(ptid)); -- VG_TRACK ( pre_thread_ll_create, ptid, ctid ); -- -- if (flags & VKI_CLONE_SETTLS) { -- /* Just assign the tls pointer in the guest TPIDR_EL0. */ -- assign_guest_tls(ctid, child_tls); -- } -- -- flags &= ~VKI_CLONE_SETTLS; -- -- /* start the thread with everything blocked */ -- VG_(sigprocmask)(VKI_SIG_SETMASK, &blockall, &savedmask); -- -- x0 = do_syscall_clone_arm64_linux( -- ML_(start_thread_NORETURN), stack, flags, &VG_(threads)[ctid], -- child_tidptr, parent_tidptr, NULL -- ); -- -- res = VG_(mk_SysRes_arm64_linux)( x0 ); -- -- VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL); -- -- out: -- if (sr_isError(res)) { -- /* clone failed */ -- VG_(cleanup_thread)(&ctst->arch); -- ctst->status = VgTs_Empty; -- /* oops. Better tell the tool the thread exited in a hurry :-) */ -- VG_TRACK( pre_thread_ll_exit, ctid ); -- } -- -- return res; --} -- -- - /* --------------------------------------------------------------------- - More thread stuff - ------------------------------------------------------------------ */ -@@ -397,7 +275,6 @@ DECL_TEMPLATE(arm64_linux, sys_mmap); - //ZZ DECL_TEMPLATE(arm_linux, sys_lstat64); - //ZZ DECL_TEMPLATE(arm_linux, sys_fstatat64); - //ZZ DECL_TEMPLATE(arm_linux, sys_fstat64); --DECL_TEMPLATE(arm64_linux, sys_clone); - //ZZ DECL_TEMPLATE(arm_linux, sys_sigreturn); - DECL_TEMPLATE(arm64_linux, sys_rt_sigreturn); - //ZZ DECL_TEMPLATE(arm_linux, sys_sigsuspend); -@@ -512,110 +389,6 @@ PRE(sys_mmap) - //ZZ POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); - //ZZ } - --/* Aarch64 seems to use CONFIG_CLONE_BACKWARDS in the kernel. See: -- http://dev.gentoo.org/~vapier/aarch64/linux-3.12.6.config -- http://people.redhat.com/wcohen/aarch64/aarch64_config -- from linux-3.10.5/kernel/fork.c -- #ifdef CONFIG_CLONE_BACKWARDS -- SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, -- int __user *, parent_tidptr, -- int, tls_val, -- int __user *, child_tidptr) --*/ --PRE(sys_clone) --{ -- UInt cloneflags; -- -- PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5); -- PRE_REG_READ5(int, "clone", -- unsigned long, flags, -- void *, child_stack, -- int *, parent_tidptr, -- void *, child_tls, -- int *, child_tidptr); -- -- if (ARG1 & VKI_CLONE_PARENT_SETTID) { -- PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), -- VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } --//ZZ if (ARG1 & VKI_CLONE_SETTLS) { --//ZZ PRE_MEM_READ("clone(tls_user_desc)", ARG4, sizeof(vki_modify_ldt_t)); --//ZZ if (!VG_(am_is_valid_for_client)(ARG4, sizeof(vki_modify_ldt_t), --//ZZ VKI_PROT_READ)) { --//ZZ SET_STATUS_Failure( VKI_EFAULT ); --//ZZ return; --//ZZ } --//ZZ } -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) { -- PRE_MEM_WRITE("clone(child_tidptr)", ARG5, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG5, sizeof(Int), -- VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- -- cloneflags = ARG1; -- -- if (!ML_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) { -- SET_STATUS_Failure( VKI_EINVAL ); -- return; -- } -- -- /* Only look at the flags we really care about */ -- switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS -- | VKI_CLONE_FILES | VKI_CLONE_VFORK)) { -- case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES: -- /* thread creation */ -- SET_STATUS_from_SysRes( -- do_clone(tid, -- ARG1, /* flags */ -- (Addr)ARG2, /* child SP */ -- (Int*)ARG3, /* parent_tidptr */ -- (Int*)ARG5, /* child_tidptr */ -- (Addr)ARG4)); /* tls_val */ -- break; -- -- case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */ -- /* FALLTHROUGH - assume vfork == fork */ -- cloneflags &= ~(VKI_CLONE_VFORK | VKI_CLONE_VM); -- -- case 0: /* plain fork */ -- SET_STATUS_from_SysRes( -- ML_(do_fork_clone)(tid, -- cloneflags, /* flags */ -- (Int*)ARG3, /* parent_tidptr */ -- (Int*)ARG5)); /* child_tidptr */ -- break; -- -- default: -- /* should we just ENOSYS? */ -- VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx\n", ARG1); -- VG_(message)(Vg_UserMsg, "\n"); -- VG_(message)(Vg_UserMsg, "The only supported clone() uses are:\n"); -- VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)\n"); -- VG_(message)(Vg_UserMsg, " - via the implementation of fork or vfork\n"); -- VG_(message)(Vg_UserMsg, " - for the Quadrics Elan3 user-space driver\n"); -- VG_(unimplemented) -- ("Valgrind does not support general clone()."); -- } -- -- if (SUCCESS) { -- if (ARG1 & VKI_CLONE_PARENT_SETTID) -- POST_MEM_WRITE(ARG3, sizeof(Int)); -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) -- POST_MEM_WRITE(ARG5, sizeof(Int)); -- -- /* Thread creation was successful; let the child have the chance -- to run */ -- *flags |= SfYieldAfter; -- } --} -- - //ZZ PRE(sys_sigreturn) - //ZZ { - //ZZ /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for -@@ -1072,7 +845,7 @@ static SyscallTableEntry syscall_main_table[] = { - LINX_(__NR_add_key, sys_add_key), // 217 - - LINXY(__NR_keyctl, sys_keyctl), // 219 -- PLAX_(__NR_clone, sys_clone), // 220 -+ LINX_(__NR_clone, sys_clone), // 220 - GENX_(__NR_execve, sys_execve), // 221 - PLAX_(__NR_mmap, sys_mmap), // 222 - PLAX_(__NR_fadvise64, sys_fadvise64), // 223 -diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c -index b3ffdb1..aa00a5f 100644 ---- a/coregrind/m_syswrap/syswrap-linux.c -+++ b/coregrind/m_syswrap/syswrap-linux.c -@@ -93,9 +93,8 @@ static VgSchedReturnCode thread_wrapper(Word /*ThreadId*/ tidW) - VG_TRACK(pre_thread_first_insn, tid); - - tst->os_state.lwpid = VG_(gettid)(); -- /* Set the threadgroup for real. This overwrites the provisional -- value set in do_clone() syswrap-*-linux.c. See comments in -- do_clone for background, also #226116. */ -+ /* Set the threadgroup for real. This overwrites the provisional value set -+ in do_clone(). See comments in do_clone for background, also #226116. */ - tst->os_state.threadgroup = VG_(getpid)(); - - /* Thread created with all signals blocked; scheduler will set the -@@ -430,17 +429,327 @@ void VG_(main_thread_wrapper_NORETURN)(ThreadId tid) - vg_assert(0); - } - -+/* Clone a new thread. Note that in the clone syscalls, we hard-code -+ tlsaddr argument as NULL : the guest TLS is emulated via guest -+ registers, and Valgrind itself has no thread local storage. */ -+static SysRes clone_new_thread ( Word (*fn)(void *), -+ void* stack, -+ Word flags, -+ ThreadState* ctst, -+ Int* child_tidptr, -+ Int* parent_tidptr) -+{ -+ SysRes res; -+ /* Note that in all the below, we make sys_clone appear to have returned -+ Success(0) in the child, by assigning the relevant child guest -+ register(s) just before the clone syscall. */ -+#if defined(VGP_x86_linux) -+ Int eax; -+ ctst->arch.vex.guest_EAX = 0; -+ eax = do_syscall_clone_x86_linux -+ (ML_(start_thread_NORETURN), stack, flags, ctst, -+ child_tidptr, parent_tidptr, NULL); -+ res = VG_(mk_SysRes_x86_linux)( eax ); -+#elif defined(VGP_amd64_linux) -+ Long rax; -+ ctst->arch.vex.guest_RAX = 0; -+ rax = do_syscall_clone_amd64_linux -+ (ML_(start_thread_NORETURN), stack, flags, ctst, -+ child_tidptr, parent_tidptr, NULL); -+ res = VG_(mk_SysRes_amd64_linux)( rax ); -+#elif defined(VGP_ppc32_linux) -+ ULong word64; -+ UInt old_cr = LibVEX_GuestPPC32_get_CR( &ctst->arch.vex ); -+ /* %r3 = 0 */ -+ ctst->arch.vex.guest_GPR3 = 0; -+ /* %cr0.so = 0 */ -+ LibVEX_GuestPPC32_put_CR( old_cr & ~(1<<28), &ctst->arch.vex ); -+ word64 = do_syscall_clone_ppc32_linux -+ (ML_(start_thread_NORETURN), stack, flags, ctst, -+ child_tidptr, parent_tidptr, NULL); -+ /* High half word64 is syscall return value. Low half is -+ the entire CR, from which we need to extract CR0.SO. */ -+ /* VG_(printf)("word64 = 0x%llx\n", word64); */ -+ res = VG_(mk_SysRes_ppc32_linux)(/*val*/(UInt)(word64 >> 32), -+ /*errflag*/ (((UInt)word64) >> 28) & 1); -+#elif defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux) -+ ULong word64; -+ UInt old_cr = LibVEX_GuestPPC64_get_CR( &ctst->arch.vex ); -+ /* %r3 = 0 */ -+ ctst->arch.vex.guest_GPR3 = 0; -+ /* %cr0.so = 0 */ -+ LibVEX_GuestPPC64_put_CR( old_cr & ~(1<<28), &ctst->arch.vex ); -+ word64 = do_syscall_clone_ppc64_linux -+ (ML_(start_thread_NORETURN), stack, flags, ctst, -+ child_tidptr, parent_tidptr, NULL); -+ /* Low half word64 is syscall return value. Hi half is -+ the entire CR, from which we need to extract CR0.SO. */ -+ /* VG_(printf)("word64 = 0x%llx\n", word64); */ -+ res = VG_(mk_SysRes_ppc64_linux) -+ (/*val*/(UInt)(word64 & 0xFFFFFFFFULL), -+ /*errflag*/ (UInt)((word64 >> (32+28)) & 1)); -+#elif defined(VGP_s390x_linux) -+ ULong r2; -+ ctst->arch.vex.guest_r2 = 0; -+ r2 = do_syscall_clone_s390x_linux -+ (stack, flags, parent_tidptr, child_tidptr, NULL, -+ ML_(start_thread_NORETURN), ctst); -+ res = VG_(mk_SysRes_s390x_linux)( r2 ); -+#elif defined(VGP_arm64_linux) -+ ULong x0; -+ ctst->arch.vex.guest_X0 = 0; -+ x0 = do_syscall_clone_arm64_linux -+ (ML_(start_thread_NORETURN), stack, flags, ctst, -+ child_tidptr, parent_tidptr, NULL); -+ res = VG_(mk_SysRes_arm64_linux)( x0 ); -+#elif defined(VGP_arm_linux) -+ UInt r0; -+ ctst->arch.vex.guest_R0 = 0; -+ r0 = do_syscall_clone_arm_linux -+ (ML_(start_thread_NORETURN), stack, flags, ctst, -+ child_tidptr, parent_tidptr, NULL); -+ res = VG_(mk_SysRes_arm_linux)( r0 ); -+#elif defined(VGP_mips64_linux) -+ UInt ret = 0; -+ ctst->arch.vex.guest_r2 = 0; -+ ctst->arch.vex.guest_r7 = 0; -+ ret = do_syscall_clone_mips64_linux -+ (ML_(start_thread_NORETURN), stack, flags, ctst, -+ parent_tidptr, NULL, child_tidptr); -+ res = VG_(mk_SysRes_mips64_linux)( /* val */ ret, 0, /* errflag */ 0); -+#elif defined(VGP_mips32_linux) -+ UInt ret = 0; -+ ctst->arch.vex.guest_r2 = 0; -+ ctst->arch.vex.guest_r7 = 0; -+ ret = do_syscall_clone_mips_linux -+ (ML_(start_thread_NORETURN), stack, flags, ctst, -+ child_tidptr, parent_tidptr, NULL); -+ /* High half word64 is syscall return value. Low half is -+ the entire CR, from which we need to extract CR0.SO. */ -+ res = VG_ (mk_SysRes_mips32_linux) (/*val */ ret, 0, /*errflag */ 0); -+#elif defined(VGP_tilegx_linux) -+ Long ret = 0; -+ ctst->arch.vex.guest_r0 = 0; -+ ctst->arch.vex.guest_r3 = 0; -+ ret = do_syscall_clone_tilegx_linux -+ (ML_ (start_thread_NORETURN), stack, flags, ctst, -+ child_tidptr, parent_tidptr, NULL); -+ /* High half word64 is syscall return value. */ -+ res = VG_(mk_SysRes_tilegx_linux) (/*val */ ret); -+#else -+# error Unknown platform -+#endif -+ return res; -+} -+ -+static void setup_child ( /*OUT*/ ThreadArchState *child, -+ /*IN*/ ThreadArchState *parent ) -+{ -+ /* We inherit our parent's guest state. */ -+ child->vex = parent->vex; -+ child->vex_shadow1 = parent->vex_shadow1; -+ child->vex_shadow2 = parent->vex_shadow2; - --/* Do a clone which is really a fork() */ --SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags, -- Int* parent_tidptr, Int* child_tidptr ) -+#if defined(VGP_x86_linux) -+ extern void ML_(x86_setup_LDT_GDT) ( /*OUT*/ ThreadArchState *child, -+ /*IN*/ ThreadArchState *parent ); -+ ML_(x86_setup_LDT_GDT)(child, parent); -+#endif -+} -+ -+static SysRes setup_child_tls (ThreadId ctid, Addr tlsaddr) -+{ -+ static const Bool debug = False; -+ ThreadState* ctst = VG_(get_ThreadState)(ctid); -+ // res is succesful by default, overriden if a real syscall is needed/done. -+ SysRes res = VG_(mk_SysRes_Success)(0); -+ -+ if (debug) -+ VG_(printf)("clone child has SETTLS: tls at %#lx\n", tlsaddr); -+ -+#if defined(VGP_x86_linux) -+ vki_modify_ldt_t* tlsinfo = (vki_modify_ldt_t*)tlsaddr; -+ if (debug) -+ VG_(printf)("clone child has SETTLS: tls info at %p: idx=%u " -+ "base=%#lx limit=%x; esp=%#x fs=%x gs=%x\n", -+ tlsinfo, tlsinfo->entry_number, -+ tlsinfo->base_addr, tlsinfo->limit, -+ ctst->arch.vex.guest_ESP, -+ ctst->arch.vex.guest_FS, ctst->arch.vex.guest_GS); -+ res = ML_(x86_sys_set_thread_area)(ctid, tlsinfo); -+#elif defined(VGP_amd64_linux) -+ ctst->arch.vex.guest_FS_CONST = tlsaddr; -+#elif defined(VGP_ppc32_linux) -+ ctst->arch.vex.guest_GPR2 = tlsaddr; -+#elif defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux) -+ ctst->arch.vex.guest_GPR13 = tlsaddr; -+#elif defined(VGP_s390x_linux) -+ ctst->arch.vex.guest_a0 = (UInt) (tlsaddr >> 32); -+ ctst->arch.vex.guest_a1 = (UInt) tlsaddr; -+#elif defined(VGP_arm64_linux) -+ /* Just assign the tls pointer in the guest TPIDR_EL0. */ -+ ctst->arch.vex.guest_TPIDR_EL0 = tlsaddr; -+#elif defined(VGP_arm_linux) -+ /* Just assign the tls pointer in the guest TPIDRURO. */ -+ ctst->arch.vex.guest_TPIDRURO = tlsaddr; -+#elif defined(VGP_mips64_linux) -+ ctst->arch.vex.guest_ULR = tlsaddr; -+ ctst->arch.vex.guest_r27 = tlsaddr; -+#elif defined(VGP_mips32_linux) -+ ctst->arch.vex.guest_ULR = tlsaddr; -+ ctst->arch.vex.guest_r27 = tlsaddr; -+#elif defined(VGP_tilegx_linux) -+ ctst->arch.vex.guest_r53 = tlsaddr; -+#else -+# error Unknown platform -+#endif -+ return res; -+} -+ -+/* -+ When a client clones, we need to keep track of the new thread. This means: -+ 1. allocate a ThreadId+ThreadState+stack for the thread -+ -+ 2. initialize the thread's new VCPU state -+ -+ 3. create the thread using the same args as the client requested, -+ but using the scheduler entrypoint for EIP, and a separate stack -+ for ESP. -+ */ -+static SysRes do_clone ( ThreadId ptid, -+ UWord flags, Addr sp, -+ Int* parent_tidptr, -+ Int* child_tidptr, -+ Addr tlsaddr) -+{ -+ ThreadId ctid = VG_(alloc_ThreadState)(); -+ ThreadState* ptst = VG_(get_ThreadState)(ptid); -+ ThreadState* ctst = VG_(get_ThreadState)(ctid); -+ UWord* stack; -+ SysRes res; -+ vki_sigset_t blockall, savedmask; -+ -+ VG_(sigfillset)(&blockall); -+ -+ vg_assert(VG_(is_running_thread)(ptid)); -+ vg_assert(VG_(is_valid_tid)(ctid)); -+ -+ stack = (UWord*)ML_(allocstack)(ctid); -+ if (stack == NULL) { -+ res = VG_(mk_SysRes_Error)( VKI_ENOMEM ); -+ goto out; -+ } -+ -+ /* Copy register state -+ -+ Both parent and child return to the same place, and the code -+ following the clone syscall works out which is which, so we -+ don't need to worry about it. -+ -+ The parent gets the child's new tid returned from clone, but the -+ child gets 0. -+ -+ If the clone call specifies a NULL sp for the new thread, then -+ it actually gets a copy of the parent's sp. -+ */ -+ setup_child( &ctst->arch, &ptst->arch ); -+ -+ if (sp != 0) -+ VG_(set_SP)(ctid, sp); -+ -+ ctst->os_state.parent = ptid; -+ -+ /* inherit signal mask */ -+ ctst->sig_mask = ptst->sig_mask; -+ ctst->tmp_sig_mask = ptst->sig_mask; -+ -+ /* Start the child with its threadgroup being the same as the -+ parent's. This is so that any exit_group calls that happen -+ after the child is created but before it sets its -+ os_state.threadgroup field for real (in thread_wrapper in -+ syswrap-linux.c), really kill the new thread. a.k.a this avoids -+ a race condition in which the thread is unkillable (via -+ exit_group) because its threadgroup is not set. The race window -+ is probably only a few hundred or a few thousand cycles long. -+ See #226116. */ -+ ctst->os_state.threadgroup = ptst->os_state.threadgroup; -+ -+ ML_(guess_and_register_stack) (sp, ctst); -+ -+ /* Assume the clone will succeed, and tell any tool that wants to -+ know that this thread has come into existence. We cannot defer -+ it beyond this point because setup_tls, just below, -+ causes checks to assert by making references to the new ThreadId -+ if we don't state the new thread exists prior to that point. -+ If the clone fails, we'll send out a ll_exit notification for it -+ at the out: label below, to clean up. */ -+ vg_assert(VG_(owns_BigLock_LL)(ptid)); -+ VG_TRACK ( pre_thread_ll_create, ptid, ctid ); -+ -+ if (flags & VKI_CLONE_SETTLS) { -+ res = setup_child_tls(ctid, tlsaddr); -+ if (sr_isError(res)) -+ goto out; -+ } -+ flags &= ~VKI_CLONE_SETTLS; -+ -+ /* start the thread with everything blocked */ -+ VG_(sigprocmask)(VKI_SIG_SETMASK, &blockall, &savedmask); -+ -+ /* Create the new thread */ -+ res = clone_new_thread ( ML_(start_thread_NORETURN), stack, flags, ctst, -+ child_tidptr, parent_tidptr); -+ -+ VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL); -+ -+ out: -+ if (sr_isError(res)) { -+ /* clone failed */ -+ VG_(cleanup_thread)(&ctst->arch); -+ ctst->status = VgTs_Empty; -+ /* oops. Better tell the tool the thread exited in a hurry :-) */ -+ VG_TRACK( pre_thread_ll_exit, ctid ); -+ } -+ -+#if defined(VGP_mips64_linux) || defined(VGP_mips32_linux) -+ // ??? why do we set unconditionally r2 to 0, even when error out ??? -+ ptst->arch.vex.guest_r2 = 0; -+#elif defined(VGP_tilegx_linux) -+ // ??? why do we set unconditionally r0 to 0, even when error out ??? -+ ptst->arch.vex.guest_r0 = 0; -+#endif -+ -+ return res; -+} -+ -+/* Do a clone which is really a fork(). -+ ML_(do_fork_clone) uses the clone syscall to fork a child process. -+ Note that this should not be called for a thread creation. -+ Also, some flags combinations are not supported, and such combinations -+ are handled either by masking the non supported flags or by asserting. -+ -+ The CLONE_VFORK flag is accepted, as this just tells that the parent is -+ suspended till the child exits or calls execve. We better keep this flag, -+ just in case the guests parent/client code depends on this synchronisation. -+ -+ We cannot keep the flag CLONE_VM, as Valgrind will do whatever host -+ instructions in the child process, that will mess up the parent host -+ memory. So, we hope for the best and assumes that the guest application does -+ not (really) depends on sharing the memory between parent and child in the -+ interval between clone and exits/execve. -+ -+ If child_sp != 0, the child (guest) sp will be set to child_sp just after the -+ clone syscall, before child guest instructions are executed. */ -+static SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags, -+ Int* parent_tidptr, Int* child_tidptr, -+ Addr child_sp) - { - vki_sigset_t fork_saved_mask; - vki_sigset_t mask; - SysRes res; - - if (flags & (VKI_CLONE_SETTLS | VKI_CLONE_FS | VKI_CLONE_VM -- | VKI_CLONE_FILES | VKI_CLONE_VFORK)) -+ | VKI_CLONE_FILES)) - return VG_(mk_SysRes_Error)( VKI_EINVAL ); - - /* Block all signals during fork, so that we can fix things up in -@@ -476,6 +785,8 @@ SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags, - - if (!sr_isError(res) && sr_Res(res) == 0) { - /* child */ -+ if (child_sp != 0) -+ VG_(set_SP)(tid, child_sp); - VG_(do_atfork_child)(tid); - - /* restore signal mask */ -@@ -508,7 +819,6 @@ SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags, - return res; - } - -- - /* --------------------------------------------------------------------- - PRE/POST wrappers for arch-generic, Linux-specific syscalls - ------------------------------------------------------------------ */ -@@ -519,6 +829,157 @@ SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags, - #error Unknown endianness - #endif - -+PRE(sys_clone) -+{ -+ UInt cloneflags; -+ Bool badarg = False; -+ -+ PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5); -+ -+// Order of arguments differs between platforms. -+#if defined(VGP_x86_linux) \ -+ || defined(VGP_ppc32_linux) \ -+ || defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux) \ -+ || defined(VGP_arm_linux) || defined(VGP_mips32_linux) \ -+ || defined(VGP_mips64_linux) || defined(VGP_arm64_linux) -+#define ARG_CHILD_TIDPTR ARG5 -+#define PRA_CHILD_TIDPTR PRA5 -+#define ARG_TLS ARG4 -+#define PRA_TLS PRA4 -+#elif defined(VGP_amd64_linux) || defined(VGP_tilegx_linux) \ -+ || defined(VGP_s390x_linux) -+#define ARG_CHILD_TIDPTR ARG4 -+#define PRA_CHILD_TIDPTR PRA4 -+#define ARG_TLS ARG5 -+#define PRA_TLS PRA5 -+#else -+# error Unknown platform -+#endif -+// And s390x is even more special, and inverts flags and child stack args -+#if defined(VGP_s390x_linux) -+#define ARG_FLAGS ARG2 -+#define PRA_FLAGS PRA2 -+#define ARG_CHILD_STACK ARG1 -+#define PRA_CHILD_STACK PRA1 -+#else -+#define ARG_FLAGS ARG1 -+#define PRA_FLAGS PRA1 -+#define ARG_CHILD_STACK ARG2 -+#define PRA_CHILD_STACK PRA2 -+#endif -+ -+ if (VG_(tdict).track_pre_reg_read) { -+ PRA_FLAGS("clone", unsigned long, flags); -+ PRA_CHILD_STACK("clone", void *, child_stack); -+ } -+ -+ if (ARG_FLAGS & VKI_CLONE_PARENT_SETTID) { -+ if (VG_(tdict).track_pre_reg_read) { -+ PRA3("clone", int *, parent_tidptr); -+ } -+ PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int)); -+ if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), -+ VKI_PROT_WRITE)) { -+ badarg = True; -+ } -+ } -+ if (ARG_FLAGS & VKI_CLONE_SETTLS) { -+ if (VG_(tdict).track_pre_reg_read) { -+ PRA_TLS("clone", vki_modify_ldt_t *, tlsinfo); -+ } -+ /* Not very clear what is vki_modify_ldt_t: for many platforms, it is a -+ dummy type (that we define as a char). We only dereference/check the -+ ARG_TLS pointer if the type looks like a real type, i.e. sizeof > 1. */ -+ if (sizeof(vki_modify_ldt_t) > 1) { -+ PRE_MEM_READ("clone(tlsinfo)", ARG_TLS, sizeof(vki_modify_ldt_t)); -+ if (!VG_(am_is_valid_for_client)(ARG_TLS, sizeof(vki_modify_ldt_t), -+ VKI_PROT_READ)) { -+ badarg = True; -+ } -+ } -+ } -+ if (ARG_FLAGS & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) { -+ if (VG_(tdict).track_pre_reg_read) { -+ PRA_CHILD_TIDPTR("clone", int *, child_tidptr); -+ } -+ PRE_MEM_WRITE("clone(child_tidptr)", ARG_CHILD_TIDPTR, sizeof(Int)); -+ if (!VG_(am_is_valid_for_client)(ARG_CHILD_TIDPTR, sizeof(Int), -+ VKI_PROT_WRITE)) { -+ badarg = True; -+ } -+ } -+ -+ if (badarg) { -+ SET_STATUS_Failure( VKI_EFAULT ); -+ return; -+ } -+ -+ cloneflags = ARG_FLAGS; -+ -+ if (!ML_(client_signal_OK)(ARG_FLAGS & VKI_CSIGNAL)) { -+ SET_STATUS_Failure( VKI_EINVAL ); -+ return; -+ } -+ -+ /* Only look at the flags we really care about */ -+ switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS -+ | VKI_CLONE_FILES | VKI_CLONE_VFORK)) { -+ case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES: -+ /* thread creation */ -+ SET_STATUS_from_SysRes( -+ do_clone(tid, -+ ARG_FLAGS, /* flags */ -+ (Addr)ARG_CHILD_STACK, /* child ESP */ -+ (Int*)ARG3, /* parent_tidptr */ -+ (Int*)ARG_CHILD_TIDPTR, /* child_tidptr */ -+ (Addr)ARG_TLS)); /* set_tls */ -+ break; -+ -+ case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */ -+ // FALLTHROUGH - assume vfork (somewhat) == fork, see ML_(do_fork_clone). -+ cloneflags &= ~VKI_CLONE_VM; -+ -+ case 0: /* plain fork */ -+ SET_STATUS_from_SysRes( -+ ML_(do_fork_clone)(tid, -+ cloneflags, /* flags */ -+ (Int*)ARG3, /* parent_tidptr */ -+ (Int*)ARG_CHILD_TIDPTR, /* child_tidptr */ -+ (Addr)ARG_CHILD_STACK)); -+ break; -+ -+ default: -+ /* should we just ENOSYS? */ -+ VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx\n", ARG_FLAGS); -+ VG_(message)(Vg_UserMsg, "\n"); -+ VG_(message)(Vg_UserMsg, "The only supported clone() uses are:\n"); -+ VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)\n"); -+ VG_(message)(Vg_UserMsg, " - via the implementation of fork or vfork\n"); -+ VG_(unimplemented) -+ ("Valgrind does not support general clone()."); -+ } -+ -+ if (SUCCESS) { -+ if (ARG_FLAGS & VKI_CLONE_PARENT_SETTID) -+ POST_MEM_WRITE(ARG3, sizeof(Int)); -+ if (ARG_FLAGS & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) -+ POST_MEM_WRITE(ARG_CHILD_TIDPTR, sizeof(Int)); -+ -+ /* Thread creation was successful; let the child have the chance -+ to run */ -+ *flags |= SfYieldAfter; -+ } -+ -+#undef ARG_CHILD_TIDPTR -+#undef PRA_CHILD_TIDPTR -+#undef ARG_TLS -+#undef PRA_TLS -+#undef ARG_FLAGS -+#undef PRA_FLAGS -+#undef ARG_CHILD_STACK -+#undef PRA_CHILD_STACK -+} -+ - /* --------------------------------------------------------------------- - *mount wrappers - ------------------------------------------------------------------ */ -diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c -index 6e3db74..d3d70c5 100644 ---- a/coregrind/m_syswrap/syswrap-mips64-linux.c -+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c -@@ -136,14 +136,7 @@ asm ( - #define __NR_CLONE __NR_clone - #define __NR_EXIT __NR_exit - --ULong do_syscall_clone_mips64_linux ( Word (*fn) (void *), /* a0 - 4 */ -- void* stack, /* a1 - 5 */ -- Int flags, /* a2 - 6 */ -- void* arg, /* a3 - 7 */ -- Int* parent_tid, /* a4 - 8 */ -- void* /* Int tls */, /* a5 - 9 */ -- Int* child_tid ); /* a6 - 10 */ -- -+// See priv_syswrap-linux.h for arg profile. - asm( - ".text\n" - ".set noreorder\n" -@@ -199,104 +192,13 @@ asm( - #undef __NR_EXIT - - /* forward declarations */ --static void setup_child ( ThreadArchState *, ThreadArchState *); - static SysRes sys_set_tls ( ThreadId tid, Addr tlsptr); - --/* When a client clones, we need to keep track of the new thread. This means: -- 1. allocate a ThreadId+ThreadState+stack for the thread -- -- 2. initialize the thread's new VCPU state -- -- 3. create the thread using the same args as the client requested, but using -- the scheduler entrypoint for IP, and a separate stack for SP. */ --static SysRes do_clone ( ThreadId ptid, -- UInt flags, Addr sp, -- Int* parent_tidptr, -- Int* child_tidptr, -- Addr child_tls ) --{ -- const Bool debug = False; -- ThreadId ctid = VG_ (alloc_ThreadState) (); -- ThreadState * ptst = VG_ (get_ThreadState) (ptid); -- ThreadState * ctst = VG_ (get_ThreadState) (ctid); -- UInt ret = 0; -- UWord * stack; -- SysRes res; -- vki_sigset_t blockall, savedmask; -- -- VG_(sigfillset)(&blockall); -- vg_assert(VG_(is_running_thread)(ptid)); -- vg_assert(VG_(is_valid_tid)(ctid)); -- stack = (UWord *)ML_(allocstack)(ctid); -- if (stack == NULL) { -- res = VG_(mk_SysRes_Error)(VKI_ENOMEM); -- goto out; -- } -- setup_child(&ctst->arch, &ptst->arch); -- -- /* on MIPS we need to set V0 and A3 to zero */ -- ctst->arch.vex.guest_r2 = 0; -- ctst->arch.vex.guest_r7 = 0; -- if (sp != 0) -- ctst->arch.vex.guest_r29 = sp; -- -- ctst->os_state.parent = ptid; -- ctst->sig_mask = ptst->sig_mask; -- ctst->tmp_sig_mask = ptst->sig_mask; -- -- ctst->os_state.threadgroup = ptst->os_state.threadgroup; -- -- ML_(guess_and_register_stack) (sp, ctst); -- -- VG_TRACK(pre_thread_ll_create, ptid, ctid); -- if (flags & VKI_CLONE_SETTLS) { -- if (debug) -- VG_(printf)("clone child has SETTLS: tls at %#lx\n", child_tls); -- res = sys_set_tls(ctid, child_tls); -- if (sr_isError(res)) -- goto out; -- ctst->arch.vex.guest_r27 = child_tls; -- } -- -- flags &= ~VKI_CLONE_SETTLS; -- VG_ (sigprocmask) (VKI_SIG_SETMASK, &blockall, &savedmask); -- /* Create the new thread */ -- ret = do_syscall_clone_mips64_linux(ML_(start_thread_NORETURN), -- stack, flags, &VG_(threads)[ctid], -- parent_tidptr, NULL /*child_tls*/, -- child_tidptr); -- if (debug) -- VG_(printf)("ret: 0x%x\n", ret); -- -- res = VG_(mk_SysRes_mips64_linux)( /* val */ ret, 0, /* errflag */ 0); -- -- VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL); -- -- out: -- if (sr_isError (res)) { -- VG_ (cleanup_thread) (&ctst->arch); -- ctst->status = VgTs_Empty; -- VG_TRACK (pre_thread_ll_exit, ctid); -- } -- ptst->arch.vex.guest_r2 = 0; -- -- return res; --} -- - /* --------------------------------------------------------------------- - More thread stuff - ------------------------------------------------------------------ */ - void VG_(cleanup_thread) ( ThreadArchState * arch ) { }; - --void setup_child ( /* OUT */ ThreadArchState * child, -- /* IN */ ThreadArchState * parent ) --{ -- /* We inherit our parent's guest state. */ -- child->vex = parent->vex; -- child->vex_shadow1 = parent->vex_shadow1; -- child->vex_shadow2 = parent->vex_shadow2; --} -- - SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ) - { - VG_(threads)[tid].arch.vex.guest_ULR = tlsptr; -@@ -316,7 +218,6 @@ SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ) - file, but that requires even more macro magic. */ - - DECL_TEMPLATE (mips_linux, sys_set_thread_area); --DECL_TEMPLATE (mips_linux, sys_clone); - DECL_TEMPLATE (mips_linux, sys_tee); - DECL_TEMPLATE (mips_linux, sys_splice); - DECL_TEMPLATE (mips_linux, sys_vmsplice); -@@ -494,84 +395,6 @@ PRE(sys_mmap) - (Off64T) ARG6); - SET_STATUS_from_SysRes(r); - } -- --PRE(sys_clone) --{ -- Bool badarg = False; -- UInt cloneflags; -- PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )", ARG1, ARG2, ARG3, -- ARG4, ARG5); -- PRE_REG_READ2(int, "clone", unsigned long, flags, void *, child_stack); -- if (ARG1 & VKI_CLONE_PARENT_SETTID) { -- if (VG_(tdict).track_pre_reg_read) { -- PRA3("clone", int *, parent_tidptr); -- } -- PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), VKI_PROT_WRITE)) { -- badarg = True; -- } -- } -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) { -- if (VG_(tdict).track_pre_reg_read) { -- PRA5("clone", int *, child_tidptr); -- } -- PRE_MEM_WRITE("clone(child_tidptr)", ARG5, sizeof (Int)); -- if (!VG_(am_is_valid_for_client)(ARG5, sizeof (Int), VKI_PROT_WRITE)) -- badarg = True; -- } -- if (badarg) { -- SET_STATUS_Failure(VKI_EFAULT); -- return; -- } -- cloneflags = ARG1; -- if (!ML_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) { -- SET_STATUS_Failure(VKI_EINVAL); -- return; -- } -- /* Only look at the flags we really care about */ -- switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS -- |VKI_CLONE_FILES | VKI_CLONE_VFORK)) { -- case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES: -- /* thread creation */ -- SET_STATUS_from_SysRes(do_clone(tid, -- ARG1, /* flags */ -- (Addr)ARG2, /* child SP */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG5, /* child_tidptr */ -- (Addr)ARG4)); /* child_tls */ -- break; -- -- case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */ -- /* FALLTHROUGH - assume vfork == fork */ -- cloneflags &= ~(VKI_CLONE_VFORK | VKI_CLONE_VM); -- case 0: /* plain fork */ -- SET_STATUS_from_SysRes(ML_(do_fork_clone)(tid, -- cloneflags, /* flags */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG5)); /* child_tidptr */ -- break; -- -- default: -- /* should we just ENOSYS? */ -- VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx\n", ARG1); -- VG_(message)(Vg_UserMsg, "\n"); -- VG_(message)(Vg_UserMsg, "The only supported clone() uses are:\n"); -- VG_(message)(Vg_UserMsg, -- " - via a threads library (LinuxThreads or NPTL)\n"); -- VG_(message)(Vg_UserMsg, -- " - via the implementation of fork or vfork\n"); -- VG_(unimplemented)("Valgrind does not support general clone()."); -- } -- if (SUCCESS) { -- if (ARG1 & VKI_CLONE_PARENT_SETTID) -- POST_MEM_WRITE(ARG3, sizeof(Int)); -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) -- POST_MEM_WRITE(ARG5, sizeof(Int)); -- /* Thread creation was successful; let the child have the chance to run */ -- *flags |= SfYieldAfter; -- } --} -- - PRE(sys_rt_sigreturn) - { - /* See comments on PRE(sys_rt_sigreturn) in syswrap-s390x-linux.c for -@@ -766,7 +589,7 @@ static SyscallTableEntry syscall_main_table[] = { - LINXY (__NR_socketpair, sys_socketpair), - LINX_ (__NR_setsockopt, sys_setsockopt), - LINXY (__NR_getsockopt, sys_getsockopt), -- PLAX_ (__NR_clone, sys_clone), -+ LINX_ (__NR_clone, sys_clone), - GENX_ (__NR_fork, sys_fork), - GENX_ (__NR_execve, sys_execve), - GENX_ (__NR_exit, sys_exit), -diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c -index 379fcb3..a654a90 100644 ---- a/coregrind/m_syswrap/syswrap-ppc32-linux.c -+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c -@@ -146,14 +146,7 @@ asm( - #define __NR_CLONE VG_STRINGIFY(__NR_clone) - #define __NR_EXIT VG_STRINGIFY(__NR_exit) - --extern --ULong do_syscall_clone_ppc32_linux ( Word (*fn)(void *), -- void* stack, -- Int flags, -- void* arg, -- Int* child_tid, -- Int* parent_tid, -- vki_modify_ldt_t * ); -+// See priv_syswrap-linux.h for arg profile. - asm( - ".text\n" - ".globl do_syscall_clone_ppc32_linux\n" -@@ -216,145 +209,6 @@ asm( - #undef __NR_CLONE - #undef __NR_EXIT - --// forward declarations --static void setup_child ( ThreadArchState*, ThreadArchState* ); -- --/* -- When a client clones, we need to keep track of the new thread. This means: -- 1. allocate a ThreadId+ThreadState+stack for the thread -- -- 2. initialize the thread's new VCPU state -- -- 3. create the thread using the same args as the client requested, -- but using the scheduler entrypoint for IP, and a separate stack -- for SP. -- */ --static SysRes do_clone ( ThreadId ptid, -- UInt flags, Addr sp, -- Int *parent_tidptr, -- Int *child_tidptr, -- Addr child_tls) --{ -- const Bool debug = False; -- -- ThreadId ctid = VG_(alloc_ThreadState)(); -- ThreadState* ptst = VG_(get_ThreadState)(ptid); -- ThreadState* ctst = VG_(get_ThreadState)(ctid); -- ULong word64; -- UWord* stack; -- SysRes res; -- vki_sigset_t blockall, savedmask; -- -- VG_(sigfillset)(&blockall); -- -- vg_assert(VG_(is_running_thread)(ptid)); -- vg_assert(VG_(is_valid_tid)(ctid)); -- -- stack = (UWord*)ML_(allocstack)(ctid); -- if (stack == NULL) { -- res = VG_(mk_SysRes_Error)( VKI_ENOMEM ); -- goto out; -- } -- --//? /* make a stack frame */ --//? stack -= 16; --//? *(UWord *)stack = 0; -- -- -- /* Copy register state -- -- Both parent and child return to the same place, and the code -- following the clone syscall works out which is which, so we -- don't need to worry about it. -- -- The parent gets the child's new tid returned from clone, but the -- child gets 0. -- -- If the clone call specifies a NULL SP for the new thread, then -- it actually gets a copy of the parent's SP. -- -- The child's TLS register (r2) gets set to the tlsaddr argument -- if the CLONE_SETTLS flag is set. -- */ -- setup_child( &ctst->arch, &ptst->arch ); -- -- /* Make sys_clone appear to have returned Success(0) in the -- child. */ -- { UInt old_cr = LibVEX_GuestPPC32_get_CR( &ctst->arch.vex ); -- /* %r3 = 0 */ -- ctst->arch.vex.guest_GPR3 = 0; -- /* %cr0.so = 0 */ -- LibVEX_GuestPPC32_put_CR( old_cr & ~(1<<28), &ctst->arch.vex ); -- } -- -- if (sp != 0) -- ctst->arch.vex.guest_GPR1 = sp; -- -- ctst->os_state.parent = ptid; -- -- /* inherit signal mask */ -- ctst->sig_mask = ptst->sig_mask; -- ctst->tmp_sig_mask = ptst->sig_mask; -- -- /* Start the child with its threadgroup being the same as the -- parent's. This is so that any exit_group calls that happen -- after the child is created but before it sets its -- os_state.threadgroup field for real (in thread_wrapper in -- syswrap-linux.c), really kill the new thread. a.k.a this avoids -- a race condition in which the thread is unkillable (via -- exit_group) because its threadgroup is not set. The race window -- is probably only a few hundred or a few thousand cycles long. -- See #226116. */ -- ctst->os_state.threadgroup = ptst->os_state.threadgroup; -- -- ML_(guess_and_register_stack) (sp, ctst); -- -- /* Assume the clone will succeed, and tell any tool that wants to -- know that this thread has come into existence. If the clone -- fails, we'll send out a ll_exit notification for it at the out: -- label below, to clean up. */ -- vg_assert(VG_(owns_BigLock_LL)(ptid)); -- VG_TRACK ( pre_thread_ll_create, ptid, ctid ); -- -- if (flags & VKI_CLONE_SETTLS) { -- if (debug) -- VG_(printf)("clone child has SETTLS: tls at %#lx\n", child_tls); -- ctst->arch.vex.guest_GPR2 = child_tls; -- } -- -- flags &= ~VKI_CLONE_SETTLS; -- -- /* start the thread with everything blocked */ -- VG_(sigprocmask)(VKI_SIG_SETMASK, &blockall, &savedmask); -- -- /* Create the new thread */ -- word64 = do_syscall_clone_ppc32_linux( -- ML_(start_thread_NORETURN), stack, flags, &VG_(threads)[ctid], -- child_tidptr, parent_tidptr, NULL -- ); -- /* High half word64 is syscall return value. Low half is -- the entire CR, from which we need to extract CR0.SO. */ -- /* VG_(printf)("word64 = 0x%llx\n", word64); */ -- res = VG_(mk_SysRes_ppc32_linux)( -- /*val*/(UInt)(word64 >> 32), -- /*errflag*/ (((UInt)word64) >> 28) & 1 -- ); -- -- VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL); -- -- out: -- if (sr_isError(res)) { -- /* clone failed */ -- VG_(cleanup_thread)(&ctst->arch); -- ctst->status = VgTs_Empty; -- /* oops. Better tell the tool the thread exited in a hurry :-) */ -- VG_TRACK( pre_thread_ll_exit, ctid ); -- } -- -- return res; --} -- -- - - /* --------------------------------------------------------------------- - More thread stuff -@@ -364,16 +218,6 @@ void VG_(cleanup_thread) ( ThreadArchState* arch ) - { - } - --void setup_child ( /*OUT*/ ThreadArchState *child, -- /*IN*/ ThreadArchState *parent ) --{ -- /* We inherit our parent's guest state. */ -- child->vex = parent->vex; -- child->vex_shadow1 = parent->vex_shadow1; -- child->vex_shadow2 = parent->vex_shadow2; --} -- -- - /* --------------------------------------------------------------------- - PRE/POST wrappers for ppc32/Linux-specific syscalls - ------------------------------------------------------------------ */ -@@ -393,7 +237,6 @@ DECL_TEMPLATE(ppc32_linux, sys_stat64); - DECL_TEMPLATE(ppc32_linux, sys_lstat64); - DECL_TEMPLATE(ppc32_linux, sys_fstatat64); - DECL_TEMPLATE(ppc32_linux, sys_fstat64); --DECL_TEMPLATE(ppc32_linux, sys_clone); - DECL_TEMPLATE(ppc32_linux, sys_sigreturn); - DECL_TEMPLATE(ppc32_linux, sys_rt_sigreturn); - DECL_TEMPLATE(ppc32_linux, sys_sigsuspend); -@@ -530,91 +373,6 @@ POST(sys_fstat64) - //.. } - //.. } - --PRE(sys_clone) --{ -- UInt cloneflags; -- -- PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5); -- PRE_REG_READ5(int, "clone", -- unsigned long, flags, -- void *, child_stack, -- int *, parent_tidptr, -- void *, child_tls, -- int *, child_tidptr); -- -- if (ARG1 & VKI_CLONE_PARENT_SETTID) { -- PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), -- VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) { -- PRE_MEM_WRITE("clone(child_tidptr)", ARG5, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG5, sizeof(Int), -- VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- -- cloneflags = ARG1; -- -- if (!ML_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) { -- SET_STATUS_Failure( VKI_EINVAL ); -- return; -- } -- -- /* Only look at the flags we really care about */ -- switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS -- | VKI_CLONE_FILES | VKI_CLONE_VFORK)) { -- case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES: -- /* thread creation */ -- SET_STATUS_from_SysRes( -- do_clone(tid, -- ARG1, /* flags */ -- (Addr)ARG2, /* child SP */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG5, /* child_tidptr */ -- (Addr)ARG4)); /* child_tls */ -- break; -- -- case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */ -- /* FALLTHROUGH - assume vfork == fork */ -- cloneflags &= ~(VKI_CLONE_VFORK | VKI_CLONE_VM); -- -- case 0: /* plain fork */ -- SET_STATUS_from_SysRes( -- ML_(do_fork_clone)(tid, -- cloneflags, /* flags */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG5)); /* child_tidptr */ -- break; -- -- default: -- /* should we just ENOSYS? */ -- VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx\n", ARG1); -- VG_(message)(Vg_UserMsg, "\n"); -- VG_(message)(Vg_UserMsg, "The only supported clone() uses are:\n"); -- VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)\n"); -- VG_(message)(Vg_UserMsg, " - via the implementation of fork or vfork\n"); -- VG_(unimplemented) -- ("Valgrind does not support general clone()."); -- } -- -- if (SUCCESS) { -- if (ARG1 & VKI_CLONE_PARENT_SETTID) -- POST_MEM_WRITE(ARG3, sizeof(Int)); -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) -- POST_MEM_WRITE(ARG5, sizeof(Int)); -- -- /* Thread creation was successful; let the child have the chance -- to run */ -- *flags |= SfYieldAfter; -- } --} -- - PRE(sys_sigreturn) - { - /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for -@@ -999,7 +757,7 @@ static SyscallTableEntry syscall_table[] = { - GENX_(__NR_fsync, sys_fsync), // 118 - PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux - //.. -- PLAX_(__NR_clone, sys_clone), // 120 -+ LINX_(__NR_clone, sys_clone), // 120 - //.. // (__NR_setdomainname, sys_setdomainname), // 121 */*(?) - GENXY(__NR_uname, sys_newuname), // 122 - //.. PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 -diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c -index 1ae4454..f90140d 100644 ---- a/coregrind/m_syswrap/syswrap-ppc64-linux.c -+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c -@@ -209,14 +209,7 @@ asm( - #define __NR_CLONE VG_STRINGIFY(__NR_clone) - #define __NR_EXIT VG_STRINGIFY(__NR_exit) - --extern --ULong do_syscall_clone_ppc64_linux ( Word (*fn)(void *), -- void* stack, -- Int flags, -- void* arg, -- Int* child_tid, -- Int* parent_tid, -- void/*vki_modify_ldt_t*/ * ); -+// See priv_syswrap-linux.h for arg profile. - asm( - #if defined(VGP_ppc64be_linux) - " .align 2\n" -@@ -366,148 +359,6 @@ asm( - #undef __NR_CLONE - #undef __NR_EXIT - --// forward declarations --static void setup_child ( ThreadArchState*, ThreadArchState* ); -- --/* -- When a client clones, we need to keep track of the new thread. This means: -- 1. allocate a ThreadId+ThreadState+stack for the thread -- -- 2. initialize the thread's new VCPU state -- -- 3. create the thread using the same args as the client requested, -- but using the scheduler entrypoint for IP, and a separate stack -- for SP. -- */ --static SysRes do_clone ( ThreadId ptid, -- UInt flags, Addr sp, -- Int *parent_tidptr, -- Int *child_tidptr, -- Addr child_tls) --{ -- const Bool debug = False; -- -- ThreadId ctid = VG_(alloc_ThreadState)(); -- ThreadState* ptst = VG_(get_ThreadState)(ptid); -- ThreadState* ctst = VG_(get_ThreadState)(ctid); -- ULong word64; -- UWord* stack; -- SysRes res; -- vki_sigset_t blockall, savedmask; -- -- VG_(sigfillset)(&blockall); -- -- vg_assert(VG_(is_running_thread)(ptid)); -- vg_assert(VG_(is_valid_tid)(ctid)); -- -- stack = (UWord*)ML_(allocstack)(ctid); -- if (stack == NULL) { -- res = VG_(mk_SysRes_Error)( VKI_ENOMEM ); -- goto out; -- } -- --//? /* make a stack frame */ --//? stack -= 16; --//? *(UWord *)stack = 0; -- -- -- /* Copy register state -- -- Both parent and child return to the same place, and the code -- following the clone syscall works out which is which, so we -- don't need to worry about it. -- -- The parent gets the child's new tid returned from clone, but the -- child gets 0. -- -- If the clone call specifies a NULL SP for the new thread, then -- it actually gets a copy of the parent's SP. -- -- The child's TLS register (r2) gets set to the tlsaddr argument -- if the CLONE_SETTLS flag is set. -- */ -- setup_child( &ctst->arch, &ptst->arch ); -- -- /* Make sys_clone appear to have returned Success(0) in the -- child. */ -- { UInt old_cr = LibVEX_GuestPPC64_get_CR( &ctst->arch.vex ); -- /* %r3 = 0 */ -- ctst->arch.vex.guest_GPR3 = 0; -- /* %cr0.so = 0 */ -- LibVEX_GuestPPC64_put_CR( old_cr & ~(1<<28), &ctst->arch.vex ); -- } -- -- if (sp != 0) -- ctst->arch.vex.guest_GPR1 = sp; -- -- ctst->os_state.parent = ptid; -- -- /* inherit signal mask */ -- ctst->sig_mask = ptst->sig_mask; -- ctst->tmp_sig_mask = ptst->sig_mask; -- -- /* Start the child with its threadgroup being the same as the -- parent's. This is so that any exit_group calls that happen -- after the child is created but before it sets its -- os_state.threadgroup field for real (in thread_wrapper in -- syswrap-linux.c), really kill the new thread. a.k.a this avoids -- a race condition in which the thread is unkillable (via -- exit_group) because its threadgroup is not set. The race window -- is probably only a few hundred or a few thousand cycles long. -- See #226116. */ -- ctst->os_state.threadgroup = ptst->os_state.threadgroup; -- -- ML_(guess_and_register_stack) (sp, ctst); -- -- /* Assume the clone will succeed, and tell any tool that wants to -- know that this thread has come into existence. If the clone -- fails, we'll send out a ll_exit notification for it at the out: -- label below, to clean up. */ -- vg_assert(VG_(owns_BigLock_LL)(ptid)); -- VG_TRACK ( pre_thread_ll_create, ptid, ctid ); -- -- if (flags & VKI_CLONE_SETTLS) { -- if (debug) -- VG_(printf)("clone child has SETTLS: tls at %#lx\n", child_tls); -- ctst->arch.vex.guest_GPR13 = child_tls; -- } -- -- flags &= ~VKI_CLONE_SETTLS; -- -- /* start the thread with everything blocked */ -- VG_(sigprocmask)(VKI_SIG_SETMASK, &blockall, &savedmask); -- -- /* Create the new thread */ -- word64 = do_syscall_clone_ppc64_linux( -- ML_(start_thread_NORETURN), -- stack, flags, &VG_(threads)[ctid], -- child_tidptr, parent_tidptr, NULL -- ); -- -- /* Low half word64 is syscall return value. Hi half is -- the entire CR, from which we need to extract CR0.SO. */ -- /* VG_(printf)("word64 = 0x%llx\n", word64); */ -- res = VG_(mk_SysRes_ppc64_linux)( -- /*val*/(UInt)(word64 & 0xFFFFFFFFULL), -- /*errflag*/ (UInt)((word64 >> (32+28)) & 1) -- ); -- -- VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL); -- -- out: -- if (sr_isError(res)) { -- /* clone failed */ -- VG_(cleanup_thread)(&ctst->arch); -- ctst->status = VgTs_Empty; -- /* oops. Better tell the tool the thread exited in a hurry :-) */ -- VG_TRACK( pre_thread_ll_exit, ctid ); -- } -- -- return res; --} -- -- -- - /* --------------------------------------------------------------------- - More thread stuff - ------------------------------------------------------------------ */ -@@ -516,16 +367,6 @@ void VG_(cleanup_thread) ( ThreadArchState* arch ) - { - } - --void setup_child ( /*OUT*/ ThreadArchState *child, -- /*IN*/ ThreadArchState *parent ) --{ -- /* We inherit our parent's guest state. */ -- child->vex = parent->vex; -- child->vex_shadow1 = parent->vex_shadow1; -- child->vex_shadow2 = parent->vex_shadow2; --} -- -- - /* --------------------------------------------------------------------- - PRE/POST wrappers for ppc64/Linux-specific syscalls - ------------------------------------------------------------------ */ -@@ -544,7 +385,6 @@ DECL_TEMPLATE(ppc64_linux, sys_mmap); - //zz DECL_TEMPLATE(ppc64_linux, sys_stat64); - //zz DECL_TEMPLATE(ppc64_linux, sys_lstat64); - //zz DECL_TEMPLATE(ppc64_linux, sys_fstat64); --DECL_TEMPLATE(ppc64_linux, sys_clone); - //zz DECL_TEMPLATE(ppc64_linux, sys_sigreturn); - DECL_TEMPLATE(ppc64_linux, sys_rt_sigreturn); - DECL_TEMPLATE(ppc64_linux, sys_fadvise64); -@@ -629,92 +469,6 @@ PRE(sys_mmap) - //zz POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); - //zz } - -- --PRE(sys_clone) --{ -- UInt cloneflags; -- -- PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5); -- PRE_REG_READ5(int, "clone", -- unsigned long, flags, -- void *, child_stack, -- int *, parent_tidptr, -- void *, child_tls, -- int *, child_tidptr); -- -- if (ARG1 & VKI_CLONE_PARENT_SETTID) { -- PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), -- VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) { -- PRE_MEM_WRITE("clone(child_tidptr)", ARG5, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG5, sizeof(Int), -- VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- -- cloneflags = ARG1; -- -- if (!ML_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) { -- SET_STATUS_Failure( VKI_EINVAL ); -- return; -- } -- -- /* Only look at the flags we really care about */ -- switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS -- | VKI_CLONE_FILES | VKI_CLONE_VFORK)) { -- case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES: -- /* thread creation */ -- SET_STATUS_from_SysRes( -- do_clone(tid, -- ARG1, /* flags */ -- (Addr)ARG2, /* child SP */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG5, /* child_tidptr */ -- (Addr)ARG4)); /* child_tls */ -- break; -- -- case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */ -- /* FALLTHROUGH - assume vfork == fork */ -- cloneflags &= ~(VKI_CLONE_VFORK | VKI_CLONE_VM); -- -- case 0: /* plain fork */ -- SET_STATUS_from_SysRes( -- ML_(do_fork_clone)(tid, -- cloneflags, /* flags */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG5)); /* child_tidptr */ -- break; -- -- default: -- /* should we just ENOSYS? */ -- VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx\n", ARG1); -- VG_(message)(Vg_UserMsg, "\n"); -- VG_(message)(Vg_UserMsg, "The only supported clone() uses are:\n"); -- VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)\n"); -- VG_(message)(Vg_UserMsg, " - via the implementation of fork or vfork\n"); -- VG_(unimplemented) -- ("Valgrind does not support general clone()."); -- } -- -- if (SUCCESS) { -- if (ARG1 & VKI_CLONE_PARENT_SETTID) -- POST_MEM_WRITE(ARG3, sizeof(Int)); -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) -- POST_MEM_WRITE(ARG5, sizeof(Int)); -- -- /* Thread creation was successful; let the child have the chance -- to run */ -- *flags |= SfYieldAfter; -- } --} -- - PRE(sys_fadvise64) - { - PRINT("sys_fadvise64 ( %ld, %ld, %lu, %ld )", SARG1, SARG2, SARG3, SARG4); -@@ -922,7 +676,7 @@ static SyscallTableEntry syscall_table[] = { - GENX_(__NR_fsync, sys_fsync), // 118 - // _____(__NR_sigreturn, sys_sigreturn), // 119 - -- PLAX_(__NR_clone, sys_clone), // 120 -+ LINX_(__NR_clone, sys_clone), // 120 - // _____(__NR_setdomainname, sys_setdomainname), // 121 - GENXY(__NR_uname, sys_newuname), // 122 - // _____(__NR_modify_ldt, sys_modify_ldt), // 123 -diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c -index ebb8295..f596341 100644 ---- a/coregrind/m_syswrap/syswrap-s390x-linux.c -+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c -@@ -138,14 +138,7 @@ asm( - #define __NR_CLONE VG_STRINGIFY(__NR_clone) - #define __NR_EXIT VG_STRINGIFY(__NR_exit) - --extern --ULong do_syscall_clone_s390x_linux ( void *stack, -- ULong flags, -- Int *parent_tid, -- Int *child_tid, -- Addr tlsaddr, -- Word (*fn)(void *), -- void *arg); -+// See priv_syswrap-linux.h for arg profile. - asm( - " .text\n" - " .align 4\n" -@@ -182,126 +175,6 @@ void VG_(cleanup_thread) ( ThreadArchState* arch ) - /* only used on x86 for descriptor tables */ - } - --static void setup_child ( /*OUT*/ ThreadArchState *child, -- /*IN*/ ThreadArchState *parent ) --{ -- /* We inherit our parent's guest state. */ -- child->vex = parent->vex; -- child->vex_shadow1 = parent->vex_shadow1; -- child->vex_shadow2 = parent->vex_shadow2; --} -- -- --/* -- When a client clones, we need to keep track of the new thread. This means: -- 1. allocate a ThreadId+ThreadState+stack for the thread -- -- 2. initialize the thread's new VCPU state -- -- 3. create the thread using the same args as the client requested, -- but using the scheduler entrypoint for IP, and a separate stack -- for SP. -- */ --static SysRes do_clone ( ThreadId ptid, -- Addr sp, ULong flags, -- Int *parent_tidptr, -- Int *child_tidptr, -- Addr tlsaddr) --{ -- static const Bool debug = False; -- -- ThreadId ctid = VG_(alloc_ThreadState)(); -- ThreadState* ptst = VG_(get_ThreadState)(ptid); -- ThreadState* ctst = VG_(get_ThreadState)(ctid); -- UWord* stack; -- SysRes res; -- ULong r2; -- vki_sigset_t blockall, savedmask; -- -- VG_(sigfillset)(&blockall); -- -- vg_assert(VG_(is_running_thread)(ptid)); -- vg_assert(VG_(is_valid_tid)(ctid)); -- -- stack = (UWord*)ML_(allocstack)(ctid); -- if (stack == NULL) { -- res = VG_(mk_SysRes_Error)( VKI_ENOMEM ); -- goto out; -- } -- -- /* Copy register state -- -- Both parent and child return to the same place, and the code -- following the clone syscall works out which is which, so we -- don't need to worry about it. -- -- The parent gets the child's new tid returned from clone, but the -- child gets 0. -- -- If the clone call specifies a NULL sp for the new thread, then -- it actually gets a copy of the parent's sp. -- */ -- setup_child( &ctst->arch, &ptst->arch ); -- -- /* Make sys_clone appear to have returned Success(0) in the -- child. */ -- ctst->arch.vex.guest_r2 = 0; -- -- if (sp != 0) -- ctst->arch.vex.guest_SP = sp; -- -- ctst->os_state.parent = ptid; -- -- /* inherit signal mask */ -- ctst->sig_mask = ptst->sig_mask; -- ctst->tmp_sig_mask = ptst->sig_mask; -- -- /* have the parents thread group */ -- ctst->os_state.threadgroup = ptst->os_state.threadgroup; -- -- ML_(guess_and_register_stack) (sp, ctst); -- -- /* Assume the clone will succeed, and tell any tool that wants to -- know that this thread has come into existence. If the clone -- fails, we'll send out a ll_exit notification for it at the out: -- label below, to clean up. */ -- vg_assert(VG_(owns_BigLock_LL)(ptid)); -- VG_TRACK ( pre_thread_ll_create, ptid, ctid ); -- -- if (flags & VKI_CLONE_SETTLS) { -- if (debug) -- VG_(printf)("clone child has SETTLS: tls at %#lx\n", tlsaddr); -- ctst->arch.vex.guest_a0 = (UInt) (tlsaddr >> 32); -- ctst->arch.vex.guest_a1 = (UInt) tlsaddr; -- } -- flags &= ~VKI_CLONE_SETTLS; -- -- /* start the thread with everything blocked */ -- VG_(sigprocmask)(VKI_SIG_SETMASK, &blockall, &savedmask); -- -- /* Create the new thread */ -- r2 = do_syscall_clone_s390x_linux( -- stack, flags, parent_tidptr, child_tidptr, tlsaddr, -- ML_(start_thread_NORETURN), &VG_(threads)[ctid]); -- -- res = VG_(mk_SysRes_s390x_linux)( r2 ); -- -- VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL); -- -- out: -- if (sr_isError(res)) { -- /* clone failed */ -- ctst->status = VgTs_Empty; -- /* oops. Better tell the tool the thread exited in a hurry :-) */ -- VG_TRACK( pre_thread_ll_exit, ctid ); -- } -- -- return res; -- --} -- -- -- - /* --------------------------------------------------------------------- - PRE/POST wrappers for s390x/Linux-specific syscalls - ------------------------------------------------------------------ */ -@@ -317,7 +190,6 @@ static SysRes do_clone ( ThreadId ptid, - - DECL_TEMPLATE(s390x_linux, sys_ptrace); - DECL_TEMPLATE(s390x_linux, sys_mmap); --DECL_TEMPLATE(s390x_linux, sys_clone); - DECL_TEMPLATE(s390x_linux, sys_sigreturn); - DECL_TEMPLATE(s390x_linux, sys_rt_sigreturn); - DECL_TEMPLATE(s390x_linux, sys_fadvise64); -@@ -452,99 +324,6 @@ PRE(sys_mmap) - SET_STATUS_from_SysRes(r); - } - --PRE(sys_clone) --{ -- UInt cloneflags; -- -- PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4, ARG5); -- PRE_REG_READ2(int, "clone", -- void *, child_stack, -- unsigned long, flags); -- -- if (ARG2 & VKI_CLONE_PARENT_SETTID) { -- if (VG_(tdict).track_pre_reg_read) -- PRA3("clone(parent_tidptr)", int *, parent_tidptr); -- PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), -- VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- if (ARG2 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) { -- if (VG_(tdict).track_pre_reg_read) -- PRA4("clone(child_tidptr)", int *, child_tidptr); -- PRE_MEM_WRITE("clone(child_tidptr)", ARG4, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG4, sizeof(Int), -- VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- -- /* The kernel simply copies reg6 (ARG5) into AR0 and AR1, no checks */ -- if (ARG2 & VKI_CLONE_SETTLS) { -- if (VG_(tdict).track_pre_reg_read) { -- PRA5("clone", Addr, tlsinfo); -- } -- } -- -- cloneflags = ARG2; -- -- if (!ML_(client_signal_OK)(ARG2 & VKI_CSIGNAL)) { -- SET_STATUS_Failure( VKI_EINVAL ); -- return; -- } -- -- /* Only look at the flags we really care about */ -- switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS -- | VKI_CLONE_FILES | VKI_CLONE_VFORK)) { -- case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES: -- /* thread creation */ -- SET_STATUS_from_SysRes( -- do_clone(tid, -- (Addr)ARG1, /* child SP */ -- ARG2, /* flags */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG4, /* child_tidptr */ -- (Addr)ARG5)); /* tlsaddr */ -- break; -- -- case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */ -- /* FALLTHROUGH - assume vfork == fork */ -- cloneflags &= ~(VKI_CLONE_VFORK | VKI_CLONE_VM); -- -- case 0: /* plain fork */ -- SET_STATUS_from_SysRes( -- ML_(do_fork_clone)(tid, -- cloneflags, /* flags */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG4)); /* child_tidptr */ -- break; -- -- default: -- /* should we just ENOSYS? */ -- VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx\n", ARG2); -- VG_(message)(Vg_UserMsg, "\n"); -- VG_(message)(Vg_UserMsg, "The only supported clone() uses are:\n"); -- VG_(message)(Vg_UserMsg, " - via a threads library (NPTL)\n"); -- VG_(message)(Vg_UserMsg, " - via the implementation of fork or vfork\n"); -- VG_(unimplemented) -- ("Valgrind does not support general clone()."); -- } -- -- if (SUCCESS) { -- if (ARG2 & VKI_CLONE_PARENT_SETTID) -- POST_MEM_WRITE(ARG3, sizeof(Int)); -- if (ARG2 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) -- POST_MEM_WRITE(ARG4, sizeof(Int)); -- -- /* Thread creation was successful; let the child have the chance -- to run */ -- *flags |= SfYieldAfter; -- } --} -- - PRE(sys_sigreturn) - { - ThreadState* tst; -@@ -775,7 +554,7 @@ static SyscallTableEntry syscall_table[] = { - GENX_(__NR_fsync, sys_fsync), // 118 - PLAX_(__NR_sigreturn, sys_sigreturn), // 119 - -- PLAX_(__NR_clone, sys_clone), // 120 -+ LINX_(__NR_clone, sys_clone), // 120 - // ?????(__NR_setdomainname, ), // 121 - GENXY(__NR_uname, sys_newuname), // 122 - GENX_(123, sys_ni_syscall), /* unimplemented (by the kernel) */ // 123 -diff --git a/coregrind/m_syswrap/syswrap-tilegx-linux.c b/coregrind/m_syswrap/syswrap-tilegx-linux.c -index 7501b20..05d81e8 100644 ---- a/coregrind/m_syswrap/syswrap-tilegx-linux.c -+++ b/coregrind/m_syswrap/syswrap-tilegx-linux.c -@@ -224,14 +224,7 @@ void ML_(call_on_new_stack_0_1) (Addr stack, Addr retaddr, - #define __NR_CLONE VG_STRINGIFY(__NR_clone) - #define __NR_EXIT VG_STRINGIFY(__NR_exit) - --Long do_syscall_clone_tilegx_linux ( Word (*fn) (void *), //r0 -- void *stack, //r1 -- Long flags, //r2 -- void *arg, //r3 -- Long * child_tid, //r4 -- Long * parent_tid, //r5 -- Long tls ); //r6 -- /* -+ /* - stack - high -> 4 r29 - 3 -@@ -239,6 +232,7 @@ Long do_syscall_clone_tilegx_linux ( Word (*fn) (void *), //r0 - 1 r10 - low -> 0 lr <- sp - */ -+// See priv_syswrap-linux.h for arg profile. - asm ( - ".text\n" - " .globl do_syscall_clone_tilegx_linux\n" -@@ -315,101 +309,6 @@ Long do_syscall_clone_tilegx_linux ( Word (*fn) (void *), //r0 - #undef __NR_EXIT - - // forward declarations --static void setup_child ( ThreadArchState *, ThreadArchState * ); --static SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ); -- /* -- When a client clones, we need to keep track of the new thread. This means: -- 1. allocate a ThreadId+ThreadState+stack for the thread -- 2. initialize the thread's new VCPU state -- 3. create the thread using the same args as the client requested, -- but using the scheduler entrypoint for IP, and a separate stack -- for SP. -- */ --static SysRes do_clone ( ThreadId ptid, -- Long flags, Addr sp, -- Long * parent_tidptr, -- Long * child_tidptr, -- Addr child_tls ) --{ -- const Bool debug = False; -- ThreadId ctid = VG_ (alloc_ThreadState) (); -- ThreadState * ptst = VG_ (get_ThreadState) (ptid); -- ThreadState * ctst = VG_ (get_ThreadState) (ctid); -- Long ret = 0; -- Long * stack; -- SysRes res; -- vki_sigset_t blockall, savedmask; -- -- VG_ (sigfillset) (&blockall); -- vg_assert (VG_ (is_running_thread) (ptid)); -- vg_assert (VG_ (is_valid_tid) (ctid)); -- stack = (Long *) ML_ (allocstack) (ctid); -- if (stack == NULL) { -- res = VG_ (mk_SysRes_Error) (VKI_ENOMEM); -- goto out; -- } -- setup_child (&ctst->arch, &ptst->arch); -- -- /* On TILEGX we need to set r0 and r3 to zero */ -- ctst->arch.vex.guest_r0 = 0; -- ctst->arch.vex.guest_r3 = 0; -- if (sp != 0) -- ctst->arch.vex.guest_r54 = sp; -- -- ctst->os_state.parent = ptid; -- ctst->sig_mask = ptst->sig_mask; -- ctst->tmp_sig_mask = ptst->sig_mask; -- -- /* Start the child with its threadgroup being the same as the -- parent's. This is so that any exit_group calls that happen -- after the child is created but before it sets its -- os_state.threadgroup field for real (in thread_wrapper in -- syswrap-linux.c), really kill the new thread. a.k.a this avoids -- a race condition in which the thread is unkillable (via -- exit_group) because its threadgroup is not set. The race window -- is probably only a few hundred or a few thousand cycles long. -- See #226116. */ -- -- ctst->os_state.threadgroup = ptst->os_state.threadgroup; -- ML_(guess_and_register_stack) (sp, ctst); -- -- VG_TRACK (pre_thread_ll_create, ptid, ctid); -- if (flags & VKI_CLONE_SETTLS) { -- if (debug) -- VG_(printf)("clone child has SETTLS: tls at %#lx\n", child_tls); -- ctst->arch.vex.guest_r53 = child_tls; -- res = sys_set_tls(ctid, child_tls); -- if (sr_isError(res)) -- goto out; -- } -- -- flags &= ~VKI_CLONE_SETTLS; -- VG_ (sigprocmask) (VKI_SIG_SETMASK, &blockall, &savedmask); -- /* Create the new thread */ -- ret = do_syscall_clone_tilegx_linux (ML_ (start_thread_NORETURN), -- stack, flags, &VG_ (threads)[ctid], -- child_tidptr, parent_tidptr, -- (Long)NULL /*child_tls*/); -- -- /* High half word64 is syscall return value. */ -- if (debug) -- VG_(printf)("ret: 0x%llx\n", (ULong)ret); -- -- res = VG_(mk_SysRes_tilegx_linux) (/*val */ ret); -- -- VG_ (sigprocmask) (VKI_SIG_SETMASK, &savedmask, NULL); -- -- out: -- if (sr_isError (res)) { -- VG_(cleanup_thread) (&ctst->arch); -- ctst->status = VgTs_Empty; -- VG_TRACK (pre_thread_ll_exit, ctid); -- } -- ptst->arch.vex.guest_r0 = 0; -- -- return res; --} -- - extern Addr do_brk ( Addr newbrk ); - - extern -@@ -428,23 +327,6 @@ extern Bool linux_kernel_2_6_22(void); - void - VG_ (cleanup_thread) ( ThreadArchState * arch ) { } - --void --setup_child ( /*OUT*/ ThreadArchState * child, -- /*IN*/ ThreadArchState * parent ) --{ -- /* We inherit our parent's guest state. */ -- child->vex = parent->vex; -- child->vex_shadow1 = parent->vex_shadow1; -- child->vex_shadow2 = parent->vex_shadow2; --} -- --SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ) --{ -- VG_(threads)[tid].arch.vex.guest_r53 = tlsptr; -- return VG_(mk_SysRes_Success)( 0 ); --} -- -- - /* --------------------------------------------------------------------- - PRE/POST wrappers for tilegx/Linux-specific syscalls - ------------------------------------------------------------------ */ -@@ -457,7 +339,6 @@ SysRes sys_set_tls ( ThreadId tid, Addr tlsptr ) - aren't visible outside this file, but that requires even more macro - magic. */ - --DECL_TEMPLATE (tilegx_linux, sys_clone); - DECL_TEMPLATE (tilegx_linux, sys_rt_sigreturn); - DECL_TEMPLATE (tilegx_linux, sys_socket); - DECL_TEMPLATE (tilegx_linux, sys_setsockopt); -@@ -496,94 +377,6 @@ DECL_TEMPLATE (tilegx_linux, sys_syscall184); - DECL_TEMPLATE (tilegx_linux, sys_cacheflush); - DECL_TEMPLATE (tilegx_linux, sys_set_dataplane); - --PRE(sys_clone) --{ -- ULong cloneflags; -- -- PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5); -- PRE_REG_READ5(int, "clone", -- unsigned long, flags, -- void *, child_stack, -- int *, parent_tidptr, -- int *, child_tidptr, -- void *, tlsaddr); -- -- if (ARG1 & VKI_CLONE_PARENT_SETTID) { -- PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) { -- PRE_MEM_WRITE("clone(child_tidptr)", ARG4, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG4, sizeof(Int), VKI_PROT_WRITE)) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- } -- -- cloneflags = ARG1; -- -- if (!ML_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) { -- SET_STATUS_Failure( VKI_EINVAL ); -- return; -- } -- -- /* Only look at the flags we really care about */ -- switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS -- | VKI_CLONE_FILES | VKI_CLONE_VFORK)) { -- case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES: -- /* thread creation */ -- SET_STATUS_from_SysRes( -- do_clone(tid, -- ARG1, /* flags */ -- (Addr)ARG2, /* child ESP */ -- (Long *)ARG3, /* parent_tidptr */ -- (Long *)ARG4, /* child_tidptr */ -- (Addr)ARG5)); /* set_tls */ -- break; -- -- case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */ -- /* FALLTHROUGH - assume vfork == fork */ -- cloneflags &= ~(VKI_CLONE_VFORK | VKI_CLONE_VM); -- -- case 0: /* plain fork */ -- SET_STATUS_from_SysRes( -- ML_(do_fork_clone)(tid, -- cloneflags, /* flags */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG4)); /* child_tidptr */ -- break; -- -- default: -- /* should we just ENOSYS? */ -- VG_(message)(Vg_UserMsg, -- "Unsupported clone() flags: 0x%lx\n", ARG1); -- VG_(message)(Vg_UserMsg, -- "\n"); -- VG_(message)(Vg_UserMsg, -- "The only supported clone() uses are:\n"); -- VG_(message)(Vg_UserMsg, -- " - via a threads library (LinuxThreads or NPTL)\n"); -- VG_(message)(Vg_UserMsg, -- " - via the implementation of fork or vfork\n"); -- VG_(unimplemented) -- ("Valgrind does not support general clone()."); -- } -- -- if (SUCCESS) { -- if (ARG1 & VKI_CLONE_PARENT_SETTID) -- POST_MEM_WRITE(ARG3, sizeof(Int)); -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) -- POST_MEM_WRITE(ARG4, sizeof(Int)); -- -- /* Thread creation was successful; let the child have the chance -- to run */ -- *flags |= SfYieldAfter; -- } --} -- - PRE(sys_rt_sigreturn) - { - /* This isn't really a syscall at all - it's a misuse of the -@@ -1344,7 +1137,7 @@ static SyscallTableEntry syscall_table[] = { - LINX_(__NR_add_key, sys_add_key), // 217 - LINX_(__NR_request_key, sys_request_key), // 218 - LINXY(__NR_keyctl, sys_keyctl), // 219 -- PLAX_(__NR_clone, sys_clone), // 220 -+ LINX_(__NR_clone, sys_clone), // 220 - GENX_(__NR_execve, sys_execve), // 221 - PLAX_(__NR_mmap, sys_mmap), // 222 - GENXY(__NR_mprotect, sys_mprotect), // 226 -diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c -index 0e5af98..f8c4eb4 100644 ---- a/coregrind/m_syswrap/syswrap-x86-linux.c -+++ b/coregrind/m_syswrap/syswrap-x86-linux.c -@@ -131,14 +131,7 @@ asm( - #define __NR_CLONE VG_STRINGIFY(__NR_clone) - #define __NR_EXIT VG_STRINGIFY(__NR_exit) - --extern --Int do_syscall_clone_x86_linux ( Word (*fn)(void *), -- void* stack, -- Int flags, -- void* arg, -- Int* child_tid, -- Int* parent_tid, -- vki_modify_ldt_t * ); -+// See priv_syswrap-linux.h for arg profile. - asm( - ".text\n" - ".globl do_syscall_clone_x86_linux\n" -@@ -191,141 +184,6 @@ asm( - #undef __NR_EXIT - - --// forward declarations --static void setup_child ( ThreadArchState*, ThreadArchState*, Bool ); --static SysRes sys_set_thread_area ( ThreadId, vki_modify_ldt_t* ); -- --/* -- When a client clones, we need to keep track of the new thread. This means: -- 1. allocate a ThreadId+ThreadState+stack for the thread -- -- 2. initialize the thread's new VCPU state -- -- 3. create the thread using the same args as the client requested, -- but using the scheduler entrypoint for EIP, and a separate stack -- for ESP. -- */ --static SysRes do_clone ( ThreadId ptid, -- UInt flags, Addr esp, -- Int* parent_tidptr, -- Int* child_tidptr, -- vki_modify_ldt_t *tlsinfo) --{ -- static const Bool debug = False; -- -- ThreadId ctid = VG_(alloc_ThreadState)(); -- ThreadState* ptst = VG_(get_ThreadState)(ptid); -- ThreadState* ctst = VG_(get_ThreadState)(ctid); -- UWord* stack; -- SysRes res; -- Int eax; -- vki_sigset_t blockall, savedmask; -- -- VG_(sigfillset)(&blockall); -- -- vg_assert(VG_(is_running_thread)(ptid)); -- vg_assert(VG_(is_valid_tid)(ctid)); -- -- stack = (UWord*)ML_(allocstack)(ctid); -- if (stack == NULL) { -- res = VG_(mk_SysRes_Error)( VKI_ENOMEM ); -- goto out; -- } -- -- /* Copy register state -- -- Both parent and child return to the same place, and the code -- following the clone syscall works out which is which, so we -- don't need to worry about it. -- -- The parent gets the child's new tid returned from clone, but the -- child gets 0. -- -- If the clone call specifies a NULL esp for the new thread, then -- it actually gets a copy of the parent's esp. -- */ -- /* Note: the clone call done by the Quadrics Elan3 driver specifies -- clone flags of 0xF00, and it seems to rely on the assumption -- that the child inherits a copy of the parent's GDT. -- setup_child takes care of setting that up. */ -- setup_child( &ctst->arch, &ptst->arch, True ); -- -- /* Make sys_clone appear to have returned Success(0) in the -- child. */ -- ctst->arch.vex.guest_EAX = 0; -- -- if (esp != 0) -- ctst->arch.vex.guest_ESP = esp; -- -- ctst->os_state.parent = ptid; -- -- /* inherit signal mask */ -- ctst->sig_mask = ptst->sig_mask; -- ctst->tmp_sig_mask = ptst->sig_mask; -- -- /* Start the child with its threadgroup being the same as the -- parent's. This is so that any exit_group calls that happen -- after the child is created but before it sets its -- os_state.threadgroup field for real (in thread_wrapper in -- syswrap-linux.c), really kill the new thread. a.k.a this avoids -- a race condition in which the thread is unkillable (via -- exit_group) because its threadgroup is not set. The race window -- is probably only a few hundred or a few thousand cycles long. -- See #226116. */ -- ctst->os_state.threadgroup = ptst->os_state.threadgroup; -- -- ML_(guess_and_register_stack) (esp, ctst); -- -- /* Assume the clone will succeed, and tell any tool that wants to -- know that this thread has come into existence. We cannot defer -- it beyond this point because sys_set_thread_area, just below, -- causes tCheck to assert by making references to the new ThreadId -- if we don't state the new thread exists prior to that point. -- If the clone fails, we'll send out a ll_exit notification for it -- at the out: label below, to clean up. */ -- vg_assert(VG_(owns_BigLock_LL)(ptid)); -- VG_TRACK ( pre_thread_ll_create, ptid, ctid ); -- -- if (flags & VKI_CLONE_SETTLS) { -- if (debug) -- VG_(printf)("clone child has SETTLS: tls info at %p: idx=%u " -- "base=%#lx limit=%x; esp=%#x fs=%x gs=%x\n", -- tlsinfo, tlsinfo->entry_number, -- tlsinfo->base_addr, tlsinfo->limit, -- ptst->arch.vex.guest_ESP, -- ctst->arch.vex.guest_FS, ctst->arch.vex.guest_GS); -- res = sys_set_thread_area(ctid, tlsinfo); -- if (sr_isError(res)) -- goto out; -- } -- -- flags &= ~VKI_CLONE_SETTLS; -- -- /* start the thread with everything blocked */ -- VG_(sigprocmask)(VKI_SIG_SETMASK, &blockall, &savedmask); -- -- /* Create the new thread */ -- eax = do_syscall_clone_x86_linux( -- ML_(start_thread_NORETURN), stack, flags, &VG_(threads)[ctid], -- child_tidptr, parent_tidptr, NULL -- ); -- res = VG_(mk_SysRes_x86_linux)( eax ); -- -- VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL); -- -- out: -- if (sr_isError(res)) { -- /* clone failed */ -- VG_(cleanup_thread)(&ctst->arch); -- ctst->status = VgTs_Empty; -- /* oops. Better tell the tool the thread exited in a hurry :-) */ -- VG_TRACK( pre_thread_ll_exit, ctid ); -- } -- -- return res; --} -- -- - /* --------------------------------------------------------------------- - LDT/GDT simulation - ------------------------------------------------------------------ */ -@@ -630,7 +488,7 @@ static SysRes sys_modify_ldt ( ThreadId tid, - } - - --static SysRes sys_set_thread_area ( ThreadId tid, vki_modify_ldt_t* info ) -+SysRes ML_(x86_sys_set_thread_area) ( ThreadId tid, vki_modify_ldt_t* info ) - { - Int idx; - VexGuestX86SegDescr* gdt; -@@ -738,15 +596,9 @@ void VG_(cleanup_thread) ( ThreadArchState* arch ) - } - - --static void setup_child ( /*OUT*/ ThreadArchState *child, -- /*IN*/ ThreadArchState *parent, -- Bool inherit_parents_GDT ) -+void ML_(x86_setup_LDT_GDT) ( /*OUT*/ ThreadArchState *child, -+ /*IN*/ ThreadArchState *parent ) - { -- /* We inherit our parent's guest state. */ -- child->vex = parent->vex; -- child->vex_shadow1 = parent->vex_shadow1; -- child->vex_shadow2 = parent->vex_shadow2; -- - /* We inherit our parent's LDT. */ - if (parent->vex.guest_LDT == (HWord)NULL) { - /* We hope this is the common case. */ -@@ -763,7 +615,7 @@ static void setup_child ( /*OUT*/ ThreadArchState *child, - only). */ - child->vex.guest_GDT = (HWord)NULL; - -- if (inherit_parents_GDT && parent->vex.guest_GDT != (HWord)NULL) { -+ if (parent->vex.guest_GDT != (HWord)NULL) { - child->vex.guest_GDT = (HWord)alloc_zeroed_x86_GDT(); - copy_GDT_from_to( (VexGuestX86SegDescr*)parent->vex.guest_GDT, - (VexGuestX86SegDescr*)child->vex.guest_GDT ); -@@ -787,7 +639,6 @@ DECL_TEMPLATE(x86_linux, sys_stat64); - DECL_TEMPLATE(x86_linux, sys_fstatat64); - DECL_TEMPLATE(x86_linux, sys_fstat64); - DECL_TEMPLATE(x86_linux, sys_lstat64); --DECL_TEMPLATE(x86_linux, sys_clone); - DECL_TEMPLATE(x86_linux, old_mmap); - DECL_TEMPLATE(x86_linux, sys_mmap2); - DECL_TEMPLATE(x86_linux, sys_sigreturn); -@@ -835,137 +686,6 @@ PRE(old_select) - } - } - --PRE(sys_clone) --{ -- UInt cloneflags; -- Bool badarg = False; -- -- PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5); -- PRE_REG_READ2(int, "clone", -- unsigned long, flags, -- void *, child_stack); -- -- if (ARG1 & VKI_CLONE_PARENT_SETTID) { -- if (VG_(tdict).track_pre_reg_read) { -- PRA3("clone", int *, parent_tidptr); -- } -- PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), -- VKI_PROT_WRITE)) { -- badarg = True; -- } -- } -- if (ARG1 & VKI_CLONE_SETTLS) { -- if (VG_(tdict).track_pre_reg_read) { -- PRA4("clone", vki_modify_ldt_t *, tlsinfo); -- } -- PRE_MEM_READ("clone(tlsinfo)", ARG4, sizeof(vki_modify_ldt_t)); -- if (!VG_(am_is_valid_for_client)(ARG4, sizeof(vki_modify_ldt_t), -- VKI_PROT_READ)) { -- badarg = True; -- } -- } -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) { -- if (VG_(tdict).track_pre_reg_read) { -- PRA5("clone", int *, child_tidptr); -- } -- PRE_MEM_WRITE("clone(child_tidptr)", ARG5, sizeof(Int)); -- if (!VG_(am_is_valid_for_client)(ARG5, sizeof(Int), -- VKI_PROT_WRITE)) { -- badarg = True; -- } -- } -- -- if (badarg) { -- SET_STATUS_Failure( VKI_EFAULT ); -- return; -- } -- -- cloneflags = ARG1; -- -- if (!ML_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) { -- SET_STATUS_Failure( VKI_EINVAL ); -- return; -- } -- -- /* Be ultra-paranoid and filter out any clone-variants we don't understand: -- - ??? specifies clone flags of 0x100011 -- - ??? specifies clone flags of 0x1200011. -- - NPTL specifies clone flags of 0x7D0F00. -- - The Quadrics Elan3 driver specifies clone flags of 0xF00. -- - Newer Quadrics Elan3 drivers with NTPL support specify 0x410F00. -- Everything else is rejected. -- */ -- if ( -- 1 || -- /* 11 Nov 05: for the time being, disable this ultra-paranoia. -- The switch below probably does a good enough job. */ -- (cloneflags == 0x100011 || cloneflags == 0x1200011 -- || cloneflags == 0x7D0F00 -- || cloneflags == 0x790F00 -- || cloneflags == 0x3D0F00 -- || cloneflags == 0x410F00 -- || cloneflags == 0xF00 -- || cloneflags == 0xF21)) { -- /* OK */ -- } -- else { -- /* Nah. We don't like it. Go away. */ -- goto reject; -- } -- -- /* Only look at the flags we really care about */ -- switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS -- | VKI_CLONE_FILES | VKI_CLONE_VFORK)) { -- case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES: -- /* thread creation */ -- SET_STATUS_from_SysRes( -- do_clone(tid, -- ARG1, /* flags */ -- (Addr)ARG2, /* child ESP */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG5, /* child_tidptr */ -- (vki_modify_ldt_t *)ARG4)); /* set_tls */ -- break; -- -- case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */ -- /* FALLTHROUGH - assume vfork == fork */ -- cloneflags &= ~(VKI_CLONE_VFORK | VKI_CLONE_VM); -- -- case 0: /* plain fork */ -- SET_STATUS_from_SysRes( -- ML_(do_fork_clone)(tid, -- cloneflags, /* flags */ -- (Int *)ARG3, /* parent_tidptr */ -- (Int *)ARG5)); /* child_tidptr */ -- break; -- -- default: -- reject: -- /* should we just ENOSYS? */ -- VG_(message)(Vg_UserMsg, "\n"); -- VG_(message)(Vg_UserMsg, "Unsupported clone() flags: 0x%lx\n", ARG1); -- VG_(message)(Vg_UserMsg, "\n"); -- VG_(message)(Vg_UserMsg, "The only supported clone() uses are:\n"); -- VG_(message)(Vg_UserMsg, " - via a threads library (LinuxThreads or NPTL)\n"); -- VG_(message)(Vg_UserMsg, " - via the implementation of fork or vfork\n"); -- VG_(message)(Vg_UserMsg, " - for the Quadrics Elan3 user-space driver\n"); -- VG_(unimplemented) -- ("Valgrind does not support general clone()."); -- } -- -- if (SUCCESS) { -- if (ARG1 & VKI_CLONE_PARENT_SETTID) -- POST_MEM_WRITE(ARG3, sizeof(Int)); -- if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) -- POST_MEM_WRITE(ARG5, sizeof(Int)); -- -- /* Thread creation was successful; let the child have the chance -- to run */ -- *flags |= SfYieldAfter; -- } --} -- - PRE(sys_sigreturn) - { - /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for -@@ -1063,7 +783,7 @@ PRE(sys_set_thread_area) - PRE_MEM_READ( "set_thread_area(u_info)", ARG1, sizeof(vki_modify_ldt_t) ); - - /* "do" the syscall ourselves; the kernel never sees it */ -- SET_STATUS_from_SysRes( sys_set_thread_area( tid, (void *)ARG1 ) ); -+ SET_STATUS_from_SysRes( ML_(x86_sys_set_thread_area)( tid, (void *)ARG1 ) ); - } - - PRE(sys_get_thread_area) -@@ -1553,7 +1273,7 @@ static SyscallTableEntry syscall_table[] = { - GENX_(__NR_fsync, sys_fsync), // 118 - PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux - -- PLAX_(__NR_clone, sys_clone), // 120 -+ LINX_(__NR_clone, sys_clone), // 120 - //zz // (__NR_setdomainname, sys_setdomainname), // 121 */*(?) - GENXY(__NR_uname, sys_newuname), // 122 - PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 -diff --git a/include/vki/vki-arm64-linux.h b/include/vki/vki-arm64-linux.h -index df34dd6..5a3b08f 100644 ---- a/include/vki/vki-arm64-linux.h -+++ b/include/vki/vki-arm64-linux.h -@@ -586,7 +586,8 @@ struct vki_ucontext { - //ZZ }; - //ZZ - //ZZ // [[Nb: for our convenience within Valgrind, use a more specific name]] --//ZZ typedef struct vki_user_desc vki_modify_ldt_t; -+ -+typedef char vki_modify_ldt_t; - - //---------------------------------------------------------------------- - // From linux-3.10.5/include/asm-generic/ipcbuf.h -diff --git a/include/vki/vki-mips32-linux.h b/include/vki/vki-mips32-linux.h -index 5be8e15..b6c9914 100644 ---- a/include/vki/vki-mips32-linux.h -+++ b/include/vki/vki-mips32-linux.h -@@ -679,7 +679,7 @@ struct vki_ucontext { - }; - - // CAB: TODO --typedef void vki_modify_ldt_t; -+typedef char vki_modify_ldt_t; - - //---------------------------------------------------------------------- - // From linux-2.6.35.5/include/asm-mips/ipcbuf.h -diff --git a/include/vki/vki-mips64-linux.h b/include/vki/vki-mips64-linux.h -index 26b8e9f..ca49b10 100644 ---- a/include/vki/vki-mips64-linux.h -+++ b/include/vki/vki-mips64-linux.h -@@ -710,6 +710,7 @@ struct vki_ucontext { - vki_sigset_t uc_sigmask; /* mask last for extensibility */ - }; - -+typedef char vki_modify_ldt_t; - //---------------------------------------------------------------------- - // From linux-2.6.35.9/include/asm-mips/ipcbuf.h - //---------------------------------------------------------------------- -diff --git a/include/vki/vki-ppc32-linux.h b/include/vki/vki-ppc32-linux.h -index 70c2835..0fd3c79 100644 ---- a/include/vki/vki-ppc32-linux.h -+++ b/include/vki/vki-ppc32-linux.h -@@ -811,10 +811,9 @@ struct vki_ucontext { - //.. }; - //.. - //.. // [[Nb: for our convenience within Valgrind, use a more specific name]] --//.. typedef struct vki_user_desc vki_modify_ldt_t; - - // CAB: TODO --typedef void vki_modify_ldt_t; -+typedef char vki_modify_ldt_t; - - - //---------------------------------------------------------------------- -diff --git a/include/vki/vki-ppc64-linux.h b/include/vki/vki-ppc64-linux.h -index b410663..fd5cea6 100644 ---- a/include/vki/vki-ppc64-linux.h -+++ b/include/vki/vki-ppc64-linux.h -@@ -685,6 +685,9 @@ struct vki_ucontext { - struct vki_sigcontext uc_mcontext; /* last for extensibility */ - }; - -+// CAB: TODO -+typedef char vki_modify_ldt_t; -+ - //---------------------------------------------------------------------- - // From linux-2.6.13/include/asm-ppc64/ipcbuf.h - //---------------------------------------------------------------------- -diff --git a/include/vki/vki-s390x-linux.h b/include/vki/vki-s390x-linux.h -index c3f6d00..1ef5cf7 100644 ---- a/include/vki/vki-s390x-linux.h -+++ b/include/vki/vki-s390x-linux.h -@@ -822,6 +822,8 @@ struct vki_ucontext { - vki_sigset_t uc_sigmask; /* mask last for extensibility */ - }; - -+typedef char vki_modify_ldt_t; -+ - //---------------------------------------------------------------------- - // From linux-2.6.16.60/include/asm-s390/ipcbuf.h - //---------------------------------------------------------------------- diff --git a/valgrind-3.12.0-deregister-stack.patch b/valgrind-3.12.0-deregister-stack.patch deleted file mode 100644 index 5fe4a11..0000000 --- a/valgrind-3.12.0-deregister-stack.patch +++ /dev/null @@ -1,111 +0,0 @@ -commit 2b49317b4f237ea5f648d8b958f96cd03fcabc7d -Author: philippe -Date: Mon Nov 28 19:34:06 2016 +0000 - - Fix 373046 - Stacks registered by core are never deregistered - - - git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16159 a5019735-40e9-0310-863c-91ae7b9d1cf9 - -diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c -index 0363898..49f51d6 100644 ---- a/coregrind/m_scheduler/scheduler.c -+++ b/coregrind/m_scheduler/scheduler.c -@@ -488,6 +488,7 @@ static void os_state_clear(ThreadState *tst) - { - tst->os_state.lwpid = 0; - tst->os_state.threadgroup = 0; -+ tst->os_state.stk_id = NULL_STK_ID; - # if defined(VGO_linux) - /* no other fields to clear */ - # elif defined(VGO_darwin) -@@ -504,7 +505,6 @@ static void os_state_clear(ThreadState *tst) - # if defined(VGP_x86_solaris) - tst->os_state.thrptr = 0; - # endif -- tst->os_state.stk_id = (UWord)-1; - tst->os_state.ustack = NULL; - tst->os_state.in_door_return = False; - tst->os_state.door_return_procedure = 0; -diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c -index 6ef6a90..28972ae 100644 ---- a/coregrind/m_syswrap/syswrap-generic.c -+++ b/coregrind/m_syswrap/syswrap-generic.c -@@ -84,11 +84,14 @@ void ML_(guess_and_register_stack) (Addr sp, ThreadState* tst) - tst->client_stack_highest_byte = (Addr)VG_PGROUNDUP(sp)-1; - tst->client_stack_szB = tst->client_stack_highest_byte - seg->start + 1; - -- VG_(register_stack)(seg->start, tst->client_stack_highest_byte); -+ tst->os_state.stk_id -+ = VG_(register_stack)(seg->start, tst->client_stack_highest_byte); - - if (debug) -- VG_(printf)("tid %u: guessed client stack range [%#lx-%#lx]\n", -- tst->tid, seg->start, tst->client_stack_highest_byte); -+ VG_(printf)("tid %u: guessed client stack range [%#lx-%#lx]" -+ " as stk_id %lu\n", -+ tst->tid, seg->start, tst->client_stack_highest_byte, -+ tst->os_state.stk_id); - } else { - VG_(message)(Vg_UserMsg, - "!? New thread %u starts with SP(%#lx) unmapped\n", -diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c -index af10b92..725ad78 100644 ---- a/coregrind/m_syswrap/syswrap-linux.c -+++ b/coregrind/m_syswrap/syswrap-linux.c -@@ -52,6 +52,7 @@ - #include "pub_core_options.h" - #include "pub_core_scheduler.h" - #include "pub_core_signals.h" -+#include "pub_core_stacks.h" - #include "pub_core_syscall.h" - #include "pub_core_syswrap.h" - #include "pub_core_inner.h" -@@ -162,6 +163,10 @@ static void run_a_thread_NORETURN ( Word tidW ) - c = VG_(count_living_threads)(); - vg_assert(c >= 1); /* stay sane */ - -+ /* Deregister thread's stack. */ -+ if (tst->os_state.stk_id != NULL_STK_ID) -+ VG_(deregister_stack)(tst->os_state.stk_id); -+ - // Tell the tool this thread is exiting - VG_TRACK( pre_thread_ll_exit, tid ); - -diff --git a/coregrind/pub_core_threadstate.h b/coregrind/pub_core_threadstate.h -index f3d956c..3307e75 100644 ---- a/coregrind/pub_core_threadstate.h -+++ b/coregrind/pub_core_threadstate.h -@@ -114,6 +114,8 @@ typedef - ThreadArchState; - - -+#define NULL_STK_ID (~(UWord)0) -+ - /* OS-specific thread state. IMPORTANT: if you add fields to this, - you _must_ add code to os_state_clear() to initialise those - fields. */ -@@ -129,6 +131,12 @@ typedef - Addr valgrind_stack_base; // Valgrind's stack (VgStack*) - Addr valgrind_stack_init_SP; // starting value for SP - -+ /* Client stack is registered as stk_id (on linux/darwin, by -+ ML_(guess_and_register_stack)). -+ Stack id NULL_STK_ID means that the user stack is not (yet) -+ registered. */ -+ UWord stk_id; -+ - /* exit details */ - Word exitcode; // in the case of exitgroup, set by someone else - Int fatalsig; // fatal signal -@@ -281,10 +289,6 @@ typedef - the 64-bit offset associated with a %fs value of zero. */ - # endif - -- /* Stack id (value (UWord)(-1) means that there is no stack). This -- tracks a stack that is set in restore_stack(). */ -- UWord stk_id; -- - /* Simulation of the kernel's lwp->lwp_ustack. Set in the PRE wrapper - of the getsetcontext syscall, for SETUSTACK. Used in - VG_(save_context)(), VG_(restore_context)() and diff --git a/valgrind-3.12.0-exit_group.patch b/valgrind-3.12.0-exit_group.patch deleted file mode 100644 index bd07d3f..0000000 --- a/valgrind-3.12.0-exit_group.patch +++ /dev/null @@ -1,52 +0,0 @@ -commit 18b3ffc1a8dc951d8a8cdb076e7e30aafc216571 -Author: philippe -Date: Sat Nov 19 14:54:44 2016 +0000 - - Fix 372504 Hanging on exit_group - - Note that it is unclear if the PRE syscall for rt_sigsuspend - is properly setting up a temporary mask in the thread state - tmp_sig_mask: if an handler is called while a thread is - calling sigsuspend, the mask during the handler run must be - the temporary mask set by sigsuspend. - It is not clear if/where the valgrind sigframe builder/handler - sets the tmp_sig_mask to the value as expected by the user - (i.e. the value of the temporary mask which was given to - the sigsuspend syscall) - - - - git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16141 a5019735-40e9-0310-863c-91ae7b9d1cf9 - -diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c -index 1dcb95d..fda8dd1 100644 ---- a/coregrind/m_syswrap/syswrap-linux.c -+++ b/coregrind/m_syswrap/syswrap-linux.c -@@ -3558,6 +3558,12 @@ PRE(sys_rt_sigsuspend) - PRE_REG_READ2(int, "rt_sigsuspend", vki_sigset_t *, mask, vki_size_t, size) - if (ARG1 != (Addr)NULL) { - PRE_MEM_READ( "rt_sigsuspend(mask)", ARG1, sizeof(vki_sigset_t) ); -+ VG_(sigdelset)((vki_sigset_t*)ARG1, VG_SIGVGKILL); -+ /* We cannot mask VG_SIGVGKILL, as otherwise this thread would not -+ be killable by VG_(nuke_all_threads_except). -+ We thus silently ignore the user request to mask this signal. -+ Note that this is similar to what is done for e.g. -+ sigprocmask (see m_signals.c calculate_SKSS_from_SCSS). */ - } - } - -diff --git a/coregrind/pub_core_threadstate.h b/coregrind/pub_core_threadstate.h -index 861f233..f3d956c 100644 ---- a/coregrind/pub_core_threadstate.h -+++ b/coregrind/pub_core_threadstate.h -@@ -354,7 +354,9 @@ typedef struct { - different values is during the execution of a sigsuspend, where - tmp_sig_mask is the temporary mask which sigsuspend installs. - It is only consulted to compute the signal mask applied to a -- signal handler. */ -+ signal handler. -+ PW Nov 2016 : it is not clear if and where this tmp_sig_mask -+ is set when an handler runs "inside" a sigsuspend. */ - vki_sigset_t tmp_sig_mask; - - /* A little signal queue for signals we can't get the kernel to diff --git a/valgrind-3.12.0-helgrind-dl_allocate_tls-supp.patch b/valgrind-3.12.0-helgrind-dl_allocate_tls-supp.patch deleted file mode 100644 index 339a839..0000000 --- a/valgrind-3.12.0-helgrind-dl_allocate_tls-supp.patch +++ /dev/null @@ -1,47 +0,0 @@ -commit 4b00bfdd73a2cd56a4d9e8de0b249eed2a1b982f -Author: petarj -Date: Fri Feb 3 00:34:52 2017 +0000 - - add suppression for helgrind/tests/tc22_exit_w_lock - - Function pthread_create indirectly calls function memcpy. Helgrind - considers that memcpy is not thread safe function. For error reported - from pthread_create there is the suppression helgrind---_dl_allocate_tls - in the file glibc-2.34567-NPTL-helgrind.supp. - Since glibc version 2.23, memcpy is implemented by __mempcpy_inline. - This causes that call to memcpy from pthread_create is no longer - recognized by the suppression. - In test helgrind/tests/tc22_exit_w_lock, pthread_create is called twice, - and second call reports error, which causes failing of the test. - This patch adds suppression for glibc 2.23 and greater. - - Patch by Tamara Vlahovic. - - Related issue #375806. - - - git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16219 a5019735-40e9-0310-863c-91ae7b9d1cf9 - -diff --git a/glibc-2.34567-NPTL-helgrind.supp b/glibc-2.34567-NPTL-helgrind.supp -index ed105b8..7ebd2c4 100644 ---- a/glibc-2.34567-NPTL-helgrind.supp -+++ b/glibc-2.34567-NPTL-helgrind.supp -@@ -267,6 +267,18 @@ - fun:pthread_create@* - } - -+{ -+ helgrind---_dl_allocate_tls2 -+ Helgrind:Race -+ fun:memcpy -+ fun:__mempcpy_inline -+ fun:_dl_allocate_tls_init -+ ... -+ fun:pthread_create@@GLIBC_2.2* -+ fun:pthread_create_WRK -+ fun:pthread_create@* -+} -+ - #################################################### - # To do with GNU libgomp - # diff --git a/valgrind-3.12.0-nocwd-cleanup.patch b/valgrind-3.12.0-nocwd-cleanup.patch deleted file mode 100644 index fdb736d..0000000 --- a/valgrind-3.12.0-nocwd-cleanup.patch +++ /dev/null @@ -1,23 +0,0 @@ -commit b02baf74e6c14cc6fcf1e4fa94f1a6734c9cffbe -Author: mjw -Date: Sat Nov 12 19:51:51 2016 +0000 - - Cleanup none/tests/nocwd.vgtest tmp dirs. - - The none/tests/nocwd creates a really deep temporary directory structure - that is also inaccessible after the test. This causes issues with some - build wrappers like koji which fail to cleanup such deep subdirectories. - So explicitly cleanup the directory after the test. - - https://bugzilla.redhat.com/show_bug.cgi?id=1390282 - - git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16134 a5019735-40e9-0310-863c-91ae7b9d1cf9 - -diff --git a/none/tests/nocwd.vgtest b/none/tests/nocwd.vgtest -index 74e2b4a..f8d4c3b 100644 ---- a/none/tests/nocwd.vgtest -+++ b/none/tests/nocwd.vgtest -@@ -1,2 +1,3 @@ - prog: nocwd - vgopts: -q --trace-children=yes -+cleanup: chmod u+rwx /tmp/wd_test_*; rm -rf /tmp/wd_test_* diff --git a/valgrind-3.12.0-powerpc-register-pair.patch b/valgrind-3.12.0-powerpc-register-pair.patch deleted file mode 100644 index 7830863..0000000 --- a/valgrind-3.12.0-powerpc-register-pair.patch +++ /dev/null @@ -1,73 +0,0 @@ -commit 3f055b64899cc4b7c34f9ebdc4beb418a8bced07 -Author: carll -Date: Fri Mar 10 20:07:09 2017 +0000 - - PowerPC: Fix incorrect register pair check for lxv, stxv, stxsd, stxssp, lxsd, - lxssp instructions - - The lfdpx, stdpx, lfdp and stfdp instructions work on a register pair. The - register pair test must only be applied to these instructions in the - dis_fp_pair() function. - - bugzilla 377427 - - - - git-svn-id: svn://svn.valgrind.org/vex/trunk@3308 8f6e269a-dfd6-0310-a8e1-e2731360e62c - -diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c -index b19dcbc..0d27389 100644 ---- a/VEX/priv/guest_ppc_toIR.c -+++ b/VEX/priv/guest_ppc_toIR.c -@@ -11310,13 +11310,16 @@ static Bool dis_fp_pair ( UInt theInstr ) - UChar b0 = ifieldBIT0(theInstr); - Bool is_load = 0; - -- if ((frT_hi_addr %2) != 0) { -- vex_printf("dis_fp_pair(ppc) : odd frT register\n"); -- return False; -- } -- - switch (opc1) { - case 0x1F: // register offset -+ /* These instructions work on a pair of registers. The specified -+ * register must be even. -+ */ -+ if ((frT_hi_addr %2) != 0) { -+ vex_printf("dis_fp_pair(ppc) ldpx or stdpx: odd frT register\n"); -+ return False; -+ } -+ - switch(opc2) { - case 0x317: // lfdpx (FP Load Double Pair X-form, ISA 2.05 p125) - DIP("ldpx fr%u,r%u,r%u\n", frT_hi_addr, rA_addr, rB_addr); -@@ -11346,6 +11349,14 @@ static Bool dis_fp_pair ( UInt theInstr ) - - switch(opc2) { - case 0x0: // lfdp (FP Load Double Pair DS-form, ISA 2.05 p125) -+ /* This instruction works on a pair of registers. The specified -+ * register must be even. -+ */ -+ if ((frT_hi_addr %2) != 0) { -+ vex_printf("dis_fp_pair(ppc) lfdp : odd frT register\n"); -+ return False; -+ } -+ - DIP("lfdp fr%u,%d(r%u)\n", frT_hi_addr, simm16, rA_addr); - assign( EA_hi, ea_rAor0_simm( rA_addr, simm16 ) ); - is_load = 1; -@@ -11390,6 +11401,14 @@ static Bool dis_fp_pair ( UInt theInstr ) - switch(opc2) { - case 0x0: - // stfdp (FP Store Double Pair DS-form, ISA 2.05 p125) -+ /* This instruction works on a pair of registers. The specified -+ * register must be even. -+ */ -+ if ((frT_hi_addr %2) != 0) { -+ vex_printf("dis_fp_pair(ppc) stfdp : odd frT register\n"); -+ return False; -+ } -+ - DIP("stfdp fr%u,%d(r%u)\n", frT_hi_addr, simm16, rA_addr); - assign( EA_hi, ea_rAor0_simm( rA_addr, simm16 ) ); - break; diff --git a/valgrind-3.12.0-ppc-xxsel.patch b/valgrind-3.12.0-ppc-xxsel.patch deleted file mode 100644 index e27b8b6..0000000 --- a/valgrind-3.12.0-ppc-xxsel.patch +++ /dev/null @@ -1,505 +0,0 @@ -commit b8fbe1485567fb240404344533c16a82d53b868e -Author: carll -Date: Mon Nov 7 19:41:30 2016 +0000 - - Fix xxsel parsing error. - - The xxsel instruction uses part of the standard opc2 field to specify - a additional operand or other values. A subset of the field is used for - the actual opcode. The masking and array lookup was getting confused by - bits in the the additional operand field. The arrays were split so only - the opcodes that should be found for a given mask is in the array. This - also speeds up the search as you are not searching through values that - cannot match. The small groups of opcodes for a couple of the masks are - now done in a case statement as that is probably faster then doing an array - look up. - - Bugzilla 148000 - - - git-svn-id: svn://svn.valgrind.org/vex/trunk@3284 8f6e269a-dfd6-0310-a8e1-e2731360e62c - -diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c -index c393740..c265645 100644 ---- a/VEX/priv/guest_ppc_toIR.c -+++ b/VEX/priv/guest_ppc_toIR.c -@@ -18146,7 +18146,7 @@ dis_vvec_cmp( UInt theInstr, UInt opc2 ) - assign( vB, getVSReg( XB ) ); - - switch (opc2) { -- case 0x18C: case 0x38C: // xvcmpeqdp[.] (VSX Vector Compare Equal To Double-Precision [ & Record ]) -+ case 0x18C: // xvcmpeqdp[.] (VSX Vector Compare Equal To Double-Precision [ & Record ]) - { - DIP("xvcmpeqdp%s crf%d,fr%u,fr%u\n", (flag_rC ? ".":""), - XT, XA, XB); -@@ -18154,7 +18154,7 @@ dis_vvec_cmp( UInt theInstr, UInt opc2 ) - break; - } - -- case 0x1CC: case 0x3CC: // xvcmpgedp[.] (VSX Vector Compare Greater Than or Equal To Double-Precision [ & Record ]) -+ case 0x1CC: // xvcmpgedp[.] (VSX Vector Compare Greater Than or Equal To Double-Precision [ & Record ]) - { - DIP("xvcmpgedp%s crf%d,fr%u,fr%u\n", (flag_rC ? ".":""), - XT, XA, XB); -@@ -18162,7 +18162,7 @@ dis_vvec_cmp( UInt theInstr, UInt opc2 ) - break; - } - -- case 0x1AC: case 0x3AC: // xvcmpgtdp[.] (VSX Vector Compare Greater Than Double-Precision [ & Record ]) -+ case 0x1AC: // xvcmpgtdp[.] (VSX Vector Compare Greater Than Double-Precision [ & Record ]) - { - DIP("xvcmpgtdp%s crf%d,fr%u,fr%u\n", (flag_rC ? ".":""), - XT, XA, XB); -@@ -18170,7 +18170,7 @@ dis_vvec_cmp( UInt theInstr, UInt opc2 ) - break; - } - -- case 0x10C: case 0x30C: // xvcmpeqsp[.] (VSX Vector Compare Equal To Single-Precision [ & Record ]) -+ case 0x10C: // xvcmpeqsp[.] (VSX Vector Compare Equal To Single-Precision [ & Record ]) - { - IRTemp vD = newTemp(Ity_V128); - -@@ -18184,7 +18184,7 @@ dis_vvec_cmp( UInt theInstr, UInt opc2 ) - break; - } - -- case 0x14C: case 0x34C: // xvcmpgesp[.] (VSX Vector Compare Greater Than or Equal To Single-Precision [ & Record ]) -+ case 0x14C: // xvcmpgesp[.] (VSX Vector Compare Greater Than or Equal To Single-Precision [ & Record ]) - { - IRTemp vD = newTemp(Ity_V128); - -@@ -18198,7 +18198,7 @@ dis_vvec_cmp( UInt theInstr, UInt opc2 ) - break; - } - -- case 0x12C: case 0x32C: //xvcmpgtsp[.] (VSX Vector Compare Greater Than Single-Precision [ & Record ]) -+ case 0x12C: //xvcmpgtsp[.] (VSX Vector Compare Greater Than Single-Precision [ & Record ]) - { - IRTemp vD = newTemp(Ity_V128); - -@@ -27043,17 +27043,93 @@ struct vsx_insn { - }; - - // ATTENTION: Keep this array sorted on the opcocde!!! --static struct vsx_insn vsx_all[] = { -- { 0x0, "xsaddsp" }, -- { 0x4, "xsmaddasp" }, -- { 0x8, "xxsldwi" }, -+static struct vsx_insn vsx_xx2[] = { - { 0x14, "xsrsqrtesp" }, - { 0x16, "xssqrtsp" }, - { 0x18, "xxsel" }, -+ { 0x34, "xsresp" }, -+ { 0x90, "xscvdpuxws" }, -+ { 0x92, "xsrdpi" }, -+ { 0x94, "xsrsqrtedp" }, -+ { 0x96, "xssqrtdp" }, -+ { 0xb0, "xscvdpsxws" }, -+ { 0xb2, "xsrdpiz" }, -+ { 0xb4, "xsredp" }, -+ { 0xd2, "xsrdpip" }, -+ { 0xd4, "xstsqrtdp" }, -+ { 0xd6, "xsrdpic" }, -+ { 0xf2, "xsrdpim" }, -+ { 0x112, "xvrspi" }, -+ { 0x116, "xvsqrtsp" }, -+ { 0x130, "xvcvspsxws" }, -+ { 0x132, "xvrspiz" }, -+ { 0x134, "xvresp" }, -+ { 0x148, "xxspltw" }, -+ { 0x14A, "xxextractuw" }, -+ { 0x150, "xvcvuxwsp" }, -+ { 0x152, "xvrspip" }, -+ { 0x154, "xvtsqrtsp" }, -+ { 0x156, "xvrspic" }, -+ { 0x16A, "xxinsertw" }, -+ { 0x170, "xvcvsxwsp" }, -+ { 0x172, "xvrspim" }, -+ { 0x190, "xvcvdpuxws" }, -+ { 0x192, "xvrdpi" }, -+ { 0x194, "xvrsqrtedp" }, -+ { 0x196, "xvsqrtdp" }, -+ { 0x1b0, "xvcvdpsxws" }, -+ { 0x1b2, "xvrdpiz" }, -+ { 0x1b4, "xvredp" }, -+ { 0x1d0, "xvcvuxwdp" }, -+ { 0x1d2, "xvrdpip" }, -+ { 0x1d4, "xvtsqrtdp" }, -+ { 0x1d6, "xvrdpic" }, -+ { 0x1f0, "xvcvsxwdp" }, -+ { 0x1f2, "xvrdpim" }, -+ { 0x212, "xscvdpsp" }, -+ { 0x216, "xscvdpspn" }, -+ { 0x232, "xxrsp" }, -+ { 0x250, "xscvuxdsp" }, -+ { 0x254, "xststdcsp" }, -+ { 0x270, "xscvsxdsp" }, -+ { 0x290, "xscvdpuxds" }, -+ { 0x292, "xscvspdp" }, -+ { 0x296, "xscvspdpn" }, -+ { 0x2b0, "xscvdpsxds" }, -+ { 0x2b2, "xsabsdp" }, -+ { 0x2b6, "xsxexpdp_xsxigdp" }, -+ { 0x2d0, "xscvuxddp" }, -+ { 0x2d2, "xsnabsdp" }, -+ { 0x2d4, "xststdcdp" }, -+ { 0x2e4, "xsnmsubmdp" }, -+ { 0x2f0, "xscvsxddp" }, -+ { 0x2f2, "xsnegdp" }, -+ { 0x310, "xvcvspuxds" }, -+ { 0x312, "xvcvdpsp" }, -+ { 0x330, "xvcvspsxds" }, -+ { 0x332, "xvabssp" }, -+ { 0x350, "xvcvuxdsp" }, -+ { 0x352, "xvnabssp" }, -+ { 0x370, "xvcvsxdsp" }, -+ { 0x372, "xvnegsp" }, -+ { 0x390, "xvcvdpuxds" }, -+ { 0x392, "xvcvspdp" }, -+ { 0x3b0, "xvcvdpsxds" }, -+ { 0x3b2, "xvabsdp" }, -+ { 0x3b6, "xxbr[h|w|d|q]|xvxexpdp|xvxexpsp|xvxsigdp|xvxsigsp|xvcvhpsp|xvcvsphp|xscvdphp|xscvhpdp" }, -+ { 0x3d0, "xvcvuxddp" }, -+ { 0x3d2, "xvnabsdp" }, -+ { 0x3f2, "xvnegdp" } -+}; -+#define VSX_XX2_LEN (sizeof vsx_xx2 / sizeof *vsx_xx2) -+ -+// ATTENTION: Keep this array sorted on the opcocde!!! -+static struct vsx_insn vsx_xx3[] = { -+ { 0x0, "xsaddsp" }, -+ { 0x4, "xsmaddasp" }, -+ { 0x9, "xsmaddmsp" }, - { 0x20, "xssubsp" }, - { 0x24, "xsmaddmsp" }, -- { 0x28, "xxpermdi" }, -- { 0x34, "xsresp" }, - { 0x3A, "xxpermr" }, - { 0x40, "xsmulsp" }, - { 0x44, "xsmsubasp" }, -@@ -27064,174 +27140,112 @@ static struct vsx_insn vsx_all[] = { - { 0x80, "xsadddp" }, - { 0x84, "xsmaddadp" }, - { 0x8c, "xscmpudp" }, -- { 0x90, "xscvdpuxws" }, -- { 0x92, "xsrdpi" }, -- { 0x94, "xsrsqrtedp" }, -- { 0x96, "xssqrtdp" }, - { 0xa0, "xssubdp" }, - { 0xa4, "xsmaddmdp" }, - { 0xac, "xscmpodp" }, -- { 0xb0, "xscvdpsxws" }, -- { 0xb2, "xsrdpiz" }, -- { 0xb4, "xsredp" }, - { 0xc0, "xsmuldp" }, - { 0xc4, "xsmsubadp" }, - { 0xc8, "xxmrglw" }, -- { 0xd2, "xsrdpip" }, - { 0xd4, "xstsqrtdp" }, -- { 0xd6, "xsrdpic" }, - { 0xe0, "xsdivdp" }, - { 0xe4, "xsmsubmdp" }, - { 0xe8, "xxpermr" }, - { 0xeC, "xscmpexpdp" }, -- { 0xf2, "xsrdpim" }, - { 0xf4, "xstdivdp" }, - { 0x100, "xvaddsp" }, - { 0x104, "xvmaddasp" }, -- { 0x10c, "xvcmpeqsp" }, -+ { 0x10C, "xvcmpeqsp" }, - { 0x110, "xvcvspuxws" }, -- { 0x112, "xvrspi" }, - { 0x114, "xvrsqrtesp" }, -- { 0x116, "xvsqrtsp" }, - { 0x120, "xvsubsp" }, - { 0x124, "xvmaddmsp" }, -- { 0x12c, "xvcmpgtsp" }, - { 0x130, "xvcvspsxws" }, -- { 0x132, "xvrspiz" }, -- { 0x134, "xvresp" }, - { 0x140, "xvmulsp" }, - { 0x144, "xvmsubasp" }, -- { 0x148, "xxspltw" }, -- { 0x14A, "xxextractuw" }, -- { 0x14c, "xvcmpgesp" }, -- { 0x150, "xvcvuxwsp" }, -- { 0x152, "xvrspip" }, -- { 0x154, "xvtsqrtsp" }, -- { 0x156, "xvrspic" }, -+ { 0x14C, "xvcmpgesp", }, - { 0x160, "xvdivsp" }, - { 0x164, "xvmsubmsp" }, -- { 0x16A, "xxinsertw" }, -- { 0x170, "xvcvsxwsp" }, -- { 0x172, "xvrspim" }, - { 0x174, "xvtdivsp" }, - { 0x180, "xvadddp" }, - { 0x184, "xvmaddadp" }, -- { 0x18c, "xvcmpeqdp" }, -- { 0x190, "xvcvdpuxws" }, -- { 0x192, "xvrdpi" }, -- { 0x194, "xvrsqrtedp" }, -- { 0x196, "xvsqrtdp" }, -+ { 0x18C, "xvcmpeqdp" }, - { 0x1a0, "xvsubdp" }, - { 0x1a4, "xvmaddmdp" }, -- { 0x1ac, "xvcmpgtdp" }, -- { 0x1b0, "xvcvdpsxws" }, -- { 0x1b2, "xvrdpiz" }, -- { 0x1b4, "xvredp" }, -+ { 0x1aC, "xvcmpgtdp" }, - { 0x1c0, "xvmuldp" }, - { 0x1c4, "xvmsubadp" }, - { 0x1cc, "xvcmpgedp" }, -- { 0x1d0, "xvcvuxwdp" }, -- { 0x1d2, "xvrdpip" }, -- { 0x1d4, "xvtsqrtdp" }, -- { 0x1d6, "xvrdpic" }, - { 0x1e0, "xvdivdp" }, - { 0x1e4, "xvmsubmdp" }, -- { 0x1f0, "xvcvsxwdp" }, -- { 0x1f2, "xvrdpim" }, - { 0x1f4, "xvtdivdp" }, - { 0x204, "xsnmaddasp" }, - { 0x208, "xxland" }, -- { 0x212, "xscvdpsp" }, -- { 0x216, "xscvdpspn" }, - { 0x224, "xsnmaddmsp" }, - { 0x228, "xxlandc" }, -- { 0x232, "xxrsp" }, - { 0x244, "xsnmsubasp" }, - { 0x248, "xxlor" }, -- { 0x250, "xscvuxdsp" }, -- { 0x254, "xststdcsp" }, - { 0x264, "xsnmsubmsp" }, - { 0x268, "xxlxor" }, -- { 0x270, "xscvsxdsp" }, - { 0x280, "xsmaxdp" }, - { 0x284, "xsnmaddadp" }, - { 0x288, "xxlnor" }, -- { 0x290, "xscvdpuxds" }, -- { 0x292, "xscvspdp" }, -- { 0x296, "xscvspdpn" }, - { 0x2a0, "xsmindp" }, - { 0x2a4, "xsnmaddmdp" }, - { 0x2a8, "xxlorc" }, -- { 0x2b0, "xscvdpsxds" }, -- { 0x2b2, "xsabsdp" }, -- { 0x2b6, "xsxexpdp_xsxigdp" }, - { 0x2c0, "xscpsgndp" }, - { 0x2c4, "xsnmsubadp" }, - { 0x2c8, "xxlnand" }, -- { 0x2d0, "xscvuxddp" }, -- { 0x2d2, "xsnabsdp" }, -- { 0x2d4, "xststdcdp" }, - { 0x2e4, "xsnmsubmdp" }, - { 0x2e8, "xxleqv" }, -- { 0x2f0, "xscvsxddp" }, -- { 0x2f2, "xsnegdp" }, - { 0x300, "xvmaxsp" }, - { 0x304, "xvnmaddasp" }, -- { 0x30c, "xvcmpeqsp." }, -- { 0x310, "xvcvspuxds" }, -- { 0x312, "xvcvdpsp" }, - { 0x320, "xvminsp" }, - { 0x324, "xvnmaddmsp" }, -- { 0x32c, "xvcmpgtsp." }, -- { 0x330, "xvcvspsxds" }, -- { 0x332, "xvabssp" }, - { 0x340, "xvcpsgnsp" }, - { 0x344, "xvnmsubasp" }, -- { 0x34c, "xvcmpgesp." }, -- { 0x350, "xvcvuxdsp" }, -- { 0x352, "xvnabssp" }, -- { 0x354, "xvtstdcsp" }, - { 0x360, "xviexpsp" }, - { 0x364, "xvnmsubmsp" }, -- { 0x370, "xvcvsxdsp" }, -- { 0x372, "xvnegsp" }, - { 0x380, "xvmaxdp" }, - { 0x384, "xvnmaddadp" }, -- { 0x38c, "xvcmpeqdp." }, -- { 0x390, "xvcvdpuxds" }, -- { 0x392, "xvcvspdp" }, -- { 0x396, "xsiexpdp" }, - { 0x3a0, "xvmindp" }, - { 0x3a4, "xvnmaddmdp" }, -- { 0x3ac, "xvcmpgtdp." }, -- { 0x3b0, "xvcvdpsxds" }, -- { 0x3b2, "xvabsdp" }, -- { 0x3b6, "xxbr[h|w|d|q]|xvxexpdp|xvxexpsp|xvxsigdp|xvxsigsp|xvcvhpsp|xvcvsphp|xscvdphp|xscvhpdp" }, - { 0x3c0, "xvcpsgndp" }, - { 0x3c4, "xvnmsubadp" }, -- { 0x3cc, "xvcmpgedp." }, -- { 0x3d0, "xvcvuxddp" }, -- { 0x3d2, "xvnabsdp" }, -- { 0x3d4, "xvtstdcdp" }, - { 0x3e0, "xviexpdp" }, - { 0x3e4, "xvnmsubmdp" }, - { 0x3f0, "xvcvsxddp" }, -- { 0x3f2, "xvnegdp" } - }; --#define VSX_ALL_LEN (sizeof vsx_all / sizeof *vsx_all) -+#define VSX_XX3_LEN (sizeof vsx_xx3 / sizeof *vsx_xx3) - - --// ATTENTION: This search function assumes vsx_all array is sorted. --static Int findVSXextOpCode(UInt opcode) -+// ATTENTION: This search functions assumes vsx_all array is sorted. -+static Int findVSXextOpCode_xx2(UInt opcode) - { - Int low, mid, high; - low = 0; -- high = VSX_ALL_LEN - 1; -+ high = VSX_XX2_LEN - 1; - while (low <= high) { - mid = (low + high)/2; -- if (opcode < vsx_all[mid].opcode) -+ if (opcode < vsx_xx2[mid].opcode) - high = mid - 1; -- else if (opcode > vsx_all[mid].opcode) -+ else if (opcode > vsx_xx2[mid].opcode) -+ low = mid + 1; -+ else -+ return mid; -+ } -+ return -1; -+} -+ -+static Int findVSXextOpCode_xx3(UInt opcode) -+{ -+ Int low, mid, high; -+ low = 0; -+ high = VSX_XX3_LEN - 1; -+ while (low <= high) { -+ mid = (low + high)/2; -+ if (opcode < vsx_xx3[mid].opcode) -+ high = mid - 1; -+ else if (opcode > vsx_xx3[mid].opcode) - low = mid + 1; - else - return mid; -@@ -27244,31 +27258,68 @@ static Int findVSXextOpCode(UInt opcode) - * passed, and we then try to match it up with one of the VSX forms - * below. - */ --static UInt get_VSX60_opc2(UInt opc2_full) -+static UInt get_VSX60_opc2(UInt opc2_full, UInt theInstr) - { --#define XX2_MASK 0x000003FE -+#define XX2_1_MASK 0x000003FF // xsiexpdp specific -+#define XX2_2_MASK 0x000003FE - #define XX3_1_MASK 0x000003FC - #define XX3_2_MASK 0x000001FC --#define XX3_3_MASK 0x0000007C --#define XX4_MASK 0x00000018 --#define VDCMX_MASK 0x000003B8 -+#define XX3_4_MASK 0x0000027C -+#define XX3_5_MASK 0x000003DC -+#define XX4_MASK 0x00000018 -+ - Int ret; - UInt vsxExtOpcode = 0; - -- if (( ret = findVSXextOpCode(opc2_full & XX2_MASK)) >= 0) -- vsxExtOpcode = vsx_all[ret].opcode; -- else if (( ret = findVSXextOpCode(opc2_full & XX3_1_MASK)) >= 0) -- vsxExtOpcode = vsx_all[ret].opcode; -- else if (( ret = findVSXextOpCode(opc2_full & VDCMX_MASK)) >= 0) -- vsxExtOpcode = vsx_all[ret].opcode; -- else if (( ret = findVSXextOpCode(opc2_full & XX3_2_MASK)) >= 0) -- vsxExtOpcode = vsx_all[ret].opcode; -- else if (( ret = findVSXextOpCode(opc2_full & XX3_3_MASK)) >= 0) -- vsxExtOpcode = vsx_all[ret].opcode; -- else if (( ret = findVSXextOpCode(opc2_full & XX4_MASK)) >= 0) -- vsxExtOpcode = vsx_all[ret].opcode; -+ if (( ret = findVSXextOpCode_xx2(opc2_full & XX2_2_MASK)) >= 0) -+ return vsx_xx2[ret].opcode; -+ else if ((opc2_full & XX2_1_MASK) == 0x396 ) // xsiexpdp -+ return 0x396; -+ else if (( ret = findVSXextOpCode_xx3(opc2_full & XX3_1_MASK)) >= 0) -+ return vsx_xx3[ret].opcode; -+ else { -+ -+ /* There are only a few codes in each of these cases it is -+ * probably faster to check for the codes then do the array lookups. -+ */ -+ vsxExtOpcode = opc2_full & XX3_2_MASK; -+ -+ switch (vsxExtOpcode) { -+ case 0x10C: return vsxExtOpcode; // xvcmpeqsp -+ case 0x12C: return vsxExtOpcode; // xvcmpgtsp, xvcmpgtsp. -+ case 0x14C: return vsxExtOpcode; // xvcmpgesp, xvcmpgesp. -+ case 0x18C: return vsxExtOpcode; // xvcmpeqdp, xvcmpeqdp. -+ case 0x1AC: return vsxExtOpcode; // xvcmpgtdp, xvcmpgtdp. -+ case 0x1CC: return vsxExtOpcode; // xvcmpgedp, xvcmpgedp. -+ default: break; -+ } - -- return vsxExtOpcode; -+ vsxExtOpcode = opc2_full & XX3_4_MASK; -+ -+ switch (vsxExtOpcode) { -+ case 0x8: return vsxExtOpcode; // xxsldwi -+ case 0x28: return vsxExtOpcode; // xxpermdi -+ default: break; -+ } -+ -+ vsxExtOpcode = opc2_full & XX3_5_MASK; -+ -+ switch (vsxExtOpcode) { -+ case 0x354: return vsxExtOpcode; // xvtstdcsp -+ case 0x3D4: return vsxExtOpcode; // xvtstdcdp -+ default: break; -+ } -+ -+ if (( opc2_full & XX4_MASK ) == XX4_MASK ) { // xxsel -+ vsxExtOpcode = 0x18; -+ return vsxExtOpcode; -+ } -+ } -+ -+ vex_printf( "Error: undefined opcode 0x %x, the instruction = 0x %x\n", -+ opc2_full, theInstr ); -+ vpanic( "ERROR: get_VSX60_opc2()\n" ); -+ return 0; - } - - /*------------------------------------------------------------*/ -@@ -27718,7 +27769,7 @@ DisResult disInstr_PPC_WRK ( - opc2 = ifieldOPClo10(theInstr); - UInt opc2hi = IFIELD(theInstr, 7, 4); - UInt opc2lo = IFIELD(theInstr, 3, 3); -- UInt vsxOpc2 = get_VSX60_opc2(opc2); -+ UInt vsxOpc2; - - if (( opc2hi == 13 ) && ( opc2lo == 5)) { //xvtstdcsp - if (dis_vxs_misc(theInstr, 0x354, allow_isa_3_0)) -@@ -27747,6 +27798,8 @@ DisResult disInstr_PPC_WRK ( - goto decode_failure; - } - -+ vsxOpc2 = get_VSX60_opc2(opc2, theInstr); -+ - switch (vsxOpc2) { - case 0x8: case 0x28: case 0x48: case 0xc8: // xxsldwi, xxpermdi, xxmrghw, xxmrglw - case 0x068: case 0xE8: // xxperm, xxpermr -@@ -27851,12 +27904,12 @@ DisResult disInstr_PPC_WRK ( - if (dis_vx_conv(theInstr, vsxOpc2)) goto decode_success; - goto decode_failure; - -- case 0x18C: case 0x38C: // xvcmpeqdp[.] -- case 0x10C: case 0x30C: // xvcmpeqsp[.] -- case 0x14C: case 0x34C: // xvcmpgesp[.] -- case 0x12C: case 0x32C: // xvcmpgtsp[.] -- case 0x1CC: case 0x3CC: // xvcmpgedp[.] -- case 0x1AC: case 0x3AC: // xvcmpgtdp[.] -+ case 0x18C: // xvcmpeqdp[.] -+ case 0x10C: // xvcmpeqsp[.] -+ case 0x14C: // xvcmpgesp[.] -+ case 0x12C: // xvcmpgtsp[.] -+ case 0x1CC: // xvcmpgedp[.] -+ case 0x1AC: // xvcmpgtdp[.] - if (dis_vvec_cmp(theInstr, vsxOpc2)) goto decode_success; - goto decode_failure; - diff --git a/valgrind-3.12.0-ppc64-isa-3_00.patch b/valgrind-3.12.0-ppc64-isa-3_00.patch deleted file mode 100644 index b1e9ed4..0000000 --- a/valgrind-3.12.0-ppc64-isa-3_00.patch +++ /dev/null @@ -1,54 +0,0 @@ -PPC64: ISA 3.0 setup fixes. - -There is a typo in the configure.ac file that causes the HAS_ISA_3_00 -variable to not be set. - -The mask64 value is missing the HWCAPS bit for ISA3.0. -bugzilla ---- - VEX/priv/guest_ppc_toIR.c | 2 +- - configure.ac | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c -index 0d27389..6fede61 100644 ---- a/VEX/priv/guest_ppc_toIR.c -+++ b/VEX/priv/guest_ppc_toIR.c -@@ -29122,7 +29122,7 @@ DisResult disInstr_PPC ( IRSB* irsb_IN, - - mask64 = VEX_HWCAPS_PPC64_V | VEX_HWCAPS_PPC64_FX - | VEX_HWCAPS_PPC64_GX | VEX_HWCAPS_PPC64_VX | VEX_HWCAPS_PPC64_DFP -- | VEX_HWCAPS_PPC64_ISA2_07; -+ | VEX_HWCAPS_PPC64_ISA2_07 | VEX_HWCAPS_PPC64_ISA3_0; - - if (mode64) { - vassert((hwcaps_guest & mask32) == 0); -diff --git a/configure.ac b/configure.ac -index 587917b..4c3cc58 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1537,7 +1537,7 @@ ac_asm_have_isa_3_00=no - AC_MSG_RESULT([no]) - ]) - --AM_CONDITIONAL(HAS_ISA_3_00, test x$ac_asm_have_isa_3_00 = xyes \ -+AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \ - -a x$HWCAP_HAS_ISA_3_00 = xyes]) - - # Check for pthread_create@GLIBC2.0 --- -1.8.3.1 - -Only in valgrind-3.12.0: autom4te.cache -diff -ur valgrind-3.12.0.orig/configure valgrind-3.12.0/configure ---- valgrind-3.12.0.orig/configure 2016-12-16 16:52:17.101832444 +0100 -+++ valgrind-3.12.0/configure 2017-03-28 23:38:32.997776458 +0200 -@@ -8122,7 +8122,7 @@ - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - if test x$ac_asm_have_isa_3_00 = xyes \ -- -a x$HWCAP_HAS_ISA_3_00 = xyes]; then -+ -a x$HWCAP_HAS_ISA_3_00 = xyes; then - HAS_ISA_3_00_TRUE= - HAS_ISA_3_00_FALSE='#' - else diff --git a/valgrind-3.12.0-ppc64-r2.patch b/valgrind-3.12.0-ppc64-r2.patch deleted file mode 100644 index f70043a..0000000 --- a/valgrind-3.12.0-ppc64-r2.patch +++ /dev/null @@ -1,52 +0,0 @@ - - On ppc64*, R2 is the TOC pointer, should not be considered a - scratch register, and thus should not be in the clobber list. - This is called out in newer GCC releases and triggers a - compile time error. - - Thusly, remove R2 from the clobber list. - -diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c -index dc6e26d..be77680 100644 ---- a/coregrind/m_debuglog.c -+++ b/coregrind/m_debuglog.c -@@ -215,7 +215,7 @@ static UInt local_sys_write_stderr ( const HChar* buf, Int n ) - : - : "b" (block) - : "cc","memory","cr0","ctr", -- "r0","r2","r3","r4","r5","r6","r7","r8","r9","r10","r11","r12" -+ "r0","r3","r4","r5","r6","r7","r8","r9","r10","r11","r12" - ); - if (block[0] < 0) - block[0] = -1; -@@ -231,7 +231,7 @@ static UInt local_sys_getpid ( void ) - : "=&r" (__res) - : "i" (__NR_getpid) - : "cc","memory","cr0","ctr", -- "r0","r2","r4","r5","r6","r7","r8","r9","r10","r11","r12" -+ "r0","r4","r5","r6","r7","r8","r9","r10","r11","r12" - ); - return (UInt)__res; - } -diff --git a/include/valgrind.h b/include/valgrind.h -index 6892007..d2e7c38 100644 ---- a/include/valgrind.h -+++ b/include/valgrind.h -@@ -2708,7 +2708,7 @@ typedef - #define __CALLER_SAVED_REGS \ - "lr", "ctr", "xer", \ - "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \ -- "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \ -+ "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \ - "r11", "r12", "r13" - - /* Macros to save and align the stack before making a function -@@ -3264,7 +3264,7 @@ typedef - #define __CALLER_SAVED_REGS \ - "lr", "ctr", "xer", \ - "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \ -- "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \ -+ "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \ - "r11", "r12", "r13" - - /* Macros to save and align the stack before making a function diff --git a/valgrind-3.12.0-quick-fatal-sigs.patch b/valgrind-3.12.0-quick-fatal-sigs.patch deleted file mode 100644 index c9133fc..0000000 --- a/valgrind-3.12.0-quick-fatal-sigs.patch +++ /dev/null @@ -1,103 +0,0 @@ -commit eee2c95b91b2fdcb36c0b1a2ab15df4a44ee2986 -Author: philippe -Date: Sat Nov 19 13:51:41 2016 +0000 - - Fix Bug 372600 - process loops forever when fatal signals are arriving quickly - - - - git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16140 a5019735-40e9-0310-863c-91ae7b9d1cf9 - -diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c -index 168b681..b398882 100644 ---- a/coregrind/m_signals.c -+++ b/coregrind/m_signals.c -@@ -2430,8 +2430,14 @@ void async_signalhandler ( Int sigNo, - info->si_code = sanitize_si_code(info->si_code); - - if (VG_(clo_trace_signals)) -- VG_(dmsg)("async signal handler: signal=%d, tid=%u, si_code=%d\n", -- sigNo, tid, info->si_code); -+ VG_(dmsg)("async signal handler: signal=%d, tid=%u, si_code=%d, " -+ "exitreason %s\n", -+ sigNo, tid, info->si_code, -+ VG_(name_of_VgSchedReturnCode)(tst->exitreason)); -+ -+ /* */ -+ if (tst->exitreason == VgSrc_FatalSig) -+ resume_scheduler(tid); - - /* Update thread state properly. The signal can only have been - delivered whilst we were in -@@ -2479,8 +2485,16 @@ void async_signalhandler ( Int sigNo, - ); - - /* (2) */ -- /* Set up the thread's state to deliver a signal */ -- if (!is_sig_ign(info, tid)) -+ /* Set up the thread's state to deliver a signal. -+ However, if exitreason is VgSrc_FatalSig, then thread tid was -+ taken out of a syscall by VG_(nuke_all_threads_except). -+ But after the emission of VKI_SIGKILL, another (fatal) async -+ signal might be sent. In such a case, we must not handle this -+ signal, as the thread is supposed to die first. -+ => resume the scheduler for such a thread, so that the scheduler -+ can let the thread die. */ -+ if (tst->exitreason != VgSrc_FatalSig -+ && !is_sig_ign(info, tid)) - deliver_signal(tid, info, uc); - - /* It's crucial that (1) and (2) happen in the order (1) then (2) -@@ -2946,6 +2960,20 @@ void VG_(poll_signals)(ThreadId tid) - ThreadState *tst = VG_(get_ThreadState)(tid); - vki_sigset_t saved_mask; - -+ if (tst->exitreason == VgSrc_FatalSig) { -+ /* This task has been requested to die due to a fatal signal -+ received by the process. So, we cannot poll new signals, -+ as we are supposed to die asap. If we would poll and deliver -+ a new (maybe fatal) signal, this could cause a deadlock, as -+ this thread would believe it has to terminate the other threads -+ and wait for them to die, while we already have a thread doing -+ that. */ -+ if (VG_(clo_trace_signals)) -+ VG_(dmsg)("poll_signals: not polling as thread %u is exitreason %s\n", -+ tid, VG_(name_of_VgSchedReturnCode)(tst->exitreason)); -+ return; -+ } -+ - /* look for all the signals this thread isn't blocking */ - /* pollset = ~tst->sig_mask */ - VG_(sigcomplementset)( &pollset, &tst->sig_mask ); -@@ -2961,15 +2989,18 @@ void VG_(poll_signals)(ThreadId tid) - /* If there was nothing queued, ask the kernel for a pending signal */ - if (sip == NULL && VG_(sigtimedwait_zero)(&pollset, &si) > 0) { - if (VG_(clo_trace_signals)) -- VG_(dmsg)("poll_signals: got signal %d for thread %u\n", -- si.si_signo, tid); -+ VG_(dmsg)("poll_signals: got signal %d for thread %u exitreason %s\n", -+ si.si_signo, tid, -+ VG_(name_of_VgSchedReturnCode)(tst->exitreason)); - sip = &si; - } - - if (sip != NULL) { - /* OK, something to do; deliver it */ - if (VG_(clo_trace_signals)) -- VG_(dmsg)("Polling found signal %d for tid %u\n", sip->si_signo, tid); -+ VG_(dmsg)("Polling found signal %d for tid %u exitreason %s\n", -+ sip->si_signo, tid, -+ VG_(name_of_VgSchedReturnCode)(tst->exitreason)); - if (!is_sig_ign(sip, tid)) - deliver_signal(tid, sip, NULL); - else if (VG_(clo_trace_signals)) -@@ -3073,7 +3104,8 @@ void VG_(sigstartup_actions) ( void ) - } - - if (VG_(clo_trace_signals)) -- VG_(dmsg)("Max kernel-supported signal is %d\n", VG_(max_signal)); -+ VG_(dmsg)("Max kernel-supported signal is %d, VG_SIGVGKILL is %d\n", -+ VG_(max_signal), VG_SIGVGKILL); - - /* Our private internal signals are treated as ignored */ - scss.scss_per_sig[VG_SIGVGKILL].scss_handler = VKI_SIG_IGN; diff --git a/valgrind-3.12.0-skip-cond-var.patch b/valgrind-3.12.0-skip-cond-var.patch deleted file mode 100644 index ab15928..0000000 --- a/valgrind-3.12.0-skip-cond-var.patch +++ /dev/null @@ -1,190 +0,0 @@ -commit 88cf06207b074f387c04de4938a0bb20366616b0 -Author: mjw -Date: Fri Oct 21 00:02:10 2016 +0000 - - Add libc_test to workaround pth_cond_destroy_busy test hangs. - - This is a workaround for bug #371396. It adds a new test program - that can be used skip tests given a specific libc implementation - and optionally a specific minimum version. Currently only glibc - is recognized. This is used for the drd and helgrind tests - pth_cond_destroy_busy to be skipped on glibc 2.24.90+. - - git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16097 a5019735-40e9-0310-863c-91ae7b9d1cf9 - -diff --git a/drd/tests/pth_cond_destroy_busy.vgtest b/drd/tests/pth_cond_destroy_busy.vgtest -index eafbd74..f3cf778 100644 ---- a/drd/tests/pth_cond_destroy_busy.vgtest -+++ b/drd/tests/pth_cond_destroy_busy.vgtest -@@ -1,2 +1,2 @@ --prereq: ./supported_libpthread -+prereq: ./supported_libpthread && ! ../../tests/libc_test glibc 2.24.90 - prog: pth_cond_destroy_busy -diff --git a/helgrind/tests/pth_cond_destroy_busy.vgtest b/helgrind/tests/pth_cond_destroy_busy.vgtest -index 45d7853..2957cc3 100644 ---- a/helgrind/tests/pth_cond_destroy_busy.vgtest -+++ b/helgrind/tests/pth_cond_destroy_busy.vgtest -@@ -1,2 +1,2 @@ --prereq: ! ../../tests/os_test darwin -+prereq: ! ../../tests/os_test darwin && ! ../../tests/libc_test glibc 2.24.90 - prog: ../../drd/tests/pth_cond_destroy_busy -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 9c0cc3a..7233626 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -44,6 +44,7 @@ noinst_HEADERS = \ - check_PROGRAMS = \ - arch_test \ - os_test \ -+ libc_test \ - true \ - x86_amd64_features \ - s390x_features \ -diff --git a/tests/libc_test.c b/tests/libc_test.c -new file mode 100644 -index 0000000..0de3d5d ---- /dev/null -+++ b/tests/libc_test.c -@@ -0,0 +1,78 @@ -+// Compare given libc name and version number to system name and version. -+ -+// Returns -+// - 0 if the libc name matches is at least the minimum version (if given). -+// - 1 if the libc name doesn't match or the version is lower than requested. -+// - 2 if the requested libc name isn't recognised. -+// - 3 if there was a usage error (it also prints an error message). -+ -+#include -+#include -+#include -+ -+#ifdef __GLIBC__ -+#include -+#endif -+ -+#define False 0 -+#define True 1 -+typedef int Bool; -+ -+/* Assumes the versions are x.y.z, with y and z optional. */ -+static Bool matches_version(char *min_version) { -+ int a1=0, a2=0, a3=0, g1=0, g2=0, g3=0; // 'a' = actual; 'g' = given -+ const char *aversion; -+ -+ if (min_version == NULL) return True; // no version specified -+ -+ // get actual version number -+#ifdef __GLIBC__ -+ aversion = gnu_get_libc_version(); -+#else -+ aversion = "unknown"; -+#endif -+ // We expect at least one number. -+ if (sscanf(aversion, "%d.%d.%d", &a1, &a2, &a3) < 1) return False; -+ -+ // parse given version number. -+ if (sscanf(min_version, "%d.%d.%d", &g1, &g2, &g3) < 1) return False; -+ -+ if (a1 > g1) return True; -+ if (a1 < g1) return False; -+ if (a2 > g2) return True; -+ if (a2 < g2) return False; -+ if (a3 >= g3) return True; -+ -+ return False; -+} -+ -+static Bool go(char* libc, char *min_version) -+{ -+#ifdef __GLIBC__ -+ if ( 0 == strcmp( libc, "glibc" ) -+ && matches_version( min_version )) -+ return True; -+#endif -+ -+ return False; -+} -+ -+//--------------------------------------------------------------------------- -+// main -+//--------------------------------------------------------------------------- -+int main(int argc, char **argv) -+{ -+ if ( argc < 2 ) { -+ fprintf( stderr, "usage: libc_test []\n" ); -+ exit(3); // Usage error. -+ } -+ if (go( argv[1], argv[2] )) { -+ return 0; // Matched. -+ } -+ -+ if ( 0 == strcmp ( argv[1], "glibc" ) ) { -+ return 1; // Requested libc name known, but this isn't it. -+ // Or it wasn't the minimum requested version. -+ } -+ return 2; // Didn't match any known libc name. -+} -Only in valgrind-3.12.0.RC2: autom4te.cache -diff -ur valgrind-3.12.0.RC2.orig/tests/Makefile.in valgrind-3.12.0.RC2/tests/Makefile.in ---- valgrind-3.12.0.RC2.orig/tests/Makefile.in 2016-10-21 02:10:24.283643034 +0200 -+++ valgrind-3.12.0.RC2/tests/Makefile.in 2016-10-21 02:11:09.668003685 +0200 -@@ -121,10 +121,11 @@ - @COMPILER_IS_CLANG_TRUE@ -Wno-uninitialized -Wno-unused-value # \ - @COMPILER_IS_CLANG_TRUE@ clang 3.0.0 - @COMPILER_IS_CLANG_TRUE@am__append_7 = -Wno-unused-private-field # drd/tests/tsan_unittest.cpp --check_PROGRAMS = arch_test$(EXEEXT) os_test$(EXEEXT) true$(EXEEXT) \ -- x86_amd64_features$(EXEEXT) s390x_features$(EXEEXT) \ -- mips_features$(EXEEXT) power_insn_available$(EXEEXT) \ -- is_ppc64_BE$(EXEEXT) min_power_isa$(EXEEXT) -+check_PROGRAMS = arch_test$(EXEEXT) os_test$(EXEEXT) \ -+ libc_test$(EXEEXT) true$(EXEEXT) x86_amd64_features$(EXEEXT) \ -+ s390x_features$(EXEEXT) mips_features$(EXEEXT) \ -+ power_insn_available$(EXEEXT) is_ppc64_BE$(EXEEXT) \ -+ min_power_isa$(EXEEXT) - subdir = tests - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - am__aclocal_m4_deps = $(top_srcdir)/configure.ac -@@ -142,6 +143,9 @@ - is_ppc64_BE_SOURCES = is_ppc64_BE.c - is_ppc64_BE_OBJECTS = is_ppc64_BE.$(OBJEXT) - is_ppc64_BE_LDADD = $(LDADD) -+libc_test_SOURCES = libc_test.c -+libc_test_OBJECTS = libc_test.$(OBJEXT) -+libc_test_LDADD = $(LDADD) - min_power_isa_SOURCES = min_power_isa.c - min_power_isa_OBJECTS = min_power_isa-min_power_isa.$(OBJEXT) - min_power_isa_LDADD = $(LDADD) -@@ -201,10 +205,10 @@ - am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) - am__v_CCLD_0 = @echo " CCLD " $@; - am__v_CCLD_1 = --SOURCES = arch_test.c is_ppc64_BE.c min_power_isa.c mips_features.c \ -- os_test.c power_insn_available.c s390x_features.c true.c \ -- x86_amd64_features.c --DIST_SOURCES = arch_test.c is_ppc64_BE.c min_power_isa.c \ -+SOURCES = arch_test.c is_ppc64_BE.c libc_test.c min_power_isa.c \ -+ mips_features.c os_test.c power_insn_available.c \ -+ s390x_features.c true.c x86_amd64_features.c -+DIST_SOURCES = arch_test.c is_ppc64_BE.c libc_test.c min_power_isa.c \ - mips_features.c os_test.c power_insn_available.c \ - s390x_features.c true.c x86_amd64_features.c - am__can_run_installinfo = \ -@@ -681,6 +685,10 @@ - @rm -f is_ppc64_BE$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(is_ppc64_BE_OBJECTS) $(is_ppc64_BE_LDADD) $(LIBS) - -+libc_test$(EXEEXT): $(libc_test_OBJECTS) $(libc_test_DEPENDENCIES) $(EXTRA_libc_test_DEPENDENCIES) -+ @rm -f libc_test$(EXEEXT) -+ $(AM_V_CCLD)$(LINK) $(libc_test_OBJECTS) $(libc_test_LDADD) $(LIBS) -+ - min_power_isa$(EXEEXT): $(min_power_isa_OBJECTS) $(min_power_isa_DEPENDENCIES) $(EXTRA_min_power_isa_DEPENDENCIES) - @rm -f min_power_isa$(EXEEXT) - $(AM_V_CCLD)$(min_power_isa_LINK) $(min_power_isa_OBJECTS) $(min_power_isa_LDADD) $(LIBS) -@@ -717,6 +725,7 @@ - - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch_test.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_ppc64_BE.Po@am__quote@ -+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libc_test.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/min_power_isa-min_power_isa.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mips_features.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_test.Po@am__quote@ diff --git a/valgrind-3.12.0-tests-cxx11_abi_0.patch b/valgrind-3.12.0-tests-cxx11_abi_0.patch deleted file mode 100644 index 271ed6b..0000000 --- a/valgrind-3.12.0-tests-cxx11_abi_0.patch +++ /dev/null @@ -1,85 +0,0 @@ -commit 4e66d0f7ca6ef2cac6c303e761af605c82b78456 -Author: petarj -Date: Tue Jan 31 18:22:20 2017 +0000 - - force old implementation of std::string for leak_cpp_interior test - - This patch forces leak_cpp_interior to be compiled using old implementation - of std::string. - - Related issue #373069 - - Patch by Aleksandar Rikalo. - - - git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16217 a5019735-40e9-0310-863c-91ae7b9d1cf9 - -diff --git a/memcheck/tests/leak_cpp_interior.cpp b/memcheck/tests/leak_cpp_interior.cpp -index f66fc89..a4b4824 100644 ---- a/memcheck/tests/leak_cpp_interior.cpp -+++ b/memcheck/tests/leak_cpp_interior.cpp -@@ -1,3 +1,4 @@ -+#define _GLIBCXX_USE_CXX11_ABI 0 - #define __STDC_FORMAT_MACROS - #include - #include -diff --git a/memcheck/tests/leak_cpp_interior.stderr.exp b/memcheck/tests/leak_cpp_interior.stderr.exp -index 3228f74..70e2764 100644 ---- a/memcheck/tests/leak_cpp_interior.stderr.exp -+++ b/memcheck/tests/leak_cpp_interior.stderr.exp -@@ -2,8 +2,8 @@ - valgrind output will go to log - VALGRIND_DO_LEAK_CHECK - 4 bytes in 1 blocks are definitely lost in loss record ... of ... -- by 0x........: doit() (leak_cpp_interior.cpp:115) -- by 0x........: main (leak_cpp_interior.cpp:130) -+ by 0x........: doit() (leak_cpp_interior.cpp:116) -+ by 0x........: main (leak_cpp_interior.cpp:131) - - LEAK SUMMARY: - definitely lost: 4 bytes in 1 blocks -diff --git a/memcheck/tests/leak_cpp_interior.stderr.exp-64bit b/memcheck/tests/leak_cpp_interior.stderr.exp-64bit -index 7a862a3..612fa3e 100644 ---- a/memcheck/tests/leak_cpp_interior.stderr.exp-64bit -+++ b/memcheck/tests/leak_cpp_interior.stderr.exp-64bit -@@ -2,8 +2,8 @@ - valgrind output will go to log - VALGRIND_DO_LEAK_CHECK - 8 bytes in 1 blocks are definitely lost in loss record ... of ... -- by 0x........: doit() (leak_cpp_interior.cpp:115) -- by 0x........: main (leak_cpp_interior.cpp:130) -+ by 0x........: doit() (leak_cpp_interior.cpp:116) -+ by 0x........: main (leak_cpp_interior.cpp:131) - - LEAK SUMMARY: - definitely lost: 8 bytes in 1 blocks -diff --git a/memcheck/tests/leak_cpp_interior.stderr.exp-64bit-solaris b/memcheck/tests/leak_cpp_interior.stderr.exp-64bit-solaris -index d53e4ce..f7e1a07 100644 ---- a/memcheck/tests/leak_cpp_interior.stderr.exp-64bit-solaris -+++ b/memcheck/tests/leak_cpp_interior.stderr.exp-64bit-solaris -@@ -2,8 +2,8 @@ - valgrind output will go to log - VALGRIND_DO_LEAK_CHECK - 8 bytes in 1 blocks are definitely lost in loss record ... of ... -- by 0x........: doit() (leak_cpp_interior.cpp:115) -- by 0x........: main (leak_cpp_interior.cpp:130) -+ by 0x........: doit() (leak_cpp_interior.cpp:116) -+ by 0x........: main (leak_cpp_interior.cpp:131) - - LEAK SUMMARY: - definitely lost: 8 bytes in 1 blocks -diff --git a/memcheck/tests/leak_cpp_interior.stderr.exp-solaris b/memcheck/tests/leak_cpp_interior.stderr.exp-solaris -index 80cd5c3..f9fc390 100644 ---- a/memcheck/tests/leak_cpp_interior.stderr.exp-solaris -+++ b/memcheck/tests/leak_cpp_interior.stderr.exp-solaris -@@ -2,8 +2,8 @@ - valgrind output will go to log - VALGRIND_DO_LEAK_CHECK - 4 bytes in 1 blocks are definitely lost in loss record ... of ... -- by 0x........: doit() (leak_cpp_interior.cpp:115) -- by 0x........: main (leak_cpp_interior.cpp:130) -+ by 0x........: doit() (leak_cpp_interior.cpp:116) -+ by 0x........: main (leak_cpp_interior.cpp:131) - - LEAK SUMMARY: - definitely lost: 4 bytes in 1 blocks diff --git a/valgrind-3.12.0-x86-gdt-and-ss.patch b/valgrind-3.12.0-x86-gdt-and-ss.patch deleted file mode 100644 index fbaf984..0000000 --- a/valgrind-3.12.0-x86-gdt-and-ss.patch +++ /dev/null @@ -1,139 +0,0 @@ -commit c7bcd1f2ee2d466fb556bfc2b33c5ab039b0898d -Author: sewardj -Date: Fri Jan 20 09:58:15 2017 +0000 - - x86-linux: Initialize x86 system GDT on first use. Bug 344139 comment 3. - Patch from Sebastian Lackner, sebastian@fds-team.de. - - - git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16204 a5019735-40e9-0310-863c-91ae7b9d1cf9 - -diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c -index f8c4eb4..2f879d8 100644 ---- a/coregrind/m_syswrap/syswrap-x86-linux.c -+++ b/coregrind/m_syswrap/syswrap-x86-linux.c -@@ -294,11 +294,37 @@ void translate_to_hw_format ( /* IN */ vki_modify_ldt_t* inn, - out->LdtEnt.Words.word2 = entry_2; - } - --/* Create a zeroed-out GDT. */ --static VexGuestX86SegDescr* alloc_zeroed_x86_GDT ( void ) -+/* Create initial GDT. */ -+static VexGuestX86SegDescr* alloc_system_x86_GDT ( void ) - { - Int nbytes = VEX_GUEST_X86_GDT_NENT * sizeof(VexGuestX86SegDescr); -- return VG_(calloc)("di.syswrap-x86.azxG.1", nbytes, 1); -+ VexGuestX86SegDescr* gdt = VG_(calloc)("di.syswrap-x86.azxG.1", nbytes, 1); -+ vki_modify_ldt_t info; -+ UShort seg; -+ -+ VG_(memset)(&info, 0, sizeof(info)); -+ info.entry_number = 0; -+ info.base_addr = 0; -+ info.limit = 0xfffff; -+ info.seg_32bit = 1; -+ info.contents = 0; -+ info.read_exec_only = 0; -+ info.limit_in_pages = 1; -+ info.seg_not_present = 0; -+ info.useable = 0; -+ info.reserved = 0; -+ -+ asm volatile("movw %%ds, %0" : : "m" (seg)); -+ if (!(seg & 4)) translate_to_hw_format(&info, &gdt[seg >> 3], 0); -+ asm volatile("movw %%ss, %0" : : "m" (seg)); -+ if (!(seg & 4)) translate_to_hw_format(&info, &gdt[seg >> 3], 0); -+ -+ info.contents = 2; -+ -+ asm volatile("movw %%cs, %0" : : "m" (seg)); -+ if (!(seg & 4)) translate_to_hw_format(&info, &gdt[seg >> 3], 0); -+ -+ return gdt; - } - - /* Create a zeroed-out LDT. */ -@@ -505,7 +531,7 @@ SysRes ML_(x86_sys_set_thread_area) ( ThreadId tid, vki_modify_ldt_t* info ) - - /* If the thread doesn't have a GDT, allocate it now. */ - if (!gdt) { -- gdt = alloc_zeroed_x86_GDT(); -+ gdt = alloc_system_x86_GDT(); - VG_(threads)[tid].arch.vex.guest_GDT = (HWord)gdt; - } - -@@ -564,7 +590,7 @@ static SysRes sys_get_thread_area ( ThreadId tid, vki_modify_ldt_t* info ) - - /* If the thread doesn't have a GDT, allocate it now. */ - if (!gdt) { -- gdt = alloc_zeroed_x86_GDT(); -+ gdt = alloc_system_x86_GDT(); - VG_(threads)[tid].arch.vex.guest_GDT = (HWord)gdt; - } - -@@ -616,7 +642,7 @@ void ML_(x86_setup_LDT_GDT) ( /*OUT*/ ThreadArchState *child, - child->vex.guest_GDT = (HWord)NULL; - - if (parent->vex.guest_GDT != (HWord)NULL) { -- child->vex.guest_GDT = (HWord)alloc_zeroed_x86_GDT(); -+ child->vex.guest_GDT = (HWord)alloc_system_x86_GDT(); - copy_GDT_from_to( (VexGuestX86SegDescr*)parent->vex.guest_GDT, - (VexGuestX86SegDescr*)child->vex.guest_GDT ); - } -commit 5f4041b376f7465cd108ad4d1696b0b8a603a175 -Author: sewardj -Date: Fri Jan 20 10:01:42 2017 +0000 - - x86: Recognize the SS segment prefix on x86. Bug 344139 comment 4. - Patch from Sebastian Lackner, sebastian@fds-team.de. - - - git-svn-id: svn://svn.valgrind.org/vex/trunk@3299 8f6e269a-dfd6-0310-a8e1-e2731360e62c - -diff --git a/VEX/priv/guest_x86_toIR.c b/VEX/priv/guest_x86_toIR.c -index de09d3a..234d68e 100644 ---- a/VEX/priv/guest_x86_toIR.c -+++ b/VEX/priv/guest_x86_toIR.c -@@ -1409,6 +1409,7 @@ const HChar* sorbTxt ( UChar sorb ) - case 0x26: return "%es:"; - case 0x64: return "%fs:"; - case 0x65: return "%gs:"; -+ case 0x36: return "%ss:"; - default: vpanic("sorbTxt(x86,guest)"); - } - } -@@ -1433,6 +1434,7 @@ IRExpr* handleSegOverride ( UChar sorb, IRExpr* virtual ) - case 0x26: sreg = R_ES; break; - case 0x64: sreg = R_FS; break; - case 0x65: sreg = R_GS; break; -+ case 0x36: sreg = R_SS; break; - default: vpanic("handleSegOverride(x86,guest)"); - } - -@@ -8101,7 +8103,7 @@ DisResult disInstr_X86_WRK ( - Int sz = 4; - - /* sorb holds the segment-override-prefix byte, if any. Zero if no -- prefix has been seen, else one of {0x26, 0x3E, 0x64, 0x65} -+ prefix has been seen, else one of {0x26, 0x36, 0x3E, 0x64, 0x65} - indicating the prefix. */ - UChar sorb = 0; - -@@ -8255,6 +8257,7 @@ DisResult disInstr_X86_WRK ( - case 0x26: /* %ES: */ - case 0x64: /* %FS: */ - case 0x65: /* %GS: */ -+ case 0x36: /* %SS: */ - if (sorb != 0) - goto decode_failure; /* only one seg override allowed */ - sorb = pre; -@@ -8274,9 +8277,6 @@ DisResult disInstr_X86_WRK ( - } - break; - } -- case 0x36: /* %SS: */ -- /* SS override cases are not handled */ -- goto decode_failure; - default: - goto not_a_prefix; - } diff --git a/valgrind.spec b/valgrind.spec index ebe1180..786214c 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -2,8 +2,8 @@ Summary: Tool for finding memory management bugs in programs Name: %{?scl_prefix}valgrind -Version: 3.12.0 -Release: 8%{?dist} +Version: 3.13.0 +Release: 0.1.RC1%{?dist} Epoch: 1 License: GPLv2+ URL: http://www.valgrind.org/ @@ -58,7 +58,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # So those will already have their full symbol table. %undefine _include_minidebuginfo -Source0: http://www.valgrind.org/downloads/valgrind-%{version}.tar.bz2 +Source0: ftp://sourceware.org/pub/valgrind/valgrind-%{version}.RC1.tar.bz2 # Needs investigation and pushing upstream Patch1: valgrind-3.9.0-cachegrind-improvements.patch @@ -69,70 +69,6 @@ Patch2: valgrind-3.9.0-helgrind-race-supp.patch # Make ld.so supressions slightly less specific. Patch3: valgrind-3.9.0-ldso-supp.patch -# KDE#371396 - workaround helgrind and drd pth_cond_destroy_busy testcase hangs -Patch4: valgrind-3.12.0-skip-cond-var.patch - -# RHBZ#1390282 upstream svn r16134 -# Cleanup none/tests/nocwd.vgtest tmp dirs. -Patch5: valgrind-3.12.0-nocwd-cleanup.patch - -# RHBZ#1424367 -# GCC7 now diagnoses inline assembly that clobbers register r2. -# This has always been invalid code, and is no longer quietly tolerated. -Patch6: valgrind-3.12.0-ppc64-r2.patch - -# KDE#376611 ppc64 and arm64 don't know about prlimit64 syscall -Patch7: valgrind-3.12.0-arm64-ppc64-prlimit64.patch - -# KDE#376279 Handle unknown HINT instructions on aarch64 by ignoring them. -Patch8: valgrind-3.12.0-arm64-hint.patch - -# KDE#342040 Valgrind mishandles clone with CLONE_VFORK | CLONE_VM -# that clones to a different stack -# KDE#373192 Calling posix_spawn in glibc 2.24 completely broken -Patch9: valgrind-3.12.0-clone-spawn.patch - -# KDE#372600 process loops forever when fatal signals are arriving quickly -Patch10: valgrind-3.12.0-quick-fatal-sigs.patch - -# KDE#372504 Hanging on exit_group -Patch11: valgrind-3.12.0-exit_group.patch - -# KDE#373046 Stacks registered by core are never deregistered -Patch12: valgrind-3.12.0-deregister-stack.patch - -# KDE#344139 -# Initialize x86 system GDT on first use. -# VEX: Recognize the SS segment prefix on x86. -Patch13: valgrind-3.12.0-x86-gdt-and-ss.patch - -# KDE#352767 - Wine/valgrind: noted but unhandled ioctl 0x5307 (CDROMSTOP) -# KDE#348616 - Wine/valgrind: noted but unhandled ioctl 0x5390 (DVD_READ_STRUCT) -Patch14: valgrind-3.12.0-cd-dvd-ioctl.patch - -# KDE#373069 force old implementation of std::string for leak_cpp_interior test -Patch15: valgrind-3.12.0-tests-cxx11_abi_0.patch - -# KDE#375806 add suppression for helgrind/tests/tc22_exit_w_lock -Patch16: valgrind-3.12.0-helgrind-dl_allocate_tls-supp.patch - -# KDE#372195 Power PC, xxsel instruction is not always recognized. -Patch17: valgrind-3.12.0-ppc-xxsel.patch - -# Combined valgrind svn r16229:r16248 patches. -# Enables pivot_root, sync_file_range, unshare, get_robust_list, -# delete_module, sched_rr_get_interval, tkill, request_key, move_pages, -# rt_tgsigqueueinfo, fanotify_init, fanotify_mark, clock_adjtime, kcmp, -# getcpu and sethostname syscalls on arm64. -Patch18: valgrind-3.12.0-aarch64-syscalls.patch - -# KDE#377427 Fix incorrect register pair check for lxv, stxv, stxsd, -# stxssp, lxsd, lxssp instructions -Patch19: valgrind-3.12.0-powerpc-register-pair.patch - -# KDE#377478 PPC64: ISA 3.0 setup fixes -Patch20: valgrind-3.12.0-ppc64-isa-3_00.patch - %if %{build_multilib} # Ensure glibc{,-devel} is installed for both multilib arches BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so @@ -243,28 +179,11 @@ Valgrind User Manual for details. %endif %prep -%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version} +%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.RC1 %patch1 -p1 %patch2 -p1 %patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 -%patch18 -p1 -%patch19 -p1 -%patch20 -p1 %build # We need to use the software collection compiler and binutils if available. @@ -390,6 +309,10 @@ cat /proc/cpuinfo # the testsuite sets all flags necessary. See also configure above. make %{?_smp_mflags} CFLAGS="" CXXFLAGS="" LDFLAGS="" check +# Workaround https://bugzilla.redhat.com/show_bug.cgi?id=1434601 +# for gdbserver tests. +export PYTHONCOERCECLOCALE=0 + echo ===============TESTING=================== # On arm the gdb integration tests hang for unknown reasons. %ifarch %{arm} @@ -458,8 +381,11 @@ echo ===============END TESTING=============== %endif %changelog -* Wed Apr 12 2017 Mark Wielaard +* Fri Jun 2 2017 Mark Wielaard - 3.13.0-0.1.RC1 - Update description as suggested by Ivo Raisr. +- Workaround gdb/python bug in testsuite (#1434601) +- Update to upstream 3.13.0-RC1. +- Drop all upstreamed patches. * Tue Mar 28 2017 Mark Wielaard - 3.12.0-8 - Add valgrind-3.12.0-powerpc-register-pair.patch