Bug 1050934

Summary: [abrt] NetworkManager-pptp: _g_log_abort(): nm-pptp-service killed by SIGTRAP
Product: [Fedora] Fedora Reporter: Christopher Meng <i>
Component: NetworkManager-pptpAssignee: Dan Williams <dcbw>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: danw, dcbw, jklimes, thaller
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/1fd64cf79cd3e43044a8bef76132a56a17ca08b9
Whiteboard: abrt_hash:6dfc68c40496c5fe1bbb80b769c4cb45803eb2dc
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-26 11:24:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: cgroup
none
File: core_backtrace
none
File: dso_list
none
File: environ
none
File: limits
none
File: maps
none
File: open_fds
none
File: proc_pid_status
none
File: var_log_messages
none
[patch] jk/rh1050934-vpn-plugin-init none

Description Christopher Meng 2014-01-09 11:33:20 UTC
Description of problem:
[rpmaker@fab Desktop]$ /usr/libexec/nm-pptp-service 

** (nm-pptp-service:18984): WARNING **: Failed to initialize VPN plugin: Connection ":1.127" is not allowed to own the service "org.freedesktop.NetworkManager.pptp" due to security policies in the configuration file

(nm-pptp-service:18984): GLib-GObject-ERROR **: object NMPptpPlugin 0x94b2898 finalized while still in-construction
Trace/breakpoint trap (core dumped)

Maybe selinux related.

Version-Release number of selected component:
NetworkManager-pptp-0.9.8.2-3.fc21

Additional info:
reporter:       libreport-2.1.10
backtrace_rating: 4
cmdline:        /usr/libexec/nm-pptp-service
crash_function: _g_log_abort
executable:     /usr/libexec/nm-pptp-service
kernel:         3.13.0-0.rc7.git0.2.fc21.i686+PAE
runlevel:       N 5
type:           CCpp
uid:            1000

Truncated backtrace:
Thread no. 1 (8 frames)
 #0 _g_log_abort at gmessages.c:309
 #3 g_object_finalize at gobject.c:1029
 #4 finalize at nm-vpn-plugin.c:890
 #6 constructor at nm-vpn-plugin.c:800
 #7 g_object_new_with_custom_constructor at gobject.c:1648
 #8 g_object_new_internal at gobject.c:1725
 #9 g_object_new_valist at gobject.c:1983
 #11 nm_pptp_plugin_new at nm-pptp-service.c:1288

Comment 1 Christopher Meng 2014-01-09 11:33:29 UTC
Created attachment 847579 [details]
File: backtrace

Comment 2 Christopher Meng 2014-01-09 11:33:32 UTC
Created attachment 847580 [details]
File: cgroup

Comment 3 Christopher Meng 2014-01-09 11:33:38 UTC
Created attachment 847581 [details]
File: core_backtrace

Comment 4 Christopher Meng 2014-01-09 11:33:44 UTC
Created attachment 847582 [details]
File: dso_list

Comment 5 Christopher Meng 2014-01-09 11:34:00 UTC
Created attachment 847583 [details]
File: environ

Comment 6 Christopher Meng 2014-01-09 11:34:03 UTC
Created attachment 847584 [details]
File: limits

Comment 7 Christopher Meng 2014-01-09 11:34:09 UTC
Created attachment 847585 [details]
File: maps

Comment 8 Christopher Meng 2014-01-09 11:34:16 UTC
Created attachment 847586 [details]
File: open_fds

Comment 9 Christopher Meng 2014-01-09 11:34:20 UTC
Created attachment 847587 [details]
File: proc_pid_status

Comment 10 Christopher Meng 2014-01-09 11:34:27 UTC
Created attachment 847588 [details]
File: var_log_messages

Comment 11 Jirka Klimes 2014-03-17 13:07:36 UTC
** (nm-pptp-service:18984): WARNING **: Failed to initialize VPN plugin: Connection ":1.127" is not allowed to own the service "org.freedesktop.NetworkManager.pptp" due to security policies in the configuration file

1月 09 18:02:25 fab.cicku.me dbus-daemon[539]: dbus[539]: [system] Rejected send message, 3 matched rules; type="error", sender=":1.107" (uid=0 pid=16419 comm="/usr/libexec/nm-pptp-service --debug ") interface="(unset)" member="(unset)" error name="org.freedesktop.DBus.Error.UnknownMethod" requested_reply="0" destination=":1.108" (uid=0 pid=16422 comm="/sbin/pppd pty /sbin/pptp 10.6.205.202 --nolaunchp")

There were problems with D-Bus communication. They caused NMVPNPlugin constructor() to fail, and a crash/abort resulted due to destroying self-object in the constructor.

Fix the crash by reworking NMVPNPlugin initialization:
branch jk/rh1050934-vpn-plugin-init

Comment 12 Thomas Haller 2014-03-17 13:17:14 UTC
Looks good!!

Comment 13 Jirka Klimes 2014-03-17 16:36:38 UTC
Also, we need to change the creation of the plugin. I have pushed the code to the plugins' repositories. Branches:
jk/vpnc-plugin-init
jk/openvpn-plugin-init
jk/pptp-plugin-init
jk/openconnect-plugin-init

You can test with these scratch builds (rawhide):
NetworkManager:
  http://koji.fedoraproject.org/koji/taskinfo?taskID=6640684
NetworkManager-vpnc:
  http://koji.fedoraproject.org/koji/taskinfo?taskID=6641334

Comment 14 Jirka Klimes 2014-03-18 11:15:05 UTC
And jk/openswan-plugin-init too.

Comment 15 Thomas Haller 2014-03-18 12:00:41 UTC
Thinking about this again, I'd say that the patch in libnm-glib must be changed so that the constructor still operates as before, but in error case, it must not unref @self, instead it must set an internal GError instance.

initable_init() in error case just returns FALSE and the internal GError instance.

In other words, initable_init() should not do anything required for the object to function properly, so that old plugins can get away with creating the object with g_object_new().


This way, old plugins using g_object_new() will still work. If an error happens, they are doomed -- but that would not have been any different before this patch.
New plugins instead use g_initable_new() so that the can fail gracefully.

Comment 16 Thomas Haller 2014-03-18 12:06:13 UTC
The patches to all the plugins look good to me.

Only thing, I would change

- g_warning ("%s", error->message);
+ g_warning ("Error initiating VPN plugin: %s", error->message);

Comment 17 Dan Winship 2014-03-20 20:54:31 UTC
Note that the abort-on-finalize-during-construction behavior was reverted later, and the current version of glib in rawhide (glib2-2.39.92-1.fc21) just prints a warning in this case (in addition to the warning that it already printed for returning NULL from construct.)

And as Thomas says, requiring the use of the GInitable API is an API break, so we shouldn't do that.

Comment 18 Dan Williams 2014-03-20 22:47:44 UTC
Yeah, we can't quite break the API yet.  There are external plugins (iodine, ssh, etc) that we should try to keep working.

Comment 19 Christopher Meng 2015-02-26 11:24:36 UTC
Thank you everyone above, I just read about this...

Comment 20 Thomas Haller 2016-02-23 15:29:07 UTC
Created attachment 1129820 [details]
[patch] jk/rh1050934-vpn-plugin-init

I attach here Jirka's patch jk/rh1050934-vpn-plugin-init for historical reference. It applies on commit a1e89b4d29b97695f21e0070888f7910f7fe7a87.


I think the patch is wrong, because it requires users to call g_initable_init(), which is an API break.