[weston,3/3] ivi-shell: clean up remaining ivisurface during de-init

Submitted by Harsha Manjula Mallikarjun (RBEI/ECF3) on Aug. 7, 2018, 1:35 p.m.

Details

Message ID 1533648904-31286-4-git-send-email-harsha.manjulamallikarjun@in.bosch.com
State New
Series "Fix invalid memory access during de-init"
Headers show

Commit Message

Harsha Manjula Mallikarjun (RBEI/ECF3) Aug. 7, 2018, 1:35 p.m.
Signed-off-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
---
 ivi-shell/ivi-shell.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
index 58f53bc..92e8f17 100644
--- a/ivi-shell/ivi-shell.c
+++ b/ivi-shell/ivi-shell.c
@@ -366,6 +366,8 @@  shell_destroy(struct wl_listener *listener, void *data)
 	wl_list_remove(&shell->wake_listener.link);
 
 	wl_list_for_each_safe(ivisurf, next, &shell->ivi_surface_list, link) {
+		if (ivisurf->layout_surface != NULL)
+			layout_surface_cleanup(ivisurf);
 		wl_list_remove(&ivisurf->link);
 		free(ivisurf);
 	}

Comments

Pekka Paalanen Aug. 8, 2018, 9:45 a.m.
On Tue, 7 Aug 2018 19:05:04 +0530
Harsha M M <harsha.manjulamallikarjun@in.bosch.com> wrote:

> Signed-off-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
> ---
>  ivi-shell/ivi-shell.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
> index 58f53bc..92e8f17 100644
> --- a/ivi-shell/ivi-shell.c
> +++ b/ivi-shell/ivi-shell.c
> @@ -366,6 +366,8 @@ shell_destroy(struct wl_listener *listener, void *data)
>  	wl_list_remove(&shell->wake_listener.link);
>  
>  	wl_list_for_each_safe(ivisurf, next, &shell->ivi_surface_list, link) {
> +		if (ivisurf->layout_surface != NULL)
> +			layout_surface_cleanup(ivisurf);
>  		wl_list_remove(&ivisurf->link);
>  		free(ivisurf);
>  	}

Hi,

using the bundled hmi-controller.so, I opened two apps (flower and
simple-shm) on weston/x11, then closed the weston window. That resulted
in the following crash:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f3dd8db46c2 in wl_list_empty (list=list@entry=0x90) at src/wayland-util.c:80
80		return list->next == list;
(gdb) bt
#0  0x00007f3dd8db46c2 in wl_list_empty (list=list@entry=0x90) at src/wayland-util.c:80
#1  0x00007f3dd8db46e4 in wl_list_insert_list (list=list@entry=0x558b8b3d8fc0, other=0x90) at src/wayland-util.c:86
#2  0x00007f3dd8fc8f6a in surface_stash_subsurface_views (surface=0x558b8b3d93f0) at /home/pq/git/weston/libweston/compositor.c:2210
#3  0x00007f3dd8fce1d0 in weston_compositor_build_view_list (compositor=0x558b8adcdfa0)
    at /home/pq/git/weston/libweston/compositor.c:2318
#4  0x00007f3dd8fce3ac in weston_view_destroy (view=0x558b8b3f49c0) at /home/pq/git/weston/libweston/compositor.c:1922
#5  0x00007f3dcf01890c in ivi_view_destroy (ivi_view=0x558b8b3f4900) at /home/pq/git/weston/ivi-shell/ivi-layout.c:156
#6  0x00007f3dcf01a89d in ivi_layout_surface_destroy (ivisurf=0x558b8b3efb30) at /home/pq/git/weston/ivi-shell/ivi-layout.c:243
#7  0x00007f3dcf01c042 in layout_surface_cleanup (ivisurf=0x558b8af8fda0) at /home/pq/git/weston/ivi-shell/ivi-shell.c:160
#8  0x00007f3dcf01c0fb in shell_destroy (listener=0x558b8af713c0, data=<optimized out>)
    at /home/pq/git/weston/ivi-shell/ivi-shell.c:370
#9  0x00007f3dd8fd2804 in wl_signal_emit (data=0x558b8adcdfa0, signal=0x558b8adcdfa0)
    at /home/pq/local/include/wayland-server-core.h:468
#10 weston_compositor_destroy (compositor=0x558b8adcdfa0) at /home/pq/git/weston/libweston/compositor.c:6690
#11 0x0000558b88c2271b in main (argc=<optimized out>, argv=<optimized out>) at /home/pq/git/weston/compositor/main.c:2598

If I drop patch 3 from this series, the crash does not happen.

I suppose there is more to fix before this patch can land, otherwise it
did look good.


Thanks,
pq
Harsha Manjula Mallikarjun (RBEI/ECF3) Aug. 8, 2018, 9:52 a.m.
> -----Original Message-----
> From: Pekka Paalanen [mailto:ppaalanen@gmail.com]
> Sent: Wednesday, August 08, 2018 3:15 PM
> To: Harsha Manjula Mallikarjun (RBEI/ECF3)
> <Harsha.ManjulaMallikarjun@in.bosch.com>
> Cc: wayland-devel@lists.freedesktop.org
> Subject: Re: [PATCH weston 3/3] ivi-shell: clean up remaining ivisurface
> during de-init
> 
> On Tue, 7 Aug 2018 19:05:04 +0530
> Harsha M M <harsha.manjulamallikarjun@in.bosch.com> wrote:
> 
> > Signed-off-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
> > ---
> >  ivi-shell/ivi-shell.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
> > index 58f53bc..92e8f17 100644
> > --- a/ivi-shell/ivi-shell.c
> > +++ b/ivi-shell/ivi-shell.c
> > @@ -366,6 +366,8 @@ shell_destroy(struct wl_listener *listener, void
> *data)
> >  	wl_list_remove(&shell->wake_listener.link);
> >
> >  	wl_list_for_each_safe(ivisurf, next, &shell->ivi_surface_list, link) {
> > +		if (ivisurf->layout_surface != NULL)
> > +			layout_surface_cleanup(ivisurf);
> >  		wl_list_remove(&ivisurf->link);
> >  		free(ivisurf);
> >  	}
> 
> Hi,
> 
> using the bundled hmi-controller.so, I opened two apps (flower and
> simple-shm) on weston/x11, then closed the weston window. That resulted
> in the following crash:
> 
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x00007f3dd8db46c2 in wl_list_empty (list=list@entry=0x90) at
> src/wayland-util.c:80
> 80		return list->next == list;
> (gdb) bt
> #0  0x00007f3dd8db46c2 in wl_list_empty (list=list@entry=0x90) at
> src/wayland-util.c:80
> #1  0x00007f3dd8db46e4 in wl_list_insert_list
> (list=list@entry=0x558b8b3d8fc0, other=0x90) at src/wayland-util.c:86
> #2  0x00007f3dd8fc8f6a in surface_stash_subsurface_views
> (surface=0x558b8b3d93f0) at
> /home/pq/git/weston/libweston/compositor.c:2210
> #3  0x00007f3dd8fce1d0 in weston_compositor_build_view_list
> (compositor=0x558b8adcdfa0)
>     at /home/pq/git/weston/libweston/compositor.c:2318
> #4  0x00007f3dd8fce3ac in weston_view_destroy (view=0x558b8b3f49c0) at
> /home/pq/git/weston/libweston/compositor.c:1922
> #5  0x00007f3dcf01890c in ivi_view_destroy (ivi_view=0x558b8b3f4900) at
> /home/pq/git/weston/ivi-shell/ivi-layout.c:156
> #6  0x00007f3dcf01a89d in ivi_layout_surface_destroy
> (ivisurf=0x558b8b3efb30) at /home/pq/git/weston/ivi-shell/ivi-layout.c:243
> #7  0x00007f3dcf01c042 in layout_surface_cleanup (ivisurf=0x558b8af8fda0)
> at /home/pq/git/weston/ivi-shell/ivi-shell.c:160
> #8  0x00007f3dcf01c0fb in shell_destroy (listener=0x558b8af713c0,
> data=<optimized out>)
>     at /home/pq/git/weston/ivi-shell/ivi-shell.c:370
> #9  0x00007f3dd8fd2804 in wl_signal_emit (data=0x558b8adcdfa0,
> signal=0x558b8adcdfa0)
>     at /home/pq/local/include/wayland-server-core.h:468
> #10 weston_compositor_destroy (compositor=0x558b8adcdfa0) at
> /home/pq/git/weston/libweston/compositor.c:6690
> #11 0x0000558b88c2271b in main (argc=<optimized out>, argv=<optimized
> out>) at /home/pq/git/weston/compositor/main.c:2598
> 
> If I drop patch 3 from this series, the crash does not happen.
> 
> I suppose there is more to fix before this patch can land, otherwise it
> did look good.


Hi Pekka,

Thanks for the feedback. I will take a look using the bundled hmi-controller.so
and resolve this problem. In my setup I was using ivi-controller from genivi 
wayland extensions.

Best Regards,
Harsha
> 
> 
> Thanks,
> pq