From: Nicholas Nethercote Date: Wed, 17 Nov 2004 18:22:38 +0000 (+0000) Subject: Arch-abstraction: X-Git-Tag: svn/VALGRIND_3_0_0~1280 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2f787498e8d01115863e8bf91bea52586da41389;p=thirdparty%2Fvalgrind.git Arch-abstraction: - Moved some more syscall wrappers into linux/syscalls.c and x86-linux/syscalls.c. There are still heaps of wrappers that probably aren't generic, but I'm not sure, so they're staying in vg_syscalls.c for now. Let's worry about that when we do an OS port. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3036 --- diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am index 4a48ae5ed7..c5e82c6f21 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am @@ -23,7 +23,6 @@ noinst_LIBRARIES = lib_replace_malloc.a noinst_HEADERS = \ core.h \ core_asm.h \ - syscall_wrappers.h \ ume.h \ vg_symtab2.h \ vg_symtypes.h \ diff --git a/coregrind/core.h b/coregrind/core.h index eaf1236e58..6fcd9a69f7 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -1406,6 +1406,11 @@ extern void VG_(show_open_fds) ( void ); // address space. Bool VG_(valid_client_addr)(Addr start, SizeT size, ThreadId tid, const Char *syscallname); + +// Return true if we're allowed to use or create this fd. +Bool VG_(fd_allowed)(Int fd, const Char *syscallname, ThreadId tid, Bool soft); + +void VG_(record_fd_open)(Int tid, Int fd, char *pathname); // Flags describing syscall wrappers #define Special (1 << 0) @@ -1424,8 +1429,8 @@ Bool VG_(valid_client_addr)(Addr start, SizeT size, ThreadId tid, // Generic (platform-independent) syscall wrappers. These are generally // POSIX or something like that; those that are not POSIX are annotated // with what standards they are part of, as stated in the Linux man pages. -// Unless otherwise indicated, all those here are generic across all -// architectures at least for Linux. +// For many of them, it's unclear if they are generic, or Linux-specific, or +// x86/Linux-specific, or something else again. // // Nb: This list may change over time... ones thought at first to be generic // may turn out not to be, and so be moved into OS-specific or @@ -1445,7 +1450,7 @@ GEN_SYSCALL_WRAPPER(sys_waitpid); GEN_SYSCALL_WRAPPER(sys_creat); GEN_SYSCALL_WRAPPER(sys_link); GEN_SYSCALL_WRAPPER(sys_unlink); -GEN_SYSCALL_WRAPPER(sys_execve); // 11 (*??) P +GEN_SYSCALL_WRAPPER(sys_execve); // (*??) P GEN_SYSCALL_WRAPPER(sys_chdir); GEN_SYSCALL_WRAPPER(sys_time); GEN_SYSCALL_WRAPPER(sys_mknod); @@ -1495,6 +1500,7 @@ GEN_SYSCALL_WRAPPER(sys_getuid); GEN_SYSCALL_WRAPPER(sys_getgid); GEN_SYSCALL_WRAPPER(sys_geteuid); GEN_SYSCALL_WRAPPER(sys_getegid); +GEN_SYSCALL_WRAPPER(sys_getpgid); GEN_SYSCALL_WRAPPER(sys_fsync); GEN_SYSCALL_WRAPPER(sys_wait4); GEN_SYSCALL_WRAPPER(sys_mprotect); @@ -1508,6 +1514,14 @@ GEN_SYSCALL_WRAPPER(sys_clock_settime); GEN_SYSCALL_WRAPPER(sys_clock_gettime); GEN_SYSCALL_WRAPPER(sys_clock_getres); GEN_SYSCALL_WRAPPER(sys_getcwd); +GEN_SYSCALL_WRAPPER(sys_symlink); +GEN_SYSCALL_WRAPPER(sys_getgroups); +GEN_SYSCALL_WRAPPER(sys_setgroups); // SVr4, SVID, X/OPEN, 4.3BSD +GEN_SYSCALL_WRAPPER(sys_chown); +GEN_SYSCALL_WRAPPER(sys_setuid); +GEN_SYSCALL_WRAPPER(sys_gettimeofday); +GEN_SYSCALL_WRAPPER(sys_madvise); +GEN_SYSCALL_WRAPPER(sys_sigpending); // These ones aren't POSIX, but are in some standard and look reasonably // generic, and are the same for all architectures under Linux. @@ -1516,7 +1530,23 @@ GEN_SYSCALL_WRAPPER(sys_sync); // SVr4, SVID, X/OPEN, BSD 4.3 GEN_SYSCALL_WRAPPER(sys_brk); // 4.3BSD GEN_SYSCALL_WRAPPER(sys_acct); // SVR4, non-POSIX GEN_SYSCALL_WRAPPER(sys_chroot); // SVr4, SVID, 4.4BSD, X/OPEN - +GEN_SYSCALL_WRAPPER(sys_readlink); // X/OPEN, 4.4BSD +GEN_SYSCALL_WRAPPER(sys_fchdir); // SVr4, SVID, POSIX, X/OPEN, 4.4BSD +GEN_SYSCALL_WRAPPER(sys_getdents); // SVr4,SVID +GEN_SYSCALL_WRAPPER(sys_select); // 4.4BSD +GEN_SYSCALL_WRAPPER(sys_flock); // 4.4BSD +GEN_SYSCALL_WRAPPER(sys_poll); // XPG4-UNIX +GEN_SYSCALL_WRAPPER(sys_getrusage); // SVr4, 4.3BSD +GEN_SYSCALL_WRAPPER(sys_settimeofday); // SVr4, 4.3BSD (non-POSIX) +GEN_SYSCALL_WRAPPER(sys_getpriority); // SVr4, 4.4BSD +GEN_SYSCALL_WRAPPER(sys_setpriority); // SVr4, 4.4BSD +GEN_SYSCALL_WRAPPER(sys_setitimer); // SVr4, 4.4BSD +GEN_SYSCALL_WRAPPER(sys_getitimer); // SVr4, 4.4BSD +GEN_SYSCALL_WRAPPER(sys_setreuid); // 4.3BSD +GEN_SYSCALL_WRAPPER(sys_setregid); // 4.3BSD +GEN_SYSCALL_WRAPPER(sys_fchown); // SVr4,4.3BSD +GEN_SYSCALL_WRAPPER(sys_setgid); // SVr4,SVID +GEN_SYSCALL_WRAPPER(sys_utimes); // 4.3BSD // These ones may be Linux specific... not sure. They use 16-bit gid_t and // uid_t types. The similarly named (minus the "16" suffix) ones below use @@ -1534,63 +1564,36 @@ GEN_SYSCALL_WRAPPER(sys_setgroups16); // ## SVr4, SVID, X/OPEN, 4.3BSD GEN_SYSCALL_WRAPPER(sys_fchown16); // ## SVr4,BSD4.3 GEN_SYSCALL_WRAPPER(sys_chown16); // ## P -GEN_SYSCALL_WRAPPER(sys_ptrace); // (x86?) (almost-P) - +// Linux's funny many-in-one socketcall is certainly not generic, but I +// didn't want to move it until necessary because it's big and has a lot of +// associated junk. +GEN_SYSCALL_WRAPPER(sys_socketcall); // Some archs on Linux do not match the generic wrapper for sys_pipe(). GEN_SYSCALL_WRAPPER(sys_pipe); -GEN_SYSCALL_WRAPPER(sys_ioctl); // */x86 (various) - - // May not be generic for every architecture under Linux. GEN_SYSCALL_WRAPPER(sys_sigaction); // (x86) P -GEN_SYSCALL_WRAPPER(sys_sigsuspend); // POSIX, but LLL (proto varies across archs) -GEN_SYSCALL_WRAPPER(sys_sigpending); -GEN_SYSCALL_WRAPPER(sys_setrlimit); // SVr4, 4.3BSD - -GEN_SYSCALL_WRAPPER(sys_old_getrlimit); // SVr4, 4.3BSD LLL? - -GEN_SYSCALL_WRAPPER(sys_getrusage); // SVr4, 4.3BSD -GEN_SYSCALL_WRAPPER(sys_gettimeofday); -GEN_SYSCALL_WRAPPER(sys_settimeofday); // SVr4, 4.3BSD (non-POSIX) - -GEN_SYSCALL_WRAPPER(old_select); // (x86) (4.4BSD) LLL - -GEN_SYSCALL_WRAPPER(sys_symlink); -GEN_SYSCALL_WRAPPER(sys_readlink); // * (X/OPEN,4.4BSD) -GEN_SYSCALL_WRAPPER(old_mmap); // (x86) (P but not...) -GEN_SYSCALL_WRAPPER(sys_getpriority); // SVr4,4.4BSD -GEN_SYSCALL_WRAPPER(sys_setpriority); // SVr4,4.4BSD -GEN_SYSCALL_WRAPPER(sys_statfs); // * L? -GEN_SYSCALL_WRAPPER(sys_fstatfs); // * L? - -// Linux's funny many-in-one socketcall is certainly not generic, but I -// didn't want to move it until necessary because it's big and has a lot of -// associated junk. -GEN_SYSCALL_WRAPPER(sys_socketcall); - -GEN_SYSCALL_WRAPPER(sys_setitimer); // * (SVr4,4.4BSD) -GEN_SYSCALL_WRAPPER(sys_getitimer); // * (SVr4,4.4BSD) - -// XXX: funny names... +// Funny names, not sure... GEN_SYSCALL_WRAPPER(sys_newstat); // * P GEN_SYSCALL_WRAPPER(sys_newlstat); // * GEN_SYSCALL_WRAPPER(sys_newfstat); // * P (SVr4,BSD4.3) +// For the remainder, not really sure yet +GEN_SYSCALL_WRAPPER(old_mmap); // x86, weird arg passing +GEN_SYSCALL_WRAPPER(sys_ptrace); // (x86?) (almost-P) +GEN_SYSCALL_WRAPPER(sys_sigsuspend); // POSIX, but L (proto varies across archs) +GEN_SYSCALL_WRAPPER(sys_setrlimit); // SVr4, 4.3BSD +GEN_SYSCALL_WRAPPER(sys_ioctl); // x86? (various) +GEN_SYSCALL_WRAPPER(sys_old_getrlimit); // SVr4, 4.3BSD L? +GEN_SYSCALL_WRAPPER(sys_statfs); // * L? +GEN_SYSCALL_WRAPPER(sys_fstatfs); // * L? GEN_SYSCALL_WRAPPER(sys_iopl); // (x86/amd64) L GEN_SYSCALL_WRAPPER(sys_ipc); // (x86) L -GEN_SYSCALL_WRAPPER(sys_clone); // (x86/Linux) TTT GEN_SYSCALL_WRAPPER(sys_newuname); // * P GEN_SYSCALL_WRAPPER(sys_init_module); // * L? GEN_SYSCALL_WRAPPER(sys_quotactl); // * (?) -GEN_SYSCALL_WRAPPER(sys_getpgid); -GEN_SYSCALL_WRAPPER(sys_fchdir); // * (almost-P) -GEN_SYSCALL_WRAPPER(sys_getdents); // * (SVr4,SVID) -GEN_SYSCALL_WRAPPER(sys_select); // * (4.4BSD...) -GEN_SYSCALL_WRAPPER(sys_flock); // * (4.4BSD...) -GEN_SYSCALL_WRAPPER(sys_poll); // * (XPG4-UNIX) GEN_SYSCALL_WRAPPER(sys_rt_sigaction); // (x86) () GEN_SYSCALL_WRAPPER(sys_rt_sigprocmask); // * ? GEN_SYSCALL_WRAPPER(sys_rt_sigpending); // * ? @@ -1602,7 +1605,6 @@ GEN_SYSCALL_WRAPPER(sys_pwrite64); // * (Unix98?) GEN_SYSCALL_WRAPPER(sys_capget); // * L? GEN_SYSCALL_WRAPPER(sys_capset); // * L? GEN_SYSCALL_WRAPPER(sys_sigaltstack); // (x86) (XPG4-UNIX) -GEN_SYSCALL_WRAPPER(sys_sendfile); // * L GEN_SYSCALL_WRAPPER(sys_getpmsg); // (?) (?) GEN_SYSCALL_WRAPPER(sys_putpmsg); // (?) (?) GEN_SYSCALL_WRAPPER(sys_getrlimit); // * (?) @@ -1613,16 +1615,7 @@ GEN_SYSCALL_WRAPPER(sys_stat64); // %% (?) GEN_SYSCALL_WRAPPER(sys_lstat64); // %% (?) GEN_SYSCALL_WRAPPER(sys_fstat64); // %% (?) GEN_SYSCALL_WRAPPER(sys_lchown); // * (L?) -GEN_SYSCALL_WRAPPER(sys_setreuid); // * (BSD4.3) -GEN_SYSCALL_WRAPPER(sys_setregid); // * (BSD4.3) -GEN_SYSCALL_WRAPPER(sys_getgroups); // * P -GEN_SYSCALL_WRAPPER(sys_setgroups); // * almost-P -GEN_SYSCALL_WRAPPER(sys_fchown); // * (SVr4,BSD4.3) -GEN_SYSCALL_WRAPPER(sys_chown); // * P -GEN_SYSCALL_WRAPPER(sys_setuid); // * -GEN_SYSCALL_WRAPPER(sys_setgid); // * (SVr4,SVID) -GEN_SYSCALL_WRAPPER(sys_mincore); // * non-P? -GEN_SYSCALL_WRAPPER(sys_madvise); // * P +GEN_SYSCALL_WRAPPER(sys_mincore); // * L? GEN_SYSCALL_WRAPPER(sys_getdents64); // * (SVr4,SVID?) GEN_SYSCALL_WRAPPER(sys_fcntl64); // * P? GEN_SYSCALL_WRAPPER(sys_setxattr); // * L? @@ -1637,19 +1630,13 @@ GEN_SYSCALL_WRAPPER(sys_flistxattr); // * L? GEN_SYSCALL_WRAPPER(sys_removexattr); // * L? GEN_SYSCALL_WRAPPER(sys_lremovexattr); // * L? GEN_SYSCALL_WRAPPER(sys_fremovexattr); // * L? -GEN_SYSCALL_WRAPPER(sys_sendfile64); // * L -GEN_SYSCALL_WRAPPER(sys_futex); // * L GEN_SYSCALL_WRAPPER(sys_sched_setaffinity); // * L? GEN_SYSCALL_WRAPPER(sys_sched_getaffinity); // * L? -GEN_SYSCALL_WRAPPER(sys_exit_group); // * +GEN_SYSCALL_WRAPPER(sys_exit_group); // * ? GEN_SYSCALL_WRAPPER(sys_lookup_dcookie); // (*/32/64) L -GEN_SYSCALL_WRAPPER(sys_epoll_create); // * L -GEN_SYSCALL_WRAPPER(sys_epoll_ctl); // * L -GEN_SYSCALL_WRAPPER(sys_epoll_wait); // * L GEN_SYSCALL_WRAPPER(sys_set_tid_address); // * ? GEN_SYSCALL_WRAPPER(sys_statfs64); // * (?) GEN_SYSCALL_WRAPPER(sys_fstatfs64); // * (?) -GEN_SYSCALL_WRAPPER(sys_utimes); // * (4.3BSD) GEN_SYSCALL_WRAPPER(sys_mq_open); // * P? GEN_SYSCALL_WRAPPER(sys_mq_unlink); // * P? GEN_SYSCALL_WRAPPER(sys_mq_timedsend); // * P? diff --git a/coregrind/linux/core_os.h b/coregrind/linux/core_os.h index 9275a507fa..a25883cc1a 100644 --- a/coregrind/linux/core_os.h +++ b/coregrind/linux/core_os.h @@ -67,6 +67,14 @@ LINUX_SYSCALL_WRAPPER(sys_personality); LINUX_SYSCALL_WRAPPER(sys_sysctl); LINUX_SYSCALL_WRAPPER(sys_prctl); +LINUX_SYSCALL_WRAPPER(sys_sendfile); +LINUX_SYSCALL_WRAPPER(sys_sendfile64); +LINUX_SYSCALL_WRAPPER(sys_futex); + +LINUX_SYSCALL_WRAPPER(sys_epoll_create); +LINUX_SYSCALL_WRAPPER(sys_epoll_ctl); +LINUX_SYSCALL_WRAPPER(sys_epoll_wait); + LINUX_SYSCALL_WRAPPER(sys_io_setup); LINUX_SYSCALL_WRAPPER(sys_io_destroy); LINUX_SYSCALL_WRAPPER(sys_io_getevents); diff --git a/coregrind/linux/syscalls.c b/coregrind/linux/syscalls.c index e4b92e5bda..2c791f6106 100644 --- a/coregrind/linux/syscalls.c +++ b/coregrind/linux/syscalls.c @@ -29,7 +29,6 @@ */ #include "core.h" -#include "syscall_wrappers.h" /* --------------------------------------------------------------------- PRE/POST wrappers for arch-generic, Linux-specific syscalls @@ -340,6 +339,111 @@ PRE(sys_prctl, MayBlock) // PRE_MEM_READs/PRE_MEM_WRITEs as necessary... } +PRE(sys_sendfile, MayBlock) +{ + PRINT("sys_sendfile ( %d, %d, %p, %llu )", arg1,arg2,arg3,(ULong)arg4); + PRE_REG_READ4(ssize_t, "sendfile", + int, out_fd, int, in_fd, vki_off_t *, offset, + vki_size_t, count); + if (arg3 != (UWord)NULL) + PRE_MEM_WRITE( "sendfile(offset)", arg3, sizeof(vki_off_t) ); +} + +POST(sys_sendfile) +{ + POST_MEM_WRITE( arg3, sizeof( vki_off_t ) ); +} + +PRE(sys_sendfile64, MayBlock) +{ + PRINT("sendfile64 ( %d, %d, %p, %llu )",arg1,arg2,arg3,(ULong)arg4); + PRE_REG_READ4(ssize_t, "sendfile64", + int, out_fd, int, in_fd, vki_loff_t *, offset, + vki_size_t, count); + if (arg3 != (UWord)NULL) + PRE_MEM_WRITE( "sendfile64(offset)", arg3, sizeof(vki_loff_t) ); +} + +POST(sys_sendfile64) +{ + if (arg3 != (UWord)NULL ) { + POST_MEM_WRITE( arg3, sizeof(vki_loff_t) ); + } +} + +PRE(sys_futex, MayBlock) +{ + PRINT("sys_futex ( %p, %d, %d, %p, %p )", arg1,arg2,arg3,arg4,arg5); + PRE_REG_READ6(long, "futex", + vki_u32 *, futex, int, op, int, val, + struct timespec *, utime, vki_u32 *, uaddr2, int, val3); + PRE_MEM_READ( "futex(futex)", arg1, sizeof(int) ); + if (arg2 == VKI_FUTEX_WAIT && arg4 != (UWord)NULL) + PRE_MEM_READ( "futex(timeout)", arg4, sizeof(struct vki_timespec) ); + if (arg2 == VKI_FUTEX_REQUEUE) + PRE_MEM_READ( "futex(futex2)", arg4, sizeof(int) ); +} + +POST(sys_futex) +{ + POST_MEM_WRITE( arg1, sizeof(int) ); + if (arg2 == VKI_FUTEX_FD) { + if (!VG_(fd_allowed)(res, "futex", tid, True)) { + VG_(close)(res); + set_result( -VKI_EMFILE ); + } else { + if (VG_(clo_track_fds)) + VG_(record_fd_open)(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1)); + } + } +} + +PRE(sys_epoll_create, 0) +{ + PRINT("sys_epoll_create ( %d )", arg1); + PRE_REG_READ1(long, "epoll_create", int, size); +} + +POST(sys_epoll_create) +{ + if (!VG_(fd_allowed)(res, "epoll_create", tid, True)) { + VG_(close)(res); + set_result( -VKI_EMFILE ); + } else { + if (VG_(clo_track_fds)) + VG_(record_fd_open) (tid, res, NULL); + } +} + +PRE(sys_epoll_ctl, 0) +{ + static const char* epoll_ctl_s[3] = { + "EPOLL_CTL_ADD", + "EPOLL_CTL_DEL", + "EPOLL_CTL_MOD" + }; + PRINT("sys_epoll_ctl ( %d, %s, %d, %p )", + arg1, ( arg2<3 ? epoll_ctl_s[arg2] : "?" ), arg3, arg4); + PRE_REG_READ4(long, "epoll_ctl", + int, epfd, int, op, int, fd, struct epoll_event *, event); + PRE_MEM_READ( "epoll_ctl(event)", arg4, sizeof(struct epoll_event) ); +} + +PRE(sys_epoll_wait, MayBlock) +{ + PRINT("sys_epoll_wait ( %d, %p, %d, %d )", arg1, arg2, arg3, arg4); + PRE_REG_READ4(long, "epoll_wait", + int, epfd, struct epoll_event *, events, + int, maxevents, int, timeout); + PRE_MEM_WRITE( "epoll_wait(events)", arg2, sizeof(struct epoll_event)*arg3); +} + +POST(sys_epoll_wait) +{ + if (res > 0) + POST_MEM_WRITE( arg2, sizeof(struct epoll_event)*res ) ; +} + // Nb: this wrapper is "Special" because we have to pad/unpad memory around // the syscall itself, and this allows us to control exactly the code that // gets run while the padding is in place. diff --git a/coregrind/vg_syscalls.c b/coregrind/vg_syscalls.c index 5eba8303ed..66cf3b1063 100644 --- a/coregrind/vg_syscalls.c +++ b/coregrind/vg_syscalls.c @@ -42,8 +42,6 @@ having the simulator retain control. */ -#include "syscall_wrappers.h" - /* --------------------------------------------------------------------- A simple atfork() facility for Valgrind's internal use ------------------------------------------------------------------ */ @@ -434,8 +432,7 @@ void record_fd_close(Int tid, Int fd) already open, then we're probably doing a dup2() to an existing fd, so just overwrite the existing one. */ -static -void record_fd_open(Int tid, Int fd, char *pathname) +void VG_(record_fd_open)(Int tid, Int fd, char *pathname) { OpenFd *i; @@ -613,7 +610,7 @@ void do_hacky_preopened() for (i = 0; i < count; i++) if(VG_(fcntl)(i, VKI_F_GETFL, 0) != -1) - record_fd_open(-1, i, NULL); + VG_(record_fd_open)(-1, i, NULL); } /* Initialize the list of open file descriptors with the file descriptors @@ -639,7 +636,7 @@ void VG_(init_preopened_fds)() if(fno != f) if(VG_(clo_track_fds)) - record_fd_open(-1, fno, VG_(resolve_filename)(fno)); + VG_(record_fd_open)(-1, fno, VG_(resolve_filename)(fno)); } VG_(lseek)(f, d.d_off, VKI_SEEK_SET); @@ -764,8 +761,8 @@ void check_cmsg_for_fds(Int tid, struct vki_msghdr *msg) for (i = 0; i < fdc; i++) if(VG_(clo_track_fds)) // XXX: must we check the range on these fds with - // fd_allowed()? - record_fd_open (tid, fds[i], VG_(resolve_filename)(fds[i])); + // VG_(fd_allowed)()? + VG_(record_fd_open) (tid, fds[i], VG_(resolve_filename)(fds[i])); } cm = VKI_CMSG_NXTHDR(msg, cm); @@ -959,7 +956,7 @@ static Addr do_brk(Addr newbrk) ------------------------------------------------------------------ */ /* Return true if we're allowed to use or create this fd */ -static Bool fd_allowed(Int fd, const Char *syscallname, ThreadId tid, Bool soft) +Bool VG_(fd_allowed)(Int fd, const Char *syscallname, ThreadId tid, Bool soft) { if (fd < 0 || fd >= VG_(fd_hard_limit) || fd == VG_(clo_log_fd)) { VG_(message)(Vg_UserMsg, @@ -1536,38 +1533,6 @@ PRE(sys_setregid16, 0) PRE_REG_READ2(long, "setregid16", vki_old_gid_t, rgid, vki_old_gid_t, egid); } -PRE(sys_sendfile, MayBlock) -{ - PRINT("sys_sendfile ( %d, %d, %p, %llu )", arg1,arg2,arg3,(ULong)arg4); - PRE_REG_READ4(ssize_t, "sendfile", - int, out_fd, int, in_fd, vki_off_t *, offset, - vki_size_t, count); - if (arg3 != (UWord)NULL) - PRE_MEM_WRITE( "sendfile(offset)", arg3, sizeof(vki_off_t) ); -} - -POST(sys_sendfile) -{ - POST_MEM_WRITE( arg3, sizeof( vki_off_t ) ); -} - -PRE(sys_sendfile64, MayBlock) -{ - PRINT("sendfile64 ( %d, %d, %p, %llu )",arg1,arg2,arg3,(ULong)arg4); - PRE_REG_READ4(ssize_t, "sendfile64", - int, out_fd, int, in_fd, vki_loff_t *, offset, - vki_size_t, count); - if (arg3 != (UWord)NULL) - PRE_MEM_WRITE( "sendfile64(offset)", arg3, sizeof(vki_loff_t) ); -} - -POST(sys_sendfile64) -{ - if (arg3 != (UWord)NULL ) { - POST_MEM_WRITE( arg3, sizeof(vki_loff_t) ); - } -} - // XXX: only for 32-bit archs PRE(sys_pwrite64, MayBlock) { @@ -1910,7 +1875,7 @@ PRE(sys_close, 0) PRE_REG_READ1(long, "close", unsigned int, fd); /* Detect and negate attempts by the client to close Valgrind's log fd */ - if (!fd_allowed(arg1, "close", tid, False)) + if (!VG_(fd_allowed)(arg1, "close", tid, False)) set_result( -VKI_EBADF ); } @@ -1927,12 +1892,12 @@ PRE(sys_dup, 0) POST(sys_dup) { - if (!fd_allowed(res, "dup", tid, True)) { + if (!VG_(fd_allowed)(res, "dup", tid, True)) { VG_(close)(res); set_result( -VKI_EMFILE ); } else { if (VG_(clo_track_fds)) - record_fd_open(tid, res, VG_(resolve_filename)(res)); + VG_(record_fd_open)(tid, res, VG_(resolve_filename)(res)); } } @@ -1940,14 +1905,14 @@ PRE(sys_dup2, 0) { PRINT("sys_dup2 ( %d, %d )", arg1,arg2); PRE_REG_READ2(long, "dup2", unsigned int, oldfd, unsigned int, newfd); - if (!fd_allowed(arg2, "dup2", tid, True)) + if (!VG_(fd_allowed)(arg2, "dup2", tid, True)) set_result( -VKI_EBADF ); } POST(sys_dup2) { if (VG_(clo_track_fds)) - record_fd_open(tid, res, VG_(resolve_filename)(res)); + VG_(record_fd_open)(tid, res, VG_(resolve_filename)(res)); } PRE(sys_fcntl, 0) @@ -1962,12 +1927,12 @@ PRE(sys_fcntl, 0) POST(sys_fcntl) { if (arg2 == VKI_F_DUPFD) { - if (!fd_allowed(res, "fcntl(DUPFD)", tid, True)) { + if (!VG_(fd_allowed)(res, "fcntl(DUPFD)", tid, True)) { VG_(close)(res); set_result( -VKI_EMFILE ); } else { if (VG_(clo_track_fds)) - record_fd_open(tid, res, VG_(resolve_filename)(res)); + VG_(record_fd_open)(tid, res, VG_(resolve_filename)(res)); } } } @@ -2011,12 +1976,12 @@ PRE(sys_fcntl64, 0) POST(sys_fcntl64) { if (arg2 == VKI_F_DUPFD) { - if (!fd_allowed(res, "fcntl64(DUPFD)", tid, True)) { + if (!VG_(fd_allowed)(res, "fcntl64(DUPFD)", tid, True)) { VG_(close)(res); set_result( -VKI_EMFILE ); } else { if (VG_(clo_track_fds)) - record_fd_open(tid, res, VG_(resolve_filename)(res)); + VG_(record_fd_open)(tid, res, VG_(resolve_filename)(res)); } } } @@ -2078,32 +2043,6 @@ POST(sys_fork) } } -// XXX: x86-specific -PRE(sys_clone, Special) -{ - PRINT("sys_clone ( %d, %p, %p, %p, %p )",arg1,arg2,arg3,arg4,arg5); - // XXX: really not sure about the last two args... if they are really - // there, we should do PRE_MEM_READs for both of them... - PRE_REG_READ4(int, "clone", - unsigned long, flags, void *, child_stack, - int *, parent_tidptr, int *, child_tidptr); - - if (arg2 == 0 && - (arg1 == (VKI_CLONE_CHILD_CLEARTID|VKI_CLONE_CHILD_SETTID|VKI_SIGCHLD) - || arg1 == (VKI_CLONE_PARENT_SETTID|VKI_SIGCHLD))) - { - VGA_(gen_sys_fork_before)(tid, tst); - set_result( VG_(do_syscall)(SYSNO, arg1, arg2, arg3, arg4, arg5) ); - VGA_(gen_sys_fork_after) (tid, tst); - } else { - VG_(unimplemented) - ("clone(): not supported by Valgrind.\n " - "We do support programs linked against\n " - "libpthread.so, though. Re-run with -v and ensure that\n " - "you are picking up Valgrind's implementation of libpthread.so."); - } -} - PRE(sys_ftruncate, MayBlock) { PRINT("sys_ftruncate ( %d, %lld )", arg1,(ULong)arg2); @@ -4171,38 +4110,6 @@ PRE(sys_mkdir, MayBlock) PRE_MEM_RASCIIZ( "mkdir(pathname)", arg1 ); } -PRE(sys_mmap2, 0) -{ - // Exactly like old_mmap() except: - // - all 6 args are passed in regs, rather than in a memory-block. - // - the file offset is specified in pagesize units rather than bytes, - // so that it can be used for files bigger than 2^32 bytes. - PRINT("sys_mmap2 ( %p, %llu, %d, %d, %d, %d )", - arg1, (ULong)arg2, arg3, arg4, arg5, arg6 ); - PRE_REG_READ6(long, "mmap2", - unsigned long, start, unsigned long, length, - unsigned long, prot, unsigned long, flags, - unsigned long, fd, unsigned long, offset); - - if (arg4 & VKI_MAP_FIXED) { - if (!VG_(valid_client_addr)(arg1, arg2, tid, "mmap2")) - set_result( -VKI_ENOMEM ); - } else { - arg1 = VG_(find_map_space)(arg1, arg2, True); - if (arg1 == 0) - set_result( -VKI_ENOMEM ); - else - arg4 |= VKI_MAP_FIXED; - } -} - -POST(sys_mmap2) -{ - vg_assert(VG_(valid_client_addr)(res, arg2, tid, "mmap2")); - mmap_segment( (Addr)res, arg2, arg3, arg4, arg5, - arg6 * (ULong)VKI_PAGE_SIZE ); -} - PRE(old_mmap, Special) { /* struct mmap_arg_struct { @@ -4244,6 +4151,38 @@ PRE(old_mmap, Special) } } +PRE(sys_mmap2, 0) +{ + // Exactly like old_mmap() except: + // - all 6 args are passed in regs, rather than in a memory-block. + // - the file offset is specified in pagesize units rather than bytes, + // so that it can be used for files bigger than 2^32 bytes. + PRINT("sys_mmap2 ( %p, %llu, %d, %d, %d, %d )", + arg1, (ULong)arg2, arg3, arg4, arg5, arg6 ); + PRE_REG_READ6(long, "mmap2", + unsigned long, start, unsigned long, length, + unsigned long, prot, unsigned long, flags, + unsigned long, fd, unsigned long, offset); + + if (arg4 & VKI_MAP_FIXED) { + if (!VG_(valid_client_addr)(arg1, arg2, tid, "mmap2")) + set_result( -VKI_ENOMEM ); + } else { + arg1 = VG_(find_map_space)(arg1, arg2, True); + if (arg1 == 0) + set_result( -VKI_ENOMEM ); + else + arg4 |= VKI_MAP_FIXED; + } +} + +POST(sys_mmap2) +{ + vg_assert(VG_(valid_client_addr)(res, arg2, tid, "mmap2")); + mmap_segment( (Addr)res, arg2, arg3, arg4, arg5, + arg6 * (ULong)VKI_PAGE_SIZE ); +} + PRE(sys_mprotect, 0) { PRINT("sys_mprotect ( %p, %llu, %d )", arg1,(ULong)arg2,arg3); @@ -4335,12 +4274,12 @@ PRE(sys_open, MayBlock) POST(sys_open) { - if (!fd_allowed(res, "open", tid, True)) { + if (!VG_(fd_allowed)(res, "open", tid, True)) { VG_(close)(res); set_result( -VKI_EMFILE ); } else { if (VG_(clo_track_fds)) - record_fd_open(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1)); + VG_(record_fd_open)(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1)); } } @@ -4350,7 +4289,7 @@ PRE(sys_read, MayBlock) PRE_REG_READ3(ssize_t, "read", unsigned int, fd, char *, buf, size_t, count); - if (!fd_allowed(arg1, "read", tid, False)) + if (!VG_(fd_allowed)(arg1, "read", tid, False)) set_result( -VKI_EBADF ); else PRE_MEM_WRITE( "read(buf)", arg2, arg3 ); @@ -4366,7 +4305,7 @@ PRE(sys_write, MayBlock) PRINT("sys_write ( %d, %p, %llu )", arg1, arg2, (ULong)arg3); PRE_REG_READ3(ssize_t, "write", unsigned int, fd, const char *, buf, size_t, count); - if (!fd_allowed(arg1, "write", tid, False)) + if (!VG_(fd_allowed)(arg1, "write", tid, False)) set_result( -VKI_EBADF ); else PRE_MEM_READ( "write(buf)", arg2, arg3 ); @@ -4381,12 +4320,12 @@ PRE(sys_creat, MayBlock) POST(sys_creat) { - if (!fd_allowed(res, "creat", tid, True)) { + if (!VG_(fd_allowed)(res, "creat", tid, True)) { VG_(close)(res); set_result( -VKI_EMFILE ); } else { if (VG_(clo_track_fds)) - record_fd_open(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1)); + VG_(record_fd_open)(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1)); } } @@ -4403,16 +4342,16 @@ POST(sys_pipe) // XXX: use of Int here -- 32-bit-specific? Int *p = (Int *)arg1; - if (!fd_allowed(p[0], "pipe", tid, True) || - !fd_allowed(p[1], "pipe", tid, True)) { + if (!VG_(fd_allowed)(p[0], "pipe", tid, True) || + !VG_(fd_allowed)(p[1], "pipe", tid, True)) { VG_(close)(p[0]); VG_(close)(p[1]); set_result( -VKI_EMFILE ); } else { POST_MEM_WRITE( arg1, 2*sizeof(int) ); if (VG_(clo_track_fds)) { - record_fd_open(tid, p[0], NULL); - record_fd_open(tid, p[1], NULL); + VG_(record_fd_open)(tid, p[0], NULL); + VG_(record_fd_open)(tid, p[1], NULL); } } } @@ -4454,52 +4393,6 @@ POST(sys_poll) } } -PRE(sys_epoll_create, 0) -{ - PRINT("sys_epoll_create ( %d )", arg1); - PRE_REG_READ1(long, "epoll_create", int, size); -} - -POST(sys_epoll_create) -{ - if (!fd_allowed(res, "epoll_create", tid, True)) { - VG_(close)(res); - set_result( -VKI_EMFILE ); - } else { - if (VG_(clo_track_fds)) - record_fd_open (tid, res, NULL); - } -} - -PRE(sys_epoll_ctl, 0) -{ - static const char* epoll_ctl_s[3] = { - "EPOLL_CTL_ADD", - "EPOLL_CTL_DEL", - "EPOLL_CTL_MOD" - }; - PRINT("sys_epoll_ctl ( %d, %s, %d, %p )", - arg1, ( arg2<3 ? epoll_ctl_s[arg2] : "?" ), arg3, arg4); - PRE_REG_READ4(long, "epoll_ctl", - int, epfd, int, op, int, fd, struct epoll_event *, event); - PRE_MEM_READ( "epoll_ctl(event)", arg4, sizeof(struct epoll_event) ); -} - -PRE(sys_epoll_wait, MayBlock) -{ - PRINT("sys_epoll_wait ( %d, %p, %d, %d )", arg1, arg2, arg3, arg4); - PRE_REG_READ4(long, "epoll_wait", - int, epfd, struct epoll_event *, events, - int, maxevents, int, timeout); - PRE_MEM_WRITE( "epoll_wait(events)", arg2, sizeof(struct epoll_event)*arg3); -} - -POST(sys_epoll_wait) -{ - if (res > 0) - POST_MEM_WRITE( arg2, sizeof(struct epoll_event)*res ) ; -} - PRE(sys_readlink, 0) { PRINT("sys_readlink ( %p, %p, %llu )", arg1,arg2,(ULong)arg3); @@ -4522,7 +4415,7 @@ PRE(sys_readv, MayBlock) PRE_REG_READ3(ssize_t, "readv", unsigned long, fd, const struct iovec *, vector, unsigned long, count); - if (!fd_allowed(arg1, "readv", tid, False)) { + if (!VG_(fd_allowed)(arg1, "readv", tid, False)) { set_result( -VKI_EBADF ); } else { PRE_MEM_READ( "readv(vector)", arg2, arg3 * sizeof(struct vki_iovec) ); @@ -4596,39 +4489,6 @@ POST(sys_sched_getparam) POST_MEM_WRITE( arg2, sizeof(struct vki_sched_param) ); } -PRE(old_select, MayBlock) -{ - /* struct sel_arg_struct { - unsigned long n; - fd_set *inp, *outp, *exp; - struct timeval *tvp; - }; - */ - PRE_REG_READ1(long, "old_select", struct sel_arg_struct *, args); - PRE_MEM_READ( "old_select(args)", arg1, 5*sizeof(UWord) ); - - { - UInt* arg_struct = (UInt*)arg1; - UInt a1, a2, a3, a4, a5; - - a1 = arg_struct[0]; - a2 = arg_struct[1]; - a3 = arg_struct[2]; - a4 = arg_struct[3]; - a5 = arg_struct[4]; - - PRINT("old_select ( %d, %p, %p, %p, %p )", a1,a2,a3,a4,a5); - if (a2 != (Addr)NULL) - PRE_MEM_READ( "old_select(readfds)", a2, a1/8 /* __FD_SETSIZE/8 */ ); - if (a3 != (Addr)NULL) - PRE_MEM_READ( "old_select(writefds)", a3, a1/8 /* __FD_SETSIZE/8 */ ); - if (a4 != (Addr)NULL) - PRE_MEM_READ( "old_select(exceptfds)", a4, a1/8 /* __FD_SETSIZE/8 */ ); - if (a5 != (Addr)NULL) - PRE_MEM_READ( "old_select(timeout)", a5, sizeof(struct vki_timeval) ); - } -} - PRE(sys_select, MayBlock) { PRINT("sys_select ( %d, %p, %p, %p, %p )", arg1,arg2,arg3,arg4,arg5); @@ -4973,28 +4833,28 @@ POST(sys_socketcall) Int fd1 = ((Int*)((UWord*)arg2)[3])[0]; Int fd2 = ((Int*)((UWord*)arg2)[3])[1]; POST_MEM_WRITE( ((UWord*)arg2)[3], 2*sizeof(int) ); - if (!fd_allowed(fd1, "socketcall.socketpair", tid, True) || - !fd_allowed(fd2, "socketcall.socketpair", tid, True)) { + if (!VG_(fd_allowed)(fd1, "socketcall.socketpair", tid, True) || + !VG_(fd_allowed)(fd2, "socketcall.socketpair", tid, True)) { VG_(close)(fd1); VG_(close)(fd2); set_result( -VKI_EMFILE ); } else { POST_MEM_WRITE( ((UWord*)arg2)[3], 2*sizeof(int) ); if (VG_(clo_track_fds)) { - record_fd_open(tid, fd1, NULL); - record_fd_open(tid, fd2, NULL); + VG_(record_fd_open)(tid, fd1, NULL); + VG_(record_fd_open)(tid, fd2, NULL); } } break; } case VKI_SYS_SOCKET: - if (!fd_allowed(res, "socket", tid, True)) { + if (!VG_(fd_allowed)(res, "socket", tid, True)) { VG_(close)(res); set_result( -VKI_EMFILE ); } else { if (VG_(clo_track_fds)) - record_fd_open(tid, res, NULL); + VG_(record_fd_open)(tid, res, NULL); } break; @@ -5009,7 +4869,7 @@ POST(sys_socketcall) case VKI_SYS_ACCEPT: { /* int accept(int s, struct sockaddr *addr, int *addrlen); */ - if (!fd_allowed(res, "accept", tid, True)) { + if (!VG_(fd_allowed)(res, "accept", tid, True)) { VG_(close)(res); set_result( -VKI_EMFILE ); } else { @@ -5020,7 +4880,7 @@ POST(sys_socketcall) buf_and_len_post_check ( tid, res, addr_p, addrlen_p, "socketcall.accept(addrlen_out)" ); if (VG_(clo_track_fds)) - record_fd_open(tid, res, NULL); + VG_(record_fd_open)(tid, res, NULL); } break; } @@ -5299,7 +5159,7 @@ PRE(sys_writev, MayBlock) PRE_REG_READ3(ssize_t, "writev", unsigned long, fd, const struct iovec *, vector, unsigned long, count); - if (!fd_allowed(arg1, "writev", tid, False)) { + if (!VG_(fd_allowed)(arg1, "writev", tid, False)) { set_result( -VKI_EBADF ); } else { PRE_MEM_READ( "writev(vector)", @@ -5323,33 +5183,6 @@ PRE(sys_utimes, 0) PRE_MEM_READ( "utimes(tvp)", arg2, sizeof(struct vki_timeval) ); } -PRE(sys_futex, MayBlock) -{ - PRINT("sys_futex ( %p, %d, %d, %p, %p )", arg1,arg2,arg3,arg4,arg5); - PRE_REG_READ6(long, "futex", - vki_u32 *, futex, int, op, int, val, - struct timespec *, utime, vki_u32 *, uaddr2, int, val3); - PRE_MEM_READ( "futex(futex)", arg1, sizeof(int) ); - if (arg2 == VKI_FUTEX_WAIT && arg4 != (UWord)NULL) - PRE_MEM_READ( "futex(timeout)", arg4, sizeof(struct vki_timespec) ); - if (arg2 == VKI_FUTEX_REQUEUE) - PRE_MEM_READ( "futex(futex2)", arg4, sizeof(int) ); -} - -POST(sys_futex) -{ - POST_MEM_WRITE( arg1, sizeof(int) ); - if (arg2 == VKI_FUTEX_FD) { - if (!fd_allowed(res, "futex", tid, True)) { - VG_(close)(res); - set_result( -VKI_EMFILE ); - } else { - if (VG_(clo_track_fds)) - record_fd_open(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1)); - } - } -} - PRE(sys_sched_setaffinity, 0) { PRINT("sched_setaffinity ( %d, %d, %p )", arg1, arg2, arg3); @@ -5645,12 +5478,12 @@ PRE(sys_mq_open, 0) POST(sys_mq_open) { - if (!fd_allowed(res, "mq_open", tid, True)) { + if (!VG_(fd_allowed)(res, "mq_open", tid, True)) { VG_(close)(res); set_result( -VKI_EMFILE ); } else { if (VG_(clo_track_fds)) - record_fd_open(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1)); + VG_(record_fd_open)(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1)); } } @@ -5668,7 +5501,7 @@ PRE(sys_mq_timedsend, MayBlock) PRE_REG_READ5(long, "mq_timedsend", vki_mqd_t, mqdes, const char *, msg_ptr, vki_size_t, msg_len, unsigned int, msg_prio, const struct timespec *, abs_timeout); - if (!fd_allowed(arg1, "mq_timedsend", tid, False)) { + if (!VG_(fd_allowed)(arg1, "mq_timedsend", tid, False)) { set_result( -VKI_EBADF ); } else { PRE_MEM_READ( "mq_timedsend(msg_ptr)", arg2, arg3 ); @@ -5686,7 +5519,7 @@ PRE(sys_mq_timedreceive, MayBlock) vki_mqd_t, mqdes, char *, msg_ptr, vki_size_t, msg_len, unsigned int *, msg_prio, const struct timespec *, abs_timeout); - if (!fd_allowed(arg1, "mq_timedreceive", tid, False)) { + if (!VG_(fd_allowed)(arg1, "mq_timedreceive", tid, False)) { set_result( -VKI_EBADF ); } else { PRE_MEM_WRITE( "mq_timedreceive(msg_ptr)", arg2, arg3 ); @@ -5711,7 +5544,7 @@ PRE(sys_mq_notify, 0) PRINT("sys_mq_notify( %d, %p )", arg1,arg2 ); PRE_REG_READ2(long, "mq_notify", vki_mqd_t, mqdes, const struct sigevent *, notification); - if (!fd_allowed(arg1, "mq_notify", tid, False)) + if (!VG_(fd_allowed)(arg1, "mq_notify", tid, False)) set_result( -VKI_EBADF ); else if (arg2 != 0) PRE_MEM_READ( "mq_notify(notification)", @@ -5724,7 +5557,7 @@ PRE(sys_mq_getsetattr, 0) PRE_REG_READ3(long, "mq_getsetattr", vki_mqd_t, mqdes, const struct mq_attr *, mqstat, struct mq_attr *, omqstat); - if (!fd_allowed(arg1, "mq_getsetattr", tid, False)) { + if (!VG_(fd_allowed)(arg1, "mq_getsetattr", tid, False)) { set_result( -VKI_EBADF ); } else { if (arg2 != 0) { diff --git a/coregrind/x86-linux/syscalls.c b/coregrind/x86-linux/syscalls.c index 970695d2f6..7152b08689 100644 --- a/coregrind/x86-linux/syscalls.c +++ b/coregrind/x86-linux/syscalls.c @@ -30,8 +30,6 @@ #include "core.h" -#include "syscall_wrappers.h" - /* We need our own copy of VG_(do_syscall)() to handle a special race-condition. If we've got signals unblocked, and we take a signal in the gap either just before or after the syscall, we may @@ -198,6 +196,64 @@ void VGA_(restart_syscall)(arch_thread_t *arch) if (VG_(clo_trace_syscalls)) \ VG_(printf)(format, ## args) +PRE(old_select, MayBlock) +{ + /* struct sel_arg_struct { + unsigned long n; + fd_set *inp, *outp, *exp; + struct timeval *tvp; + }; + */ + PRE_REG_READ1(long, "old_select", struct sel_arg_struct *, args); + PRE_MEM_READ( "old_select(args)", arg1, 5*sizeof(UWord) ); + + { + UInt* arg_struct = (UInt*)arg1; + UInt a1, a2, a3, a4, a5; + + a1 = arg_struct[0]; + a2 = arg_struct[1]; + a3 = arg_struct[2]; + a4 = arg_struct[3]; + a5 = arg_struct[4]; + + PRINT("old_select ( %d, %p, %p, %p, %p )", a1,a2,a3,a4,a5); + if (a2 != (Addr)NULL) + PRE_MEM_READ( "old_select(readfds)", a2, a1/8 /* __FD_SETSIZE/8 */ ); + if (a3 != (Addr)NULL) + PRE_MEM_READ( "old_select(writefds)", a3, a1/8 /* __FD_SETSIZE/8 */ ); + if (a4 != (Addr)NULL) + PRE_MEM_READ( "old_select(exceptfds)", a4, a1/8 /* __FD_SETSIZE/8 */ ); + if (a5 != (Addr)NULL) + PRE_MEM_READ( "old_select(timeout)", a5, sizeof(struct vki_timeval) ); + } +} + +PRE(sys_clone, Special) +{ + PRINT("sys_clone ( %d, %p, %p, %p, %p )",arg1,arg2,arg3,arg4,arg5); + // XXX: really not sure about the last two args... if they are really + // there, we should do PRE_MEM_READs for both of them... + PRE_REG_READ4(int, "clone", + unsigned long, flags, void *, child_stack, + int *, parent_tidptr, int *, child_tidptr); + + if (arg2 == 0 && + (arg1 == (VKI_CLONE_CHILD_CLEARTID|VKI_CLONE_CHILD_SETTID|VKI_SIGCHLD) + || arg1 == (VKI_CLONE_PARENT_SETTID|VKI_SIGCHLD))) + { + VGA_(gen_sys_fork_before)(tid, tst); + set_result( VG_(do_syscall)(SYSNO, arg1, arg2, arg3, arg4, arg5) ); + VGA_(gen_sys_fork_after) (tid, tst); + } else { + VG_(unimplemented) + ("clone(): not supported by Valgrind.\n " + "We do support programs linked against\n " + "libpthread.so, though. Re-run with -v and ensure that\n " + "you are picking up Valgrind's implementation of libpthread.so."); + } +} + PRE(sys_modify_ldt, Special) { PRINT("sys_modify_ldt ( %d, %p, %d )", arg1,arg2,arg3); @@ -282,8 +338,14 @@ PRE(sys_get_thread_area, Special) [const] = { &x86_linux_##name##_flags, x86_linux_##name##_before, \ x86_linux_##name##_after } -// This table maps from __NR_xxx syscall numbers to the appropriate -// PRE/POST sys_foo() wrappers on x86. +// This table maps from __NR_xxx syscall numbers (from +// linux/include/asm-i386/unistd.h) to the appropriate PRE/POST sys_foo() +// wrappers on x86 (as per sys_call_table in linux/arch/i386/kernel/entry.S). +// +// For those syscalls not handled by Valgrind, the annotation indicate its +// arch/OS combination, eg. */* (generic), */Linux (Linux only), ?/? +// (unknown). + const struct SyscallTableEntry VGA_(syscall_table)[] = { // (restart_syscall) // 0 GENX_(__NR_exit, sys_exit), // 1 @@ -298,15 +360,15 @@ const struct SyscallTableEntry VGA_(syscall_table)[] = { GENX_(__NR_link, sys_link), // 9 GENX_(__NR_unlink, sys_unlink), // 10 - GENX_(__NR_execve, sys_execve), // 11 (*??) P + GENX_(__NR_execve, sys_execve), // 11 GENX_(__NR_chdir, sys_chdir), // 12 GENXY(__NR_time, sys_time), // 13 GENX_(__NR_mknod, sys_mknod), // 14 GENX_(__NR_chmod, sys_chmod), // 15 // (__NR_lchown, sys_lchown16), // 16 ## P - GENX_(__NR_break, sys_ni_syscall), // 17 -- unimplemented - // (__NR_oldstat, sys_stat), // 18 * L -- obsolete + GENX_(__NR_break, sys_ni_syscall), // 17 + // (__NR_oldstat, sys_stat), // 18 (obsolete) GENX_(__NR_lseek, sys_lseek), // 19 GENX_(__NR_getpid, sys_getpid), // 20 @@ -315,156 +377,156 @@ const struct SyscallTableEntry VGA_(syscall_table)[] = { GENX_(__NR_setuid, sys_setuid16), // 23 ## P GENX_(__NR_getuid, sys_getuid16), // 24 ## P - // (__NR_stime, sys_stime), // 25 * (SVr4,SVID,X/OPEN) - GENXY(__NR_ptrace, sys_ptrace), // 26 (x86?) (L?) - GENX_(__NR_alarm, sys_alarm), // 27 * P - // (__NR_oldfstat, sys_fstat), // 28 * L -- obsolete - GENX_(__NR_pause, sys_pause), // 29 * P + // (__NR_stime, sys_stime), // 25 * (SVr4,SVID,X/OPEN) + GENXY(__NR_ptrace, sys_ptrace), // 26 + GENX_(__NR_alarm, sys_alarm), // 27 + // (__NR_oldfstat, sys_fstat), // 28 * L -- obsolete + GENX_(__NR_pause, sys_pause), // 29 - GENX_(__NR_utime, sys_utime), // 30 * P - GENX_(__NR_stty, sys_ni_syscall), // 31 -- unimplemented - GENX_(__NR_gtty, sys_ni_syscall), // 32 -- unimplemented - GENX_(__NR_access, sys_access), // 33 * P - GENX_(__NR_nice, sys_nice), // 34 * (almost P) + GENX_(__NR_utime, sys_utime), // 30 + GENX_(__NR_stty, sys_ni_syscall), // 31 + GENX_(__NR_gtty, sys_ni_syscall), // 32 + GENX_(__NR_access, sys_access), // 33 + GENX_(__NR_nice, sys_nice), // 34 - GENX_(__NR_ftime, sys_ni_syscall), // 35 -- unimplemented - GENX_(__NR_sync, sys_sync), // 36 * (almost P) + GENX_(__NR_ftime, sys_ni_syscall), // 35 + GENX_(__NR_sync, sys_sync), // 36 GENXY(__NR_kill, sys_kill), // 37 GENX_(__NR_rename, sys_rename), // 38 GENX_(__NR_mkdir, sys_mkdir), // 39 GENX_(__NR_rmdir, sys_rmdir), // 40 GENXY(__NR_dup, sys_dup), // 41 - GENXY(__NR_pipe, sys_pipe), // 42 (x86) P + GENXY(__NR_pipe, sys_pipe), // 42 GENXY(__NR_times, sys_times), // 43 - GENX_(__NR_prof, sys_ni_syscall), // 44 -- unimplemented + GENX_(__NR_prof, sys_ni_syscall), // 44 - GENX_(__NR_brk, sys_brk), // 45 * non-P - GENX_(__NR_setgid, sys_setgid16), // 46 ## (SVr4,SVID) - GENX_(__NR_getgid, sys_getgid16), // 47 ## P - // (__NR_signal, sys_signal), // 48 * (ANSI C?) - GENX_(__NR_geteuid, sys_geteuid16), // 49 ## P + GENX_(__NR_brk, sys_brk), // 45 + GENX_(__NR_setgid, sys_setgid16), // 46 + GENX_(__NR_getgid, sys_getgid16), // 47 + // (__NR_signal, sys_signal), // 48 */* (ANSI C) + GENX_(__NR_geteuid, sys_geteuid16), // 49 - GENX_(__NR_getegid, sys_getegid16), // 50 ## (P16) - GENX_(__NR_acct, sys_acct), // 51 * (SVR4, non-POSIX) + GENX_(__NR_getegid, sys_getegid16), // 50 + GENX_(__NR_acct, sys_acct), // 51 LINX_(__NR_umount2, sys_umount), // 52 - GENX_(__NR_lock, sys_ni_syscall), // 53 -- unimplemented - GENXY(__NR_ioctl, sys_ioctl), // 54 */x86 (varying) + GENX_(__NR_lock, sys_ni_syscall), // 53 + GENXY(__NR_ioctl, sys_ioctl), // 54 GENXY(__NR_fcntl, sys_fcntl), // 55 - GENX_(__NR_mpx, sys_ni_syscall), // 56 -- unimplemented - GENXY(__NR_setpgid, sys_setpgid), // 57 * P - GENX_(__NR_ulimit, sys_ni_syscall), // 58 -- unimplemented - // (__NR_oldolduname, sys_olduname), // 59 (?) L -- obsolete + GENX_(__NR_mpx, sys_ni_syscall), // 56 + GENXY(__NR_setpgid, sys_setpgid), // 57 + GENX_(__NR_ulimit, sys_ni_syscall), // 58 + // (__NR_oldolduname, sys_olduname), // 59 Linux -- obsolete GENX_(__NR_umask, sys_umask), // 60 - GENX_(__NR_chroot, sys_chroot), // 61 * (almost P) - // (__NR_ustat, sys_ustat) // 62 * (SVr4) -- deprecated + GENX_(__NR_chroot, sys_chroot), // 61 + // (__NR_ustat, sys_ustat) // 62 SVr4 -- deprecated GENXY(__NR_dup2, sys_dup2), // 63 GENX_(__NR_getppid, sys_getppid), // 64 GENX_(__NR_getpgrp, sys_getpgrp), // 65 GENX_(__NR_setsid, sys_setsid), // 66 - GENXY(__NR_sigaction, sys_sigaction), // 67 (x86) P - // (__NR_sgetmask, sys_sgetmask), // 68 * (ANSI C) - // (__NR_ssetmask, sys_ssetmask), // 69 * (ANSI C) - - GENX_(__NR_setreuid, sys_setreuid16), // 70 ## (BSD4.3) - GENX_(__NR_setregid, sys_setregid16), // 71 ## (BSD4.3) - GENX_(__NR_sigsuspend, sys_sigsuspend), // 72 () P - GENXY(__NR_sigpending, sys_sigpending), // 73 * P - // (__NR_sethostname, sys_sethostname), // 74 * (almost P) - - GENX_(__NR_setrlimit, sys_setrlimit), // 75 * (SVr4,BSD4.3) - GENXY(__NR_getrlimit, sys_old_getrlimit), // 76 * (SVr4,BSD4.3) - GENXY(__NR_getrusage, sys_getrusage), // 77 * (SVr4,BSD4.3) - GENXY(__NR_gettimeofday, sys_gettimeofday), // 78 * P - GENX_(__NR_settimeofday, sys_settimeofday), // 79 * almost-P - - GENXY(__NR_getgroups, sys_getgroups16), // 80 ## P - GENX_(__NR_setgroups, sys_setgroups16), // 81 ## almost-P - GENX_(__NR_select, old_select), // 82 (x86) (4.4BSD) - GENX_(__NR_symlink, sys_symlink), // 83 * P - // (__NR_oldlstat, sys_lstat), // 84 * L -- obsolete - - GENXY(__NR_readlink, sys_readlink), // 85 * (X/OPEN,4.4BSD) - // (__NR_uselib, sys_uselib), // 86 * L - // (__NR_swapon, sys_swapon), // 87 * L - // (__NR_reboot, sys_reboot), // 88 * L - // (__NR_readdir, old_readdir), // 89 () L -- superseded - - GENX_(__NR_mmap, old_mmap), // 90 (x86) (P but not...) + GENXY(__NR_sigaction, sys_sigaction), // 67 + // (__NR_sgetmask, sys_sgetmask), // 68 */* (ANSI C) + // (__NR_ssetmask, sys_ssetmask), // 69 */* (ANSI C) + + GENX_(__NR_setreuid, sys_setreuid16), // 70 + GENX_(__NR_setregid, sys_setregid16), // 71 + GENX_(__NR_sigsuspend, sys_sigsuspend), // 72 + GENXY(__NR_sigpending, sys_sigpending), // 73 + // (__NR_sethostname, sys_sethostname), // 74 */* + + GENX_(__NR_setrlimit, sys_setrlimit), // 75 + GENXY(__NR_getrlimit, sys_old_getrlimit), // 76 + GENXY(__NR_getrusage, sys_getrusage), // 77 + GENXY(__NR_gettimeofday, sys_gettimeofday), // 78 + GENX_(__NR_settimeofday, sys_settimeofday), // 79 + + GENXY(__NR_getgroups, sys_getgroups16), // 80 + GENX_(__NR_setgroups, sys_setgroups16), // 81 + PLAX_(__NR_select, old_select), // 82 + GENX_(__NR_symlink, sys_symlink), // 83 + // (__NR_oldlstat, sys_lstat), // 84 -- obsolete + + GENXY(__NR_readlink, sys_readlink), // 85 + // (__NR_uselib, sys_uselib), // 86 */Linux + // (__NR_swapon, sys_swapon), // 87 */Linux + // (__NR_reboot, sys_reboot), // 88 */Linux + // (__NR_readdir, old_readdir), // 89 -- superseded + + GENX_(__NR_mmap, old_mmap), // 90 GENXY(__NR_munmap, sys_munmap), // 91 GENX_(__NR_truncate, sys_truncate), // 92 GENX_(__NR_ftruncate, sys_ftruncate), // 93 GENX_(__NR_fchmod, sys_fchmod), // 94 - GENX_(__NR_fchown, sys_fchown16), // 95 ## (SVr4,BSD4.3) - GENX_(__NR_getpriority, sys_getpriority), // 96 * (SVr4,4.4BSD) - GENX_(__NR_setpriority, sys_setpriority), // 97 * (SVr4,4.4BSD) - GENX_(__NR_profil, sys_ni_syscall), // 98 -- unimplemented - GENXY(__NR_statfs, sys_statfs), // 99 * (P-ish) + GENX_(__NR_fchown, sys_fchown16), // 95 + GENX_(__NR_getpriority, sys_getpriority), // 96 + GENX_(__NR_setpriority, sys_setpriority), // 97 + GENX_(__NR_profil, sys_ni_syscall), // 98 + GENXY(__NR_statfs, sys_statfs), // 99 - GENXY(__NR_fstatfs, sys_fstatfs), // 100 * (P-ish) - LINX_(__NR_ioperm, sys_ioperm), // 101 * L - GENXY(__NR_socketcall, sys_socketcall), // 102 */Linux (?) + GENXY(__NR_fstatfs, sys_fstatfs), // 100 + LINX_(__NR_ioperm, sys_ioperm), // 101 + GENXY(__NR_socketcall, sys_socketcall), // 102 LINXY(__NR_syslog, sys_syslog), // 103 - GENXY(__NR_setitimer, sys_setitimer), // 104 * (SVr4,4.4BSD) + GENXY(__NR_setitimer, sys_setitimer), // 104 - GENXY(__NR_getitimer, sys_getitimer), // 105 * (SVr4,4.4BSD) - GENXY(__NR_stat, sys_newstat), // 106 * P - GENXY(__NR_lstat, sys_newlstat), // 107 * - GENXY(__NR_fstat, sys_newfstat), // 108 * P (SVr4,BSD4.3) - // (__NR_olduname, sys_uname), // 109 (?) L -- obsolete + GENXY(__NR_getitimer, sys_getitimer), // 105 + GENXY(__NR_stat, sys_newstat), // 106 + GENXY(__NR_lstat, sys_newlstat), // 107 + GENXY(__NR_fstat, sys_newfstat), // 108 + // (__NR_olduname, sys_uname), // 109 -- obsolete - GENX_(__NR_iopl, sys_iopl), // 110 (x86/amd64) L + GENX_(__NR_iopl, sys_iopl), // 110 LINX_(__NR_vhangup, sys_vhangup), // 111 - GENX_(__NR_idle, sys_ni_syscall), // 112 -- unimplemented + GENX_(__NR_idle, sys_ni_syscall), // 112 // (__NR_vm86old, sys_vm86old), // 113 x86/Linux-only - GENXY(__NR_wait4, sys_wait4), // 114 * P + GENXY(__NR_wait4, sys_wait4), // 114 // (__NR_swapoff, sys_swapoff), // 115 */Linux LINXY(__NR_sysinfo, sys_sysinfo), // 116 - GENXY(__NR_ipc, sys_ipc), // 117 (x86) L + GENXY(__NR_ipc, sys_ipc), // 117 GENX_(__NR_fsync, sys_fsync), // 118 - // (__NR_sigreturn, sys_sigreturn), // 119 () L + // (__NR_sigreturn, sys_sigreturn), // 119 ?/Linux - GENX_(__NR_clone, sys_clone), // 120 (x86) L - // (__NR_setdomainname, sys_setdomainname), // 121 * (non-P?) - GENXY(__NR_uname, sys_newuname), // 122 * P - PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 (x86,amd64) L - LINXY(__NR_adjtimex, sys_adjtimex), // 124 * L + PLAX_(__NR_clone, sys_clone), // 120 + // (__NR_setdomainname, sys_setdomainname), // 121 */*(?) + GENXY(__NR_uname, sys_newuname), // 122 + PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 + LINXY(__NR_adjtimex, sys_adjtimex), // 124 - GENXY(__NR_mprotect, sys_mprotect), // 125 * P - GENXY(__NR_sigprocmask, sys_sigprocmask), // 126 * P + GENXY(__NR_mprotect, sys_mprotect), // 125 + GENXY(__NR_sigprocmask, sys_sigprocmask), // 126 // Nb: create_module() was removed 2.4-->2.6 - GENX_(__NR_create_module, sys_ni_syscall), // 127 -- unimplemented - GENX_(__NR_init_module, sys_init_module), // 128 * L? - // (__NR_delete_module, sys_delete_module), // 129 () (L?) + GENX_(__NR_create_module, sys_ni_syscall), // 127 + GENX_(__NR_init_module, sys_init_module), // 128 + // (__NR_delete_module, sys_delete_module), // 129 (*/Linux)? // Nb: get_kernel_syms() was removed 2.4-->2.6 - GENX_(__NR_get_kernel_syms, sys_ni_syscall), // 130 -- unimplemented - GENX_(__NR_quotactl, sys_quotactl), // 131 * (?) + GENX_(__NR_get_kernel_syms, sys_ni_syscall), // 130 + GENX_(__NR_quotactl, sys_quotactl), // 131 GENX_(__NR_getpgid, sys_getpgid), // 132 - GENX_(__NR_fchdir, sys_fchdir), // 133 * (almost-P) - // (__NR_bdflush, sys_bdflush), // 134 * L + GENX_(__NR_fchdir, sys_fchdir), // 133 + // (__NR_bdflush, sys_bdflush), // 134 */Linux - // (__NR_sysfs, sys_sysfs), // 135 * (SVr4) + // (__NR_sysfs, sys_sysfs), // 135 SVr4 LINX_(__NR_personality, sys_personality), // 136 - GENX_(__NR_afs_syscall, sys_ni_syscall), // 137 -- unimplemented - LINX_(__NR_setfsuid, sys_setfsuid16), // 138 ## L - LINX_(__NR_setfsgid, sys_setfsgid16), // 139 ## L + GENX_(__NR_afs_syscall, sys_ni_syscall), // 137 + LINX_(__NR_setfsuid, sys_setfsuid16), // 138 + LINX_(__NR_setfsgid, sys_setfsgid16), // 139 LINXY(__NR__llseek, sys_llseek), // 140 - GENXY(__NR_getdents, sys_getdents), // 141 * (SVr4,SVID) - GENX_(__NR__newselect, sys_select), // 142 * (4.4BSD...) - GENX_(__NR_flock, sys_flock), // 143 * (4.4BSD...) - GENX_(__NR_msync, sys_msync), // 144 * P - - GENXY(__NR_readv, sys_readv), // 145 * P - GENX_(__NR_writev, sys_writev), // 146 * P - GENX_(__NR_getsid, sys_getsid), // 147 * P - GENX_(__NR_fdatasync, sys_fdatasync), // 148 * P + GENXY(__NR_getdents, sys_getdents), // 141 + GENX_(__NR__newselect, sys_select), // 142 + GENX_(__NR_flock, sys_flock), // 143 + GENX_(__NR_msync, sys_msync), // 144 + + GENXY(__NR_readv, sys_readv), // 145 + GENX_(__NR_writev, sys_writev), // 146 + GENX_(__NR_getsid, sys_getsid), // 147 + GENX_(__NR_fdatasync, sys_fdatasync), // 148 LINXY(__NR__sysctl, sys_sysctl), // 149 GENX_(__NR_mlock, sys_mlock), // 150 @@ -480,105 +542,105 @@ const struct SyscallTableEntry VGA_(syscall_table)[] = { GENX_(__NR_sched_get_priority_max, sys_sched_get_priority_max),// 159 GENX_(__NR_sched_get_priority_min, sys_sched_get_priority_min),// 160 - // (__NR_sched_rr_get_interval, sys_sched_rr_get_interval), // 161 (gen) + // (__NR_sched_rr_get_interval, sys_sched_rr_get_interval), // 161 */* GENXY(__NR_nanosleep, sys_nanosleep), // 162 GENX_(__NR_mremap, sys_mremap), // 163 LINX_(__NR_setresuid, sys_setresuid16), // 164 LINXY(__NR_getresuid, sys_getresuid16), // 165 // (__NR_vm86, sys_vm86), // 166 x86/Linux-only - GENX_(__NR_query_module, sys_ni_syscall), // 167 -- unimplemented - GENXY(__NR_poll, sys_poll), // 168 * (XPG4-UNIX) - // (__NR_nfsservctl, sys_nfsservctl), // 169 * L + GENX_(__NR_query_module, sys_ni_syscall), // 167 + GENXY(__NR_poll, sys_poll), // 168 + // (__NR_nfsservctl, sys_nfsservctl), // 169 */Linux LINX_(__NR_setresgid, sys_setresgid16), // 170 LINXY(__NR_getresgid, sys_getresgid16), // 171 LINX_(__NR_prctl, sys_prctl), // 172 - // (__NR_rt_sigreturn, sys_rt_sigreturn), // 173 (x86) () - GENXY(__NR_rt_sigaction, sys_rt_sigaction), // 174 (x86) () - - GENXY(__NR_rt_sigprocmask, sys_rt_sigprocmask), // 175 * ? - GENXY(__NR_rt_sigpending, sys_rt_sigpending), // 176 * ? - GENXY(__NR_rt_sigtimedwait, sys_rt_sigtimedwait),// 177 * ? - GENXY(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo),// 178 * ? - GENX_(__NR_rt_sigsuspend, sys_rt_sigsuspend), // 179 () () - GENXY(__NR_pread64, sys_pread64), // 180 * (Unix98?) - - GENX_(__NR_pwrite64, sys_pwrite64), // 181 * (Unix98?) - GENX_(__NR_chown, sys_chown16), // 182 * P - GENXY(__NR_getcwd, sys_getcwd), // 183 * P - GENXY(__NR_capget, sys_capget), // 184 * L? - - GENX_(__NR_capset, sys_capset), // 185 * L? - GENXY(__NR_sigaltstack, sys_sigaltstack), // 186 (x86) (XPG4-UNIX) - GENXY(__NR_sendfile, sys_sendfile), // 187 * L - GENXY(__NR_getpmsg, sys_getpmsg), // 188 (?) (?) - GENX_(__NR_putpmsg, sys_putpmsg), // 189 (?) (?) + // (__NR_rt_sigreturn, sys_rt_sigreturn), // 173 x86/Linux only? + GENXY(__NR_rt_sigaction, sys_rt_sigaction), // 174 + + GENXY(__NR_rt_sigprocmask, sys_rt_sigprocmask), // 175 + GENXY(__NR_rt_sigpending, sys_rt_sigpending), // 176 + GENXY(__NR_rt_sigtimedwait, sys_rt_sigtimedwait),// 177 + GENXY(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo),// 178 + GENX_(__NR_rt_sigsuspend, sys_rt_sigsuspend), // 179 + + GENXY(__NR_pread64, sys_pread64), // 180 + GENX_(__NR_pwrite64, sys_pwrite64), // 181 + GENX_(__NR_chown, sys_chown16), // 182 + GENXY(__NR_getcwd, sys_getcwd), // 183 + GENXY(__NR_capget, sys_capget), // 184 + + GENX_(__NR_capset, sys_capset), // 185 + GENXY(__NR_sigaltstack, sys_sigaltstack), // 186 + LINXY(__NR_sendfile, sys_sendfile), // 187 + GENXY(__NR_getpmsg, sys_getpmsg), // 188 + GENX_(__NR_putpmsg, sys_putpmsg), // 189 // Nb: we convert vfork() to fork() in VG_(pre_syscall)(). - // (__NR_vfork, sys_vfork), // 190 -- Valgrind avoids - GENXY(__NR_ugetrlimit, sys_getrlimit), // 191 * (?) - GENXY(__NR_mmap2, sys_mmap2), // 192 (x86?) P? - GENX_(__NR_truncate64, sys_truncate64), // 193 %% (P?) - GENX_(__NR_ftruncate64, sys_ftruncate64), // 194 %% (P?) + // (__NR_vfork, sys_vfork), // 190 + GENXY(__NR_ugetrlimit, sys_getrlimit), // 191 + GENXY(__NR_mmap2, sys_mmap2), // 192 + GENX_(__NR_truncate64, sys_truncate64), // 193 + GENX_(__NR_ftruncate64, sys_ftruncate64), // 194 - GENXY(__NR_stat64, sys_stat64), // 195 %% (?) - GENXY(__NR_lstat64, sys_lstat64), // 196 %% (?) - GENXY(__NR_fstat64, sys_fstat64), // 197 %% (?) - GENX_(__NR_lchown32, sys_lchown), // 198 * (L?) + GENXY(__NR_stat64, sys_stat64), // 195 + GENXY(__NR_lstat64, sys_lstat64), // 196 + GENXY(__NR_fstat64, sys_fstat64), // 197 + GENX_(__NR_lchown32, sys_lchown), // 198 GENX_(__NR_getuid32, sys_getuid), // 199 GENX_(__NR_getgid32, sys_getgid), // 200 GENX_(__NR_geteuid32, sys_geteuid), // 201 GENX_(__NR_getegid32, sys_getegid), // 202 - GENX_(__NR_setreuid32, sys_setreuid), // 203 * (BSD4.3) - GENX_(__NR_setregid32, sys_setregid), // 204 * (BSD4.3) + GENX_(__NR_setreuid32, sys_setreuid), // 203 + GENX_(__NR_setregid32, sys_setregid), // 204 - GENXY(__NR_getgroups32, sys_getgroups), // 205 * P - GENX_(__NR_setgroups32, sys_setgroups), // 206 * almost-P - GENX_(__NR_fchown32, sys_fchown), // 207 * (SVr4,BSD4.3) + GENXY(__NR_getgroups32, sys_getgroups), // 205 + GENX_(__NR_setgroups32, sys_setgroups), // 206 + GENX_(__NR_fchown32, sys_fchown), // 207 LINX_(__NR_setresuid32, sys_setresuid), // 208 LINXY(__NR_getresuid32, sys_getresuid), // 209 LINX_(__NR_setresgid32, sys_setresgid), // 210 LINXY(__NR_getresgid32, sys_getresgid), // 211 - GENX_(__NR_chown32, sys_chown), // 212 * P - GENX_(__NR_setuid32, sys_setuid), // 213 * - GENX_(__NR_setgid32, sys_setgid), // 214 * (SVr4,SVID) + GENX_(__NR_chown32, sys_chown), // 212 + GENX_(__NR_setuid32, sys_setuid), // 213 + GENX_(__NR_setgid32, sys_setgid), // 214 LINX_(__NR_setfsuid32, sys_setfsuid), // 215 LINX_(__NR_setfsgid32, sys_setfsgid), // 216 // (__NR_pivot_root, sys_pivot_root), // 217 */Linux - GENXY(__NR_mincore, sys_mincore), // 218 * non-P? - GENX_(__NR_madvise, sys_madvise), // 219 * P + GENXY(__NR_mincore, sys_mincore), // 218 + GENX_(__NR_madvise, sys_madvise), // 219 - GENXY(__NR_getdents64, sys_getdents64), // 220 * (SVr4,SVID?) - GENXY(__NR_fcntl64, sys_fcntl64), // 221 * P? - GENX_(222, sys_ni_syscall), // 222 -- reserved for TUX - GENX_(223, sys_ni_syscall), // 223 -- unused + GENXY(__NR_getdents64, sys_getdents64), // 220 + GENXY(__NR_fcntl64, sys_fcntl64), // 221 + GENX_(222, sys_ni_syscall), // 222 + GENX_(223, sys_ni_syscall), // 223 // (__NR_gettid, sys_gettid), // 224 */Linux // (__NR_readahead, sys_readahead), // 225 */(Linux?) - GENX_(__NR_setxattr, sys_setxattr), // 226 * L? - GENX_(__NR_lsetxattr, sys_lsetxattr), // 227 * L? - GENX_(__NR_fsetxattr, sys_fsetxattr), // 228 * L? - GENXY(__NR_getxattr, sys_getxattr), // 229 * L? - - GENXY(__NR_lgetxattr, sys_lgetxattr), // 230 * L? - GENXY(__NR_fgetxattr, sys_fgetxattr), // 231 * L? - GENXY(__NR_listxattr, sys_listxattr), // 232 * L? - GENXY(__NR_llistxattr, sys_llistxattr), // 233 * L? - GENXY(__NR_flistxattr, sys_flistxattr), // 234 * L? - - GENX_(__NR_removexattr, sys_removexattr), // 235 * L? - GENX_(__NR_lremovexattr, sys_lremovexattr), // 236 * L? - GENX_(__NR_fremovexattr, sys_fremovexattr), // 237 * L? + GENX_(__NR_setxattr, sys_setxattr), // 226 + GENX_(__NR_lsetxattr, sys_lsetxattr), // 227 + GENX_(__NR_fsetxattr, sys_fsetxattr), // 228 + GENXY(__NR_getxattr, sys_getxattr), // 229 + + GENXY(__NR_lgetxattr, sys_lgetxattr), // 230 + GENXY(__NR_fgetxattr, sys_fgetxattr), // 231 + GENXY(__NR_listxattr, sys_listxattr), // 232 + GENXY(__NR_llistxattr, sys_llistxattr), // 233 + GENXY(__NR_flistxattr, sys_flistxattr), // 234 + + GENX_(__NR_removexattr, sys_removexattr), // 235 + GENX_(__NR_lremovexattr, sys_lremovexattr), // 236 + GENX_(__NR_fremovexattr, sys_fremovexattr), // 237 // (__NR_tkill, sys_tkill), // 238 */Linux - GENXY(__NR_sendfile64, sys_sendfile64), // 239 * L + LINXY(__NR_sendfile64, sys_sendfile64), // 239 - GENXY(__NR_futex, sys_futex), // 240 * L - GENX_(__NR_sched_setaffinity, sys_sched_setaffinity), // 241 * L? - GENXY(__NR_sched_getaffinity, sys_sched_getaffinity), // 242 * L? + LINXY(__NR_futex, sys_futex), // 240 + GENX_(__NR_sched_setaffinity, sys_sched_setaffinity), // 241 + GENXY(__NR_sched_getaffinity, sys_sched_getaffinity), // 242 PLAX_(__NR_set_thread_area, sys_set_thread_area), // 243 PLAX_(__NR_get_thread_area, sys_get_thread_area), // 244 @@ -588,45 +650,45 @@ const struct SyscallTableEntry VGA_(syscall_table)[] = { LINX_(__NR_io_submit, sys_io_submit), // 248 LINXY(__NR_io_cancel, sys_io_cancel), // 249 - // (__NR_fadvise64, sys_fadvise64), // 250 * () - GENX_(251, sys_ni_syscall), // 251 -- unused - GENX_(__NR_exit_group, sys_exit_group), // 252 * - GENXY(__NR_lookup_dcookie, sys_lookup_dcookie), // 253 (*/32/64) L - GENXY(__NR_epoll_create, sys_epoll_create), // 254 * L - - GENX_(__NR_epoll_ctl, sys_epoll_ctl), // 255 * L - GENXY(__NR_epoll_wait, sys_epoll_wait), // 256 * L - // (__NR_remap_file_pages, sys_remap_file_pages), // 257 * L - GENX_(__NR_set_tid_address, sys_set_tid_address), // 258 * ? - GENXY(__NR_timer_create, sys_timer_create), // 259 (?) P - - GENXY(__NR_timer_settime, sys_timer_settime), // (timer_create+1) * P - GENXY(__NR_timer_gettime, sys_timer_gettime), // (timer_create+2) * P - GENX_(__NR_timer_getoverrun, sys_timer_getoverrun),//(timer_create+3) * P - GENX_(__NR_timer_delete, sys_timer_delete), // (timer_create+4) * P - GENX_(__NR_clock_settime, sys_clock_settime), // (timer_create+5) * P - - GENXY(__NR_clock_gettime, sys_clock_gettime), // (timer_create+6) * P - GENXY(__NR_clock_getres, sys_clock_getres), // (timer_create+7) * P - // (__NR_clock_nanosleep, sys_clock_nanosleep),// (timer_create+8) * P - GENXY(__NR_statfs64, sys_statfs64), // 268 * (?) - GENXY(__NR_fstatfs64, sys_fstatfs64), // 269 * (?) + // (__NR_fadvise64, sys_fadvise64), // 250 */(Linux?) + GENX_(251, sys_ni_syscall), // 251 + GENX_(__NR_exit_group, sys_exit_group), // 252 + GENXY(__NR_lookup_dcookie, sys_lookup_dcookie), // 253 + LINXY(__NR_epoll_create, sys_epoll_create), // 254 + + LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 255 + LINXY(__NR_epoll_wait, sys_epoll_wait), // 256 + // (__NR_remap_file_pages, sys_remap_file_pages), // 257 */Linux + GENX_(__NR_set_tid_address, sys_set_tid_address), // 258 + GENXY(__NR_timer_create, sys_timer_create), // 259 + + GENXY(__NR_timer_settime, sys_timer_settime), // (timer_create+1) + GENXY(__NR_timer_gettime, sys_timer_gettime), // (timer_create+2) + GENX_(__NR_timer_getoverrun, sys_timer_getoverrun),//(timer_create+3) + GENX_(__NR_timer_delete, sys_timer_delete), // (timer_create+4) + GENX_(__NR_clock_settime, sys_clock_settime), // (timer_create+5) + + GENXY(__NR_clock_gettime, sys_clock_gettime), // (timer_create+6) + GENXY(__NR_clock_getres, sys_clock_getres), // (timer_create+7) + // (__NR_clock_nanosleep, sys_clock_nanosleep),// (timer_create+8) */* + GENXY(__NR_statfs64, sys_statfs64), // 268 + GENXY(__NR_fstatfs64, sys_fstatfs64), // 269 // (__NR_tgkill, sys_tgkill), // 270 */Linux - GENX_(__NR_utimes, sys_utimes), // 271 * (4.3BSD) + GENX_(__NR_utimes, sys_utimes), // 271 // (__NR_fadvise64_64, sys_fadvise64_64), // 272 */(Linux?) - GENX_(__NR_vserver, sys_ni_syscall), // 273 -- unimplemented + GENX_(__NR_vserver, sys_ni_syscall), // 273 // (__NR_mbind, sys_mbind), // 274 ?/? // (__NR_get_mempolicy, sys_get_mempolicy), // 275 ?/? // (__NR_set_mempolicy, sys_set_mempolicy), // 276 ?/? - GENXY(__NR_mq_open, sys_mq_open), // 277 * P? - GENX_(__NR_mq_unlink, sys_mq_unlink), // (mq_open+1) * P? - GENX_(__NR_mq_timedsend, sys_mq_timedsend), // (mq_open+2) * P? + GENXY(__NR_mq_open, sys_mq_open), // 277 + GENX_(__NR_mq_unlink, sys_mq_unlink), // (mq_open+1) + GENX_(__NR_mq_timedsend, sys_mq_timedsend), // (mq_open+2) - GENXY(__NR_mq_timedreceive, sys_mq_timedreceive),// (mq_open+3) * P? - GENX_(__NR_mq_notify, sys_mq_notify), // (mq_open+4) * P? - GENXY(__NR_mq_getsetattr, sys_mq_getsetattr), // (mq_open+5) * P? + GENXY(__NR_mq_timedreceive, sys_mq_timedreceive),// (mq_open+3) + GENX_(__NR_mq_notify, sys_mq_notify), // (mq_open+4) + GENXY(__NR_mq_getsetattr, sys_mq_getsetattr), // (mq_open+5) GENX_(__NR_sys_kexec_load, sys_ni_syscall), // 283 };