sui icon indicating copy to clipboard operation
sui copied to clipboard

move integration tests can exceed >2MB stack usage, possibly evading guard page

Open mystenmark opened this issue 3 years ago • 1 comments

Please see https://github.com/MystenLabs/sui/pull/5549 for work-around.

Here's a stack trace: https://gist.githubusercontent.com/mystenmark/8c994201e79047708229b6a6f17dcebb/raw/b3bc2a813cef2d77d1e16fdc7081236fb402387d/g - note that this stack is only a few hundred frames deep, yet it exceeded a 2MB limit.

There are several concerning things to investigate

  • This is happening for very small, simple source files that shouldn't require very deep recursion.
  • It does not appear that the guard page is reliably catching this error. The failing tests do not seem to fail reliably, and prior to https://github.com/MystenLabs/sui/pull/5490 (which should not impact the move tests at all) none of them failed at all.

The main question at this point: is undetected stack overflow happening routinely during move compilation.

mystenmark avatar Oct 26 '22 21:10 mystenmark

@mystenmark, @andll and myself chatted a little bit more about the issue of reliably detecting stack overflow. On Tier 1 platforms (including x86_64) it does seem like __rust_probestack is doing the right thing and reliably hitting the guard page, but what we're seeing here could be an issue on M1 Macs, because LLVM does not support stack probes on AArch64, and this has been the state of play for ~5 years AFAICT, so not something we should try to solve ourselves or wait to be solved.

However, these platforms still have guard pages, so we can make headway by being more on it about small structs and small frames.

amnn avatar Oct 27 '22 09:10 amnn