Skip to content
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

cagebreak: 1.6.0 -> 1.7.0 #119963

Closed
wants to merge 2 commits into from
Closed

Conversation

Synthetica9
Copy link
Member

@Synthetica9 Synthetica9 commented Apr 20, 2021

Motivation for this change

Tests still failing, related to the failure in #119615

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot requested a review from berbiche April 20, 2021 16:41
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Apr 20, 2021
@Synthetica9
Copy link
Member Author

But in this one I got an actual backtrace with -fsanitize=address!

00:00:00.572 [ERROR] [backend/drm/atomic.c:35] connector DP-1: Atomic commit failed (modeset): Invalid argument
00:00:01.848 [ERROR] [../cagebreak.c:186] Could not open config file "/home/synthetica/.config/cagebreak/config"
=================================================================
==88383==ERROR: AddressSanitizer: heap-use-after-free on address 0x61500002df88 at pc 0x000000420744 bp 0x7ffed0623660 sp 0x7ffed0623658
READ of size 8 at 0x61500002df88 thread T0
    #0 0x420743 in seat_set_focus (/nix/store/r1n5267ndk9rf4qcp55lkjkid1mkm0ij-cagebreak-1.7.0/bin/.cagebreak-wrapped+0x420743)
    #1 0x40eadf in keybinding_cycle_outputs (/nix/store/r1n5267ndk9rf4qcp55lkjkid1mkm0ij-cagebreak-1.7.0/bin/.cagebreak-wrapped+0x40eadf)
    #2 0x41518f in output_clear (/nix/store/r1n5267ndk9rf4qcp55lkjkid1mkm0ij-cagebreak-1.7.0/bin/.cagebreak-wrapped+0x41518f)
    #3 0x415343 in output_destroy (/nix/store/r1n5267ndk9rf4qcp55lkjkid1mkm0ij-cagebreak-1.7.0/bin/.cagebreak-wrapped+0x415343)
    #4 0x7f093ebc144b in wlr_signal_emit_safe (/nix/store/jvkgicprzd0sq9akf6kjx9fgcyfljibz-wlroots-0.13.0/lib/libwlroots.so.8+0x7744b)
    #5 0x7f093ebad7e8 in wlr_output_damage_destroy (/nix/store/jvkgicprzd0sq9akf6kjx9fgcyfljibz-wlroots-0.13.0/lib/libwlroots.so.8+0x637e8)
    #6 0x7f093ebc144b in wlr_signal_emit_safe (/nix/store/jvkgicprzd0sq9akf6kjx9fgcyfljibz-wlroots-0.13.0/lib/libwlroots.so.8+0x7744b)
    #7 0x7f093ebb31b9 in wlr_output_destroy (/nix/store/jvkgicprzd0sq9akf6kjx9fgcyfljibz-wlroots-0.13.0/lib/libwlroots.so.8+0x691b9)
    #8 0x7f093eb7f934 in destroy_drm_connector (/nix/store/jvkgicprzd0sq9akf6kjx9fgcyfljibz-wlroots-0.13.0/lib/libwlroots.so.8+0x35934)
    #9 0x7f093eb7c49c in backend_destroy.part.0 (/nix/store/jvkgicprzd0sq9akf6kjx9fgcyfljibz-wlroots-0.13.0/lib/libwlroots.so.8+0x3249c)
    #10 0x7f093eb87964 in multi_backend_destroy (/nix/store/jvkgicprzd0sq9akf6kjx9fgcyfljibz-wlroots-0.13.0/lib/libwlroots.so.8+0x3d964)
    #11 0x7f093ec10dbc in wl_display_destroy (/nix/store/7fnq0qvpvgj04gdf2l6hmgpz8dk72r1z-wayland-1.19.0/lib/libwayland-server.so.0+0x8dbc)
    #12 0x408da4 in main (/nix/store/r1n5267ndk9rf4qcp55lkjkid1mkm0ij-cagebreak-1.7.0/bin/.cagebreak-wrapped+0x408da4)
    #13 0x7f093e96cdec in __libc_start_main (/nix/store/1jn6apz0fa9h9x7rl3v6vwiymwnjznwv-glibc-2.32-40/lib/libc.so.6+0x27dec)
    #14 0x40a429 in _start (/nix/store/r1n5267ndk9rf4qcp55lkjkid1mkm0ij-cagebreak-1.7.0/bin/.cagebreak-wrapped+0x40a429)

0x61500002df88 is located 8 bytes inside of 504-byte region [0x61500002df80,0x61500002e178)
freed by thread T0 here:
    #0 0x7f093f112b6f in __interceptor_free (/nix/store/hsw0sq8y0a46fxc2d7krgyr6p5dy71kd-gcc-10.2.0-lib/lib/libasan.so.6+0xacb6f)
    #1 0x7f093ebc144b in wlr_signal_emit_safe (/nix/store/jvkgicprzd0sq9akf6kjx9fgcyfljibz-wlroots-0.13.0/lib/libwlroots.so.8+0x7744b)
    #2 0x60f0000088bf  (<unknown module>)

previously allocated by thread T0 here:
    #0 0x7f093f113037 in __interceptor_calloc (/nix/store/hsw0sq8y0a46fxc2d7krgyr6p5dy71kd-gcc-10.2.0-lib/lib/libasan.so.6+0xad037)
    #1 0x41f7d2 in seat_create (/nix/store/r1n5267ndk9rf4qcp55lkjkid1mkm0ij-cagebreak-1.7.0/bin/.cagebreak-wrapped+0x41f7d2)
    #2 0x60d00000044f  (<unknown module>)

SUMMARY: AddressSanitizer: heap-use-after-free (/nix/store/r1n5267ndk9rf4qcp55lkjkid1mkm0ij-cagebreak-1.7.0/bin/.cagebreak-wrapped+0x420743) in seat_set_focus
Shadow bytes around the buggy address:
  0x0c2a7fffdba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2a7fffdbb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2a7fffdbc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2a7fffdbd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa
  0x0c2a7fffdbe0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c2a7fffdbf0: fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2a7fffdc00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2a7fffdc10: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2a7fffdc20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa
  0x0c2a7fffdc30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2a7fffdc40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==88383==ABORTING

@legendofmiracles
Copy link
Contributor

Result of nixpkgs-review pr 119963 run on x86_64-linux 1

1 package built:
  • cagebreak

@Synthetica9 Synthetica9 marked this pull request as draft April 20, 2021 17:07
@r-rmcgibbo
Copy link

Result of nixpkgs-review pr 119963 at b6ba402a run on x86_64-linux 1

1 package built successfully:
  • cagebreak
1 suggestion:
  • warning: build-tools-in-build-inputs

    pandoc is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/applications/window-managers/cagebreak/default.nix:26:3:

       |
    26 |   buildInputs = [
       |   ^
    

@berbiche
Copy link
Member

@Synthetica9 IIRC cagebreak will crash on startup if the config file is missing (poor UX choice imo)

@Synthetica9
Copy link
Member Author

@Synthetica9 IIRC cagebreak will crash on startup if the config file is missing (poor UX choice imo)

Oh, yeah, that's very poor UX, but thanks for the heads-up

@berbiche berbiche mentioned this pull request Apr 27, 2021
10 tasks
@github-actions github-actions bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Apr 30, 2021
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Apr 30, 2021
@Synthetica9 Synthetica9 marked this pull request as ready for review April 30, 2021 14:48
@Synthetica9 Synthetica9 marked this pull request as draft April 30, 2021 14:55
Copy link
Member

@primeos primeos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might be already on it but could you also rebase to resolve the merge conflict and limit the test to x86_64-linux (28b8cff#diff-307c155c790abf7b54b5dec19dc230c6d692c6dca0604760d8389c7aed543c10R50)?

nixos/tests/cagebreak.nix Outdated Show resolved Hide resolved
@primeos
Copy link
Member

primeos commented May 1, 2021

Yesterday I had a brief look at this and got the following output for nix-build -A nixosTests.cagebreak:

machine # [    9.081583] xsession[933]: 00:00:00.002 [ERROR] [backend/x11/backend.c:433] X11 does not support DRI3 extension
machine # [    9.083267] xsession[933]: 00:00:00.004 [ERROR] [../cagebreak.c:313] Unable to create the wlroots backend
machine # [    9.196526] show_signal_msg: 77 callbacks suppressed
machine # [    9.196542] .cagebreak-wrap[933]: segfault at 8 ip 0000000000408574 sp 00007ffd441af370 error 4 in .cagebreak-wrapped[407000+d000]
machine # [    9.198950] Code: f4 ff ff 4c 8b 84 24 70 01 00 00 8d 45 01 48 89 c5 49 8b 3c c0 48 85 ff 75 e4 4c 89 c7 e8 84 f4 ff ff 48 8b bc 24 18 01 00 00 <48> 8b 47 08 4c 8d 6f d8 48 8d 68 d8 48 39 df 75 0e eb 36 66 0f 1f
machine # [    9.107703] systemd[1]: Created slice system-systemd\x2dcoredump.slice.
machine # [    9.111248] systemd[1]: Started Process Core Dump (PID 935/UID 0).
machine # [    9.192686] systemd-coredump[936]: Process 933 (.cagebreak-wrap) of user 1000 dumped core.
machine # [    9.202025] systemd[1]: [email protected]: Succeeded.
machine # [    9.213734] xsession[925]: /nix/store/di4ylzjkpqg9v3jzp6d2y43lscm3wj36-xsession: line 21:   933 Segmentation fault      (core dumped) /nix/store/sfhniimqs51gp2blcrqsya6rli08dpb4-cagebreak-1.7.0/bin/cagebreak
machine # [    9.227817] systemd[918]: Stopped target Current graphical user session.
machine # [    9.233687] lightdm[913]: pam_unix(lightdm-autologin:session): session closed for user alice
machine # [    9.239386] systemd-logind[559]: Session 1 logged out. Waiting for processes to exit.
machine # [    9.246370] systemd[1]: session-1.scope: Succeeded.
machine # [    9.247607] systemd-logind[559]: Removed session 1.
machine # [    9.800322] systemd-logind[559]: New session c1 of user lightdm.

The first message (X11 does not support DRI3 extension) comes from wlroots and got my attention. It seems like wlroots 0.13 started requiring DRI3 for the X11 backend and apparently that isn't supported for virtual GPU drivers (which kinda makes sense although virtio is pretty fast and supports 3D acceleration). I haven't analyzed this further though.

Starting Cagebreak directly is likely the best solution but I haven't looked much into Wayland tests so far (wanted to investigate manually logging in via a VT/tty for a Sway test but never got around to that).
Edit: I finally gave it a go: #121437.

Note: I'll rebase this PR to resolve the merge conflict (2da39dd).

@primeos primeos force-pushed the cagebreak-1.7.0 branch from 5386cb9 to d68809b Compare May 1, 2021 18:41
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label May 1, 2021
@ofborg ofborg bot requested a review from berbiche May 1, 2021 18:51
@primeos primeos mentioned this pull request May 14, 2021
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants