Commit Graph

7633 Commits

Author SHA1 Message Date
Pekka Paalanen
091b1554da shared/cairo-util: fix leak from load_cairo_surface()
Fixes ASan reported leaks:

Direct leak of 256 byte(s) in 1 object(s) allocated from:
    #0 0x7f8266f2d330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    #1 0x7f8266c8589a  (/lib/x86_64-linux-gnu/libpixman-1.so.0+0x5089a)
    #2 0x7f8266c4ea77  (/lib/x86_64-linux-gnu/libpixman-1.so.0+0x19a77)
    #3 0x55fa7818f8e8 in load_png ../../git/weston/shared/image-loader.c:297
    #4 0x55fa7819039e in load_image ../../git/weston/shared/image-loader.c:423
    #5 0x55fa78187b3e in load_cairo_surface ../../git/weston/shared/cairo-util.c:354
    #6 0x55fa7815ff8a in background_draw ../../git/weston/clients/desktop-shell.c:779
    #7 0x55fa7817b2c2 in widget_redraw ../../git/weston/clients/window.c:4520
    #8 0x55fa7817b831 in surface_redraw ../../git/weston/clients/window.c:4578
    #9 0x55fa7817b9a7 in idle_redraw ../../git/weston/clients/window.c:4607
    #10 0x55fa78184ea4 in display_run ../../git/weston/clients/window.c:6527
    #11 0x55fa781646fb in main ../../git/weston/clients/desktop-shell.c:1556
    #12 0x7f826659709a in __libc_start_main ../csu/libc-start.c:308
    #13 0x55fa7815c0a9 in _start (/home/pq/build/weston-meson/clients/weston-desktop-shell+0x120a9)

Indirect leak of 8024 byte(s) in 1 object(s) allocated from:
    #0 0x7f8266f2d330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    #1 0x55fa7818f5e7 in load_png ../../git/weston/shared/image-loader.c:275
    #2 0x55fa7819039e in load_image ../../git/weston/shared/image-loader.c:423
    #3 0x55fa78187b3e in load_cairo_surface ../../git/weston/shared/cairo-util.c:354
    #4 0x55fa7815ff8a in background_draw ../../git/weston/clients/desktop-shell.c:779
    #5 0x55fa7817b2c2 in widget_redraw ../../git/weston/clients/window.c:4520
    #6 0x55fa7817b831 in surface_redraw ../../git/weston/clients/window.c:4578
    #7 0x55fa7817b9a7 in idle_redraw ../../git/weston/clients/window.c:4607
    #8 0x55fa78184ea4 in display_run ../../git/weston/clients/window.c:6527
    #9 0x55fa781646fb in main ../../git/weston/clients/desktop-shell.c:1556
    #10 0x7f826659709a in __libc_start_main ../csu/libc-start.c:308
    #11 0x55fa7815c0a9 in _start (/home/pq/build/weston-meson/clients/weston-desktop-shell+0x120a9)

from the command

	ASAN_OPTIONS=fast_unwind_on_malloc=0,malloc_context_size=50 \
	LSAN_OPTIONS=suppressions=/home/pq/git/weston/.gitlab-ci/leak-sanitizer.supp \
	./tests/test-viewporter test_viewporter_bad_source_rect

by recording the pixman image as user data so it can be freed when the
surface is destroyed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Lujin Wang
928d3a0059 clients: Free output->make/model in output_destroy
== 8 bytes in 1 blocks are definitely lost in loss record 4 of 71
==    at 0x48450F8: malloc (vg_replace_malloc.c:309)
==    by 0x500213F: strdup (strdup.c:42)
==    by 0x40A57F: display_handle_geometry (in weston-desktop-shell)
==    by 0x4864D27: ffi_call_SYSV (in libffi.so.6.0.4)
==    by 0x4865697: ffi_call (in libffi.so.6.0.4)
==    by 0x4880E07: wl_closure_invoke (connection.c:935)
==    by 0x487DD73: dispatch_event.isra.5 (wayland-client.c:1310)
==    by 0x487EF87: dispatch_queue (wayland-client.c:1456)
==    by 0x487EF87: wl_display_dispatch_queue_pending (wayland-client.c:1698)
==    by 0x4104E3: handle_display_data (in weston-desktop-shell)
==    by 0x40FE8F: display_run (in weston-desktop-shell)
==    by 0x405AB3: main (in weston-desktop-shell)

Signed-off-by: Lujin Wang <luwang@nvidia.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen
719ca87399 desktop-shell: clean up shell_output better
This fixes the following ASan detected leaks:

Direct leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x7f8c3455f330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    #1 0x7f8c33c60906 in wl_event_loop_add_timer ../../git/wayland/src/event-loop.c:571
    #2 0x7f8c2ff98f46 in shell_fade_init ../../git/weston/desktop-shell/shell.c:4211
    #3 0x7f8c2ff9e1da in wet_shell_init ../../git/weston/desktop-shell/shell.c:5266
    #4 0x7f8c3443ede5 in wet_load_shell ../../git/weston/compositor/main.c:956
    #5 0x7f8c3444fdb9 in wet_main ../../git/weston/compositor/main.c:3434
    #6 0x55878ad3bfc6 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
    #7 0x55878ad3f9fa in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
    #8 0x55878ad2fbd6 in fixture_setup ../../git/weston/tests/viewporter-test.c:46
    #9 0x55878ad2fc58 in fixture_setup_run_ ../../git/weston/tests/viewporter-test.c:48
    #10 0x55878ad3ffaf in main ../../git/weston/tests/weston-test-runner.c:661
    #11 0x7f8c340b409a in __libc_start_main ../csu/libc-start.c:308
    #12 0x55878ad2f769 in _start (/home/pq/build/weston-meson/tests/test-viewporter+0xc769)

Indirect leak of 856 byte(s) in 1 object(s) allocated from:
    #0 0x7f8c3455f518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7f8c33c99b73 in zalloc ../../git/weston/include/libweston/zalloc.h:38
    #2 0x7f8c33c9cfb1 in weston_surface_create ../../git/weston/libweston/compositor.c:574
    #3 0x7f8c2ff98230 in shell_fade_create_surface_for_output ../../git/weston/desktop-shell/shell.c:4059
    #4 0x7f8c2ff98df6 in shell_fade_init ../../git/weston/desktop-shell/shell.c:4202
    #5 0x7f8c2ff9e1da in wet_shell_init ../../git/weston/desktop-shell/shell.c:5266
    #6 0x7f8c3443ede5 in wet_load_shell ../../git/weston/compositor/main.c:956
    #7 0x7f8c3444fdb9 in wet_main ../../git/weston/compositor/main.c:3434
    #8 0x55878ad3bfc6 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
    #9 0x55878ad3f9fa in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
    #10 0x55878ad2fbd6 in fixture_setup ../../git/weston/tests/viewporter-test.c:46
    #11 0x55878ad2fc58 in fixture_setup_run_ ../../git/weston/tests/viewporter-test.c:48
    #12 0x55878ad3ffaf in main ../../git/weston/tests/weston-test-runner.c:661
    #13 0x7f8c340b409a in __libc_start_main ../csu/libc-start.c:308
    #14 0x55878ad2f769 in _start (/home/pq/build/weston-meson/tests/test-viewporter+0xc769)

Indirect leak of 608 byte(s) in 1 object(s) allocated from:
    #0 0x7f8c3455f518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7f8c33c99b73 in zalloc ../../git/weston/include/libweston/zalloc.h:38
    #2 0x7f8c33c9bed5 in weston_view_create ../../git/weston/libweston/compositor.c:365
    #3 0x7f8c2ff98251 in shell_fade_create_surface_for_output ../../git/weston/desktop-shell/shell.c:4063
    #4 0x7f8c2ff98df6 in shell_fade_init ../../git/weston/desktop-shell/shell.c:4202
    #5 0x7f8c2ff9e1da in wet_shell_init ../../git/weston/desktop-shell/shell.c:5266
    #6 0x7f8c3443ede5 in wet_load_shell ../../git/weston/compositor/main.c:956
    #7 0x7f8c3444fdb9 in wet_main ../../git/weston/compositor/main.c:3434
    #8 0x55878ad3bfc6 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
    #9 0x55878ad3f9fa in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
    #10 0x55878ad2fbd6 in fixture_setup ../../git/weston/tests/viewporter-test.c:46
    #11 0x55878ad2fc58 in fixture_setup_run_ ../../git/weston/tests/viewporter-test.c:48
    #12 0x55878ad3ffaf in main ../../git/weston/tests/weston-test-runner.c:661
    #13 0x7f8c340b409a in __libc_start_main ../csu/libc-start.c:308
    #14 0x55878ad2f769 in _start (/home/pq/build/weston-meson/tests/test-viewporter+0xc769)

They were found with:

	ASAN_OPTIONS=fast_unwind_on_malloc=0,malloc_context_size=50 \
	LSAN_OPTIONS=suppressions=/home/pq/git/weston/.gitlab-ci/leak-sanitizer.supp \
	./tests/test-viewporter test_viewporter_double_create

Turns out shell_destroy() had an open-coded and outdated copy of the
tear-down sequence, so fixing the leaks in only handle_output_destroy()
was not enough.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen
0d5e4ffb96 desktop-shell: rename output_listener to shell_output
Most other places call a variable like this 'shell_output', so let's do
that here too. The old name was really confusing.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen
abd7292969 desktop-shell: destroy weston_desktop
Plugs ASan reported leaks:

Direct leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x7f338f70a518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7f338afe22f3 in zalloc ../../git/weston/include/libweston/zalloc.h:38
    #2 0x7f338afe3cc2 in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:410
    #3 0x7f338afdbaef in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87
    #4 0x7f338b148d39 in wet_shell_init ../../git/weston/desktop-shell/shell.c:5224
    #5 0x7f338f5e9de5 in wet_load_shell ../../git/weston/compositor/main.c:956
    #6 0x7f338f5fadb9 in wet_main ../../git/weston/compositor/main.c:3434
    #7 0x5646d2392fc6 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
    #8 0x5646d23969fa in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
    #9 0x5646d2386bd6 in fixture_setup ../../git/weston/tests/viewporter-test.c:46
    #10 0x5646d2386c58 in fixture_setup_run_ ../../git/weston/tests/viewporter-test.c:48
    #11 0x5646d2396faf in main ../../git/weston/tests/weston-test-runner.c:661
    #12 0x7f338f25f09a in __libc_start_main ../csu/libc-start.c:308
    #13 0x5646d2386769 in _start (/home/pq/build/weston-meson/tests/test-viewporter+0xc769)

Indirect leak of 152 byte(s) in 1 object(s) allocated from:
    #0 0x7f338f70a518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7f338afdb811 in zalloc ../../git/weston/include/libweston/zalloc.h:38
    #2 0x7f338afdb92d in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:65
    #3 0x7f338b148d39 in wet_shell_init ../../git/weston/desktop-shell/shell.c:5224
    #4 0x7f338f5e9de5 in wet_load_shell ../../git/weston/compositor/main.c:956
    #5 0x7f338f5fadb9 in wet_main ../../git/weston/compositor/main.c:3434
    #6 0x5646d2392fc6 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
    #7 0x5646d23969fa in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
    #8 0x5646d2386bd6 in fixture_setup ../../git/weston/tests/viewporter-test.c:46
    #9 0x5646d2386c58 in fixture_setup_run_ ../../git/weston/tests/viewporter-test.c:48
    #10 0x5646d2396faf in main ../../git/weston/tests/weston-test-runner.c:661
    #11 0x7f338f25f09a in __libc_start_main ../csu/libc-start.c:308
    #12 0x5646d2386769 in _start (/home/pq/build/weston-meson/tests/test-viewporter+0xc769)

Indirect leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x7f338f70a518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7f338afdc5ae in zalloc ../../git/weston/include/libweston/zalloc.h:38
    #2 0x7f338afdc89e in weston_desktop_client_create ../../git/weston/libweston-desktop/client.c:108
    #3 0x7f338afe3d2a in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:415
    #4 0x7f338afdbaef in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87
    #5 0x7f338b148d39 in wet_shell_init ../../git/weston/desktop-shell/shell.c:5224
    #6 0x7f338f5e9de5 in wet_load_shell ../../git/weston/compositor/main.c:956
    #7 0x7f338f5fadb9 in wet_main ../../git/weston/compositor/main.c:3434
    #8 0x5646d2392fc6 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
    #9 0x5646d23969fa in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
    #10 0x5646d2386bd6 in fixture_setup ../../git/weston/tests/viewporter-test.c:46
    #11 0x5646d2386c58 in fixture_setup_run_ ../../git/weston/tests/viewporter-test.c:48
    #12 0x5646d2396faf in main ../../git/weston/tests/weston-test-runner.c:661
    #13 0x7f338f25f09a in __libc_start_main ../csu/libc-start.c:308
    #14 0x5646d2386769 in _start (/home/pq/build/weston-meson/tests/test-viewporter+0xc769)

Oops.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen
ef4d5c4086 tests: clean up after viewporter-test
Clean up after each test to avoid ASan reporting leaks.

At few points client_roundtrip() is replaced with client_destroy()
because the latter does a final roundtrip anyway.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen
ed6df8ed1c tests: allow client_destroy() after expect_protocol_error()
expect_protocol_error() ensures that the connection has failed in the
expected way. To satisfy ASan leak detection, we still need to tear down
everything, including call client_destroy().

client_destroy() needs to check that tear-down does not cause protocol
errors, so it does one last roundtrip that checks that is succeeds. But
if the connection is already down in an expected way, this roundtrip
cannot succeed and must be skipped.

Also moves the roundtrip under 'if (wl_display)', assuming the 'if' is
there for a reason - but obviously that reason was never used as it
would have crashed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen
6ae243f91e Add leak sanitizer suppressions
ASan will detect leaks also outside of the code we build, and sometimes
that external code leaks and we cannot work around it. Then we need to
suppress the leak reports to make our own ASan testing succeed. This
commit only introduces the suppressions file, making use of it CI is for
another time. This file is useful for manual targeted testing as below.

Start by suppressing two functions what weston-keyboard client ends up
calling, suppressing leak reports like these:

Indirect leak of 96 byte(s) in 3 object(s) allocated from:
    #0 0x7fc109c3d518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7fc109083d18  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x20d18)
    #2 0x7fc1090849a7 in FcPatternDuplicate (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x219a7)
    #3 0x7fc109adf93e  (/lib/x86_64-linux-gnu/libcairo.so.2+0xbb93e)
    #4 0x7fc109adfc8d  (/lib/x86_64-linux-gnu/libcairo.so.2+0xbbc8d)
    #5 0x7fc109aa02e7 in cairo_toy_font_face_create (/lib/x86_64-linux-gnu/libcairo.so.2+0x7c2e7)
    #6 0x7fc109aa856c in cairo_select_font_face (/lib/x86_64-linux-gnu/libcairo.so.2+0x8456c)
    #7 0x5603cb49a06a in redraw_handler ../../git/weston/clients/keyboard.c:378
    #8 0x5603cb4b506b in widget_redraw ../../git/weston/clients/window.c:4520
    #9 0x5603cb4b55da in surface_redraw ../../git/weston/clients/window.c:4578
    #10 0x5603cb4b5750 in idle_redraw ../../git/weston/clients/window.c:4607
    #11 0x5603cb4bebe3 in display_run ../../git/weston/clients/window.c:6525
    #12 0x5603cb49e55d in main ../../git/weston/clients/keyboard.c:1054
    #13 0x7fc1092a709a in __libc_start_main ../csu/libc-start.c:308
    #14 0x5603cb499019 in _start (/home/pq/build/weston-meson/clients/weston-keyboard+0x19019)

Indirect leak of 528 byte(s) in 51 object(s) allocated from:
    #0 0x7fc109b8e810 in strdup (/lib/x86_64-linux-gnu/libasan.so.5+0x3a810)
    #1 0x7fc109082fc4 in FcValueSave (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1ffc4)
    #2 0x7fc109083d2e  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x20d2e)
    #3 0x7fc1090852c7  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x222c7)
    #4 0x7fc10908c28b  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2928b)
    #5 0x7fc108603a15  (/lib/x86_64-linux-gnu/libexpat.so.1+0xba15)
    #6 0x7fc1086044bb  (/lib/x86_64-linux-gnu/libexpat.so.1+0xc4bb)
    #7 0x7fc108601f8a  (/lib/x86_64-linux-gnu/libexpat.so.1+0x9f8a)
    #8 0x7fc108602e7a  (/lib/x86_64-linux-gnu/libexpat.so.1+0xae7a)
    #9 0x7fc108606a37 in XML_ParseBuffer (/lib/x86_64-linux-gnu/libexpat.so.1+0xea37)
    #10 0x7fc10908a0fa  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x270fa)
    #11 0x7fc10908a519  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x27519)
    #12 0x7fc10908a73a  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2773a)
    #13 0x7fc10908b48f  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2848f)
    #14 0x7fc108603a15  (/lib/x86_64-linux-gnu/libexpat.so.1+0xba15)
    #15 0x7fc1086044bb  (/lib/x86_64-linux-gnu/libexpat.so.1+0xc4bb)
    #16 0x7fc108601f8a  (/lib/x86_64-linux-gnu/libexpat.so.1+0x9f8a)
    #17 0x7fc108602e7a  (/lib/x86_64-linux-gnu/libexpat.so.1+0xae7a)
    #18 0x7fc108606a37 in XML_ParseBuffer (/lib/x86_64-linux-gnu/libexpat.so.1+0xea37)
    #19 0x7fc10908a0fa  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x270fa)
    #20 0x7fc10908a519  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x27519)
    #21 0x7fc10907c4b3  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x194b3)
    #22 0x7fc10907c715  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x19715)
    #23 0x7fc10906e8e6  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0xb8e6)
    #24 0x7fc109070928 in FcConfigSubstituteWithPat (/lib/x86_64-linux-gnu/libfontconfig.so.1+0xd928)
    #25 0x7fc109ae2d6b  (/lib/x86_64-linux-gnu/libcairo.so.2+0xbed6b)
    #26 0x7fc109a8aba2 in cairo_scaled_font_create (/lib/x86_64-linux-gnu/libcairo.so.2+0x66ba2)
    #27 0x7fc109a50d1d  (/lib/x86_64-linux-gnu/libcairo.so.2+0x2cd1d)
    #28 0x7fc109a53be0  (/lib/x86_64-linux-gnu/libcairo.so.2+0x2fbe0)
    #29 0x7fc109a4c1df  (/lib/x86_64-linux-gnu/libcairo.so.2+0x281df)
    #30 0x7fc109aa8dab in cairo_text_extents (/lib/x86_64-linux-gnu/libcairo.so.2+0x84dab)
    #31 0x5603cb499af3 in draw_key ../../git/weston/clients/keyboard.c:329
    #32 0x5603cb49a30c in redraw_handler ../../git/weston/clients/keyboard.c:392
    #33 0x5603cb4b506b in widget_redraw ../../git/weston/clients/window.c:4520
    #34 0x5603cb4b55da in surface_redraw ../../git/weston/clients/window.c:4578
    #35 0x5603cb4b5750 in idle_redraw ../../git/weston/clients/window.c:4607
    #36 0x5603cb4bebe3 in display_run ../../git/weston/clients/window.c:6525
    #37 0x5603cb49e55d in main ../../git/weston/clients/keyboard.c:1054
    #38 0x7fc1092a709a in __libc_start_main ../csu/libc-start.c:308
    #39 0x5603cb499019 in _start (/home/pq/build/weston-meson/clients/weston-keyboard+0x19019)

With the command line

	ASAN_OPTIONS=fast_unwind_on_malloc=0,malloc_context_size=50 \
	LSAN_OPTIONS=suppressions=/home/pq/git/weston/.gitlab-ci/leak-sanitizer.supp \
	./tests/test-viewporter test_viewporter_double_create

Suppressions used:
  count      bytes template
      5        357 cairo_select_font_face
    130       9104 cairo_text_extents

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen
c8c53bafd3 clients/window: destroy remaining globals
Destroy the remaining globals on exit. Fixes a bunch of leaks reported
by ASan.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen
1e08a81c43 clients/window: move code into global_destroy()
Another patch will want to call global_destroy() too.

Pure refactoring, no functional change.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen
d9b949d8b9 keyboard: free stuff on exit
This fixes a bunch of leaks when trying to run a Weston test with
desktop-shell, which spawns weston-keyboard.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen
1f3e9045ad clients/window: fix leaks on start-up failure
Trying to run viewporter-test with ASan leak checking,
weston-desktop-shell helper client reports many leaks, because the
compositor quits before the client can start. Hence the
wl_display_roundtrip() fails.

Clean up by calling display_destroy() when wl_display_roundtrip() fails.
It's late enough that all kinds of things may have been allocated, so a
special local tear-down path is not feasible.

To make that work, display_destroy() must handle many things that might
be NULL which normally aren't. Also display_create() needs to initialize
lists early enough so that cleaning them up works.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Simon Ser
992ee045f1 clients/window: atomically update pointer cursor
Currently, Weston clients update the pointer cursor by first issuing
a wl_surface.commit request to update the buffer, then a
wl_pointer.set_cursor request to update the hotspot. This causes an
issue because buffer and hotspot aren't updated atomically: in-between
the two requests, the buffer is new but the hotspot is old.

To fix this issue, create a new surface each time the cursor is
updated.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-05-30 15:07:04 +00:00
Pekka Paalanen
7514bf7e45 tests: proper weston_test_surface_create()
struct weston_test_surface in the test harness' compositor plugin had no
tear down code, which lead to ASan report on alpha-blending test:

Direct leak of 64 byte(s) in 2 object(s) allocated from:
    #0 0x7f8931f10330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    #1 0x7f892d934425 in move_surface ../../git/weston/tests/weston-test.c:181
    #2 0x7f893159d8ed in ffi_call_unix64 (/lib/x86_64-linux-gnu/libffi.so.6+0x68ed)

While at it, let's do this properly for once:
- put the creation in a new function
- hook up to the weston_surface destroy signal so this actually gets
  freed (fixes the leak)
- check that we don't overwrite another surface role
- check that committed_private actually is ours
- set the surface label func so it gets properly listed in debugs and
  traces
- use the proper surface role setup call, so no-one stomps on anyones
  toes if a test makes a mistake by using a wrong wl_surface

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
33b29bbb11 tests: destroy screenshooter
Fixes a leak found by ASan in alpha-blending-test.

Direct leak of 160 byte(s) in 2 object(s) allocated from:
    #0 0x7f511fe11518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7f511fc76373 in zalloc ../../git/wayland/src/wayland-private.h:232
    #2 0x7f511fc76373 in proxy_create ../../git/wayland/src/wayland-client.c:422
    #3 0x7f511fc79dcc in create_outgoing_proxy ../../git/wayland/src/wayland-client.c:651
    #4 0x7f511fc79dcc in wl_proxy_marshal_array_constructor_versioned ../../git/wayland/src/wayland-client.c:736
    #5 0x7f511fc7b17b in wl_proxy_marshal_constructor_versioned ../../git/wayland/src/wayland-client.c:873
    #6 0x5583e5348f43 in wl_registry_bind /home/pq/local/include/wayland-client-protocol.h:1165
    #7 0x5583e534cfbe in handle_global ../../git/weston/tests/weston-test-client-helper.c:800
    #8 0x7f511f34b8ed in ffi_call_unix64 (/lib/x86_64-linux-gnu/libffi.so.6+0x68ed)

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
681db3416d tests: destroy subcompositor in alpha-blending
Fixed a leak found by ASan:

Direct leak of 160 byte(s) in 2 object(s) allocated from:
    #0 0x7f511fe11518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7f511fc76373 in zalloc ../../git/wayland/src/wayland-private.h:232
    #2 0x7f511fc76373 in proxy_create ../../git/wayland/src/wayland-client.c:422
    #3 0x7f511fc79dcc in create_outgoing_proxy ../../git/wayland/src/wayland-client.c:651
    #4 0x7f511fc79dcc in wl_proxy_marshal_array_constructor_versioned ../../git/wayland/src/wayland-client.c:736
    #5 0x7f511fc7b17b in wl_proxy_marshal_constructor_versioned ../../git/wayland/src/wayland-client.c:873
    #6 0x5583e5348f43 in wl_registry_bind /home/pq/local/include/wayland-client-protocol.h:1165
    #7 0x5583e535140b in bind_to_singleton_global ../../git/weston/tests/weston-test-client-helper.c:1863
    #8 0x5583e5348752 in alpha_blend_monotonic ../../git/weston/tests/alpha-blending-test.c:219
    #9 0x5583e5348571 in wrapalpha_blend_monotonic ../../git/weston/tests/alpha-blending-test.c:200
    #10 0x5583e53554cc in run_test ../../git/weston/tests/weston-test-runner.c:162
    #11 0x5583e5355b6d in run_case ../../git/weston/tests/weston-test-runner.c:277
    #12 0x5583e5355913 in for_each_test_case ../../git/weston/tests/weston-test-runner.c:235
    #13 0x5583e5355df5 in testsuite_run ../../git/weston/tests/weston-test-runner.c:311
    #14 0x7f511aaaf752 in client_thread_routine ../../git/weston/tests/weston-test.c:404
    #15 0x7f511f88cfa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Lujin Wang
d4b46cdd3c libweston: Remove source repaint_timer in weston_compositor_shutdown
Fixes a definitely lost:
== 56 bytes in 1 blocks are definitely lost in loss record 16 of 45
==    at 0x48450F8: malloc (vg_replace_malloc.c:309)
==    by 0x4B55E93: wl_event_loop_add_timer (event-loop.c:197)
==    by 0x4126CF: weston_compositor_create (in /usr/local/bin/weston)
==    by 0x409997: main (in /usr/local/bin/weston)

Signed-off-by: Lujin Wang <luwang@nvidia.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
e2583ca084 libweston-desktop: add weston_desktop_xwayland_fini()
This fixes the following leaks detected by ASan in
./tests/test-alpha-blending:

Direct leak of 176 byte(s) in 2 object(s) allocated from:
    #0 0x7fb447880518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7fb4432c12d7 in zalloc ../../git/weston/include/libweston/zalloc.h:38
    #2 0x7fb4432c2ca6 in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:410
    #3 0x7fb4432baadf in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87
    #4 0x7fb4432e1e1f in wet_shell_init ../../git/weston/tests/weston-test-desktop-shell.c:224
    #5 0x7fb44775fddd in wet_load_shell ../../git/weston/compositor/main.c:956
    #6 0x7fb447770db1 in wet_main ../../git/weston/compositor/main.c:3434
    #7 0x56172c599279 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
    #8 0x56172c59cce5 in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
    #9 0x56172c58dc8c in fixture_setup ../../git/weston/tests/alpha-blending-test.c:65
    #10 0x56172c58dd31 in fixture_setup_run_ ../../git/weston/tests/alpha-blending-test.c:67
    #11 0x56172c59d29a in main ../../git/weston/tests/weston-test-runner.c:661
    #12 0x7fb4473d509a in __libc_start_main ../csu/libc-start.c:308

Indirect leak of 144 byte(s) in 2 object(s) allocated from:
    #0 0x7fb447880518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7fb4432bb592 in zalloc ../../git/weston/include/libweston/zalloc.h:38
    #2 0x7fb4432bb882 in weston_desktop_client_create ../../git/weston/libweston-desktop/client.c:108
    #3 0x7fb4432c2d0e in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:415
    #4 0x7fb4432baadf in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87
    #5 0x7fb4432e1e1f in wet_shell_init ../../git/weston/tests/weston-test-desktop-shell.c:224
    #6 0x7fb44775fddd in wet_load_shell ../../git/weston/compositor/main.c:956
    #7 0x7fb447770db1 in wet_main ../../git/weston/compositor/main.c:3434
    #8 0x56172c599279 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
    #9 0x56172c59cce5 in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
    #10 0x56172c58dc8c in fixture_setup ../../git/weston/tests/alpha-blending-test.c:65
    #11 0x56172c58dd31 in fixture_setup_run_ ../../git/weston/tests/alpha-blending-test.c:67
    #12 0x56172c59d29a in main ../../git/weston/tests/weston-test-runner.c:661
    #13 0x7fb4473d509a in __libc_start_main ../csu/libc-start.c:308

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
f53c05d3c2 libweston-desktop: introduce weston_desktop_client_destroy()
This new function is callable explicitly, unlike the old function that
used to have the same name.

This will be needed when tearing down what
weston_desktop_xwayland_init() puts up.

Since calling weston_desktop_client_destroy() for an external client
(one that has a wl_resource for this) is a bug, add asserts to prevent
it. This will only be needed for the internal client: XWM.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
5a6604a7a2 libweston-desktop: rename weston_desktop_client_destroy()
This function here is a wl_resource destructor, but we will need another
function for externally triggered destroy when wl_resource does not
exist.

Rename the existing function, because the old name fits better the new
function to be written.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
6a0a3a014f tests: call weston_layer_fini()
This ensures the layers are torn down properly.

See commit: libweston: add weston_layer_fini()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
91147c6e80 kiosk-shell: call weston_layer_fini()
This ensures the layers are torn down properly.

See commit: libweston: add weston_layer_fini()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
9706a807f9 ivi-shell: call weston_layer_fini()
This ensures the layers are torn down properly.

See commit: libweston: add weston_layer_fini()

There would be a lot more to tear down here, but that is for another
time.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
4bb326bc8c desktop-shell: call weston_layer_fini()
This ensures the layers are torn down properly.

See commit: libweston: add weston_layer_fini()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Pekka Paalanen
8740037a93 libweston: add weston_layer_fini()
Layers did not have a fini sequence before, which means the compositor
layer list might have stale pointers temporarily when shutting down. A
bigger problem might be having views linger after the destruction of the
layer.

These problems were not observed yet, but if they exist, this patch
should help to find them and then fix them.

The check in weston_compositor_shutdown() is not an assert yet, because
it will trigger until all components call weston_layer_fini() correctly.
Some components do not even have a tear-down function to call it from at
all, like fullscreen-shell.

The same with the check in weston_layer_fini().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03:00
Peter Hutterer
eaa5ecf8b2 CONTRIBUTING: update IRC mention to oftc 2021-05-27 08:28:02 +10:00
Daniel Stone
58dba727c9 CI: Use FDO_CI_CONCURRENT
$FDO_CI_CONCURRENT is provided by in the CI environment by the fd.o
GitLab runners to tell us how many parallel processes would be 'good' to
use.

Use this to override the default Ninja invocation which uses as many
CPUs as available, and instead tell it to use as many parallel processes
as the runner thinks we should during the build process.

Tests are invoked using `meson test` inside a virtme/QEmu VM; whilst
Meson's test backend will use as many processors as availble, virtme
will by default create a single-CPU VM. So if we create a VM with as
many CPUs as we should have parallel processes, we can let it use all of
them. This also requires quadrupling the requested RAM so ASan doesn't
force us straight into OOM.

Suggested by @daenzer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-05-18 14:11:49 +01:00
Pekka Paalanen
6551c09d63 libweston: comment places that cannot use paint node lists
These are all the remaining places that still use the global view_list,
and cannot avoid it. Add a comment to explain why in each.

Now all places that use view_list have been audited for paint node
lists.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-18 14:06:21 +03:00
Pekka Paalanen
aa2e0b2075 drm-backend: iterate paint nodes
Iterate paint nodes instead of the global view list. Right now this does
not change behavior.

This is a step towards using per-output view lists that can then be
optimized for the output in libweston core.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-18 14:06:21 +03:00
Pekka Paalanen
20ab6f88ec libweston: iterate paint nodes in accumulate damage
Iterate paint nodes instead of the global view list. Right now this does
not change behavior.

This is a step towards using per-output view lists that can then be
optimized for the output in libweston core.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-18 14:06:21 +03:00
Pekka Paalanen
6d6b36738f libweston: iterate paint nodes on output repaint
Iterate paint nodes instead of the global view list. Right now this does
not change behavior.

This is a step towards using per-output view lists that can then be
optimized for the output in libweston core.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-18 14:06:21 +03:00
Pekka Paalanen
29cdb34019 gl-renderer: iterate paint nodes
Iterate paint nodes instead of the global view list. Right now this does
not change behavior.

This is a step towards using per-output view lists that can then be
optimized for the output in libweston core.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-18 14:03:44 +03:00
Pekka Paalanen
e02dbf650b pixman-renderer: iterate paint nodes
Iterate paint nodes instead of the global view list. Right now this does
not change behavior.

This is a step towards using per-output view lists that can then be
optimized for the output in libweston core.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-18 14:03:44 +03:00
Pekka Paalanen
2fddc539c5 libweston: per-output z-ordered paint node list
This patch creates a per-output paint node list in the same z-order as
the global view_list in weston_compositor.

The next step is to switch output repaints and backends to use the
z-order list instead of view_list.

Having a per-output paint node list for repaints allows including only
those paint nodes that actually contribute to the output image, so that
completely occluded and out-of-screen views can be ignored in libweston
core already.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-18 14:03:44 +03:00
Pekka Paalanen
1a4f87dec5 libweston: introduce weston_paint_node
This new object is created for every surface-view-output triplet. As
there is always exactly one surface for a view and it does not change
during a view's lifetime, this is really for a view-output pair or a
surface-output pair.

The object is created on-demand as a part of preparing for an output
repaint, so it applies only to surfaces that are going through repaint.
A prerequisite for that is that the surface is mapped, which means it
has a mapped view.

When any one of surface or view gets destroyed or output gets disabled,
all related paint nodes are destroyed.

In future, paint node will be useful for caching surface-output or
view-output pair dependent data:
- damage regions for overlapping outputs
- color transformations
- backend-specific bookkeeping (e.g. DRM KMS plane assigments)
- per-output repaint lists
- surface geometry transformed into output space

Suggested by Daniel Stone in
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/582#note_899406

PS. The call in weston_view_destroy() to
weston_compositor_build_view_list() might be so that if the view has
sub-surfaces, rebuilding the view list removes those those too and
automagically deletes their views.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-18 14:03:44 +03:00
Pekka Paalanen
7ee4149c9e libweston: remove weston_view::renderer_state
Unused.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-18 14:03:44 +03:00
Daniel Stone
8ee025d119 CI: Quieten virtme kernel output
We don't need the entire verbose boot log in CI every time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-05-17 13:14:28 +00:00
Simon Ser
0ccad4b24f clients/simple-dmabuf-egl: don't add INVALID to modifier list
While this is harmless because gbm_bo_create_with_modifiers will just
fail, it's easy to misunderstand that gbm_bo_create_with_modifiers
accepts MOD_INVALID. Let's just keep modifiers_count to zero instead
and stop even trying to call that function with invalid input.

Stop using modifiers_count to decide whether the compositor supports a
format. Instead use a separate format_supported flag.

Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7601#note_778845
2021-05-17 11:59:58 +00:00
Daniel Stone
e649c12316 CI: Use larger timeout multiplier for ASan tests
Running under ASan introduces a good amount of overhead. Using the Meson
test wrapper rather than invoking a Ninja target lets us set a timeout
multiplier, which we smash up pretty high to account for this overhead
and prevent some of the larger tests from hitting timeout.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-05-17 12:27:03 +01:00
Christian Rauch
5c303cc116 destroy shm, pointer, keyboard, touch and seat on exit 2021-05-15 18:57:59 +01:00
Pekka Paalanen
7baece632f CI: shorten job names
The old job names were really long, so long that Gitlab web UI had to
almost always ellipsize them, showing only the beginning which is the
same fof the two and hiding the part that actually matters.

Rename the templates and the jobs to be shorter and more descriptive.
Meson is the only tool we build with. All builds are native. Default
options is a long way to say full-featured and besides libseat was not
even default yet we build it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-15 16:12:59 +00:00
Pekka Paalanen
4a644e34d9 CI: put coverage-html output into file
I'm tired of scrolling through that flood when looking at CI logs. It's
just listing every gcno, gcda and c file name as it parses them.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-15 16:12:59 +00:00
Pekka Paalanen
b27f539714 CI: turn BUILDDIR and PREFIX into CI variables
Change BUILDDIR and PREFIX from exported shell variables into CI
variables. This way they can be used in CI configuration, e.g.
artifacts.

The main reason for this change is that it makes it possible to use
these variables in after_script, which is not possible with shell
variables as the values do not carry over there.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-15 16:12:59 +00:00
ahe
c76cf48f3e libweston/renderer-gl/gl-renderer.c: use glDeleteTextures() and update gs->num_textures if num_textures is decrased
Signed-off-by: ahe <Andreas.Heynig@meetwise.com>
2021-05-15 16:03:42 +00:00
Michael Olbrich
7803e83a94 wayland-backend: forward seats with the correct name
Use the real name of the seat instead of calling each seat 'default'. This makes
it easier to identify the current seat in a multi-seat environment.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2021-05-15 15:57:18 +00:00
Jonathan Marler
d3223cc4b4 data-device: cleanup after touch drag
This change fixes the "touch-up" operation to clear "data_source"
by setting "seat" to NULL.  This operation is done in the mouse button
release operation, but seems to have been forgotten in the "touch up"
case.

Forgetting this operation causes weston to send a "premature finish
request" error to the client which causes the client to exit.

This issue can be reproduced with the "weston-dnd" program by performing
a drag-and-drop operation with a touch input device. Once the drag
is released, the weston-dnd program will exit with an error.

Signed-off-by: Jonathan Marler <johnnymarler@gmail.com>
2021-05-15 15:54:03 +00:00
Jonathan Marler
5ba5a86a7f launcher: remove unused enum value
Signed-off-by: Jonathan Marler <johnnymarler@gmail.com>
2021-05-15 15:40:24 +00:00
Daniel Stone
3d9b73c9e5 drm/state-propose: Remove unnecessary check
If sprites_are_broken, then we will only ever arrive in renderer_only
mode, so this case will be caught by the checks above.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-05-15 15:24:12 +00:00
Damian Wrobel
d3630ace1a compositor: Improve logging message
Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
2021-05-14 14:57:06 +02:00
Marius Vlad
f722dc6f08 compositor: Prevent an invalid access against content protection
Avoids an user-after-free when destroying the surface, like in the
following ASAN message:

==25180==ERROR: AddressSanitizer: heap-use-after-free on address 0x6060000589d8 at pc 0x7ff70a4f7102 bp 0x7fff8f7e13b0 sp 0x7fff8f7e13a8
READ of size 8 at 0x6060000589d8 thread T0
    #0 0x7ff70a4f7101 in weston_schedule_surface_protection_update ../libweston/compositor.c:1163
    #1 0x7ff70a4f743b in weston_surface_update_output_mask ../libweston/compositor.c:1212
    #2 0x7ff70a4f7a47 in weston_surface_assign_output ../libweston/compositor.c:1298
    #3 0x7ff70a4f7f44 in weston_view_assign_output ../libweston/compositor.c:1348
    #4 0x7ff70a4fa12f in weston_view_update_transform ../libweston/compositor.c:1589
    #5 0x7ff70a4ffc20 in view_list_add ../libweston/compositor.c:2657
    #6 0x7ff70a5000ee in weston_compositor_build_view_list ../libweston/compositor.c:2688
    #7 0x7ff70a4fd577 in weston_view_destroy ../libweston/compositor.c:2202
    #8 0x7ff70a4fd7df in weston_surface_destroy ../libweston/compositor.c:2239
    #9 0x7ff70a4fdbb0 in destroy_surface ../libweston/compositor.c:2285
    #10 0x7ff70a4a2d3e in destroy_resource ../src/wayland-server.c:723
    #11 0x7ff70a4a8940 in for_each_helper ../src/wayland-util.c:372
    #12 0x7ff70a4a8e1f in wl_map_for_each ../src/wayland-util.c:385
    #13 0x7ff70a4a3748 in wl_client_destroy ../src/wayland-server.c:882
    #14 0x7ff6fe04e866 in shell_destroy ../desktop-shell/shell.c:5004
    #15 0x7ff70a4ee923 in wl_signal_emit /home/mvlad/install-amd64/include/wayland-server-core.h:481
    #16 0x7ff70a51598d in weston_compositor_destroy ../libweston/compositor.c:7903
    #17 0x7ff70a903a58 in wet_main ../compositor/main.c:3493
    #18 0x560de7b3b179 in main ../compositor/executable.c:33
    #19 0x7ff70a73ecc9 in __libc_start_main ../csu/libc-start.c:308
    #20 0x560de7b3b099 in _start (/home/mvlad/install-amd64/bin/weston+0x1099)

0x6060000589d8 is located 56 bytes inside of 64-byte region [0x6060000589a0,0x6060000589e0)
freed by thread T0 here:
    #0 0x7ff70a9d3b6f in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xa9b6f)
    #1 0x7ff70a5167d2 in cp_destroy_listener ../libweston/content-protection.c:193
    #2 0x7ff70a4ee923 in wl_signal_emit /home/mvlad/install-amd64/include/wayland-server-core.h:481
    #3 0x7ff70a51598d in weston_compositor_destroy ../libweston/compositor.c:7903
    #4 0x7ff70a903a58 in wet_main ../compositor/main.c:3493
    #5 0x560de7b3b179 in main ../compositor/executable.c:33
    #6 0x7ff70a73ecc9 in __libc_start_main ../csu/libc-start.c:308

previously allocated by thread T0 here:
    #0 0x7ff70a9d4037 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xaa037)
    #1 0x7ff70a5160aa in zalloc ../include/libweston/zalloc.h:38
    #2 0x7ff70a516cda in weston_compositor_enable_content_protection ../libweston/content-protection.c:329
    #3 0x7ff7070247e0 in drm_backend_create ../libweston/backend-drm/drm.c:3180
    #4 0x7ff707024cae in weston_backend_init ../libweston/backend-drm/drm.c:3250
    #5 0x7ff70a515d02 in weston_compositor_load_backend ../libweston/compositor.c:7999
    #6 0x7ff70a8fbcfb in load_drm_backend ../compositor/main.c:2614
    #7 0x7ff70a900b46 in load_backend ../compositor/main.c:3103
    #8 0x7ff70a902ecd in wet_main ../compositor/main.c:3380
    #9 0x560de7b3b179 in main ../compositor/executable.c:33
    #10 0x7ff70a73ecc9 in __libc_start_main ../csu/libc-start.c:308

SUMMARY: AddressSanitizer: heap-use-after-free ../libweston/compositor.c:1163 in weston_schedule_surface_protection_update

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-05-12 17:51:49 +03:00