<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 10, 2016 at 1:47 PM, Matt Turner <span dir="ltr"><<a href="mailto:mattst88@gmail.com" target="_blank">mattst88@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, Feb 10, 2016 at 1:27 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> This fixes two issues. First, we had a use-after-free in the case where<br>
> the instruction got deleted and we tried to return mov->dest.write_mask.<br>
> Second, in the case where we are doing a self-mov of a register, we delete<br>
> those channels that are moved to themselves from the write-mask. This<br>
> means that those channels aren't reported as being handled even though they<br>
> are. We now stash off the write-mask before remove unneeded channels so<br>
> that they still get reported as handled.<br>
><br>
> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=94073" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=94073</a><br>
> ---<br>
> src/compiler/nir/nir_lower_vec_to_movs.c | 4 +++-<br>
> 1 file changed, 3 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/src/compiler/nir/nir_lower_vec_to_movs.c b/src/compiler/nir/nir_lower_vec_to_movs.c<br>
> index 06d6279..f51cede 100644<br>
> --- a/src/compiler/nir/nir_lower_vec_to_movs.c<br>
> +++ b/src/compiler/nir/nir_lower_vec_to_movs.c<br>
> @@ -83,6 +83,8 @@ insert_mov(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader)<br>
> }<br>
> }<br>
><br>
> + unsigned channels_handled = mov->dest.write_mask;<br>
> +<br>
> /* In some situations (if the vecN is involved in a phi-web), we can end<br>
> * up with a mov from a register to itself. Some of those channels may end<br>
> * up doing nothing and there's no reason to have them as part of the mov.<br>
> @@ -103,7 +105,7 @@ insert_mov(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader)<br>
> ralloc_free(mov);<br>
> }<br>
><br>
> - return mov->dest.write_mask;<br>
> + return channels_handled;<br>
> }<br>
<br>
</div></div>Yup. I totally missed the very obvious use-after-free in 8dcbca5.<br>
<br>
Reviewed-by: Matt Turner <<a href="mailto:mattst88@gmail.com">mattst88@gmail.com</a>><br></blockquote><div><br></div><div>Thanks!<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I'd tag this for stable as well since it fixes a WebGL conformance test.<br></blockquote><div><br></div><div>Yup. Will do. <br></div></div><br></div></div>