[Xfce-bugs] [Bug 16632] New: Segfault when suspending without pm-suspend installed

bugzilla-daemon at xfce.org bugzilla-daemon at xfce.org
Sat Apr 4 15:33:57 CEST 2020


https://bugzilla.xfce.org/show_bug.cgi?id=16632

            Bug ID: 16632
           Summary: Segfault when suspending without pm-suspend installed
    Classification: Xfce Core
           Product: Xfce4-session
           Version: Unspecified
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Medium
         Component: General
          Assignee: xfce-bugs at xfce.org
          Reporter: piotr.trojanek at gmail.com
  Target Milestone: Xfce 4.14

Created attachment 9669
  --> https://bugzilla.xfce.org/attachment.cgi?id=9669&action=edit
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Xfce-bugs mailing list