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