38a74d2cc4670e3eb559adff51a376cd6ec98005 |
|
30-Aug-2014 |
philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
9848690cfe9c59a8a92d4be6e5b43c77786066ee |
|
20-Aug-2014 |
philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
Add option a new sim-hint no-nptl-pthread-stackcache. Activating this hint using --sim-hints=no-nptl-pthread-stackcache means the glibc nptl stack cache will be disabled. Disabling this stack/tls cache avoids helgrind false positive race conditions errors when using __thread variables. Note: disabling the stack cache is done by a kludge, dependent on internal knowledge of glibc code, and using libpthread debug info. So, this kludge might be broken with newer glibc version. This has been tested on various platforms and various glibc versions 2.11, 2.16 and 2.18 To check if the disabling works, you can do: valgrind --tool=helgrind --sim-hints=no-nptl-pthread-stackcache -d -v ./helgrind/tests/tls_threads |& grep kludge If you see the below 2 lines, then hopefully the stack cache has been disabled. --12624-- deactivate nptl pthread stackcache via kludge: found symbol stack_cache_actsize at addr 0x3AF178 --12624:1:sched pthread stack cache size disabling done via kludge git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14313 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
0f157ddb404bcde7815a1c5bf2d7e41c114f3d73 |
|
18-Oct-2013 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
Update copyright dates (20XY-2012 ==> 20XY-2013) git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13658 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
41ad7e73914ee13bd1467ce48a1532570218e327 |
|
04-Oct-2012 |
tom <tom@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
03f8d3fc25f5a45c5826259d1b33b7f310117279 |
|
05-Aug-2012 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
Update copyright dates to include 2012. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12843 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
ec062e8d96a361af9905b5447027819dfbfee01a |
|
23-Oct-2011 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
Update all copyright dates, from 20xy-2010 to 20xy-2011. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12206 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
2a31239309f89ea2d70c1bd29d2c1a7874e14812 |
|
26-Jun-2011 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
Add support for PIC executables (e.g. firefox on Ubuntu 11) by adding the "auxv" protocol packet to gdbsrv. (Philippe Waroquiers, philippe.waroquiers@skynet.be). Bug 214909 comment 108. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11836 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
9eecbbb9a9cbbd30b903c09a9e04d8efc20bda33 |
|
03-May-2010 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
Update copyright dates to 2010. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11121 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
9f207460d70d38c46c9e81996a3dcdf90961c6db |
|
10-Mar-2009 |
njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
Updated copyright years. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9344 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
9c606bd8634cd6b67bb41fa645b5c639668cfa2d |
|
18-Sep-2008 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
4d474d086188fd1f29fa97dbd84d8ea2e589a9b8 |
|
11-Feb-2008 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
Update copyright dates ("200X-2007" --> "200X-2008"). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7398 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
9ebd6e0c607fa30301b1325874eb8de871c21cc5 |
|
08-Jan-2007 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
Update copyright dates. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6488 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
e4b0bf07b0ee0a18eacc5aba91686ab5fc1d327b |
|
06-Jun-2006 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
Update copyright dates. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5954 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
a672ea31b733495acf8aabe18a702d53d771f80e |
|
29-Apr-2006 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
0ec07f32bbbb209d749b9974408e6f025ad40b31 |
|
12-Jan-2006 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
fdf91b45b672e5e45db7db6df62c448a37dae88b |
|
28-Sep-2005 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
Small cleanups, mostly of m_main: - Move VG_(fd_{soft,hard}_limit) into m_clientstate - m_main: clean up auxv handling. Get rid of scan_auxv(). - m_main: move scan_colsep() to somewhere more sensible. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4799 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|
45f4e7c91119c7d01a59f5e827c67841632c9314 |
|
27-Sep-2005 |
sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> |
This commit merges in changes from branches/ASPACEM (specifically, changes from r4341 through r4787 inclusive). That branch is now dead. Please do not commit anything else to it. For the most part the merge was not troublesome. The main areas of uncertainty are: - build system: I had to import by hand Makefile.core-AM_CPPFLAGS.am and include it in a couple of places. Building etc seems to still work, but I haven't tried building the documentation. - syscall wrappers: Following analysis by Greg & Nick, a whole lot of stuff was moved from -generic to -linux after the branch was created. I think that is satisfactorily glued back together now. - Regtests: although this appears to work, no .out files appear, which is strange, and makes it hard to diagnose regtest failures. In particular memcheck/tests/x86/scalar.stderr.exp remains in a conflicted state. - amd64 is broken (slightly), and ppc32 will be unbuildable. I'll attend to the former shortly. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4789 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/coregrind/pub_core_clientstate.h
|