From: Nicholas Nethercote Date: Mon, 15 Nov 2004 17:19:22 +0000 (+0000) Subject: convert a couple more X-Git-Tag: svn/VALGRIND_3_0_0~1300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ec929266e0686bf66cc521279682506115cc29f;p=thirdparty%2Fvalgrind.git convert a couple more git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3012 --- diff --git a/coregrind/vg_syscalls.c b/coregrind/vg_syscalls.c index 00d6fdb9f9..dbfac09e39 100644 --- a/coregrind/vg_syscalls.c +++ b/coregrind/vg_syscalls.c @@ -1663,17 +1663,16 @@ PREx(sys_setfsuid, 0) PRE_REG_READ1(long, "setfsuid", vki_uid_t, uid); } -PRE(_sysctl) +PREx(sys_sysctl, 0) { - /* int _sysctl(struct __sysctl_args *args); */ - PRINT("_sysctl ( %p )", arg1 ); - PRE_MEM_WRITE( "_sysctl(args)", arg1, sizeof(struct __vki_sysctl_args) ); + PRINT("sys_sysctl ( %p )", arg1 ); + PRE_REG_READ1(long, "sysctl", struct __sysctl_args *, args); + PRE_MEM_WRITE( "sysctl(args)", arg1, sizeof(struct __vki_sysctl_args) ); } -POST(_sysctl) +POSTx(sys_sysctl) { POST_MEM_WRITE( arg1, sizeof(struct __vki_sysctl_args) ); - } PREx(sys_sched_getscheduler, 0/*???*/) @@ -5659,11 +5658,16 @@ PREx(sys_writev, MayBlock) } } -PRE(prctl) +PREx(sys_prctl, MayBlock) { - /* int prctl(int option, unsigned long arg2, unsigned long arg3, - unsigned long arg4, unsigned long arg5); */ PRINT( "prctl ( %d, %d, %d, %d, %d )", arg1, arg2, arg3, arg4, arg5 ); + // XXX: too simplistic, often not all args are used + // Nb: can't use "arg2".."arg5" here because that's our own macro... + PRE_REG_READ5(long, "prctl", + int, option, unsigned long, parg2, unsigned long, parg3, + unsigned long, parg4, unsigned long, parg5); + // XXX: totally wrong... we need to look at the 'option' arg, and do + // PRE_MEM_READs/PRE_MEM_WRITEs as necessary... } PREx(sys_adjtimex, 0) @@ -6528,7 +6532,7 @@ static const struct sys_info sys_info[] = { SYSX_(__NR_writev, sys_writev), // 146 * P SYSX_(__NR_getsid, sys_getsid), // 147 * P SYSX_(__NR_fdatasync, sys_fdatasync), // 148 * P - SYSBA(__NR__sysctl, sys_sysctl, 0), // 149 * + SYSXY(__NR__sysctl, sys_sysctl), // 149 * L SYSX_(__NR_mlock, sys_mlock), // 150 * P SYSX_(__NR_munlock, sys_munlock), // 151 * P @@ -6556,7 +6560,7 @@ static const struct sys_info sys_info[] = { SYSX_(__NR_setresgid, sys_setresgid16), // 170 ## (non-standard) SYSXY(__NR_getresgid, sys_getresgid16), // 171 ## L - SYSB_(__NR_prctl, sys_prctl, MayBlock), // 172 * + SYSX_(__NR_prctl, sys_prctl), // 172 * L // (__NR_rt_sigreturn, sys_rt_sigreturn), // 173 (x86) () SYSXY(__NR_rt_sigaction, sys_rt_sigaction), // 174 (x86) () diff --git a/memcheck/tests/scalar.c b/memcheck/tests/scalar.c index 45df119fb2..0555207f48 100644 --- a/memcheck/tests/scalar.c +++ b/memcheck/tests/scalar.c @@ -633,8 +633,8 @@ int main(void) SY(__NR_fdatasync, x0-1); // __NR__sysctl 149 - //GO(__NR__sysctl, ".s .m"); - //SY(__NR__sysctl); + GO(__NR__sysctl, "1s 1m"); + SY(__NR__sysctl, x0); // __NR_mlock 150 GO(__NR_mlock, "2s 0m"); @@ -724,9 +724,9 @@ int main(void) GO(__NR_getresgid, "3s 3m"); SY(__NR_getresgid, x0, x0, x0); - // __NR_prctl 172 - //GO(__NR_prctl, ".s .m"); - //SY(__NR_prctl); + // __NR_prctl 172 + GO(__NR_prctl, "5s 0m"); + SY(__NR_prctl); // __NR_rt_sigreturn 173 GO(__NR_rt_sigreturn, "n/a"); diff --git a/memcheck/tests/scalar.stderr.exp b/memcheck/tests/scalar.stderr.exp index 160adee1ce..d3415d24e8 100644 --- a/memcheck/tests/scalar.stderr.exp +++ b/memcheck/tests/scalar.stderr.exp @@ -1917,6 +1917,20 @@ Syscall param fdatasync(fd) contains uninitialised byte(s) by 0x........: __libc_start_main (...libc...) by 0x........: ... ----------------------------------------------------- +149: __NR__sysctl 1s 1m +----------------------------------------------------- + +Syscall param sysctl(args) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param sysctl(args) 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 +----------------------------------------------------- 150: __NR_mlock 2s 0m ----------------------------------------------------- @@ -2209,6 +2223,34 @@ Syscall param getresgid16(sgid) points to unaddressable byte(s) by 0x........: ... Address 0x........ is not stack'd, malloc'd or (recently) free'd ----------------------------------------------------- +172: __NR_prctl 5s 0m +----------------------------------------------------- + +Syscall param prctl(option) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param prctl(parg2) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param prctl(parg3) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param prctl(parg4) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + +Syscall param prctl(parg5) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... +----------------------------------------------------- 173: __NR_rt_sigreturn n/a ----------------------------------------------------- -----------------------------------------------------