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

All recursion in the WGSL front end should be audited #6964

Closed
jimblandy opened this issue Jan 21, 2025 · 2 comments
Closed

All recursion in the WGSL front end should be audited #6964

jimblandy opened this issue Jan 21, 2025 · 2 comments
Labels
area: naga front-end lang: WGSL WebGPU Shading Language naga Shader Translator type: enhancement New feature or request

Comments

@jimblandy
Copy link
Member

The fuzzers are having a good time making the WGSL front end exhaust it's stack. We've had #5757 for expressions, and #4352 for statements. I think there is also recursion in type parsing. Waiting for the fuzzers to find everything is dorky; we should just think about the grammar, identify everywhere that recursion is used, and slap limits on all of them.

It's true that the WGSL spec doesn't impose any limits on this nesting, as Erich pointed out in his comment: #6885 (review) But the fact is that Naga exhausts its stack with unbounded nesting; our architecture doesn't parse these things successfully anyway. So we need to treat this as an uncategorized error:

An uncategorized error may occur even when all WGSL and WebGPU requirements have been satisfied. Possible causes include:

  • The shaders are too complex, exceeding the capabilities of the implementation, but in a way not easily captured by prescribed limits. Simplifying the shaders may work around the issue.

  • A defect in the WebGPU implementation.

@jimblandy
Copy link
Member Author

Hmm, @jamienicol's changes in #6885 might have dealt with all these cases.

@jimblandy
Copy link
Member Author

@jamienicol says he scoured the WGSL front end for all the recursion he could find, so I'm really not aware of anything left for this issue to cover - closing.

@github-project-automation github-project-automation bot moved this from Todo to Done in WebGPU for Firefox Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga front-end lang: WGSL WebGPU Shading Language naga Shader Translator type: enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

2 participants