Elliott Hughes | a0664b9 | 2017-04-18 17:46:52 -0700 | [diff] [blame^] | 1 | /* This is the arm64 variant of memcheck/tests/x86-linux/scalar.c |
| 2 | syscalls are in x86 number order to make exp comparison easier. */ |
| 3 | #define _GNU_SOURCE |
| 4 | #include "../../memcheck.h" |
| 5 | #include "scalar.h" |
| 6 | #include <unistd.h> |
| 7 | #include <sched.h> |
| 8 | #include <signal.h> |
| 9 | #include <linux/mman.h> // MREMAP_FIXED |
| 10 | |
| 11 | // Here we are trying to trigger every syscall error (scalar errors and |
| 12 | // memory errors) for every syscall. We do this by passing a lot of bogus |
| 13 | // arguments, mostly 0 and 1 (often it's 1 because NULL ptr args often aren't |
| 14 | // checked for memory errors, or in order to have a non-zero length used |
| 15 | // with some buffer). So most of the syscalls don't actually succeed and do |
| 16 | // anything. |
| 17 | // |
| 18 | // Occasionally we have to be careful not to cause Valgrind to seg fault in |
| 19 | // its pre-syscall wrappers; it does so because it can't know in general |
| 20 | // when memory is unaddressable, and so tries to dereference it when doing |
| 21 | // PRE_MEM_READ/PRE_MEM_WRITE calls. (Note that Memcheck will |
| 22 | // always issue an error message immediately before these seg faults occur). |
| 23 | // |
| 24 | // The output has numbers like "3s 2m" for each syscall. "s" is short for |
| 25 | // "scalar", ie. the argument itself is undefined. "m" is short for "memory", |
| 26 | // ie. the argument points to memory which is unaddressable. |
| 27 | int main(void) |
| 28 | { |
| 29 | // uninitialised, but we know px[0] is 0x0 |
| 30 | long* px = malloc(sizeof(long)); |
| 31 | long x0 = px[0]; |
| 32 | long res; |
| 33 | |
| 34 | // All __NR_xxx numbers are taken from x86 |
| 35 | |
| 36 | // __NR_restart_syscall 0 // XXX: not yet handled, perhaps should be... |
| 37 | GO(__NR_restart_syscall, "n/a"); |
| 38 | //SY(__NR_restart_syscall); // (Not yet handled by Valgrind) FAIL; |
| 39 | |
| 40 | // __NR_exit 1 |
| 41 | GO(__NR_exit, "below"); |
| 42 | // (see below) |
| 43 | |
| 44 | // __NR_fork arm64 only has clone |
| 45 | //GO(__NR_fork, "other"); |
| 46 | // (sse scalar_fork.c) |
| 47 | |
| 48 | // __NR_read 3 |
| 49 | // Nb: here we are also getting an error from the syscall arg itself. |
| 50 | GO(__NR_read, "1+3s 1m"); |
| 51 | SY(__NR_read+x0, x0, x0, x0+1); FAILx(EFAULT); |
| 52 | |
| 53 | // __NR_write 4 |
| 54 | GO(__NR_write, "3s 1m"); |
| 55 | SY(__NR_write, x0, x0, x0+1); FAIL; |
| 56 | |
| 57 | // __NR_open arm64 only as openat. |
| 58 | //GO(__NR_open, "(2-args) 2s 1m"); |
| 59 | //SY(__NR_open, x0, x0); FAIL; |
| 60 | |
| 61 | // Only 1s 0m errors -- the other 2s 1m have been checked in the previous |
| 62 | // open test, and if we test them they may be commoned up but they also |
| 63 | // may not. arm64 only has openat. |
| 64 | //GO(__NR_open, "(3-args) 1s 0m"); |
| 65 | //SY(__NR_open, "scalar.c", O_CREAT|O_EXCL, x0); FAIL; |
| 66 | |
| 67 | // __NR_close 6 |
| 68 | GO(__NR_close, "1s 0m"); |
| 69 | SY(__NR_close, x0-1); FAIL; |
| 70 | |
| 71 | // __NR_waitpid arm64 only has waitid. |
| 72 | //GO(__NR_waitpid, "3s 1m"); |
| 73 | //SY(__NR_waitpid, x0, x0+1, x0); FAIL; |
| 74 | |
| 75 | // __NR_creat arm64 only has openat |
| 76 | //GO(__NR_creat, "2s 1m"); |
| 77 | //SY(__NR_creat, x0, x0); FAIL; |
| 78 | |
| 79 | // __NR_link arm64 only has linkat |
| 80 | //GO(__NR_link, "2s 2m"); |
| 81 | //SY(__NR_link, x0, x0); FAIL; |
| 82 | |
| 83 | // __NR_unlink arm64 only has unlinkat |
| 84 | //GO(__NR_unlink, "1s 1m"); |
| 85 | //SY(__NR_unlink, x0); FAIL; |
| 86 | |
| 87 | // __NR_execve 11 |
| 88 | // Nb: could have 3 memory errors if we pass x0+1 as the 2nd and 3rd |
| 89 | // args, except for bug #93174. |
| 90 | GO(__NR_execve, "3s 1m"); |
| 91 | SY(__NR_execve, x0, x0, x0); FAIL; |
| 92 | |
| 93 | // __NR_chdir 12 |
| 94 | GO(__NR_chdir, "1s 1m"); |
| 95 | SY(__NR_chdir, x0); FAIL; |
| 96 | |
| 97 | // __NR_time on arm64 time is provided in the vdso |
| 98 | //GO(__NR_time, "1s 1m"); |
| 99 | //SY(__NR_time, x0+1); FAIL; |
| 100 | |
| 101 | // __NR_mknod arm64 only has mknodat |
| 102 | //GO(__NR_mknod, "3s 1m"); |
| 103 | //SY(__NR_mknod, x0, x0, x0); FAIL; |
| 104 | |
| 105 | // __NR_chmod arm64 only has chmodat |
| 106 | //GO(__NR_chmod, "2s 1m"); |
| 107 | //SY(__NR_chmod, x0, x0); FAIL; |
| 108 | |
| 109 | // __NR_lchown arm64 only has lchownat |
| 110 | //GO(__NR_lchown, "n/a"); |
| 111 | //SY(__NR_lchown); // (Not yet handled by Valgrind) FAIL; |
| 112 | |
| 113 | // __NR_break arm64 has no break |
| 114 | //GO(__NR_break, "ni"); |
| 115 | //SY(__NR_break); FAIL; |
| 116 | |
| 117 | // __NR_oldstat arm64 has no oldstat |
| 118 | //GO(__NR_oldstat, "n/a"); |
| 119 | // (obsolete, not handled by Valgrind) |
| 120 | |
| 121 | // __NR_lseek 19 |
| 122 | GO(__NR_lseek, "3s 0m"); |
| 123 | SY(__NR_lseek, x0-1, x0, x0); FAILx(EBADF); |
| 124 | |
| 125 | // __NR_getpid 20 |
| 126 | GO(__NR_getpid, "0s 0m"); |
| 127 | SY(__NR_getpid); SUCC; |
| 128 | |
| 129 | // __NR_mount 21 |
| 130 | GO(__NR_mount, "5s 3m"); |
| 131 | SY(__NR_mount, x0, x0, x0, x0, x0); FAIL; |
| 132 | |
| 133 | // __NR_umount arm64 only has umount2 |
| 134 | //GO(__NR_umount, "1s 1m"); |
| 135 | //SY(__NR_umount, x0); FAIL; |
| 136 | |
| 137 | // __NR_setuid 23 |
| 138 | GO(__NR_setuid, "1s 0m"); |
| 139 | SY(__NR_setuid, x0); FAIL; |
| 140 | |
| 141 | // __NR_getuid 24 |
| 142 | GO(__NR_getuid, "0s 0m"); |
| 143 | SY(__NR_getuid); SUCC; |
| 144 | |
| 145 | // __NR_stime arm64 does not have stime |
| 146 | //GO(__NR_stime, "n/a"); |
| 147 | //SY(__NR_stime); // (Not yet handled by Valgrind) FAIL; |
| 148 | |
| 149 | // __NR_ptrace arm64 does not use PTRACE_GETREGS |
| 150 | // XXX: memory pointed to be arg3 goes unchecked... otherwise would be 2m |
| 151 | //GO(__NR_ptrace, "4s 1m"); |
| 152 | //SY(__NR_ptrace, x0+PTRACE_GETREGS, x0, x0, x0); FAIL; |
| 153 | |
| 154 | // __NR_alarm arm64 only has ualarm |
| 155 | //GO(__NR_alarm, "1s 0m"); |
| 156 | //SY(__NR_alarm, x0); SUCC; |
| 157 | |
| 158 | // __NR_oldfstat arm64 does not have oldfstat |
| 159 | //GO(__NR_oldfstat, "n/a"); |
| 160 | // (obsolete, not handled by Valgrind) |
| 161 | |
| 162 | // __NR_pause arm64 does not have pause |
| 163 | //GO(__NR_pause, "ignore"); |
| 164 | // (hard to test, and no args so not much to be gained -- don't bother) |
| 165 | |
| 166 | // __NR_utime arm64 only has utimes |
| 167 | //GO(__NR_utime, "2s 2m"); |
| 168 | //SY(__NR_utime, x0, x0+1); FAIL; |
| 169 | |
| 170 | // __NR_stty arm64 doesn't have stty. |
| 171 | //GO(__NR_stty, "ni"); |
| 172 | //SY(__NR_stty); FAIL; |
| 173 | |
| 174 | // __NR_gtty arm64 doesm't have gtty. |
| 175 | //GO(__NR_gtty, "ni"); |
| 176 | //SY(__NR_gtty); FAIL; |
| 177 | |
| 178 | // __NR_access arm64 only has fsaccessat |
| 179 | //GO(__NR_access, "2s 1m"); |
| 180 | //SY(__NR_access, x0, x0); FAIL; |
| 181 | |
| 182 | // __NR_nice arm64 only has setpriority |
| 183 | //GO(__NR_nice, "1s 0m"); |
| 184 | //SY(__NR_nice, x0); SUCC; |
| 185 | |
| 186 | // __NR_ftime arm64 doesn't implement ftime |
| 187 | //GO(__NR_ftime, "ni"); |
| 188 | //SY(__NR_ftime); FAIL; |
| 189 | |
| 190 | // __NR_sync 36 |
| 191 | GO(__NR_sync, "0s 0m"); |
| 192 | SY(__NR_sync); SUCC; |
| 193 | |
| 194 | // __NR_kill 37 |
| 195 | GO(__NR_kill, "2s 0m"); |
| 196 | SY(__NR_kill, x0, x0); SUCC; |
| 197 | |
| 198 | // __NR_rename arm64 only has renameat |
| 199 | //GO(__NR_rename, "2s 2m"); |
| 200 | //SY(__NR_rename, x0, x0); FAIL; |
| 201 | |
| 202 | // __NR_mkdir arm64 only has mkdirat |
| 203 | //GO(__NR_mkdir, "2s 1m"); |
| 204 | //SY(__NR_mkdir, x0, x0); FAIL; |
| 205 | |
| 206 | // __NR_rmdir arm64 only has rmdirat |
| 207 | //GO(__NR_rmdir, "1s 1m"); |
| 208 | //SY(__NR_rmdir, x0); FAIL; |
| 209 | |
| 210 | // __NR_dup 41 |
| 211 | GO(__NR_dup, "1s 0m"); |
| 212 | SY(__NR_dup, x0-1); FAIL; |
| 213 | |
| 214 | // __NR_pipe arm64 only has pipe2 |
| 215 | //GO(__NR_pipe, "1s 1m"); |
| 216 | //SY(__NR_pipe, x0); FAIL; |
| 217 | |
| 218 | // __NR_times 43 |
| 219 | GO(__NR_times, "1s 1m"); |
| 220 | SY(__NR_times, x0+1); FAIL; |
| 221 | |
| 222 | // __NR_prof arm64 doesn't implement prof |
| 223 | //GO(__NR_prof, "ni"); |
| 224 | //SY(__NR_prof); FAIL; |
| 225 | |
| 226 | // __NR_brk 45 |
| 227 | GO(__NR_brk, "1s 0m"); |
| 228 | SY(__NR_brk, x0); SUCC; |
| 229 | |
| 230 | // __NR_setgid 46 |
| 231 | GO(__NR_setgid, "1s 0m"); |
| 232 | SY(__NR_setgid, x0); FAIL; |
| 233 | |
| 234 | // __NR_getgid 47 |
| 235 | GO(__NR_getgid, "0s 0m"); |
| 236 | SY(__NR_getgid); SUCC; |
| 237 | |
| 238 | // __NR_signal arm64 only has rt_sigaction |
| 239 | //GO(__NR_signal, "n/a"); |
| 240 | //SY(__NR_signal); // (Not yet handled by Valgrind) FAIL; |
| 241 | |
| 242 | // __NR_geteuid 49 |
| 243 | GO(__NR_geteuid, "0s 0m"); |
| 244 | SY(__NR_geteuid); SUCC; |
| 245 | |
| 246 | // __NR_getegid 50 |
| 247 | GO(__NR_getegid, "0s 0m"); |
| 248 | SY(__NR_getegid); SUCC; |
| 249 | |
| 250 | // __NR_acct 51 |
| 251 | GO(__NR_acct, "1s 1m"); |
| 252 | SY(__NR_acct, x0); FAIL; |
| 253 | |
| 254 | // __NR_umount2 52 |
| 255 | GO(__NR_umount2, "2s 1m"); |
| 256 | SY(__NR_umount2, x0, x0); FAIL; |
| 257 | |
| 258 | // __NR_lock arm64 doesn't implement lock |
| 259 | //GO(__NR_lock, "ni"); |
| 260 | //SY(__NR_lock); FAIL; |
| 261 | |
| 262 | // __NR_ioctl 54 |
| 263 | #include <asm/ioctls.h> |
| 264 | GO(__NR_ioctl, "3s 1m"); |
| 265 | SY(__NR_ioctl, x0, x0+TCSETS, x0); FAIL; |
| 266 | |
| 267 | // __NR_fcntl 55 |
| 268 | // As with sys_open(), the 'fd' error is suppressed for the later ones. |
| 269 | // For F_GETFD the 3rd arg is ignored |
| 270 | GO(__NR_fcntl, "(GETFD) 2s 0m"); |
| 271 | SY(__NR_fcntl, x0-1, x0+F_GETFD, x0); FAILx(EBADF); |
| 272 | |
| 273 | // For F_DUPFD the 3rd arg is 'arg'. We don't check the 1st two args |
| 274 | // because any errors may or may not be commoned up with the ones from |
| 275 | // the previous fcntl call. |
| 276 | GO(__NR_fcntl, "(DUPFD) 1s 0m"); |
| 277 | SY(__NR_fcntl, -1, F_DUPFD, x0); FAILx(EBADF); |
| 278 | |
| 279 | // For F_GETLK the 3rd arg is 'lock'. On x86, this fails w/EBADF. But |
| 280 | // on amd64 in 32-bit mode it fails w/EFAULT. We don't check the 1st two |
| 281 | // args for the reason given above. |
| 282 | GO(__NR_fcntl, "(GETLK) 1s 0m"); |
| 283 | SY(__NR_fcntl, -1, F_GETLK, x0); FAIL; //FAILx(EBADF); |
| 284 | |
| 285 | // __NR_mpx arm64 doesn't implement mpx |
| 286 | //GO(__NR_mpx, "ni"); |
| 287 | //SY(__NR_mpx); FAIL; |
| 288 | |
| 289 | // __NR_setpgid 57 |
| 290 | GO(__NR_setpgid, "2s 0m"); |
| 291 | SY(__NR_setpgid, x0, x0-1); FAIL; |
| 292 | |
| 293 | // __NR_ulimit arm64 doesn't implement ulimit |
| 294 | //GO(__NR_ulimit, "ni"); |
| 295 | //SY(__NR_ulimit); FAIL; |
| 296 | |
| 297 | // __NR_oldolduname arm64 doesn't implement oldolduname, |
| 298 | //GO(__NR_oldolduname, "n/a"); |
| 299 | // (obsolete, not handled by Valgrind) |
| 300 | |
| 301 | // __NR_umask 60 |
| 302 | GO(__NR_umask, "1s 0m"); |
| 303 | SY(__NR_umask, x0+022); SUCC; |
| 304 | |
| 305 | // __NR_chroot 61 |
| 306 | GO(__NR_chroot, "1s 1m"); |
| 307 | SY(__NR_chroot, x0); FAIL; |
| 308 | |
| 309 | // __NR_ustat arm64 only has statfs |
| 310 | //GO(__NR_ustat, "n/a"); |
| 311 | // (deprecated, not handled by Valgrind) |
| 312 | |
| 313 | // __NR_dup2 arm64 only has dup or dup3 |
| 314 | //GO(__NR_dup2, "2s 0m"); |
| 315 | //SY(__NR_dup2, x0-1, x0); FAIL; |
| 316 | |
| 317 | // __NR_getppid 64 |
| 318 | GO(__NR_getppid, "0s 0m"); |
| 319 | SY(__NR_getppid); SUCC; |
| 320 | |
| 321 | // __NR_getpgrp arm64 only has getpgid |
| 322 | //GO(__NR_getpgrp, "0s 0m"); |
| 323 | //SY(__NR_getpgrp); SUCC; |
| 324 | |
| 325 | // __NR_setsid 66 |
| 326 | GO(__NR_setsid, "0s 0m"); |
| 327 | SY(__NR_setsid); SUCC_OR_FAIL; |
| 328 | |
| 329 | // __NR_sigaction arm64 only has rt_sigaction |
| 330 | //GO(__NR_sigaction, "3s 4m"); |
| 331 | //SY(__NR_sigaction, x0, x0+&px[1], x0+&px[1]); FAIL; |
| 332 | |
| 333 | // __NR_sgetmask arm64 only has rt_sigprocmask |
| 334 | //GO(__NR_sgetmask, "n/a"); |
| 335 | //SY(__NR_sgetmask); // (Not yet handled by Valgrind) FAIL; |
| 336 | |
| 337 | // __NR_ssetmask arm64 only has rt_sigprocmask |
| 338 | //GO(__NR_ssetmask, "n/a"); |
| 339 | //SY(__NR_ssetmask); // (Not yet handled by Valgrind) FAIL; |
| 340 | |
| 341 | // __NR_setreuid 70 |
| 342 | GO(__NR_setreuid, "2s 0m"); |
| 343 | SY(__NR_setreuid, x0, x0); FAIL; |
| 344 | |
| 345 | // __NR_setregid 71 |
| 346 | GO(__NR_setregid, "2s 0m"); |
| 347 | SY(__NR_setregid, x0, x0); FAIL; |
| 348 | |
| 349 | // __NR_sigsuspend arm64 only has rt_sigsuspend |
| 350 | // XXX: how do you use this function? |
| 351 | //GO(__NR_sigsuspend, "ignore"); |
| 352 | // (I don't know how to test this...) |
| 353 | |
| 354 | // __NR_sigpending arm64 only has rt_sigpending |
| 355 | //GO(__NR_sigpending, "1s 1m"); |
| 356 | //SY(__NR_sigpending, x0); FAIL; |
| 357 | |
| 358 | // __NR_sethostname 74 |
| 359 | GO(__NR_sethostname, "n/a"); |
| 360 | //SY(__NR_sethostname); // (Not yet handled by Valgrind) FAIL; |
| 361 | |
| 362 | // __NR_setrlimit 75 |
| 363 | GO(__NR_setrlimit, "2s 1m"); |
| 364 | SY(__NR_setrlimit, x0, x0); FAIL; |
| 365 | |
| 366 | // __NR_getrlimit 76 |
| 367 | GO(__NR_getrlimit, "2s 1m"); |
| 368 | SY(__NR_getrlimit, x0, x0); FAIL; |
| 369 | |
| 370 | // __NR_getrusage 77 |
| 371 | GO(__NR_getrusage, "2s 1m"); |
| 372 | SY(__NR_getrusage, x0, x0); FAIL; |
| 373 | |
| 374 | // __NR_gettimeofday 78 |
| 375 | GO(__NR_gettimeofday, "2s 2m"); |
| 376 | SY(__NR_gettimeofday, x0+1, x0+1); FAIL; |
| 377 | |
| 378 | // __NR_settimeofday 79 |
| 379 | GO(__NR_settimeofday, "2s 2m"); |
| 380 | SY(__NR_settimeofday, x0+1, x0+1); FAIL; |
| 381 | |
| 382 | // __NR_getgroups 80 |
| 383 | GO(__NR_getgroups, "2s 1m"); |
| 384 | SY(__NR_getgroups, x0+1, x0+1); FAIL; |
| 385 | |
| 386 | // __NR_setgroups 81 |
| 387 | GO(__NR_setgroups, "2s 1m"); |
| 388 | SY(__NR_setgroups, x0+1, x0+1); FAIL; |
| 389 | |
| 390 | // __NR_select arm64 only has pselect6 |
| 391 | //{ |
| 392 | // long args[5] = { x0+8, x0+0xffffffee, x0+1, x0+1, x0+1 }; |
| 393 | // GO(__NR_select, "1s 5m"); |
| 394 | // SY(__NR_select, args+x0); FAIL; |
| 395 | //} |
| 396 | |
| 397 | // __NR_symlink arm64 only has symlinkat |
| 398 | //GO(__NR_symlink, "2s 2m"); |
| 399 | //SY(__NR_symlink, x0, x0); FAIL; |
| 400 | |
| 401 | // __NR_oldlstat arm64 doesn't implement oldlstat |
| 402 | //GO(__NR_oldlstat, "n/a"); |
| 403 | // (obsolete, not handled by Valgrind) |
| 404 | |
| 405 | // __NR_readlink arm64 only has readlinkat |
| 406 | //GO(__NR_readlink, "3s 2m"); |
| 407 | //SY(__NR_readlink, x0+1, x0+1, x0+1); FAIL; |
| 408 | |
| 409 | // __NR_uselib arm64 doesn't implement uselib |
| 410 | //GO(__NR_uselib, "n/a"); |
| 411 | //SY(__NR_uselib); // (Not yet handled by Valgrind) FAIL; |
| 412 | |
| 413 | // __NR_swapon 87 |
| 414 | GO(__NR_swapon, "n/a"); |
| 415 | //SY(__NR_swapon); // (Not yet handled by Valgrind) FAIL; |
| 416 | |
| 417 | // __NR_reboot 88 |
| 418 | GO(__NR_reboot, "n/a"); |
| 419 | //SY(__NR_reboot); // (Not yet handled by Valgrind) FAIL; |
| 420 | |
| 421 | // __NR_readdir arm64 only implements getdents64 |
| 422 | //GO(__NR_readdir, "n/a"); |
| 423 | // (superseded, not handled by Valgrind) |
| 424 | |
| 425 | // __NR_mmap 90 |
| 426 | { |
| 427 | long args[6] = { x0, x0, x0, x0, x0-1, x0 }; |
| 428 | GO(__NR_mmap, "1s 1m"); |
| 429 | SY(__NR_mmap, args+x0); FAIL; |
| 430 | } |
| 431 | |
| 432 | // __NR_munmap 91 |
| 433 | GO(__NR_munmap, "2s 0m"); |
| 434 | SY(__NR_munmap, x0, x0); FAIL; |
| 435 | |
| 436 | // __NR_truncate 92 |
| 437 | GO(__NR_truncate, "2s 1m"); |
| 438 | SY(__NR_truncate, x0, x0); FAIL; |
| 439 | |
| 440 | // __NR_ftruncate 93 |
| 441 | GO(__NR_ftruncate, "2s 0m"); |
| 442 | SY(__NR_ftruncate, x0, x0); FAIL; |
| 443 | |
| 444 | // __NR_fchmod 94 |
| 445 | GO(__NR_fchmod, "2s 0m"); |
| 446 | SY(__NR_fchmod, x0-1, x0); FAIL; |
| 447 | |
| 448 | // __NR_fchown 95 |
| 449 | GO(__NR_fchown, "3s 0m"); |
| 450 | SY(__NR_fchown, x0, x0, x0); FAIL; |
| 451 | |
| 452 | // __NR_getpriority 96 |
| 453 | GO(__NR_getpriority, "2s 0m"); |
| 454 | SY(__NR_getpriority, x0-1, x0); FAIL; |
| 455 | |
| 456 | // __NR_setpriority 97 |
| 457 | GO(__NR_setpriority, "3s 0m"); |
| 458 | SY(__NR_setpriority, x0-1, x0, x0); FAIL; |
| 459 | |
| 460 | // __NR_profil arm64 doesn't implement profil. |
| 461 | //GO(__NR_profil, "ni"); |
| 462 | //SY(__NR_profil); FAIL; |
| 463 | |
| 464 | // __NR_statfs 99 |
| 465 | GO(__NR_statfs, "2s 2m"); |
| 466 | SY(__NR_statfs, x0, x0); FAIL; |
| 467 | |
| 468 | // __NR_fstatfs 100 |
| 469 | GO(__NR_fstatfs, "2s 1m"); |
| 470 | SY(__NR_fstatfs, x0, x0); FAIL; |
| 471 | |
| 472 | // __NR_ioperm arm64 doesn't implement ioperm |
| 473 | //GO(__NR_ioperm, "3s 0m"); |
| 474 | //SY(__NR_ioperm, x0, x0, x0); FAIL; |
| 475 | |
| 476 | // __NR_socketcall arm64 doesn't have socketcall. |
| 477 | //GO(__NR_socketcall, "XXX"); |
| 478 | // (XXX: need to do all sub-cases properly) |
| 479 | |
| 480 | // __NR_syslog 103 |
| 481 | GO(__NR_syslog, "3s 1m"); |
| 482 | SY(__NR_syslog, x0+2, x0, x0+1); FAIL; |
| 483 | |
| 484 | // __NR_setitimer 104 |
| 485 | GO(__NR_setitimer, "3s 2m"); |
| 486 | SY(__NR_setitimer, x0, x0+1, x0+1); FAIL; |
| 487 | |
| 488 | // __NR_getitimer 105 |
| 489 | GO(__NR_getitimer, "2s 1m"); |
| 490 | SY(__NR_getitimer, x0, x0, x0); FAIL; |
| 491 | |
| 492 | // __NR_stat arm64 doesn't implement stat |
| 493 | //GO(__NR_stat, "2s 2m"); |
| 494 | //SY(__NR_stat, x0, x0); FAIL; |
| 495 | |
| 496 | // __NR_lstat arm64 doesn't implement lstat |
| 497 | //GO(__NR_lstat, "2s 2m"); |
| 498 | //SY(__NR_lstat, x0, x0); FAIL; |
| 499 | |
| 500 | // __NR_fstat 108 |
| 501 | GO(__NR_fstat, "2s 1m"); |
| 502 | SY(__NR_fstat, x0, x0); FAIL; |
| 503 | |
| 504 | // __NR_olduname arm64 doesn't implement olduname |
| 505 | //GO(__NR_olduname, "n/a"); |
| 506 | // (obsolete, not handled by Valgrind) |
| 507 | |
| 508 | // __NR_iopl arm64 doesn't implement iopl |
| 509 | //GO(__NR_iopl, "1s 0m"); |
| 510 | //SY(__NR_iopl, x0+100); FAIL; |
| 511 | |
| 512 | // __NR_vhangup 111 |
| 513 | GO(__NR_vhangup, "0s 0m"); |
| 514 | SY(__NR_vhangup); SUCC_OR_FAIL; // Will succeed for superuser |
| 515 | |
| 516 | // __NR_idle arm64 doesn't implement idle. |
| 517 | //GO(__NR_idle, "ni"); |
| 518 | //SY(__NR_idle); FAIL; |
| 519 | |
| 520 | // __NR_vm86old arm64 doesn't implement vm86old |
| 521 | //GO(__NR_vm86old, "n/a"); |
| 522 | // (will probably never be handled by Valgrind) |
| 523 | |
| 524 | // __NR_wait4 114 |
| 525 | GO(__NR_wait4, "4s 2m"); |
| 526 | SY(__NR_wait4, x0, x0+1, x0, x0+1); FAIL; |
| 527 | |
| 528 | // __NR_swapoff 115 |
| 529 | GO(__NR_swapoff, "n/a"); |
| 530 | //SY(__NR_swapoff); // (Not yet handled by Valgrind) FAIL; |
| 531 | |
| 532 | // __NR_sysinfo 116 |
| 533 | GO(__NR_sysinfo, "1s 1m"); |
| 534 | SY(__NR_sysinfo, x0); FAIL; |
| 535 | |
| 536 | // __NR_ipc arm64 has separate msgctl semctl shmctl system calls |
| 537 | // XXX: This is simplistic -- need to do all the sub-cases properly. |
| 538 | // XXX: Also, should be 6 scalar errors, except glibc's syscall() doesn't |
| 539 | // use the 6th one! |
| 540 | //GO(__NR_ipc, "5s 0m"); |
| 541 | //SY(__NR_ipc, x0+4, x0, x0, x0, x0, x0); FAIL; |
| 542 | |
| 543 | // __NR_fsync 118 |
| 544 | GO(__NR_fsync, "1s 0m"); |
| 545 | SY(__NR_fsync, x0-1); FAIL; |
| 546 | |
| 547 | // __NR_sigreturn arm64 only has rt_sigreturn |
| 548 | //GO(__NR_sigreturn, "n/a"); |
| 549 | //SY(__NR_sigreturn); // (Not yet handled by Valgrind) FAIL; |
| 550 | |
| 551 | // __NR_clone 120 |
| 552 | #ifndef CLONE_PARENT_SETTID |
| 553 | #define CLONE_PARENT_SETTID 0x00100000 |
| 554 | #endif |
| 555 | GO(__NR_clone, "5s 3m"); |
| 556 | SY(__NR_clone, x0|CLONE_PARENT_SETTID|CLONE_SETTLS|CLONE_CHILD_SETTID|SIGCHLD, x0, x0, x0, x0); FAIL; |
| 557 | if (0 == res) { |
| 558 | SY(__NR_exit, 0); FAIL; |
| 559 | } |
| 560 | |
| 561 | // __NR_setdomainname 121 |
| 562 | GO(__NR_setdomainname, "n/a"); |
| 563 | //SY(__NR_setdomainname); // (Not yet handled by Valgrind) FAIL; |
| 564 | |
| 565 | // __NR_uname 122 |
| 566 | GO(__NR_uname, "1s 1m"); |
| 567 | SY(__NR_uname, x0); FAIL; |
| 568 | |
| 569 | // __NR_modify_ldt arm64 doesn't implement modify_ldt |
| 570 | //GO(__NR_modify_ldt, "3s 1m"); |
| 571 | //SY(__NR_modify_ldt, x0+1, x0, x0+1); FAILx(EINVAL); |
| 572 | |
| 573 | // __NR_adjtimex 124 |
| 574 | // XXX: need to do properly, but deref'ing NULL causing Valgrind to crash... |
| 575 | GO(__NR_adjtimex, "XXX"); |
| 576 | // SY(__NR_adjtimex, x0); FAIL; |
| 577 | |
| 578 | // __NR_mprotect 125 |
| 579 | GO(__NR_mprotect, "3s 0m"); |
| 580 | SY(__NR_mprotect, x0+1, x0, x0); FAILx(EINVAL); |
| 581 | |
| 582 | // __NR_sigprocmask arm64 has rt_sigprocmask |
| 583 | //GO(__NR_sigprocmask, "3s 2m"); |
| 584 | //SY(__NR_sigprocmask, x0, x0+&px[1], x0+&px[1]); SUCC; |
| 585 | |
| 586 | // __NR_create_module arm64 doesn't implement create_module. |
| 587 | //GO(__NR_create_module, "ni"); |
| 588 | //SY(__NR_create_module); FAIL; |
| 589 | |
| 590 | // __NR_init_module 128 |
| 591 | GO(__NR_init_module, "3s 2m"); |
| 592 | SY(__NR_init_module, x0, x0+1, x0); FAIL; |
| 593 | |
| 594 | // __NR_delete_module 129 |
| 595 | GO(__NR_delete_module, "n/a"); |
| 596 | //SY(__NR_delete_module); // (Not yet handled by Valgrind) FAIL; |
| 597 | |
| 598 | // __NR_get_kernel_syms arm64 doesn't implement get_kernel_syms |
| 599 | //GO(__NR_get_kernel_syms, "ni"); |
| 600 | //SY(__NR_get_kernel_syms); FAIL; |
| 601 | |
| 602 | // __NR_quotactl 131 |
| 603 | GO(__NR_quotactl, "4s 1m"); |
| 604 | SY(__NR_quotactl, x0, x0, x0, x0); FAIL; |
| 605 | |
| 606 | // __NR_getpgid 132 |
| 607 | GO(__NR_getpgid, "1s 0m"); |
| 608 | SY(__NR_getpgid, x0-1); FAIL; |
| 609 | |
| 610 | // __NR_fchdir 133 |
| 611 | GO(__NR_fchdir, "1s 0m"); |
| 612 | SY(__NR_fchdir, x0-1); FAIL; |
| 613 | |
| 614 | // __NR_bdflush arm64 doesn't implement bdflush |
| 615 | //GO(__NR_bdflush, "n/a"); |
| 616 | //SY(__NR_bdflush); // (Not yet handled by Valgrind) FAIL; |
| 617 | |
| 618 | // __NR_sysfs arm64 doesn't handle sysfs, use proc. |
| 619 | //GO(__NR_sysfs, "n/a"); |
| 620 | //SY(__NR_sysfs); // (Not yet handled by Valgrind) FAIL; |
| 621 | |
| 622 | // __NR_personality 136 |
| 623 | GO(__NR_personality, "1s 0m"); |
| 624 | SY(__NR_personality, x0+0xffffffff); SUCC; |
| 625 | |
| 626 | // __NR_afs_syscall arm64 doesn't implement afs_syscall |
| 627 | //GO(__NR_afs_syscall, "ni"); |
| 628 | //SY(__NR_afs_syscall); FAIL; |
| 629 | |
| 630 | // __NR_setfsuid 138 |
| 631 | GO(__NR_setfsuid, "1s 0m"); |
| 632 | SY(__NR_setfsuid, x0); SUCC; // This syscall has a stupid return value |
| 633 | |
| 634 | // __NR_setfsgid 139 |
| 635 | GO(__NR_setfsgid, "1s 0m"); |
| 636 | SY(__NR_setfsgid, x0); SUCC; // This syscall has a stupid return value |
| 637 | |
| 638 | // __NR__llseek arm64 doesn't implement _llseek |
| 639 | //GO(__NR__llseek, "5s 1m"); |
| 640 | //SY(__NR__llseek, x0, x0, x0, x0, x0); FAIL; |
| 641 | |
| 642 | // __NR_getdents arm64 only has getdents64 |
| 643 | //GO(__NR_getdents, "3s 1m"); |
| 644 | //SY(__NR_getdents, x0, x0, x0+1); FAIL; |
| 645 | |
| 646 | // __NR__newselect arm64 doesn't implement _newselect |
| 647 | //GO(__NR__newselect, "5s 4m"); |
| 648 | //SY(__NR__newselect, x0+8, x0+0xffffffff, x0+1, x0+1, x0+1); FAIL; |
| 649 | |
| 650 | // __NR_flock 143 |
| 651 | GO(__NR_flock, "2s 0m"); |
| 652 | SY(__NR_flock, x0, x0); FAIL; |
| 653 | |
| 654 | // __NR_msync 144 |
| 655 | GO(__NR_msync, "3s 1m"); |
| 656 | SY(__NR_msync, x0, x0+1, x0); FAIL; |
| 657 | |
| 658 | // __NR_readv 145 |
| 659 | GO(__NR_readv, "3s 1m"); |
| 660 | SY(__NR_readv, x0, x0, x0+1); FAIL; |
| 661 | |
| 662 | // __NR_writev 146 |
| 663 | GO(__NR_writev, "3s 1m"); |
| 664 | SY(__NR_writev, x0, x0, x0+1); FAIL; |
| 665 | |
| 666 | // __NR_getsid 147 |
| 667 | GO(__NR_getsid, "1s 0m"); |
| 668 | SY(__NR_getsid, x0-1); FAIL; |
| 669 | |
| 670 | // __NR_fdatasync 148 |
| 671 | GO(__NR_fdatasync, "1s 0m"); |
| 672 | SY(__NR_fdatasync, x0-1); FAIL; |
| 673 | |
| 674 | // __NR__sysctl arm64 doesn't implement sysctl, use /proc |
| 675 | //GO(__NR__sysctl, "1s 1m"); |
| 676 | //SY(__NR__sysctl, x0); FAIL; |
| 677 | |
| 678 | // __NR_mlock 150 |
| 679 | GO(__NR_mlock, "2s 0m"); |
| 680 | SY(__NR_mlock, x0, x0+1); FAIL; |
| 681 | |
| 682 | // __NR_munlock 151 |
| 683 | GO(__NR_munlock, "2s 0m"); |
| 684 | SY(__NR_munlock, x0, x0+1); FAIL; |
| 685 | |
| 686 | // __NR_mlockall 152 |
| 687 | GO(__NR_mlockall, "1s 0m"); |
| 688 | SY(__NR_mlockall, x0-1); FAIL; |
| 689 | |
| 690 | // __NR_munlockall 153 |
| 691 | GO(__NR_munlockall, "0s 0m"); |
| 692 | SY(__NR_munlockall); SUCC_OR_FAILx(EPERM); |
| 693 | |
| 694 | // __NR_sched_setparam 154 |
| 695 | GO(__NR_sched_setparam, "2s 1m"); |
| 696 | SY(__NR_sched_setparam, x0, x0); FAIL; |
| 697 | |
| 698 | // __NR_sched_getparam 155 |
| 699 | GO(__NR_sched_getparam, "2s 1m"); |
| 700 | SY(__NR_sched_getparam, x0, x0); FAIL; |
| 701 | |
| 702 | // __NR_sched_setscheduler 156 |
| 703 | GO(__NR_sched_setscheduler, "3s 1m"); |
| 704 | SY(__NR_sched_setscheduler, x0-1, x0, x0+1); FAIL; |
| 705 | |
| 706 | // __NR_sched_getscheduler 157 |
| 707 | GO(__NR_sched_getscheduler, "1s 0m"); |
| 708 | SY(__NR_sched_getscheduler, x0-1); FAIL; |
| 709 | |
| 710 | // __NR_sched_yield 158 |
| 711 | GO(__NR_sched_yield, "0s 0m"); |
| 712 | SY(__NR_sched_yield); SUCC; |
| 713 | |
| 714 | // __NR_sched_get_priority_max 159 |
| 715 | GO(__NR_sched_get_priority_max, "1s 0m"); |
| 716 | SY(__NR_sched_get_priority_max, x0-1); FAIL; |
| 717 | |
| 718 | // __NR_sched_get_priority_min 160 |
| 719 | GO(__NR_sched_get_priority_min, "1s 0m"); |
| 720 | SY(__NR_sched_get_priority_min, x0-1); FAIL; |
| 721 | |
| 722 | // __NR_sched_rr_get_interval 161 |
| 723 | GO(__NR_sched_rr_get_interval, "n/a"); |
| 724 | //SY(__NR_sched_rr_get_interval); // (Not yet handled by Valgrind) FAIL; |
| 725 | |
| 726 | // __NR_nanosleep 162 |
| 727 | GO(__NR_nanosleep, "2s 2m"); |
| 728 | SY(__NR_nanosleep, x0, x0+1); FAIL; |
| 729 | |
| 730 | // __NR_mremap 163 |
| 731 | GO(__NR_mremap, "5s 0m"); |
| 732 | SY(__NR_mremap, x0+1, x0, x0, x0+MREMAP_FIXED, x0); FAILx(EINVAL); |
| 733 | |
| 734 | // __NR_setresuid 164 |
| 735 | GO(__NR_setresuid, "3s 0m"); |
| 736 | SY(__NR_setresuid, x0, x0, x0); FAIL; |
| 737 | |
| 738 | // __NR_getresuid 165 |
| 739 | GO(__NR_getresuid, "3s 3m"); |
| 740 | SY(__NR_getresuid, x0, x0, x0); FAIL; |
| 741 | |
| 742 | // __NR_vm86 arm64 doesn't implement vm86 |
| 743 | //GO(__NR_vm86, "n/a"); |
| 744 | // (will probably never be handled by Valgrind) |
| 745 | |
| 746 | // __NR_query_module arm64 doesn't implement query_module |
| 747 | //GO(__NR_query_module, "ni"); |
| 748 | //SY(__NR_query_module); FAIL; |
| 749 | |
| 750 | // __NR_poll arm64 only has ppoll |
| 751 | //GO(__NR_poll, "3s 1m"); |
| 752 | //SY(__NR_poll, x0, x0+1, x0); FAIL; |
| 753 | |
| 754 | // __NR_nfsservctl 169 |
| 755 | GO(__NR_nfsservctl, "n/a"); |
| 756 | //SY(__NR_nfsservctl); // (Not yet handled by Valgrind) FAIL; |
| 757 | |
| 758 | // __NR_setresgid 170 |
| 759 | GO(__NR_setresgid, "3s 0m"); |
| 760 | SY(__NR_setresgid, x0, x0, x0); FAIL; |
| 761 | |
| 762 | // __NR_getresgid 171 |
| 763 | GO(__NR_getresgid, "3s 3m"); |
| 764 | SY(__NR_getresgid, x0, x0, x0); FAIL; |
| 765 | |
| 766 | // __NR_prctl 172 |
| 767 | GO(__NR_prctl, "5s 0m"); |
| 768 | SY(__NR_prctl, x0, x0, x0, x0, x0); FAIL; |
| 769 | |
| 770 | // __NR_rt_sigreturn 173 |
| 771 | GO(__NR_rt_sigreturn, "n/a"); |
| 772 | //SY(__NR_rt_sigreturn); // (Not yet handled by Valgrind) FAIL; |
| 773 | |
| 774 | // __NR_rt_sigaction 174 |
| 775 | GO(__NR_rt_sigaction, "4s 4m"); |
| 776 | SY(__NR_rt_sigaction, x0, x0+&px[2], x0+&px[2], x0); FAIL; |
| 777 | |
| 778 | // __NR_rt_sigprocmask 175 |
| 779 | GO(__NR_rt_sigprocmask, "4s 2m"); |
| 780 | SY(__NR_rt_sigprocmask, x0, x0+1, x0+1, x0); FAIL; |
| 781 | |
| 782 | // __NR_rt_sigpending 176 |
| 783 | GO(__NR_rt_sigpending, "2s 1m"); |
| 784 | SY(__NR_rt_sigpending, x0, x0+1); FAIL; |
| 785 | |
| 786 | // __NR_rt_sigtimedwait 177 |
| 787 | GO(__NR_rt_sigtimedwait, "4s 3m"); |
| 788 | SY(__NR_rt_sigtimedwait, x0+1, x0+1, x0+1, x0); FAIL; |
| 789 | |
| 790 | // __NR_rt_sigqueueinfo 178 |
| 791 | GO(__NR_rt_sigqueueinfo, "3s 1m"); |
| 792 | SY(__NR_rt_sigqueueinfo, x0, x0+1, x0); FAIL; |
| 793 | |
| 794 | // __NR_rt_sigsuspend 179 |
| 795 | GO(__NR_rt_sigsuspend, "ignore"); |
| 796 | // (I don't know how to test this...) |
| 797 | |
| 798 | // __NR_pread64 180 |
| 799 | GO(__NR_pread64, "5s 1m"); |
| 800 | SY(__NR_pread64, x0, x0, x0+1, x0, x0); FAIL; |
| 801 | |
| 802 | // __NR_pwrite64 181 |
| 803 | GO(__NR_pwrite64, "5s 1m"); |
| 804 | SY(__NR_pwrite64, x0, x0, x0+1, x0, x0); FAIL; |
| 805 | |
| 806 | // __NR_chown arm64 only has chownat |
| 807 | //GO(__NR_chown, "3s 1m"); |
| 808 | //SY(__NR_chown, x0, x0, x0); FAIL; |
| 809 | |
| 810 | // __NR_getcwd 183 |
| 811 | GO(__NR_getcwd, "2s 1m"); |
| 812 | SY(__NR_getcwd, x0, x0+1); FAIL; |
| 813 | |
| 814 | // __NR_capget 184 |
| 815 | GO(__NR_capget, "2s 2m"); |
| 816 | SY(__NR_capget, x0, x0+1); FAIL; |
| 817 | |
| 818 | // __NR_capset 185 |
| 819 | GO(__NR_capset, "2s 2m"); |
| 820 | SY(__NR_capset, x0, x0); FAIL; |
| 821 | |
| 822 | // __NR_sigaltstack 186 |
| 823 | { |
| 824 | struct our_sigaltstack { |
| 825 | void *ss_sp; |
| 826 | int ss_flags; |
| 827 | size_t ss_size; |
| 828 | } ss; |
| 829 | ss.ss_sp = NULL; |
| 830 | ss.ss_flags = 0; |
| 831 | ss.ss_size = 0; |
| 832 | VALGRIND_MAKE_MEM_NOACCESS(& ss, sizeof(struct our_sigaltstack)); |
| 833 | GO(__NR_sigaltstack, "2s 2m"); |
| 834 | SY(__NR_sigaltstack, x0+&ss, x0+&ss); SUCC; |
| 835 | } |
| 836 | |
| 837 | // __NR_sendfile 187 |
| 838 | GO(__NR_sendfile, "4s 1m"); |
| 839 | SY(__NR_sendfile, x0, x0, x0+1, x0); FAIL; |
| 840 | |
| 841 | // __NR_getpmsg arm64 doesn't implement getpmsg |
| 842 | // Could do 5s 4m with more effort, but I can't be bothered for this |
| 843 | // crappy non-standard syscall. |
| 844 | //GO(__NR_getpmsg, "5s 0m"); |
| 845 | //SY(__NR_getpmsg, x0, x0, x0, x0); FAIL; |
| 846 | |
| 847 | // __NR_putpmsg arm64 doesn't implement putpmsg |
| 848 | // Could do 5s 2m with more effort, but I can't be bothered for this |
| 849 | // crappy non-standard syscall. |
| 850 | //GO(__NR_putpmsg, "5s 0m"); |
| 851 | //SY(__NR_putpmsg, x0, x0, x0, x0, x0); FAIL; |
| 852 | |
| 853 | // __NR_vfork arm64 only has clone |
| 854 | //GO(__NR_vfork, "other"); |
| 855 | // (sse scalar_vfork.c) |
| 856 | |
| 857 | // __NR_ugetrlimit arm64 only has getrlimit and prlimit64 |
| 858 | //GO(__NR_ugetrlimit, "2s 1m"); |
| 859 | //SY(__NR_ugetrlimit, x0, x0); FAIL; |
| 860 | |
| 861 | // __NR_mmap2 arm64 doesn't implement mmap2 |
| 862 | //GO(__NR_mmap2, "6s 0m"); |
| 863 | //SY(__NR_mmap2, x0, x0, x0, x0, x0-1, x0); FAIL; |
| 864 | |
| 865 | // __NR_truncate64 arm64 just has truncate |
| 866 | //GO(__NR_truncate64, "3s 1m"); |
| 867 | //SY(__NR_truncate64, x0, x0, x0); FAIL; |
| 868 | |
| 869 | // __NR_ftruncate64 arm64 just has ftruncate |
| 870 | //GO(__NR_ftruncate64, "3s 0m"); |
| 871 | //SY(__NR_ftruncate64, x0, x0, x0); FAIL; |
| 872 | |
| 873 | // __NR_stat64 arm64 doesn't implement stat64 |
| 874 | //GO(__NR_stat64, "2s 2m"); |
| 875 | //SY(__NR_stat64, x0, x0); FAIL; |
| 876 | |
| 877 | // __NR_lstat64 196 |
| 878 | //GO(__NR_lstat64, "2s 2m"); |
| 879 | //SY(__NR_lstat64, x0, x0); FAIL; |
| 880 | |
| 881 | // __NR_fstat64 197 |
| 882 | //GO(__NR_fstat64, "2s 1m"); |
| 883 | //SY(__NR_fstat64, x0, x0); FAIL; |
| 884 | |
| 885 | // __NR_lchown32 198 |
| 886 | //GO(__NR_lchown32, "3s 1m"); |
| 887 | //SY(__NR_lchown32, x0, x0, x0); FAIL; |
| 888 | |
| 889 | // __NR_getuid32 199 |
| 890 | //GO(__NR_getuid32, "0s 0m"); |
| 891 | //SY(__NR_getuid32); SUCC; |
| 892 | |
| 893 | // __NR_getgid32 200 |
| 894 | //GO(__NR_getgid32, "0s 0m"); |
| 895 | //SY(__NR_getgid32); SUCC; |
| 896 | |
| 897 | // __NR_geteuid32 201 |
| 898 | //GO(__NR_geteuid32, "0s 0m"); |
| 899 | //SY(__NR_geteuid32); SUCC; |
| 900 | |
| 901 | // __NR_getegid32 202 |
| 902 | //GO(__NR_getegid32, "0s 0m"); |
| 903 | //SY(__NR_getegid32); SUCC; |
| 904 | |
| 905 | // __NR_setreuid32 203 |
| 906 | //GO(__NR_setreuid32, "2s 0m"); |
| 907 | //SY(__NR_setreuid32, x0, x0); FAIL; |
| 908 | |
| 909 | // __NR_setregid32 204 |
| 910 | //GO(__NR_setregid32, "2s 0m"); |
| 911 | //SY(__NR_setregid32, x0, x0); FAIL; |
| 912 | |
| 913 | // __NR_getgroups32 205 |
| 914 | //GO(__NR_getgroups32, "2s 1m"); |
| 915 | //SY(__NR_getgroups32, x0+1, x0+1); FAIL; |
| 916 | |
| 917 | // __NR_setgroups32 206 |
| 918 | //GO(__NR_setgroups32, "2s 1m"); |
| 919 | //SY(__NR_setgroups32, x0+1, x0+1); FAIL; |
| 920 | |
| 921 | // __NR_fchown32 207 |
| 922 | //GO(__NR_fchown32, "3s 0m"); |
| 923 | //SY(__NR_fchown32, x0, x0, x0); FAIL; |
| 924 | |
| 925 | // __NR_setresuid32 208 |
| 926 | //GO(__NR_setresuid32, "3s 0m"); |
| 927 | //SY(__NR_setresuid32, x0, x0, x0); FAIL; |
| 928 | |
| 929 | // __NR_getresuid32 209 |
| 930 | //GO(__NR_getresuid32, "3s 3m"); |
| 931 | //SY(__NR_getresuid32, x0, x0, x0); FAIL; |
| 932 | |
| 933 | // __NR_setresgid32 210 |
| 934 | //GO(__NR_setresgid32, "3s 0m"); |
| 935 | //SY(__NR_setresgid32, x0, x0, x0); FAIL; |
| 936 | |
| 937 | // __NR_getresgid32 211 |
| 938 | //GO(__NR_getresgid32, "3s 3m"); |
| 939 | //SY(__NR_getresgid32, x0, x0, x0); FAIL; |
| 940 | |
| 941 | // __NR_chown32 212 |
| 942 | //GO(__NR_chown32, "3s 1m"); |
| 943 | //SY(__NR_chown32, x0, x0, x0); FAIL; |
| 944 | |
| 945 | // __NR_setuid32 213 |
| 946 | //GO(__NR_setuid32, "1s 0m"); |
| 947 | //SY(__NR_setuid32, x0); FAIL; |
| 948 | |
| 949 | // __NR_setgid32 214 |
| 950 | //GO(__NR_setgid32, "1s 0m"); |
| 951 | //SY(__NR_setgid32, x0); FAIL; |
| 952 | |
| 953 | // __NR_setfsuid32 215 |
| 954 | //GO(__NR_setfsuid32, "1s 0m"); |
| 955 | //SY(__NR_setfsuid32, x0); SUCC; // This syscall has a stupid return value |
| 956 | |
| 957 | // __NR_setfsgid32 216 |
| 958 | //GO(__NR_setfsgid32, "1s 0m"); |
| 959 | //SY(__NR_setfsgid32, x0); SUCC; // This syscall has a stupid return value |
| 960 | |
| 961 | // __NR_pivot_root 217 |
| 962 | GO(__NR_pivot_root, "n/a"); |
| 963 | //SY(__NR_pivot_root); // (Not yet handled by Valgrind) FAIL; |
| 964 | |
| 965 | // __NR_mincore 218 |
| 966 | GO(__NR_mincore, "3s 1m"); |
| 967 | SY(__NR_mincore, x0, x0+40960, x0); FAIL; |
| 968 | |
| 969 | // __NR_madvise 219 |
| 970 | GO(__NR_madvise, "3s 0m"); |
| 971 | SY(__NR_madvise, x0, x0+1, x0); FAILx(ENOMEM); |
| 972 | |
| 973 | // __NR_getdents64 220 |
| 974 | GO(__NR_getdents64, "3s 1m"); |
| 975 | SY(__NR_getdents64, x0, x0, x0+1); FAIL; |
| 976 | |
| 977 | // __NR_fcntl64 221 |
| 978 | // As with sys_open(), we don't trigger errors for the 1st two args for |
| 979 | // the later ones. |
| 980 | // For F_GETFD the 3rd arg is ignored. |
| 981 | //GO(__NR_fcntl64, "(GETFD) 2s 0m"); |
| 982 | //SY(__NR_fcntl64, x0-1, x0+F_GETFD, x0); FAILx(EBADF); |
| 983 | |
| 984 | // For F_DUPFD the 3rd arg is 'arg' |
| 985 | //GO(__NR_fcntl64, "(DUPFD) 1s 0m"); |
| 986 | //SY(__NR_fcntl64, -1, F_DUPFD, x0); FAILx(EBADF); |
| 987 | |
| 988 | // For F_GETLK the 3rd arg is 'lock'. |
| 989 | // On x86, this fails w/EBADF. But on amd64 in 32-bit mode it fails |
| 990 | // w/EFAULT. |
| 991 | //GO(__NR_fcntl64, "(GETLK) 1s 0m"); |
| 992 | //SY(__NR_fcntl64, -1, +F_GETLK, x0); FAIL; //FAILx(EBADF); |
| 993 | |
| 994 | // 222 |
| 995 | //GO(222, "ni"); |
| 996 | //SY(222); FAIL; |
| 997 | |
| 998 | // 223 |
| 999 | //GO(223, "ni"); |
| 1000 | //SY(223); FAIL; |
| 1001 | |
| 1002 | // __NR_gettid 224 |
| 1003 | GO(__NR_gettid, "n/a"); |
| 1004 | //SY(__NR_gettid); // (Not yet handled by Valgrind) FAIL; |
| 1005 | |
| 1006 | // __NR_readahead 225 |
| 1007 | GO(__NR_readahead, "n/a"); |
| 1008 | //SY(__NR_readahead); // (Not yet handled by Valgrind) FAIL; |
| 1009 | |
| 1010 | // __NR_setxattr 226 |
| 1011 | GO(__NR_setxattr, "5s 3m"); |
| 1012 | SY(__NR_setxattr, x0, x0, x0, x0+1, x0); FAIL; |
| 1013 | |
| 1014 | // __NR_lsetxattr 227 |
| 1015 | GO(__NR_lsetxattr, "5s 3m"); |
| 1016 | SY(__NR_lsetxattr, x0, x0, x0, x0+1, x0); FAIL; |
| 1017 | |
| 1018 | // __NR_fsetxattr 228 |
| 1019 | GO(__NR_fsetxattr, "5s 2m"); |
| 1020 | SY(__NR_fsetxattr, x0, x0, x0, x0+1, x0); FAIL; |
| 1021 | |
| 1022 | // __NR_getxattr 229 |
| 1023 | GO(__NR_getxattr, "4s 3m"); |
| 1024 | SY(__NR_getxattr, x0, x0, x0, x0+1); FAIL; |
| 1025 | |
| 1026 | // __NR_lgetxattr 230 |
| 1027 | GO(__NR_lgetxattr, "4s 3m"); |
| 1028 | SY(__NR_lgetxattr, x0, x0, x0, x0+1); FAIL; |
| 1029 | |
| 1030 | // __NR_fgetxattr 231 |
| 1031 | GO(__NR_fgetxattr, "4s 2m"); |
| 1032 | SY(__NR_fgetxattr, x0, x0, x0, x0+1); FAIL; |
| 1033 | |
| 1034 | // __NR_listxattr 232 |
| 1035 | GO(__NR_listxattr, "3s 2m"); |
| 1036 | SY(__NR_listxattr, x0, x0, x0+1); FAIL; |
| 1037 | |
| 1038 | // __NR_llistxattr 233 |
| 1039 | GO(__NR_llistxattr, "3s 2m"); |
| 1040 | SY(__NR_llistxattr, x0, x0, x0+1); FAIL; |
| 1041 | |
| 1042 | // __NR_flistxattr 234 |
| 1043 | GO(__NR_flistxattr, "3s 1m"); |
| 1044 | SY(__NR_flistxattr, x0-1, x0, x0+1); FAIL; /* kernel returns EBADF, but both seem correct */ |
| 1045 | |
| 1046 | // __NR_removexattr 235 |
| 1047 | GO(__NR_removexattr, "2s 2m"); |
| 1048 | SY(__NR_removexattr, x0, x0); FAIL; |
| 1049 | |
| 1050 | // __NR_lremovexattr 236 |
| 1051 | GO(__NR_lremovexattr, "2s 2m"); |
| 1052 | SY(__NR_lremovexattr, x0, x0); FAIL; |
| 1053 | |
| 1054 | // __NR_fremovexattr 237 |
| 1055 | GO(__NR_fremovexattr, "2s 1m"); |
| 1056 | SY(__NR_fremovexattr, x0, x0); FAIL; |
| 1057 | |
| 1058 | // __NR_tkill 238 |
| 1059 | GO(__NR_tkill, "n/a"); |
| 1060 | //SY(__NR_tkill); // (Not yet handled by Valgrind) FAIL; |
| 1061 | |
| 1062 | // __NR_sendfile64 239 |
| 1063 | //GO(__NR_sendfile64, "4s 1m"); |
| 1064 | //SY(__NR_sendfile64, x0, x0, x0+1, x0); FAIL; |
| 1065 | |
| 1066 | // __NR_futex 240 |
| 1067 | #ifndef FUTEX_WAIT |
| 1068 | #define FUTEX_WAIT 0 |
| 1069 | #endif |
| 1070 | // XXX: again, glibc not doing 6th arg means we have only 5s errors |
| 1071 | GO(__NR_futex, "5s 2m"); |
| 1072 | SY(__NR_futex, x0+FUTEX_WAIT, x0, x0, x0+1, x0, x0); FAIL; |
| 1073 | |
| 1074 | // __NR_sched_setaffinity 241 |
| 1075 | GO(__NR_sched_setaffinity, "3s 1m"); |
| 1076 | SY(__NR_sched_setaffinity, x0, x0+1, x0); FAIL; |
| 1077 | |
| 1078 | // __NR_sched_getaffinity 242 |
| 1079 | GO(__NR_sched_getaffinity, "3s 1m"); |
| 1080 | SY(__NR_sched_getaffinity, x0, x0+1, x0); FAIL; |
| 1081 | |
| 1082 | // __NR_set_thread_area 243 |
| 1083 | //GO(__NR_set_thread_area, "1s 1m"); |
| 1084 | //SY(__NR_set_thread_area, x0); FAILx(EFAULT); |
| 1085 | |
| 1086 | // __NR_get_thread_area 244 |
| 1087 | //GO(__NR_get_thread_area, "1s 1m"); |
| 1088 | //SY(__NR_get_thread_area, x0); FAILx(EFAULT); |
| 1089 | |
| 1090 | // __NR_io_setup 245 |
| 1091 | GO(__NR_io_setup, "2s 1m"); |
| 1092 | SY(__NR_io_setup, x0, x0); FAIL; |
| 1093 | |
| 1094 | // __NR_io_destroy 246 |
| 1095 | { |
| 1096 | // jump through hoops to prevent the PRE(io_destroy) wrapper crashing. |
| 1097 | struct fake_aio_ring { |
| 1098 | unsigned id; /* kernel internal index number */ |
| 1099 | unsigned nr; /* number of io_events */ |
| 1100 | // There are more fields in the real aio_ring, but the 'nr' field is |
| 1101 | // the only one used by the PRE() wrapper. |
| 1102 | } ring = { 0, 0 }; |
| 1103 | struct fake_aio_ring* ringptr = ˚ |
| 1104 | GO(__NR_io_destroy, "1s 0m"); |
| 1105 | SY(__NR_io_destroy, x0+&ringptr); FAIL; |
| 1106 | } |
| 1107 | |
| 1108 | // __NR_io_getevents 247 |
| 1109 | GO(__NR_io_getevents, "5s 2m"); |
| 1110 | SY(__NR_io_getevents, x0, x0, x0+1, x0, x0+1); FAIL; |
| 1111 | |
| 1112 | // __NR_io_submit 248 |
| 1113 | GO(__NR_io_submit, "3s 1m"); |
| 1114 | SY(__NR_io_submit, x0, x0+1, x0); FAIL; |
| 1115 | |
| 1116 | // __NR_io_cancel 249 |
| 1117 | GO(__NR_io_cancel, "3s 2m"); |
| 1118 | SY(__NR_io_cancel, x0, x0, x0); FAIL; |
| 1119 | |
| 1120 | // __NR_fadvise64 250 |
| 1121 | GO(__NR_fadvise64, "n/a"); |
| 1122 | //SY(__NR_fadvise64); // (Not yet handled by Valgrind) FAIL; |
| 1123 | |
| 1124 | // 251 |
| 1125 | //GO(251, "ni"); |
| 1126 | //SY(251); FAIL; |
| 1127 | |
| 1128 | // __NR_exit_group 252 |
| 1129 | GO(__NR_exit_group, "other"); |
| 1130 | // (see scalar_exit_group.c) |
| 1131 | |
| 1132 | // __NR_lookup_dcookie 253 |
| 1133 | GO(__NR_lookup_dcookie, "4s 1m"); |
| 1134 | SY(__NR_lookup_dcookie, x0, x0, x0, x0+1); FAIL; |
| 1135 | |
| 1136 | // __NR_epoll_create arm64 only has epoll_create1 |
| 1137 | //GO(__NR_epoll_create, "1s 0m"); |
| 1138 | //SY(__NR_epoll_create, x0); SUCC_OR_FAIL; |
| 1139 | |
| 1140 | // __NR_epoll_ctl 255 |
| 1141 | GO(__NR_epoll_ctl, "4s 1m"); |
| 1142 | SY(__NR_epoll_ctl, x0, x0, x0, x0); FAIL; |
| 1143 | |
| 1144 | // __NR_epoll_wait arm64 only has epoll_pwait |
| 1145 | //GO(__NR_epoll_wait, "4s 1m"); |
| 1146 | //SY(__NR_epoll_wait, x0, x0, x0+1, x0); FAIL; |
| 1147 | |
| 1148 | // __NR_remap_file_pages 257 |
| 1149 | GO(__NR_remap_file_pages, "n/a"); |
| 1150 | //SY(__NR_remap_file_pages); // (Not yet handled by Valgrind) FAIL; |
| 1151 | |
| 1152 | // __NR_set_tid_address 258 |
| 1153 | GO(__NR_set_tid_address, "1s 0m"); |
| 1154 | SY(__NR_set_tid_address, x0); SUCC_OR_FAILx(ENOSYS); |
| 1155 | |
| 1156 | // __NR_timer_create 259 |
| 1157 | GO(__NR_timer_create, "3s 2m"); |
| 1158 | SY(__NR_timer_create, x0, x0+1, x0); FAIL; |
| 1159 | |
| 1160 | // __NR_timer_settime (__NR_timer_create+1) |
| 1161 | GO(__NR_timer_settime, "4s 2m"); |
| 1162 | SY(__NR_timer_settime, x0, x0, x0, x0+1); FAIL; |
| 1163 | |
| 1164 | // __NR_timer_gettime (__NR_timer_create+2) |
| 1165 | GO(__NR_timer_gettime, "2s 1m"); |
| 1166 | SY(__NR_timer_gettime, x0, x0); FAIL; |
| 1167 | |
| 1168 | // __NR_timer_getoverrun (__NR_timer_create+3) |
| 1169 | GO(__NR_timer_getoverrun, "1s 0m"); |
| 1170 | SY(__NR_timer_getoverrun, x0); FAIL; |
| 1171 | |
| 1172 | // __NR_timer_delete (__NR_timer_create+4) |
| 1173 | GO(__NR_timer_delete, "1s 0m"); |
| 1174 | SY(__NR_timer_delete, x0); FAIL; |
| 1175 | |
| 1176 | // __NR_clock_settime (__NR_timer_create+5) |
| 1177 | GO(__NR_clock_settime, "2s 1m"); |
| 1178 | SY(__NR_clock_settime, x0, x0); FAIL; FAIL; |
| 1179 | |
| 1180 | // __NR_clock_gettime (__NR_timer_create+6) |
| 1181 | GO(__NR_clock_gettime, "2s 1m"); |
| 1182 | SY(__NR_clock_gettime, x0, x0); FAIL; |
| 1183 | |
| 1184 | // __NR_clock_getres (__NR_timer_create+7) |
| 1185 | GO(__NR_clock_getres, "2s 1m"); |
| 1186 | SY(__NR_clock_getres, x0+1, x0+1); FAIL; FAIL; |
| 1187 | |
| 1188 | // __NR_clock_nanosleep (__NR_timer_create+8) |
| 1189 | GO(__NR_clock_nanosleep, "n/a"); |
| 1190 | //SY(__NR_clock_nanosleep); // (Not yet handled by Valgrind) FAIL; |
| 1191 | |
| 1192 | // __NR_statfs64 268 |
| 1193 | //GO(__NR_statfs64, "3s 2m"); |
| 1194 | //SY(__NR_statfs64, x0, x0+1, x0); FAIL; |
| 1195 | |
| 1196 | // __NR_fstatfs64 269 |
| 1197 | //GO(__NR_fstatfs64, "3s 1m"); |
| 1198 | //SY(__NR_fstatfs64, x0, x0+1, x0); FAIL; |
| 1199 | |
| 1200 | // __NR_tgkill 270 |
| 1201 | GO(__NR_tgkill, "n/a"); |
| 1202 | //SY(__NR_tgkill); // (Not yet handled by Valgrind) FAIL; |
| 1203 | |
| 1204 | // __NR_utimes arm64 only has utimensat |
| 1205 | //GO(__NR_utimes, "2s 2m"); |
| 1206 | //SY(__NR_utimes, x0, x0+1); FAIL; |
| 1207 | |
| 1208 | // __NR_fadvise64_64 272 |
| 1209 | //GO(__NR_fadvise64_64, "n/a"); |
| 1210 | //SY(__NR_fadvise64_64); // (Not yet handled by Valgrind) FAIL; |
| 1211 | |
| 1212 | // __NR_vserver 273 |
| 1213 | //GO(__NR_vserver, "ni"); |
| 1214 | //SY(__NR_vserver); FAIL; |
| 1215 | |
| 1216 | // __NR_mbind 274 |
| 1217 | GO(__NR_mbind, "n/a"); |
| 1218 | //SY(__NR_mbind); // (Not yet handled by Valgrind) FAIL; |
| 1219 | |
| 1220 | // __NR_get_mempolicy 275 |
| 1221 | GO(__NR_get_mempolicy, "n/a"); |
| 1222 | //SY(__NR_get_mempolicy); // (Not yet handled by Valgrind) FAIL; |
| 1223 | |
| 1224 | // __NR_set_mempolicy 276 |
| 1225 | GO(__NR_set_mempolicy, "n/a"); |
| 1226 | //SY(__NR_set_mempolicy); // (Not yet handled by Valgrind) FAIL; |
| 1227 | |
| 1228 | // __NR_mq_open 277 |
| 1229 | GO(__NR_mq_open, "4s 3m"); |
| 1230 | SY(__NR_mq_open, x0, x0+O_CREAT, x0, x0+1); FAIL; |
| 1231 | |
| 1232 | // __NR_mq_unlink (__NR_mq_open+1) |
| 1233 | GO(__NR_mq_unlink, "1s 1m"); |
| 1234 | SY(__NR_mq_unlink, x0); FAIL; |
| 1235 | |
| 1236 | // __NR_mq_timedsend (__NR_mq_open+2) |
| 1237 | GO(__NR_mq_timedsend, "5s 2m"); |
| 1238 | SY(__NR_mq_timedsend, x0, x0, x0+1, x0, x0+1); FAIL; |
| 1239 | |
| 1240 | // __NR_mq_timedreceive (__NR_mq_open+3) |
| 1241 | GO(__NR_mq_timedreceive, "5s 3m"); |
| 1242 | SY(__NR_mq_timedreceive, x0, x0, x0+1, x0+1, x0+1); FAIL; |
| 1243 | |
| 1244 | // __NR_mq_notify (__NR_mq_open+4) |
| 1245 | GO(__NR_mq_notify, "2s 1m"); |
| 1246 | SY(__NR_mq_notify, x0, x0+1); FAIL; |
| 1247 | |
| 1248 | // __NR_mq_getsetattr (__NR_mq_open+5) |
| 1249 | GO(__NR_mq_getsetattr, "3s 2m"); |
| 1250 | SY(__NR_mq_getsetattr, x0, x0+1, x0+1); FAIL; |
| 1251 | |
| 1252 | // __NR_kexec_load 283 |
| 1253 | GO(__NR_kexec_load, "ni"); |
| 1254 | SY(__NR_kexec_load); FAIL; |
| 1255 | |
| 1256 | // __NR_epoll_create1 329 |
| 1257 | GO(__NR_epoll_create1, "1s 0m"); |
| 1258 | SY(__NR_epoll_create1, x0); SUCC_OR_FAIL; |
| 1259 | |
| 1260 | // __NR_process_vm_readv 347 |
| 1261 | GO(__NR_process_vm_readv, "6s 2m"); |
| 1262 | SY(__NR_process_vm_readv, x0, x0, x0+1, x0, x0+1, x0); FAIL; |
| 1263 | |
| 1264 | // __NR_process_vm_writev 348 |
| 1265 | GO(__NR_process_vm_writev, "6s 2m"); |
| 1266 | SY(__NR_process_vm_writev, x0, x0, x0+1, x0, x0+1, x0); FAIL; |
| 1267 | |
| 1268 | // no such syscall... |
| 1269 | GO(9999, "1e"); |
| 1270 | SY(9999); FAIL; |
| 1271 | |
| 1272 | // __NR_exit 1 |
| 1273 | GO(__NR_exit, "1s 0m"); |
| 1274 | SY(__NR_exit, x0); FAIL; |
| 1275 | |
| 1276 | assert(0); |
| 1277 | } |
| 1278 | |