]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Improved memcheck/tests/scalar so that it shows an example whereby the syscall
authorNicholas Nethercote <n.nethercote@gmail.com>
Mon, 8 Nov 2004 19:30:08 +0000 (19:30 +0000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Mon, 8 Nov 2004 19:30:08 +0000 (19:30 +0000)
number itself is undefined.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2950

memcheck/tests/.cvsignore
memcheck/tests/scalar.c
memcheck/tests/scalar.stderr.exp
memcheck/tests/scalar.supp
memcheck/tests/scalar_supp.stderr.exp

index 7ef3ece758c8623d919f1920e4fa67d8842fa11f..853f8d2d588f5df8db5512a397e1fd13ce1b68ec 100644 (file)
@@ -48,8 +48,10 @@ overlap
 realloc1
 realloc2
 realloc3
+scalar
 sigaltstack
 signal2
+str_tester
 supp1
 supp2
 suppfree
index 599d3ddf777442a8f69e8396156ed1a04fddb655..440f382eb60262c3cd9a67ffc89d37816a673321 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <unistd.h>
+#include <sys/syscall.h>
 
 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;
 }
index 43a75ee8bb586623677c971c62819cad516e076d..b5ea4c87819f5682b2f2d49729f2402a0eab2ebc 100644 (file)
@@ -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
index 14c46fba07e30e2086ecd52bb50ed7835e2439b8..7a4267af09adc5c4439172418d41c2bd1578dca6 100644 (file)
@@ -3,7 +3,7 @@
    foo2
    Memcheck:Param
    write(buf)
-   fun:__write_nocancel
+   fun:syscall
    fun:__libc_start_main
 }
 
index d9821acef59e7429e30a6517e3103475669733b0..6bf756ec74204559ca36dc56c363e759e30a71be 100644 (file)
@@ -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........: ...