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

Lower marshal.c recursion depth limit for WASI #98925

Closed
brettcannon opened this issue Oct 31, 2022 · 1 comment
Closed

Lower marshal.c recursion depth limit for WASI #98925

brettcannon opened this issue Oct 31, 2022 · 1 comment
Assignees
Labels
3.11 only security fixes 3.12 bugs and security fixes OS-wasi type-bug An unexpected behavior, bug, or error

Comments

@brettcannon
Copy link
Member

brettcannon commented Oct 31, 2022

Based on bytecodealliance/wasmtime#5152 it looks like the stack depth specified in:

#define MAX_MARSHAL_STACK_DEPTH 2000

and:

MAX_MARSHAL_STACK_DEPTH = 2000

are too high for wasmtime 2.0 (in development). We should drop it to either 1000 to match Windows or something like 1500 if we want a higher, but still acceptable, limit.

@brettcannon
Copy link
Member Author

brettcannon added a commit to brettcannon/cpython that referenced this issue Nov 1, 2022
For (in-development) wasmtime 2.0, the stack depth cost is 6% higher. As the default is 2000 and Windows is 1000, split the difference and choose 1500 for WASI.
miss-islington pushed a commit that referenced this issue Nov 1, 2022
For wasmtime 2.0, the stack depth cost is 6% higher. This causes the default max `marshal` recursion depth to blow the stack.

As the default marshal depth is 2000 and Windows is set to 1000, split the difference and choose 1500 for WASI to be safe.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 1, 2022
For wasmtime 2.0, the stack depth cost is 6% higher. This causes the default max `marshal` recursion depth to blow the stack.

As the default marshal depth is 2000 and Windows is set to 1000, split the difference and choose 1500 for WASI to be safe.
(cherry picked from commit 9711265)

Co-authored-by: Brett Cannon <brett@python.org>
brettcannon added a commit that referenced this issue Nov 1, 2022
…H-98979)

* gh-98925: Lower marshal recursion depth for WASI (GH-98938)

For wasmtime 2.0, the stack depth cost is 6% higher. This causes the default max `marshal` recursion depth to blow the stack.

As the default marshal depth is 2000 and Windows is set to 1000, split the difference and choose 1500 for WASI to be safe.
(cherry picked from commit 9711265)

Co-authored-by: Brett Cannon <brett@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes OS-wasi type-bug An unexpected behavior, bug, or error
Projects
No open projects
Status: Done
Development

No branches or pull requests

1 participant