Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack corruption with -fstack-clash-protection + -O2 on ppc64le with clang 12 #49247

Closed
llvmbot opened this issue Apr 8, 2021 · 6 comments
Closed
Assignees
Labels
bugzilla Issues migrated from bugzilla

Comments

@llvmbot
Copy link
Member

llvmbot commented Apr 8, 2021

Bugzilla Link 49903
Resolution FIXED
Resolved on Jun 14, 2021 23:01
Version trunk
OS Linux
Blocks #48661
Attachments Test case
Reporter LLVM Bugzilla Contributor
CC @bzEq,@serge-sans-paille,@tstellar
Fixed by commit(s) c87c294 bf58600 a37dff2 04a6828

Extended Description

On clang 12 on ppc64le with -O2, -fstack-stack-protection sometimes causes some of my tests to fail. I don't really speak PPC assembly so I've pretty much hit the end of my ability to debug this further, sorry.

I'm attaching two test cases, one is the original (pre-processed), the other has been run through cvise to try to reduce it, though I'm not sure that it shows the same issue as the original (it seems to manifest as an infinite loop instead of a segfault like the original).

Compile with something like:

clang -O2 -fstack-clash-protection -o test test.c -lm

The corruption doesn't always occur, so you may have to run it a few times. For me, the counter in the function which calls the individual tests jumps from 76 to 140736792407376 (between the svml/mm256_cdfnorminv_pd and svml/mm512_cdfnorminv_ps tests), and eventually there is a segfault.

I haven't been able to reproduce the problem with earlier versions of clang. The code works on other architectures.

If there is anything else I can do to help please let me know. FWIW, I can provide access to the machine I'm encountering this on, though I only have clang-12 in an F32 docker container.

@llvmbot
Copy link
Member Author

llvmbot commented Apr 8, 2021

assigned to @bzEq

@bzEq
Copy link
Collaborator

bzEq commented Apr 9, 2021

Looks like probe breaks redzone's content. I will investigate more and send a patch to fix it.

@bzEq
Copy link
Collaborator

bzEq commented Apr 12, 2021

https://reviews.llvm.org/D100290 is posted to fix this issue.

@bzEq
Copy link
Collaborator

bzEq commented Jun 9, 2021

Fixed in bf58600

@bzEq
Copy link
Collaborator

bzEq commented Jun 9, 2021

Hi Tom, would you please cherry-pick

commit c87c294397ea4c3dae31f5a7fd6e38602338fd57
Author: Kai Luo <lkail@cn.ibm.com>
Date:   Wed Jun 9 02:22:48 2021 +0000

    [PowerPC][Dwarf] Assign MMA register's dwarf register number to negative value

commit bf58600badb1138a501ad81b07298207a7a64b2a
Author: Kai Luo <lkail@cn.ibm.com>
Date:   Wed Jun 9 06:24:14 2021 +0000

    [PowerPC] Make sure the first probe is full size or is the last probe when stack is realigned

@tstellar
Copy link
Collaborator

Merged: 04a6828

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

3 participants