forked from IcebergThings/weston
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix initial window position by shell is over-written by configure_notify #19
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spronovo
approved these changes
May 28, 2021
hideyukn88
pushed a commit
that referenced
this pull request
Oct 20, 2021
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>
hideyukn88
pushed a commit
that referenced
this pull request
Oct 20, 2021
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>
hideyukn88
pushed a commit
that referenced
this pull request
Oct 20, 2021
Fixes ASan leak: Direct leak of 80 byte(s) in 1 object(s) allocated from: #0 0x7fe7791f4518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518) #1 0x7fe779100892 in zalloc ../../git/wayland/src/wayland-private.h:232 #2 0x7fe779100892 in proxy_create ../../git/wayland/src/wayland-client.c:422 #3 0x7fe779100ede in create_outgoing_proxy ../../git/wayland/src/wayland-client.c:651 #4 0x7fe779100ede in wl_proxy_marshal_array_constructor_versioned ../../git/wayland/src/wayland-client.c:736 #5 0x7fe779101226 in wl_proxy_marshal_constructor ../../git/wayland/src/wayland-client.c:834 #6 0x56428c9bc578 in zwp_input_panel_v1_get_input_panel_surface protocol/input-method-unstable-v1-client-protocol.h:678 #7 0x56428c9c0bbb in set_toplevel ../../git/weston/clients/keyboard.c:965 #8 0x56428c9c0c8d in display_output_handler ../../git/weston/clients/keyboard.c:980 #9 0x56428c9ddead in display_handle_mode ../../git/weston/clients/window.c:5700 #10 0x7fe7786668ed in ffi_call_unix64 (/lib/x86_64-linux-gnu/libffi.so.6+0x68ed) #11 0x7fe7786662be in ffi_call (/lib/x86_64-linux-gnu/libffi.so.6+0x62be) #12 0x7fe779103fac in wl_closure_invoke ../../git/wayland/src/connection.c:1018 #13 0x7fe779100a48 in dispatch_event ../../git/wayland/src/wayland-client.c:1452 #14 0x7fe779101e43 in dispatch_queue ../../git/wayland/src/wayland-client.c:1598 #15 0x7fe779101e43 in wl_display_dispatch_queue_pending ../../git/wayland/src/wayland-client.c:1840 #16 0x56428c9e031c in handle_display_data ../../git/weston/clients/window.c:6211 #17 0x56428c9e2147 in display_run ../../git/weston/clients/window.c:6553 #18 0x56428c9c1559 in main ../../git/weston/clients/keyboard.c:1053 #19 0x7fe77885e09a in __libc_start_main ../csu/libc-start.c:308 #20 0x56428c9bc029 in _start (/home/pq/build/weston-meson/clients/weston-keyboard+0x19029) Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses the regression introduced by #17. That PR allows frame window to be movable by configure_notify. but there is a case configure_notify is called with window position from where frame window is created and there is a race condition that configure_notify comes after window is positioned by shell. Thus certain application (such as nedit) always placed at upper-left corner of desktop. This PR address that by calling xcb_create_window is specific value (SHRT_MIN) and ignore that at configure_notify. SHRT_MIN is unlikely used for window placement, so hopefully it's safe to ignore for positioning frame window. Tested with both desktop-shell (does not support moving toplevel window) and rdprail-shell (does support moving toplevel window).