swaylock icon indicating copy to clipboard operation
swaylock copied to clipboard

Application content leaks when output is rotated

Open epakai opened this issue 3 years ago • 6 comments

If the screen is locked with swaylock, rotating the device allows parts of the screen to become visible.

Set up is:

  • Surface Go 1. 1800x1200 display, with 1.5 DPI scaling.
  • Debian bullseye (testing)
  • swaylock 1.6-2 (Debian patches)
  • rot8 0.1.3 (accelerometer screen rotation daemon)

I experimented with making the render buffer square using the largest screen dimension (see diff below, not intended for use). This seems to be effective at keeping all of the screen covered when rotated, but the lock screen image will be inappropriately scaled.

  1 --- a/render.c
  2 +++ b/render.c
  3 @@ -34,9 +34,17 @@
  4
  5  void render_frame_background(struct swaylock_surface *surface) {
  6     struct swaylock_state *state = surface->state;
  7 +
  8 +    int buffer_width;
  9 +    int buffer_height;
 10
 11 -   int buffer_width = surface->width * surface->scale;
 12 -   int buffer_height = surface->height * surface->scale;
 13 +    if (surface->width > surface->height) {
 14 +        buffer_width = surface->width * surface->scale;
 15 +        buffer_height = surface->width * surface->scale;
 16 +    } else {
 17 +        buffer_width = surface->height * surface->scale;
 18 +        buffer_height = surface->height * surface->scale;
 19 +    }
 20     if (buffer_width == 0 || buffer_height == 0) {
 21         return; // not yet configured
 22     }

epakai avatar May 25 '22 05:05 epakai

Is this using ext-session-lock?

emersion avatar May 25 '22 06:05 emersion

[main.c:1250] Using wlr-layer-shell + wlr-input-inhibitor

I don't see the debug line for ext-session-lock so I'm assuming no.

epakai avatar May 25 '22 07:05 epakai

Please try with ext-session-lock.

emersion avatar May 25 '22 07:05 emersion

I looked into it and I'm not clear on enabling it. From looking at a few other github issues it seems like this would require a newer version of sway, and a newer version of wlroots. Can you clarify, and I'll see if I can try it out?

In any case it sounds like this is the expected direction for swaylock, and wlr-layer-shell is to be deprecated so perhaps this issue won't be addressed directly.

epakai avatar May 26 '22 04:05 epakai

I'm experiencing the same thing on a GPD Pocket 3 running Guix System with swaylock v1.6-3, and what about to open a new issue when I found that one. I thought about suggesting the same fix too, i.e., using a square lock screen with the longest screen dimension as side. I wonder if that vulnerability could not be used too when connecting an external monitor on an already locked device?

I am not sure how to try ext-session-lock either, I'm afraid there may be no package available for that in Guix.

Kabouik avatar Sep 18 '22 22:09 Kabouik

I am not sure how to try ext-session-lock either

sway master implements the protocol.

kennylevinsen avatar Sep 19 '22 07:09 kennylevinsen

the screen leaks also when the scaling is reset IMG_20221125_063139_414

(sway 1.7 with im patch and swaylock 1.6-3)

ngkz avatar Nov 24 '22 21:11 ngkz

sway 1.7

sway 1.7 did not have ext-session-lock support, which is what fixes this issue.

Closing as this is fixed by ext-session-lock and just requires a new enough sway version (master at the time of writing, but 1.8 when released will also have it).

kennylevinsen avatar Nov 24 '22 23:11 kennylevinsen