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

[ML-DSA] Measure stack frame size on CI #680

Closed
wants to merge 5 commits into from

Conversation

jschneider-bensch
Copy link
Collaborator

This PR contains a script for obtaining stack frame measurements in ML-DSA and checking they don't exceed a given limit.
It also introduces a new job on the ML-DSA CI for running the script and

From the script docs:
This script runs cargo stack-sizes to obtain stack frame sizes for
functions in the crate. It

  • temporarily installs the cargo stack-sizes tool,
  • temporarily reconfigure the crate to the requirements of cargo
    stack-sizes (installs a minimal Rust nightly toolchain and sets a
    bogus version in Cargo.toml),
  • runs the stack-sizes tool on a given example.

The script will then print all stack frame sizes it collects in
increasing order and will exit normally if the FRAME_SIZE_LIMIT is
not exceeded by any of them. If the limit is exceeded the script
will error and print the name of the offending function.

Before exiting, the script will restore the previous state of the
crate and uninstall the stack-sizes tool.

Usage:

    ./stack-sizes.sh <example>

where <example> is an example program as you would run it with cargo run --example <example>.

@jschneider-bensch jschneider-bensch changed the title Jonas/stack size limit [ML-DSA] Measure stack frame size on CI Nov 14, 2024
@jschneider-bensch jschneider-bensch linked an issue Nov 14, 2024 that may be closed by this pull request
@jschneider-bensch
Copy link
Collaborator Author

After some testing and discussion, the tool might not be as precise as we hoped. (Some discussion on this.)
Closing this in favor of a different approach for now.

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.

[ML-DSA] Measure stack size on CI
1 participant