! 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 !
Segfault when suspending without pm-suspend installed
Status:
RESOLVED: FIXED
Product:
Xfce4-session
Component:
General

Comments

Description Piotr Trojanek 2020-04-04 15:33:57 CEST
Created attachment 9669 
Patch for segmentation fault

When I click Log Out->Suspend in my XFCE4 on Debian 10 it sometimes fails to suspend my computer. Instead, a line like this appears in the system logs:

[157564.090376] traps: xfsm-shutdown-h[18010] general protection ip:7f5cd3b359bd sp:7ffc11a900a0 error:0 in libc-2.28.so[7f5cd3ad3000+148000]

When executed as root from the command it either works as expected, or emits this message:

# PKEXEC_UID=12345 /usr/lib/x86_64-linux-gnu/xfce4/session/xfsm-shutdown-helper --suspend

(xfsm-shutdown-helper:19816): GLib-WARNING **: 14:03:03.723: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Failed to execute child process ?/usr/sbin/pm-suspend? (No such file or directory)
Segmentation fault

Apparently the pm-utils package, which contains the /usr/sbin/pm-suspend utility, is not a dependency of XFCE in Debian, but still xfsm-shutdown-helper should handle this without a segfault.

I tracked this to be a violation of this rule (https://developer.gnome.org/glib/stable/glib-Error-Reporting.html#gerror-rules):
* A GError* must be initialized to NULL before passing its address to a function that can report errors. 

and the attached patch fixes Segmentation fault problem.

Now I reliably get:
# PKEXEC_UID=12345 ./xfsm-shutdown-helper --suspend
Failed to execute child process “/usr/sbin/pm-suspend” (No such file or directory)

I guess this also explains the "sometimes fails to suspend" behaviour, because occasionally the err variable could be initialized to NULL and then XFCE gracefully handled the missing pm-suspend command by trying some alternative method.
Comment 1 Git Bot editbugs 2020-05-01 11:50:51 CEST
Piotr Trojanek referenced this bugreport in commit 2cd5029d4b6be6ff9cbb7bec9fdc0216b95132c5

Bug #16632: Segfault when suspending without pm-suspend installed

https://gitlab.xfce.org/xfce/xfce4-session/commit/2cd5029d4b6be6ff9cbb7bec9fdc0216b95132c5
Comment 2 Skunnyk editbugs 2020-05-01 11:51:14 CEST
Thank you !
Comment 3 Git Bot editbugs 2020-05-01 12:04:12 CEST
Piotr Trojanek referenced this bugreport in commit 209c67febf16ff5bdd50e6c26630a9e04995f3a6

Bug #16632: Segfault when suspending without pm-suspend installed

https://gitlab.xfce.org/xfce/xfce4-session/commit/209c67febf16ff5bdd50e6c26630a9e04995f3a6

Bug #16632

Reported by:
Piotr Trojanek
Reported on: 2020-04-04
Last modified on: 2020-05-01

People

Assignee:
Xfce Bug Triage
CC List:
1 user

Version

Version:
Unspecified

Attachments

Patch for segmentation fault (442 bytes, patch)
2020-04-04 15:33 CEST , Piotr Trojanek
no flags

Additional information