|
From: <sv...@va...> - 2009-05-07 00:59:34
|
Author: njn
Date: 2009-05-07 01:59:26 +0100 (Thu, 07 May 2009)
New Revision: 9789
Log:
Augment darwin/scalar.c with cases from Filipe Cabecinhas. And expand on
the comment in x86-linux/scalar.c.
Modified:
branches/DARWIN/memcheck/tests/darwin/scalar.c
branches/DARWIN/memcheck/tests/darwin/scalar.stderr.exp
branches/DARWIN/memcheck/tests/x86-linux/scalar.c
Modified: branches/DARWIN/memcheck/tests/darwin/scalar.c
===================================================================
--- branches/DARWIN/memcheck/tests/darwin/scalar.c 2009-05-07 00:20:07 UTC (rev 9788)
+++ branches/DARWIN/memcheck/tests/darwin/scalar.c 2009-05-07 00:59:26 UTC (rev 9789)
@@ -4,20 +4,9 @@
#include <sched.h>
#include <signal.h>
+// See memcheck/tests/x86-linux/scalar.c for an explanation of what this test
+// is doing.
-// Here we are trying to trigger every syscall error (scalar errors and
-// memory errors) for every syscall. We do this by passing a lot of bogus
-// arguments, mostly 0 and 1 (often it's 1 because NULL ptr args often aren't
-// checked for memory errors, or in order to have a non-zero length used
-// with some buffer). So most of the syscalls don't actually succeed and do
-// anything.
-//
-// Occasionally we have to be careful not to cause Valgrind to seg fault in
-// its pre-syscall wrappers; it does so because it can't know in general
-// when memory is unaddressable, and so tries to dereference it when doing
-// PRE_MEM_READ/PRE_MEM_WRITE calls. (Note that Memcheck will
-// always issue an error message immediately before these seg faults occur).
-
int main(void)
{
// uninitialised, but we know px[0] is 0x0
@@ -222,7 +211,11 @@
// /* 166 old exportfs */
// __NR_mount 167
// /* 168 old ustat */
+
// __NR_csops 169
+ GO(__NR_csops, "4s 1m");
+ SY(__NR_csops, x0, x0, x0+1, x0+1); FAILx(EFAULT);
+
// /* 170 old table */
// /* 171 old wait3 */
// /* 172 old rpause */
@@ -346,8 +339,15 @@
SY(__NR_sem_post, x0); FAIL;
// __NR_sem_getvalue 274
+
// __NR_sem_init 275
+ GO(__NR_sem_init, "3s 1m");
+ SY(__NR_sem_init, x0+1, x0, x0); FAILx(ENOSYS);
+
// __NR_sem_destroy 276
+ GO(__NR_sem_destroy, "1s 1m");
+ SY(__NR_sem_destroy, x0+1); FAILx(ENOSYS);
+
// __NR_open_extended 277
// __NR_umask_extended 278
// __NR_stat_extended 279
Modified: branches/DARWIN/memcheck/tests/darwin/scalar.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/darwin/scalar.stderr.exp 2009-05-07 00:20:07 UTC (rev 9788)
+++ branches/DARWIN/memcheck/tests/darwin/scalar.stderr.exp 2009-05-07 00:59:26 UTC (rev 9789)
@@ -83,8 +83,27 @@
...
Address 0x........ is 0 bytes after a block of size 4 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (scalar.c:24)
+ by 0x........: main (scalar.c:13)
-----------------------------------------------------
+169: __NR_csops 4s 1m
+-----------------------------------------------------
+
+Syscall param csops(pid) contains uninitialised byte(s)
+ ...
+
+Syscall param csops(ops) contains uninitialised byte(s)
+ ...
+
+Syscall param csops(useraddr) contains uninitialised byte(s)
+ ...
+
+Syscall param csops(usersize) contains uninitialised byte(s)
+ ...
+
+Syscall param csops(addr) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
268: __NR_sem_open 2s 1m
-----------------------------------------------------
@@ -129,6 +148,32 @@
Syscall param sem_post(sem) contains uninitialised byte(s)
...
-----------------------------------------------------
+275: __NR_sem_init 3s 1m
+-----------------------------------------------------
+
+Syscall param sem_init(sem) contains uninitialised byte(s)
+ ...
+
+Syscall param sem_init(pshared) contains uninitialised byte(s)
+ ...
+
+Syscall param sem_init(value) contains uninitialised byte(s)
+ ...
+
+Syscall param sem_init(sem) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
+276: __NR_sem_destroy 1s 1m
+-----------------------------------------------------
+
+Syscall param sem_destroy(sem) contains uninitialised byte(s)
+ ...
+
+Syscall param sem_destroy(sem) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
420:__NR_sem_wait_nocancel 1s 0m
-----------------------------------------------------
Modified: branches/DARWIN/memcheck/tests/x86-linux/scalar.c
===================================================================
--- branches/DARWIN/memcheck/tests/x86-linux/scalar.c 2009-05-07 00:20:07 UTC (rev 9788)
+++ branches/DARWIN/memcheck/tests/x86-linux/scalar.c 2009-05-07 00:59:26 UTC (rev 9789)
@@ -17,6 +17,10 @@
// when memory is unaddressable, and so tries to dereference it when doing
// PRE_MEM_READ/PRE_MEM_WRITE calls. (Note that Memcheck will
// always issue an error message immediately before these seg faults occur).
+//
+// The output has numbers like "3s 2m" for each syscall. "s" is short for
+// "scalar", ie. the argument itself is undefined. "m" is short for "memory",
+// ie. the argument points to memory which is unaddressable.
int main(void)
{
|