Skip to content

Implement stack probe for x86#9535

Closed
kubo39 wants to merge 1 commit intocrystal-lang:masterfrom
kubo39:probestack
Closed

Implement stack probe for x86#9535
kubo39 wants to merge 1 commit intocrystal-lang:masterfrom
kubo39:probestack

Conversation

@kubo39
Copy link
Contributor

@kubo39 kubo39 commented Jun 23, 2020

TODO:

  • add some code that is broken without this patch.
  • add test case.
  • check version LLVM supports stack probe.

@jhass
Copy link
Member

jhass commented Jun 23, 2020

Could you provide some reference/motivation for this? :)

@kubo39
Copy link
Contributor Author

kubo39 commented Jun 23, 2020

@jhass
Sure :)
The problem is that if a stack frame which is larger than the OS-thread guard page, a function could skip over the guard page and may corrupt the heap or another thread. This patch solves by using LLVM's stackprobe.

According to LLVM LangRef Manual

This attribute indicates that the function will trigger a guard region in the end of the stack. It ensures that accesses to the stack must be no further apart than the size of the guard region to a previous access of the stack. It takes one required string value, the name of the stack probing function that will be called.

  • other references/implementations:

@jhass
Copy link
Member

jhass commented Jun 23, 2020

Huh, so another thing you would expect LLVM to just handle for you.

@asterite
Copy link
Member

Could you provide some code that is broken without this patch? Otherwise, I feel like we'll be merging something without really knowing or understand what this does.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants