From: Nicholas Nethercote Date: Fri, 12 Nov 2004 18:49:27 +0000 (+0000) Subject: and converted a few more X-Git-Tag: svn/VALGRIND_3_0_0~1338 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cdbb6cd2e123edde5a48906d5e04879971a3fe7d;p=thirdparty%2Fvalgrind.git and converted a few more git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2974 --- diff --git a/coregrind/vg_syscalls.c b/coregrind/vg_syscalls.c index 4741681bab..5ee7f7de17 100644 --- a/coregrind/vg_syscalls.c +++ b/coregrind/vg_syscalls.c @@ -1523,10 +1523,10 @@ PRE(personality) PRINT("personality ( %d )", arg1); } -PRE(chroot) +PREx(sys_chroot, 0) { - /* int chroot(const char *path); */ - PRINT("chroot ( %p )", arg1); + PRINT("sys_chroot ( %p )", arg1); + PRE_REG_READ1(long, "chroot", const char *, path); PRE_MEM_RASCIIZ( "chroot(path)", arg1 ); } @@ -2041,17 +2041,17 @@ POST(sys_dup) } } -PRE(dup2) +PREx(sys_dup2, 0) { - /* int dup2(int oldfd, int newfd); */ - PRINT("dup2 ( %d, %d )", arg1,arg2); + 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)) set_result( -VKI_EBADF ); } -POST(dup2) +POST(sys_dup2) { - if(VG_(clo_track_fds)) + if (VG_(clo_track_fds)) record_fd_open(tid, res, VG_(resolve_filename)(res)); } @@ -5352,11 +5352,13 @@ POST(sigaltstack) POST_MEM_WRITE( arg2, sizeof(vki_stack_t)); } -PRE(sigaction) +// XXX: x86-specific +PREx(sys_sigaction, SIG_SIM) { - /* int sigaction(int signum, struct k_sigaction *act, - struct k_sigaction *oldact); */ - PRINT("sigaction ( %d, %p, %p )",arg1,arg2,arg3); + PRINT("sys_sigaction ( %d, %p, %p )", arg1,arg2,arg3); + PRE_REG_READ3(int, "sigaction", + int, signum, const struct old_sigaction *, act, + struct old_sigaction *, oldact) if (arg2 != (UWord)NULL) PRE_MEM_READ( "sigaction(act)", arg2, sizeof(struct vki_sigaction)); if (arg3 != (UWord)NULL) @@ -5366,14 +5368,14 @@ PRE(sigaction) VG_(do_sys_sigaction)(tid); } -POST(sigaction) +POST(sys_sigaction) { if (res == 0 && arg3 != (UWord)NULL) POST_MEM_WRITE( arg3, sizeof(struct vki_sigaction)); } -PREALIAS(rt_sigaction, sigaction); -POSTALIAS(rt_sigaction, sigaction); +PREALIAS(rt_sigaction, sys_sigaction); +POSTALIAS(rt_sigaction, sys_sigaction); PRE(sigprocmask) { @@ -5889,14 +5891,14 @@ static const struct sys_info sys_info[] = { // (__NR_oldolduname, sys_olduname), // 59 (?) L -- obsolete SYSX_(__NR_umask, sys_umask), // 60 * P - SYSB_(chroot, 0), // 61 sys_chroot * - // (__NR_ustat, sys_ustat) // 62 * (SVr4, deprecated) - SYSBA(dup2, 0), // 63 sys_dup2 * - SYSX_(__NR_getppid, sys_getppid), // 64 * - - SYSX_(__NR_getpgrp, sys_getpgrp), // 65 * - SYSX_(__NR_setsid, sys_setsid), // 66 * - SYSBA(sigaction, SIG_SIM), // 67 sys_sigaction + SYSX_(__NR_chroot, sys_chroot), // 61 * (almost P) + // (__NR_ustat, sys_ustat) // 62 * (SVr4) -- deprecated + SYSXY(__NR_dup2, sys_dup2), // 63 * P + SYSX_(__NR_getppid, sys_getppid), // 64 * P + + SYSX_(__NR_getpgrp, sys_getpgrp), // 65 * P + SYSX_(__NR_setsid, sys_setsid), // 66 * P + SYSXY(__NR_sigaction, sys_sigaction), // 67 (x86) P // (__NR_sgetmask, sys_sgetmask), // 68 * (ANSI C) // (__NR_ssetmask, sys_ssetmask), // 69 * (ANSI C) diff --git a/memcheck/tests/scalar.c b/memcheck/tests/scalar.c index e838ed3742..18bae91040 100644 --- a/memcheck/tests/scalar.c +++ b/memcheck/tests/scalar.c @@ -250,8 +250,15 @@ int main(void) SY(__NR_umask, x0); // __NR_chroot 61 + GO(__NR_chroot, "1s 1m"); + SY(__NR_chroot, x0); + // __NR_ustat 62 + // (deprecated, not handled by Valgrind) + // __NR_dup2 63 + GO(__NR_dup2, "2s 0m"); + SY(__NR_dup2, x0, x0); // __NR_getppid 64 --> sys_getppid() GO(__NR_getppid, "0e"); @@ -266,13 +273,23 @@ int main(void) SY(__NR_setsid); // __NR_sigaction 67 + GO(__NR_sigaction, "3s 2m"); + SY(__NR_sigaction, x0, x0+1, x0+1); + // __NR_sgetmask 68 + // (Not yet handled by Valgrind) + // __NR_ssetmask 69 + // (Not yet handled by Valgrind) + // __NR_setreuid 70 // __NR_setregid 71 // __NR_sigsuspend 72 // __NR_sigpending 73 + // __NR_sethostname 74 + // (Not yet handled by Valgrind) + // __NR_setrlimit 75 // __NR_getrlimit 76 // __NR_getrusage 77 @@ -287,10 +304,19 @@ int main(void) // (obsolete, not handled by Valgrind) // __NR_readlink 85 + // __NR_uselib 86 + // (Not yet handled by Valgrind) + // __NR_swapon 87 + // (Not yet handled by Valgrind) + // __NR_reboot 88 + // (Not yet handled by Valgrind) + // __NR_readdir 89 + // (superseded, not handled by Valgrind) + // __NR_mmap 90 // __NR_munmap 91 // __NR_truncate 92 diff --git a/memcheck/tests/scalar.stderr.exp b/memcheck/tests/scalar.stderr.exp index 3aacc75b0e..c86c37dd1d 100644 --- a/memcheck/tests/scalar.stderr.exp +++ b/memcheck/tests/scalar.stderr.exp @@ -702,6 +702,33 @@ Syscall param umask(mask) contains uninitialised byte(s) at 0x........: syscall (in /...libc...) by 0x........: __libc_start_main (...libc...) by 0x........: ... +----------------------------------------------------- + 61: __NR_chroot 1s 1m +----------------------------------------------------- + +Syscall param chroot(path) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param chroot(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 +----------------------------------------------------- + 63: __NR_dup2 2s 0m +----------------------------------------------------- + +Syscall param dup2(oldfd) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param dup2(newfd) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... ----------------------------------------------------- 64: __NR_getppid 0e ----------------------------------------------------- @@ -711,6 +738,36 @@ Syscall param umask(mask) contains uninitialised byte(s) ----------------------------------------------------- 66: __NR_setsid 0e ----------------------------------------------------- +----------------------------------------------------- + 67: __NR_sigaction 3s 2m +----------------------------------------------------- + +Syscall param sigaction(signum) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param sigaction(act) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param sigaction(oldact) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param sigaction(act) 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 sigaction(oldact) 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 ----------------------------------------------------- 111: __NR_vhangup 0e -----------------------------------------------------