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

[SR-14359] Concurrency/Task.cpp and Concurrency/Actor.cpp do not compile without -fno-stack-protector #56718

Closed
swift-ci opened this issue Mar 15, 2021 · 6 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. Darwin Windows Platform: Windows

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-14359
Radar rdar://problem/75451180
Original Reporter 3405691582 (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug, Darwin, LLVM, Windows
Assignee TNorthover (JIRA)
Priority Medium

md5: 31f447b47ec057bba9e9b1a8cd0abf75

Issue Description:

Attempting to compile these results in

musttail call must precede a ret with an optional bitcast                       
  musttail call swifttailcc void @_ZL18runOnAssumedThreadPN5swift9AsyncTaskENS_1
1ExecutorRefEN12_GLOBAL__N_114RunningJobInfoE(%"class.swift::AsyncTask"* %29, i6
4 %36, i8 %39, i64 %41, %"class.(anonymous namespace)::ProcessOverrideJob"* %43)
, !dbg !4405                                                                    
in function swift_task_switch 

for Actor.cpp and

musttail call must precede a ret with an optional bitcast                       
  musttail call swifttailcc void @_ZL12completeTaskPN5swift9AsyncTaskENS_11Execu
torRefEPNS_12AsyncContextE(%"class.swift::AsyncTask"* %7, i64 %13, %"class.swift
::AsyncContext"* swiftasync %10), !dbg !5834                                    
in function _ZL23completeTaskWithClosurePN5swift9AsyncTaskENS_11ExecutorRefEPNS_
12AsyncContextE 

for Task.cpp.

Taking the compilation line and repeating it adding -fno-stack-protector results in a clean compile.

@compnerd
Copy link
Collaborator

This is an LLVM issue with the CG for SSP not handling the swiftasync call properly (swifttailcc is not being handled properly). I've found the issue impacting:

  • arm64 (darwin, windows)

  • x86_64 (windows)

@typesanitizer
Copy link

@swift-ci create

@swift-ci
Copy link
Collaborator Author

Comment by Tim Northover (JIRA)

I saw hints of this in the arm64e VFP thunks when I made the `musttail` diagnostic more rigorous for this Swift work. But there I could just disable stack-protection for the thunks since we know precisely what they do and it's not risky.

With luck this is as simple as making sure the stack protection IR gets emitted just before the `musttail` call instead of between it and the return.

@swift-ci
Copy link
Collaborator Author

Comment by Tim Northover (JIRA)

Patch up for review: https://reviews.llvm.org/D98701.

And I'll get it cherry-picked to `apple/stable/20210107`.

@compnerd
Copy link
Collaborator

compnerd commented Apr 8, 2021

TNorthover (JIRA User) - would be nice to get that merged upstream and cherry-picked back before the branch cut. I see that Amara has already accepted the differential.

@compnerd
Copy link
Collaborator

I believe that this has been resolved.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. Darwin Windows Platform: Windows
Projects
None yet
Development

No branches or pull requests

3 participants