Bug 480126 - Build failure on Raspberry Pi 5 / OS 6.1.0-rpi7-rpi-v8
[valgrind.git] / memcheck / tests / darwin / scalar.c
blob225615523b50b294508911bf390a19725405868b
1 #include "../../memcheck.h"
2 #include "scalar.h"
3 #include <unistd.h>
4 #include <sched.h>
5 #include <signal.h>
6 #include <sys/shm.h>
8 // See memcheck/tests/x86-linux/scalar.c for an explanation of what this test
9 // is doing.
11 int main(void)
13 // uninitialised, but we know px[0] is 0x0
14 long* px = malloc(sizeof(long));
15 long x0 = px[0];
16 long res;
18 VALGRIND_MAKE_MEM_NOACCESS(0, 0x1000);
20 // __NR_syscall 0
21 // XXX
23 GO(__NR_exit, 1, "below");
24 // (see below)
26 GO(__NR_fork, 2, "other");
27 // (sse scalar_fork.c)
29 // Nb: here we are also getting an error from the syscall arg itself.
30 GO(__NR_read, 3, "1+3s 1m");
31 SY(__NR_read+(int)x0, x0, x0, x0+1); FAILx(EFAULT);
33 GO(__NR_write, 4, "3s 1m");
34 SY(__NR_write, x0, x0, x0+1); FAIL;
35 //res = write(x0, x0, x0+1); FAIL;
37 GO(__NR_open, 5, "(2-args) 2s 1m");
38 SY(__NR_open, x0, x0); FAIL;
39 // Only 1s 0m errors -- the other 2s 1m have been checked in the previous
40 // open test, and if we test them they may be commoned up but they also
41 // may not.
42 GO(__NR_open, 5, "(3-args) 1s 0m");
43 SY(__NR_open, "scalar.c", O_CREAT|O_EXCL, x0); FAIL;
45 GO(__NR_close, 6, "1s 0m");
46 SY(__NR_close, x0-1); FAIL;
48 GO(__NR_wait4, 7, "4s 2m");
49 SY(__NR_wait4, x0, x0+1, x0, x0+1); FAIL;
51 GO_UNIMP(8, "old creat");
53 GO(__NR_link, 9, "2s 2m");
54 SY(__NR_link, x0, x0); FAIL;
56 GO(__NR_unlink, 10, "1s 1m");
57 SY(__NR_unlink, x0); FAIL;
59 GO_UNIMP(11, "old execv");
61 GO(__NR_chdir, 12, "1s 1m");
62 SY(__NR_chdir, x0); FAIL;
64 GO(__NR_fchdir, 13, "1s 0m");
65 SY(__NR_fchdir, x0-1); FAIL;
67 GO(__NR_mknod, 14, "3s 1m");
68 SY(__NR_mknod, x0, x0, x0); FAIL;
70 GO(__NR_chmod, 15, "2s 1m");
71 SY(__NR_chmod, x0, x0); FAIL;
73 GO(__NR_chown, 16, "3s 1m");
74 SY(__NR_chown, x0, x0, x0); FAIL;
76 GO_UNIMP(17, "old break");
78 GO(__NR_getfsstat, 18, "3s 1m");
79 SY(__NR_getfsstat, x0+1, x0+1, x0); SUCC; // This should fail...
81 GO_UNIMP(19, "old lseek");
83 // __NR_getpid 20
85 GO_UNIMP(21, "old mount");
87 GO_UNIMP(22, "old umount");
89 // __NR_setuid 23
90 // __NR_getuid 24
91 // __NR_geteuid 25
92 // __NR_ptrace 26
93 // __NR_recvmsg 27
94 // __NR_sendmsg 28
95 // __NR_recvfrom 29
96 // __NR_accept 30
97 // __NR_getpeername 31
98 // __NR_getsockname 32
99 // __NR_access 33
100 // __NR_chflags 34
101 // __NR_fchflags 35
102 // __NR_sync 36
103 // __NR_kill 37
105 GO_UNIMP(38, "old stat");
107 // __NR_getppid 39
109 GO_UNIMP(40, "old lstat");
111 // __NR_dup 41
112 // __NR_pipe VG_DARWIN_SYSCALL_CONSTRUCT_UX64(42
113 // __NR_getegid 43
114 // __NR_profil 44
116 GO_UNIMP(45, "old ktrace");
118 // __NR_sigaction 46
119 // __NR_getgid 47
120 // __NR_sigprocmask 48
121 // __NR_getlogin 49
122 // __NR_setlogin 50
123 // __NR_acct 51
124 // __NR_sigpending 52
125 // __NR_sigaltstack 53
126 // __NR_ioctl 54
127 // __NR_reboot 55
128 // __NR_revoke 56
129 // __NR_symlink 57
130 // __NR_readlink 58
131 // __NR_execve 59
132 // __NR_umask 60
133 // __NR_chroot 61
135 GO_UNIMP(62, "old fstat");
137 GO_UNIMP(63, "used internally, reserved");
139 GO_UNIMP(64, "old getpagesize");
141 // __NR_msync 65
142 // __NR_vfork 66
144 GO_UNIMP(67, "old vread");
146 GO_UNIMP(68, "old vwrite");
148 GO_UNIMP(69, "old sbrk");
150 GO_UNIMP(70, "old sstk");
152 GO_UNIMP(71, "old mmap");
154 GO_UNIMP(72, "old vadvise");
156 // __NR_munmap 73
157 // __NR_mprotect 74
158 // __NR_madvise 75
160 GO_UNIMP(76, "old vhangup");
162 GO_UNIMP(77, "old vlimit");
164 GO(__NR_mincore, 78, "3s 1m");
165 SY(__NR_mincore, x0, x0+40960, x0); FAIL;
167 // __NR_getgroups 79
168 // __NR_setgroups 80
169 // __NR_getpgrp 81
171 GO(__NR_setpgid, 82, "2s 0m");
172 SY(__NR_setpgid, x0-1, x0-1); FAIL;
174 // __NR_setitimer 83
176 GO_UNIMP(78, "old wait");
178 // __NR_swapon 85
179 // __NR_getitimer 86
181 GO_UNIMP(87, "old gethostname");
183 GO_UNIMP(88, "old sethostname");
185 // __NR_getdtablesize 89
186 // __NR_dup2 90
188 GO_UNIMP(91, "old getdopt");
190 // __NR_fcntl 92
191 // __NR_select 93
193 GO_UNIMP(94, "old setdopt");
195 // __NR_fsync 95
196 // __NR_setpriority 96
197 // __NR_socket 97
198 // __NR_connect 98
200 GO_UNIMP(99, "old accept");
202 // __NR_getpriority 100
204 GO_UNIMP(101, "old send");
206 GO_UNIMP(102, "old recv");
208 GO_UNIMP(103, "old sigreturn");
210 // __NR_bind 104
212 GO(__NR_setsockopt, 105, "5s 1m");
213 SY(__NR_setsockopt, x0, x0, x0, x0+1, x0+1); FAIL;
215 // __NR_listen 106
217 GO_UNIMP(107, "old vtimes");
219 GO_UNIMP(108, "old sigvec");
221 GO_UNIMP(109, "old sigblock");
223 GO_UNIMP(110, "old sigsetmask");
225 GO(__NR_sigsuspend, 111, "ignore");
226 // (I don't know how to test this...)
228 GO_UNIMP(112, "old sigstack");
230 GO_UNIMP(113, "old recvmsg");
232 GO_UNIMP(114, "old sendmsg");
234 GO_UNIMP(115, "old vtrace");
236 // __NR_gettimeofday 116
237 // __NR_getrusage 117
239 // Nb: there's no "getsockopt(optlen) points to unaddressable byte(s)";
240 // difficult to get with arg4 being checked with buf_and_len_pre_check.
241 GO(__NR_getsockopt, 118, "5s 1m");
242 SY(__NR_getsockopt, x0, x0, x0, x0+1, x0+&px[1]); FAIL;
244 GO_UNIMP(119, "old resuba");
246 // __NR_readv 120
247 // __NR_writev 121
248 // __NR_settimeofday 122
249 // __NR_fchown 123
250 // __NR_fchmod 124
252 GO_UNIMP(125, "old recvfrom");
254 // __NR_setreuid 126
255 // __NR_setregid 127
256 // __NR_rename 128
258 GO_UNIMP(129, "old truncate");
260 GO_UNIMP(130, "old ftruncate");
262 // __NR_flock 131
264 GO(__NR_mkfifo, 132, "2s 1m");
265 SY(__NR_mkfifo, x0, x0); FAIL;
267 // __NR_sendto 133
268 // __NR_shutdown 134
269 // __NR_socketpair 135
270 // __NR_mkdir 136
271 // __NR_rmdir 137
272 // __NR_utimes 138
273 // __NR_futimes 139
274 // __NR_adjtime 140
276 GO_UNIMP(141, "old getpeername");
278 // __NR_gethostuuid 142
280 GO_UNIMP(143, "old sethostid");
282 GO_UNIMP(144, "old getrlimit");
284 GO_UNIMP(145, "old setrlimit");
286 GO_UNIMP(146, "old killpg");
288 // __NR_setsid 147
290 GO_UNIMP(148, "old setquota");
292 GO_UNIMP(149, "old qquota");
294 GO_UNIMP(150, "old getsockname");
296 // __NR_getpgid 151
297 // __NR_setprivexec 152
298 // __NR_pread 153
299 // __NR_pwrite 154
300 // __NR_nfssvc 155
302 GO_UNIMP(156, "old getdirentries");
304 // __NR_statfs 157
305 // __NR_fstatfs 158
306 // __NR_unmount 159
308 GO_UNIMP(160, "old async_daemon");
310 // __NR_getfh 161
312 GO_UNIMP(162, "old getdomainname");
314 GO_UNIMP(163, "old setdomainname");
316 // /* 164 */
318 // __NR_quotactl 165
320 GO_UNIMP(166, "old exportfs");
322 GO(__NR_mount, 167, "4s 2m");
323 SY(__NR_mount, x0, x0, x0, x0); FAIL;
325 GO_UNIMP(168, "old ustat");
327 GO(__NR_csops, 169, "4s 1m");
328 SY(__NR_csops, x0, x0, x0+1, x0+1); FAILx(EFAULT);
330 GO_UNIMP(170, "old table");
332 GO_UNIMP(171, "old wait3");
334 GO_UNIMP(172, "old rpause");
336 // __NR_waitid 173
338 GO_UNIMP(174, "old getdents");
340 GO_UNIMP(175, "old gc_control");
342 // __NR_add_profil 176
344 GO_UNIMP(177-179, "unused");
346 // __NR_kdebug_trace 180
347 // __NR_setgid 181
348 // __NR_setegid 182
349 // __NR_seteuid 183
350 // __NR_sigreturn 184
351 // __NR_chud 185
353 GO_UNIMP(186-187, "unused");
355 // __NR_stat 188
356 // __NR_fstat 189
357 // __NR_lstat 190
358 // __NR_pathconf 191
359 // __NR_fpathconf 192
361 GO_UNIMP(193, "unused");
363 // __NR_getrlimit 194
364 // __NR_setrlimit 195
365 // __NR_getdirentries 196
366 // __NR_mmap 197
368 // /* 198 __syscall */
370 // __NR_lseek VG_DARWIN_SYSCALL_CONSTRUCT_UX64(199
371 // __NR_truncate 200
372 // __NR_ftruncate 201
373 // __NR___sysctl 202
374 // __NR_mlock 203
375 // __NR_munlock 204
376 // __NR_undelete 205
377 // __NR_ATsocket 206
378 // __NR_ATgetmsg 207
379 // __NR_ATputmsg 208
380 // __NR_ATPsndreq 209
381 // __NR_ATPsndrsp 210
382 // __NR_ATPgetreq 211
383 // __NR_ATPgetrsp 212
385 GO_UNIMP(213, "reserved for AppleTalk");
387 // __NR_kqueue_from_portset_np 214
388 // __NR_kqueue_portset_np 215
389 // __NR_mkcomplex 216
390 // __NR_statv 217
391 // __NR_lstatv 218
392 // __NR_fstatv 219
393 // __NR_getattrlist 220
394 // __NR_setattrlist 221
395 // __NR_getdirentriesattr 222
397 GO(__NR_exchangedata, 223, "3s 2m");
398 SY(__NR_exchangedata, x0, x0, x0); FAIL;
400 // /* 224 checkuseraccess */
402 // __NR_searchfs 225
403 // __NR_delete 226
404 // __NR_copyfile 227
406 GO_UNIMP(228-229, "unused");
408 // __NR_poll 230
409 // __NR_watchevent 231
410 // __NR_waitevent 232
411 // __NR_modwatch 233
412 // __NR_getxattr 234
413 // __NR_fgetxattr 235
414 // __NR_setxattr 236
415 // __NR_fsetxattr 237
416 // __NR_removexattr 238
417 // __NR_fremovexattr 239
418 // __NR_listxattr 240
419 // __NR_flistxattr 241
420 // __NR_fsctl 242
421 // __NR_initgroups 243
422 // __NR_posix_spawn 244
424 GO_UNIMP(245-246, "unused");
426 // __NR_nfsclnt 247
427 // __NR_fhopen 248
429 GO_UNIMP(249, "unused");
431 // __NR_minherit 250
432 // __NR_semsys 251
433 // __NR_msgsys 252
434 // __NR_shmsys 253
435 // __NR_semctl 254
436 // __NR_semget 255
437 // __NR_semop 256
439 GO_UNIMP(257, "unused");
441 // __NR_msgctl 258
442 // __NR_msgget 259
443 // __NR_msgsnd 260
444 // __NR_msgrcv 261
446 GO(__NR_shmat, 262, "3s 0m");
447 SY(__NR_shmat, x0, x0, x0); FAIL;
449 GO(__NR_shmctl, 263, "3s 1m");
450 SY(__NR_shmctl, x0, x0+IPC_STAT, x0+1); FAIL;
452 GO(__NR_shmdt, 264, "1s 0m");
453 SY(__NR_shmdt, x0); FAIL;
455 GO(__NR_shmget, 265, "3s 0m");
456 SY(__NR_shmget, x0, x0, x0); FAIL;
458 // __NR_shm_open 266
459 // __NR_shm_unlink 267
461 GO(__NR_sem_open, 268, "2s 1m");
462 SY(__NR_sem_open, x0, x0); FAIL;
464 GO(__NR_sem_open, 268, "(4-args) 2s 0m");
465 SY(__NR_sem_open, "my_sem", O_CREAT|O_EXCL, x0, x0); SUCC_OR_FAIL;
467 // Nb: we add 0x12345 to make sure it's not a valid semaphore descriptor.
468 GO(__NR_sem_close, 269, "1s 0m");
469 SY(__NR_sem_close, x0+0x12345); FAIL;
471 GO(__NR_sem_unlink, 270, "1s 1m");
472 SY(__NR_sem_unlink, x0); FAIL;
474 GO(__NR_sem_wait, 271, "1s 0m");
475 SY(__NR_sem_wait, x0); FAIL;
477 GO(__NR_sem_trywait, 272, "1s 0m");
478 SY(__NR_sem_trywait, x0); FAIL;
480 GO(__NR_sem_post, 273, "1s 0m");
481 SY(__NR_sem_post, x0); FAIL;
483 // __NR_sem_getvalue 274
485 GO(__NR_sem_init, 275, "3s 1m");
486 SY(__NR_sem_init, x0+1, x0, x0); FAILx(ENOSYS);
488 GO(__NR_sem_destroy, 276, "1s 1m");
489 SY(__NR_sem_destroy, x0+1); FAILx(ENOSYS);
491 // __NR_open_extended 277
492 // __NR_umask_extended 278
495 size_t one = 1;
496 GO(__NR_stat_extended, 279, "4s 4m");
497 SY(__NR_stat_extended, x0, x0, x0, x0); FAIL;
498 // Go again to get a complaint about where the 3rd arg points; it
499 // requires the 4th arg to point to a valid value.
500 SY(__NR_stat_extended, 0, 0, 0, &one); FAIL;
502 GO(__NR_lstat_extended, 280, "4s 4m");
503 SY(__NR_lstat_extended, x0, x0, x0, x0); FAIL;
504 // Go again to get a complaint about where the 3rd arg points; it
505 // requires the 4th arg to point to a valid value.
506 SY(__NR_lstat_extended, 0, 0, 0, &one); FAIL;
508 GO(__NR_fstat_extended, 280, "4s 3m");
509 SY(__NR_fstat_extended, x0, x0, x0, x0); FAIL;
510 // Go again to get a complaint about where the 3rd arg points; it
511 // requires the 4th arg to point to a valid value.
512 SY(__NR_fstat_extended, 0, 0, 0, &one); FAIL;
515 // __NR_chmod_extended 282
516 // __NR_fchmod_extended 283
518 // XXX: we don't check the 'results' (too hard, see the wrapper code). If
519 // we did, it would be 2m.
520 GO(__NR_access_extended, 284, "4s 1m");
521 SY(__NR_access_extended, x0, x0+1, x0, x0); FAIL;
523 // __NR_settid 285
524 // __NR_gettid 286
525 // __NR_setsgroups 287
526 // __NR_getsgroups 288
527 // __NR_setwgroups 289
528 // __NR_getwgroups 290
529 // __NR_mkfifo_extended 291
530 // __NR_mkdir_extended 292
531 // __NR_identitysvc 293
532 // __NR_shared_region_check_np 294
533 // __NR_shared_region_map_np 295
535 GO_UNIMP(296, "old load_shared_file");
537 GO_UNIMP(297, "old reset_shared_file");
539 GO_UNIMP(298, "old new_system_shared_regions");
541 GO_UNIMP(299, "old shared_region_map_file_np");
543 GO_UNIMP(300, "old shared_region_make_private_np");
545 // __NR___pthread_mutex_destroy 301
546 // __NR___pthread_mutex_init 302
547 // __NR___pthread_mutex_lock 303
548 // __NR___pthread_mutex_trylock 304
549 // __NR___pthread_mutex_unlock 305
550 // __NR___pthread_cond_init 306
551 // __NR___pthread_cond_destroy 307
552 // __NR___pthread_cond_broadcast 308
553 // __NR___pthread_cond_signal 309
554 // __NR_getsid 310
555 // __NR_settid_with_pid 311
556 // __NR___pthread_cond_timedwait 312
557 // __NR_aio_fsync 313
559 GO(__NR_aio_return, 314, "1s 0m");
560 SY(__NR_aio_return, x0); FAIL;
562 GO(__NR_aio_suspend, 315, "1s 0m");
563 SY(__NR_aio_suspend, x0, x0+1, x0); FAIL;
565 // __NR_aio_cancel 316
567 GO(__NR_aio_error, 317, "1s 0m");
568 SY(__NR_aio_error, x0); FAIL;
570 GO(__NR_aio_read, 318, "1s 1m");
571 SY(__NR_aio_read, x0); FAIL;
573 GO(__NR_aio_write, 319, "1s 1m");
574 SY(__NR_aio_write, x0); FAIL;
576 // __NR_lio_listio 320
577 // __NR___pthread_cond_wait 321
578 // __NR_iopolicysys 322
580 GO_UNIMP(323, "unused");
582 // __NR_mlockall 324
583 // __NR_munlockall 325
585 GO_UNIMP(326, "unused");
587 // __NR_issetugid 327
589 GO(__NR___pthread_kill, 328, "2s 0m");
590 SY(__NR___pthread_kill, x0, x0); FAIL;
592 GO(__NR___pthread_sigmask, 329, "3s 0m");
593 SY(__NR___pthread_sigmask, x0, x0, x0); SUCC;
595 // __NR___sigwait 330
596 // __NR_sigwait 330) // GrP fixme hack
597 // __NR___disable_threadsignal 331
598 // __NR___pthread_markcancel 332
599 // __NR___pthread_canceled 333
600 // __NR___semwait_signal 334
602 GO_UNIMP(335, "old utrace");
604 // __NR_proc_info 336
605 // __NR_sendfile 337
606 // __NR_stat64 338
607 // __NR_fstat64 339
608 // __NR_lstat64 340
611 size_t one = 1;
612 GO(__NR_stat64_extended, 341, "4s 4m");
613 SY(__NR_stat64_extended, x0, x0, x0, x0); FAIL;
614 // Go again to get a complaint about where the 3rd arg points; it
615 // requires the 4th arg to point to a valid value.
616 SY(__NR_stat64_extended, 0, 0, 0, &one); FAIL;
618 GO(__NR_lstat64_extended, 342, "4s 4m");
619 SY(__NR_lstat64_extended, x0, x0, x0, x0); FAIL;
620 // Go again to get a complaint about where the 3rd arg points; it
621 // requires the 4th arg to point to a valid value.
622 SY(__NR_lstat64_extended, 0, 0, 0, &one); FAIL;
624 GO(__NR_fstat64_extended, 342, "4s 3m");
625 SY(__NR_fstat64_extended, x0, x0, x0, x0); FAIL;
626 // Go again to get a complaint about where the 3rd arg points; it
627 // requires the 4th arg to point to a valid value.
628 SY(__NR_fstat64_extended, 0, 0, 0, &one); FAIL;
631 // __NR_fstat64_extended 343
632 // __NR_getdirentries64 344
633 // __NR_statfs64 345
634 // __NR_fstatfs64 346
636 GO(__NR_getfsstat64, 347, "3s 1m");
637 SY(__NR_getfsstat64, x0+1, x0+1, x0); SUCC; // This should fail...
639 // __NR___pthread_chdir 348
640 // __NR___pthread_fchdir 349
641 // __NR_audit 350
642 // __NR_auditon 351
644 // /* 352 */
646 // __NR_getauid 353
647 // __NR_setauid 354
648 // __NR_getaudit 355
649 // __NR_setaudit 356
650 // __NR_getaudit_addr 357
651 // __NR_setaudit_addr 358
652 // __NR_auditctl 359
653 // __NR_bsdthread_create 360
654 // __NR_bsdthread_terminate 361
655 // __NR_kqueue 362
656 // __NR_kevent 363
657 // __NR_lchown 364
658 // __NR_stack_snapshot 365
659 // __NR_bsdthread_register 366
660 // __NR_workq_open 367
661 // __NR_workq_ops 368
663 GO_UNIMP(369-373, "unused");
665 #if DARWIN_VERS >= DARWIN_10_11
667 long args[8] = { x0+8, x0+0xffffffee, x0+1, x0+1, x0+1, x0+1, x0+1, x0+1 };
668 GO(__NR_kevent_qos, 374, "1s 8m");
669 SY(__NR_kevent_qos, args+x0); FAIL;
671 #endif /* DARWIN_VERS >= DARWIN_10_11 */
673 GO_UNIMP(375-379, "unused");
675 // __NR___mac_execve 380
676 // __NR___mac_syscall 381
677 // __NR___mac_get_file 382
678 // __NR___mac_set_file 383
679 // __NR___mac_get_link 384
680 // __NR___mac_set_link 385
681 // __NR___mac_get_proc 386
682 // __NR___mac_set_proc 387
683 // __NR___mac_get_fd 388
684 // __NR___mac_set_fd 389
685 // __NR___mac_get_pid 390
686 // __NR___mac_get_lcid 391
687 // __NR___mac_get_lctx 392
688 // __NR___mac_set_lctx 393
690 #if DARWIN_VERS >= DARWIN_10_11
692 long args[6] = { x0+8, x0+0xffffffee, x0+1, x0+1, x0+1, x0+1 };
693 GO(__NR_pselect, 394, "1s 6m");
694 SY(__NR_pselect, args+x0); FAIL;
696 #else
697 // __NR_setlcid 394
698 #endif /* DARWIN_VERS >= DARWIN_10_11 */
700 // __NR_getlcid 395
702 // The nocancel syscalls (396--423) are tested in scalar_nocancel.c.
704 // __NR___mac_mount 424
705 // __NR___mac_get_mount 425
706 // __NR___mac_getfsstat 426
707 // __NR_MAXSYSCALL 427
709 #if 0
710 // XXX: all these are copied from x86-linux/scalar.c.
712 // __NR_creat 8
713 GO(__NR_creat, "2s 1m");
714 SY(__NR_creat, x0, x0); FAIL;
716 // __NR_execve 11
717 // Nb: could have 3 memory errors if we pass x0+1 as the 2nd and 3rd
718 // args, except for bug #93174.
719 GO(__NR_execve, "3s 1m");
720 SY(__NR_execve, x0, x0, x0); FAIL;
722 // __NR_time 13
723 GO(__NR_time, "1s 1m");
724 SY(__NR_time, x0+1); FAIL;
726 // __NR_lchown 16
727 GO(__NR_lchown, "n/a");
728 //SY(__NR_lchown); // (Not yet handled by Valgrind) FAIL;
730 // __NR_break 17
731 GO(__NR_break, "ni");
732 SY(__NR_break); FAIL;
734 // __NR_oldstat 18
735 GO(__NR_oldstat, "n/a");
736 // (obsolete, not handled by Valgrind)
738 // __NR_lseek 19
739 GO(__NR_lseek, "3s 0m");
740 SY(__NR_lseek, x0-1, x0, x0); FAILx(EBADF);
742 // __NR_getpid 20
743 GO(__NR_getpid, "0s 0m");
744 SY(__NR_getpid); SUCC;
746 // __NR_mount 21
747 GO(__NR_mount, "5s 3m");
748 SY(__NR_mount, x0, x0, x0, x0, x0); FAIL;
750 // __NR_umount 22
751 GO(__NR_umount, "1s 1m");
752 SY(__NR_umount, x0); FAIL;
754 // __NR_setuid 23
755 GO(__NR_setuid, "1s 0m");
756 SY(__NR_setuid, x0); FAIL;
758 // __NR_getuid 24
759 GO(__NR_getuid, "0s 0m");
760 SY(__NR_getuid); SUCC;
762 // __NR_stime 25
763 GO(__NR_stime, "n/a");
764 //SY(__NR_stime); // (Not yet handled by Valgrind) FAIL;
766 // __NR_ptrace 26
767 // XXX: memory pointed to by arg3 goes unchecked... otherwise would be 2m
768 GO(__NR_ptrace, "4s 1m");
769 SY(__NR_ptrace, x0+PTRACE_GETREGS, x0, x0, x0); FAIL;
771 // __NR_alarm 27
772 GO(__NR_alarm, "1s 0m");
773 SY(__NR_alarm, x0); SUCC;
775 // __NR_oldfstat 28
776 GO(__NR_oldfstat, "n/a");
777 // (obsolete, not handled by Valgrind)
779 // __NR_pause 29
780 GO(__NR_pause, "ignore");
781 // (hard to test, and no args so not much to be gained -- don't bother)
783 // __NR_utime 30
784 GO(__NR_utime, "2s 2m");
785 SY(__NR_utime, x0, x0+1); FAIL;
787 // __NR_stty 31
788 GO(__NR_stty, "ni");
789 SY(__NR_stty); FAIL;
791 // __NR_gtty 32
792 GO(__NR_gtty, "ni");
793 SY(__NR_gtty); FAIL;
795 // __NR_access 33
796 GO(__NR_access, "2s 1m");
797 SY(__NR_access, x0, x0); FAIL;
799 // __NR_nice 34
800 GO(__NR_nice, "1s 0m");
801 SY(__NR_nice, x0); SUCC;
803 // __NR_ftime 35
804 GO(__NR_ftime, "ni");
805 SY(__NR_ftime); FAIL;
807 // __NR_sync 36
808 GO(__NR_sync, "0s 0m");
809 SY(__NR_sync); SUCC;
811 // __NR_kill 37
812 GO(__NR_kill, "2s 0m");
813 SY(__NR_kill, x0, x0); SUCC;
815 // __NR_rename 38
816 GO(__NR_rename, "2s 2m");
817 SY(__NR_rename, x0, x0); FAIL;
819 // __NR_mkdir 39
820 GO(__NR_mkdir, "2s 1m");
821 SY(__NR_mkdir, x0, x0); FAIL;
823 // __NR_rmdir 40
824 GO(__NR_rmdir, "1s 1m");
825 SY(__NR_rmdir, x0); FAIL;
827 // __NR_dup 41
828 GO(__NR_dup, "1s 0m");
829 SY(__NR_dup, x0-1); FAIL;
831 // __NR_pipe 42
832 GO(__NR_pipe, "1s 1m");
833 SY(__NR_pipe, x0); FAIL;
835 // __NR_times 43
836 GO(__NR_times, "1s 1m");
837 SY(__NR_times, x0+1); FAIL;
839 // __NR_prof 44
840 GO(__NR_prof, "ni");
841 SY(__NR_prof); FAIL;
843 // __NR_brk 45
844 GO(__NR_brk, "1s 0m");
845 SY(__NR_brk, x0); SUCC;
847 // __NR_setgid 46
848 GO(__NR_setgid, "1s 0m");
849 SY(__NR_setgid, x0); FAIL;
851 // __NR_getgid 47
852 GO(__NR_getgid, "0s 0m");
853 SY(__NR_getgid); SUCC;
855 // __NR_signal 48
856 GO(__NR_signal, "n/a");
857 //SY(__NR_signal); // (Not yet handled by Valgrind) FAIL;
859 // __NR_geteuid 49
860 GO(__NR_geteuid, "0s 0m");
861 SY(__NR_geteuid); SUCC;
863 // __NR_getegid 50
864 GO(__NR_getegid, "0s 0m");
865 SY(__NR_getegid); SUCC;
867 // __NR_acct 51
868 GO(__NR_acct, "1s 1m");
869 SY(__NR_acct, x0); FAIL;
871 // __NR_umount2 52
872 GO(__NR_umount2, "2s 1m");
873 SY(__NR_umount2, x0, x0); FAIL;
875 // __NR_lock 53
876 GO(__NR_lock, "ni");
877 SY(__NR_lock); FAIL;
879 // __NR_ioctl 54
880 #include <asm/ioctls.h>
881 GO(__NR_ioctl, "3s 1m");
882 SY(__NR_ioctl, x0, x0+TCSETS, x0); FAIL;
884 // __NR_fcntl 55
885 // As with sys_open(), the 'fd' error is suppressed for the later ones.
886 // For F_GETFD the 3rd arg is ignored
887 GO(__NR_fcntl, "(GETFD) 2s 0m");
888 SY(__NR_fcntl, x0-1, x0+F_GETFD, x0); FAILx(EBADF);
890 // For F_DUPFD the 3rd arg is 'arg'. We don't check the 1st two args
891 // because any errors may or may not be commoned up with the ones from
892 // the previous fcntl call.
893 GO(__NR_fcntl, "(DUPFD) 1s 0m");
894 SY(__NR_fcntl, -1, F_DUPFD, x0); FAILx(EBADF);
896 // For F_GETLK the 3rd arg is 'lock'. On x86, this fails w/EBADF. But
897 // on amd64 in 32-bit mode it fails w/EFAULT. We don't check the 1st two
898 // args for the reason given above.
899 GO(__NR_fcntl, "(GETLK) 1s 0m");
900 SY(__NR_fcntl, -1, F_GETLK, x0); FAIL; //FAILx(EBADF);
902 // __NR_mpx 56
903 GO(__NR_mpx, "ni");
904 SY(__NR_mpx); FAIL;
906 // __NR_setpgid 57
907 GO(__NR_setpgid, "2s 0m");
908 SY(__NR_setpgid, x0, x0-1); FAIL;
910 // __NR_ulimit 58
911 GO(__NR_ulimit, "ni");
912 SY(__NR_ulimit); FAIL;
914 // __NR_oldolduname 59
915 GO(__NR_oldolduname, "n/a");
916 // (obsolete, not handled by Valgrind)
918 // __NR_umask 60
919 GO(__NR_umask, "1s 0m");
920 SY(__NR_umask, x0+022); SUCC;
922 // __NR_chroot 61
923 GO(__NR_chroot, "1s 1m");
924 SY(__NR_chroot, x0); FAIL;
926 // __NR_ustat 62
927 GO(__NR_ustat, "n/a");
928 // (deprecated, not handled by Valgrind)
930 // __NR_dup2 63
931 GO(__NR_dup2, "2s 0m");
932 SY(__NR_dup2, x0-1, x0); FAIL;
934 // __NR_getppid 64
935 GO(__NR_getppid, "0s 0m");
936 SY(__NR_getppid); SUCC;
938 // __NR_getpgrp 65
939 GO(__NR_getpgrp, "0s 0m");
940 SY(__NR_getpgrp); SUCC;
942 // __NR_setsid 66
943 GO(__NR_setsid, "0s 0m");
944 SY(__NR_setsid); SUCC_OR_FAIL;
946 // __NR_sigaction 67
947 GO(__NR_sigaction, "3s 4m");
948 SY(__NR_sigaction, x0, x0+&px[1], x0+&px[1]); FAIL;
950 // __NR_sgetmask 68 sys_sgetmask()
951 GO(__NR_sgetmask, "n/a");
952 //SY(__NR_sgetmask); // (Not yet handled by Valgrind) FAIL;
954 // __NR_ssetmask 69
955 GO(__NR_ssetmask, "n/a");
956 //SY(__NR_ssetmask); // (Not yet handled by Valgrind) FAIL;
958 // __NR_setreuid 70
959 GO(__NR_setreuid, "2s 0m");
960 SY(__NR_setreuid, x0, x0); FAIL;
962 // __NR_setregid 71
963 GO(__NR_setregid, "2s 0m");
964 SY(__NR_setregid, x0, x0); FAIL;
966 // __NR_sigsuspend 72
967 // XXX: how do you use this function?
968 GO(__NR_sigsuspend, "ignore");
969 // (I don't know how to test this...)
971 // __NR_sigpending 73
972 GO(__NR_sigpending, "1s 1m");
973 SY(__NR_sigpending, x0); FAIL;
975 // __NR_sethostname 74
976 GO(__NR_sethostname, "n/a");
977 //SY(__NR_sethostname); // (Not yet handled by Valgrind) FAIL;
979 // __NR_setrlimit 75
980 GO(__NR_setrlimit, "2s 1m");
981 SY(__NR_setrlimit, x0, x0); FAIL;
983 // __NR_getrlimit 76
984 GO(__NR_getrlimit, "2s 1m");
985 SY(__NR_getrlimit, x0, x0); FAIL;
987 // __NR_getrusage 77
988 GO(__NR_getrusage, "2s 1m");
989 SY(__NR_getrusage, x0, x0); FAIL;
991 // __NR_gettimeofday 78
992 GO(__NR_gettimeofday, "2s 2m");
993 SY(__NR_gettimeofday, x0, x0+1); FAIL;
995 // __NR_settimeofday 79
996 GO(__NR_settimeofday, "2s 2m");
997 SY(__NR_settimeofday, x0, x0+1); FAIL;
999 // __NR_getgroups 80
1000 GO(__NR_getgroups, "2s 1m");
1001 SY(__NR_getgroups, x0+1, x0+1); FAIL;
1003 // __NR_setgroups 81
1004 GO(__NR_setgroups, "2s 1m");
1005 SY(__NR_setgroups, x0+1, x0+1); FAIL;
1007 // __NR_select 82
1009 long args[5] = { x0+8, x0+0xffffffee, x0+1, x0+1, x0+1 };
1010 GO(__NR_select, "1s 5m");
1011 SY(__NR_select, args+x0); FAIL;
1014 // __NR_symlink 83
1015 GO(__NR_symlink, "2s 2m");
1016 SY(__NR_symlink, x0, x0); FAIL;
1018 // __NR_oldlstat 84
1019 GO(__NR_oldlstat, "n/a");
1020 // (obsolete, not handled by Valgrind)
1022 // __NR_readlink 85
1023 GO(__NR_readlink, "3s 2m");
1024 SY(__NR_readlink, x0+1, x0+1, x0+1); FAIL;
1026 // __NR_uselib 86
1027 GO(__NR_uselib, "n/a");
1028 //SY(__NR_uselib); // (Not yet handled by Valgrind) FAIL;
1030 // __NR_swapon 87
1031 GO(__NR_swapon, "n/a");
1032 //SY(__NR_swapon); // (Not yet handled by Valgrind) FAIL;
1034 // __NR_reboot 88
1035 GO(__NR_reboot, "n/a");
1036 //SY(__NR_reboot); // (Not yet handled by Valgrind) FAIL;
1038 // __NR_readdir 89
1039 GO(__NR_readdir, "n/a");
1040 // (superseded, not handled by Valgrind)
1042 // __NR_mmap 90
1044 long args[6] = { x0, x0, x0, x0, x0-1, x0 };
1045 GO(__NR_mmap, "1s 1m");
1046 SY(__NR_mmap, args+x0); FAIL;
1049 // __NR_munmap 91
1050 GO(__NR_munmap, "2s 0m");
1051 SY(__NR_munmap, x0, x0); FAIL;
1053 // __NR_truncate 92
1054 GO(__NR_truncate, "2s 1m");
1055 SY(__NR_truncate, x0, x0); FAIL;
1057 // __NR_ftruncate 93
1058 GO(__NR_ftruncate, "2s 0m");
1059 SY(__NR_ftruncate, x0, x0); FAIL;
1061 // __NR_fchmod 94
1062 GO(__NR_fchmod, "2s 0m");
1063 SY(__NR_fchmod, x0-1, x0); FAIL;
1065 // __NR_fchown 95
1066 GO(__NR_fchown, "3s 0m");
1067 SY(__NR_fchown, x0, x0, x0); FAIL;
1069 // __NR_getpriority 96
1070 GO(__NR_getpriority, "2s 0m");
1071 SY(__NR_getpriority, x0-1, x0); FAIL;
1073 // __NR_setpriority 97
1074 GO(__NR_setpriority, "3s 0m");
1075 SY(__NR_setpriority, x0-1, x0, x0); FAIL;
1077 // __NR_profil 98
1078 GO(__NR_profil, "ni");
1079 SY(__NR_profil); FAIL;
1081 // __NR_statfs 99
1082 GO(__NR_statfs, "2s 2m");
1083 SY(__NR_statfs, x0, x0); FAIL;
1085 // __NR_fstatfs 100
1086 GO(__NR_fstatfs, "2s 1m");
1087 SY(__NR_fstatfs, x0, x0); FAIL;
1089 // __NR_ioperm 101
1090 GO(__NR_ioperm, "3s 0m");
1091 SY(__NR_ioperm, x0, x0, x0); FAIL;
1093 // __NR_socketcall 102
1094 GO(__NR_socketcall, "XXX");
1095 // (XXX: need to do all sub-cases properly)
1097 // __NR_syslog 103
1098 GO(__NR_syslog, "3s 1m");
1099 SY(__NR_syslog, x0+2, x0, x0+1); FAIL;
1101 // __NR_setitimer 104
1102 GO(__NR_setitimer, "3s 2m");
1103 SY(__NR_setitimer, x0, x0+1, x0+1); FAIL;
1105 // __NR_getitimer 105
1106 GO(__NR_getitimer, "2s 1m");
1107 SY(__NR_getitimer, x0, x0, x0); FAIL;
1109 // __NR_stat 106
1110 GO(__NR_stat, "2s 2m");
1111 SY(__NR_stat, x0, x0); FAIL;
1113 // __NR_lstat 107
1114 GO(__NR_lstat, "2s 2m");
1115 SY(__NR_lstat, x0, x0); FAIL;
1117 // __NR_fstat 108
1118 GO(__NR_fstat, "2s 1m");
1119 SY(__NR_fstat, x0, x0); FAIL;
1121 // __NR_olduname 109
1122 GO(__NR_olduname, "n/a");
1123 // (obsolete, not handled by Valgrind)
1125 // __NR_iopl 110
1126 GO(__NR_iopl, "1s 0m");
1127 SY(__NR_iopl, x0+100); FAIL;
1129 // __NR_vhangup 111
1130 GO(__NR_vhangup, "0s 0m");
1131 SY(__NR_vhangup); SUCC_OR_FAIL; // Will succeed for superuser
1133 // __NR_idle 112
1134 GO(__NR_idle, "ni");
1135 SY(__NR_idle); FAIL;
1137 // __NR_vm86old 113
1138 GO(__NR_vm86old, "n/a");
1139 // (will probably never be handled by Valgrind)
1141 // __NR_swapoff 115
1142 GO(__NR_swapoff, "n/a");
1143 //SY(__NR_swapoff); // (Not yet handled by Valgrind) FAIL;
1145 // __NR_sysinfo 116
1146 GO(__NR_sysinfo, "1s 1m");
1147 SY(__NR_sysinfo, x0); FAIL;
1149 // __NR_ipc 117
1150 // XXX: This is simplistic -- need to do all the sub-cases properly.
1151 // XXX: Also, should be 6 scalar errors, except glibc's syscall() doesn't
1152 // use the 6th one!
1153 GO(__NR_ipc, "5s 0m");
1154 SY(__NR_ipc, x0+4, x0, x0, x0, x0, x0); FAIL;
1156 // __NR_fsync 118
1157 GO(__NR_fsync, "1s 0m");
1158 SY(__NR_fsync, x0-1); FAIL;
1160 // __NR_sigreturn 119
1161 GO(__NR_sigreturn, "n/a");
1162 //SY(__NR_sigreturn); // (Not yet handled by Valgrind) FAIL;
1164 // __NR_clone 120
1165 #ifndef CLONE_PARENT_SETTID
1166 #define CLONE_PARENT_SETTID 0x00100000
1167 #endif
1168 // XXX: should really be "4s 2m"? Not sure... (see PRE(sys_clone))
1169 GO(__NR_clone, "4s 0m");
1170 SY(__NR_clone, x0|CLONE_PARENT_SETTID|SIGCHLD, x0, x0, x0); FAIL;
1171 if (0 == res) {
1172 SY(__NR_exit, 0); FAIL;
1175 // __NR_setdomainname 121
1176 GO(__NR_setdomainname, "n/a");
1177 //SY(__NR_setdomainname); // (Not yet handled by Valgrind) FAIL;
1179 // __NR_uname 122
1180 GO(__NR_uname, "1s 1m");
1181 SY(__NR_uname, x0); FAIL;
1183 // __NR_modify_ldt 123
1184 GO(__NR_modify_ldt, "3s 1m");
1185 SY(__NR_modify_ldt, x0+1, x0, x0+1); FAILx(EINVAL);
1187 // __NR_adjtimex 124
1188 // XXX: need to do properly, but deref'ing NULL causing Valgrind to crash...
1189 GO(__NR_adjtimex, "XXX");
1190 // SY(__NR_adjtimex, x0); FAIL;
1192 // __NR_mprotect 125
1193 GO(__NR_mprotect, "3s 0m");
1194 SY(__NR_mprotect, x0+1, x0, x0); FAILx(EINVAL);
1196 // __NR_sigprocmask 126
1197 GO(__NR_sigprocmask, "3s 2m");
1198 SY(__NR_sigprocmask, x0, x0+&px[1], x0+&px[1]); SUCC;
1200 // __NR_create_module 127
1201 GO(__NR_create_module, "ni");
1202 SY(__NR_create_module); FAIL;
1204 // __NR_init_module 128
1205 GO(__NR_init_module, "3s 2m");
1206 SY(__NR_init_module, x0, x0+1, x0); FAIL;
1208 // __NR_delete_module 129
1209 GO(__NR_delete_module, "n/a");
1210 //SY(__NR_delete_module); // (Not yet handled by Valgrind) FAIL;
1212 // __NR_get_kernel_syms 130
1213 GO(__NR_get_kernel_syms, "ni");
1214 SY(__NR_get_kernel_syms); FAIL;
1216 // __NR_quotactl 131
1217 GO(__NR_quotactl, "4s 1m");
1218 SY(__NR_quotactl, x0, x0, x0, x0); FAIL;
1220 // __NR_getpgid 132
1221 GO(__NR_getpgid, "1s 0m");
1222 SY(__NR_getpgid, x0-1); FAIL;
1224 // __NR_bdflush 134
1225 GO(__NR_bdflush, "n/a");
1226 //SY(__NR_bdflush); // (Not yet handled by Valgrind) FAIL;
1228 // __NR_sysfs 135
1229 GO(__NR_sysfs, "n/a");
1230 //SY(__NR_sysfs); // (Not yet handled by Valgrind) FAIL;
1232 // __NR_personality 136
1233 GO(__NR_personality, "1s 0m");
1234 SY(__NR_personality, x0+0xffffffff); SUCC;
1236 // __NR_afs_syscall 137
1237 GO(__NR_afs_syscall, "ni");
1238 SY(__NR_afs_syscall); FAIL;
1240 // __NR_setfsuid 138
1241 GO(__NR_setfsuid, "1s 0m");
1242 SY(__NR_setfsuid, x0); SUCC; // This syscall has a stupid return value
1244 // __NR_setfsgid 139
1245 GO(__NR_setfsgid, "1s 0m");
1246 SY(__NR_setfsgid, x0); SUCC; // This syscall has a stupid return value
1248 // __NR__llseek 140
1249 GO(__NR__llseek, "5s 1m");
1250 SY(__NR__llseek, x0, x0, x0, x0, x0); FAIL;
1252 // __NR_getdents 141
1253 GO(__NR_getdents, "3s 1m");
1254 SY(__NR_getdents, x0, x0, x0+1); FAIL;
1256 // __NR__newselect 142
1257 GO(__NR__newselect, "5s 4m");
1258 SY(__NR__newselect, x0+8, x0+0xffffffff, x0+1, x0+1, x0+1); FAIL;
1260 // __NR_flock 143
1261 GO(__NR_flock, "2s 0m");
1262 SY(__NR_flock, x0, x0); FAIL;
1264 // __NR_msync 144
1265 GO(__NR_msync, "3s 1m");
1266 SY(__NR_msync, x0, x0+1, x0); FAIL;
1268 // __NR_readv 145
1269 GO(__NR_readv, "3s 1m");
1270 SY(__NR_readv, x0, x0, x0+1); FAIL;
1272 // __NR_writev 146
1273 GO(__NR_writev, "3s 1m");
1274 SY(__NR_writev, x0, x0, x0+1); FAIL;
1276 // __NR_getsid 147
1277 GO(__NR_getsid, "1s 0m");
1278 SY(__NR_getsid, x0-1); FAIL;
1280 // __NR_fdatasync 148
1281 GO(__NR_fdatasync, "1s 0m");
1282 SY(__NR_fdatasync, x0-1); FAIL;
1284 // __NR__sysctl 149
1285 GO(__NR__sysctl, "1s 1m");
1286 SY(__NR__sysctl, x0); FAIL;
1288 // __NR_mlock 150
1289 GO(__NR_mlock, "2s 0m");
1290 SY(__NR_mlock, x0, x0+1); FAIL;
1292 // __NR_munlock 151
1293 GO(__NR_munlock, "2s 0m");
1294 SY(__NR_munlock, x0, x0+1); FAIL;
1296 // __NR_mlockall 152
1297 GO(__NR_mlockall, "1s 0m");
1298 SY(__NR_mlockall, x0-1); FAIL;
1300 // __NR_munlockall 153
1301 GO(__NR_munlockall, "0s 0m");
1302 SY(__NR_munlockall); SUCC_OR_FAILx(EPERM);
1304 // __NR_sched_setparam 154
1305 GO(__NR_sched_setparam, "2s 1m");
1306 SY(__NR_sched_setparam, x0, x0); FAIL;
1308 // __NR_sched_getparam 155
1309 GO(__NR_sched_getparam, "2s 1m");
1310 SY(__NR_sched_getparam, x0, x0); FAIL;
1312 // __NR_sched_setscheduler 156
1313 GO(__NR_sched_setscheduler, "3s 1m");
1314 SY(__NR_sched_setscheduler, x0-1, x0, x0+1); FAIL;
1316 // __NR_sched_getscheduler 157
1317 GO(__NR_sched_getscheduler, "1s 0m");
1318 SY(__NR_sched_getscheduler, x0-1); FAIL;
1320 // __NR_sched_yield 158
1321 GO(__NR_sched_yield, "0s 0m");
1322 SY(__NR_sched_yield); SUCC;
1324 // __NR_sched_get_priority_max 159
1325 GO(__NR_sched_get_priority_max, "1s 0m");
1326 SY(__NR_sched_get_priority_max, x0-1); FAIL;
1328 // __NR_sched_get_priority_min 160
1329 GO(__NR_sched_get_priority_min, "1s 0m");
1330 SY(__NR_sched_get_priority_min, x0-1); FAIL;
1332 // __NR_sched_rr_get_interval 161
1333 GO(__NR_sched_rr_get_interval, "n/a");
1334 //SY(__NR_sched_rr_get_interval); // (Not yet handled by Valgrind) FAIL;
1336 // __NR_nanosleep 162
1337 GO(__NR_nanosleep, "2s 2m");
1338 SY(__NR_nanosleep, x0, x0+1); FAIL;
1340 // __NR_mremap 163
1341 GO(__NR_mremap, "5s 0m");
1342 SY(__NR_mremap, x0+1, x0, x0, x0+MREMAP_FIXED, x0); FAILx(EINVAL);
1344 // __NR_setresuid 164
1345 GO(__NR_setresuid, "3s 0m");
1346 SY(__NR_setresuid, x0, x0, x0); FAIL;
1348 // __NR_getresuid 165
1349 GO(__NR_getresuid, "3s 3m");
1350 SY(__NR_getresuid, x0, x0, x0); FAIL;
1352 // __NR_vm86 166
1353 GO(__NR_vm86, "n/a");
1354 // (will probably never be handled by Valgrind)
1356 // __NR_query_module 167
1357 GO(__NR_query_module, "ni");
1358 SY(__NR_query_module); FAIL;
1360 // __NR_poll 168
1361 GO(__NR_poll, "3s 1m");
1362 SY(__NR_poll, x0, x0+1, x0); FAIL;
1364 // __NR_nfsservctl 169
1365 GO(__NR_nfsservctl, "n/a");
1366 //SY(__NR_nfsservctl); // (Not yet handled by Valgrind) FAIL;
1368 // __NR_setresgid 170
1369 GO(__NR_setresgid, "3s 0m");
1370 SY(__NR_setresgid, x0, x0, x0); FAIL;
1372 // __NR_getresgid 171
1373 GO(__NR_getresgid, "3s 3m");
1374 SY(__NR_getresgid, x0, x0, x0); FAIL;
1376 // __NR_prctl 172
1377 GO(__NR_prctl, "5s 0m");
1378 SY(__NR_prctl, x0, x0, x0, x0, x0); FAIL;
1380 // __NR_rt_sigreturn 173
1381 GO(__NR_rt_sigreturn, "n/a");
1382 //SY(__NR_rt_sigreturn); // (Not yet handled by Valgrind) FAIL;
1384 // __NR_rt_sigaction 174
1385 GO(__NR_rt_sigaction, "4s 4m");
1386 SY(__NR_rt_sigaction, x0, x0+&px[2], x0+&px[2], x0); FAIL;
1388 // __NR_rt_sigprocmask 175
1389 GO(__NR_rt_sigprocmask, "4s 2m");
1390 SY(__NR_rt_sigprocmask, x0, x0+1, x0+1, x0); FAIL;
1392 // __NR_rt_sigpending 176
1393 GO(__NR_rt_sigpending, "2s 1m");
1394 SY(__NR_rt_sigpending, x0, x0+1); FAIL;
1396 // __NR_rt_sigtimedwait 177
1397 GO(__NR_rt_sigtimedwait, "4s 3m");
1398 SY(__NR_rt_sigtimedwait, x0+1, x0+1, x0+1, x0); FAIL;
1400 // __NR_rt_sigqueueinfo 178
1401 GO(__NR_rt_sigqueueinfo, "3s 1m");
1402 SY(__NR_rt_sigqueueinfo, x0, x0+1, x0); FAIL;
1404 // __NR_rt_sigsuspend 179
1405 GO(__NR_rt_sigsuspend, "ignore");
1406 // (I don't know how to test this...)
1408 // __NR_pread64 180
1409 GO(__NR_pread64, "5s 1m");
1410 SY(__NR_pread64, x0, x0, x0+1, x0, x0); FAIL;
1412 // __NR_pwrite64 181
1413 GO(__NR_pwrite64, "5s 1m");
1414 SY(__NR_pwrite64, x0, x0, x0+1, x0, x0); FAIL;
1416 // __NR_getcwd 183
1417 GO(__NR_getcwd, "2s 1m");
1418 SY(__NR_getcwd, x0, x0+1); FAIL;
1420 // __NR_capget 184
1421 GO(__NR_capget, "2s 2m");
1422 SY(__NR_capget, x0, x0); FAIL;
1424 // __NR_capset 185
1425 GO(__NR_capset, "2s 2m");
1426 SY(__NR_capset, x0, x0); FAIL;
1428 // __NR_sigaltstack 186
1430 struct our_sigaltstack {
1431 void *ss_sp;
1432 int ss_flags;
1433 size_t ss_size;
1434 } ss;
1435 ss.ss_sp = NULL;
1436 ss.ss_flags = 0;
1437 ss.ss_size = 0;
1438 VALGRIND_MAKE_MEM_NOACCESS(& ss, sizeof(struct our_sigaltstack));
1439 GO(__NR_sigaltstack, "2s 2m");
1440 SY(__NR_sigaltstack, x0+&ss, x0+&ss); SUCC;
1443 // __NR_sendfile 187
1444 GO(__NR_sendfile, "4s 1m");
1445 SY(__NR_sendfile, x0, x0, x0+1, x0); FAIL;
1447 // __NR_getpmsg 188
1448 // Could do 5s 4m with more effort, but I can't be bothered for this
1449 // crappy non-standard syscall.
1450 GO(__NR_getpmsg, "5s 0m");
1451 SY(__NR_getpmsg, x0, x0, x0, x0); FAIL;
1453 // __NR_putpmsg 189
1454 // Could do 5s 2m with more effort, but I can't be bothered for this
1455 // crappy non-standard syscall.
1456 GO(__NR_putpmsg, "5s 0m");
1457 SY(__NR_putpmsg, x0, x0, x0, x0, x0); FAIL;
1459 // __NR_vfork 190
1460 GO(__NR_vfork, "other");
1461 // (sse scalar_vfork.c)
1463 // __NR_ugetrlimit 191
1464 GO(__NR_ugetrlimit, "2s 1m");
1465 SY(__NR_ugetrlimit, x0, x0); FAIL;
1467 // __NR_mmap2 192
1468 GO(__NR_mmap2, "6s 0m");
1469 SY(__NR_mmap2, x0, x0, x0, x0, x0-1, x0); FAIL;
1471 // __NR_truncate64 193
1472 GO(__NR_truncate64, "3s 1m");
1473 SY(__NR_truncate64, x0, x0, x0); FAIL;
1475 // __NR_ftruncate64 194
1476 GO(__NR_ftruncate64, "3s 0m");
1477 SY(__NR_ftruncate64, x0, x0, x0); FAIL;
1479 // __NR_stat64 195
1480 GO(__NR_stat64, "2s 2m");
1481 SY(__NR_stat64, x0, x0); FAIL;
1483 // __NR_lstat64 196
1484 GO(__NR_lstat64, "2s 2m");
1485 SY(__NR_lstat64, x0, x0); FAIL;
1487 // __NR_fstat64 197
1488 GO(__NR_fstat64, "2s 1m");
1489 SY(__NR_fstat64, x0, x0); FAIL;
1491 // __NR_lchown32 198
1492 GO(__NR_lchown32, "3s 1m");
1493 SY(__NR_lchown32, x0, x0, x0); FAIL;
1495 // __NR_getuid32 199
1496 GO(__NR_getuid32, "0s 0m");
1497 SY(__NR_getuid32); SUCC;
1499 // __NR_getgid32 200
1500 GO(__NR_getgid32, "0s 0m");
1501 SY(__NR_getgid32); SUCC;
1503 // __NR_geteuid32 201
1504 GO(__NR_geteuid32, "0s 0m");
1505 SY(__NR_geteuid32); SUCC;
1507 // __NR_getegid32 202
1508 GO(__NR_getegid32, "0s 0m");
1509 SY(__NR_getegid32); SUCC;
1511 // __NR_setreuid32 203
1512 GO(__NR_setreuid32, "2s 0m");
1513 SY(__NR_setreuid32, x0, x0); FAIL;
1515 // __NR_setregid32 204
1516 GO(__NR_setregid32, "2s 0m");
1517 SY(__NR_setregid32, x0, x0); FAIL;
1519 // __NR_getgroups32 205
1520 GO(__NR_getgroups32, "2s 1m");
1521 SY(__NR_getgroups32, x0+1, x0+1); FAIL;
1523 // __NR_setgroups32 206
1524 GO(__NR_setgroups32, "2s 1m");
1525 SY(__NR_setgroups32, x0+1, x0+1); FAIL;
1527 // __NR_fchown32 207
1528 GO(__NR_fchown32, "3s 0m");
1529 SY(__NR_fchown32, x0, x0, x0); FAIL;
1531 // __NR_setresuid32 208
1532 GO(__NR_setresuid32, "3s 0m");
1533 SY(__NR_setresuid32, x0, x0, x0); FAIL;
1535 // __NR_getresuid32 209
1536 GO(__NR_getresuid32, "3s 3m");
1537 SY(__NR_getresuid32, x0, x0, x0); FAIL;
1539 // __NR_setresgid32 210
1540 GO(__NR_setresgid32, "3s 0m");
1541 SY(__NR_setresgid32, x0, x0, x0); FAIL;
1543 // __NR_getresgid32 211
1544 GO(__NR_getresgid32, "3s 3m");
1545 SY(__NR_getresgid32, x0, x0, x0); FAIL;
1547 // __NR_chown32 212
1548 GO(__NR_chown32, "3s 1m");
1549 SY(__NR_chown32, x0, x0, x0); FAIL;
1551 // __NR_setuid32 213
1552 GO(__NR_setuid32, "1s 0m");
1553 SY(__NR_setuid32, x0); FAIL;
1555 // __NR_setgid32 214
1556 GO(__NR_setgid32, "1s 0m");
1557 SY(__NR_setgid32, x0); FAIL;
1559 // __NR_setfsuid32 215
1560 GO(__NR_setfsuid32, "1s 0m");
1561 SY(__NR_setfsuid32, x0); SUCC; // This syscall has a stupid return value
1563 // __NR_setfsgid32 216
1564 GO(__NR_setfsgid32, "1s 0m");
1565 SY(__NR_setfsgid32, x0); SUCC; // This syscall has a stupid return value
1567 // __NR_pivot_root 217
1568 GO(__NR_pivot_root, "n/a");
1569 //SY(__NR_pivot_root); // (Not yet handled by Valgrind) FAIL;
1571 // __NR_mincore 218
1572 GO(__NR_mincore, "3s 1m");
1573 SY(__NR_mincore, x0, x0+40960, x0); FAIL;
1575 // __NR_madvise 219
1576 GO(__NR_madvise, "3s 0m");
1577 SY(__NR_madvise, x0, x0+1, x0); FAILx(ENOMEM);
1579 // __NR_getdents64 220
1580 GO(__NR_getdents64, "3s 1m");
1581 SY(__NR_getdents64, x0, x0, x0+1); FAIL;
1583 // __NR_fcntl64 221
1584 // As with sys_open(), we don't trigger errors for the 1st two args for
1585 // the later ones.
1586 // For F_GETFD the 3rd arg is ignored.
1587 GO(__NR_fcntl64, "(GETFD) 2s 0m");
1588 SY(__NR_fcntl64, x0-1, x0+F_GETFD, x0); FAILx(EBADF);
1590 // For F_DUPFD the 3rd arg is 'arg'
1591 GO(__NR_fcntl64, "(DUPFD) 1s 0m");
1592 SY(__NR_fcntl64, -1, F_DUPFD, x0); FAILx(EBADF);
1594 // For F_GETLK the 3rd arg is 'lock'.
1595 // On x86, this fails w/EBADF. But on amd64 in 32-bit mode it fails
1596 // w/EFAULT.
1597 GO(__NR_fcntl64, "(GETLK) 1s 0m");
1598 SY(__NR_fcntl64, -1, +F_GETLK, x0); FAIL; //FAILx(EBADF);
1600 // 222
1601 GO(222, "ni");
1602 SY(222); FAIL;
1604 // 223
1605 GO(223, "ni");
1606 SY(223); FAIL;
1608 // __NR_gettid 224
1609 GO(__NR_gettid, "n/a");
1610 //SY(__NR_gettid); // (Not yet handled by Valgrind) FAIL;
1612 // __NR_readahead 225
1613 GO(__NR_readahead, "n/a");
1614 //SY(__NR_readahead); // (Not yet handled by Valgrind) FAIL;
1616 // __NR_setxattr 226
1617 GO(__NR_setxattr, "5s 3m");
1618 SY(__NR_setxattr, x0, x0, x0, x0+1, x0); FAIL;
1620 // __NR_lsetxattr 227
1621 GO(__NR_lsetxattr, "5s 3m");
1622 SY(__NR_lsetxattr, x0, x0, x0, x0+1, x0); FAIL;
1624 // __NR_fsetxattr 228
1625 GO(__NR_fsetxattr, "5s 2m");
1626 SY(__NR_fsetxattr, x0, x0, x0, x0+1, x0); FAIL;
1628 // __NR_getxattr 229
1629 GO(__NR_getxattr, "4s 3m");
1630 SY(__NR_getxattr, x0, x0, x0, x0+1); FAIL;
1632 // __NR_lgetxattr 230
1633 GO(__NR_lgetxattr, "4s 3m");
1634 SY(__NR_lgetxattr, x0, x0, x0, x0+1); FAIL;
1636 // __NR_fgetxattr 231
1637 GO(__NR_fgetxattr, "4s 2m");
1638 SY(__NR_fgetxattr, x0, x0, x0, x0+1); FAIL;
1640 // __NR_listxattr 232
1641 GO(__NR_listxattr, "3s 2m");
1642 SY(__NR_listxattr, x0, x0, x0+1); FAIL;
1644 // __NR_llistxattr 233
1645 GO(__NR_llistxattr, "3s 2m");
1646 SY(__NR_llistxattr, x0, x0, x0+1); FAIL;
1648 // __NR_flistxattr 234
1649 GO(__NR_flistxattr, "3s 1m");
1650 SY(__NR_flistxattr, x0-1, x0, x0+1); FAIL; /* kernel returns EBADF, but both seem correct */
1652 // __NR_removexattr 235
1653 GO(__NR_removexattr, "2s 2m");
1654 SY(__NR_removexattr, x0, x0); FAIL;
1656 // __NR_lremovexattr 236
1657 GO(__NR_lremovexattr, "2s 2m");
1658 SY(__NR_lremovexattr, x0, x0); FAIL;
1660 // __NR_fremovexattr 237
1661 GO(__NR_fremovexattr, "2s 1m");
1662 SY(__NR_fremovexattr, x0, x0); FAIL;
1664 // __NR_tkill 238
1665 GO(__NR_tkill, "n/a");
1666 //SY(__NR_tkill); // (Not yet handled by Valgrind) FAIL;
1668 // __NR_sendfile64 239
1669 GO(__NR_sendfile64, "4s 1m");
1670 SY(__NR_sendfile64, x0, x0, x0+1, x0); FAIL;
1672 // __NR_futex 240
1673 #ifndef FUTEX_WAIT
1674 #define FUTEX_WAIT 0
1675 #endif
1676 // XXX: again, glibc not doing 6th arg means we have only 5s errors
1677 GO(__NR_futex, "4s 2m");
1678 SY(__NR_futex, x0+FUTEX_WAIT, x0, x0, x0+1); FAIL;
1680 // __NR_sched_setaffinity 241
1681 GO(__NR_sched_setaffinity, "3s 1m");
1682 SY(__NR_sched_setaffinity, x0, x0+1, x0); FAIL;
1684 // __NR_sched_getaffinity 242
1685 GO(__NR_sched_getaffinity, "3s 1m");
1686 SY(__NR_sched_getaffinity, x0, x0+1, x0); FAIL;
1688 // __NR_set_thread_area 243
1689 GO(__NR_set_thread_area, "1s 1m");
1690 SY(__NR_set_thread_area, x0); FAILx(EFAULT);
1692 // __NR_get_thread_area 244
1693 GO(__NR_get_thread_area, "1s 1m");
1694 SY(__NR_get_thread_area, x0); FAILx(EFAULT);
1696 // __NR_io_setup 245
1697 GO(__NR_io_setup, "2s 1m");
1698 SY(__NR_io_setup, x0, x0); FAIL;
1700 // __NR_io_destroy 246
1702 // jump through hoops to prevent the PRE(io_destroy) wrapper crashing.
1703 struct fake_aio_ring {
1704 unsigned id; /* kernel internal index number */
1705 unsigned nr; /* number of io_events */
1706 // There are more fields in the real aio_ring, but the 'nr' field is
1707 // the only one used by the PRE() wrapper.
1708 } ring = { 0, 0 };
1709 struct fake_aio_ring* ringptr = &ring;
1710 GO(__NR_io_destroy, "1s 0m");
1711 SY(__NR_io_destroy, x0+&ringptr); FAIL;
1714 // __NR_io_getevents 247
1715 GO(__NR_io_getevents, "5s 2m");
1716 SY(__NR_io_getevents, x0, x0, x0+1, x0, x0+1); FAIL;
1718 // __NR_io_submit 248
1719 GO(__NR_io_submit, "3s 1m");
1720 SY(__NR_io_submit, x0, x0+1, x0); FAIL;
1722 // __NR_io_cancel 249
1723 GO(__NR_io_cancel, "3s 2m");
1724 SY(__NR_io_cancel, x0, x0, x0); FAIL;
1726 // __NR_fadvise64 250
1727 GO(__NR_fadvise64, "n/a");
1728 //SY(__NR_fadvise64); // (Not yet handled by Valgrind) FAIL;
1730 // 251
1731 GO(251, "ni");
1732 SY(251); FAIL;
1734 // __NR_exit_group 252
1735 GO(__NR_exit_group, "other");
1736 // (see scalar_exit_group.c)
1738 // __NR_lookup_dcookie 253
1739 GO(__NR_lookup_dcookie, "4s 1m");
1740 SY(__NR_lookup_dcookie, x0, x0, x0, x0+1); FAIL;
1742 // __NR_epoll_create 254
1743 GO(__NR_epoll_create, "1s 0m");
1744 SY(__NR_epoll_create, x0); SUCC_OR_FAIL;
1746 // __NR_epoll_ctl 255
1747 GO(__NR_epoll_ctl, "4s 1m");
1748 SY(__NR_epoll_ctl, x0, x0, x0, x0); FAIL;
1750 // __NR_epoll_wait 256
1751 GO(__NR_epoll_wait, "4s 1m");
1752 SY(__NR_epoll_wait, x0, x0, x0+1, x0); FAIL;
1754 // __NR_remap_file_pages 257
1755 GO(__NR_remap_file_pages, "n/a");
1756 //SY(__NR_remap_file_pages); // (Not yet handled by Valgrind) FAIL;
1758 // __NR_set_tid_address 258
1759 GO(__NR_set_tid_address, "1s 0m");
1760 SY(__NR_set_tid_address, x0); SUCC_OR_FAILx(ENOSYS);
1762 // __NR_timer_create 259
1763 GO(__NR_timer_create, "3s 2m");
1764 SY(__NR_timer_create, x0, x0+1, x0); FAIL;
1766 // __NR_timer_settime (__NR_timer_create+1)
1767 GO(__NR_timer_settime, "4s 2m");
1768 SY(__NR_timer_settime, x0, x0, x0, x0+1); FAIL;
1770 // __NR_timer_gettime (__NR_timer_create+2)
1771 GO(__NR_timer_gettime, "2s 1m");
1772 SY(__NR_timer_gettime, x0, x0); FAIL;
1774 // __NR_timer_getoverrun (__NR_timer_create+3)
1775 GO(__NR_timer_getoverrun, "1s 0m");
1776 SY(__NR_timer_getoverrun, x0); FAIL;
1778 // __NR_timer_delete (__NR_timer_create+4)
1779 GO(__NR_timer_delete, "1s 0m");
1780 SY(__NR_timer_delete, x0); FAIL;
1782 // __NR_clock_settime (__NR_timer_create+5)
1783 GO(__NR_clock_settime, "2s 1m");
1784 SY(__NR_clock_settime, x0, x0); FAIL; FAIL;
1786 // __NR_clock_gettime (__NR_timer_create+6)
1787 GO(__NR_clock_gettime, "2s 1m");
1788 SY(__NR_clock_gettime, x0, x0); FAIL;
1790 // __NR_clock_getres (__NR_timer_create+7)
1791 GO(__NR_clock_getres, "2s 1m");
1792 SY(__NR_clock_getres, x0+1, x0+1); FAIL; FAIL;
1794 // __NR_clock_nanosleep (__NR_timer_create+8)
1795 GO(__NR_clock_nanosleep, "n/a");
1796 //SY(__NR_clock_nanosleep); // (Not yet handled by Valgrind) FAIL;
1798 // __NR_statfs64 268
1799 GO(__NR_statfs64, "3s 2m");
1800 SY(__NR_statfs64, x0, x0+1, x0); FAIL;
1802 // __NR_fstatfs64 269
1803 GO(__NR_fstatfs64, "3s 1m");
1804 SY(__NR_fstatfs64, x0, x0+1, x0); FAIL;
1806 // __NR_tgkill 270
1807 GO(__NR_tgkill, "n/a");
1808 //SY(__NR_tgkill); // (Not yet handled by Valgrind) FAIL;
1810 // __NR_utimes 271
1811 GO(__NR_utimes, "2s 2m");
1812 SY(__NR_utimes, x0, x0+1); FAIL;
1814 // __NR_fadvise64_64 272
1815 GO(__NR_fadvise64_64, "n/a");
1816 //SY(__NR_fadvise64_64); // (Not yet handled by Valgrind) FAIL;
1818 // __NR_vserver 273
1819 GO(__NR_vserver, "ni");
1820 SY(__NR_vserver); FAIL;
1822 // __NR_mbind 274
1823 GO(__NR_mbind, "n/a");
1824 //SY(__NR_mbind); // (Not yet handled by Valgrind) FAIL;
1826 // __NR_get_mempolicy 275
1827 GO(__NR_get_mempolicy, "n/a");
1828 //SY(__NR_get_mempolicy); // (Not yet handled by Valgrind) FAIL;
1830 // __NR_set_mempolicy 276
1831 GO(__NR_set_mempolicy, "n/a");
1832 //SY(__NR_set_mempolicy); // (Not yet handled by Valgrind) FAIL;
1834 // __NR_mq_open 277
1835 GO(__NR_mq_open, "4s 3m");
1836 SY(__NR_mq_open, x0, x0+O_CREAT, x0, x0+1); FAIL;
1838 // __NR_mq_unlink (__NR_mq_open+1)
1839 GO(__NR_mq_unlink, "1s 1m");
1840 SY(__NR_mq_unlink, x0); FAIL;
1842 // __NR_mq_timedsend (__NR_mq_open+2)
1843 GO(__NR_mq_timedsend, "5s 2m");
1844 SY(__NR_mq_timedsend, x0, x0, x0+1, x0, x0+1); FAIL;
1846 // __NR_mq_timedreceive (__NR_mq_open+3)
1847 GO(__NR_mq_timedreceive, "5s 3m");
1848 SY(__NR_mq_timedreceive, x0, x0, x0+1, x0+1, x0+1); FAIL;
1850 // __NR_mq_notify (__NR_mq_open+4)
1851 GO(__NR_mq_notify, "2s 1m");
1852 SY(__NR_mq_notify, x0, x0+1); FAIL;
1854 // __NR_mq_getsetattr (__NR_mq_open+5)
1855 GO(__NR_mq_getsetattr, "3s 2m");
1856 SY(__NR_mq_getsetattr, x0, x0+1, x0+1); FAIL;
1858 // __NR_sys_kexec_load 283
1859 GO(__NR_sys_kexec_load, "ni");
1860 SY(__NR_sys_kexec_load); FAIL;
1861 #endif
1863 // no such syscall...
1864 GO(9999, 9999, "1e");
1865 SY(9999); FAIL;
1867 // __NR_exit 1
1868 GO(__NR_exit, 1, "1s 0m");
1869 SY(__NR_exit, x0); FAIL;
1871 assert(0);