<div dir="auto"><div>Sounds like a missing make current somewhere.</div><div dir="auto"><br></div><div dir="auto">Dave.<br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Fri., 10 Aug. 2018, 03:28 Marek Olšák, <<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This will leak the renderbuffer, but that's not the biggest problem.<br>
<br>
In your bug report, you said that the renderbuffer was created by<br>
intel_new_renderbuffer, but this change is for st/mesa. Something is<br>
horribly wrong here. The intel driver should not ever end up in<br>
st/mesa, because st/mesa is a different driver. What is going on here?<br><br><br>
Marek<br>
<br>
On Thu, Aug 2, 2018 at 8:29 AM, Olivier Fourdan <<a href="mailto:ofourdan@redhat.com" target="_blank" rel="noreferrer">ofourdan@redhat.com</a>> wrote:<br>
> st_renderbuffer_delete() can segfault if we get a non-NULL context<br>
> pointer but if the st_context is NULL:<br>
><br>
> Thread 1 "Xwayland" received signal SIGSEGV, Segmentation fault.<br>
> in st_renderbuffer_delete () at state_tracker/st_cb_fbo.c:241<br>
> 241 pipe_surface_release(st->pipe, &strb->surface_srgb);<br>
> (gdb) bt<br>
> #0 st_renderbuffer_delete () at state_tracker/st_cb_fbo.c:241<br>
> #1 _mesa_reference_renderbuffer_ () at main/renderbuffer.c:212<br>
> #2 _mesa_reference_renderbuffer () at main/renderbuffer.h:72<br>
> #3 _mesa_free_framebuffer_data (0) at main/framebuffer.c:229<br>
> #4 _mesa_destroy_framebuffer () at main/framebuffer.c:207<br>
> #5 _mesa_reference_framebuffer_ () at main/framebuffer.c:265<br>
> #6 _mesa_reference_framebuffer () at main/framebuffer.h:63<br>
> #7 _mesa_free_context_data () at main/context.c:1326<br>
> #8 st_destroy_context () at state_tracker/st_context.c:653<br>
> #9 dri_destroy_context () at dri_context.c:239<br>
> #10 driDestroyContext () at dri_util.c:524<br>
> #11 __glXDRIcontextDestroy () at glxdriswrast.c:132<br>
> #12 __glXFreeContext () at glxext.c:190<br>
> #13 ContextGone () at glxext.c:82<br>
> #14 doFreeResource () at resource.c:880<br>
> #15 FreeResourceByType () at resource.c:941<br>
> #16 __glXDisp_DestroyContext () at glxcmds.c:437<br>
> #17 dispatch_DestroyContext () at vnd_dispatch_stubs.c:82<br>
> #18 Dispatch () at dispatch.c:478<br>
> #19 dix_main () at main.c:276<br>
> #20 __libc_start_main () from /lib64/libc.so.6<br>
> #21 _start () at glxcmds.c:125<br>
><br>
> (gdb) p st<br>
> $1 = (struct st_context *) 0x0<br>
><br>
> Check for a non-NULL st_context pointer as well to avoid the crash.<br>
><br>
> Bugzilla: <a href="https://bugzilla.redhat.com/1611140" rel="noreferrer noreferrer" target="_blank">https://bugzilla.redhat.com/1611140</a><br>
> Signed-off-by: Olivier Fourdan <<a href="mailto:ofourdan@redhat.com" target="_blank" rel="noreferrer">ofourdan@redhat.com</a>><br>
> ---<br>
> Note: This fixes several bug reported downstream, like:<br>
> <a href="https://bugzilla.redhat.com/1611140" rel="noreferrer noreferrer" target="_blank">https://bugzilla.redhat.com/1611140</a><br>
> <a href="https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1762971" rel="noreferrer noreferrer" target="_blank">https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1762971</a><br>
> <a href="https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/1754693" rel="noreferrer noreferrer" target="_blank">https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/1754693</a><br>
> etc.<br>
> I don't know what this client actually does, but whatever it is it should<br>
> not crash Xwayland because of Mesa...<br>
> I tested this fix against the given reproducer (run snap on Wayland/Xwayland)<br>
> and it works.<br>
><br>
> src/mesa/state_tracker/st_cb_fbo.c | 6 ++++--<br>
> 1 file changed, 4 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c<br>
> index 73414fdfa1..856d213b73 100644<br>
> --- a/src/mesa/state_tracker/st_cb_fbo.c<br>
> +++ b/src/mesa/state_tracker/st_cb_fbo.c<br>
> @@ -238,8 +238,10 @@ st_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb)<br>
> struct st_renderbuffer *strb = st_renderbuffer(rb);<br>
> if (ctx) {<br>
> struct st_context *st = st_context(ctx);<br>
> - pipe_surface_release(st->pipe, &strb->surface_srgb);<br>
> - pipe_surface_release(st->pipe, &strb->surface_linear);<br>
> + if (st) {<br>
> + pipe_surface_release(st->pipe, &strb->surface_srgb);<br>
> + pipe_surface_release(st->pipe, &strb->surface_linear);<br>
> + }<br>
> strb->surface = NULL;<br>
> }<br>
> pipe_resource_reference(&strb->texture, NULL);<br>
> --<br>
> 2.17.1<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank" rel="noreferrer">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank" rel="noreferrer">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div></div>