You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
(7) |
2
(9) |
3
(7) |
4
(5) |
5
(5) |
6
(16) |
|
7
(20) |
8
(9) |
9
(15) |
10
(11) |
11
(13) |
12
(12) |
13
(10) |
|
14
(13) |
15
(6) |
16
(10) |
17
(12) |
18
(17) |
19
(3) |
20
(10) |
|
21
(11) |
22
(7) |
23
(6) |
24
(7) |
25
(5) |
26
(5) |
27
(14) |
|
28
(6) |
29
(4) |
30
(5) |
|
|
|
|
|
From: <sv...@va...> - 2008-09-14 16:04:51
|
Author: sewardj
Date: 2008-09-14 17:05:01 +0100 (Sun, 14 Sep 2008)
New Revision: 8618
Log:
Fix spelling in comment.
Modified:
branches/PTRCHECK/exp-ptrcheck/sg_main.c
Modified: branches/PTRCHECK/exp-ptrcheck/sg_main.c
===================================================================
--- branches/PTRCHECK/exp-ptrcheck/sg_main.c 2008-09-14 16:04:45 UTC (rev 8617)
+++ branches/PTRCHECK/exp-ptrcheck/sg_main.c 2008-09-14 16:05:01 UTC (rev 8618)
@@ -703,8 +703,9 @@
However, such trickery is scuppered by the fact that we
truncate all variable names to 15 characters to make
storage management simpler, hence giving pairs like
- "__EI___pthread_[TRUCATED]" vs "__pthread_keys". So it's
- simplest just to skip the name comparison completely. */
+ "__EI___pthread_" (truncated) vs "__pthread_keys". So
+ it's simplest just to skip the name comparison
+ completely. */
&& 0 == VG_(strcmp)(nd->descr->soname, nyu->descr->soname)) {
/* exact duplicate; ignore it */
sg_free(nyu);
|
|
From: <sv...@va...> - 2008-09-14 16:04:34
|
Author: sewardj Date: 2008-09-14 17:04:45 +0100 (Sun, 14 Sep 2008) New Revision: 8617 Log: Oops, this should have been part of r8616 (Add some initial documentation about Ptrcheck.). Modified: branches/PTRCHECK/exp-ptrcheck/Makefile.am Modified: branches/PTRCHECK/exp-ptrcheck/Makefile.am =================================================================== --- branches/PTRCHECK/exp-ptrcheck/Makefile.am 2008-09-14 16:03:18 UTC (rev 8616) +++ branches/PTRCHECK/exp-ptrcheck/Makefile.am 2008-09-14 16:04:45 UTC (rev 8617) @@ -126,3 +126,4 @@ noinst_HEADERS = h_main.h sg_main.h pc_common.h +EXTRA_DIST = README.ABOUT.PTRCHECK.txt |
|
From: <sv...@va...> - 2008-09-14 16:03:11
|
Author: sewardj
Date: 2008-09-14 17:03:18 +0100 (Sun, 14 Sep 2008)
New Revision: 8616
Log:
Add some initial documentation about Ptrcheck.
Added:
branches/PTRCHECK/exp-ptrcheck/README.ABOUT.PTRCHECK.txt
Added: branches/PTRCHECK/exp-ptrcheck/README.ABOUT.PTRCHECK.txt
===================================================================
--- branches/PTRCHECK/exp-ptrcheck/README.ABOUT.PTRCHECK.txt (rev 0)
+++ branches/PTRCHECK/exp-ptrcheck/README.ABOUT.PTRCHECK.txt 2008-09-14 16:03:18 UTC (rev 8616)
@@ -0,0 +1,368 @@
+
+0. CONTENTS
+~~~~~~~~~~~
+
+This document introduces Ptrcheck, a new, experimental Valgrind tool.
+It contains the following sections:
+
+ 1. INTRODUCING PTRCHECK
+ 2. HOW TO RUN IT
+ 3. HOW IT WORKS: HEAP CHECKING
+ 4. HOW IT WORKS: STACK & GLOBAL CHECKING
+ 5. COMPARISON WITH MEMCHECK
+ 6. LIMITATIONS
+ 7. STILL TO DO -- User visible things
+ 8. STILL TO DO -- Implementation tidying
+
+
+
+1. INTRODUCING PTRCHECK
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Ptrcheck is a Valgrind tool for finding overruns of heap, stack and
+global arrays. Its functionality overlaps somewhat with Memcheck's,
+but it is able to catch invalid accesses in a number of cases that
+Memcheck would miss. A detailed comparison against Memcheck is
+presented below.
+
+Ptrcheck is composed of two almost completely independent tools that
+have been glued together. One part, in h_main.[ch], checks accesses
+through heap-derived pointers. The other part, in sg_main.[ch],
+checks accesses to stack and global arrays. The remaining files
+pc_{common,main}.[ch], provide common error-management and
+coordination functions, so as to make it appear as a single tool.
+
+The heap-check part is an extensively-hacked (largely rewritten)
+version of the experimental "Annelid" tool developed and described by
+Nicholas Nethercote and Jeremy Fitzhardinge. The stack- and global-
+check part uses a heuristic approach derived from an observation about
+the likely forms of stack and global array accesses, and, as far as is
+known, is entirely novel.
+
+
+
+2. HOW TO RUN IT
+~~~~~~~~~~~~~~~~
+
+valgrind --tool=exp-ptrcheck [myprog] [args for myprog]
+
+There are no Ptrcheck specific flags at present.
+
+
+
+3. HOW IT WORKS: HEAP CHECKING
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Ptrcheck can check for invalid uses of heap pointers, including out of
+range accesses and accesses to freed memory. The mechanism is however
+completely different from Memcheck's, and the checking is more
+powerful.
+
+For each pointer in the program, Ptrcheck keeps track of which heap
+block (if any) it was derived from. Then, when an access is made
+through that pointer, Ptrcheck compares the access address with the
+bounds of the associated block, and reports an error if the address is
+out of bounds, or if the block has been freed.
+
+Of course it is rarely the case that one wants to access a block only
+at the exact address returned by malloc (et al). Ptrcheck understands
+that adding or subtracting offsets from a pointer to a block results
+in a pointer to the same block.
+
+At a fundamental level, this scheme works because a correct program
+cannot make assumptions about the addresses returned by malloc. In
+particular it cannot make any assumptions about the differences in
+addresses returned by subsequent calls to malloc. Hence there are
+very few ways to take an address returned by malloc, modify it, and
+still have a valid address. In short, the only allowable operations
+are adding and subtracting other non-pointer values. Almost all other
+operations produce a value which cannot possibly be a valid pointer.
+
+
+
+4. HOW IT WORKS: STACK & GLOBAL CHECKING
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When a source file is compiled with "-g", the compiler attaches Dwarf3
+debugging information which describes the location of all stack and
+global arrays in the file.
+
+Checking of accesses to such arrays would then be relatively simple,
+if the compiler could also tell us which array (if any) each memory
+referencing instruction was supposed to access. Unfortunately the
+Dwarf3 debugging format does not provide a way to represent such
+information, so we have to resort to a heuristic technique to
+approximate the same information. The key observation is that
+
+ if a memory referencing instruction accesses inside a stack or
+ global array once, then it is highly likely to always access that
+ same array
+
+To see how this might be useful, consider the following buggy
+fragment:
+
+ { int i, a[10]; // both are auto vars
+ for (i = 0; i <= 10; i++)
+ a[i] = 42;
+ }
+
+At run time we will know the precise address of a[] on the stack, and
+so we can observer that the first store resulting from "a[i] = 42"
+writes a[], and we will (correctly) assume that that instruction is
+intended always to access a[]. Then, on the 11th iteration, it
+accesses somewhere else, possibly a different local, possibly an
+un-accounted for area of the stack (eg, spill slot), so Ptrcheck
+reports an error.
+
+There is an important caveat.
+
+Imagine a function such as memcpy, which is used to read and write
+many different areas of memory over the lifetime of the program. If
+we insist that the read and write instructions in its memory copying
+loop only ever access one particular stack or global variable, we will
+be flooded with errors resulting from calls to memcpy.
+
+To avoid this problem, Ptrcheck instantiates fresh likely-target
+records for each entry to a function, and discards them on exit. This
+allows detection of cases where (eg) memcpy overflows its source or
+destination buffers for any specific call, but does not carry any
+restriction from one call to the next. Indeed, multiple threads may
+be multiple simultaneous calls to (eg) memcpy without mutual
+interference.
+
+
+
+5. COMPARISON WITH MEMCHECK
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Memcheck does not do any access checks for stack or global arrays, so
+the presence of those in Ptrcheck is a straight win. (But see
+LIMITATIONS below).
+
+Memcheck and Ptrcheck use different approaches for checking heap
+accesses. Memcheck maintains bitmaps telling it which areas of memory
+are accessible and which are not. If a memory access falls in an
+unaccessible area, it reports an error. By marking the 16 bytes
+before and after an allocated block unaccessible, Memcheck is able to
+detect small over- and underruns of the block. Similarly, by marking
+freed memory as unaccessible, Memcheck can detect all accesses to
+freed memory.
+
+Memcheck's approach is simple. But it's also weak. It can't catch
+block overruns beyond 16 bytes. And, more generally, because it
+focusses only on the question "is the target address accessible", it
+fails to detect invalid accesses which just happen to fall within some
+other valid area. This is not improbable, especially in crowded areas
+of the process' address space.
+
+Ptrcheck's approach is to keep track of pointers derived from heap
+blocks. It tracks pointers which are derived directly from calls to
+malloc et al, but also ones derived indirectly, by adding or
+subtracting offsets from the directly-derived pointers. When a
+pointer is finally used to access memory, Ptrcheck compares the access
+address with that of the block it was originally derived from, and
+reports an error if the access address is not within the block bounds.
+
+Consequently Ptrcheck can detect any out of bounds access through a
+heap-derived pointer, no matter how far from the original block it is.
+
+A second advantage is that Ptrcheck is better at detecting accesses to
+blocks freed very far in the past. Memcheck can detect these too, but
+only for blocks freed relatively recently. To detect accesses to a
+freed block, Memcheck must make it inaccessible, hence requiring a
+space overhead proportional to the size of the block. If the blocks
+are large, Memcheck will have to make them available for re-allocation
+relatively quickly, thereby losing the ability to detect invalid
+accesses to them.
+
+By contrast, Ptrcheck has a constant per-block space requirement of
+four machine words, for detection of accesses to freed blocks. A
+freed block can be reallocated immediately, yet Ptrcheck can still
+detect all invalid accesses through any pointers derived from the old
+allocation, providing only that the four-word descriptor for the old
+allocation is stored. For example, on a 64-bit machine, to detect
+accesses in any of the most recently freed 10 million blocks, Ptrcheck
+will require only 320MB of extra storage. Achieveing the same level
+of detection with Memcheck is close to impossible and would likely
+involve several gigabytes of extra storage.
+
+In defense of Memcheck ...
+
+Remember that Memcheck performs uninitialised value checking, which
+Ptrcheck does not. Memcheck has also benefitted from years of
+refinement, tuning, and experience with production-level usage, and so
+is much faster than Ptrcheck as it currently stands, as of September
+2008.
+
+Consequently it is recommended to first make your programs run
+Memcheck clean. Once that's done, try Ptrcheck to see if you can
+shake out any further heap, global or stack errors.
+
+
+
+6. LIMITATIONS
+~~~~~~~~~~~~~~
+
+This is an experimental tool, which relies rather too heavily on some
+not-as-robust-as-I-would-like assumptions on the behaviour of correct
+programs. There are a number of limitations which you should be aware
+of.
+
+* Heap checks: Ptrcheck can occasionally lose track of, or become
+ confused about, which heap block a given pointer has been derived
+ from. This can cause it to falsely report errors, or to miss some
+ errors. This is not believed to be a serious problem.
+
+* Heap checks: Ptrcheck only tracks pointers that are stored properly
+ aligned in memory. If a pointer is stored at a misaligned address,
+ and then later read again, Ptrcheck will lose track of what it
+ points at. Similar problem if a pointer is split into pieces and
+ later reconsitituted.
+
+* Heap checks: Ptrcheck needs to "understand" which system calls
+ return pointers and which don't. Many, but not all system calls are
+ handled. If an unhandled one is encountered, Ptrcheck will abort.
+
+* Stack checks: It follows from the description above (HOW IT WORKS:
+ STACK & GLOBAL CHECKING) that the first access by a memory
+ referencing instruction to a stack or global array creates an
+ association between that instruction and the array, which is checked
+ on subsequent accesses by that instruction, until the containing
+ function exits. Hence, the first access by an instruction to an
+ array (in any given function instantiation) is not checked for
+ overrun, since Ptrcheck uses that as the "example" of how subsequent
+ accesses should behave.
+
+* Stack checks: Similarly, and more serious, it is clearly possible to
+ write legitimate pieces of code which break the basic assumption
+ upon which the stack/global checking rests. For example:
+
+ { int a[10], b[10], *p, i;
+ for (i = 0; i < 10; i++) {
+ p = /* arbitrary condition */ ? &a[i] : &b[i];
+ *p = 42;
+ }
+ }
+
+ In this case the store sometimes accesses a[] and sometimes b[], but
+ in no cases is the addressed array overrun. Nevertheless the change
+ in target will cause an error to be reported.
+
+ It is hard to see how to get around this problem. The only
+ mitigating factor is that such constructions appear very rare, at
+ least judging from the results using the tool so far. Such a
+ construction appears only once in the Valgrind sources (running
+ Valgrind on Valgrind) and perhaps two or three times for a start and
+ exit of Firefox. The best that can be done is to suppress the
+ errors.
+
+* Performance: the stack/global checks require reading all of the
+ Dwarf3 type and variable information on the executable and its
+ shared objects. This is computationally expensive and makes startup
+ quite slow. You can expect debuginfo reading time to be in the
+ region of a minute for an OpenOffice sized application, on a 2.4 GHz
+ Core 2 machine. Reading this information also requires a lot of
+ memory. To make it viable, Ptrcheck goes to considerable trouble to
+ compress the in-memory representation of the Dwarf3 data, which is
+ why the process of reading it appears slow.
+
+* Performance: Ptrcheck runs slower than Memcheck. This is partly due
+ to a lack of tuning, but partly due to algorithmic difficulties.
+ The heap-check side is potentially quite fast. The stack and global
+ checks can sometimes require a number of range checks per memory
+ access, and these are difficult to short-circuit (despite
+ considerable efforts having been made).
+
+* Coverage: the heap checking is relatively robust, requiring only
+ that Ptrcheck can see calls to malloc/free et al. In that sense it
+ has debug-info requirements comparable with Memcheck, and is able to
+ heap-check programs even with no debugging information attached.
+
+ Stack/global checking is much more fragile. If a shared object does
+ not have debug information attached, then Ptrcheck will not be able
+ to determine the bounds of any stack or global arrays defined within
+ that shared object, and so will not be able to check accesses to
+ them. This is true even when those arrays are accessed from some
+ other shared object which was compiled with debug info.
+
+ At the moment Ptrcheck accepts objects lacking debuginfo without
+ comment. This is dangerous as it causes Ptrcheck to silently skip
+ stack & global checking for such objects. It would be better to
+ print a warning in such circumstances.
+
+* Coverage: Ptrcheck checks that the areas read or written by system
+ calls do not overrun heap blocks. But it doesn't currently check
+ them for overruns stack and global arrays. This would be easy to
+ add.
+
+* Performance: for implementation reasons, system call checking has a
+ cost proportional to the number of live and freed heap blocks being
+ tracked, and so can be very expensive. This is stupid and could
+ easily be fixed (see "STILL TO DO -- User visible things" below).
+
+* Platforms: the stack/global checks won't work properly on any
+ PowerPC platforms, only on x86 and amd64 targets. That's because
+ the stack and global checking requires tracking function calls and
+ exits reliably, and there's no obvious way to do it with the PPC
+ ABIs. (cf with the x86 and amd64 ABIs this is relatively
+ straightforward.)
+
+* Robustness: related to the previous point. Function call/exit
+ tracking for x86/amd64 is believed to work properly even in the
+ presence of longjmps within the same stack (although this has not
+ been tested). However, code which switches stacks is likely to
+ cause breakage/chaos.
+
+
+7. STILL TO DO -- User visible things
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Extend system call checking to work on stack and global arrays
+
+* Fix big performance problem to do with heap-vs-syscall checking.
+ How: in h_main.c: get rid of get_Seg_containing_addr_SLOW and
+ implement the same by doing a search in addr_to_seg_map. This would
+ fix the heap-vs-syscall performance problem noted above.
+
+* Print a warning if a shared object does not have debug info attached
+
+
+
+8. STILL TO DO -- Implementation tidying
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Items marked CRITICAL are considered important for correctness:
+non-fixage of them is liable to lead to crashes or assertion failures
+in real use.
+
+* h_main.c: make N_FREED_SEGS command-line configurable
+
+* Maybe add command line options to enable only heap checking, or only
+ stack/global checking
+
+* sg_main.c: Improve the performance of the stack / global checks by
+ doing some up-front filtering to ignore references in areas which
+ can't "obviously" can't be stack or globals. This will require
+ using information that m_aspacemgr knows about the address space
+ layout.
+
+* h_main.c: get rid of the last_seg_added hack; add suitable plumbing
+ to the core/tool interface to do this cleanly
+
+* h_main.c: move vast amounts of arch-dependent uglyness
+ (get_IntRegInfo et al) to its own source file, a la mc_machine.c.
+
+* h_main.c: make the lossage-check stuff work again, as a way of doing
+ quality assurance on the implementation
+
+* h_main.c: schemeEw_Atom: don't generate a call to nonptr_or_unknown,
+ this is really stupid, since it could be done at translation time
+ instead
+
+* CRITICAL: h_main.c: h_instrument (main instrumentation fn): generate
+ shadows for word-sized temps defined in the block's preamble. (Why
+ does this work at all, as it stands?)
+
+* CRITICAL: sg_main.c: make preen_Invar work properly again. Why
+ isn't it being called?
+
|
|
From: <sv...@va...> - 2008-09-14 12:51:37
|
Author: sewardj Date: 2008-09-14 13:51:47 +0100 (Sun, 14 Sep 2008) New Revision: 8615 Log: Make the regtests work in cases where glibc (+ libdl + libpthread + ld) have been built with debugging information, hence source locs are present. Modified: branches/PTRCHECK/exp-ptrcheck/tests/filter_stderr Modified: branches/PTRCHECK/exp-ptrcheck/tests/filter_stderr =================================================================== --- branches/PTRCHECK/exp-ptrcheck/tests/filter_stderr 2008-09-14 12:51:04 UTC (rev 8614) +++ branches/PTRCHECK/exp-ptrcheck/tests/filter_stderr 2008-09-14 12:51:47 UTC (rev 8615) @@ -16,7 +16,19 @@ # Anonymise paths like "__libc_start_main (../foo/bar/libc-quux.c:129)" sed "s/__libc_\(.*\) (.*)$/__libc_\1 (...libc...)/" | +# Remove preambly stuff sed \ -e "/^exp-ptrcheck, a heap, stack & global array overrun detector\.$/d" \ -e "/^NOTE: This is an Experimental-Class Valgrind Tool.$/d" \ --e "/^Copyright (C) 2003-200., and GNU GPL'd, by OpenWorks Ltd et al.$/d" \ +-e "/^Copyright (C) 2003-200., and GNU GPL'd, by OpenWorks Ltd et al.$/d" | + +# Tidy up in cases where glibc (+ libdl + libpthread + ld) have +# been built with debugging information, hence source locs are present +sed \ +-e "s/vfprintf ([a-z]*printf.c:[0-9]*)/.../" \ +-e "s/vsprintf ([a-z]*printf.c:[0-9]*)/.../" \ +-e "s/sprintf (sprintf.c:[0-9]*)/.../" \ +-e "s/printf (printf.c:[0-9]*)/.../" \ +-e "s/strdup (strdup.c:[0-9]*)/.../" \ +-e "s/pthread_key_create.c:[0-9]*/in \/...libpthread.../" \ +-e "s/genops.c:[0-9]*/in \/...libc.../" |
|
From: <sv...@va...> - 2008-09-14 12:50:56
|
Author: sewardj
Date: 2008-09-14 13:51:04 +0100 (Sun, 14 Sep 2008)
New Revision: 8614
Log:
Handle sys_getpid (it wasn't handled before?!)
Modified:
branches/PTRCHECK/exp-ptrcheck/h_main.c
Modified: branches/PTRCHECK/exp-ptrcheck/h_main.c
===================================================================
--- branches/PTRCHECK/exp-ptrcheck/h_main.c 2008-09-14 12:50:34 UTC (rev 8613)
+++ branches/PTRCHECK/exp-ptrcheck/h_main.c 2008-09-14 12:51:04 UTC (rev 8614)
@@ -2149,6 +2149,7 @@
# if defined(__NR_getpeername)
ADD(0, __NR_getpeername);
# endif
+ ADD(0, __NR_getpid);
ADD(0, __NR_getppid);
ADD(0, __NR_getresgid);
ADD(0, __NR_getresuid);
|
|
From: <sv...@va...> - 2008-09-14 12:50:27
|
Author: sewardj
Date: 2008-09-14 13:50:34 +0100 (Sun, 14 Sep 2008)
New Revision: 8613
Log:
Relax the tests for detection of duplicate global blocks in the debug info.
Modified:
branches/PTRCHECK/exp-ptrcheck/sg_main.c
Modified: branches/PTRCHECK/exp-ptrcheck/sg_main.c
===================================================================
--- branches/PTRCHECK/exp-ptrcheck/sg_main.c 2008-09-14 11:49:30 UTC (rev 8612)
+++ branches/PTRCHECK/exp-ptrcheck/sg_main.c 2008-09-14 12:50:34 UTC (rev 8613)
@@ -672,7 +672,8 @@
{
Bool already_present;
GlobalTreeNode *nyu, *nd;
- UWord keyW, valW;
+ UWord keyW, valW;
+
tl_assert(descr->szB > 0);
nyu = sg_malloc( "di.sg_main.abtG.1", sizeof(GlobalTreeNode) );
nyu->addr = descr->addr;
@@ -692,7 +693,18 @@
tl_assert(nd->descr);
tl_assert(nyu->descr);
if (nd->addr == nyu->addr && nd->szB == nyu->szB
- && 0 == VG_(strcmp)(nd->descr->name, nyu->descr->name)
+ /* && 0 == VG_(strcmp)(nd->descr->name, nyu->descr->name) */
+ /* Although it seems reasonable to demand that duplicate
+ blocks have identical names, that is too strict. For
+ example, reading debuginfo from glibc produces two
+ otherwise identical blocks with names "tzname" and
+ "__tzname". A constraint of the form "must be identical,
+ or one must be a substring of the other" would fix that.
+ However, such trickery is scuppered by the fact that we
+ truncate all variable names to 15 characters to make
+ storage management simpler, hence giving pairs like
+ "__EI___pthread_[TRUCATED]" vs "__pthread_keys". So it's
+ simplest just to skip the name comparison completely. */
&& 0 == VG_(strcmp)(nd->descr->soname, nyu->descr->soname)) {
/* exact duplicate; ignore it */
sg_free(nyu);
|
|
From: <sv...@va...> - 2008-09-14 11:49:24
|
Author: sewardj
Date: 2008-09-14 12:49:30 +0100 (Sun, 14 Sep 2008)
New Revision: 8612
Log:
Redo the post-syscall handling in h_main.c, so as to add a framework
which extends more easily to non-Linux OSs.
Modified:
branches/PTRCHECK/coregrind/pub_core_vkiscnums.h
branches/PTRCHECK/exp-ptrcheck/h_main.c
branches/PTRCHECK/include/pub_tool_basics.h
branches/PTRCHECK/include/pub_tool_vkiscnums.h
Modified: branches/PTRCHECK/coregrind/pub_core_vkiscnums.h
===================================================================
--- branches/PTRCHECK/coregrind/pub_core_vkiscnums.h 2008-09-13 11:58:59 UTC (rev 8611)
+++ branches/PTRCHECK/coregrind/pub_core_vkiscnums.h 2008-09-14 11:49:30 UTC (rev 8612)
@@ -51,9 +51,6 @@
/* Bind the given syscall name to the given number. Returns True if
successful, False if the name is unknown. */
extern Bool VG_(aix5_register_syscall)( Int, UChar* );
-/* Look up in said binding later, for the purposes of making error
- messages. */
-extern UChar* VG_(aix5_sysno_to_sysname)( Int sysno );
#endif
#endif /* !defined(VG_IN_ASSEMBLY_SOURCE) */
Modified: branches/PTRCHECK/exp-ptrcheck/h_main.c
===================================================================
--- branches/PTRCHECK/exp-ptrcheck/h_main.c 2008-09-13 11:58:59 UTC (rev 8611)
+++ branches/PTRCHECK/exp-ptrcheck/h_main.c 2008-09-14 11:49:30 UTC (rev 8612)
@@ -231,6 +231,7 @@
#include "pub_tool_vkiscnums.h"
#include "pub_tool_machine.h"
#include "pub_tool_wordfm.h"
+#include "pub_tool_xarray.h"
#include "pc_common.h"
@@ -1458,6 +1459,7 @@
if (o == GOF(RESVN) && is4) goto none;
if (o == GOF(TISTART) && is4) goto none;
if (o == GOF(TILEN) && is4) goto none;
+ if (o == GOF(REDIR_SP) && is4) goto none;
if (sz == 1) {
if (o == GOF(XER_SO)) goto none;
@@ -1778,10 +1780,10 @@
/* -------------------- ppc32 -------------------- */
# elif defined(VGA_ppc32)
/* The redir stack. */
- //if (arr->base == offsetof(VexGuestPPC64State,guest_REDIR_STACK[0])
- // && arr->elemTy == Ity_I64
- // && arr->nElems == VEX_GUEST_PPC64_REDIR_STACK_SIZE)
- // return True;
+ if (arr->base == offsetof(VexGuestPPC32State,guest_REDIR_STACK[0])
+ && arr->elemTy == Ity_I32
+ && arr->nElems == VEX_GUEST_PPC32_REDIR_STACK_SIZE)
+ return True;
VG_(printf)("is_integer_guest_reg_array(ppc32): unhandled: ");
ppIRRegArray(arr);
@@ -2025,265 +2027,398 @@
/*--- System calls ---*/
/*--------------------------------------------------------------------*/
-void h_pre_syscall ( ThreadId tid, UInt syscallno )
+void h_pre_syscall ( ThreadId tid, UInt sysno )
{
-//zz #if 0
-//zz UInt mmap_flags;
-//zz if (90 == syscallno) {
-//zz // mmap: get contents of ebx to find args block, then extract 'flags'
-//zz UInt* arg_block = (UInt*)VG_(get_thread_archreg)(tid, R_EBX);
-//zz VG_(printf)("arg_block = %#lx\n", arg_block);
-//zz mmap_flags = arg_block[3];
-//zz VG_(printf)("flags = %d\n", mmap_flags);
-//zz
-//zz } else if (192 == syscallno) {
-//zz // mmap2: get flags from 4th register arg
-//zz mmap_flags = VG_(get_thread_archreg)(tid, R_ESI);
-//zz
-//zz } else {
-//zz goto out;
-//zz }
-//zz
-//zz if (0 != (mmap_flags & VKI_MAP_FIXED)) {
-//zz VG_(skin_panic)("can't handle MAP_FIXED flag to mmap()");
-//zz }
-//zz
-//zz out:
-//zz #endif
-//zz return NULL;
+ /* we don't do anything at the pre-syscall point */
}
-void h_post_syscall ( ThreadId tid, UInt syscallno, SysRes res )
+/* The post-syscall table is a table of pairs (number, flag).
+
+ 'flag' is only ever zero or one. If it is zero, it indicates that
+ default handling for that syscall is required -- namely that the
+ syscall is deemed to return NONPTR. This is the case for the vast
+ majority of syscalls. If it is one then some special
+ syscall-specific handling is is required. No further details of it
+ are stored in the table.
+
+ On Linux, 'number' is a __NR_xxx constant.
+
+ On AIX5, 'number' is an Int*, which points to the Int variable
+ holding the currently assigned number for this syscall.
+
+ When querying the table, we compare the supplied syscall number
+ with the 'number' field (directly on Linux, after dereferencing on
+ AIX5), to find the relevant entry. This requires a linear search
+ of the table. To stop the costs getting too high, the table is
+ incrementally rearranged after each search, to move commonly
+ requested items a bit closer to the front.
+
+ The table is built once, the first time it is used. After that we
+ merely query it (and reorder the entries as a result). */
+
+static XArray* /* of UWordPair */ post_syscall_table = NULL;
+
+static void setup_post_syscall_table ( void )
{
- switch (syscallno) {
+ tl_assert(!post_syscall_table);
+ post_syscall_table = VG_(newXA)( VG_(malloc), "pc.h_main.spst.1",
+ VG_(free), sizeof(UWordPair) );
+ tl_assert(post_syscall_table);
+ /* --------------- LINUX --------------- */
+
+# if defined(VGO_linux)
+
+# define ADD(_flag, _syscallname) \
+ do { UWordPair p; p.uw1 = (_syscallname); p.uw2 = (_flag); \
+ VG_(addToXA)( post_syscall_table, &p ); \
+ } while (0)
+
/* These ones definitely don't return pointers. They're not
particularly grammatical, either. */
+
# if defined(__NR__llseek)
- case __NR__llseek:
+ ADD(0, __NR__llseek);
# endif
- case __NR__sysctl:
+ ADD(0, __NR__sysctl);
# if defined(__NR__newselect)
- case __NR__newselect:
+ ADD(0, __NR__newselect);
# endif
# if defined(__NR_accept)
- case __NR_accept:
+ ADD(0, __NR_accept);
# endif
- case __NR_access:
+ ADD(0, __NR_access);
# if defined(__NR_bind)
- case __NR_bind:
+ ADD(0, __NR_bind);
# endif
- case __NR_chdir:
- case __NR_chmod:
- case __NR_chown:
- case __NR_clock_getres:
- case __NR_clock_gettime:
- case __NR_clone:
- case __NR_close:
+# if defined(__NR_chdir)
+ ADD(0, __NR_chdir);
+# endif
+ ADD(0, __NR_chmod);
+ ADD(0, __NR_chown);
+ ADD(0, __NR_clock_getres);
+ ADD(0, __NR_clock_gettime);
+ ADD(0, __NR_clone);
+ ADD(0, __NR_close);
# if defined(__NR_connect)
- case __NR_connect:
+ ADD(0, __NR_connect);
# 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:
- case __NR_fchmod:
- case __NR_fchown:
+ ADD(0, __NR_dup);
+ ADD(0, __NR_dup2);
+ ADD(0, __NR_execve); /* presumably we see this because the call failed? */
+ ADD(0, __NR_exit); /* hmm, why are we still alive? */
+ ADD(0, __NR_exit_group);
+ ADD(0, __NR_fadvise64);
+ ADD(0, __NR_fchmod);
+ ADD(0, __NR_fchown);
# if defined(__NR_fchown32)
- case __NR_fchown32:
+ ADD(0, __NR_fchown32);
# endif
- case __NR_fcntl:
+ ADD(0, __NR_fcntl);
# if defined(__NR_fcntl64)
- case __NR_fcntl64:
+ ADD(0, __NR_fcntl64);
# endif
- case __NR_fdatasync:
- case __NR_fstat:
+ ADD(0, __NR_fdatasync);
+ ADD(0, __NR_fstat);
# if defined(__NR_fstat64)
- case __NR_fstat64:
+ ADD(0, __NR_fstat64);
# endif
- case __NR_fstatfs:
- case __NR_fsync:
- case __NR_ftruncate:
+ ADD(0, __NR_fstatfs);
+ ADD(0, __NR_fsync);
+ ADD(0, __NR_ftruncate);
# if defined(__NR_ftruncate64)
- case __NR_ftruncate64:
+ ADD(0, __NR_ftruncate64);
# endif
- case __NR_futex:
- case __NR_getcwd:
- case __NR_getdents: // something to do with teeth?
- case __NR_getdents64:
- case __NR_getegid:
+ ADD(0, __NR_futex);
+ ADD(0, __NR_getcwd);
+ ADD(0, __NR_getdents); // something to do with teeth
+ ADD(0, __NR_getdents64);
+ ADD(0, __NR_getegid);
# if defined(__NR_getegid32)
- case __NR_getegid32:
+ ADD(0, __NR_getegid32);
# endif
- case __NR_geteuid:
+ ADD(0, __NR_geteuid);
# if defined(__NR_geteuid32)
- case __NR_geteuid32:
+ ADD(0, __NR_geteuid32);
# endif
- case __NR_getgid:
+ ADD(0, __NR_getgid);
# if defined(__NR_getgid32)
- case __NR_getgid32:
+ ADD(0, __NR_getgid32);
# endif
- case __NR_getitimer:
+ ADD(0, __NR_getitimer);
# if defined(__NR_getpeername)
- case __NR_getpeername:
+ ADD(0, __NR_getpeername);
# endif
- case __NR_getppid:
- case __NR_getresgid:
- case __NR_getresuid:
- case __NR_getrlimit:
+ ADD(0, __NR_getppid);
+ ADD(0, __NR_getresgid);
+ ADD(0, __NR_getresuid);
+ ADD(0, __NR_getrlimit);
# if defined(__NR_getsockname)
- case __NR_getsockname:
+ ADD(0, __NR_getsockname);
# endif
# if defined(__NR_getsockopt)
- case __NR_getsockopt:
+ ADD(0, __NR_getsockopt);
# endif
- case __NR_gettimeofday:
- case __NR_getuid:
+ ADD(0, __NR_gettimeofday);
+ ADD(0, __NR_getuid);
# if defined(__NR_getuid32)
- case __NR_getuid32:
+ ADD(0, __NR_getuid32);
# endif
- case __NR_getxattr:
- case __NR_inotify_init:
- case __NR_ioctl: // ioctl -- assuming no pointers returned
- case __NR_kill:
- case __NR_link:
+ ADD(0, __NR_getxattr);
+ ADD(0, __NR_inotify_init);
+ ADD(0, __NR_ioctl); // ioctl -- assuming no pointers returned
+ ADD(0, __NR_kill);
+ ADD(0, __NR_link);
# if defined(__NR_listen)
- case __NR_listen:
+ ADD(0, __NR_listen);
# endif
- case __NR_lseek:
- case __NR_lstat:
+ ADD(0, __NR_lseek);
+ ADD(0, __NR_lstat);
# if defined(__NR_lstat64)
- case __NR_lstat64:
+ ADD(0, __NR_lstat64);
# endif
- case __NR_madvise:
- case __NR_mkdir:
- case __NR_mprotect:
- case __NR_munmap: // die_mem_munmap already called, segment removed
- case __NR_open:
- case __NR_pipe:
- case __NR_poll:
- case __NR_pread64:
- case __NR_pwrite64:
- case __NR_read:
- case __NR_readlink:
- case __NR_readv:
+ ADD(0, __NR_madvise);
+ ADD(0, __NR_mkdir);
+ ADD(0, __NR_mprotect);
+ ADD(0, __NR_munmap); // die_mem_munmap already called, segment remove);
+ ADD(0, __NR_open);
+ ADD(0, __NR_pipe);
+ ADD(0, __NR_poll);
+ ADD(0, __NR_pread64);
+ ADD(0, __NR_pwrite64);
+ ADD(0, __NR_read);
+ ADD(0, __NR_readlink);
+ ADD(0, __NR_readv);
# if defined(__NR_recvfrom)
- case __NR_recvfrom:
+ ADD(0, __NR_recvfrom);
# endif
# if defined(__NR_recvmsg)
- case __NR_recvmsg:
+ ADD(0, __NR_recvmsg);
# endif
- case __NR_rename:
- case __NR_rmdir:
- case __NR_rt_sigaction:
- case __NR_rt_sigprocmask:
- case __NR_rt_sigreturn: /* not sure if we should see this or not */
- case __NR_sched_get_priority_max:
- case __NR_sched_get_priority_min:
- case __NR_sched_getparam:
- case __NR_sched_getscheduler:
- case __NR_sched_setscheduler:
- case __NR_sched_yield:
- case __NR_select:
+ ADD(0, __NR_rename);
+ ADD(0, __NR_rmdir);
+ ADD(0, __NR_rt_sigaction);
+ ADD(0, __NR_rt_sigprocmask);
+ ADD(0, __NR_rt_sigreturn); /* not sure if we should see this or not */
+ ADD(0, __NR_sched_get_priority_max);
+ ADD(0, __NR_sched_get_priority_min);
+ ADD(0, __NR_sched_getparam);
+ ADD(0, __NR_sched_getscheduler);
+ ADD(0, __NR_sched_setscheduler);
+ ADD(0, __NR_sched_yield);
+ ADD(0, __NR_select);
# if defined(__NR_sendto)
- case __NR_sendto:
+ ADD(0, __NR_sendto);
# endif
- case __NR_set_robust_list:
+ ADD(0, __NR_set_robust_list);
# if defined(__NR_set_thread_area)
- case __NR_set_thread_area:
+ ADD(0, __NR_set_thread_area);
# endif
- case __NR_set_tid_address:
- case __NR_setitimer:
- case __NR_setrlimit:
- case __NR_setsid:
+ ADD(0, __NR_set_tid_address);
+ ADD(0, __NR_setitimer);
+ ADD(0, __NR_setrlimit);
+ ADD(0, __NR_setsid);
# if defined(__NR_setsockopt)
- case __NR_setsockopt:
+ ADD(0, __NR_setsockopt);
# endif
# if defined(__NR_shmctl)
- case __NR_shmctl:
- case __NR_shmdt:
+ ADD(0, __NR_shmctl);
+ ADD(0, __NR_shmdt);
# endif
# if defined(__NR_shutdown)
- case __NR_shutdown:
+ ADD(0, __NR_shutdown);
# endif
# if defined(__NR_socket)
- case __NR_socket:
+ ADD(0, __NR_socket);
# endif
# if defined(__NR_socketcall)
- case __NR_socketcall: /* the nasty x86-linux socket multiplexor */
+ ADD(0, __NR_socketcall); /* the nasty x86-linux socket multiplexor */
# endif
# if defined(__NR_statfs64)
- case __NR_statfs64:
+ ADD(0, __NR_statfs64);
# endif
# if defined(__NR_sigreturn)
- case __NR_sigreturn: /* not sure if we should see this or not */
+ ADD(0, __NR_sigreturn); /* not sure if we should see this or not */
# endif
# if defined(__NR_stat64)
- case __NR_stat64:
+ ADD(0, __NR_stat64);
# endif
- case __NR_stat:
- case __NR_statfs:
- case __NR_symlink:
- case __NR_sysinfo:
- case __NR_tgkill:
- case __NR_time:
- case __NR_times:
- case __NR_truncate:
+ ADD(0, __NR_stat);
+ ADD(0, __NR_statfs);
+ ADD(0, __NR_symlink);
+ ADD(0, __NR_sysinfo);
+ ADD(0, __NR_tgkill);
+ ADD(0, __NR_time);
+ ADD(0, __NR_times);
+ ADD(0, __NR_truncate);
# if defined(__NR_truncate64)
- case __NR_truncate64:
+ ADD(0, __NR_truncate64);
# endif
# if defined(__NR_ugetrlimit)
- case __NR_ugetrlimit:
+ ADD(0, __NR_ugetrlimit);
# endif
- case __NR_umask:
- case __NR_uname:
- case __NR_unlink:
- case __NR_utime:
+ ADD(0, __NR_umask);
+ ADD(0, __NR_uname);
+ ADD(0, __NR_unlink);
+ ADD(0, __NR_utime);
# if defined(__NR_waitpid)
- case __NR_waitpid:
+ ADD(0, __NR_waitpid);
# endif
- case __NR_wait4:
- case __NR_write:
- case __NR_writev:
- VG_(set_syscall_return_shadows)(
- tid, /* retval */ (UWord)NONPTR, 0,
- /* error */ (UWord)NONPTR, 0
- );
- break;
+ ADD(0, __NR_wait4);
+ ADD(0, __NR_write);
+ ADD(0, __NR_writev);
+ /* Whereas the following need special treatment */
# if defined(__NR_arch_prctl)
- case __NR_arch_prctl: {
- /* This is nasty. On amd64-linux, arch_prctl may write a
- value to guest_FS_ZERO, and we need to shadow that value.
- Hence apply nonptr_or_unknown to it here, after the
- syscall completes. */
- post_reg_write_nonptr_or_unknown( tid, PC_OFF_FS_ZERO,
- PC_SZB_FS_ZERO );
- VG_(set_syscall_return_shadows)(
- tid, /* retval */ (UWord)NONPTR, 0,
- /* error */ (UWord)NONPTR, 0
- );
- }
+ ADD(1, __NR_arch_prctl);
# endif
+ ADD(1, __NR_brk);
+ ADD(1, __NR_mmap);
+# if defined(__NR_mmap2)
+ ADD(1, __NR_mmap2);
+# endif
+# if defined(__NR_shmat)
+ ADD(1, __NR_shmat);
+# endif
+# if defined(__NR_shmget)
+ ADD(1, __NR_shmget);
+# endif
+ /* --------------- AIX5 --------------- */
+
+# elif defined(VGO_aix5)
+
+# define ADD(_flag, _syscallname) \
+ do { \
+ UWordPair p; \
+ if ((_syscallname) != __NR_AIX5_UNKNOWN) { \
+ p.uw1 = (UWord)&(_syscallname); p.uw2 = (_flag); \
+ VG_(addToXA)( post_syscall_table, &p ); \
+ } \
+ } while (0)
+
+ /* Just a minimal set of handlers, enough to make
+ a 32- and 64-bit hello-world program run. */
+ ADD(1, __NR_AIX5___loadx); /* not sure what to do here */
+ ADD(0, __NR_AIX5__exit);
+ ADD(0, __NR_AIX5_access);
+ ADD(0, __NR_AIX5_getgidx);
+ ADD(0, __NR_AIX5_getuidx);
+ ADD(0, __NR_AIX5_kfcntl);
+ ADD(0, __NR_AIX5_kioctl);
+ ADD(1, __NR_AIX5_kload); /* not sure what to do here */
+ ADD(0, __NR_AIX5_kwrite);
+
+# else
+# error "Unsupported OS"
+# endif
+
+# undef ADD
+}
+
+
+void h_post_syscall ( ThreadId tid, UInt sysno, SysRes res )
+{
+ Word i, n;
+ UWordPair* pair;
+
+ if (!post_syscall_table)
+ setup_post_syscall_table();
+
+ /* search for 'sysno' in the post_syscall_table */
+ n = VG_(sizeXA)( post_syscall_table );
+ for (i = 0; i < n; i++) {
+ pair = VG_(indexXA)( post_syscall_table, i );
+# if defined(VGO_linux)
+ if (pair->uw1 == (UWord)sysno)
+ break;
+# elif defined(VGO_aix5)
+ if (*(Int*)(pair->uw1) == (Int)sysno)
+ break;
+# else
+# error "Unsupported OS"
+# endif
+ }
+
+ tl_assert(i >= 0 && i <= n);
+
+ if (i == n) {
+ VG_(printf)("sysno == %u\n", sysno);
+# if defined(VGO_aix5)
+ VG_(printf)("syscallnm == %s\n",
+ VG_(aix5_sysno_to_sysname)(sysno));
+# endif
+ VG_(tool_panic)("unhandled syscall");
+ }
+
+ /* So we found the relevant entry. Move it one step
+ forward so as to speed future accesses to it. */
+ if (i > 0) {
+ UWordPair tmp, *p, *q;
+ p = VG_(indexXA)( post_syscall_table, i-1 );
+ q = VG_(indexXA)( post_syscall_table, i-0 );
+ tmp = *p;
+ *p = *q;
+ *q = tmp;
+ i--;
+ }
+
+ /* Deal with the common case */
+ pair = VG_(indexXA)( post_syscall_table, i );
+ if (pair->uw2 == 0) {
+ /* the common case */
+ VG_(set_syscall_return_shadows)(
+ tid, /* retval */ (UWord)NONPTR, 0,
+ /* error */ (UWord)NONPTR, 0
+ );
+ return;
+ }
+
+ /* Special handling for all remaining cases */
+ tl_assert(pair->uw2 == 1);
+
+# if defined(__NR_arch_prctl)
+ if (sysno == __NR_arch_prctl) {
+ /* This is nasty. On amd64-linux, arch_prctl may write a
+ value to guest_FS_ZERO, and we need to shadow that value.
+ Hence apply nonptr_or_unknown to it here, after the
+ syscall completes. */
+ post_reg_write_nonptr_or_unknown( tid, PC_OFF_FS_ZERO,
+ PC_SZB_FS_ZERO );
+ VG_(set_syscall_return_shadows)(
+ tid, /* retval */ (UWord)NONPTR, 0,
+ /* error */ (UWord)NONPTR, 0
+ );
+ return;
+ }
+# endif
+
+# if defined(__NR_brk)
// With brk(), result (of kernel syscall, not glibc wrapper) is a heap
// pointer. Make the shadow UNKNOWN.
- case __NR_brk:
+ if (sysno == __NR_brk) {
VG_(set_syscall_return_shadows)(
tid, /* retval */ (UWord)UNKNOWN, 0,
/* error */ (UWord)NONPTR, 0
);
- break;
+ return;
+ }
+# endif
// With mmap, new_mem_mmap() has already been called and added the
// segment (we did it there because we had the result address and size
// handy). So just set the return value shadow.
- case __NR_mmap:
-# if defined(__NR_mmap2)
- case __NR_mmap2:
-# endif
+ if (sysno == __NR_mmap
+# if defined(__NR_mmap2)
+ || sysno == __NR_mmap2
+# endif
+# if defined(__NR_AIX5___loadx)
+ || (sysno == __NR_AIX5___loadx && __NR_AIX5___loadx != __NR_AIX5_UNKNOWN)
+# endif
+# if defined(__NR_AIX5_kload)
+ || (sysno == __NR_AIX5_kload && __NR_AIX5_kload != __NR_AIX5_UNKNOWN)
+# endif
+ ) {
if (res.isError) {
// mmap() had an error, return value is a small negative integer
VG_(set_syscall_return_shadows)( tid, /*val*/ (UWord)NONPTR, 0,
@@ -2294,12 +2429,13 @@
/*err*/ (UWord)NONPTR, 0 );
if (0) VG_(printf)("ZZZZZZZ mmap res -> UNKNOWN\n");
}
- break;
+ return;
+ }
// shmat uses the same scheme. We will just have had a
// notification via new_mem_mmap. Just set the return value shadow.
# if defined(__NR_shmat)
- case __NR_shmat:
+ if (sysno == __NR_shmat) {
if (res.isError) {
VG_(set_syscall_return_shadows)( tid, /*val*/ (UWord)NONPTR, 0,
/*err*/ (UWord)NONPTR, 0 );
@@ -2309,21 +2445,23 @@
/*err*/ (UWord)NONPTR, 0 );
if (0) VG_(printf)("ZZZZZZZ shmat res -> UNKNOWN\n");
}
- break;
+ return;
+ }
# endif
# if defined(__NR_shmget)
- case __NR_shmget:
+ if (sysno == __NR_shmget) {
// FIXME: is this correct?
VG_(set_syscall_return_shadows)( tid, /*val*/ (UWord)UNKNOWN, 0,
/*err*/ (UWord)NONPTR, 0 );
- break;
+ return;
+ }
# endif
- default:
- VG_(printf)("syscallno == %d\n", syscallno);
- VG_(tool_panic)("unhandled syscall");
- }
+ /* If we get here, it implies the corresponding entry in
+ post_syscall_table has .w2 == 1, which in turn implies there
+ should be special-case code for it above. */
+ tl_assert(0);
}
Modified: branches/PTRCHECK/include/pub_tool_basics.h
===================================================================
--- branches/PTRCHECK/include/pub_tool_basics.h 2008-09-13 11:58:59 UTC (rev 8611)
+++ branches/PTRCHECK/include/pub_tool_basics.h 2008-09-14 11:49:30 UTC (rev 8612)
@@ -83,7 +83,10 @@
# define NULL ((void*)0)
#endif
+/* This is just too useful to not have around the place somewhere. */
+typedef struct { UWord uw1; UWord uw2; } UWordPair;
+
/* ---------------------------------------------------------------------
non-builtin types
------------------------------------------------------------------ */
Modified: branches/PTRCHECK/include/pub_tool_vkiscnums.h
===================================================================
--- branches/PTRCHECK/include/pub_tool_vkiscnums.h 2008-09-13 11:58:59 UTC (rev 8611)
+++ branches/PTRCHECK/include/pub_tool_vkiscnums.h 2008-09-14 11:49:30 UTC (rev 8612)
@@ -54,14 +54,29 @@
#if defined(VGP_x86_linux)
# include "vki/vki-scnums-x86-linux.h"
+
#elif defined(VGP_amd64_linux)
# include "vki/vki-scnums-amd64-linux.h"
+
#elif defined(VGP_ppc32_linux)
# include "vki/vki-scnums-ppc32-linux.h"
+
#elif defined(VGP_ppc64_linux)
# include "vki/vki-scnums-ppc64-linux.h"
+
#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
# include "vki/vki-scnums-aix5.h"
+
+/* Make it possible to include this file in assembly sources. */
+#if !defined(VG_IN_ASSEMBLY_SOURCE)
+
+/* Look up the name of a syscall, using the bindings previously
+ created by VG_(aix5_register_syscall), for the purposes of making
+ error messages. */
+extern UChar* VG_(aix5_sysno_to_sysname)( Int sysno );
+
+#endif /* !defined(VG_IN_ASSEMBLY_SOURCE) */
+
#else
# error Unknown platform
#endif
|
|
From: <bar...@gm...> - 2008-09-14 07:50:58
|
Nightly build on georgia-tech-cellbuzz ( IBM BladeCenter QS20 ) started at 2008-09-14 03:00:01 EDT Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... done Regression test results follow == 368 tests, 21 stderr failures, 11 stdout failures, 1 post failure == drd/tests/pth_create_chain (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc07_hbl1 (stderr) helgrind/tests/tc08_hbl2 (stderr) helgrind/tests/tc11_XCHG (stderr) helgrind/tests/tc20_verifywrap (stderr) massif/tests/long-names (post) memcheck/tests/deep_templates (stdout) memcheck/tests/file_locking (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/zeropage (stdout) none/tests/async-sigs (stdout) none/tests/blockfault (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) none/tests/ppc32/jm-fp (stdout) none/tests/ppc32/jm-vmx (stdout) none/tests/ppc32/round (stdout) none/tests/ppc32/test_gx (stdout) none/tests/ppc64/jm-fp (stdout) none/tests/ppc64/jm-vmx (stdout) none/tests/ppc64/round (stdout) |
|
From: Tom H. <th...@cy...> - 2008-09-14 03:24:48
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2008-09-14 03:15:03 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 346 tests, 60 stderr failures, 1 stdout failure, 29 post failures == helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/hg06_readshared (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc02_simple_tls (stderr) helgrind/tests/tc03_re_excl (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc07_hbl1 (stderr) helgrind/tests/tc08_hbl2 (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc11_XCHG (stderr) helgrind/tests/tc12_rwl_trivial (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) helgrind/tests/tc24_nonzero_sem (stderr) massif/tests/alloc-fns-A (post) massif/tests/alloc-fns-B (post) massif/tests/basic (post) massif/tests/basic2 (post) massif/tests/big-alloc (post) massif/tests/culling1 (stderr) massif/tests/culling2 (stderr) massif/tests/custom_alloc (post) massif/tests/deep-A (post) massif/tests/deep-B (stderr) massif/tests/deep-B (post) massif/tests/deep-C (stderr) massif/tests/deep-C (post) massif/tests/deep-D (post) massif/tests/ignoring (post) massif/tests/insig (post) massif/tests/long-names (post) massif/tests/long-time (post) massif/tests/new-cpp (post) massif/tests/null (post) massif/tests/one (post) massif/tests/overloaded-new (post) massif/tests/peak (post) massif/tests/peak2 (stderr) massif/tests/peak2 (post) massif/tests/realloc (stderr) massif/tests/realloc (post) massif/tests/thresholds_0_0 (post) massif/tests/thresholds_0_10 (post) massif/tests/thresholds_10_0 (post) massif/tests/thresholds_10_10 (post) massif/tests/thresholds_5_0 (post) massif/tests/thresholds_5_10 (post) massif/tests/zero1 (post) massif/tests/zero2 (post) memcheck/tests/file_locking (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/long_namespace_xml (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/origin1-yes (stderr) memcheck/tests/origin4-many (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_changes (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/x86/bug152022 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) memcheck/tests/x86/xor-undef-x86 (stderr) memcheck/tests/xml1 (stderr) none/tests/blockfault (stderr) none/tests/mremap2 (stdout) none/tests/shell (stderr) none/tests/shell_valid1 (stderr) none/tests/shell_valid2 (stderr) none/tests/shell_valid3 (stderr) |
|
From: Tom H. <th...@cy...> - 2008-09-14 03:00:09
|
Nightly build on aston ( x86_64, Fedora Core 5 ) started at 2008-09-14 03:20:04 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 444 tests, 8 stderr failures, 1 stdout failure, 0 post failures == helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/x86/scalar (stderr) none/tests/blockfault (stderr) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2008-09-14 02:52:52
|
Nightly build on trojan ( x86_64, Fedora Core 6 ) started at 2008-09-14 03:25:03 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 442 tests, 9 stderr failures, 5 stdout failures, 0 post failures == helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/bug133694 (stdout) memcheck/tests/x86/bug133694 (stderr) memcheck/tests/x86/scalar (stderr) none/tests/blockfault (stderr) none/tests/cmdline1 (stdout) none/tests/cmdline2 (stdout) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2008-09-14 02:51:26
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2008-09-14 03:05:08 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 438 tests, 7 stderr failures, 2 stdout failures, 0 post failures == helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/scalar (stderr) none/tests/blockfault (stderr) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2008-09-14 02:28:46
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2008-09-14 03:00:06 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 444 tests, 31 stderr failures, 3 stdout failures, 0 post failures == helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/amd64/insn_ssse3 (stdout) none/tests/amd64/insn_ssse3 (stderr) none/tests/amd64/ssse3_misaligned (stderr) none/tests/blockfault (stderr) none/tests/fdleak_fcntl (stderr) none/tests/mremap2 (stdout) none/tests/x86/insn_ssse3 (stdout) none/tests/x86/insn_ssse3 (stderr) none/tests/x86/ssse3_misaligned (stderr) |