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