Skip to content

Add input size validation to Module.execute #10701

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

Merged

Conversation

keyprocedure
Copy link
Contributor

Summary

Adds input size validation to Module.execute to prevent possible silent memory corruption when too many EValue inputs are passed.

Fixes #10510

Test plan

  • Added unit test TestExecuteWithTooManyInputs

  • Verified by successfully running all module_test.cpp tests, except TestPTD (did not have access to ModuleLinear.ptd)

  • To run locally:

    • Bypass is_fbcode guard in targets.bzl and redirect test file paths to use a locally exported ModuleAdd.pte file
    • Build and run tests via:
    buck2 build //extension/module/test:test
    buck2 run //extension/module/test:test
    

@keyprocedure keyprocedure requested a review from shoumikhin as a code owner May 5, 2025 23:56
Copy link

pytorch-bot bot commented May 5, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/10701

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 1 Unrelated Failure

As of commit bb83697 with merge base d069d65 (image):

NEW FAILURE - The following job has failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 5, 2025
@keyprocedure
Copy link
Contributor Author

@pytorchbot label "topic: not user facing"

@keyprocedure
Copy link
Contributor Author

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot bot added the release notes: none Do not include this in the release notes label May 15, 2025
@keyprocedure
Copy link
Contributor Author

Hi @shoumikhin, the CI failures are unrelated to this PR; they're due totest_llava_export and test_position_embeddings.py. Could you please merge when you get a chance?

@shoumikhin shoumikhin merged commit e365e15 into pytorch:main May 19, 2025
91 of 93 checks passed
hinriksnaer pushed a commit to hinriksnaer/executorch that referenced this pull request May 19, 2025
### Summary
Adds input size validation to `Module.execute` to prevent possible
silent memory corruption when too many EValue inputs are passed.

Fixes pytorch#10510 

### Test plan
- Added unit test `TestExecuteWithTooManyInputs`
- Verified by successfully running all `module_test.cpp` tests, except
`TestPTD` (did not have access to `ModuleLinear.ptd`)
- To run locally:  
- Bypass `is_fbcode` guard in `targets.bzl` and redirect test file paths
to use a locally exported `ModuleAdd.pte` file
  - Build and run tests via:
  
  ```
  buck2 build //extension/module/test:test
  buck2 run //extension/module/test:test

---------

Co-authored-by: Anthony Shoumikhin <anthony@shoumikh.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: none Do not include this in the release notes topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module.execute does not check input count
3 participants