|
From: <sv...@va...> - 2008-09-10 20:20:02
|
Author: sewardj
Date: 2008-09-10 21:20:09 +0100 (Wed, 10 Sep 2008)
New Revision: 8599
Log:
Some fixes based on testing with large programs:
* add a couple of suppressions
* sg_main.c: handle corner cases w.r.t partial overlaps correctly
* h_main.c: handle a couple more syscalls
* pc_common.c: disable bogus assertion in error handling
Modified:
branches/PTRCHECK/exp-ptrcheck.supp
branches/PTRCHECK/exp-ptrcheck/h_main.c
branches/PTRCHECK/exp-ptrcheck/pc_common.c
branches/PTRCHECK/exp-ptrcheck/sg_main.c
Modified: branches/PTRCHECK/exp-ptrcheck/h_main.c
===================================================================
--- branches/PTRCHECK/exp-ptrcheck/h_main.c 2008-09-10 09:36:46 UTC (rev 8598)
+++ branches/PTRCHECK/exp-ptrcheck/h_main.c 2008-09-10 20:20:09 UTC (rev 8599)
@@ -1884,6 +1884,7 @@
# endif
case __NR_chdir:
case __NR_chmod:
+ case __NR_chown:
case __NR_clock_getres:
case __NR_clock_gettime:
case __NR_clone:
@@ -1893,6 +1894,7 @@
# endif
case __NR_dup:
case __NR_dup2:
+ case __NR_execve: /* presumably we see this because the call failed? */
case __NR_exit: /* hmm, why are we still alive? */
case __NR_exit_group:
case __NR_fadvise64:
Modified: branches/PTRCHECK/exp-ptrcheck/pc_common.c
===================================================================
--- branches/PTRCHECK/exp-ptrcheck/pc_common.c 2008-09-10 09:36:46 UTC (rev 8598)
+++ branches/PTRCHECK/exp-ptrcheck/pc_common.c 2008-09-10 20:20:09 UTC (rev 8599)
@@ -214,8 +214,8 @@
{
XError *xe1, *xe2;
tl_assert(VG_(get_error_kind)(e1) == VG_(get_error_kind)(e2));
- tl_assert(VG_(get_error_string)(e1) == NULL);
- tl_assert(VG_(get_error_string)(e2) == NULL);
+ //tl_assert(VG_(get_error_string)(e1) == NULL);
+ //tl_assert(VG_(get_error_string)(e2) == NULL);
xe1 = (XError*)VG_(get_error_extra)(e1);
xe2 = (XError*)VG_(get_error_extra)(e2);
@@ -287,7 +287,7 @@
// Access via a non-pointer
VG_(message)(Vg_UserMsg, "Invalid %s of size %ld",
readwrite(xe->XE.Heap.sszB),
- xe->XE.Heap.sszB);
+ Word__abs(xe->XE.Heap.sszB));
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
VG_(message)(Vg_UserMsg,
" Address %#lx is not derived from any known block", a);
@@ -306,7 +306,7 @@
VG_(message)(Vg_UserMsg, "%s %s of size %ld", how_invalid,
readwrite(xe->XE.Heap.sszB),
- xe->XE.Heap.sszB);
+ Word__abs(xe->XE.Heap.sszB));
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
VG_(message)(Vg_UserMsg,
Modified: branches/PTRCHECK/exp-ptrcheck/sg_main.c
===================================================================
--- branches/PTRCHECK/exp-ptrcheck/sg_main.c 2008-09-10 09:36:46 UTC (rev 8598)
+++ branches/PTRCHECK/exp-ptrcheck/sg_main.c 2008-09-10 20:20:09 UTC (rev 8599)
@@ -1410,8 +1410,8 @@
/* Try to classify the block into which a memory access falls, and
- write the result in 'inv'. This writes all fields of 'inv',
- including, importantly the ReVal (revalidation) fields. */
+ write the result in 'inv'. This writes all relevant fields of
+ 'inv'. */
__attribute__((noinline))
static void classify_address ( /*OUT*/Invar* inv,
ThreadId tid,
@@ -1439,7 +1439,6 @@
}
}
}
-
/* Look in this thread's query cache */
{ Word i;
QCache* cache = &qcaches[tid];
@@ -1465,7 +1464,6 @@
}
stats__qcache_misses++;
}
-
/* Ok, so it's not a block in the top frame. Perhaps it's a block
in some calling frame? Consult this thread's stack-block
interval tree to find out. */
@@ -1564,20 +1562,48 @@
/* If this happens, then [ea,ea+szB) partially overlaps
a heap or stack block. We can't represent that, so
just forget it (should be very rare). However, do
- maximum sanity checks first. */
+ maximum sanity checks first. In such a
+ partial overlap case, it can't be the case that both
+ [ea] and [ea+szB-1] overlap the same block, since if
+ that were indeed the case then it wouldn't be a
+ partial overlap; rather it would simply fall inside
+ that block entirely and we shouldn't be inside this
+ conditional at all. */
if (!sOK) {
- StackTreeNode* nd = find_StackTreeNode( siTrees[tid], ea );
- /* "it does overlap a stack block */
- tl_assert(nd);
- /* "but does not completely fall with the block" */
- tl_assert(!is_subinterval_of(nd->addr, nd->szB, ea, szB));
+ StackTreeNode *ndFirst, *ndLast;
+ ndFirst = find_StackTreeNode( siTrees[tid], ea );
+ ndLast = find_StackTreeNode( siTrees[tid], ea+szB-1 );
+ /* if both ends of the range fall inside a block,
+ they can't be in the same block. */
+ if (ndFirst && ndLast)
+ tl_assert(ndFirst != ndLast);
+ /* for each end of the range, if it is in a block,
+ the range as a whole can't be entirely within the
+ block. */
+ if (ndFirst)
+ tl_assert(!is_subinterval_of(ndFirst->addr,
+ ndFirst->szB, ea, szB));
+ if (ndLast)
+ tl_assert(!is_subinterval_of(ndLast->addr,
+ ndLast->szB, ea, szB));
}
if (!gOK) {
- GlobalTreeNode* nd = find_GlobalTreeNode( giTree, ea );
- /* "it does overlap a global block */
- tl_assert(nd);
- /* "but does not completely fall with the block" */
- tl_assert(!is_subinterval_of(nd->addr, nd->szB, ea, szB));
+ GlobalTreeNode *ndFirst, *ndLast;
+ ndFirst = find_GlobalTreeNode( giTree, ea );
+ ndLast = find_GlobalTreeNode( giTree, ea+szB-1 );
+ /* if both ends of the range fall inside a block,
+ they can't be in the same block. */
+ if (ndFirst && ndLast)
+ tl_assert(ndFirst != ndLast);
+ /* for each end of the range, if it is in a block,
+ the range as a whole can't be entirely within the
+ block. */
+ if (ndFirst)
+ tl_assert(!is_subinterval_of(ndFirst->addr,
+ ndFirst->szB, ea, szB));
+ if (ndLast)
+ tl_assert(!is_subinterval_of(ndLast->addr,
+ ndLast->szB, ea, szB));
}
if (0) VG_(printf)("overlapping blocks in cache\n");
return;
Modified: branches/PTRCHECK/exp-ptrcheck.supp
===================================================================
--- branches/PTRCHECK/exp-ptrcheck.supp 2008-09-10 09:36:46 UTC (rev 8598)
+++ branches/PTRCHECK/exp-ptrcheck.supp 2008-09-10 20:20:09 UTC (rev 8599)
@@ -19,3 +19,20 @@
obj:/lib*/ld-2.*so*
obj:/lib*/ld-2.*so*
}
+
+{
+ ld-2.X poking around in god knows where
+ exp-ptrcheck:SorG
+ obj:/lib*/ld-2.*so*
+ obj:/lib*/ld-2.*so*
+ obj:/lib*/ld-2.*so*
+ obj:/lib*/ld-2.*so*
+}
+
+# I'm pretty sure this is a false positive caused by the sg_ stuff
+{
+ glibc realpath false positive
+ exp-ptrcheck:SorG
+ fun:realpath
+ fun:*
+}
|