From: Nicholas Nethercote Date: Sun, 14 Nov 2004 18:37:07 +0000 (+0000) Subject: converted a few more syscalls X-Git-Tag: svn/VALGRIND_3_0_0~1317 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef904d7d63c622a6b44f673e6e752e38f82f921d;p=thirdparty%2Fvalgrind.git converted a few more syscalls git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2995 --- diff --git a/coregrind/vg_syscalls.c b/coregrind/vg_syscalls.c index 5b35a22ae3..b0a61898af 100644 --- a/coregrind/vg_syscalls.c +++ b/coregrind/vg_syscalls.c @@ -1453,7 +1453,7 @@ PRE(quotactl) PRE_MEM_RASCIIZ( "quotactl(special)", arg2 ); } -// XXX: this is only suitable for 32-bit platforms +// XXX: this wrapper is only suitable for 32-bit platforms PREx(sys_lookup_dcookie, 0) { PRINT("sys_lookup_dcookie (0x%llx, %p, %d)", LOHI64(arg1,arg2), arg3, arg4); @@ -1469,12 +1469,6 @@ POSTx(sys_lookup_dcookie) POST_MEM_WRITE( arg3, res); } -PRE(truncate64) -{ - PRINT("truncate64 ( %p, %lld )", arg1, LOHI64(arg2, arg3)); - PRE_MEM_RASCIIZ( "truncate64(path)", arg1 ); -} - PRE(fdatasync) { /* int fdatasync(int fd); */ @@ -2295,18 +2289,40 @@ PRE(fsync) PRINT("fsync ( %d )", arg1); } -PRE(ftruncate) +PREx(sys_ftruncate, MayBlock) +{ + PRINT("sys_ftruncate ( %d, %lld )", arg1,(ULong)arg2); + PRE_REG_READ2(long, "ftruncate", unsigned int, fd, unsigned long, length); +} + +PREx(sys_truncate, MayBlock) +{ + PRINT("sys_truncate ( %p(%s), %d )", arg1,arg1,arg2); + PRE_REG_READ2(long, "truncate", + const char *, path, unsigned long, length); + PRE_MEM_RASCIIZ( "truncate(path)", arg1 ); +} + +// XXX: this wrapper is only suitable for 32-bit platforms +PREx(sys_ftruncate64, MayBlock) { - /* int ftruncate(int fd, size_t length); */ - PRINT("ftruncate ( %d, %lld )", arg1,(ULong)arg2); + PRINT("sys_ftruncate64 ( %d, %lld )", arg1, LOHI64(arg2,arg3)); + PRE_REG_READ3(long, "ftruncate64", + unsigned int, fd, + vki_u32, length_low32, vki_u32, length_high32); } -PRE(ftruncate64) +// XXX: this wrapper is only suitable for 32-bit platforms +PREx(sys_truncate64, MayBlock) { - /* int ftruncate64(int fd, off64_t length); */ - PRINT("ftruncate64 ( %d, %lld )", arg1, LOHI64(arg2,arg3)); + PRINT("sys_truncate64 ( %p, %lld )", arg1, LOHI64(arg2, arg3)); + PRE_REG_READ3(long, "truncate64", + const char *, path, + vki_u32, length_low32, vki_u32, length_high32); + PRE_MEM_RASCIIZ( "truncate64(path)", arg1 ); } + PRE(getdents) { /* int getdents(unsigned int fd, struct dirent *dirp, @@ -4740,15 +4756,16 @@ POST(epoll_wait) POST_MEM_WRITE( arg2, sizeof(struct epoll_event)*res ) ; } -PRE(readlink) +PREx(sys_readlink, 0) { - /* int readlink(const char *path, char *buf, size_t bufsiz); */ - PRINT("readlink ( %p, %p, %llu )", arg1,arg2,(ULong)arg3); + PRINT("sys_readlink ( %p, %p, %llu )", arg1,arg2,(ULong)arg3); + PRE_REG_READ3(long, "readlink", + const char *, path, char *, buf, int, bufsiz); PRE_MEM_RASCIIZ( "readlink(path)", arg1 ); PRE_MEM_WRITE( "readlink(buf)", arg2,arg3 ); } -POST(readlink) +POSTx(sys_readlink) { POST_MEM_WRITE( arg2, res ); } @@ -5417,10 +5434,10 @@ POST(statfs64) POST_MEM_WRITE( arg3, arg2 ); } -PRE(symlink) +PREx(sys_symlink, MayBlock) { - /* int symlink(const char *oldpath, const char *newpath); */ - PRINT("symlink ( %p, %p )",arg1,arg2); + PRINT("sys_symlink ( %p, %p )",arg1,arg2); + PRE_REG_READ2(long, "symlink", const char *, oldpath, const char *, newpath); PRE_MEM_RASCIIZ( "symlink(oldpath)", arg1 ); PRE_MEM_RASCIIZ( "symlink(newpath)", arg2 ); } @@ -5493,13 +5510,6 @@ POSTx(sys_times) } } -PRE(truncate) -{ - /* int truncate(const char *path, off_t length); */ - PRINT("truncate ( %p(%s), %d )", arg1,arg1,arg2); - PRE_MEM_RASCIIZ( "truncate(path)", arg1 ); -} - PREx(sys_umask, 0) { PRINT("sys_umask ( %d )", arg1); @@ -6372,10 +6382,10 @@ static const struct sys_info sys_info[] = { SYSXY(__NR_getgroups, sys_getgroups16), // 80 ## P SYSX_(__NR_setgroups, sys_setgroups16), // 81 ## almost-P SYSX_(__NR_select, old_select), // 82 (x86) (4.4BSD) - SYSB_(__NR_symlink, sys_symlink, MayBlock), // 83 * + SYSX_(__NR_symlink, sys_symlink), // 83 * P // (__NR_oldlstat, sys_lstat), // 84 * L -- obsolete - SYSBA(__NR_readlink, sys_readlink, 0), // 85 * + SYSXY(__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 @@ -6383,8 +6393,8 @@ static const struct sys_info sys_info[] = { SYSB_(__NR_mmap, old_mmap, Special), // 90 old_mmap SYSBA(__NR_munmap, sys_munmap, 0), // 91 * - SYSB_(__NR_truncate, sys_truncate, MayBlock), // 92 * - SYSB_(__NR_ftruncate, sys_ftruncate, MayBlock), // 93 * + SYSX_(__NR_truncate, sys_truncate), // 92 * P + SYSX_(__NR_ftruncate, sys_ftruncate), // 93 * P SYSB_(__NR_fchmod, sys_fchmod, 0), // 94 * SYSX_(__NR_fchown, sys_fchown16), // 95 ## (SVr4,BSD4.3) @@ -6507,8 +6517,8 @@ static const struct sys_info sys_info[] = { // (__NR_vfork, sys_vfork), // 190 -- Valgrind avoids SYSXY(__NR_ugetrlimit, sys_getrlimit), // 191 * (?) SYSBA(__NR_mmap2, sys_mmap2, 0), // 192 - SYSB_(__NR_truncate64, sys_truncate64, MayBlock), // 193 %% - SYSB_(__NR_ftruncate64, sys_ftruncate64, MayBlock), // 194 %% + SYSX_(__NR_truncate64, sys_truncate64), // 193 %% (P?) + SYSX_(__NR_ftruncate64, sys_ftruncate64), // 194 %% (P?) SYSXY(__NR_stat64, sys_stat64), // 195 %% (?) SYSXY(__NR_lstat64, sys_lstat64), // 196 %% (?) diff --git a/memcheck/tests/scalar.c b/memcheck/tests/scalar.c index 3b02fee3dc..4816b825a2 100644 --- a/memcheck/tests/scalar.c +++ b/memcheck/tests/scalar.c @@ -339,16 +339,16 @@ int main(void) SY(__NR_select, args+x0); } - // __NR_symlink 83 - //GO(__NR_symlink, ".s .m"); - //SY(__NR_symlink); + // __NR_symlink 83 --> sys_symlink() + GO(__NR_symlink, "2s 2m"); + SY(__NR_symlink, x0, x0); // __NR_oldlstat 84 // (obsolete, not handled by Valgrind) // __NR_readlink 85 - //GO(__NR_readlink, ".s .m"); - //SY(__NR_readlink); + GO(__NR_readlink, "3s 2m"); + SY(__NR_readlink); // __NR_uselib 86 // (Not yet handled by Valgrind) @@ -370,13 +370,13 @@ int main(void) //GO(__NR_munmap, ".s .m"); //SY(__NR_munmap); - // __NR_truncate 92 - //GO(__NR_truncate, ".s .m"); - //SY(__NR_truncate); + // __NR_truncate 92 --> sys_truncate() + GO(__NR_truncate, "2s 1m"); + SY(__NR_truncate, x0, x0); - // __NR_ftruncate 93 - //GO(__NR_ftruncate, ".s .m"); - //SY(__NR_ftruncate); + // __NR_ftruncate 93 --> sys_ftruncate() + GO(__NR_ftruncate, "2s 0m"); + SY(__NR_ftruncate, x0, x0); // __NR_fchmod 94 //GO(__NR_fchmod, ".s .m"); @@ -773,13 +773,13 @@ int main(void) //GO(__NR_mmap2, ".s .m"); //SY(__NR_mmap2); - // __NR_truncate64 193 - //GO(__NR_truncate64, ".s .m"); - //SY(__NR_truncate64); + // __NR_truncate64 193 --> sys_truncate64() + GO(__NR_truncate64, "3s 1m"); + SY(__NR_truncate64, x0, x0, x0); - // __NR_ftruncate64 194 - //GO(__NR_ftruncate64, ".s .m"); - //SY(__NR_ftruncate64); + // __NR_ftruncate64 194 --> sys_ftruncate64() + GO(__NR_ftruncate64, "3s 0m"); + SY(__NR_ftruncate64, x0, x0, x0); // __NR_stat64 195 GO(__NR_stat64, "2s 2m"); diff --git a/memcheck/tests/scalar.stderr.exp b/memcheck/tests/scalar.stderr.exp index 8af73c9c23..a27b71a16c 100644 --- a/memcheck/tests/scalar.stderr.exp +++ b/memcheck/tests/scalar.stderr.exp @@ -985,6 +985,93 @@ Syscall param old_select(timeout) points to unaddressable byte(s) by 0x........: __libc_start_main (...libc...) by 0x........: ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +----------------------------------------------------- + 83: __NR_symlink 2s 2m +----------------------------------------------------- + +Syscall param symlink(oldpath) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param symlink(newpath) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param symlink(oldpath) points to unaddressable byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param symlink(newpath) points to unaddressable byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd +----------------------------------------------------- + 85: __NR_readlink 3s 2m +----------------------------------------------------- + +Syscall param readlink(path) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param readlink(buf) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param readlink(bufsiz) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param readlink(path) points to unaddressable byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param readlink(buf) points to unaddressable byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd +----------------------------------------------------- + 92: __NR_truncate 2s 1m +----------------------------------------------------- + +Syscall param truncate(path) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param truncate(length) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param truncate(path) points to unaddressable byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd +----------------------------------------------------- + 93: __NR_ftruncate 2s 0m +----------------------------------------------------- + +Syscall param ftruncate(fd) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param ftruncate(length) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... ----------------------------------------------------- 95: __NR_fchown 3s 0m ----------------------------------------------------- @@ -1362,6 +1449,48 @@ Syscall param getrlimit(rlim) points to unaddressable byte(s) by 0x........: ... Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- +193: __NR_truncate64 3s 1m +----------------------------------------------------- + +Syscall param truncate64(path) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param truncate64(length_low32) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param truncate64(length_high32) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param truncate64(path) points to unaddressable byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd +----------------------------------------------------- +194: __NR_ftruncate64 3s 0m +----------------------------------------------------- + +Syscall param ftruncate64(fd) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param ftruncate64(length_low32) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param ftruncate64(length_high32) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... +----------------------------------------------------- 195: __NR_stat64 2s 2m -----------------------------------------------------