55 Commits

Author SHA1 Message Date
Philippe Waroquiers
eb2b193943 Fix dangling ref in m_errormgr.c + report all uninit fields in a syscall param
Some syscall verification code is allocating memory to generate 
the string used to build an error, e.g. syswrap-generic.c verifying fields of
e.g socket addresses (pre_mem_read_sockaddr) or sendmsg/recvmsg args 
(msghdr_foreachfield)

The allocated pointer was copied in the error created by VG_(maybe_record_error).

This was wrong for 2 reasons:
1. If the error is a new error, it is stored in a list of errors,
   but the string memory was freed by pre_mem_read_sockaddr, msghdr_foreachfield, ...
   This causes a dangling reference. Was at least visible when giving -v, which
   re-prints all errors at the end of execution.
   Probably this could have some consequences during run while generating new errors,
   and comparing for equality with a recorded error having a dangling reference.
2. the same allocated string is re-used for each piece/field of the verified struct.
   The code in mc_errors.c that checks that 2 errors are identical was then wrongly
   considereing that 2 successive errors for 2 different fields for the same syscall
   arg are identical, just because the error string happened to be produced at
   the same address.
(it is believed that initially, the error string was assumed to be a static
string, which is not the case anymore, causing the above 2 problems).

Changes:
* The fix consists in duplicating in m_errormgr.c the given error string when
  the error is recorded. In other words, the error string is now duplicated similarly
  to the (optional) extra component of the error.

* memcheck/tests/linux/rfcomm.c test modified as now an error is reported
  for each uninit field.

* socketaddr unknown family is also better reported (using sa_data field name,
  rather than an empty field name.

* minor reformatting in m_errormgr.c, to be below 80 characters.

Some notes:
1. the string is only duplicated if the error is recorded
   (ie. printed or the first time an error matches a suppression).
   The string is not duplicated for duplicated errors or following errors
   matching the first (suppressed) error.
   The string is also not duplicated for 'unique errors' (that are printed
   and then not recorded).
2. duplicating the string for each recorded error is not deemed to
   use a lot of memory:
     * error strings are usually NULL or short (often 10 bytes or so).
     * we expect no program has a huge number of errors
   If ever this string duplicate would be significant, having a DedupPoolAlloc
   in m_errormgr.c for these strings would reduce this memory (as we expect to
   have very few different strings, even with millions of errors).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14214
2014-07-30 22:20:29 +00:00
Philippe Waroquiers
9b67d18f11 Improve address description for address in the stack.
--read-var-info=yes is very memory and cpu intensive.
This patch ensures that even witout --read-var-info=yes that
the frame where the address point is reported in the address
description.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13991
2014-05-22 23:48:24 +00:00
Mark Wielaard
86f74d6026 Support Linux kernel AF_BLUETOOTH for bind().
Bug #320116. sockaddr_rc might contain some padding which might not be
initialized. Explicitly check the sockaddr_rc fields are set. That also
produces better diagnostics about which field is unitialized.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13404
2013-05-22 10:21:10 +00:00
Florian Krohm
8c76e43290 Make sys-openat test conditional upon the existence of AT_FDCWD.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13171
2012-12-08 19:26:03 +00:00
Julian Seward
12a820fcbf Fix some gcc complaints about unused variables in these tests.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13167
2012-12-06 23:11:19 +00:00
Julian Seward
36468d9ae2 For sys-openat the dirfd argument should be ignored when the pathname
is absolute.  Fixes #307103.  (Mark Wielaard, mjw@redhat.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13159
2012-12-06 16:05:18 +00:00
Petar Jovanovic
516de0bcd6 Correctly skip memcheck's getregset for MIPS.
Previous change r13145 incorrectly disables getregset test for all architectures
rather than just for MIPS arch. Issue spotted by Bart Van Assche and reported on
the list.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13148
2012-12-03 00:31:42 +00:00
Petar Jovanovic
a167c7a54d Skip memcheck's getregset for MIPS.
Skip the getregset test for MIPS since we still does not have TRACEHOOK
support in MIPS kernel for it, and that is needed to support PTRACE_GETREGSET.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13145
2012-12-02 03:37:36 +00:00
Christian Borntraeger
73744bb25f GETREGSET was introduced with 2.6.33.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13115
2012-11-09 08:06:14 +00:00
Christian Borntraeger
4155f1b382 add s390 specific fix for getregset
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13112
2012-11-08 20:10:10 +00:00
Christian Borntraeger
b5bb5fa736 wire up testcase
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13111
2012-11-08 19:46:29 +00:00
Christian Borntraeger
6c0b993485 Add ptrace getreset testcase from Andreas Arnez
arnez AT  linux DOT vnet DOT ibm DOT com



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13110
2012-11-08 19:42:00 +00:00
Florian Krohm
9e5f501978 Some older kernels on s390 do not provide AT_PLATFORM.
Add a prerequisite condition to make sure it's there.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13023
2012-10-05 23:29:38 +00:00
Tom Hughes
f74befe896 Implement a fake /proc/self/auxv file for linux systems.
Patch from Mark Wielaard to fix BZ#253519.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13019
2012-10-04 20:27:38 +00:00
Julian Seward
084b7cb10b Fix #284384 (clang 3.1 -Wunused-value warnings in valgrind.h,
memcheck.h) by changing a bunch of VALGRIND_DO_CLIENT_REQUEST_EXPR
into VALGRIND_DO_CLIENT_REQUEST_STMT for cases where the return value
of the former would be unused.  (Bart Van Assche, bart.vanassche@gmail.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12226
2011-10-24 13:21:57 +00:00
Bart Van Assche
399aea2c1b memcheck/tests/linux/Makefile.am: Add four .vgtest files to the distribution tarball and remove the capget binary
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12155
2011-10-14 09:32:46 +00:00
Florian Krohm
ad7a355b4a Improve filtering of backtrace noise in the memcheck bucket
and update exp files accordingly. This works well for x86
and all testcases pass on my machine.
New file filter_memcheck to do the work. 
There is a bit of a ripple here as filter_memcheck requires
command line arguments to be passed in. So all users of 
filter_memcheck (direct or indirect) were updated as well.
filter_stderr was simplified as was filter_libc.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12091
2011-10-03 23:39:54 +00:00
Bart Van Assche
11ce1f16fa memcheck/tests/linux/timerfd-syscall: Avoid failure on heavily loaded systems
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11997
2011-08-20 11:08:48 +00:00
Florian Krohm
c9c6767b83 Fix prerequisite for memcheck/tests/linux/timerfd-syscall.
The testcase was executed despite uname -r being 2.6.9-42.EL
Extend tests/os_test.c to take an optional 2nd argument
which is a minimum version number. Use os_test in the
prerequisite expression.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11954
2011-07-31 03:22:45 +00:00
Tom Hughes
af8ec0a591 Define _GNU_SOURCE for access to CLONE_XXX flags with gibc 2.14 headers.
Based on patch from Dmitry Djachenko <dimhen@gmail.com>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11802
2011-06-07 22:53:21 +00:00
Bart Van Assche
9a36fe677e Get rid of the remaining "set but not used" warnings reported by gcc 4.6 by
swapping the roles of the VALGRIND_DO_CLIENT_REQUEST() and
VALGRIND_DO_CLIENT_REQUEST_EXPR() macros. Also, many __attribute__((unused))
declarations on variables have been eliminated. Closes #269778.

Note: so far this patch has been tested on x86/Linux, amd64/Linux and
ppc64/Linux but not yet on any other supported CPU/OS combination.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11755
2011-05-15 07:04:03 +00:00
Bart Van Assche
bd7dbb42d3 timerfd-syscall regression test: Allow even more scheduler variation.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11692
2011-04-12 10:28:31 +00:00
Bart Van Assche
8a3e9fdd7c git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11682 2011-04-03 17:42:19 +00:00
Bart Van Assche
44a6867773 timerfd-syscall regression test: Allow even more scheduler variation.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11676
2011-03-29 10:56:32 +00:00
Bart Van Assche
61e5d45e0c Replaced a Unicode character by an ASCII character in a source code comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11652
2011-03-17 11:00:11 +00:00
Bart Van Assche
9a8cdf03cb Moved two Linux-specific syscalls to the linux subdirectory.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11651
2011-03-17 10:57:49 +00:00
Bart Van Assche
1ecd0141bd Fixed a recently introduced compiler warning.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11649
2011-03-17 10:24:53 +00:00
Bart Van Assche
4a32a7d8be Yet another attempt to make the timerfd-syscall test reliable.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11647
2011-03-17 07:45:46 +00:00
Bart Van Assche
75e3bb63ce Avoid that small time variations make the timerfd-syscall regression test fail.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11641
2011-03-13 09:42:56 +00:00
Julian Seward
dae0b7a571 'make dist' fixes following s390x-linux merge. (Christian Borntraeger
<borntraeger@de.ibm.com>)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11616
2011-03-10 12:36:09 +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
Bart Van Assche
ad86d78a6c E-mail address update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11420
2010-10-10 18:07:31 +00:00
Bart Van Assche
75ac57dc3a Made timerfd-syscall test more robust by improving the time rounding algorithm.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11368
2010-09-19 17:21:31 +00:00
Bart Van Assche
3169936a1b Fixed a typo.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11367
2010-09-19 17:16:39 +00:00
Bart Van Assche
e7b5c2eb6e memcheck/tests/linux/timerfd-syscall: send output to stderr instead of stdout.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11366
2010-09-19 17:13:53 +00:00
Bart Van Assche
e8e16af0dc Made sure that the sigqueue regression test passes on 32-bit and on 64-bit systems.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10922
2009-10-30 11:37:35 +00:00
Bart Van Assche
0e5846e018 Fixed expected output.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10916
2009-10-28 10:13:20 +00:00
Bart Van Assche
8e84bb3784 Added a comment that explains the purpose of the sigqueue.c test program.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10915
2009-10-28 10:13:03 +00:00
Bart Van Assche
20f6ef5896 Added a modified version of the rt_sigqueue test program provided by Konstantin Serebryany.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10910
2009-10-27 14:20:23 +00:00
Nicholas Nethercote
86be4a7cf3 Update .exp files for r10783.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10784
2009-08-12 00:14:44 +00:00
Julian Seward
2fcd38d5f2 Update Memcheck expected outputs following r10746 (64-bit variants only).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10747
2009-08-07 17:47:42 +00:00
Bart Van Assche
0ebd83edda Un-break regression test run.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10648
2009-07-28 08:03:31 +00:00
Nicholas Nethercote
ff3b502612 Remove non-Linux code from this Linux-only test.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10646
2009-07-28 05:11:42 +00:00
Nicholas Nethercote
1165808df3 Make lsframe1, lsframe2 and stack_changes Linux-only since they all fault
natively on Mac.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10645
2009-07-28 05:10:33 +00:00
Nicholas Nethercote
b05a2a18d7 This commit merges the BUILD_TWEAKS branch onto the trunk. It has the
following improvements:

- Arch/OS/platform-specific files are now included/excluded via the
  preprocessor, rather than via the build system.  This is more consistent
  (we use the pre-processor for small arch/OS/platform-specific chunks
  within files) and makes the build system much simpler, as the sources for
  all programs are the same on all platforms.

- Vast amounts of cut+paste Makefile.am code has been factored out.  If a
  new platform is implemented, you need to add 11 extra Makefile.am lines.
  Previously it was over 100 lines.

- Vex has been autotoolised.  Dependency checking now works in Vex (no more
  incomplete builds).  Parallel builds now also work.  --with-vex no longer
  works;  it's little use and a pain to support.  VEX/Makefile is still in
  the Vex repository and gets overwritten at configure-time;  it should
  probably be renamed Makefile-gcc to avoid possible problems, such as
  accidentally committing a generated Makefile.  There's a bunch of hacky
  copying to deal with the fact that autotools don't handle same-named files
  in different directories.  Julian plans to rename the files to avoid this
  problem.

- Various small Makefile.am things have been made more standard automake
  style, eg. the use of pkginclude/pkglib prefixes instead of rolling our
  own.

- The existing five top-level Makefile.am include files have been
  consolidated into three.

- Most Makefile.am files now are structured more clearly, with comment
  headers separating sections, declarations relating to the same things next
  to each other, better spacing and layout, etc.

- Removed the unused exp-ptrcheck/tests/x86 directory.

- Renamed some XML files.

- Factored out some duplicated dSYM handling code.

- Split auxprogs/ into auxprogs/ and mpi/, which allowed the resulting
  Makefile.am files to be much more standard.

- Cleaned up m_coredump by merging a bunch of files that had been
  overzealously separated.

The net result is 630 fewer lines of Makefile.am code, or 897 if you exclude
the added Makefile.vex.am, or 997 once the hacky file copying for Vex is
removed.  And the build system is much simpler.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10364
2009-06-24 00:37:09 +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
Bart Van Assche
5c2c273c6f Compiles now on RHEL 5.3 systems. In the RHEL 5.3 headers __NR_timerfd_create is defined but neither __NR_timerfd_settime nor __NR_timerfd_gettime.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9710
2009-05-01 11:54:07 +00:00
Nicholas Nethercote
4481c22c52 Move with-space to linux/, because it's hard to replicate on Darwin.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9569
2009-04-17 06:52:10 +00:00
Nicholas Nethercote
f3f801ed48 Merge r9533..9536 (add tests/{asm.h,sys_mman.h,malloc.h} from the DARWIN
branch.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9537
2009-04-15 03:12:43 +00:00
Nicholas Nethercote
de920a14ce A few more test/build changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9228
2009-02-23 01:33:40 +00:00