Skip to content

no support for full stack safety provided by a guard page #10781

Closed
@thestinger

Description

@thestinger
Contributor

Rust should have a way to output a call to a chkstk-like function for frames larger than the guard size. LLVM has support for chkstk so this could be leveraged on other platforms too. The Linux pthread API provides pthread_getattr_np so the available stack space can be checked.

Here's the documentation for the GCC support:

http://gcc.gnu.org/onlinedocs/gccint/Stack-Checking.html

Activity

alexcrichton

alexcrichton commented on Dec 9, 2013

@alexcrichton
Member

This bug may not be so much as we don't have support for this but rather we're just not doing this. We're not using segmented stacks the way that they're supposed to be used in the compiler, and our strategy on all platforms should align with that of chkstk. I've looked into LLVM and it is indeed implemented, but it's all special-cased on codegen for the windows platform.

To pursue this, we will need to modify to accept an option to codegen chkstk on all platforms, hopefully take a symbol as well (so we can implement our own), and then implement the necessary prologue for all our platforms and architectures (I have a feeling that LLVM only implements it for x86 windows right now).

It would probably be worth chatting with the upstream LLVM guys before pursuing this just to make sure that we're aligned correctly in how to do this.

thestinger

thestinger commented on Aug 15, 2014

@thestinger
ContributorAuthor

Closing in favour of #16012.

added a commit that references this issue on May 20, 2023

Auto merge of rust-lang#10781 - flip1995:stepping-down, r=xFrednet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alexcrichton@thestinger

        Issue actions

          no support for full stack safety provided by a guard page · Issue #10781 · rust-lang/rust