Bug 124418 - user-allocated stack is inaccessible even after thread finishes
Summary: user-allocated stack is inaccessible even after thread finishes
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.1.1
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-28 14:25 UTC by Aleksander Salwa
Modified: 2006-03-28 15:08 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
test case (648 bytes, text/plain)
2006-03-28 14:26 UTC, Aleksander Salwa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aleksander Salwa 2006-03-28 14:25:50 UTC
User-allocated stack is inaccessible after thread finishes.
It is correct to reuse this memory (maybe allocated via malloc()) for any other
purpose. But memcheck reports errors.
Short test program is attached. memcheck complains about line with memset().

As Tom Hughes already noted on valgrind-developers list it is not easy to
handle, because Valgrind marks stack frames as (in)accessible whenever stack
pointer changes.
Maybe it is possible to remember original state of memory guessed to be client
stack ? On thread exit VG could set original state of this memory back. It is
hard for user-allocated stacks with unknown size. But not impossible - VG can
store original state gradually - each time stack expands.
Comment 1 Aleksander Salwa 2006-03-28 14:26:45 UTC
Created attachment 15333 [details]
test case
Comment 2 Aleksander Salwa 2006-03-28 15:04:20 UTC
Resetting state of whole malloc'ed block that contains this stack isn't a good solution. Proper solution should also handle stacks that are made of part of malloc'ed block or are statically allocated.
Comment 3 Julian Seward 2006-03-28 15:08:36 UTC
Realistically I think the prospects for fixing this are not good, since
we don't know how to make our stack-tracking heuristics sophisticated
enough.