10985 Commits

Author SHA1 Message Date
Philippe Waroquiers
3159bc49c8 Improve description of an address that is on a stack but below sp.
An address below the sp will be described as being on a stack, but below sp.

The stack for such an address is found in the registered stacks.

Also, if there is a guard page at the end of the stack (lowest address)
an address in this page will be described as being in thread guard page.
A guard page is recognised as being a page not readable/writable/executable.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14399
2014-08-31 22:27:19 +00:00
Mark Wielaard
8d4524f6a1 Bug 338681 Enable clone backtrace hack for i386-linux in helgrind.
glibc doesn't provide CFI unwind information right after the clone call
(because it would be invalid in the child). Enable the same workaround
for i386-linux that is already used for amd64-linux (subtract 3 from ip).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14398
2014-08-30 20:37:40 +00:00
Julian Seward
ffdff34aef Fix (kludge) stack unwinding through clone on arm64-linux. This is
the same problem as shown in #338681, except for arm64-linux instead
of x86-linux.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14397
2014-08-30 19:24:05 +00:00
Julian Seward
24b6d8ea1f Helgrind needs to know the soname of ld.so, and on arm64-linux
it is different (ld-linux-aarch64.so.1) from all other targets.
(Why?)  This makes Helgrind at least somewhat usable on arm64-linux.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14396
2014-08-30 19:21:48 +00:00
Julian Seward
917e8e40f8 Initial triage pass for all remaining newly opened bugs.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14395
2014-08-30 10:09:30 +00:00
Bart Van Assche
ed8d0edf04 drd/tests/pth_create_chain: Reduce stack usage
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14394
2014-08-30 06:48:01 +00:00
Philippe Waroquiers
23ced45c48 document in NEWS the fact that stack registration start/end boundaries
are the lowest/highest addressable bytes


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14393
2014-08-29 23:24:20 +00:00
Philippe Waroquiers
51c6c85e22 The semantic of the stack bounds is not consistent or is not described.
At various places, there were either some assumption that the 'end'
boundary (highest address) was either not included, included,
or was the highest addressable word, or the highest addressable byte.
This e.g. was very visible when doing:
  ./vg-in-place -d -d ./helgrind/tests/tc01_simple_race|&grep regi
giving
  --24040:2:stacks     register 0xBEDB4000-0xBEDB4FFF as stack 0
  --24040:2:stacks     register 0x402C000-0x4A2C000 as stack 1
showing that the main stack end was (on x86) not the highest word
but the highest byte, while for the thread 1, the registered end
was a byte not part of the stack.

The attached patch ensures that stack bounds semantic are documented and
consistent. Also, some of the stack handling code is factorised.

The convention that the patch ensures and documents is:
start is the lowest addressable byte, end is the highest addressable byte.
(the words 'min' and 'max' have been kept when already used, as this wording is 
consistent with the new semantic of start/end).

In various debug log, used brackets [ and ] to make clear that
both bounds are included.

The code to guess and register the client stack was duplicated
in all the platform specific syswrap-<plat>-<os>.c files.
Code has been factorised in syswrap-generic.c

The patch has been regression tested on
   x86, amd64, ppc32/64, s390x.
It has been compiled and one test run on arm64.
Not compiled/not tested on darwin, android, mips32/64, arm


More in details, the patch does the following:

coregrind/pub_core_aspacemgr.h
include/valgrind.h
include/pub_tool_machine.h
coregrind/pub_core_scheduler.h
coregrind/pub_core_stacks.h
  - document start/end semantic in various functions
 also in pub_tool_machine.h:
  - replaces unclear 'bottommost address' by 'lowest address'
    (unclear as stack bottom is or at least can be interpreted as
     the 'functional' bottom of the stack, which is the highest
      address for 'stack growing downwards').
coregrind/pub_core_initimg.h
  replace unclear clstack_top by clstack_end
coregrind/m_main.c
  updated to clstack_end

coregrind/pub_core_threadstate.h
  renamed client_stack_highest_word to client_stack_highest_byte
coregrind/m_scheduler/scheduler.c
  computes client_stack_highest_byte as the highest addressable byte
  Update comments in call to VG_(show_sched_status)
coregrind/m_machine.c
coregrind/m_stacktrace.c
  updated to client_stack_highest_byte, and switched 
    stack_lowest/highest_word to stack_lowest/highest_byte accordingly

coregrind/m_stacks.c
  clarify semantic of start/end,
  added a comment to indicate why we invert start/end in register call
  (note that the code find_stack_by_addr was already assuming that
  end was included as the checks were doing e.g.
    sp >= i->start && sp <= i->end

coregrind/pub_core_clientstate.h
coregrind/m_clientstate.c
  renames Addr  VG_(clstk_base) to Addr  VG_(clstk_start_base)
    (start to indicate it is the lowest address, base suffix kept
     to indicate it is the initial lowest address).

coregrind/m_initimg/initimg-darwin.c
   updated to  VG_(clstk_start_base)
   replace unclear iicii.clstack_top by iicii.clstack_end
   updated clstack_max_size computation according to both bounds included.

coregrind/m_initimg/initimg-linux.c
   updated to  VG_(clstk_start_base)
   updated VG_(clstk_end) computation according to both bounds included.
   replace unclear iicii.clstack_top by iicii.clstack_end

coregrind/pub_core_aspacemgr.h
  extern Addr VG_(am_startup) : clarify semantic of the returned value
coregrind/m_aspacemgr/aspacemgr-linux.c
   removed a copy of a comment that was already in pub_core_aspacemgr.h
     (avoid double maintenance)
   renamed unclear suggested_clstack_top to suggested_clstack_end
    (note that here, it looks like suggested_clstack_top was already
     the last addressable byte)

* factorisation of the stack guessing and registration causes
  mechanical changes in the following files:
      coregrind/m_syswrap/syswrap-ppc64-linux.c
      coregrind/m_syswrap/syswrap-x86-darwin.c
      coregrind/m_syswrap/syswrap-amd64-linux.c
      coregrind/m_syswrap/syswrap-arm-linux.c
      coregrind/m_syswrap/syswrap-generic.c
      coregrind/m_syswrap/syswrap-mips64-linux.c
      coregrind/m_syswrap/syswrap-ppc32-linux.c
      coregrind/m_syswrap/syswrap-amd64-darwin.c
      coregrind/m_syswrap/syswrap-mips32-linux.c
      coregrind/m_syswrap/priv_syswrap-generic.h
      coregrind/m_syswrap/syswrap-x86-linux.c
      coregrind/m_syswrap/syswrap-s390x-linux.c
      coregrind/m_syswrap/syswrap-darwin.c
      coregrind/m_syswrap/syswrap-arm64-linux.c
 Some files to look at more in details:
  syswrap-darwin.c : the handling of sysctl(kern.usrstack) looked
    buggy to me, and has probably be made correct by the fact that
     VG_(clstk_end) is now the last addressable byte. However,unsure
    about this, as I could not find any documentation about 
    sysctl(kern.usrstack). I only find several occurences on the web,
    showing that the result of this is page aligned, which I guess
    means it must be 1+ the last addressable byte.
  syswrap-x86-darwin.c and syswrap-amd64-darwin.c
   I suspect the code that was computing client_stack_highest_word
   was wrong, and the patch makes it correct.
  syswrap-mips64-linux.c
    not sure what to do for this code. This is the only code
    that was guessing the stack differently from others.
    Kept (almost) untouched. To be discussed with mips maintainers.

coregrind/pub_core_libcassert.h
coregrind/m_libcassert.c
  * void VG_(show_sched_status):
     renamed Bool valgrind_stack_usage to Bool stack_usage
     if stack_usage, shows both the valgrind stack usage and
     the client stack boundaries
coregrind/m_scheduler/scheduler.c
coregrind/m_gdbserver/server.c
coregrind/m_gdbserver/remote-utils.c
   Updated comments in callers to VG_(show_sched_status)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14392
2014-08-29 22:53:19 +00:00
Philippe Waroquiers
6375fdd9cc make prereq fail with 1 if host command not installed
as prereq must return 0 or 1. Any other return value aborts the regtests.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14391
2014-08-29 22:49:21 +00:00
Philippe Waroquiers
ac73d50e9c Add missing file in EXTRA_DIST
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14390
2014-08-29 22:48:27 +00:00
Julian Seward
fd1166d11d arm64: record the use of x8 as of vex r2938.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14389
2014-08-29 22:02:56 +00:00
Mark Wielaard
e5ce1c9b68 With gcc 4.9.1 exp-sgcheck/tests/globalerr sees array "a", not unknown.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14388
2014-08-29 21:18:17 +00:00
Julian Seward
db85fec898 Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14387
2014-08-29 19:34:45 +00:00
Julian Seward
7cdd4e056e run_thread_for_a_while: Make the computation of done_this_time less
bogus, and in particular ensure that it can't be zero if in fact the
thread did do some useful work.  Fix up a couple of associated
assertions.  Fixes #336435.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14386
2014-08-29 19:12:38 +00:00
Mark Wielaard
a909919fee none/tests/res_search.vgtest: Add prereq that domain can be resolved.
Some autobuilders/testers don't allow network access.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14385
2014-08-29 18:35:54 +00:00
Mark Wielaard
455f32995d Use getdents64 syscall on linux.
getdents has been deprecated since linux 2.4 and newer arches (arm64)
might no longer provide the getdents syscall. Use getdents64 for reading
the /proc/self/fd/ dir so --track-fds=yes works reliable on all arches.
Without this the none/tests/fdleak*vgtest might fail.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14384
2014-08-29 14:28:30 +00:00
Mark Wielaard
0a0862f83c include/vki/vki-scnums-arm64-linux.h use correct __NR_lseek define.
This caused memcheck/tests/linux/proc-auxv.vgtest to fail because
our internal VG(lseek) would return ENOSYS.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14383
2014-08-29 11:44:20 +00:00
Mark Wielaard
499dd431ed Hook up allexec tests for arm64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14382
2014-08-29 08:41:45 +00:00
Mark Wielaard
f65b136853 gdbserver_tests filter out and don't expect empty lines.
Some filters might have left some empty lines in the output.  Filter them
out explicitly and don't expect any empty lines in any of the .exp files.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14381
2014-08-28 22:51:38 +00:00
Mark Wielaard
736294a7ac gdbserver_tests/filter_gdb filter out 'entry value'.
Some versions of gdb might try to print the entry value of an
argument if they know it with @entry=... Filter that out too.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14380
2014-08-28 21:42:45 +00:00
Philippe Waroquiers
92644a67a7 Fix a bunch of defined(VGA_ppc64)
(a.o. this was making leak_cpp_interior test failing,
as the ppc64 specific code in mc_leakcheck.c was not compiled in)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14379
2014-08-28 21:02:11 +00:00
Philippe Waroquiers
3b9ae3e047 Check that vgdb ptrace actions do not cause a EINTR or whatever
to go out of the select syscall


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14378
2014-08-28 20:19:41 +00:00
Philippe Waroquiers
dc483f91bf Typo fix + small improvement in comment
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14377
2014-08-28 19:57:32 +00:00
Mark Wielaard
ce0631c3ee Workaround bug 338633. gdbserver_tests/nlcontrolc.vgtest hangs on arm64.
Disable the test on arm64 for now to keep make regtest from hanging.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14376
2014-08-28 18:47:54 +00:00
Mark Wielaard
c9fbea9079 Handle ENOSYS instread of EINVAL for some helgrind tests.
Some arches (s390x and ppc64) return ENOSYS instead of EINVAL for
undefined futex operations. Adjust the helgrind filter_stderr to
handle that case.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14375
2014-08-28 14:59:08 +00:00
Mark Wielaard
a3a0be70ab Bug 338615 suppress glibc 2.20 optimized strcmp implementation for ARMv7.
Add an add_hardwired_spec for strcmp in VG_(redir_initialise) for
ld-linux.so.3 and ld-linux-armhf.so.3 to use a simple strcmp
implementation in m_trampoline.S (compiled from the trivial .c code
to asm with gcc like the other implementations in that file).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14374
2014-08-28 14:59:04 +00:00
Mark Wielaard
dc640cf2df Add configure check for 32 bit build support on arm64-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14373
2014-08-27 18:29:34 +00:00
Mark Wielaard
bdcf926b1e none/tests/Makefile.am (DIST_SUBDIRS): Add arm64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14371
2014-08-27 13:39:53 +00:00
Mark Wielaard
e12b5e5ac2 Fix typo in syswrap ppoll param, equate ppoll and poll for memcheck testcase.
ppoll argument is called ufds like the poll argument.
Newer architectures (aarch64) implement poll by calling ppoll directly.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14370
2014-08-26 22:15:58 +00:00
Julian Seward
c88407b17f Add a missing entry to all_archs[], the lack of which was causing
the test system to run arm64 tests on non-arm64 platforms.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14369
2014-08-26 21:06:31 +00:00
Julian Seward
30303db978 Back out a line inadvertantly committed in r14363.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14368
2014-08-26 19:58:26 +00:00
Julian Seward
02bfa4d655 Add test config files and expected outputs.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14365
2014-08-26 19:53:08 +00:00
Mark Wielaard
60fe2d5a5b Add socket.S to memcheck/tests/filter_stderr.
sendmsg.vgtest shows socket.S on some arches instead of syscall-template.S
to indicate "in ...libc...".

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14364
2014-08-26 19:41:51 +00:00
Julian Seward
2f2212df9c Build system stuff, to hook the tests in none/tests/arm64
to the build system.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14363
2014-08-26 19:28:09 +00:00
Julian Seward
3af5a88ca6 Handle the new IROps introduced to support ARM64 SIMD.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14362
2014-08-26 18:35:13 +00:00
Julian Seward
319765a595 Iop_Rol64x2 was handled as if it were a 32x4 case. This moves
it to the right place.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14361
2014-08-26 17:30:07 +00:00
Florian Krohm
f2c8fccbfd Cleanup: remove unused macros.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14360
2014-08-25 22:04:01 +00:00
Julian Seward
65f273d292 arm64: enable test cases for:
{zip,uzp,trn}{1,2} (vector)
  urecpe, ursqrte (vector)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14353
2014-08-24 20:37:39 +00:00
Julian Seward
6a859c491c Track renaming of {reciprocal, reciprocal sqrt}{estimate, step}
primops in vex r2932.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14350
2014-08-24 14:02:22 +00:00
Philippe Waroquiers
59990c4f9d 338499 --sim-hints parsing broken due to wrong order in tokens (after introduction of no-nptl-pthread-stackcache)
Fix the token order in m_main.c

Somewhat retested by running the regression tests
(testing no-nptl-pthread-stackcache) and testing in an outer/inner setup
(testing enable-outer,no-inner-prefix).
It seems there is no regtest for the 2 other flags (lax-ioctls,fuse-compatible)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14349
2014-08-24 11:24:10 +00:00
Mark Wielaard
4ecf04acef filter_shell_output: filter out "Exec format error" added by newer bash.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14343
2014-08-23 20:49:17 +00:00
Florian Krohm
91842f01b9 Remove unused functions and prototypes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14342
2014-08-23 19:42:52 +00:00
Florian Krohm
02fa6bce92 Remove unused function CLG_(sprint_cost).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14341
2014-08-23 19:13:48 +00:00
Julian Seward
7566a219b0 Memcheck: add a new flag, --show-mismatched-frees=no|yes [yes], to
optionally disable allocator/deallocator mismatch checking.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14336
2014-08-22 19:26:23 +00:00
Julian Seward
73df2fc86a mc_LOADV_128_or_256_slow: change a constant from V_BITS8_DEFINED
to V_BITS64_DEFINED so as to be consistent with the rest of the
types in this function.  Since both values are zero it gives no
functional change.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14335
2014-08-22 19:07:12 +00:00
Josef Weidendorfer
3675ccd650 Cleanup. Cost array was never called anyway.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14334
2014-08-22 17:36:05 +00:00
Florian Krohm
147520eb27 Remove benign macro redefinition.
Give current_jccs internal linkage.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14332
2014-08-22 16:55:07 +00:00
Mark Wielaard
b89d33b962 Tweak gdbserver_tests/hgtls.stdoutB.exp filter_gdb a little for older GDB.
Older GDB (7.2 on i386) don't print out which variable+offset an argument
pointer in a breakpoint function points to. The hgtls test already tests
whether the p pointer/test points to the expected tests array element.
So don't expect gdb to print it also and filter it out with filter_gdb.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14331
2014-08-22 10:14:28 +00:00
Josef Weidendorfer
6962af41ae Align header comment with other files
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14330
2014-08-22 08:38:40 +00:00
Philippe Waroquiers
5f58068856 Follow up to r14313: disable stack cache earlier
glibc is recycling memory for detached threads before a thread
termination => disable the stack cache earlier (i.e. once
a 'non main thread' is seen)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14329
2014-08-21 20:01:50 +00:00