[Mesa-dev] [PATCH] intel/fs: Fix memory corruption when compiling a CS

Kenneth Graunke kenneth at whitecape.org
Fri Feb 1 18:00:32 UTC 2019


On Saturday, January 26, 2019 7:47:42 AM PST Oscar Blumberg wrote:
> Missing check for shader stage in the fs_visitor would corrupt the
> cs_prog_data.push information and trigger crashes / corruption later
> when uploading the CS state.
> ---
>  src/intel/compiler/brw_fs_nir.cpp | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
> index bdc883e53..21b03a089 100644
> --- a/src/intel/compiler/brw_fs_nir.cpp
> +++ b/src/intel/compiler/brw_fs_nir.cpp
> @@ -3779,8 +3779,9 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
>                                   BRW_REGISTER_TYPE_UD);
>        const fs_reg data = retype(get_nir_src(instr->src[2]),
>                                   BRW_REGISTER_TYPE_UD);
> -
> -      brw_wm_prog_data(prog_data)->has_side_effects = true;
> +      
> +      if (stage == MESA_SHADER_FRAGMENT)
> +         brw_wm_prog_data(prog_data)->has_side_effects = true;
>  
>        emit_untyped_write(bld, image, addr, data, 1,
>                           instr->num_components);
> 

Good catch, thanks so much for the fix!  I'm running it through a quick
set of testing (though it looks obviously correct), assuming that all
comes back green I'll push this shortly.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190201/fa1087c2/attachment.sig>


More information about the mesa-dev mailing list