1#define _GNU_SOURCE
2
3#include "../../memcheck.h"
4#include "scalar.h"
5#include <unistd.h>
6#include <sched.h>
7#include <signal.h>
8#include <linux/mman.h> // MREMAP_FIXED
9#include <sys/prctl.h>
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
28int main(void)
29{
30   // uninitialised, but we know px[0] is 0x0
31   long* px  = malloc(sizeof(long));
32   long  x0  = px[0];
33   long  res;
34
35   // All __NR_xxx numbers are taken from x86
36
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;
40
41   // __NR_exit 1
42   GO(__NR_exit, "below");
43   // (see below)
44
45   // __NR_fork 2
46   GO(__NR_fork, "other");
47   // (sse scalar_fork.c)
48
49   // __NR_read 3
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);
53
54   // __NR_write 4
55   GO(__NR_write, "3s 1m");
56   SY(__NR_write, x0, x0, x0+1); FAIL;
57
58   // __NR_open 5
59   GO(__NR_open, "(2-args) 2s 1m");
60   SY(__NR_open, x0, x0); FAIL;
61
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
64   // may not.
65   GO(__NR_open, "(3-args) 1s 0m");
66   SY(__NR_open, "scalar.c", O_CREAT|O_EXCL, x0); FAIL;
67
68   // __NR_close 6
69   GO(__NR_close, "1s 0m");
70   SY(__NR_close, x0-1); FAIL;
71
72   // __NR_waitpid 7
73   GO(__NR_waitpid, "3s 1m");
74   SY(__NR_waitpid, x0, x0+1, x0); FAIL;
75
76   // __NR_creat 8
77   GO(__NR_creat, "2s 1m");
78   SY(__NR_creat, x0, x0); FAIL;
79
80   // __NR_link 9
81   GO(__NR_link, "2s 2m");
82   SY(__NR_link, x0, x0); FAIL;
83
84   // __NR_unlink 10
85   GO(__NR_unlink, "1s 1m");
86   SY(__NR_unlink, x0); FAIL;
87
88   // __NR_execve 11
89   GO(__NR_execve, "3s 1m");
90   SY(__NR_execve, x0 + 1, x0 + 1, x0); FAIL;
91
92   GO(__NR_execve, "3s 1m");
93   SY(__NR_execve, x0 + 1, x0, x0 + 1); FAIL;
94
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
99   GO(__NR_execve, "4s 2m");
100   SY(__NR_execve, x0 + 1, x0, x0 + argv_envp); FAIL;
101
102   // __NR_chdir 12
103   GO(__NR_chdir, "1s 1m");
104   SY(__NR_chdir, x0); FAIL;
105
106   // __NR_time 13
107   GO(__NR_time, "1s 1m");
108   SY(__NR_time, x0+1); FAIL;
109
110   // __NR_mknod 14
111   GO(__NR_mknod, "3s 1m");
112   SY(__NR_mknod, x0, x0, x0); FAIL;
113
114   // __NR_chmod 15
115   GO(__NR_chmod, "2s 1m");
116   SY(__NR_chmod, x0, x0); FAIL;
117
118   // __NR_lchown 16
119   GO(__NR_lchown, "n/a");
120 //SY(__NR_lchown); // (Not yet handled by Valgrind) FAIL;
121
122   // __NR_break 17
123   GO(__NR_break, "ni");
124   SY(__NR_break); FAIL;
125
126   // __NR_oldstat 18
127   GO(__NR_oldstat, "n/a");
128   // (obsolete, not handled by Valgrind)
129
130   // __NR_lseek 19
131   GO(__NR_lseek, "3s 0m");
132   SY(__NR_lseek, x0-1, x0, x0); FAILx(EBADF);
133
134   // __NR_getpid 20
135   GO(__NR_getpid, "0s 0m");
136   SY(__NR_getpid); SUCC;
137
138   // __NR_mount 21
139   GO(__NR_mount, "5s 3m");
140   SY(__NR_mount, x0, x0, x0, x0, x0); FAIL;
141
142   // __NR_umount 22
143   GO(__NR_umount, "1s 1m");
144   SY(__NR_umount, x0); FAIL;
145
146   // __NR_setuid 23
147   GO(__NR_setuid, "1s 0m");
148   SY(__NR_setuid, x0); FAIL;
149
150   // __NR_getuid 24
151   GO(__NR_getuid, "0s 0m");
152   SY(__NR_getuid); SUCC;
153
154   // __NR_stime 25
155   GO(__NR_stime, "n/a");
156 //SY(__NR_stime); // (Not yet handled by Valgrind) FAIL;
157
158   // __NR_ptrace 26
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;
162
163   // __NR_alarm 27
164   GO(__NR_alarm, "1s 0m");
165   SY(__NR_alarm, x0); SUCC;
166
167   // __NR_oldfstat 28
168   GO(__NR_oldfstat, "n/a");
169   // (obsolete, not handled by Valgrind)
170
171   // __NR_pause 29
172   GO(__NR_pause, "ignore");
173   // (hard to test, and no args so not much to be gained -- don't bother)
174
175   // __NR_utime 30
176   GO(__NR_utime, "2s 2m");
177   SY(__NR_utime, x0, x0+1); FAIL;
178
179   // __NR_stty 31
180   GO(__NR_stty, "ni");
181   SY(__NR_stty); FAIL;
182
183   // __NR_gtty 32
184   GO(__NR_gtty, "ni");
185   SY(__NR_gtty); FAIL;
186
187   // __NR_access 33
188   GO(__NR_access, "2s 1m");
189   SY(__NR_access, x0, x0); FAIL;
190
191   // __NR_nice 34
192   GO(__NR_nice, "1s 0m");
193   SY(__NR_nice, x0); SUCC;
194
195   // __NR_ftime 35
196   GO(__NR_ftime, "ni");
197   SY(__NR_ftime); FAIL;
198
199   // __NR_sync 36
200   GO(__NR_sync, "0s 0m");
201   SY(__NR_sync); SUCC;
202
203   // __NR_kill 37
204   GO(__NR_kill, "2s 0m");
205   SY(__NR_kill, x0, x0); SUCC;
206
207   // __NR_rename 38
208   GO(__NR_rename, "2s 2m");
209   SY(__NR_rename, x0, x0); FAIL;
210
211   // __NR_mkdir 39
212   GO(__NR_mkdir, "2s 1m");
213   SY(__NR_mkdir, x0, x0); FAIL;
214
215   // __NR_rmdir 40
216   GO(__NR_rmdir, "1s 1m");
217   SY(__NR_rmdir, x0); FAIL;
218
219   // __NR_dup 41
220   GO(__NR_dup, "1s 0m");
221   SY(__NR_dup, x0-1); FAIL;
222
223   // __NR_pipe 42
224   GO(__NR_pipe, "1s 1m");
225   SY(__NR_pipe, x0); FAIL;
226
227   // __NR_times 43
228   GO(__NR_times, "1s 1m");
229   SY(__NR_times, x0+1); FAIL;
230
231   // __NR_prof 44
232   GO(__NR_prof, "ni");
233   SY(__NR_prof); FAIL;
234
235   // __NR_brk 45
236   GO(__NR_brk, "1s 0m");
237   SY(__NR_brk, x0); SUCC;
238
239   // __NR_setgid 46
240   GO(__NR_setgid, "1s 0m");
241   SY(__NR_setgid, x0); FAIL;
242
243   // __NR_getgid 47
244   GO(__NR_getgid, "0s 0m");
245   SY(__NR_getgid); SUCC;
246
247   // __NR_signal 48
248   GO(__NR_signal, "n/a");
249 //SY(__NR_signal); // (Not yet handled by Valgrind) FAIL;
250
251   // __NR_geteuid 49
252   GO(__NR_geteuid, "0s 0m");
253   SY(__NR_geteuid); SUCC;
254
255   // __NR_getegid 50
256   GO(__NR_getegid, "0s 0m");
257   SY(__NR_getegid); SUCC;
258
259   // __NR_acct 51
260   GO(__NR_acct, "1s 1m");
261   SY(__NR_acct, x0); FAIL;
262
263   // __NR_umount2 52
264   GO(__NR_umount2, "2s 1m");
265   SY(__NR_umount2, x0, x0); FAIL;
266
267   // __NR_lock 53
268   GO(__NR_lock, "ni");
269   SY(__NR_lock); FAIL;
270
271   // __NR_ioctl 54
272   #include <asm/ioctls.h>
273   GO(__NR_ioctl, "3s 1m");
274   SY(__NR_ioctl, x0, x0+TCSETS, x0); FAIL;
275
276   // __NR_fcntl 55
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);
281
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);
287
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);
293
294   // __NR_mpx 56
295   GO(__NR_mpx, "ni");
296   SY(__NR_mpx); FAIL;
297
298   // __NR_setpgid 57
299   GO(__NR_setpgid, "2s 0m");
300   SY(__NR_setpgid, x0, x0-1); FAIL;
301
302   // __NR_ulimit 58
303   GO(__NR_ulimit, "ni");
304   SY(__NR_ulimit); FAIL;
305
306   // __NR_oldolduname 59
307   GO(__NR_oldolduname, "n/a");
308   // (obsolete, not handled by Valgrind)
309
310   // __NR_umask 60
311   GO(__NR_umask, "1s 0m");
312   SY(__NR_umask, x0+022); SUCC;
313
314   // __NR_chroot 61
315   GO(__NR_chroot, "1s 1m");
316   SY(__NR_chroot, x0); FAIL;
317
318   // __NR_ustat 62
319   GO(__NR_ustat, "n/a");
320   // (deprecated, not handled by Valgrind)
321
322   // __NR_dup2 63
323   GO(__NR_dup2, "2s 0m");
324   SY(__NR_dup2, x0-1, x0); FAIL;
325
326   // __NR_getppid 64
327   GO(__NR_getppid, "0s 0m");
328   SY(__NR_getppid); SUCC;
329
330   // __NR_getpgrp 65
331   GO(__NR_getpgrp, "0s 0m");
332   SY(__NR_getpgrp); SUCC;
333
334   // __NR_setsid 66
335   GO(__NR_setsid, "0s 0m");
336   SY(__NR_setsid); SUCC_OR_FAIL;
337
338   // __NR_sigaction 67
339   GO(__NR_sigaction, "3s 4m");
340   SY(__NR_sigaction, x0, x0+&px[1], x0+&px[1]); FAIL;
341
342   // __NR_sgetmask 68 sys_sgetmask()
343   GO(__NR_sgetmask, "n/a");
344 //SY(__NR_sgetmask); // (Not yet handled by Valgrind) FAIL;
345
346   // __NR_ssetmask 69
347   GO(__NR_ssetmask, "n/a");
348 //SY(__NR_ssetmask); // (Not yet handled by Valgrind) FAIL;
349
350   // __NR_setreuid 70
351   GO(__NR_setreuid, "2s 0m");
352   SY(__NR_setreuid, x0, x0); FAIL;
353
354   // __NR_setregid 71
355   GO(__NR_setregid, "2s 0m");
356   SY(__NR_setregid, x0, x0); FAIL;
357
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...)
362
363   // __NR_sigpending 73
364   GO(__NR_sigpending, "1s 1m");
365   SY(__NR_sigpending, x0); FAIL;
366
367   // __NR_sethostname 74
368   GO(__NR_sethostname, "n/a");
369 //SY(__NR_sethostname); // (Not yet handled by Valgrind) FAIL;
370
371   // __NR_setrlimit 75
372   GO(__NR_setrlimit, "2s 1m");
373   SY(__NR_setrlimit, x0, x0); FAIL;
374
375   // __NR_getrlimit 76
376   GO(__NR_getrlimit, "2s 1m");
377   SY(__NR_getrlimit, x0, x0); FAIL;
378
379   // __NR_getrusage 77
380   GO(__NR_getrusage, "2s 1m");
381   SY(__NR_getrusage, x0, x0); FAIL;
382
383   // __NR_gettimeofday 78
384   GO(__NR_gettimeofday, "2s 2m");
385   SY(__NR_gettimeofday, x0+1, x0+1); FAIL;
386
387   // __NR_settimeofday 79
388   GO(__NR_settimeofday, "2s 2m");
389   SY(__NR_settimeofday, x0+1, x0+1); FAIL;
390
391   // __NR_getgroups 80
392   GO(__NR_getgroups, "2s 1m");
393   SY(__NR_getgroups, x0+1, x0+1); FAIL;
394
395   // __NR_setgroups 81
396   GO(__NR_setgroups, "2s 1m");
397   SY(__NR_setgroups, x0+1, x0+1); FAIL;
398
399   // __NR_select 82
400   {
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;
404   }
405
406   // __NR_symlink 83
407   GO(__NR_symlink, "2s 2m");
408   SY(__NR_symlink, x0, x0); FAIL;
409
410   // __NR_oldlstat 84
411   GO(__NR_oldlstat, "n/a");
412   // (obsolete, not handled by Valgrind)
413
414   // __NR_readlink 85
415   GO(__NR_readlink, "3s 2m");
416   SY(__NR_readlink, x0+1, x0+1, x0+1); FAIL;
417
418   // __NR_uselib 86
419   GO(__NR_uselib, "n/a");
420 //SY(__NR_uselib); // (Not yet handled by Valgrind) FAIL;
421
422   // __NR_swapon 87
423   GO(__NR_swapon, "n/a");
424 //SY(__NR_swapon); // (Not yet handled by Valgrind) FAIL;
425
426   // __NR_reboot 88
427   GO(__NR_reboot, "n/a");
428 //SY(__NR_reboot); // (Not yet handled by Valgrind) FAIL;
429
430   // __NR_readdir 89
431   GO(__NR_readdir, "n/a");
432   // (superseded, not handled by Valgrind)
433
434   // __NR_mmap 90
435   {
436      long args[6] = { x0, x0, x0, x0, x0-1, x0 };
437      GO(__NR_mmap, "1s 1m");
438      SY(__NR_mmap, args+x0); FAIL;
439   }
440
441   // __NR_munmap 91
442   GO(__NR_munmap, "2s 0m");
443   SY(__NR_munmap, x0, x0); FAIL;
444
445   // __NR_truncate 92
446   GO(__NR_truncate, "2s 1m");
447   SY(__NR_truncate, x0, x0); FAIL;
448
449   // __NR_ftruncate 93
450   GO(__NR_ftruncate, "2s 0m");
451   SY(__NR_ftruncate, x0, x0); FAIL;
452
453   // __NR_fchmod 94
454   GO(__NR_fchmod, "2s 0m");
455   SY(__NR_fchmod, x0-1, x0); FAIL;
456
457   // __NR_fchown 95
458   GO(__NR_fchown, "3s 0m");
459   SY(__NR_fchown, x0, x0, x0); FAIL;
460
461   // __NR_getpriority 96
462   GO(__NR_getpriority, "2s 0m");
463   SY(__NR_getpriority, x0-1, x0); FAIL;
464
465   // __NR_setpriority 97
466   GO(__NR_setpriority, "3s 0m");
467   SY(__NR_setpriority, x0-1, x0, x0); FAIL;
468
469   // __NR_profil 98
470   GO(__NR_profil, "ni");
471   SY(__NR_profil); FAIL;
472
473   // __NR_statfs 99
474   GO(__NR_statfs, "2s 2m");
475   SY(__NR_statfs, x0, x0); FAIL;
476
477   // __NR_fstatfs 100
478   GO(__NR_fstatfs, "2s 1m");
479   SY(__NR_fstatfs, x0, x0); FAIL;
480
481   // __NR_ioperm 101
482   GO(__NR_ioperm, "3s 0m");
483   SY(__NR_ioperm, x0, x0, x0); FAIL;
484
485   // __NR_socketcall 102
486   GO(__NR_socketcall, "XXX");
487   // (XXX: need to do all sub-cases properly)
488
489   // __NR_syslog 103
490   GO(__NR_syslog, "3s 1m");
491   SY(__NR_syslog, x0+2, x0, x0+1); FAIL;
492
493   // __NR_setitimer 104
494   GO(__NR_setitimer, "3s 2m");
495   SY(__NR_setitimer, x0, x0+1, x0+1); FAIL;
496
497   // __NR_getitimer 105
498   GO(__NR_getitimer, "2s 1m");
499   SY(__NR_getitimer, x0, x0, x0); FAIL;
500
501   // __NR_stat 106
502   GO(__NR_stat, "2s 2m");
503   SY(__NR_stat, x0, x0); FAIL;
504
505   // __NR_lstat 107
506   GO(__NR_lstat, "2s 2m");
507   SY(__NR_lstat, x0, x0); FAIL;
508
509   // __NR_fstat 108
510   GO(__NR_fstat, "2s 1m");
511   SY(__NR_fstat, x0, x0); FAIL;
512
513   // __NR_olduname 109
514   GO(__NR_olduname, "n/a");
515   // (obsolete, not handled by Valgrind)
516
517   // __NR_iopl 110
518   GO(__NR_iopl, "1s 0m");
519   SY(__NR_iopl, x0+100); FAIL;
520
521   // __NR_vhangup 111
522   GO(__NR_vhangup, "0s 0m");
523   SY(__NR_vhangup); SUCC_OR_FAIL;  // Will succeed for superuser
524
525   // __NR_idle 112
526   GO(__NR_idle, "ni");
527   SY(__NR_idle); FAIL;
528
529   // __NR_vm86old 113
530   GO(__NR_vm86old, "n/a");
531   // (will probably never be handled by Valgrind)
532
533   // __NR_wait4 114
534   GO(__NR_wait4, "4s 2m");
535   SY(__NR_wait4, x0, x0+1, x0, x0+1); FAIL;
536
537   // __NR_swapoff 115
538   GO(__NR_swapoff, "n/a");
539 //SY(__NR_swapoff); // (Not yet handled by Valgrind) FAIL;
540
541   // __NR_sysinfo 116
542   GO(__NR_sysinfo, "1s 1m");
543   SY(__NR_sysinfo, x0); FAIL;
544
545   // __NR_ipc 117
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
548   //      use the 6th one!
549   GO(__NR_ipc, "5s 0m");
550   SY(__NR_ipc, x0+4, x0, x0, x0, x0, x0); FAIL;
551
552   // __NR_fsync 118
553   GO(__NR_fsync, "1s 0m");
554   SY(__NR_fsync, x0-1); FAIL;
555
556   // __NR_sigreturn 119
557   GO(__NR_sigreturn, "n/a");
558 //SY(__NR_sigreturn); // (Not yet handled by Valgrind) FAIL;
559
560   // __NR_clone 120
561#ifndef CLONE_PARENT_SETTID
562#define CLONE_PARENT_SETTID	0x00100000
563#endif
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;
566   if (0 == res) {
567      SY(__NR_exit, 0); FAIL;
568   }
569
570   // __NR_setdomainname 121
571   GO(__NR_setdomainname, "n/a");
572 //SY(__NR_setdomainname); // (Not yet handled by Valgrind) FAIL;
573
574   // __NR_uname 122
575   GO(__NR_uname, "1s 1m");
576   SY(__NR_uname, x0); FAIL;
577
578   // __NR_modify_ldt 123
579   GO(__NR_modify_ldt, "3s 1m");
580   SY(__NR_modify_ldt, x0+1, x0, x0+1); FAILx(EINVAL);
581
582   // __NR_adjtimex 124
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;
586
587   // __NR_mprotect 125
588   GO(__NR_mprotect, "3s 0m");
589   SY(__NR_mprotect, x0+1, x0, x0); FAILx(EINVAL);
590
591   // __NR_sigprocmask 126
592   GO(__NR_sigprocmask, "3s 2m");
593   SY(__NR_sigprocmask, x0, x0+&px[1], x0+&px[1]); SUCC;
594
595   // __NR_create_module 127
596   GO(__NR_create_module, "ni");
597   SY(__NR_create_module); FAIL;
598
599   // __NR_init_module 128
600   GO(__NR_init_module, "3s 2m");
601   SY(__NR_init_module, x0, x0+1, x0); FAIL;
602
603   // __NR_delete_module 129
604   GO(__NR_delete_module, "n/a");
605 //SY(__NR_delete_module); // (Not yet handled by Valgrind) FAIL;
606
607   // __NR_get_kernel_syms 130
608   GO(__NR_get_kernel_syms, "ni");
609   SY(__NR_get_kernel_syms); FAIL;
610
611   // __NR_quotactl 131
612   GO(__NR_quotactl, "4s 1m");
613   SY(__NR_quotactl, x0, x0, x0, x0); FAIL;
614
615   // __NR_getpgid 132
616   GO(__NR_getpgid, "1s 0m");
617   SY(__NR_getpgid, x0-1); FAIL;
618
619   // __NR_fchdir 133
620   GO(__NR_fchdir, "1s 0m");
621   SY(__NR_fchdir, x0-1); FAIL;
622
623   // __NR_bdflush 134
624   GO(__NR_bdflush, "n/a");
625 //SY(__NR_bdflush); // (Not yet handled by Valgrind) FAIL;
626
627   // __NR_sysfs 135
628   GO(__NR_sysfs, "n/a");
629 //SY(__NR_sysfs); // (Not yet handled by Valgrind) FAIL;
630
631   // __NR_personality 136
632   GO(__NR_personality, "1s 0m");
633   SY(__NR_personality, x0+0xffffffff); SUCC;
634
635   // __NR_afs_syscall 137
636   GO(__NR_afs_syscall, "ni");
637   SY(__NR_afs_syscall); FAIL;
638
639   // __NR_setfsuid 138
640   GO(__NR_setfsuid, "1s 0m");
641   SY(__NR_setfsuid, x0); SUCC;  // This syscall has a stupid return value
642
643   // __NR_setfsgid 139
644   GO(__NR_setfsgid, "1s 0m");
645   SY(__NR_setfsgid, x0); SUCC;  // This syscall has a stupid return value
646
647   // __NR__llseek 140
648   GO(__NR__llseek, "5s 1m");
649   SY(__NR__llseek, x0, x0, x0, x0, x0); FAIL;
650
651   // __NR_getdents 141
652   GO(__NR_getdents, "3s 1m");
653   SY(__NR_getdents, x0, x0, x0+1); FAIL;
654
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;
658
659   // __NR_flock 143
660   GO(__NR_flock, "2s 0m");
661   SY(__NR_flock, x0, x0); FAIL;
662
663   // __NR_msync 144
664   GO(__NR_msync, "3s 1m");
665   SY(__NR_msync, x0, x0+1, x0); FAIL;
666
667   // __NR_readv 145
668   GO(__NR_readv, "3s 1m");
669   SY(__NR_readv, x0, x0, x0+1); FAIL;
670
671   // __NR_writev 146
672   GO(__NR_writev, "3s 1m");
673   SY(__NR_writev, x0, x0, x0+1); FAIL;
674
675   // __NR_getsid 147
676   GO(__NR_getsid, "1s 0m");
677   SY(__NR_getsid, x0-1); FAIL;
678
679   // __NR_fdatasync 148
680   GO(__NR_fdatasync, "1s 0m");
681   SY(__NR_fdatasync, x0-1); FAIL;
682
683   // __NR__sysctl 149
684   GO(__NR__sysctl, "1s 1m");
685   SY(__NR__sysctl, x0); FAIL;
686
687   // __NR_mlock 150
688   GO(__NR_mlock, "2s 0m");
689   SY(__NR_mlock, x0, x0+1); FAIL;
690
691   // __NR_munlock 151
692   GO(__NR_munlock, "2s 0m");
693   SY(__NR_munlock, x0, x0+1); FAIL;
694
695   // __NR_mlockall 152
696   GO(__NR_mlockall, "1s 0m");
697   SY(__NR_mlockall, x0-1); FAIL;
698
699   // __NR_munlockall 153
700   GO(__NR_munlockall, "0s 0m");
701   SY(__NR_munlockall); SUCC_OR_FAILx(EPERM);
702
703   // __NR_sched_setparam 154
704   GO(__NR_sched_setparam, "2s 1m");
705   SY(__NR_sched_setparam, x0, x0); FAIL;
706
707   // __NR_sched_getparam 155
708   GO(__NR_sched_getparam, "2s 1m");
709   SY(__NR_sched_getparam, x0, x0); FAIL;
710
711   // __NR_sched_setscheduler 156
712   GO(__NR_sched_setscheduler, "3s 1m");
713   SY(__NR_sched_setscheduler, x0-1, x0, x0+1); FAIL;
714
715   // __NR_sched_getscheduler 157
716   GO(__NR_sched_getscheduler, "1s 0m");
717   SY(__NR_sched_getscheduler, x0-1); FAIL;
718
719   // __NR_sched_yield 158
720   GO(__NR_sched_yield, "0s 0m");
721   SY(__NR_sched_yield); SUCC;
722
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;
726
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;
730
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;
734
735   // __NR_nanosleep 162
736   GO(__NR_nanosleep, "2s 2m");
737   SY(__NR_nanosleep, x0, x0+1); FAIL;
738
739   // __NR_mremap 163
740   GO(__NR_mremap, "5s 0m");
741   SY(__NR_mremap, x0+1, x0, x0, x0+MREMAP_FIXED, x0); FAILx(EINVAL);
742
743   // __NR_setresuid 164
744   GO(__NR_setresuid, "3s 0m");
745   SY(__NR_setresuid, x0, x0, x0); FAIL;
746
747   // __NR_getresuid 165
748   GO(__NR_getresuid, "3s 3m");
749   SY(__NR_getresuid, x0, x0, x0); FAIL;
750
751   // __NR_vm86 166
752   GO(__NR_vm86, "n/a");
753   // (will probably never be handled by Valgrind)
754
755   // __NR_query_module 167
756   GO(__NR_query_module, "ni");
757   SY(__NR_query_module); FAIL;
758
759   // __NR_poll 168
760   GO(__NR_poll, "3s 1m");
761   SY(__NR_poll, x0, x0+1, x0); FAIL;
762
763   // __NR_nfsservctl 169
764   GO(__NR_nfsservctl, "n/a");
765 //SY(__NR_nfsservctl); // (Not yet handled by Valgrind) FAIL;
766
767   // __NR_setresgid 170
768   GO(__NR_setresgid, "3s 0m");
769   SY(__NR_setresgid, x0, x0, x0); FAIL;
770
771   // __NR_getresgid 171
772   GO(__NR_getresgid, "3s 3m");
773   SY(__NR_getresgid, x0, x0, x0); FAIL;
774
775   // __NR_prctl 172
776   GO(__NR_prctl, "5s 0m");
777   SY(__NR_prctl, x0, x0, x0, x0, x0); FAIL;
778
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;
783
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;
788
789   // __NR_rt_sigreturn 173
790   GO(__NR_rt_sigreturn, "n/a");
791 //SY(__NR_rt_sigreturn); // (Not yet handled by Valgrind) FAIL;
792
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;
796
797   // __NR_rt_sigprocmask 175
798   GO(__NR_rt_sigprocmask, "4s 2m");
799   SY(__NR_rt_sigprocmask, x0, x0+1, x0+1, x0); FAIL;
800
801   // __NR_rt_sigpending 176
802   GO(__NR_rt_sigpending, "2s 1m");
803   SY(__NR_rt_sigpending, x0, x0+1); FAIL;
804
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;
808
809   // __NR_rt_sigqueueinfo 178
810   GO(__NR_rt_sigqueueinfo, "3s 1m");
811   SY(__NR_rt_sigqueueinfo, x0, x0+1, x0); FAIL;
812
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);
816
817   // __NR_pread64 180
818   GO(__NR_pread64, "5s 1m");
819   SY(__NR_pread64, x0, x0, x0+1, x0, x0); FAIL;
820
821   // __NR_pwrite64 181
822   GO(__NR_pwrite64, "5s 1m");
823   SY(__NR_pwrite64, x0, x0, x0+1, x0, x0); FAIL;
824
825   // __NR_chown 182
826   GO(__NR_chown, "3s 1m");
827   SY(__NR_chown, x0, x0, x0); FAIL;
828
829   // __NR_getcwd 183
830   GO(__NR_getcwd, "2s 1m");
831   SY(__NR_getcwd, x0, x0+1); FAIL;
832
833   // __NR_capget 184
834   GO(__NR_capget, "2s 2m");
835   SY(__NR_capget, x0, x0+1); FAIL;
836
837   // __NR_capset 185
838   GO(__NR_capset, "2s 2m");
839   SY(__NR_capset, x0, x0); FAIL;
840
841   // __NR_sigaltstack 186
842   {
843      struct our_sigaltstack {
844              void *ss_sp;
845              int ss_flags;
846              size_t ss_size;
847      } ss;
848      ss.ss_sp     = NULL;
849      ss.ss_flags  = 0;
850      ss.ss_size   = 0;
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;
854   }
855
856   // __NR_sendfile 187
857   GO(__NR_sendfile, "4s 1m");
858   SY(__NR_sendfile, x0, x0, x0+1, x0); FAIL;
859
860   // __NR_getpmsg 188
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;
865
866   // __NR_putpmsg 189
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;
871
872   // __NR_vfork 190
873   GO(__NR_vfork, "other");
874   // (sse scalar_vfork.c)
875
876   // __NR_ugetrlimit 191
877   GO(__NR_ugetrlimit, "2s 1m");
878   SY(__NR_ugetrlimit, x0, x0); FAIL;
879
880   // __NR_mmap2 192
881   GO(__NR_mmap2, "6s 0m");
882   SY(__NR_mmap2, x0, x0, x0, x0, x0-1, x0); FAIL;
883
884   // __NR_truncate64 193
885   GO(__NR_truncate64, "3s 1m");
886   SY(__NR_truncate64, x0, x0, x0); FAIL;
887
888   // __NR_ftruncate64 194
889   GO(__NR_ftruncate64, "3s 0m");
890   SY(__NR_ftruncate64, x0, x0, x0); FAIL;
891
892   // __NR_stat64 195
893   GO(__NR_stat64, "2s 2m");
894   SY(__NR_stat64, x0, x0); FAIL;
895
896   // __NR_lstat64 196
897   GO(__NR_lstat64, "2s 2m");
898   SY(__NR_lstat64, x0, x0); FAIL;
899
900   // __NR_fstat64 197
901   GO(__NR_fstat64, "2s 1m");
902   SY(__NR_fstat64, x0, x0); FAIL;
903
904   // __NR_lchown32 198
905   GO(__NR_lchown32, "3s 1m");
906   SY(__NR_lchown32, x0, x0, x0); FAIL;
907
908   // __NR_getuid32 199
909   GO(__NR_getuid32, "0s 0m");
910   SY(__NR_getuid32); SUCC;
911
912   // __NR_getgid32 200
913   GO(__NR_getgid32, "0s 0m");
914   SY(__NR_getgid32); SUCC;
915
916   // __NR_geteuid32 201
917   GO(__NR_geteuid32, "0s 0m");
918   SY(__NR_geteuid32); SUCC;
919
920   // __NR_getegid32 202
921   GO(__NR_getegid32, "0s 0m");
922   SY(__NR_getegid32); SUCC;
923
924   // __NR_setreuid32 203
925   GO(__NR_setreuid32, "2s 0m");
926   SY(__NR_setreuid32, x0, x0); FAIL;
927
928   // __NR_setregid32 204
929   GO(__NR_setregid32, "2s 0m");
930   SY(__NR_setregid32, x0, x0); FAIL;
931
932   // __NR_getgroups32 205
933   GO(__NR_getgroups32, "2s 1m");
934   SY(__NR_getgroups32, x0+1, x0+1); FAIL;
935
936   // __NR_setgroups32 206
937   GO(__NR_setgroups32, "2s 1m");
938   SY(__NR_setgroups32, x0+1, x0+1); FAIL;
939
940   // __NR_fchown32 207
941   GO(__NR_fchown32, "3s 0m");
942   SY(__NR_fchown32, x0, x0, x0); FAIL;
943
944   // __NR_setresuid32 208
945   GO(__NR_setresuid32, "3s 0m");
946   SY(__NR_setresuid32, x0, x0, x0); FAIL;
947
948   // __NR_getresuid32 209
949   GO(__NR_getresuid32, "3s 3m");
950   SY(__NR_getresuid32, x0, x0, x0); FAIL;
951
952   // __NR_setresgid32 210
953   GO(__NR_setresgid32, "3s 0m");
954   SY(__NR_setresgid32, x0, x0, x0); FAIL;
955
956   // __NR_getresgid32 211
957   GO(__NR_getresgid32, "3s 3m");
958   SY(__NR_getresgid32, x0, x0, x0); FAIL;
959
960   // __NR_chown32 212
961   GO(__NR_chown32, "3s 1m");
962   SY(__NR_chown32, x0, x0, x0); FAIL;
963
964   // __NR_setuid32 213
965   GO(__NR_setuid32, "1s 0m");
966   SY(__NR_setuid32, x0); FAIL;
967
968   // __NR_setgid32 214
969   GO(__NR_setgid32, "1s 0m");
970   SY(__NR_setgid32, x0); FAIL;
971
972   // __NR_setfsuid32 215
973   GO(__NR_setfsuid32, "1s 0m");
974   SY(__NR_setfsuid32, x0); SUCC;  // This syscall has a stupid return value
975
976   // __NR_setfsgid32 216
977   GO(__NR_setfsgid32, "1s 0m");
978   SY(__NR_setfsgid32, x0); SUCC;  // This syscall has a stupid return value
979
980   // __NR_pivot_root 217
981   GO(__NR_pivot_root, "n/a");
982 //SY(__NR_pivot_root); // (Not yet handled by Valgrind) FAIL;
983
984   // __NR_mincore 218
985   GO(__NR_mincore, "3s 1m");
986   SY(__NR_mincore, x0, x0+40960, x0); FAIL;
987
988   // __NR_madvise 219
989   GO(__NR_madvise, "3s 0m");
990   SY(__NR_madvise, x0, x0+1, x0); FAILx(ENOMEM);
991
992   // __NR_getdents64 220
993   GO(__NR_getdents64, "3s 1m");
994   SY(__NR_getdents64, x0, x0, x0+1); FAIL;
995
996   // __NR_fcntl64 221
997   // As with sys_open(), we don't trigger errors for the 1st two args for
998   // the later ones.
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);
1002
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);
1006
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
1009   // w/EFAULT.
1010   GO(__NR_fcntl64, "(GETLK) 1s 0m");
1011   SY(__NR_fcntl64, -1, +F_GETLK, x0); FAIL; //FAILx(EBADF);
1012
1013   // 222
1014   GO(222, "ni");
1015   SY(222); FAIL;
1016
1017   // 223
1018   GO(223, "ni");
1019   SY(223); FAIL;
1020
1021   // __NR_gettid 224
1022   GO(__NR_gettid, "n/a");
1023 //SY(__NR_gettid); // (Not yet handled by Valgrind) FAIL;
1024
1025   // __NR_readahead 225
1026   GO(__NR_readahead, "n/a");
1027 //SY(__NR_readahead); // (Not yet handled by Valgrind) FAIL;
1028
1029   // __NR_setxattr 226
1030   GO(__NR_setxattr, "5s 3m");
1031   SY(__NR_setxattr, x0, x0, x0, x0+1, x0); FAIL;
1032
1033   // __NR_lsetxattr 227
1034   GO(__NR_lsetxattr, "5s 3m");
1035   SY(__NR_lsetxattr, x0, x0, x0, x0+1, x0); FAIL;
1036
1037   // __NR_fsetxattr 228
1038   GO(__NR_fsetxattr, "5s 2m");
1039   SY(__NR_fsetxattr, x0, x0, x0, x0+1, x0); FAIL;
1040
1041   // __NR_getxattr 229
1042   GO(__NR_getxattr, "4s 3m");
1043   SY(__NR_getxattr, x0, x0, x0, x0+1); FAIL;
1044
1045   // __NR_lgetxattr 230
1046   GO(__NR_lgetxattr, "4s 3m");
1047   SY(__NR_lgetxattr, x0, x0, x0, x0+1); FAIL;
1048
1049   // __NR_fgetxattr 231
1050   GO(__NR_fgetxattr, "4s 2m");
1051   SY(__NR_fgetxattr, x0, x0, x0, x0+1); FAIL;
1052
1053   // __NR_listxattr 232
1054   GO(__NR_listxattr, "3s 2m");
1055   SY(__NR_listxattr, x0, x0, x0+1); FAIL;
1056
1057   // __NR_llistxattr 233
1058   GO(__NR_llistxattr, "3s 2m");
1059   SY(__NR_llistxattr, x0, x0, x0+1); FAIL;
1060
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 */
1064
1065   // __NR_removexattr 235
1066   GO(__NR_removexattr, "2s 2m");
1067   SY(__NR_removexattr, x0, x0); FAIL;
1068
1069   // __NR_lremovexattr 236
1070   GO(__NR_lremovexattr, "2s 2m");
1071   SY(__NR_lremovexattr, x0, x0); FAIL;
1072
1073   // __NR_fremovexattr 237
1074   GO(__NR_fremovexattr, "2s 1m");
1075   SY(__NR_fremovexattr, x0, x0); FAIL;
1076
1077   // __NR_tkill 238
1078   GO(__NR_tkill, "n/a");
1079 //SY(__NR_tkill); // (Not yet handled by Valgrind) FAIL;
1080
1081   // __NR_sendfile64 239
1082   GO(__NR_sendfile64, "4s 1m");
1083   SY(__NR_sendfile64, x0, x0, x0+1, x0); FAIL;
1084
1085   // __NR_futex 240
1086   #ifndef FUTEX_WAIT
1087   #define FUTEX_WAIT   0
1088   #endif
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;
1092
1093   // __NR_sched_setaffinity 241
1094   GO(__NR_sched_setaffinity, "3s 1m");
1095   SY(__NR_sched_setaffinity, x0, x0+1, x0); FAIL;
1096
1097   // __NR_sched_getaffinity 242
1098   GO(__NR_sched_getaffinity, "3s 1m");
1099   SY(__NR_sched_getaffinity, x0, x0+1, x0); FAIL;
1100
1101   // __NR_set_thread_area 243
1102   GO(__NR_set_thread_area, "1s 1m");
1103   SY(__NR_set_thread_area, x0); FAILx(EFAULT);
1104
1105   // __NR_get_thread_area 244
1106   GO(__NR_get_thread_area, "1s 1m");
1107   SY(__NR_get_thread_area, x0); FAILx(EFAULT);
1108
1109   // __NR_io_setup 245
1110   GO(__NR_io_setup, "2s 1m");
1111   SY(__NR_io_setup, x0, x0); FAIL;
1112
1113   // __NR_io_destroy 246
1114   {
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.
1121      } ring = { 0, 0 };
1122      struct fake_aio_ring* ringptr = &ring;
1123      GO(__NR_io_destroy, "1s 0m");
1124      SY(__NR_io_destroy, x0+&ringptr); FAIL;
1125   }
1126
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;
1130
1131   // __NR_io_submit 248
1132   GO(__NR_io_submit, "3s 1m");
1133   SY(__NR_io_submit, x0, x0+1, x0); FAIL;
1134
1135   // __NR_io_cancel 249
1136   GO(__NR_io_cancel, "3s 2m");
1137   SY(__NR_io_cancel, x0, x0, x0); FAIL;
1138
1139   // __NR_fadvise64 250
1140   GO(__NR_fadvise64, "n/a");
1141 //SY(__NR_fadvise64); // (Not yet handled by Valgrind) FAIL;
1142
1143   // 251
1144   GO(251, "ni");
1145   SY(251); FAIL;
1146
1147   // __NR_exit_group 252
1148   GO(__NR_exit_group, "other");
1149   // (see scalar_exit_group.c)
1150
1151   // __NR_lookup_dcookie 253
1152   GO(__NR_lookup_dcookie, "4s 1m");
1153   SY(__NR_lookup_dcookie, x0, x0, x0, x0+1); FAIL;
1154
1155   // __NR_epoll_create 254
1156   GO(__NR_epoll_create, "1s 0m");
1157   SY(__NR_epoll_create, x0); SUCC_OR_FAIL;
1158
1159   // __NR_epoll_ctl 255
1160   GO(__NR_epoll_ctl, "4s 1m");
1161   SY(__NR_epoll_ctl, x0, x0, x0, x0); FAIL;
1162
1163   // __NR_epoll_wait 256
1164   GO(__NR_epoll_wait, "4s 1m");
1165   SY(__NR_epoll_wait, x0, x0, x0+1, x0); FAIL;
1166
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;
1170
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);
1174
1175   // __NR_timer_create 259
1176   GO(__NR_timer_create, "3s 2m");
1177   SY(__NR_timer_create, x0, x0+1, x0); FAIL;
1178
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;
1182
1183   // __NR_timer_gettime (__NR_timer_create+2)
1184   GO(__NR_timer_gettime, "2s 1m");
1185   SY(__NR_timer_gettime, x0, x0); FAIL;
1186
1187   // __NR_timer_getoverrun (__NR_timer_create+3)
1188   GO(__NR_timer_getoverrun, "1s 0m");
1189   SY(__NR_timer_getoverrun, x0); FAIL;
1190
1191   // __NR_timer_delete (__NR_timer_create+4)
1192   GO(__NR_timer_delete, "1s 0m");
1193   SY(__NR_timer_delete, x0); FAIL;
1194
1195   // __NR_clock_settime (__NR_timer_create+5)
1196   GO(__NR_clock_settime, "2s 1m");
1197   SY(__NR_clock_settime, x0, x0);  FAIL; FAIL;
1198
1199   // __NR_clock_gettime (__NR_timer_create+6)
1200   GO(__NR_clock_gettime, "2s 1m");
1201   SY(__NR_clock_gettime, x0, x0); FAIL;
1202
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;
1206
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;
1210
1211   // __NR_statfs64 268
1212   GO(__NR_statfs64, "3s 2m");
1213   SY(__NR_statfs64, x0, x0+1, x0); FAIL;
1214
1215   // __NR_fstatfs64 269
1216   GO(__NR_fstatfs64, "3s 1m");
1217   SY(__NR_fstatfs64, x0, x0+1, x0); FAIL;
1218
1219   // __NR_tgkill 270
1220   GO(__NR_tgkill, "n/a");
1221 //SY(__NR_tgkill); // (Not yet handled by Valgrind) FAIL;
1222
1223   // __NR_utimes 271
1224   GO(__NR_utimes, "2s 2m");
1225   SY(__NR_utimes, x0, x0+1); FAIL;
1226
1227   // __NR_fadvise64_64 272
1228   GO(__NR_fadvise64_64, "n/a");
1229 //SY(__NR_fadvise64_64); // (Not yet handled by Valgrind) FAIL;
1230
1231   // __NR_vserver 273
1232   GO(__NR_vserver, "ni");
1233   SY(__NR_vserver); FAIL;
1234
1235   // __NR_mbind 274
1236   GO(__NR_mbind, "n/a");
1237 //SY(__NR_mbind); // (Not yet handled by Valgrind) FAIL;
1238
1239   // __NR_get_mempolicy 275
1240   GO(__NR_get_mempolicy, "n/a");
1241 //SY(__NR_get_mempolicy); // (Not yet handled by Valgrind) FAIL;
1242
1243   // __NR_set_mempolicy 276
1244   GO(__NR_set_mempolicy, "n/a");
1245 //SY(__NR_set_mempolicy); // (Not yet handled by Valgrind) FAIL;
1246
1247   // __NR_mq_open 277
1248   GO(__NR_mq_open, "4s 3m");
1249   SY(__NR_mq_open, x0, x0+O_CREAT, x0, x0+1); FAIL;
1250
1251   // __NR_mq_unlink (__NR_mq_open+1)
1252   GO(__NR_mq_unlink, "1s 1m");
1253   SY(__NR_mq_unlink, x0); FAIL;
1254
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;
1258
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;
1262
1263   // __NR_mq_notify (__NR_mq_open+4)
1264   GO(__NR_mq_notify, "2s 1m");
1265   SY(__NR_mq_notify, x0, x0+1); FAIL;
1266
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;
1270
1271   // __NR_sys_kexec_load 283
1272   GO(__NR_sys_kexec_load, "ni");
1273   SY(__NR_sys_kexec_load); FAIL;
1274
1275   // __NR_epoll_create1 329
1276   GO(__NR_epoll_create1, "1s 0m");
1277   SY(__NR_epoll_create1, x0); SUCC_OR_FAIL;
1278
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;
1282
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;
1286
1287   // no such syscall...
1288   GO(9999, "1e");
1289   SY(9999); FAIL;
1290
1291   // __NR_exit 1
1292   GO(__NR_exit, "1s 0m");
1293   SY(__NR_exit, x0); FAIL;
1294
1295   assert(0);
1296}
1297
1298