-
Limit Subzero routine stack size to 512 KiB · ff010f9fNicolas Capens authored
Fuzzing tests generate shaders with large arrays or very high numbers of local variables, which can cause stack overflow. We need to limit the allowable stack memory usage of generated routines. Note this change does not yet gracefully deal with routines which exceed this limit. They will cause a null pointer dereference instead of a stack overflow. The default stack size limit of 1 MiB at the Subzero level is to ensure we catch cases of excessive stack sizes even in the case no explicit limit was set. At the Reactor level we reduce it to 512 KiB to prevent actual stack overflow for a 1 MiB stack, assuming some earlier calls might want to use the stack. Also, our legacy 'ASM' compiler for GLSL allocates 4096 'registers' of 4 components for 128-bit SIMD, which already requires 256 KiB. Bug: b/157555596 Change-Id: I474285eecc786496edffbaef29719ca0cdf03f7d Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/52329 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Reviewed-by:
Antonio Maiorano <amaiorano@google.com> Tested-by:
Nicolas Capens <nicolascapens@google.com> Commit-Queue: Nicolas Capens <nicolascapens@google.com>
ff010f9f
×