! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Suspend + lock screen works a bit insecure
Status:
RESOLVED: MOVED
Product:
Xfce4-session
Component:
General

Comments

Description siukola.antti 2013-05-15 07:20:39 CEST
Running XFCE on Xubuntu 13.04 and noticed that suspend + lock screen doesn't always work as expected. When I'm suspending the system and the option "Lock screen when going for suspend/hibernate" is used, the system seeems to suspend normally. However, when waking up the system yet again, I see a short glance of the desktop that was on when suspending. Only after that I get the lock screen password prompt. This happens randomly, not always.
Comment 1 siukola.antti 2013-05-15 07:22:58 CEST
Running 'xflock4 && xfce4-session-logout -s' is a workaround
Comment 2 Jarno Suni 2014-01-03 13:39:39 CET
Downstream report: https://bugs.launchpad.net/ubuntu/+source/xfce4-session/+bug/1054299

The caller of xflock4 should wait until xflock4 exits, i.e. not run xflock4 in background.

This is an issue with xfce4-power-manager, as well.
Please, see https://bugzilla.xfce.org/show_bug.cgi?id=6413
Especially comments 1 and 2.
Comment 3 Jarno Suni 2014-02-27 18:32:43 CET
Please note that even the workaround given in Comment 1 does not work in principle, if xflock4 uses one of the lockers that start in background. Those include xlock, slock, slimlock or any locker configured with xautolock, when considering the proposed xflock4:
http://bug-attachment.xfce.org/attachment.cgi?id=5359
(featured within https://bugzilla.xfce.org/show_bug.cgi?id=10217)
Comment 4 Jarno Suni 2014-09-22 00:46:48 CEST
(In reply to siukola.antti from comment #1)
> Running 'xflock4 && xfce4-session-logout -s' is a workaround

Yes, if xflock4 uses xscreensaver, but if it uses light-locker, the script doesn't work according to my experience in Ubuntu Studio 14.04: the logout command requests password in background.
Comment 5 Jarno Suni 2017-07-09 17:31:14 CEST
(In reply to siukola.antti from comment #0)
> Running XFCE on Xubuntu 13.04 and noticed that suspend + lock screen doesn't
> always work as expected. When I'm suspending the system and the option "Lock
> screen when going for suspend/hibernate" is used, the system seeems to
> suspend normally. However, when waking up the system yet again, I see a
> short glance of the desktop that was on when suspending. Only after that I
> get the lock screen password prompt. This happens randomly, not always.

If I have understood correctly, xfce4-session nowadays waits until xflock4 finishes, before it suspends. The problem was especially with xscreensaver, since it can be configured to fade screen given time and it may slow anyway [1]. However, since current xflock4 runs 'xscreensaver-command -lock' in foreground, it waits until the fading is complete.

[1] https://bugs.launchpad.net/ubuntu/+source/xscreensaver/+bug/1701917
Comment 6 Jarno Suni 2018-08-21 20:28:33 CEST
I have to take words back. In Xubuntu 16.04 and 18.04 system does not wait until xflock4 finishes before suspending, so the bug seems to be present in Xfce 4.12
Comment 7 Jarno Suni 2018-09-15 00:17:29 CEST
The bug is in xfce4-session/xfce-screensaver.c (and in xfce4-session/xfsm-systemd.c before git commit  9fa8c63b4377bcb46b8471da509ff8bd909c4bf0).

A locker should be called syncronously, not by g_spawn_command_line_async (), but by g_spawn_command_line_sync () or directly by g_spawn_sync(), and the provided exit_status should be taken into account.
https://developer.gnome.org/glib/stable/glib-Spawning-Processes.html#g-spawn-command-line-sync

I.e. something like this:

gint *exit_status
g_spawn_command_line_sync ("xflock4", NULL, NULL, exit_status, NULL);
if (exit_status != NULL && *exit_status == 0) return TRUE;
return FALSE;
Comment 8 Jarno Suni 2018-09-23 10:43:16 CEST
I have provided a patch for xfce4-session 4.12.1 at https://bugs.launchpad.net/ubuntu/+source/xfce4-session/+bug/1054299/comments/39
However, when the patch is applied, there is some issue with error handling. Besides, Xubuntu 18.04 does not have pm-utils installed (and thus pm-suspend does not work): https://bugs.launchpad.net/ubuntu/+source/xfce4-session/+bug/1054299/comments/47
Comment 9 Jarno Suni 2019-04-27 00:13:46 CEST
So could g_spawn_command_line_sync be used in case of SCREENSAVER_TYPE_OTHER in xfce_screensaver_lock?
Comment 10 2.acc.von 2020-03-15 15:12:20 CET
So I wrote a patch for 4.14. [1] I have not tested it, as I don't know how to start my xfce4-session. startxfce4 should maybe have some configuration options to point it to another xfce4-session.


[1]: https://bugs.launchpad.net/ubuntu/+source/xfce4-session/+bug/1054299/comments/65


Note: maybe the 2 second wait here can be removed now. I don't know, when this lock_screen() function is called, though.
https://git.xfce.org/xfce/xfce4-session/tree/xfce4-session/xfsm-shutdown-fallback.c?h=xfce-4.14#n348
Comment 11 2.acc.von 2020-03-15 18:55:21 CET
Created attachment 9607 
For 4.14

Not really tested.
Comment 12 2.acc.von 2020-03-15 18:56:14 CET
Created attachment 9608 
For 4.12

Untested.
Comment 13 2.acc.von 2020-03-15 19:26:39 CET
Ok, so I tested the 4.14 patch by suspending once. My xscreensaver dimmed the screen until it was completely black and than the pc suspended.
Comment 14 Jarno Suni 2020-03-21 00:04:55 CET
That sounds great! I which that fix could be released soon and even backported.
Comment 15 Git Bot editbugs 2020-05-26 00:43:43 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/xfce/xfce4-session/-/issues/15.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #10089

Reported by:
siukola.antti
Reported on: 2013-05-15
Last modified on: 2020-05-26

People

Assignee:
Xfce Bug Triage
CC List:
4 users

Version

Version:
4.10.0

Attachments

For 4.14 (3.19 KB, patch)
2020-03-15 18:55 CET , 2.acc.von
no flags
For 4.12 (3.04 KB, patch)
2020-03-15 18:56 CET , 2.acc.von
no flags

Additional information