Bug 580393 - nm-system-settings segv, when dbus is stopped
Summary: nm-system-settings segv, when dbus is stopped
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: NetworkManager
Version: 5.5
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Dan Williams
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks: 653345
TreeView+ depends on / blocked
 
Reported: 2010-04-08 07:25 UTC by ritz
Modified: 2019-10-10 09:00 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Prior to this update, stopping the messagebus service (either manually, or during a routine system shutdown) may have caused certain NetworkManager components to terminate unexpectedly with a segmentation fault. With this update, the underlying source code has been modified to target this issue, and NetworkManager components now exit with 0 return code when the messagebus service is stopped.
Clone Of:
Environment:
Last Closed: 2011-07-21 07:57:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch based on upstream code (6.34 KB, patch)
2010-04-08 08:06 UTC, ritz
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1023 0 normal SHIPPED_LIVE NetworkManager bug fix update 2011-07-20 15:44:23 UTC

Description ritz 2010-04-08 07:25:38 UTC
Description of problem:
nm-system-settings segfault when quitting cleanly

Version-Release number of selected component (if applicable):
NetworkManager-0.7.0-10.el5

How reproducible:
always

Steps to Reproduce:
1. service messagebus stop
  
Actual results:
nm-system-settings: disconnected from the system bus, exiting.
nm-system-setti[31328]: segfault at 0000000000000000 rip 0000000000000000 rsp 00007fff4ac2b668 error 14

Expected results:
should not crash

Comment 1 ritz 2010-04-08 08:06:28 UTC
Created attachment 405216 [details]
patch based on upstream code

commit f90d079858c12c92f3d1bca433d8b2314cd2df36
Author: Dan Williams <dcbw>
Date:   Tue Feb 17 10:42:25 2009 -0500

    system-settings: fix shutdown issues
    
    Shutdown on SIGTERM, and don't segfault when quitting cleanly.  Can't
    send signals on an object that's being disposed of, so don't do that.
    Fix a memory leak of the Hal manager's priv->devices on shutdown, not
    that it matters.


Additionally, updated system-settings/plugins/ifcfg-rh/plugin.c
 * don't segfault on NULL errors

Comment 3 ritz 2010-04-09 17:08:38 UTC
NetworkManager 0.7 on EL5 bundles gfilemonitor, and a rather ancient copy. The glocalfilemonitor class does not define cancel option. A simple workaround would be to update  "gfilemonitor.c:g_file_monitor_cancel", to check if cancel function has been defined, and if yes, to execute it as shown below

gboolean
g_file_monitor_cancel (GFileMonitor* monitor)
{
  GFileMonitorClass *klass;
...
  klass = G_FILE_MONITOR_GET_CLASS (monitor);

  if (klass && klass->cancel)
    return (* klass->cancel) (monitor);
  else
    return FALSE;
}

Additional note:
gfilemonitor on EL5 uses inotify helper with gfilemonitor.c, whereas upstream has a separate class ginotifyfilemonitor.c. I did try updating gfilemonitor.c to use _ih_sub_cancel, after defining g_local_file_monitor_cancel, which oddly failed.

Comment 4 Dan Williams 2010-04-09 21:33:06 UTC
Thanks for the analysis; this seems pretty safe to fix for 5.6.

QE: reproducer is in first comment.

Comment 10 Dan Williams 2010-11-12 22:20:52 UTC
QE: easy reproducer steps:

1) service NetworkManager stop
2) killall -TERM nm-system-settings
3) /usr/sbin/nm-system-settings --debug --plugins=ifcfg-rh
4) service messagebus stop

If the bug still exists, you'll see:

*** (nm-system-settings:XXXXX): WARNING **: disconnected from the system bus, exiting
Segmentation fault.

If the bug is fixed, you should no longer see the segfault message.

Comment 13 Jaromir Hradilek 2010-11-30 13:35:47 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Prior to this update, stopping the messagebus service (either manually, or during a routine system shutdown) may have caused certain NetworkManager components to terminate unexpectedly with a segmentation fault. With this update, the underlying source code has been modified to target this issue, and NetworkManager components now exit with 0 return code when the messagebus service is stopped.

Comment 18 errata-xmlrpc 2011-07-21 07:57:29 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1023.html


Note You need to log in before you can comment on or make changes to this bug.