3 #include "../../memcheck.h"
8 #include <linux/mman.h> // MREMAP_FIXED
10 // Here we are trying to trigger every syscall error (scalar errors and
11 // memory errors) for every syscall. We do this by passing a lot of bogus
12 // arguments, mostly 0 and 1 (often it's 1 because NULL ptr args often aren't
13 // checked for memory errors, or in order to have a non-zero length used
14 // with some buffer). So most of the syscalls don't actually succeed and do
17 // Occasionally we have to be careful not to cause Valgrind to seg fault in
18 // its pre-syscall wrappers; it does so because it can't know in general
19 // when memory is unaddressable, and so tries to dereference it when doing
20 // PRE_MEM_READ/PRE_MEM_WRITE calls. (Note that Memcheck will
21 // always issue an error message immediately before these seg faults occur).
23 // The output has numbers like "3s 2m" for each syscall. "s" is short for
24 // "scalar", ie. the argument itself is undefined. "m" is short for "memory",
25 // ie. the argument points to memory which is unaddressable.
29 // uninitialised, but we know px[0] is 0x0
30 long* px
= malloc(sizeof(long));
34 // All __NR_xxx numbers are taken from x86
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;
41 GO(__NR_exit
, "below");
45 GO(__NR_fork
, "other");
46 // (sse scalar_fork.c)
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
);
54 GO(__NR_write
, "3s 1m");
55 SY(__NR_write
, x0
, x0
, x0
+1); FAIL
;
58 GO(__NR_open
, "(2-args) 2s 1m");
59 SY(__NR_open
, x0
, x0
); FAIL
;
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
64 GO(__NR_open
, "(3-args) 1s 0m");
65 SY(__NR_open
, "scalar.c", O_CREAT
|O_EXCL
, x0
); FAIL
;
68 GO(__NR_close
, "1s 0m");
69 SY(__NR_close
, x0
-1); FAIL
;
72 GO(__NR_waitpid
, "3s 1m");
73 SY(__NR_waitpid
, x0
, x0
+1, x0
); FAIL
;
76 GO(__NR_creat
, "2s 1m");
77 SY(__NR_creat
, x0
, x0
); FAIL
;
80 GO(__NR_link
, "2s 2m");
81 SY(__NR_link
, x0
, x0
); FAIL
;
84 GO(__NR_unlink
, "1s 1m");
85 SY(__NR_unlink
, x0
); FAIL
;
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
;
94 GO(__NR_chdir
, "1s 1m");
95 SY(__NR_chdir
, x0
); FAIL
;
98 GO(__NR_time
, "1s 1m");
99 SY(__NR_time
, x0
+1); FAIL
;
102 GO(__NR_mknod
, "3s 1m");
103 SY(__NR_mknod
, x0
, x0
, x0
); FAIL
;
106 GO(__NR_chmod
, "2s 1m");
107 SY(__NR_chmod
, x0
, x0
); FAIL
;
110 GO(__NR_lchown
, "n/a");
111 //SY(__NR_lchown); // (Not yet handled by Valgrind) FAIL;
114 GO(__NR_break
, "ni");
115 SY(__NR_break
); FAIL
;
118 GO(__NR_oldstat
, "n/a");
119 // (obsolete, not handled by Valgrind)
122 GO(__NR_lseek
, "3s 0m");
123 SY(__NR_lseek
, x0
-1, x0
, x0
); FAILx(EBADF
);
126 GO(__NR_getpid
, "0s 0m");
127 SY(__NR_getpid
); SUCC
;
130 GO(__NR_mount
, "5s 3m");
131 SY(__NR_mount
, x0
, x0
, x0
, x0
, x0
); FAIL
;
134 GO(__NR_umount
, "1s 1m");
135 SY(__NR_umount
, x0
); FAIL
;
138 GO(__NR_setuid
, "1s 0m");
139 SY(__NR_setuid
, x0
); FAIL
;
142 GO(__NR_getuid
, "0s 0m");
143 SY(__NR_getuid
); SUCC
;
146 GO(__NR_stime
, "n/a");
147 //SY(__NR_stime); // (Not yet handled by Valgrind) FAIL;
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
;
155 GO(__NR_alarm
, "1s 0m");
156 SY(__NR_alarm
, x0
); SUCC
;
159 GO(__NR_oldfstat
, "n/a");
160 // (obsolete, not handled by Valgrind)
163 GO(__NR_pause
, "ignore");
164 // (hard to test, and no args so not much to be gained -- don't bother)
167 GO(__NR_utime
, "2s 2m");
168 SY(__NR_utime
, x0
, x0
+1); FAIL
;
179 GO(__NR_access
, "2s 1m");
180 SY(__NR_access
, x0
, x0
); FAIL
;
183 GO(__NR_nice
, "1s 0m");
184 SY(__NR_nice
, x0
); SUCC
;
187 GO(__NR_ftime
, "ni");
188 SY(__NR_ftime
); FAIL
;
191 GO(__NR_sync
, "0s 0m");
195 GO(__NR_kill
, "2s 0m");
196 SY(__NR_kill
, x0
, x0
); SUCC
;
199 GO(__NR_rename
, "2s 2m");
200 SY(__NR_rename
, x0
, x0
); FAIL
;
203 GO(__NR_mkdir
, "2s 1m");
204 SY(__NR_mkdir
, x0
, x0
); FAIL
;
207 GO(__NR_rmdir
, "1s 1m");
208 SY(__NR_rmdir
, x0
); FAIL
;
211 GO(__NR_dup
, "1s 0m");
212 SY(__NR_dup
, x0
-1); FAIL
;
215 GO(__NR_pipe
, "1s 1m");
216 SY(__NR_pipe
, x0
); FAIL
;
219 GO(__NR_times
, "1s 1m");
220 SY(__NR_times
, x0
+1); FAIL
;
227 GO(__NR_brk
, "1s 0m");
228 SY(__NR_brk
, x0
); SUCC
;
231 GO(__NR_setgid
, "1s 0m");
232 SY(__NR_setgid
, x0
); FAIL
;
235 GO(__NR_getgid
, "0s 0m");
236 SY(__NR_getgid
); SUCC
;
239 GO(__NR_signal
, "n/a");
240 //SY(__NR_signal); // (Not yet handled by Valgrind) FAIL;
243 GO(__NR_geteuid
, "0s 0m");
244 SY(__NR_geteuid
); SUCC
;
247 GO(__NR_getegid
, "0s 0m");
248 SY(__NR_getegid
); SUCC
;
251 GO(__NR_acct
, "1s 1m");
252 SY(__NR_acct
, x0
); FAIL
;
255 GO(__NR_umount2
, "2s 1m");
256 SY(__NR_umount2
, x0
, x0
); FAIL
;
263 #include <asm/ioctls.h>
264 GO(__NR_ioctl
, "3s 1m");
265 SY(__NR_ioctl
, x0
, x0
+TCSETS
, x0
); FAIL
;
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
);
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
);
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);
290 GO(__NR_setpgid
, "2s 0m");
291 SY(__NR_setpgid
, x0
, x0
-1); FAIL
;
294 GO(__NR_ulimit
, "ni");
295 SY(__NR_ulimit
); FAIL
;
297 // __NR_oldolduname 59
298 GO(__NR_oldolduname
, "n/a");
299 // (obsolete, not handled by Valgrind)
302 GO(__NR_umask
, "1s 0m");
303 SY(__NR_umask
, x0
+022); SUCC
;
306 GO(__NR_chroot
, "1s 1m");
307 SY(__NR_chroot
, x0
); FAIL
;
310 GO(__NR_ustat
, "n/a");
311 // (deprecated, not handled by Valgrind)
314 GO(__NR_dup2
, "2s 0m");
315 SY(__NR_dup2
, x0
-1, x0
); FAIL
;
318 GO(__NR_getppid
, "0s 0m");
319 SY(__NR_getppid
); SUCC
;
322 GO(__NR_getpgrp
, "0s 0m");
323 SY(__NR_getpgrp
); SUCC
;
326 GO(__NR_setsid
, "0s 0m");
327 SY(__NR_setsid
); SUCC_OR_FAIL
;
330 GO(__NR_sigaction
, "3s 4m");
331 SY(__NR_sigaction
, x0
, x0
+&px
[1], x0
+&px
[1]); FAIL
;
333 // __NR_sgetmask 68 sys_sgetmask()
334 GO(__NR_sgetmask
, "n/a");
335 //SY(__NR_sgetmask); // (Not yet handled by Valgrind) FAIL;
338 GO(__NR_ssetmask
, "n/a");
339 //SY(__NR_ssetmask); // (Not yet handled by Valgrind) FAIL;
342 GO(__NR_setreuid
, "2s 0m");
343 SY(__NR_setreuid
, x0
, x0
); FAIL
;
346 GO(__NR_setregid
, "2s 0m");
347 SY(__NR_setregid
, x0
, x0
); FAIL
;
349 // __NR_sigsuspend 72
350 // XXX: how do you use this function?
351 GO(__NR_sigsuspend
, "ignore");
352 // (I don't know how to test this...)
354 // __NR_sigpending 73
355 GO(__NR_sigpending
, "1s 1m");
356 SY(__NR_sigpending
, x0
); FAIL
;
358 // __NR_sethostname 74
359 GO(__NR_sethostname
, "n/a");
360 //SY(__NR_sethostname); // (Not yet handled by Valgrind) FAIL;
363 GO(__NR_setrlimit
, "2s 1m");
364 SY(__NR_setrlimit
, x0
, x0
); FAIL
;
367 GO(__NR_getrlimit
, "2s 1m");
368 SY(__NR_getrlimit
, x0
, x0
); FAIL
;
371 GO(__NR_getrusage
, "2s 1m");
372 SY(__NR_getrusage
, x0
, x0
); FAIL
;
374 // __NR_gettimeofday 78
375 GO(__NR_gettimeofday
, "2s 2m");
376 SY(__NR_gettimeofday
, x0
+1, x0
+1); FAIL
;
378 // __NR_settimeofday 79
379 GO(__NR_settimeofday
, "2s 2m");
380 SY(__NR_settimeofday
, x0
+1, x0
+1); FAIL
;
383 GO(__NR_getgroups
, "2s 1m");
384 SY(__NR_getgroups
, x0
+1, x0
+1); FAIL
;
387 GO(__NR_setgroups
, "2s 1m");
388 SY(__NR_setgroups
, x0
+1, x0
+1); FAIL
;
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
;
398 GO(__NR_symlink
, "2s 2m");
399 SY(__NR_symlink
, x0
, x0
); FAIL
;
402 GO(__NR_oldlstat
, "n/a");
403 // (obsolete, not handled by Valgrind)
406 GO(__NR_readlink
, "3s 2m");
407 SY(__NR_readlink
, x0
+1, x0
+1, x0
+1); FAIL
;
410 GO(__NR_uselib
, "n/a");
411 //SY(__NR_uselib); // (Not yet handled by Valgrind) FAIL;
414 GO(__NR_swapon
, "n/a");
415 //SY(__NR_swapon); // (Not yet handled by Valgrind) FAIL;
418 GO(__NR_reboot
, "n/a");
419 //SY(__NR_reboot); // (Not yet handled by Valgrind) FAIL;
422 GO(__NR_readdir
, "n/a");
423 // (superseded, not handled by Valgrind)
427 long args
[6] = { x0
, x0
, x0
, x0
, x0
-1, x0
};
428 GO(__NR_mmap
, "1s 1m");
429 SY(__NR_mmap
, args
+x0
); FAIL
;
433 GO(__NR_munmap
, "2s 0m");
434 SY(__NR_munmap
, x0
, x0
); FAIL
;
437 GO(__NR_truncate
, "2s 1m");
438 SY(__NR_truncate
, x0
, x0
); FAIL
;
441 GO(__NR_ftruncate
, "2s 0m");
442 SY(__NR_ftruncate
, x0
, x0
); FAIL
;
445 GO(__NR_fchmod
, "2s 0m");
446 SY(__NR_fchmod
, x0
-1, x0
); FAIL
;
449 GO(__NR_fchown
, "3s 0m");
450 SY(__NR_fchown
, x0
, x0
, x0
); FAIL
;
452 // __NR_getpriority 96
453 GO(__NR_getpriority
, "2s 0m");
454 SY(__NR_getpriority
, x0
-1, x0
); FAIL
;
456 // __NR_setpriority 97
457 GO(__NR_setpriority
, "3s 0m");
458 SY(__NR_setpriority
, x0
-1, x0
, x0
); FAIL
;
461 GO(__NR_profil
, "ni");
462 SY(__NR_profil
); FAIL
;
465 GO(__NR_statfs
, "2s 2m");
466 SY(__NR_statfs
, x0
, x0
); FAIL
;
469 GO(__NR_fstatfs
, "2s 1m");
470 SY(__NR_fstatfs
, x0
, x0
); FAIL
;
473 GO(__NR_ioperm
, "3s 0m");
474 SY(__NR_ioperm
, x0
, x0
, x0
); FAIL
;
476 // __NR_socketcall 102
477 GO(__NR_socketcall
, "XXX");
478 // (XXX: need to do all sub-cases properly)
481 GO(__NR_syslog
, "3s 1m");
482 SY(__NR_syslog
, x0
+2, x0
, x0
+1); FAIL
;
484 // __NR_setitimer 104
485 GO(__NR_setitimer
, "3s 2m");
486 SY(__NR_setitimer
, x0
, x0
+1, x0
+1); FAIL
;
488 // __NR_getitimer 105
489 GO(__NR_getitimer
, "2s 1m");
490 SY(__NR_getitimer
, x0
, x0
, x0
); FAIL
;
493 GO(__NR_stat
, "2s 2m");
494 SY(__NR_stat
, x0
, x0
); FAIL
;
497 GO(__NR_lstat
, "2s 2m");
498 SY(__NR_lstat
, x0
, x0
); FAIL
;
501 GO(__NR_fstat
, "2s 1m");
502 SY(__NR_fstat
, x0
, x0
); FAIL
;
505 GO(__NR_olduname
, "n/a");
506 // (obsolete, not handled by Valgrind)
509 GO(__NR_iopl
, "1s 0m");
510 SY(__NR_iopl
, x0
+100); FAIL
;
513 GO(__NR_vhangup
, "0s 0m");
514 SY(__NR_vhangup
); SUCC_OR_FAIL
; // Will succeed for superuser
521 GO(__NR_vm86old
, "n/a");
522 // (will probably never be handled by Valgrind)
525 GO(__NR_wait4
, "4s 2m");
526 SY(__NR_wait4
, x0
, x0
+1, x0
, x0
+1); FAIL
;
529 GO(__NR_swapoff
, "n/a");
530 //SY(__NR_swapoff); // (Not yet handled by Valgrind) FAIL;
533 GO(__NR_sysinfo
, "1s 1m");
534 SY(__NR_sysinfo
, x0
); FAIL
;
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
540 GO(__NR_ipc
, "5s 0m");
541 SY(__NR_ipc
, x0
+4, x0
, x0
, x0
, x0
, x0
); FAIL
;
544 GO(__NR_fsync
, "1s 0m");
545 SY(__NR_fsync
, x0
-1); FAIL
;
547 // __NR_sigreturn 119
548 GO(__NR_sigreturn
, "n/a");
549 //SY(__NR_sigreturn); // (Not yet handled by Valgrind) FAIL;
552 #ifndef CLONE_PARENT_SETTID
553 #define CLONE_PARENT_SETTID 0x00100000
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
;
558 SY(__NR_exit
, 0); FAIL
;
561 // __NR_setdomainname 121
562 GO(__NR_setdomainname
, "n/a");
563 //SY(__NR_setdomainname); // (Not yet handled by Valgrind) FAIL;
566 GO(__NR_uname
, "1s 1m");
567 SY(__NR_uname
, x0
); FAIL
;
569 // __NR_modify_ldt 123
570 GO(__NR_modify_ldt
, "3s 1m");
571 SY(__NR_modify_ldt
, x0
+1, x0
, x0
+1); FAILx(EINVAL
);
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;
579 GO(__NR_mprotect
, "3s 0m");
580 SY(__NR_mprotect
, x0
+1, x0
, x0
); FAILx(EINVAL
);
582 // __NR_sigprocmask 126
583 GO(__NR_sigprocmask
, "3s 2m");
584 SY(__NR_sigprocmask
, x0
, x0
+&px
[1], x0
+&px
[1]); SUCC
;
586 // __NR_create_module 127
587 GO(__NR_create_module
, "ni");
588 SY(__NR_create_module
); FAIL
;
590 // __NR_init_module 128
591 GO(__NR_init_module
, "3s 2m");
592 SY(__NR_init_module
, x0
, x0
+1, x0
); FAIL
;
594 // __NR_delete_module 129
595 GO(__NR_delete_module
, "n/a");
596 //SY(__NR_delete_module); // (Not yet handled by Valgrind) FAIL;
598 // __NR_get_kernel_syms 130
599 GO(__NR_get_kernel_syms
, "ni");
600 SY(__NR_get_kernel_syms
); FAIL
;
603 GO(__NR_quotactl
, "4s 1m");
604 SY(__NR_quotactl
, x0
, x0
, x0
, x0
); FAIL
;
607 GO(__NR_getpgid
, "1s 0m");
608 SY(__NR_getpgid
, x0
-1); FAIL
;
611 GO(__NR_fchdir
, "1s 0m");
612 SY(__NR_fchdir
, x0
-1); FAIL
;
615 GO(__NR_bdflush
, "n/a");
616 //SY(__NR_bdflush); // (Not yet handled by Valgrind) FAIL;
619 GO(__NR_sysfs
, "n/a");
620 //SY(__NR_sysfs); // (Not yet handled by Valgrind) FAIL;
622 // __NR_personality 136
623 GO(__NR_personality
, "1s 0m");
624 SY(__NR_personality
, x0
+0xffffffff); SUCC
;
626 // __NR_afs_syscall 137
627 GO(__NR_afs_syscall
, "ni");
628 SY(__NR_afs_syscall
); FAIL
;
631 GO(__NR_setfsuid
, "1s 0m");
632 SY(__NR_setfsuid
, x0
); SUCC
; // This syscall has a stupid return value
635 GO(__NR_setfsgid
, "1s 0m");
636 SY(__NR_setfsgid
, x0
); SUCC
; // This syscall has a stupid return value
639 GO(__NR__llseek
, "5s 1m");
640 SY(__NR__llseek
, x0
, x0
, x0
, x0
, x0
); FAIL
;
643 GO(__NR_getdents
, "3s 1m");
644 SY(__NR_getdents
, x0
, x0
, x0
+1); FAIL
;
646 // __NR__newselect 142
647 GO(__NR__newselect
, "5s 4m");
648 SY(__NR__newselect
, x0
+8, x0
+0xffffffff, x0
+1, x0
+1, x0
+1); FAIL
;
651 GO(__NR_flock
, "2s 0m");
652 SY(__NR_flock
, x0
, x0
); FAIL
;
655 GO(__NR_msync
, "3s 1m");
656 SY(__NR_msync
, x0
, x0
+1, x0
); FAIL
;
659 GO(__NR_readv
, "3s 1m");
660 SY(__NR_readv
, x0
, x0
, x0
+1); FAIL
;
663 GO(__NR_writev
, "3s 1m");
664 SY(__NR_writev
, x0
, x0
, x0
+1); FAIL
;
667 GO(__NR_getsid
, "1s 0m");
668 SY(__NR_getsid
, x0
-1); FAIL
;
670 // __NR_fdatasync 148
671 GO(__NR_fdatasync
, "1s 0m");
672 SY(__NR_fdatasync
, x0
-1); FAIL
;
675 GO(__NR__sysctl
, "1s 1m");
676 SY(__NR__sysctl
, x0
); FAIL
;
679 GO(__NR_mlock
, "2s 0m");
680 SY(__NR_mlock
, x0
, x0
+1); FAIL
;
683 GO(__NR_munlock
, "2s 0m");
684 SY(__NR_munlock
, x0
, x0
+1); FAIL
;
687 GO(__NR_mlockall
, "1s 0m");
688 SY(__NR_mlockall
, x0
-1); FAIL
;
690 // __NR_munlockall 153
691 GO(__NR_munlockall
, "0s 0m");
692 SY(__NR_munlockall
); SUCC_OR_FAILx(EPERM
);
694 // __NR_sched_setparam 154
695 GO(__NR_sched_setparam
, "2s 1m");
696 SY(__NR_sched_setparam
, x0
, x0
); FAIL
;
698 // __NR_sched_getparam 155
699 GO(__NR_sched_getparam
, "2s 1m");
700 SY(__NR_sched_getparam
, x0
, x0
); FAIL
;
702 // __NR_sched_setscheduler 156
703 GO(__NR_sched_setscheduler
, "3s 1m");
704 SY(__NR_sched_setscheduler
, x0
-1, x0
, x0
+1); FAIL
;
706 // __NR_sched_getscheduler 157
707 GO(__NR_sched_getscheduler
, "1s 0m");
708 SY(__NR_sched_getscheduler
, x0
-1); FAIL
;
710 // __NR_sched_yield 158
711 GO(__NR_sched_yield
, "0s 0m");
712 SY(__NR_sched_yield
); SUCC
;
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
;
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
;
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;
726 // __NR_nanosleep 162
727 GO(__NR_nanosleep
, "2s 2m");
728 SY(__NR_nanosleep
, x0
, x0
+1); FAIL
;
731 GO(__NR_mremap
, "5s 0m");
732 SY(__NR_mremap
, x0
+1, x0
, x0
, x0
+MREMAP_FIXED
, x0
); FAILx(EINVAL
);
734 // __NR_setresuid 164
735 GO(__NR_setresuid
, "3s 0m");
736 SY(__NR_setresuid
, x0
, x0
, x0
); FAIL
;
738 // __NR_getresuid 165
739 GO(__NR_getresuid
, "3s 3m");
740 SY(__NR_getresuid
, x0
, x0
, x0
); FAIL
;
743 GO(__NR_vm86
, "n/a");
744 // (will probably never be handled by Valgrind)
746 // __NR_query_module 167
747 GO(__NR_query_module
, "ni");
748 SY(__NR_query_module
); FAIL
;
751 GO(__NR_poll
, "3s 1m");
752 SY(__NR_poll
, x0
, x0
+1, x0
); FAIL
;
754 // __NR_nfsservctl 169
755 GO(__NR_nfsservctl
, "n/a");
756 //SY(__NR_nfsservctl); // (Not yet handled by Valgrind) FAIL;
758 // __NR_setresgid 170
759 GO(__NR_setresgid
, "3s 0m");
760 SY(__NR_setresgid
, x0
, x0
, x0
); FAIL
;
762 // __NR_getresgid 171
763 GO(__NR_getresgid
, "3s 3m");
764 SY(__NR_getresgid
, x0
, x0
, x0
); FAIL
;
767 GO(__NR_prctl
, "5s 0m");
768 SY(__NR_prctl
, x0
, x0
, x0
, x0
, x0
); FAIL
;
770 // __NR_rt_sigreturn 173
771 GO(__NR_rt_sigreturn
, "n/a");
772 //SY(__NR_rt_sigreturn); // (Not yet handled by Valgrind) FAIL;
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
;
778 // __NR_rt_sigprocmask 175
779 GO(__NR_rt_sigprocmask
, "4s 2m");
780 SY(__NR_rt_sigprocmask
, x0
, x0
+1, x0
+1, x0
); FAIL
;
782 // __NR_rt_sigpending 176
783 GO(__NR_rt_sigpending
, "2s 1m");
784 SY(__NR_rt_sigpending
, x0
, x0
+1); FAIL
;
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
;
790 // __NR_rt_sigqueueinfo 178
791 GO(__NR_rt_sigqueueinfo
, "3s 1m");
792 SY(__NR_rt_sigqueueinfo
, x0
, x0
+1, x0
); FAIL
;
794 // __NR_rt_sigsuspend 179
795 GO(__NR_rt_sigsuspend
, "ignore");
796 // (I don't know how to test this...)
799 GO(__NR_pread64
, "5s 1m");
800 SY(__NR_pread64
, x0
, x0
, x0
+1, x0
, x0
); FAIL
;
803 GO(__NR_pwrite64
, "5s 1m");
804 SY(__NR_pwrite64
, x0
, x0
, x0
+1, x0
, x0
); FAIL
;
807 GO(__NR_chown
, "3s 1m");
808 SY(__NR_chown
, x0
, x0
, x0
); FAIL
;
811 GO(__NR_getcwd
, "2s 1m");
812 SY(__NR_getcwd
, x0
, x0
+1); FAIL
;
815 GO(__NR_capget
, "2s 2m");
816 SY(__NR_capget
, x0
, x0
+1); FAIL
;
819 GO(__NR_capset
, "2s 2m");
820 SY(__NR_capset
, x0
, x0
); FAIL
;
822 // __NR_sigaltstack 186
824 struct our_sigaltstack
{
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
;
838 GO(__NR_sendfile
, "4s 1m");
839 SY(__NR_sendfile
, x0
, x0
, x0
+1, x0
); FAIL
;
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
;
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
;
854 GO(__NR_vfork
, "other");
855 // (sse scalar_vfork.c)
857 // __NR_ugetrlimit 191
858 GO(__NR_ugetrlimit
, "2s 1m");
859 SY(__NR_ugetrlimit
, x0
, x0
); FAIL
;
862 GO(__NR_mmap2
, "6s 0m");
863 SY(__NR_mmap2
, x0
, x0
, x0
, x0
, x0
-1, x0
); FAIL
;
865 // __NR_truncate64 193
866 GO(__NR_truncate64
, "3s 1m");
867 SY(__NR_truncate64
, x0
, x0
, x0
); FAIL
;
869 // __NR_ftruncate64 194
870 GO(__NR_ftruncate64
, "3s 0m");
871 SY(__NR_ftruncate64
, x0
, x0
, x0
); FAIL
;
874 GO(__NR_stat64
, "2s 2m");
875 SY(__NR_stat64
, x0
, x0
); FAIL
;
878 GO(__NR_lstat64
, "2s 2m");
879 SY(__NR_lstat64
, x0
, x0
); FAIL
;
882 GO(__NR_fstat64
, "2s 1m");
883 SY(__NR_fstat64
, x0
, x0
); FAIL
;
886 GO(__NR_lchown32
, "3s 1m");
887 SY(__NR_lchown32
, x0
, x0
, x0
); FAIL
;
890 GO(__NR_getuid32
, "0s 0m");
891 SY(__NR_getuid32
); SUCC
;
894 GO(__NR_getgid32
, "0s 0m");
895 SY(__NR_getgid32
); SUCC
;
897 // __NR_geteuid32 201
898 GO(__NR_geteuid32
, "0s 0m");
899 SY(__NR_geteuid32
); SUCC
;
901 // __NR_getegid32 202
902 GO(__NR_getegid32
, "0s 0m");
903 SY(__NR_getegid32
); SUCC
;
905 // __NR_setreuid32 203
906 GO(__NR_setreuid32
, "2s 0m");
907 SY(__NR_setreuid32
, x0
, x0
); FAIL
;
909 // __NR_setregid32 204
910 GO(__NR_setregid32
, "2s 0m");
911 SY(__NR_setregid32
, x0
, x0
); FAIL
;
913 // __NR_getgroups32 205
914 GO(__NR_getgroups32
, "2s 1m");
915 SY(__NR_getgroups32
, x0
+1, x0
+1); FAIL
;
917 // __NR_setgroups32 206
918 GO(__NR_setgroups32
, "2s 1m");
919 SY(__NR_setgroups32
, x0
+1, x0
+1); FAIL
;
922 GO(__NR_fchown32
, "3s 0m");
923 SY(__NR_fchown32
, x0
, x0
, x0
); FAIL
;
925 // __NR_setresuid32 208
926 GO(__NR_setresuid32
, "3s 0m");
927 SY(__NR_setresuid32
, x0
, x0
, x0
); FAIL
;
929 // __NR_getresuid32 209
930 GO(__NR_getresuid32
, "3s 3m");
931 SY(__NR_getresuid32
, x0
, x0
, x0
); FAIL
;
933 // __NR_setresgid32 210
934 GO(__NR_setresgid32
, "3s 0m");
935 SY(__NR_setresgid32
, x0
, x0
, x0
); FAIL
;
937 // __NR_getresgid32 211
938 GO(__NR_getresgid32
, "3s 3m");
939 SY(__NR_getresgid32
, x0
, x0
, x0
); FAIL
;
942 GO(__NR_chown32
, "3s 1m");
943 SY(__NR_chown32
, x0
, x0
, x0
); FAIL
;
946 GO(__NR_setuid32
, "1s 0m");
947 SY(__NR_setuid32
, x0
); FAIL
;
950 GO(__NR_setgid32
, "1s 0m");
951 SY(__NR_setgid32
, x0
); FAIL
;
953 // __NR_setfsuid32 215
954 GO(__NR_setfsuid32
, "1s 0m");
955 SY(__NR_setfsuid32
, x0
); SUCC
; // This syscall has a stupid return value
957 // __NR_setfsgid32 216
958 GO(__NR_setfsgid32
, "1s 0m");
959 SY(__NR_setfsgid32
, x0
); SUCC
; // This syscall has a stupid return value
961 // __NR_pivot_root 217
962 GO(__NR_pivot_root
, "n/a");
963 //SY(__NR_pivot_root); // (Not yet handled by Valgrind) FAIL;
966 GO(__NR_mincore
, "3s 1m");
967 SY(__NR_mincore
, x0
, x0
+40960, x0
); FAIL
;
970 GO(__NR_madvise
, "3s 0m");
971 SY(__NR_madvise
, x0
, x0
+1, x0
); FAILx(ENOMEM
);
973 // __NR_getdents64 220
974 GO(__NR_getdents64
, "3s 1m");
975 SY(__NR_getdents64
, x0
, x0
, x0
+1); FAIL
;
978 // As with sys_open(), we don't trigger errors for the 1st two args for
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
);
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
);
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
991 GO(__NR_fcntl64
, "(GETLK) 1s 0m");
992 SY(__NR_fcntl64
, -1, +F_GETLK
, x0
); FAIL
; //FAILx(EBADF);
1003 GO(__NR_gettid
, "n/a");
1004 //SY(__NR_gettid); // (Not yet handled by Valgrind) FAIL;
1006 // __NR_readahead 225
1007 GO(__NR_readahead
, "n/a");
1008 //SY(__NR_readahead); // (Not yet handled by Valgrind) FAIL;
1010 // __NR_setxattr 226
1011 GO(__NR_setxattr
, "5s 3m");
1012 SY(__NR_setxattr
, x0
, x0
, x0
, x0
+1, x0
); FAIL
;
1014 // __NR_lsetxattr 227
1015 GO(__NR_lsetxattr
, "5s 3m");
1016 SY(__NR_lsetxattr
, x0
, x0
, x0
, x0
+1, x0
); FAIL
;
1018 // __NR_fsetxattr 228
1019 GO(__NR_fsetxattr
, "5s 2m");
1020 SY(__NR_fsetxattr
, x0
, x0
, x0
, x0
+1, x0
); FAIL
;
1022 // __NR_getxattr 229
1023 GO(__NR_getxattr
, "4s 3m");
1024 SY(__NR_getxattr
, x0
, x0
, x0
, x0
+1); FAIL
;
1026 // __NR_lgetxattr 230
1027 GO(__NR_lgetxattr
, "4s 3m");
1028 SY(__NR_lgetxattr
, x0
, x0
, x0
, x0
+1); FAIL
;
1030 // __NR_fgetxattr 231
1031 GO(__NR_fgetxattr
, "4s 2m");
1032 SY(__NR_fgetxattr
, x0
, x0
, x0
, x0
+1); FAIL
;
1034 // __NR_listxattr 232
1035 GO(__NR_listxattr
, "3s 2m");
1036 SY(__NR_listxattr
, x0
, x0
, x0
+1); FAIL
;
1038 // __NR_llistxattr 233
1039 GO(__NR_llistxattr
, "3s 2m");
1040 SY(__NR_llistxattr
, x0
, x0
, x0
+1); FAIL
;
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 */
1046 // __NR_removexattr 235
1047 GO(__NR_removexattr
, "2s 2m");
1048 SY(__NR_removexattr
, x0
, x0
); FAIL
;
1050 // __NR_lremovexattr 236
1051 GO(__NR_lremovexattr
, "2s 2m");
1052 SY(__NR_lremovexattr
, x0
, x0
); FAIL
;
1054 // __NR_fremovexattr 237
1055 GO(__NR_fremovexattr
, "2s 1m");
1056 SY(__NR_fremovexattr
, x0
, x0
); FAIL
;
1059 GO(__NR_tkill
, "n/a");
1060 //SY(__NR_tkill); // (Not yet handled by Valgrind) FAIL;
1062 // __NR_sendfile64 239
1063 GO(__NR_sendfile64
, "4s 1m");
1064 SY(__NR_sendfile64
, x0
, x0
, x0
+1, x0
); FAIL
;
1068 #define FUTEX_WAIT 0
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
;
1074 // __NR_sched_setaffinity 241
1075 GO(__NR_sched_setaffinity
, "3s 1m");
1076 SY(__NR_sched_setaffinity
, x0
, x0
+1, x0
); FAIL
;
1078 // __NR_sched_getaffinity 242
1079 GO(__NR_sched_getaffinity
, "3s 1m");
1080 SY(__NR_sched_getaffinity
, x0
, x0
+1, x0
); FAIL
;
1082 // __NR_set_thread_area 243
1083 GO(__NR_set_thread_area
, "1s 1m");
1084 SY(__NR_set_thread_area
, x0
); FAILx(EFAULT
);
1086 // __NR_get_thread_area 244
1087 GO(__NR_get_thread_area
, "1s 1m");
1088 SY(__NR_get_thread_area
, x0
); FAILx(EFAULT
);
1090 // __NR_io_setup 245
1091 GO(__NR_io_setup
, "2s 1m");
1092 SY(__NR_io_setup
, x0
, x0
); FAIL
;
1094 // __NR_io_destroy 246
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.
1103 struct fake_aio_ring
* ringptr
= &ring
;
1104 GO(__NR_io_destroy
, "1s 0m");
1105 SY(__NR_io_destroy
, x0
+&ringptr
); FAIL
;
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
;
1112 // __NR_io_submit 248
1113 GO(__NR_io_submit
, "3s 1m");
1114 SY(__NR_io_submit
, x0
, x0
+1, x0
); FAIL
;
1116 // __NR_io_cancel 249
1117 GO(__NR_io_cancel
, "3s 2m");
1118 SY(__NR_io_cancel
, x0
, x0
, x0
); FAIL
;
1120 // __NR_fadvise64 250
1121 GO(__NR_fadvise64
, "n/a");
1122 //SY(__NR_fadvise64); // (Not yet handled by Valgrind) FAIL;
1128 // __NR_exit_group 252
1129 GO(__NR_exit_group
, "other");
1130 // (see scalar_exit_group.c)
1132 // __NR_lookup_dcookie 253
1133 GO(__NR_lookup_dcookie
, "4s 1m");
1134 SY(__NR_lookup_dcookie
, x0
, x0
, x0
, x0
+1); FAIL
;
1136 // __NR_epoll_create 254
1137 GO(__NR_epoll_create
, "1s 0m");
1138 SY(__NR_epoll_create
, x0
); SUCC_OR_FAIL
;
1140 // __NR_epoll_ctl 255
1141 GO(__NR_epoll_ctl
, "4s 1m");
1142 SY(__NR_epoll_ctl
, x0
, x0
, x0
, x0
); FAIL
;
1144 // __NR_epoll_wait 256
1145 GO(__NR_epoll_wait
, "4s 1m");
1146 SY(__NR_epoll_wait
, x0
, x0
, x0
+1, x0
); FAIL
;
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;
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
);
1156 // __NR_timer_create 259
1157 GO(__NR_timer_create
, "3s 2m");
1158 SY(__NR_timer_create
, x0
, x0
+1, x0
); FAIL
;
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
;
1164 // __NR_timer_gettime (__NR_timer_create+2)
1165 GO(__NR_timer_gettime
, "2s 1m");
1166 SY(__NR_timer_gettime
, x0
, x0
); FAIL
;
1168 // __NR_timer_getoverrun (__NR_timer_create+3)
1169 GO(__NR_timer_getoverrun
, "1s 0m");
1170 SY(__NR_timer_getoverrun
, x0
); FAIL
;
1172 // __NR_timer_delete (__NR_timer_create+4)
1173 GO(__NR_timer_delete
, "1s 0m");
1174 SY(__NR_timer_delete
, x0
); FAIL
;
1176 // __NR_clock_settime (__NR_timer_create+5)
1177 GO(__NR_clock_settime
, "2s 1m");
1178 SY(__NR_clock_settime
, x0
, x0
); FAIL
; FAIL
;
1180 // __NR_clock_gettime (__NR_timer_create+6)
1181 GO(__NR_clock_gettime
, "2s 1m");
1182 SY(__NR_clock_gettime
, x0
, x0
); FAIL
;
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
;
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;
1192 // __NR_statfs64 268
1193 GO(__NR_statfs64
, "3s 2m");
1194 SY(__NR_statfs64
, x0
, x0
+1, x0
); FAIL
;
1196 // __NR_fstatfs64 269
1197 GO(__NR_fstatfs64
, "3s 1m");
1198 SY(__NR_fstatfs64
, x0
, x0
+1, x0
); FAIL
;
1201 GO(__NR_tgkill
, "n/a");
1202 //SY(__NR_tgkill); // (Not yet handled by Valgrind) FAIL;
1205 GO(__NR_utimes
, "2s 2m");
1206 SY(__NR_utimes
, x0
, x0
+1); FAIL
;
1208 // __NR_fadvise64_64 272
1209 GO(__NR_fadvise64_64
, "n/a");
1210 //SY(__NR_fadvise64_64); // (Not yet handled by Valgrind) FAIL;
1213 GO(__NR_vserver
, "ni");
1214 SY(__NR_vserver
); FAIL
;
1217 GO(__NR_mbind
, "n/a");
1218 //SY(__NR_mbind); // (Not yet handled by Valgrind) FAIL;
1220 // __NR_get_mempolicy 275
1221 GO(__NR_get_mempolicy
, "n/a");
1222 //SY(__NR_get_mempolicy); // (Not yet handled by Valgrind) FAIL;
1224 // __NR_set_mempolicy 276
1225 GO(__NR_set_mempolicy
, "n/a");
1226 //SY(__NR_set_mempolicy); // (Not yet handled by Valgrind) FAIL;
1229 GO(__NR_mq_open
, "4s 3m");
1230 SY(__NR_mq_open
, x0
, x0
+O_CREAT
, x0
, x0
+1); FAIL
;
1232 // __NR_mq_unlink (__NR_mq_open+1)
1233 GO(__NR_mq_unlink
, "1s 1m");
1234 SY(__NR_mq_unlink
, x0
); FAIL
;
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
;
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
;
1244 // __NR_mq_notify (__NR_mq_open+4)
1245 GO(__NR_mq_notify
, "2s 1m");
1246 SY(__NR_mq_notify
, x0
, x0
+1); FAIL
;
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
;
1252 // __NR_sys_kexec_load 283
1253 GO(__NR_sys_kexec_load
, "ni");
1254 SY(__NR_sys_kexec_load
); FAIL
;
1256 // __NR_epoll_create1 329
1257 GO(__NR_epoll_create1
, "1s 0m");
1258 SY(__NR_epoll_create1
, x0
); SUCC_OR_FAIL
;
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
;
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
;
1268 // no such syscall...
1273 GO(__NR_exit
, "1s 0m");
1274 SY(__NR_exit
, x0
); FAIL
;