Commit Graph

81 Commits

Author SHA1 Message Date
Julian Seward
dc53563392 Intercept strlen in ld.so on x86. Fixes #266961.
(Jakub Jelinek, jakub@redhat.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11668
2011-03-28 08:22:55 +00:00
Julian Seward
6107fd666c Add a port to IBM z/Architecture (s390x) running Linux -- Valgrind
side components. (Florian Krohm <britzel@acm.org> and Christian
Borntraeger <borntraeger@de.ibm.com>).  Fixes #243404.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11604
2011-03-07 16:05:35 +00:00
Julian Seward
46bbd35ea3 Make ld.so:index redir mandatory for glibc-2.12 and later, on x86-linux.
Also, improve the failure message a bit, so as to tell people what package
they need to install, in at least some cases.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11538
2011-02-11 16:47:03 +00:00
Julian Seward
1baa12e56d Merge from branches/THUMB: supps and mandatory redirs on Ubuntu 10.04 (ARM)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11281
2010-08-22 12:13:35 +00:00
Nicholas Nethercote
6fd0eb7b07 Merged the MACOSX106 branch to the trunk. Merge command:
svn merge -r11143:HEAD svn://svn.valgrind.org/valgrind/branches/MACOSX106

There were some easy-to-resolve conflicts.

Then I had to fix up coregrind/link_tool_exe*.in -- those files had been
added independently on both the trunk and the branch, AFAICT.  I just
overwrote the trunk versions with the branch versions.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11194
2010-07-01 00:20:20 +00:00
Julian Seward
2e6b7655d1 New flag --require-text-symbol=:sopatt:fnpatt, to be used to check
that specified shared objects contain specified symbols.  Along with a
couple of regtests that unfortunately will fail on MacOSX.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11125
2010-05-09 22:30:43 +00:00
Julian Seward
9b0574dff8 Update copyright dates to 2010.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11121
2010-05-03 21:37:12 +00:00
Julian Seward
e9de458500 Merge from branches/ARM, all parts of the ARM-Linux port except for
the changes to do with reading and using ELF and DWARF3 info.
This breaks all targets except amd64-linux and x86-linux.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10982
2010-01-01 11:59:33 +00:00
Bart Van Assche
8cab2ecf92 Follow-up for r10972: added missing #include "config.h".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10978
2009-12-31 13:31:11 +00:00
Tom Hughes
2a4c610013 Assert that the indirect function wrapper exists if we encounter a
redirection for an indirect function.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10942
2009-11-16 09:06:09 +00:00
Tom Hughes
8e518d8c22 Initialise the isIFunc flag when adding a hardwired redirection. Fixes #212547.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10923
2009-11-01 16:37:33 +00:00
Tom Hughes
00d987f91a Add support for ELF indirect functions. These are symbols of
type STT_GNU_IFUNC which, instead of pointing directly at the
function, point at a routine which will return the address of
the real function. Redirection of indirect functions is handled
by valgrind as follows:

  - When a redirection specification matches an indirect
    function symbol an active redirection is added in the
    normal way, but with the isIFunc flag set.

  - When a call is made to an address which matches an
    active redirection with the isIFunc flag set the call
    is redirected, but not to the target address of the
    redirection - instead it is sent to a small wrapper
    routine that is preloaded into the client.

  - The wrapper routine calls the original client routine
    and collects the result, which it reports to valgrind
    using a client request, and then returns the result to
    the caller.

  - When valgrind gets the client request it looks up the
    active redirection for the indirect function and then
    adds a new active redirection which redirects from the
    address returned by the indirection function to the
    redirection target. This new redirection does not have
    the isIFunc flag set so behaves as a normal redirection.

In addition to the above we also add a few new redirections to
memcheck to capture internal calls made by glibc to things like
strlen, as these internal calls do not go through the indirect
function and instead go direct to the chosen implementation.

Based on a patch from Dodji Seketeli and comments from Jakub
Jelinek, this commit closes bug 206013.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10920
2009-10-29 09:27:11 +00:00
Julian Seward
6f3ce096ad Fix some const stuff that gcc-4.4.0 complains about.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10771
2009-08-10 19:39:02 +00:00
Julian Seward
b39a007b53 Reinstating a heavily modified version of r10402. This is to do
with #190429.

This patch (originally from Jakub Jelinek) makes the redir of strlen
in ld.so on amd64-linux ld.so mandatory, but only for glibc 2.10 and
above.  For glibc-2.2 (our earliest supported version) to glibc-2.9
it is still optional.

Also, makes more verbose, the message that is printed if a mandatory
ld.so redirection on Linux cannot be set up.

Is believed to fix #190429.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10689
2009-08-02 12:21:31 +00:00
Julian Seward
d7ed7f6a13 (almost completely just function renaming):
* VG_(find_seginfo): incrementally rearrange the DebugInfo list, like
  most of the other list-searching functions do.

* rename all VG_(*seginfo*) functions exported from m_debuginfo to
  VG_(*DebugInfo*).  "seginfo" was a historical name which was mostly
  but not completely, done away with some time back.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10678
2009-07-31 09:41:29 +00:00
Julian Seward
e7dde85a24 Merge coregrind/ changes from branches/MESSAGING_TIDYUP r10464.
This commit tidies up and rationalises what could be called the
"messaging" system -- that part of V to do with presenting output to
the user.  In particular it brings significant improvements to XML
output.

Changes are:

* XML and normal text output now have separate file descriptors,
  which solves longstanding problems for XML consumers caused by
  the XML output getting polluted by unexpected non-XML output.

* This also means that we no longer have to hardwire all manner
  of output settings (verbosity, etc) when XML is requested.

* The XML output format has been revised, cleaned up, and made
  more suitable for use by error detecting tools in general
  (various Memcheck-specific features have been removed).  XML
  output is enabled for Ptrcheck and Helgrind, and Memcheck is
  updated to the new format.

* One side effect is that the behaviour of VG_(message) has been
  made to be consistent with printf: it no longer automatically
  adds a newline at the end of the output.  This means multiple
  calls to it can be used to build up a single line message; or a
  single call can write a multi-line message.  The ==pid==
  preamble is automatically inserted at each newline.

* VG_(message)(Vg_UserMsg, ..args..) now has the abbreviated form
  VG_(UMSG)(..args..); ditto VG_(DMSG) for Vg_DebugMsg and
  VG_(EMSG) for Vg_DebugExtraMsg.  A couple of other useful
  printf derivatives have been added to pub_tool_libcprint.h,
  most particularly VG_(vcbprintf).

* There's a small change in the core-tool interface to do with
  error handling: VG_(needs_tool_errors) has a new method
  void (*before_pp_Error)(Error* err)  which, if non-NULL, is
  called just before  void (*pp_Error)(Error* err).  This is to
  give tools the chance to look at errors before any part of them
  is printed, so they can print any XML preamble they like.

* coregrind/m_errormgr.c has been overhauled and cleaned up, and
  is a bit simpler and more commented.  In particular pp_Error
  and VG_(maybe_record_error) are significantly changed.

The diff is huge, but mostly very boring.  Most of the changes
are of the form

-   VG_(message)(Vg_UserMsg, "this is a message %d", n);
+   VG_(message)(Vg_UserMsg, "this is a message %d\n", n);

Unfortunately as a result of this, it touches a large number
of source files.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10465
2009-07-15 14:48:32 +00:00
Nicholas Nethercote
4fc7d06fcc Back out r10402 because it completely breaks things on Ubuntu 9.04 and
OpenSUSE 11.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10404
2009-07-02 20:47:53 +00:00
Tom Hughes
3ddeb03e5b Replace strlen on amd64-linux with a simple version that doesn't
generate false positives.

Patch from Jakub Jelinek <jakub@redhat.com>. Fixes #190429.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10402
2009-07-02 13:02:12 +00:00
Nicholas Nethercote
07045477ca Merge the DARWIN branch onto the trunk.
I tried using 'svn merge' to do the merge but it did a terrible job and
there were bazillions of conflicts.  So instead I just took the diff between
the branch and trunk  at r10155, applied the diff to the trunk, 'svn add'ed
the added files (no files needed to be 'svn remove'd) and committed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10156
2009-05-28 01:53:07 +00:00
Nicholas Nethercote
2001629c3f Updated copyright years.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9344
2009-03-10 22:02:09 +00:00
Bart Van Assche
d704a19db5 Removed mandatory redirections for DRD since these made DRD impossible to use on openSUSE 10.3 ppc.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9092
2009-01-30 18:31:54 +00:00
Julian Seward
09dac86eca Add a new module, m_seqmatch, which does very simple sequence (regexp)
matching, in the function VG_(generic_match).  Patterns to be matched
against may contain only '*'-style wildcards (matches any number of
elements, we don't care what they are), '?' wildcards (matches exactly
one element, we don't care what it is) and literal elements.

It is totally abstractified, in the sense that the pattern and input
arrays may be arrays of anything.  The caller provides enough
information so that VG_(generic_match) can step along both arrays, and
can ask the questions "is this pattern element a '*' ?", "is this
pattern element a '?' ?", and "does this pattern element match an
input element ?".

The existing function VG_(string_match) is reimplemented using
VG_(generic_match), although the ability to escape metacharacters in
the pattern string is removed -- I don't think it was ever used.

In m_errormgr, matching of suppression stacks (including wildcard
"..." lines) against error stacks is re-implemented using
VG_(generic_match).

Further detailed comments are in m_seqmatch.h and pub_tool_seqmatch.h.

A negative side effect is that VG_(string_match) will be much slower
than before, due to the abstractification.  It may be necessary to
reimplement a specialised version later.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8816
2008-12-12 08:07:49 +00:00
Julian Seward
335992d8fc Merge all remaining changes from branches/PTRCHECK. These are some
relatively minor extensions to m_debuginfo, a major overhaul of
m_debuginfo/readdwarf3.c to get its space usage under control, and
changes throughout the system to enable heap-use profiling.

The majority of the merged changes were committed into
branches/PTRCHECK as the following revs: 8591 8595 8598 8599 8601 and
8161.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8621
2008-09-18 18:12:50 +00:00
Bart Van Assche
547e5c2c9f Changed exp-drd tool name into drd.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8362
2008-07-04 15:34:23 +00:00
Bart Van Assche
46f92fc29f Changed _Spec::mandatory from HChar* into const HChar*. If no symbol information is found in ld.so during startup of the exp-drd tool, let Valgrind abort and print an informative error message.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8170
2008-06-01 16:33:37 +00:00
Julian Seward
14af4957fc Merge in the DATASYMS branch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7540
2008-03-03 01:35:41 +00:00
Julian Seward
5679a22410 Update copyright dates ("200X-2007" --> "200X-2008").
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7398
2008-02-11 11:34:59 +00:00
Julian Seward
760e1d046e Make one redirect mandatory for ppc64-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7167
2007-11-16 19:39:49 +00:00
Julian Seward
5d69e35fdc Make one of the ppc32-linux initial redirects mandatory, and add
further comments.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7166
2007-11-16 18:45:40 +00:00
Julian Seward
f245d83cc4 Introduce the concept of a 'mandatory redirection'. A redirection
says (essentially) "I am the replacement for function foo in object w/
soname bar.so".  Now, if a redirection is mandatory, and bar.so is
loaded but foo is not found in its symbol table, then V aborts.

The initial motivation for this is making Memcheck work sanely on
glibc-2.6.X ppc32-linux.  We really need to intercept 'strlen' in
ld.so right from startup.  If ld.so does not have a visible 'strlen'
symbol, Memcheck generates an impossible number of errors resulting
from highly tuned strlen implementation in ld.so, and is completely
unusable -- the resulting undefinedness eventually seeps everywhere.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7165
2007-11-16 18:32:40 +00:00
Nicholas Nethercote
0974a299f5 Split the OSet interface into two parts: "OSetGen_", which is the existing
interface and provides full power;  and "OSetWord_", which is an
easier-to-use interface for if you just want to store words.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6841
2007-09-17 05:30:48 +00:00
Julian Seward
b7302d9258 Get rid of the type XArrayStrings in m_clientstate and use new generic
equivalents in module m_xarray instead.  A suprisingly pervasive
change.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6616
2007-02-25 15:08:24 +00:00
Julian Seward
172505c978 Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6488
2007-01-08 06:01:59 +00:00
Julian Seward
ecb2ce6536 Merge r6132:
Minor changes for redirection on AIX.  The only significant change is
that it now checks for, warns about and disallows, attempts to
redirect to, or wrap with, a function for which no TOC pointer can be
found, since that would be really asking for trouble (a segfault).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6269
2006-10-17 01:39:30 +00:00
Julian Seward
751284af95 SuSE 10.1 (ppc32/64) fixlet.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6010
2006-08-25 11:48:38 +00:00
Julian Seward
ad67fd79fe Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5954
2006-06-05 23:21:15 +00:00
Julian Seward
8ca05cc698 Get rid of VG_(x86_linux_REDIR_FOR__dl_sysinfo_int80) and do the x86-linux
stack unwind kludge another way.  This is believed to fix #108258.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5868
2006-04-29 18:03:14 +00:00
Julian Seward
0b7e01a2fa Fix a redirection bug created by the overhaul of m_redir.c. Bug
caused hardwired Actives to be discarded at the first call to
VG_(redir_notify_delete_SegInfo).  This causes crashes on amd64-linux
by throwing away the hardwired redirections

  0xFFFFFFFFFF600000 -> VG_(amd64_linux_REDIR_FOR_vgettimeofday)
  0xFFFFFFFFFF600400 -> VG_(amd64_linux_REDIR_FOR_vtime)

which I'm sure got mentioned at some point recently, but I cannot find
the email now.

Bug does not affect 3.1.X, since that line contains the old m_redir.c
implementation.

Bug does not affect any platform other than amd64-linux since no
others have hardwired Actives at the start.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5750
2006-03-12 00:39:19 +00:00
Julian Seward
be6fd9597d Fix erroneous hardwired redirect spec.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5622
2006-02-09 10:29:43 +00:00
Julian Seward
5e77fedd75 Fix more ppc64-linux function wrapping and symbol-table bits and pieces.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5523
2006-01-12 21:15:35 +00:00
Julian Seward
f9a9e03c7a Merge in function wrapping support from the FNWRAP branch. That
branch hereby becomes inactive.  This currently breaks everything
except x86; fixes for amd64/ppc32 to follow.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5520
2006-01-12 12:32:32 +00:00
Julian Seward
9c0ae4be6f Initial redirect stuff for ppc64-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5499
2006-01-05 14:07:04 +00:00
Julian Seward
8ba9a34088 Add framework for ppc64 support. Apologies in advance for the
inevitable breakage to other platforms.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5250
2005-11-29 13:05:56 +00:00
Julian Seward
fbf6836aec As with ppc it's necessary to have an initial redirect for index(strchr)
on x86 glibc-2.3.5.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5223
2005-11-20 19:37:54 +00:00
Julian Seward
da4edd2f48 ppc32: just apply the initial-redirection hack when Memcheck is in use
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5197
2005-11-18 21:12:52 +00:00
Julian Seward
15ba5b2d9e Back out r5180 (sorry Josef). On consideration it just increases the difficulty
of testing the system properly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5190
2005-11-18 15:10:24 +00:00
Julian Seward
3de346b9e3 (ppc32) Only include hacky redirects for malloc-replacing tools.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5180
2005-11-17 20:15:04 +00:00
Nicholas Nethercote
cf39f65c7d OSet-ify m_redir.c.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4930
2005-10-15 15:48:52 +00:00
Julian Seward
04bb445744 Various fixes to reduce noise level on SuSE 10 (PPC). Also fix some
ppc32 syscalls.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4927
2005-10-15 02:00:41 +00:00
Julian Seward
f0f1b729c9 ppc32-linux only: redirect strcmp right from the start.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4841
2005-10-01 19:12:08 +00:00