29 Commits

Author SHA1 Message Date
Mark Wielaard
c76123d32c none/tests/linux/membarrier.vgtest: Only execute if membarrier exists. 2018-06-16 23:25:48 +02:00
Mark Wielaard
7f4e06881c none/tests/linux/Makefile.am: Fix membarrier.st[d]err.exp typo. 2018-06-16 23:02:39 +02:00
Bart Van Assche
e9a82f3d75 Add a test program for the membarrier() system call
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-06-15 08:25:32 -07:00
Ivo Raisr
f8a8e3de4d Fix expected output of brk tests after r16407.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16410
2017-05-23 21:22:31 +00:00
Philippe Waroquiers
984cc6d07c Add missing EXTRA_DIST clonev.stdout.exp
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16187
2016-12-11 22:18:07 +00:00
Philippe Waroquiers
489cfd5156 Fix 342040 Valgrind mishandles clone with CLONE_VFORK | CLONE_VM that clones to a different stack
Fix 373192 Calling posix_spawn in glibc 2.24 completely broken

Functionally, this patch just does the following 2 changes to the
fork clone handling:
* It does not mask anymore CLONE_VFORK :
  The only effect of this flag is to suspend the parent, waiting for
  the child to either exit or execve.
  If some applications depends on this synchronisation, better keep it,
  as it will not harm to suspend the parent valgrind waiting for the
  child valgrind to exit or execve.
* In case the guest calls the clone syscall providing a non zero client stack,
  set the child guest SP after the syscall, before executing guest instructions.
  Not setting the guest stack ptr was the source of the problem reported
  in the bugs.

This also adds a test case  none/tests/linux/clonev.
Before this patch, test gives a SEGV, which is fixed by the patch.

The patch is however a lot bigger : this fix was touching some (mostly
identical/duplicated) code in all the linux platforms.
So, the clone/fork code has been factorised as much as possible.
This removes about 1700 lines of code.

This has been tested on:
* amd64
* x86
* ppc64 be and le
* ppc32
* arm64

This has been compiled on but *not really tested* on:
* mips64 (not too clear how to properly build and run valgrind on gcc22)

It has *not* been compiled and *not* tested on:
* arm
* mips32
* tilegx
* darwin   (normally, no impact)
* solaris  (normally, no impact)

The changes are relatively mechanical, so it is not impossible that
it will compile and work out of the box on these platforms.
Otherwise, questions welcome.

A few points of interest:
* Some platforms did have a typedef void vki_modify_ldt_t,
  and some platforms had no definition for this type at all.
  To make it easier to factorise, for such platforms, the following has
  been used:
     typedef char vki_modify_ldt_t;
    When the sizeof vki_modify_ldt_t is > 1, then the arg syscall is checked.
  This is somewhat a hack, but was simplifying the factorisation.

* for mips32/mips64 and tilegx, there is a strange unconditional assignment
  of 0 to a register (guest_r2 on mips, guest_r0 on tilegx).
  Unclear what this is, in particular because this is assigned whatever
  the result of the syscall (success or not).
  



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16186
2016-12-11 21:39:23 +00:00
Philippe Waroquiers
268ff84f7b Document brk segment limitation, reference manual in limit reached msg.
The msg telling brk cannot be extended confuses some users
so improve the documentation and have the msg referencing the doc.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15880
2016-05-22 20:48:09 +00:00
Florian Krohm
d0cf6ac4fa Suppress unwanted clang 3.7 warnings.
Fix undefined behaviour in perf/tinycc.c


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15616
2015-09-02 15:47:33 +00:00
Florian Krohm
c39a983920 For those testcases that crash one way or another
remove any core files after running the test.
Patch by Matthias Schwarzott <zzam@gentoo.org>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15520
2015-08-11 20:58:15 +00:00
Florian Krohm
249171e15c Fix another GCC 5.1 warning.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15512
2015-08-09 08:54:27 +00:00
Florian Krohm
31536d92a1 Remove an incorrect assertion. Need to consider SkShmC segments as well.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15269
2015-05-21 22:41:39 +00:00
Florian Krohm
463aa75635 In functions VG_(am_relocate_nooverlap_client) and VG_(am_extend_map_client)
need to allow SkShmC segments, too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15221
2015-05-12 21:52:08 +00:00
Florian Krohm
ab0a9ba34a Get prototype from system header.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15220
2015-05-12 21:44:48 +00:00
Florian Krohm
c000459632 Fix bug in do_mremap. Also need to allow SkShmC segments.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15219
2015-05-12 21:19:25 +00:00
Florian Krohm
97b35b97f6 Issue an error message if then brk segment overflows.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15155
2015-04-29 12:59:16 +00:00
Florian Krohm
9d3d254a8b Fix an assertion in the address space manager. BZ #345887.
The VG_(extend_stack) call needs to be properly guarded because the
passed-in address is not necessarily part of an extensible stack
segment. And an extensible stack segment is the only thing that
function should have to deal with.
Previously, the function VG_(am_addr_is_in_extensible_client_stack)
was introduced to guard VG_(extend_stack) but it was not added in all
places it should have been.

Also, extending the client stack during signal delivery (in sigframe-common.c)
was simply calling VG_(extend_stack) hoping it would do the right thing.
But that was not always the case. The new testcase 
none/tests/linux/pthread-stack.c exercises this (3.10.1 errors out on it).

Renamed ML_(sf_extend_stack) to ML_(sf_maybe_extend_stack) and add
proper guard logic for VG_(extend_stack).

Testcases none/tests/{amd64|x86}-linux/bug345887.c by Ivo Raisr.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15138
2015-04-23 15:20:00 +00:00
Florian Krohm
b77e045e1f Rewritten to use a single line instead of line splicing
to avoid line number differences in the reported error.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14988
2015-03-07 12:49:32 +00:00
Florian Krohm
1f8ced27c3 Produce a user message in case of stack overflow.
Change VG_(extend_stack) and VG_(am_extend_into_adjacent_reservation_client)
accordingly. 
Remove some redundant checking.
Add testcase.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14974
2015-03-03 14:56:17 +00:00
Philippe Waroquiers
e52f0e1de0 * none/tests/linux/mremap3.vgtest : new test
mremap3.c based on testcase provided by Jan Engelhardt
* coregrind/m_syswrap/syswrap-generic.c
  - The two 'no-thrash checks' that were introduced to fix bug #129866
    were (probably) broken when adress space manager was reworked.
    The new VG_(am_get_advisory_client_simple) returns NULL for a free
    segment, but the check was based on checking not NULL and then
    that the state is free.
    => replaces these two local checks by a call to the new
    am Bool VG_(am_covered_by_single_free_segment) function.

* coregrind/pub_core_aspacemgr.h
  coregrind/m_aspacemgr/aspacemgr-linux.c
  - new function Bool VG_(am_covered_by_single_free_segment)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12314
2011-12-22 13:25:58 +00:00
Bart Van Assche
8a3e9fdd7c git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11682 2011-04-03 17:42:19 +00:00
Nicholas Nethercote
bd7381bd00 mremap2 is a totally unreliable test; it's the only test that fails on a
number of Linux machines.  This change makes it more reliable, at the cost
of being less specific.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10575
2009-07-24 05:38:23 +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
86ccf0ca56 Add some missing 'make dist' files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9907
2009-05-19 00:05:29 +00:00
Nicholas Nethercote
af09b2fa03 Fix test breakage caused by r9694.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9697
2009-04-30 05:09:09 +00:00
Nicholas Nethercote
13e765c304 Merged r9546..r9548 (moved blockfault, and filtering fixes) from the DARWIN
branch.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9549
2009-04-15 07:11:36 +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
Nicholas Nethercote
c8d150dbaa Various build system clean-ups and simplifications:
- Created Makefile.tool-tests.am, put standard AM_CFLAGS et al for tests in
  it.
- A number of tests are shared between Helgrind and DRD.  They used to be
  built in both directories.  Now they are only built in helgrind/tests/,
  and the DRD .vgtest files just point to the executable in helgrind/tests/.
  Most of these (about 30) had the source files in helgrind/tests/;  I moved
  the three that were in drd/tests/ into helgrind/tests/ for consistency.
- Fixed rwlock_test, which was failing to run due to a wrong name in the
  .vgtest file.
- Removed remnants of unused 'hello' test for Memcheck.
- Avoided redundant flag specification in various places, esp.
  memcheck/tests/Makefile.am.
- Removed unnecessary _AIX guards in some Linux-only tests.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9202
2009-02-19 09:52:05 +00:00
Nicholas Nethercote
6031d626c1 Moved 3 Linux-specific tests into linux/ directories.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9144
2009-02-13 06:23:46 +00:00