3 #include "../../memcheck.h"
8 #include <sys/mman.h> // MREMAP_FIXED
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
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).
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.
30 // uninitialised, but we know px[0] is 0x0
31 long* px
= malloc(sizeof(long));
35 // All __NR_xxx numbers are taken from x86
37 // __NR_restart_syscall 0 // XXX: not yet handled, perhaps should be...
38 GO(__NR_restart_syscall
, "n/a");
39 //SY(__NR_restart_syscall); // (Not yet handled by Valgrind) FAIL;
42 GO(__NR_exit
, "below");
46 GO(__NR_fork
, "other");
47 // (sse scalar_fork.c)
50 // Nb: here we are also getting an error from the syscall arg itself.
51 GO(__NR_read
, "1+3s 1m");
52 SY(__NR_read
+x0
, x0
, x0
, x0
+1); FAILx(EFAULT
);
55 GO(__NR_write
, "3s 1m");
56 SY(__NR_write
, x0
, x0
, x0
+1); FAIL
;
59 GO(__NR_open
, "(2-args) 2s 1m");
60 SY(__NR_open
, x0
, x0
); FAIL
;
62 // Only 1s 0m errors -- the other 2s 1m have been checked in the previous
63 // open test, and if we test them they may be commoned up but they also
65 GO(__NR_open
, "(3-args) 1s 0m");
66 SY(__NR_open
, "scalar.c", O_CREAT
|O_EXCL
, x0
); FAIL
;
69 GO(__NR_close
, "1s 0m");
70 SY(__NR_close
, x0
-1); FAIL
;
73 GO(__NR_waitpid
, "3s 1m");
74 SY(__NR_waitpid
, x0
, x0
+1, x0
); FAIL
;
77 GO(__NR_creat
, "2s 1m");
78 SY(__NR_creat
, x0
, x0
); FAIL
;
81 GO(__NR_link
, "2s 2m");
82 SY(__NR_link
, x0
, x0
); FAIL
;
85 GO(__NR_unlink
, "1s 1m");
86 SY(__NR_unlink
, x0
); FAIL
;
89 GO(__NR_execve
, "3s 1m");
90 SY(__NR_execve
, x0
+ 1, x0
+ 1, x0
); FAIL
;
92 GO(__NR_execve
, "3s 1m");
93 SY(__NR_execve
, x0
+ 1, x0
, x0
+ 1); FAIL
;
95 char *argv_envp
[] = {(char *) (x0
+ 1), NULL
};
96 GO(__NR_execve
, "4s 2m");
97 SY(__NR_execve
, x0
+ 1, x0
+ argv_envp
, x0
); FAIL
;
98 char *argv_ok
[] = {"frob", NULL
};
99 GO(__NR_execve
, "4s 2m");
100 SY(__NR_execve
, x0
+ 1, x0
+ argv_ok
, x0
+ argv_envp
); FAIL
;
103 GO(__NR_chdir
, "1s 1m");
104 SY(__NR_chdir
, x0
); FAIL
;
107 GO(__NR_time
, "1s 1m");
108 SY(__NR_time
, x0
+1); FAIL
;
111 GO(__NR_mknod
, "3s 1m");
112 SY(__NR_mknod
, x0
, x0
, x0
); FAIL
;
115 GO(__NR_chmod
, "2s 1m");
116 SY(__NR_chmod
, x0
, x0
); FAIL
;
119 GO(__NR_lchown
, "n/a");
120 //SY(__NR_lchown); // (Not yet handled by Valgrind) FAIL;
123 GO(__NR_break
, "ni");
124 SY(__NR_break
); FAIL
;
127 GO(__NR_oldstat
, "n/a");
128 // (obsolete, not handled by Valgrind)
131 GO(__NR_lseek
, "3s 0m");
132 SY(__NR_lseek
, x0
-1, x0
, x0
); FAILx(EBADF
);
135 GO(__NR_getpid
, "0s 0m");
136 SY(__NR_getpid
); SUCC
;
139 GO(__NR_mount
, "5s 3m");
140 SY(__NR_mount
, x0
, x0
, x0
, x0
, x0
); FAIL
;
143 GO(__NR_umount
, "1s 1m");
144 SY(__NR_umount
, x0
); FAIL
;
147 GO(__NR_setuid
, "1s 0m");
148 SY(__NR_setuid
, x0
-1); FAIL
;
151 GO(__NR_getuid
, "0s 0m");
152 SY(__NR_getuid
); SUCC
;
155 GO(__NR_stime
, "n/a");
156 //SY(__NR_stime); // (Not yet handled by Valgrind) FAIL;
159 // XXX: memory pointed to be arg3 goes unchecked... otherwise would be 2m
160 GO(__NR_ptrace
, "4s 1m");
161 SY(__NR_ptrace
, x0
+PTRACE_GETREGS
, x0
, x0
, x0
); FAIL
;
164 GO(__NR_alarm
, "1s 0m");
165 SY(__NR_alarm
, x0
); SUCC
;
168 GO(__NR_oldfstat
, "n/a");
169 // (obsolete, not handled by Valgrind)
172 GO(__NR_pause
, "ignore");
173 // (hard to test, and no args so not much to be gained -- don't bother)
176 GO(__NR_utime
, "2s 2m");
177 SY(__NR_utime
, x0
, x0
+1); FAIL
;
188 GO(__NR_access
, "2s 1m");
189 SY(__NR_access
, x0
, x0
); FAIL
;
192 GO(__NR_nice
, "1s 0m");
193 SY(__NR_nice
, x0
); SUCC
;
196 GO(__NR_ftime
, "ni");
197 SY(__NR_ftime
); FAIL
;
200 GO(__NR_sync
, "0s 0m");
204 GO(__NR_kill
, "2s 0m");
205 SY(__NR_kill
, x0
, x0
); SUCC
;
208 GO(__NR_rename
, "2s 2m");
209 SY(__NR_rename
, x0
, x0
); FAIL
;
212 GO(__NR_mkdir
, "2s 1m");
213 SY(__NR_mkdir
, x0
, x0
); FAIL
;
216 GO(__NR_rmdir
, "1s 1m");
217 SY(__NR_rmdir
, x0
); FAIL
;
220 GO(__NR_dup
, "1s 0m");
221 SY(__NR_dup
, x0
-1); FAIL
;
224 GO(__NR_pipe
, "1s 1m");
225 SY(__NR_pipe
, x0
); FAIL
;
228 GO(__NR_times
, "1s 1m");
229 SY(__NR_times
, x0
+1); FAIL
;
236 GO(__NR_brk
, "1s 0m");
237 SY(__NR_brk
, x0
); SUCC
;
240 GO(__NR_setgid
, "1s 0m");
241 SY(__NR_setgid
, x0
-1); FAIL
;
244 GO(__NR_getgid
, "0s 0m");
245 SY(__NR_getgid
); SUCC
;
248 GO(__NR_signal
, "n/a");
249 //SY(__NR_signal); // (Not yet handled by Valgrind) FAIL;
252 GO(__NR_geteuid
, "0s 0m");
253 SY(__NR_geteuid
); SUCC
;
256 GO(__NR_getegid
, "0s 0m");
257 SY(__NR_getegid
); SUCC
;
260 GO(__NR_acct
, "1s 1m");
261 SY(__NR_acct
, x0
-1); FAIL
;
264 GO(__NR_umount2
, "2s 1m");
265 SY(__NR_umount2
, x0
, x0
); FAIL
;
272 #include <sys/ioctl.h>
273 GO(__NR_ioctl
, "3s 1m");
274 SY(__NR_ioctl
, x0
, x0
+TCSETS
, x0
); FAIL
;
277 // As with sys_open(), the 'fd' error is suppressed for the later ones.
278 // For F_GETFD the 3rd arg is ignored
279 GO(__NR_fcntl
, "(GETFD) 2s 0m");
280 SY(__NR_fcntl
, x0
-1, x0
+F_GETFD
, x0
); FAILx(EBADF
);
282 // For F_DUPFD the 3rd arg is 'arg'. We don't check the 1st two args
283 // because any errors may or may not be commoned up with the ones from
284 // the previous fcntl call.
285 GO(__NR_fcntl
, "(DUPFD) 1s 0m");
286 SY(__NR_fcntl
, -1, F_DUPFD
, x0
); FAILx(EBADF
);
288 // For F_GETLK the 3rd arg is 'lock'. On x86, this fails w/EBADF. But
289 // on amd64 in 32-bit mode it fails w/EFAULT. We don't check the 1st two
290 // args for the reason given above.
291 GO(__NR_fcntl
, "(GETLK) 1s 5m");
292 SY(__NR_fcntl
, -1, F_GETLK
, x0
); FAIL
; //FAILx(EBADF);
299 GO(__NR_setpgid
, "2s 0m");
300 SY(__NR_setpgid
, x0
, x0
-1); FAIL
;
303 GO(__NR_ulimit
, "ni");
304 SY(__NR_ulimit
); FAIL
;
306 // __NR_oldolduname 59
307 GO(__NR_oldolduname
, "n/a");
308 // (obsolete, not handled by Valgrind)
311 GO(__NR_umask
, "1s 0m");
312 SY(__NR_umask
, x0
+022); SUCC
;
315 GO(__NR_chroot
, "1s 1m");
316 SY(__NR_chroot
, x0
); FAIL
;
319 GO(__NR_ustat
, "n/a");
320 // (deprecated, not handled by Valgrind)
323 GO(__NR_dup2
, "2s 0m");
324 SY(__NR_dup2
, x0
-1, x0
); FAIL
;
327 GO(__NR_getppid
, "0s 0m");
328 SY(__NR_getppid
); SUCC
;
331 GO(__NR_getpgrp
, "0s 0m");
332 SY(__NR_getpgrp
); SUCC
;
335 GO(__NR_setsid
, "0s 0m");
336 SY(__NR_setsid
); SUCC_OR_FAIL
;
339 GO(__NR_sigaction
, "3s 4m");
340 SY(__NR_sigaction
, x0
, x0
+&px
[1], x0
+&px
[1]); FAIL
;
342 // __NR_sgetmask 68 sys_sgetmask()
343 GO(__NR_sgetmask
, "n/a");
344 //SY(__NR_sgetmask); // (Not yet handled by Valgrind) FAIL;
347 GO(__NR_ssetmask
, "n/a");
348 //SY(__NR_ssetmask); // (Not yet handled by Valgrind) FAIL;
351 GO(__NR_setreuid
, "2s 0m");
352 SY(__NR_setreuid
, x0
-1, x0
-1); SUCC
;
355 GO(__NR_setregid
, "2s 0m");
356 SY(__NR_setregid
, x0
-1, x0
-1); SUCC
;
358 // __NR_sigsuspend 72
359 // XXX: how do you use this function?
360 GO(__NR_sigsuspend
, "ignore");
361 // (I don't know how to test this...)
363 // __NR_sigpending 73
364 GO(__NR_sigpending
, "1s 1m");
365 SY(__NR_sigpending
, x0
); FAIL
;
367 // __NR_sethostname 74
368 GO(__NR_sethostname
, "n/a");
369 //SY(__NR_sethostname); // (Not yet handled by Valgrind) FAIL;
372 GO(__NR_setrlimit
, "2s 1m");
373 SY(__NR_setrlimit
, x0
, x0
); FAIL
;
376 GO(__NR_getrlimit
, "2s 1m");
377 SY(__NR_getrlimit
, x0
, x0
); FAIL
;
380 GO(__NR_getrusage
, "2s 1m");
381 SY(__NR_getrusage
, x0
, x0
); FAIL
;
383 // __NR_gettimeofday 78
384 GO(__NR_gettimeofday
, "2s 2m");
385 SY(__NR_gettimeofday
, x0
+1, x0
+1); FAIL
;
387 // __NR_settimeofday 79
388 GO(__NR_settimeofday
, "2s 2m");
389 SY(__NR_settimeofday
, x0
+1, x0
+1); FAIL
;
392 GO(__NR_getgroups
, "2s 1m");
393 SY(__NR_getgroups
, x0
+1, x0
+1); FAIL
;
396 GO(__NR_setgroups
, "2s 1m");
397 SY(__NR_setgroups
, x0
+1, x0
+1); FAIL
;
401 long args
[5] = { x0
+8, x0
+0xffffffee, x0
+1, x0
+1, x0
+1 };
402 GO(__NR_select
, "1s 5m");
403 SY(__NR_select
, args
+x0
); FAIL
;
407 GO(__NR_symlink
, "2s 2m");
408 SY(__NR_symlink
, x0
, x0
); FAIL
;
411 GO(__NR_oldlstat
, "n/a");
412 // (obsolete, not handled by Valgrind)
415 GO(__NR_readlink
, "3s 2m");
416 SY(__NR_readlink
, x0
+1, x0
+1, x0
+1); FAIL
;
419 GO(__NR_uselib
, "n/a");
420 //SY(__NR_uselib); // (Not yet handled by Valgrind) FAIL;
423 GO(__NR_swapon
, "n/a");
424 //SY(__NR_swapon); // (Not yet handled by Valgrind) FAIL;
427 GO(__NR_reboot
, "n/a");
428 //SY(__NR_reboot); // (Not yet handled by Valgrind) FAIL;
431 GO(__NR_readdir
, "n/a");
432 // (superseded, not handled by Valgrind)
436 long args
[6] = { x0
, x0
, x0
, x0
, x0
-1, x0
};
437 GO(__NR_mmap
, "1s 1m");
438 SY(__NR_mmap
, args
+x0
); FAIL
;
442 GO(__NR_munmap
, "2s 0m");
443 SY(__NR_munmap
, x0
, x0
); FAIL
;
446 GO(__NR_truncate
, "2s 1m");
447 SY(__NR_truncate
, x0
, x0
); FAIL
;
450 GO(__NR_ftruncate
, "2s 0m");
451 SY(__NR_ftruncate
, x0
, x0
); FAIL
;
454 GO(__NR_fchmod
, "2s 0m");
455 SY(__NR_fchmod
, x0
-1, x0
); FAIL
;
458 GO(__NR_fchown
, "3s 0m");
459 SY(__NR_fchown
, x0
-1, x0
, x0
); FAIL
;
461 // __NR_getpriority 96
462 GO(__NR_getpriority
, "2s 0m");
463 SY(__NR_getpriority
, x0
-1, x0
); FAIL
;
465 // __NR_setpriority 97
466 GO(__NR_setpriority
, "3s 0m");
467 SY(__NR_setpriority
, x0
-1, x0
, x0
); FAIL
;
470 GO(__NR_profil
, "ni");
471 SY(__NR_profil
); FAIL
;
474 GO(__NR_statfs
, "2s 2m");
475 SY(__NR_statfs
, x0
, x0
); FAIL
;
478 GO(__NR_fstatfs
, "2s 1m");
479 SY(__NR_fstatfs
, x0
, x0
); FAIL
;
482 GO(__NR_ioperm
, "3s 0m");
483 SY(__NR_ioperm
, x0
, x0
, x0
); FAIL
;
485 // __NR_socketcall 102
486 GO(__NR_socketcall
, "XXX");
487 // (XXX: need to do all sub-cases properly)
490 GO(__NR_syslog
, "3s 1m");
491 SY(__NR_syslog
, x0
+2, x0
, x0
+1); FAIL
;
493 // __NR_setitimer 104
494 GO(__NR_setitimer
, "3s 2m");
495 SY(__NR_setitimer
, x0
, x0
+1, x0
+1); FAIL
;
497 // __NR_getitimer 105
498 GO(__NR_getitimer
, "2s 1m");
499 SY(__NR_getitimer
, x0
, x0
, x0
); FAIL
;
502 GO(__NR_stat
, "2s 2m");
503 SY(__NR_stat
, x0
, x0
); FAIL
;
506 GO(__NR_lstat
, "2s 2m");
507 SY(__NR_lstat
, x0
, x0
); FAIL
;
510 GO(__NR_fstat
, "2s 1m");
511 SY(__NR_fstat
, x0
, x0
); FAIL
;
514 GO(__NR_olduname
, "n/a");
515 // (obsolete, not handled by Valgrind)
518 GO(__NR_iopl
, "1s 0m");
519 SY(__NR_iopl
, x0
+100); FAIL
;
522 GO(__NR_vhangup
, "0s 0m");
523 SY(__NR_vhangup
); SUCC_OR_FAIL
; // Will succeed for superuser
530 GO(__NR_vm86old
, "n/a");
531 // (will probably never be handled by Valgrind)
534 GO(__NR_wait4
, "4s 2m");
535 SY(__NR_wait4
, x0
, x0
+1, x0
, x0
+1); FAIL
;
538 GO(__NR_swapoff
, "n/a");
539 //SY(__NR_swapoff); // (Not yet handled by Valgrind) FAIL;
542 GO(__NR_sysinfo
, "1s 1m");
543 SY(__NR_sysinfo
, x0
); FAIL
;
546 // XXX: This is simplistic -- need to do all the sub-cases properly.
547 // XXX: Also, should be 6 scalar errors, except glibc's syscall() doesn't
549 GO(__NR_ipc
, "5s 0m");
550 SY(__NR_ipc
, x0
+4, x0
, x0
, x0
, x0
, x0
); FAIL
;
553 GO(__NR_fsync
, "1s 0m");
554 SY(__NR_fsync
, x0
-1); FAIL
;
556 // __NR_sigreturn 119
557 GO(__NR_sigreturn
, "n/a");
558 //SY(__NR_sigreturn); // (Not yet handled by Valgrind) FAIL;
561 #ifndef CLONE_PARENT_SETTID
562 #define CLONE_PARENT_SETTID 0x00100000
564 GO(__NR_clone
, "5s 3m");
565 SY(__NR_clone
, x0
|CLONE_PARENT_SETTID
|CLONE_SETTLS
|CLONE_CHILD_SETTID
|SIGCHLD
, x0
, x0
, x0
, x0
); FAIL
;
567 SY(__NR_exit
, 0); FAIL
;
570 // __NR_setdomainname 121
571 GO(__NR_setdomainname
, "n/a");
572 //SY(__NR_setdomainname); // (Not yet handled by Valgrind) FAIL;
575 GO(__NR_uname
, "1s 1m");
576 SY(__NR_uname
, x0
); FAIL
;
578 // __NR_modify_ldt 123
579 GO(__NR_modify_ldt
, "3s 1m");
580 SY(__NR_modify_ldt
, x0
+1, x0
, x0
+1); FAILx(EINVAL
);
583 // XXX: need to do properly, but deref'ing NULL causing Valgrind to crash...
584 GO(__NR_adjtimex
, "XXX");
585 // SY(__NR_adjtimex, x0); FAIL;
588 GO(__NR_mprotect
, "3s 0m");
589 SY(__NR_mprotect
, x0
+1, x0
, x0
); FAILx(EINVAL
);
591 // __NR_sigprocmask 126
592 GO(__NR_sigprocmask
, "3s 2m");
593 SY(__NR_sigprocmask
, x0
, x0
+&px
[1], x0
+&px
[1]); SUCC
;
595 // __NR_create_module 127
596 GO(__NR_create_module
, "ni");
597 SY(__NR_create_module
); FAIL
;
599 // __NR_init_module 128
600 GO(__NR_init_module
, "3s 2m");
601 SY(__NR_init_module
, x0
, x0
+1, x0
); FAIL
;
603 // __NR_delete_module 129
604 GO(__NR_delete_module
, "n/a");
605 //SY(__NR_delete_module); // (Not yet handled by Valgrind) FAIL;
607 // __NR_get_kernel_syms 130
608 GO(__NR_get_kernel_syms
, "ni");
609 SY(__NR_get_kernel_syms
); FAIL
;
612 GO(__NR_quotactl
, "4s 1m");
613 SY(__NR_quotactl
, x0
, x0
, x0
, x0
); FAIL
;
616 GO(__NR_getpgid
, "1s 0m");
617 SY(__NR_getpgid
, x0
-1); FAIL
;
620 GO(__NR_fchdir
, "1s 0m");
621 SY(__NR_fchdir
, x0
-1); FAIL
;
624 GO(__NR_bdflush
, "n/a");
625 //SY(__NR_bdflush); // (Not yet handled by Valgrind) FAIL;
628 GO(__NR_sysfs
, "n/a");
629 //SY(__NR_sysfs); // (Not yet handled by Valgrind) FAIL;
631 // __NR_personality 136
632 GO(__NR_personality
, "1s 0m");
633 SY(__NR_personality
, x0
+0xffffffff); SUCC
;
635 // __NR_afs_syscall 137
636 GO(__NR_afs_syscall
, "ni");
637 SY(__NR_afs_syscall
); FAIL
;
640 GO(__NR_setfsuid
, "1s 0m");
641 SY(__NR_setfsuid
, x0
); SUCC
; // This syscall has a stupid return value
644 GO(__NR_setfsgid
, "1s 0m");
645 SY(__NR_setfsgid
, x0
); SUCC
; // This syscall has a stupid return value
648 GO(__NR__llseek
, "5s 1m");
649 SY(__NR__llseek
, x0
, x0
, x0
, x0
, x0
); FAIL
;
652 GO(__NR_getdents
, "3s 1m");
653 SY(__NR_getdents
, x0
, x0
, x0
+1); FAIL
;
655 // __NR__newselect 142
656 GO(__NR__newselect
, "5s 4m");
657 SY(__NR__newselect
, x0
+8, x0
+0xffffffff, x0
+1, x0
+1, x0
+1); FAIL
;
660 GO(__NR_flock
, "2s 0m");
661 SY(__NR_flock
, x0
, x0
); FAIL
;
664 GO(__NR_msync
, "3s 1m");
665 SY(__NR_msync
, x0
, x0
+1, x0
); FAIL
;
668 GO(__NR_readv
, "3s 1m");
669 SY(__NR_readv
, x0
, x0
, x0
+1); FAIL
;
672 GO(__NR_writev
, "3s 1m");
673 SY(__NR_writev
, x0
, x0
, x0
+1); FAIL
;
676 GO(__NR_getsid
, "1s 0m");
677 SY(__NR_getsid
, x0
-1); FAIL
;
679 // __NR_fdatasync 148
680 GO(__NR_fdatasync
, "1s 0m");
681 SY(__NR_fdatasync
, x0
-1); FAIL
;
684 GO(__NR__sysctl
, "1s 1m");
685 SY(__NR__sysctl
, x0
); FAIL
;
688 GO(__NR_mlock
, "2s 0m");
689 SY(__NR_mlock
, x0
, x0
+1); FAIL
;
692 GO(__NR_munlock
, "2s 0m");
693 SY(__NR_munlock
, x0
, x0
+1); FAIL
;
696 GO(__NR_mlockall
, "1s 0m");
697 SY(__NR_mlockall
, x0
-1); FAIL
;
699 // __NR_munlockall 153
700 GO(__NR_munlockall
, "0s 0m");
701 SY(__NR_munlockall
); SUCC_OR_FAILx(EPERM
);
703 // __NR_sched_setparam 154
704 GO(__NR_sched_setparam
, "2s 1m");
705 SY(__NR_sched_setparam
, x0
, x0
); FAIL
;
707 // __NR_sched_getparam 155
708 GO(__NR_sched_getparam
, "2s 1m");
709 SY(__NR_sched_getparam
, x0
, x0
); FAIL
;
711 // __NR_sched_setscheduler 156
712 GO(__NR_sched_setscheduler
, "3s 1m");
713 SY(__NR_sched_setscheduler
, x0
-1, x0
, x0
+1); FAIL
;
715 // __NR_sched_getscheduler 157
716 GO(__NR_sched_getscheduler
, "1s 0m");
717 SY(__NR_sched_getscheduler
, x0
-1); FAIL
;
719 // __NR_sched_yield 158
720 GO(__NR_sched_yield
, "0s 0m");
721 SY(__NR_sched_yield
); SUCC
;
723 // __NR_sched_get_priority_max 159
724 GO(__NR_sched_get_priority_max
, "1s 0m");
725 SY(__NR_sched_get_priority_max
, x0
-1); FAIL
;
727 // __NR_sched_get_priority_min 160
728 GO(__NR_sched_get_priority_min
, "1s 0m");
729 SY(__NR_sched_get_priority_min
, x0
-1); FAIL
;
731 // __NR_sched_rr_get_interval 161
732 GO(__NR_sched_rr_get_interval
, "n/a");
733 //SY(__NR_sched_rr_get_interval); // (Not yet handled by Valgrind) FAIL;
735 // __NR_nanosleep 162
736 GO(__NR_nanosleep
, "2s 2m");
737 SY(__NR_nanosleep
, x0
, x0
+1); FAIL
;
740 GO(__NR_mremap
, "5s 0m");
741 SY(__NR_mremap
, x0
+1, x0
, x0
, x0
+MREMAP_FIXED
, x0
); FAILx(EINVAL
);
743 // __NR_setresuid 164
744 GO(__NR_setresuid
, "3s 0m");
745 SY(__NR_setresuid
, x0
-1, x0
-1, x0
-1); SUCC
;
747 // __NR_getresuid 165
748 GO(__NR_getresuid
, "3s 3m");
749 SY(__NR_getresuid
, x0
, x0
, x0
); FAIL
;
752 GO(__NR_vm86
, "n/a");
753 // (will probably never be handled by Valgrind)
755 // __NR_query_module 167
756 GO(__NR_query_module
, "ni");
757 SY(__NR_query_module
); FAIL
;
760 GO(__NR_poll
, "3s 1m");
761 SY(__NR_poll
, x0
, x0
+1, x0
); FAIL
;
763 // __NR_nfsservctl 169
764 GO(__NR_nfsservctl
, "n/a");
765 //SY(__NR_nfsservctl); // (Not yet handled by Valgrind) FAIL;
767 // __NR_setresgid 170
768 GO(__NR_setresgid
, "3s 0m");
769 SY(__NR_setresgid
, x0
-1, x0
-1, x0
-1); SUCC
;
771 // __NR_getresgid 171
772 GO(__NR_getresgid
, "3s 3m");
773 SY(__NR_getresgid
, x0
, x0
, x0
); FAIL
;
776 GO(__NR_prctl
, "5s 0m");
777 SY(__NR_prctl
, x0
, x0
, x0
, x0
, x0
); FAIL
;
779 char buf16
[16] = "123456789012345.";
780 buf16
[15] = x0
; // this will cause 'using unitialised value'
781 GO(__NR_prctl
, "2s 0m");
782 SY(__NR_prctl
, x0
+ PR_SET_NAME
, buf16
); SUCC
;
784 char buf17
[17] = "1234567890123456.";
785 buf17
[16] = x0
; // this must not cause 'using unitialised value'
786 GO(__NR_prctl
, "1s 0m");
787 SY(__NR_prctl
, x0
+ PR_SET_NAME
, buf17
); SUCC
;
789 // __NR_rt_sigreturn 173
790 GO(__NR_rt_sigreturn
, "n/a");
791 //SY(__NR_rt_sigreturn); // (Not yet handled by Valgrind) FAIL;
793 // __NR_rt_sigaction 174
794 GO(__NR_rt_sigaction
, "4s 4m");
795 SY(__NR_rt_sigaction
, x0
, x0
+&px
[2], x0
+&px
[2], x0
); FAIL
;
797 // __NR_rt_sigprocmask 175
798 GO(__NR_rt_sigprocmask
, "4s 2m");
799 SY(__NR_rt_sigprocmask
, x0
, x0
+1, x0
+1, x0
); FAIL
;
801 // __NR_rt_sigpending 176
802 GO(__NR_rt_sigpending
, "2s 1m");
803 SY(__NR_rt_sigpending
, x0
, x0
+1); FAIL
;
805 // __NR_rt_sigtimedwait 177
806 GO(__NR_rt_sigtimedwait
, "4s 3m");
807 SY(__NR_rt_sigtimedwait
, x0
+1, x0
+1, x0
+1, x0
); FAIL
;
809 // __NR_rt_sigqueueinfo 178
810 GO(__NR_rt_sigqueueinfo
, "3s 1m");
811 SY(__NR_rt_sigqueueinfo
, x0
, x0
+1, x0
); FAIL
;
813 // __NR_rt_sigsuspend 179
814 GO(__NR_rt_sigsuspend
, "2s 1m");
815 SY(__NR_rt_sigsuspend
, x0
+ 1, x0
+ sizeof(sigset_t
)); FAILx(EFAULT
);
818 GO(__NR_pread64
, "5s 1m");
819 SY(__NR_pread64
, x0
, x0
, x0
+1, x0
, x0
); FAIL
;
822 GO(__NR_pwrite64
, "5s 1m");
823 SY(__NR_pwrite64
, x0
, x0
, x0
+1, x0
, x0
); FAIL
;
826 GO(__NR_chown
, "3s 1m");
827 SY(__NR_chown
, x0
, x0
, x0
); FAIL
;
830 GO(__NR_getcwd
, "2s 1m");
831 SY(__NR_getcwd
, x0
, x0
+1); FAIL
;
834 GO(__NR_capget
, "2s 2m");
835 SY(__NR_capget
, x0
, x0
+1); FAIL
;
838 GO(__NR_capset
, "2s 2m");
839 SY(__NR_capset
, x0
, x0
); FAIL
;
841 // __NR_sigaltstack 186
843 struct our_sigaltstack
{
851 VALGRIND_MAKE_MEM_NOACCESS(& ss
, sizeof(struct our_sigaltstack
));
852 GO(__NR_sigaltstack
, "2s 2m");
853 SY(__NR_sigaltstack
, x0
+&ss
, x0
+&ss
); SUCC
;
857 GO(__NR_sendfile
, "4s 1m");
858 SY(__NR_sendfile
, x0
, x0
, x0
+1, x0
); FAIL
;
861 // Could do 5s 4m with more effort, but I can't be bothered for this
862 // crappy non-standard syscall.
863 GO(__NR_getpmsg
, "5s 0m");
864 SY(__NR_getpmsg
, x0
, x0
, x0
, x0
); FAIL
;
867 // Could do 5s 2m with more effort, but I can't be bothered for this
868 // crappy non-standard syscall.
869 GO(__NR_putpmsg
, "5s 0m");
870 SY(__NR_putpmsg
, x0
, x0
, x0
, x0
, x0
); FAIL
;
873 GO(__NR_vfork
, "other");
874 // (sse scalar_vfork.c)
876 // __NR_ugetrlimit 191
877 GO(__NR_ugetrlimit
, "2s 1m");
878 SY(__NR_ugetrlimit
, x0
, x0
); FAIL
;
881 GO(__NR_mmap2
, "6s 0m");
882 SY(__NR_mmap2
, x0
, x0
, x0
, x0
, x0
-1, x0
); FAIL
;
884 // __NR_truncate64 193
885 GO(__NR_truncate64
, "3s 1m");
886 SY(__NR_truncate64
, x0
, x0
, x0
); FAIL
;
888 // __NR_ftruncate64 194
889 GO(__NR_ftruncate64
, "3s 0m");
890 SY(__NR_ftruncate64
, x0
, x0
, x0
); FAIL
;
893 GO(__NR_stat64
, "2s 2m");
894 SY(__NR_stat64
, x0
, x0
); FAIL
;
897 GO(__NR_lstat64
, "2s 2m");
898 SY(__NR_lstat64
, x0
, x0
); FAIL
;
901 GO(__NR_fstat64
, "2s 1m");
902 SY(__NR_fstat64
, x0
, x0
); FAIL
;
905 GO(__NR_lchown32
, "3s 1m");
906 SY(__NR_lchown32
, x0
, x0
, x0
); FAIL
;
909 GO(__NR_getuid32
, "0s 0m");
910 SY(__NR_getuid32
); SUCC
;
913 GO(__NR_getgid32
, "0s 0m");
914 SY(__NR_getgid32
); SUCC
;
916 // __NR_geteuid32 201
917 GO(__NR_geteuid32
, "0s 0m");
918 SY(__NR_geteuid32
); SUCC
;
920 // __NR_getegid32 202
921 GO(__NR_getegid32
, "0s 0m");
922 SY(__NR_getegid32
); SUCC
;
924 // __NR_setreuid32 203
925 GO(__NR_setreuid32
, "2s 0m");
926 SY(__NR_setreuid32
, x0
-1, x0
-1); SUCC
;
928 // __NR_setregid32 204
929 GO(__NR_setregid32
, "2s 0m");
930 SY(__NR_setregid32
, x0
-1, x0
-1); SUCC
;
932 // __NR_getgroups32 205
933 GO(__NR_getgroups32
, "2s 1m");
934 SY(__NR_getgroups32
, x0
+1, x0
+1); FAIL
;
936 // __NR_setgroups32 206
937 GO(__NR_setgroups32
, "2s 1m");
938 SY(__NR_setgroups32
, x0
+1, x0
+1); FAIL
;
941 GO(__NR_fchown32
, "3s 0m");
942 SY(__NR_fchown32
, x0
-1, x0
, x0
); FAIL
;
944 // __NR_setresuid32 208
945 GO(__NR_setresuid32
, "3s 0m");
946 SY(__NR_setresuid32
, x0
-1, x0
-1, x0
-1); SUCC
;
948 // __NR_getresuid32 209
949 GO(__NR_getresuid32
, "3s 3m");
950 SY(__NR_getresuid32
, x0
, x0
, x0
); FAIL
;
952 // __NR_setresgid32 210
953 GO(__NR_setresgid32
, "3s 0m");
954 SY(__NR_setresgid32
, x0
-1, x0
-1, x0
-1); SUCC
;
956 // __NR_getresgid32 211
957 GO(__NR_getresgid32
, "3s 3m");
958 SY(__NR_getresgid32
, x0
, x0
, x0
); FAIL
;
961 GO(__NR_chown32
, "3s 1m");
962 SY(__NR_chown32
, x0
, x0
, x0
); FAIL
;
965 GO(__NR_setuid32
, "1s 0m");
966 SY(__NR_setuid32
, x0
-1); FAIL
;
969 GO(__NR_setgid32
, "1s 0m");
970 SY(__NR_setgid32
, x0
-1); FAIL
;
972 // __NR_setfsuid32 215
973 GO(__NR_setfsuid32
, "1s 0m");
974 SY(__NR_setfsuid32
, x0
); SUCC
; // This syscall has a stupid return value
976 // __NR_setfsgid32 216
977 GO(__NR_setfsgid32
, "1s 0m");
978 SY(__NR_setfsgid32
, x0
); SUCC
; // This syscall has a stupid return value
980 // __NR_pivot_root 217
981 GO(__NR_pivot_root
, "n/a");
982 //SY(__NR_pivot_root); // (Not yet handled by Valgrind) FAIL;
985 GO(__NR_mincore
, "3s 1m");
986 SY(__NR_mincore
, x0
, x0
+40960, x0
); FAIL
;
989 GO(__NR_madvise
, "3s 0m");
990 SY(__NR_madvise
, x0
, x0
+1, x0
); FAILx(ENOMEM
);
992 // __NR_getdents64 220
993 GO(__NR_getdents64
, "3s 1m");
994 SY(__NR_getdents64
, x0
, x0
, x0
+1); FAIL
;
997 // As with sys_open(), we don't trigger errors for the 1st two args for
999 // For F_GETFD the 3rd arg is ignored.
1000 GO(__NR_fcntl64
, "(GETFD) 2s 0m");
1001 SY(__NR_fcntl64
, x0
-1, x0
+F_GETFD
, x0
); FAILx(EBADF
);
1003 // For F_DUPFD the 3rd arg is 'arg'
1004 GO(__NR_fcntl64
, "(DUPFD) 1s 0m");
1005 SY(__NR_fcntl64
, -1, F_DUPFD
, x0
); FAILx(EBADF
);
1007 // For F_GETLK the 3rd arg is 'lock'.
1008 // On x86, this fails w/EBADF. But on amd64 in 32-bit mode it fails
1010 GO(__NR_fcntl64
, "(GETLK) 1s 0m");
1011 SY(__NR_fcntl64
, -1, +F_GETLK
, x0
); FAIL
; //FAILx(EBADF);
1022 GO(__NR_gettid
, "n/a");
1023 //SY(__NR_gettid); // (Not yet handled by Valgrind) FAIL;
1025 // __NR_readahead 225
1026 GO(__NR_readahead
, "n/a");
1027 //SY(__NR_readahead); // (Not yet handled by Valgrind) FAIL;
1029 // __NR_setxattr 226
1030 GO(__NR_setxattr
, "5s 3m");
1031 SY(__NR_setxattr
, x0
, x0
, x0
, x0
+1, x0
); FAIL
;
1033 // __NR_lsetxattr 227
1034 GO(__NR_lsetxattr
, "5s 3m");
1035 SY(__NR_lsetxattr
, x0
, x0
, x0
, x0
+1, x0
); FAIL
;
1037 // __NR_fsetxattr 228
1038 GO(__NR_fsetxattr
, "5s 2m");
1039 SY(__NR_fsetxattr
, x0
, x0
, x0
, x0
+1, x0
); FAIL
;
1041 // __NR_getxattr 229
1042 GO(__NR_getxattr
, "4s 3m");
1043 SY(__NR_getxattr
, x0
, x0
, x0
, x0
+1); FAIL
;
1045 // __NR_lgetxattr 230
1046 GO(__NR_lgetxattr
, "4s 3m");
1047 SY(__NR_lgetxattr
, x0
, x0
, x0
, x0
+1); FAIL
;
1049 // __NR_fgetxattr 231
1050 GO(__NR_fgetxattr
, "4s 2m");
1051 SY(__NR_fgetxattr
, x0
, x0
, x0
, x0
+1); FAIL
;
1053 // __NR_listxattr 232
1054 GO(__NR_listxattr
, "3s 2m");
1055 SY(__NR_listxattr
, x0
, x0
, x0
+1); FAIL
;
1057 // __NR_llistxattr 233
1058 GO(__NR_llistxattr
, "3s 2m");
1059 SY(__NR_llistxattr
, x0
, x0
, x0
+1); FAIL
;
1061 // __NR_flistxattr 234
1062 GO(__NR_flistxattr
, "3s 1m");
1063 SY(__NR_flistxattr
, x0
-1, x0
, x0
+1); FAIL
; /* kernel returns EBADF, but both seem correct */
1065 // __NR_removexattr 235
1066 GO(__NR_removexattr
, "2s 2m");
1067 SY(__NR_removexattr
, x0
, x0
); FAIL
;
1069 // __NR_lremovexattr 236
1070 GO(__NR_lremovexattr
, "2s 2m");
1071 SY(__NR_lremovexattr
, x0
, x0
); FAIL
;
1073 // __NR_fremovexattr 237
1074 GO(__NR_fremovexattr
, "2s 1m");
1075 SY(__NR_fremovexattr
, x0
, x0
); FAIL
;
1078 GO(__NR_tkill
, "n/a");
1079 //SY(__NR_tkill); // (Not yet handled by Valgrind) FAIL;
1081 // __NR_sendfile64 239
1082 GO(__NR_sendfile64
, "4s 1m");
1083 SY(__NR_sendfile64
, x0
, x0
, x0
+1, x0
); FAIL
;
1087 #define FUTEX_WAIT 0
1089 // XXX: again, glibc not doing 6th arg means we have only 5s errors
1090 GO(__NR_futex
, "4s 2m");
1091 SY(__NR_futex
, x0
+FUTEX_WAIT
, x0
, x0
, x0
+1); FAIL
;
1093 // __NR_sched_setaffinity 241
1094 GO(__NR_sched_setaffinity
, "3s 1m");
1095 SY(__NR_sched_setaffinity
, x0
, x0
+1, x0
); FAIL
;
1097 // __NR_sched_getaffinity 242
1098 GO(__NR_sched_getaffinity
, "3s 1m");
1099 SY(__NR_sched_getaffinity
, x0
, x0
+1, x0
); FAIL
;
1101 // __NR_set_thread_area 243
1102 GO(__NR_set_thread_area
, "1s 1m");
1103 SY(__NR_set_thread_area
, x0
); FAILx(EFAULT
);
1105 // __NR_get_thread_area 244
1106 GO(__NR_get_thread_area
, "1s 1m");
1107 SY(__NR_get_thread_area
, x0
); FAILx(EFAULT
);
1109 // __NR_io_setup 245
1110 GO(__NR_io_setup
, "2s 1m");
1111 SY(__NR_io_setup
, x0
, x0
); FAIL
;
1113 // __NR_io_destroy 246
1115 // jump through hoops to prevent the PRE(io_destroy) wrapper crashing.
1116 struct fake_aio_ring
{
1117 unsigned id
; /* kernel internal index number */
1118 unsigned nr
; /* number of io_events */
1119 // There are more fields in the real aio_ring, but the 'nr' field is
1120 // the only one used by the PRE() wrapper.
1122 struct fake_aio_ring
* ringptr
= &ring
;
1123 GO(__NR_io_destroy
, "1s 0m");
1124 SY(__NR_io_destroy
, x0
+&ringptr
); FAIL
;
1127 // __NR_io_getevents 247
1128 GO(__NR_io_getevents
, "5s 2m");
1129 SY(__NR_io_getevents
, x0
, x0
, x0
+1, x0
, x0
+1); FAIL
;
1131 // __NR_io_submit 248
1132 GO(__NR_io_submit
, "3s 1m");
1133 SY(__NR_io_submit
, x0
, x0
+1, x0
); FAIL
;
1135 // __NR_io_cancel 249
1136 GO(__NR_io_cancel
, "3s 2m");
1137 SY(__NR_io_cancel
, x0
, x0
, x0
); FAIL
;
1139 // __NR_fadvise64 250
1140 GO(__NR_fadvise64
, "n/a");
1141 //SY(__NR_fadvise64); // (Not yet handled by Valgrind) FAIL;
1147 // __NR_exit_group 252
1148 GO(__NR_exit_group
, "other");
1149 // (see scalar_exit_group.c)
1151 // __NR_lookup_dcookie 253
1152 GO(__NR_lookup_dcookie
, "4s 1m");
1153 SY(__NR_lookup_dcookie
, x0
, x0
, x0
, x0
+1); FAIL
;
1155 // __NR_epoll_create 254
1156 GO(__NR_epoll_create
, "1s 0m");
1157 SY(__NR_epoll_create
, x0
); SUCC_OR_FAIL
;
1159 // __NR_epoll_ctl 255
1160 GO(__NR_epoll_ctl
, "4s 1m");
1161 SY(__NR_epoll_ctl
, x0
, x0
, x0
, x0
); FAIL
;
1163 // __NR_epoll_wait 256
1164 GO(__NR_epoll_wait
, "4s 1m");
1165 SY(__NR_epoll_wait
, x0
, x0
, x0
+1, x0
); FAIL
;
1167 // __NR_remap_file_pages 257
1168 GO(__NR_remap_file_pages
, "n/a");
1169 //SY(__NR_remap_file_pages); // (Not yet handled by Valgrind) FAIL;
1171 // __NR_set_tid_address 258
1172 GO(__NR_set_tid_address
, "1s 0m");
1173 SY(__NR_set_tid_address
, x0
); SUCC_OR_FAILx(ENOSYS
);
1175 // __NR_timer_create 259
1176 GO(__NR_timer_create
, "3s 2m");
1177 SY(__NR_timer_create
, x0
, x0
+1, x0
); FAIL
;
1179 // __NR_timer_settime (__NR_timer_create+1)
1180 GO(__NR_timer_settime
, "4s 2m");
1181 SY(__NR_timer_settime
, x0
, x0
, x0
, x0
+1); FAIL
;
1183 // __NR_timer_gettime (__NR_timer_create+2)
1184 GO(__NR_timer_gettime
, "2s 1m");
1185 SY(__NR_timer_gettime
, x0
, x0
); FAIL
;
1187 // __NR_timer_getoverrun (__NR_timer_create+3)
1188 GO(__NR_timer_getoverrun
, "1s 0m");
1189 SY(__NR_timer_getoverrun
, x0
); FAIL
;
1191 // __NR_timer_delete (__NR_timer_create+4)
1192 GO(__NR_timer_delete
, "1s 0m");
1193 SY(__NR_timer_delete
, x0
); FAIL
;
1195 // __NR_clock_settime (__NR_timer_create+5)
1196 GO(__NR_clock_settime
, "2s 1m");
1197 SY(__NR_clock_settime
, x0
, x0
); FAIL
; FAIL
;
1199 // __NR_clock_gettime (__NR_timer_create+6)
1200 GO(__NR_clock_gettime
, "2s 1m");
1201 SY(__NR_clock_gettime
, x0
, x0
); FAIL
;
1203 // __NR_clock_getres (__NR_timer_create+7)
1204 GO(__NR_clock_getres
, "2s 1m");
1205 SY(__NR_clock_getres
, x0
+1, x0
+1); FAIL
; FAIL
;
1207 // __NR_clock_nanosleep (__NR_timer_create+8)
1208 GO(__NR_clock_nanosleep
, "n/a");
1209 //SY(__NR_clock_nanosleep); // (Not yet handled by Valgrind) FAIL;
1211 // __NR_statfs64 268
1212 GO(__NR_statfs64
, "3s 2m");
1213 SY(__NR_statfs64
, x0
, x0
+1, x0
); FAIL
;
1215 // __NR_fstatfs64 269
1216 GO(__NR_fstatfs64
, "3s 1m");
1217 SY(__NR_fstatfs64
, x0
, x0
+1, x0
); FAIL
;
1220 GO(__NR_tgkill
, "n/a");
1221 //SY(__NR_tgkill); // (Not yet handled by Valgrind) FAIL;
1224 GO(__NR_utimes
, "2s 2m");
1225 SY(__NR_utimes
, x0
, x0
+1); FAIL
;
1227 // __NR_fadvise64_64 272
1228 GO(__NR_fadvise64_64
, "n/a");
1229 //SY(__NR_fadvise64_64); // (Not yet handled by Valgrind) FAIL;
1232 GO(__NR_vserver
, "ni");
1233 SY(__NR_vserver
); FAIL
;
1236 GO(__NR_mbind
, "n/a");
1237 //SY(__NR_mbind); // (Not yet handled by Valgrind) FAIL;
1239 // __NR_get_mempolicy 275
1240 GO(__NR_get_mempolicy
, "n/a");
1241 //SY(__NR_get_mempolicy); // (Not yet handled by Valgrind) FAIL;
1243 // __NR_set_mempolicy 276
1244 GO(__NR_set_mempolicy
, "n/a");
1245 //SY(__NR_set_mempolicy); // (Not yet handled by Valgrind) FAIL;
1248 GO(__NR_mq_open
, "4s 3m");
1249 SY(__NR_mq_open
, x0
, x0
+O_CREAT
, x0
, x0
+1); FAIL
;
1251 // __NR_mq_unlink (__NR_mq_open+1)
1252 GO(__NR_mq_unlink
, "1s 1m");
1253 SY(__NR_mq_unlink
, x0
); FAIL
;
1255 // __NR_mq_timedsend (__NR_mq_open+2)
1256 GO(__NR_mq_timedsend
, "5s 2m");
1257 SY(__NR_mq_timedsend
, x0
, x0
, x0
+1, x0
, x0
+1); FAIL
;
1259 // __NR_mq_timedreceive (__NR_mq_open+3)
1260 GO(__NR_mq_timedreceive
, "5s 3m");
1261 SY(__NR_mq_timedreceive
, x0
, x0
, x0
+1, x0
+1, x0
+1); FAIL
;
1263 // __NR_mq_notify (__NR_mq_open+4)
1264 GO(__NR_mq_notify
, "2s 1m");
1265 SY(__NR_mq_notify
, x0
, x0
+1); FAIL
;
1267 // __NR_mq_getsetattr (__NR_mq_open+5)
1268 GO(__NR_mq_getsetattr
, "3s 2m");
1269 SY(__NR_mq_getsetattr
, x0
, x0
+1, x0
+1); FAIL
;
1271 // __NR_sys_kexec_load 283
1272 GO(__NR_sys_kexec_load
, "ni");
1273 SY(__NR_sys_kexec_load
); FAIL
;
1275 // __NR_epoll_create1 329
1276 GO(__NR_epoll_create1
, "1s 0m");
1277 SY(__NR_epoll_create1
, x0
); SUCC_OR_FAIL
;
1279 // __NR_process_vm_readv 347
1280 GO(__NR_process_vm_readv
, "6s 2m");
1281 SY(__NR_process_vm_readv
, x0
, x0
, x0
+1, x0
, x0
+1, x0
); FAIL
;
1283 // __NR_process_vm_writev 348
1284 GO(__NR_process_vm_writev
, "6s 2m");
1285 SY(__NR_process_vm_writev
, x0
, x0
, x0
+1, x0
, x0
+1, x0
); FAIL
;
1287 // no such syscall...
1292 GO(__NR_exit
, "1s 0m");
1293 SY(__NR_exit
, x0
); FAIL
;