From: Nicholas Nethercote Date: Mon, 8 Nov 2004 19:30:08 +0000 (+0000) Subject: Improved memcheck/tests/scalar so that it shows an example whereby the syscall X-Git-Tag: svn/VALGRIND_3_0_0~1362 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a2954cd68b2bb77fa8eb2b198edf7fca150e3cdc;p=thirdparty%2Fvalgrind.git Improved memcheck/tests/scalar so that it shows an example whereby the syscall number itself is undefined. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2950 --- diff --git a/memcheck/tests/.cvsignore b/memcheck/tests/.cvsignore index 7ef3ece758..853f8d2d58 100644 --- a/memcheck/tests/.cvsignore +++ b/memcheck/tests/.cvsignore @@ -48,8 +48,10 @@ overlap realloc1 realloc2 realloc3 +scalar sigaltstack signal2 +str_tester supp1 supp2 suppfree diff --git a/memcheck/tests/scalar.c b/memcheck/tests/scalar.c index 599d3ddf77..440f382eb6 100644 --- a/memcheck/tests/scalar.c +++ b/memcheck/tests/scalar.c @@ -1,5 +1,6 @@ #include #include +#include int main(void) { @@ -9,9 +10,12 @@ int main(void) // uninitialised, but we know pc[0] points to 0x0 char** pc = malloc(sizeof(char*)); - // Four errors: each of the scalar args are undefined, plus the 2nd arg - // points to unaddressable memory. - write(pi[0], pc[0], pi[0]+1); + // Five errors: + // - the syscall number itself is undefined (but we know it's + // 0 + __NR_write :) + // - each of the scalar args are undefined + // - the 2nd arg points to unaddressable memory. + syscall(pi[0]+__NR_write, pi[0], pc[0], pi[0]+1); return 0; } diff --git a/memcheck/tests/scalar.stderr.exp b/memcheck/tests/scalar.stderr.exp index 43a75ee8bb..b5ea4c8781 100644 --- a/memcheck/tests/scalar.stderr.exp +++ b/memcheck/tests/scalar.stderr.exp @@ -1,20 +1,25 @@ +Syscall param (syscallno) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + Syscall param write(fd) contains uninitialised byte(s) - at 0x........: write (in /...libc...) + at 0x........: syscall (in /...libc...) by 0x........: __libc_start_main (...libc...) by 0x........: ... Syscall param write(buf) contains uninitialised byte(s) - at 0x........: write (in /...libc...) + at 0x........: syscall (in /...libc...) by 0x........: __libc_start_main (...libc...) by 0x........: ... Syscall param write(count) contains uninitialised byte(s) - at 0x........: write (in /...libc...) + at 0x........: syscall (in /...libc...) by 0x........: __libc_start_main (...libc...) by 0x........: ... Syscall param write(buf) points to unaddressable byte(s) - at 0x........: write (in /...libc...) + 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 diff --git a/memcheck/tests/scalar.supp b/memcheck/tests/scalar.supp index 14c46fba07..7a4267af09 100644 --- a/memcheck/tests/scalar.supp +++ b/memcheck/tests/scalar.supp @@ -3,7 +3,7 @@ foo2 Memcheck:Param write(buf) - fun:__write_nocancel + fun:syscall fun:__libc_start_main } diff --git a/memcheck/tests/scalar_supp.stderr.exp b/memcheck/tests/scalar_supp.stderr.exp index d9821acef5..6bf756ec74 100644 --- a/memcheck/tests/scalar_supp.stderr.exp +++ b/memcheck/tests/scalar_supp.stderr.exp @@ -1,9 +1,14 @@ +Syscall param (syscallno) contains uninitialised byte(s) + at 0x........: syscall (in /...libc...) + by 0x........: __libc_start_main (...libc...) + by 0x........: ... + Syscall param write(fd) contains uninitialised byte(s) - at 0x........: write (in /...libc...) + at 0x........: syscall (in /...libc...) by 0x........: __libc_start_main (...libc...) by 0x........: ... Syscall param write(count) contains uninitialised byte(s) - at 0x........: write (in /...libc...) + at 0x........: syscall (in /...libc...) by 0x........: __libc_start_main (...libc...) by 0x........: ...