mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-07 04:38:00 +00:00
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
34 lines
867 B
C
34 lines
867 B
C
/* This test used to cause an assertion in the address space manager */
|
|
|
|
__attribute__((noinline))
|
|
static void inner(void)
|
|
{
|
|
/* Set other registers to apriori known values. */
|
|
__asm__ __volatile__(
|
|
"movl $0x101, %%eax\n"
|
|
"movl $0x102, %%ebx\n"
|
|
"movl $0x103, %%ecx\n"
|
|
"movl $0x104, %%edx\n"
|
|
"movl $0x105, %%esi\n"
|
|
"movl $0x106, %%edi\n"
|
|
// not %ebp as mdb is then not able to reconstruct stack trace
|
|
"movl $0x108, %%esp\n"
|
|
"movl $0x1234, (%%eax)\n" // should cause SEGV here
|
|
"ud2" // should never get here
|
|
: // no output registers
|
|
: // no input registers
|
|
: "memory", "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%esp");
|
|
}
|
|
|
|
__attribute__((noinline))
|
|
static void outer(void)
|
|
{
|
|
inner();
|
|
}
|
|
|
|
int main(int argc, const char *argv[])
|
|
{
|
|
outer();
|
|
return 0;
|
|
}
|