https://bugs.kde.org/show_bug.cgi?id=402480

--- Comment #2 from Khem Raj <raj.k...@gmail.com> ---
(In reply to Mark Wielaard from comment #1)
> Comment on attachment 117070 [details]
> Patch to fix the issue
> 
> While I agree that trying to clobber the stack pointer doesn't make sense
> (and it only "works" because we never return from the asm), the changing of
> the stack pointer itself is deliberate and part of the test (bug #345887 was
> about checking the stack pointer was bogus and not crashing valgrind, even
> though the test program itself does crash).
> 
> Also without the bogus stack pointer the expected output doesn't match
> anymore (because now we get a full backtrace because we can follow the
> stack).
> 
> So how about just removing the clobber, but keeping stack pointer change
> itself:
> 
> diff --git a/none/tests/amd64-linux/bug345887.c
> b/none/tests/amd64-linux/bug345887.c
> index 0f9237d..269bd70 100644
> --- a/none/tests/amd64-linux/bug345887.c
> +++ b/none/tests/amd64-linux/bug345887.c
> @@ -20,13 +20,17 @@ static void inner(void)
>        "movq $0x10d, %%r14\n"
>        "movq $0x10e, %%r15\n"
>        // not %rbp as mdb is then not able to reconstruct stack trace
> +      // Do change %rsp (to test a bogus stack pointer),
> +      // but don't add %rsp to the clobber list since gcc ignores it
> +      // and since gcc >= 9.0 errors about it
> +      // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813
>        "movq $0x10f, %%rsp\n"
>        "movq $0x1234, (%%rax)\n"  // should cause SEGV here
>        "ud2"                      // should never get here
>        : // no output registers
>        : // no input registers
>        : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi",
> -        "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15",
> "%rsp");
> +        "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15");
>  }
>  
>  __attribute__((noinline))


OK that seems fine to me. It will work.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to