Bug 972731 - cryptkeeper-0.9.5-7.fc19.x86_64 segfaults in Rawhide (glibc-2.17.90-1.fc20.x86_64)
cryptkeeper-0.9.5-7.fc19.x86_64 segfaults in Rawhide (glibc-2.17.90-1.fc20.x8...
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: cryptkeeper (Show other bugs)
20
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Hicham HAOUARI
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-10 09:35 EDT by Tom London
Modified: 2015-06-29 08:00 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-06-29 08:00:12 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to encfs_wrapper.cpp to check for realpath() returning NULL (599 bytes, patch)
2013-06-18 09:55 EDT, Tom London
no flags Details | Diff

  None (edit)
Description Tom London 2013-06-10 09:35:50 EDT
Description of problem:


Core was generated by `/usr/bin/cryptkeeper'.
Program terminated with signal 11, Segmentation fault.
#0  __strcmp_ssse3 () at ../sysdeps/x86_64/strcmp.S:210
210		movlpd	(%rsi), %xmm2
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib64/libgobject-2.0.so.0.3701.0-gdb.py", line 9, in <module>
    from gobject import register
  File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in <module>
    import gdb.backtrace
ImportError: No module named backtrace
(gdb) set pagination off
(gdb) bt full
#0  __strcmp_ssse3 () at ../sysdeps/x86_64/strcmp.S:210
No locals.
#1  0x0000000000404eb9 in is_mounted (mount_dir=mount_dir@entry=0x16d01b0 "/home/tbl/FileVault") at encfs_wrapper.cpp:49
        m = <optimized out>
        f = 0x1873aa0
#2  0x000000000040544b in encfs_stash_mount (crypt_dir=0x16d0210 "/home/tbl/.FileVault_encfs", mount_dir=0x16d01b0 "/home/tbl/FileVault", password=password@entry=0x186e490 "504 Class of '28", idle_timeout=0, allow_other=<optimized out>, output=output@entry=0x7fff242028c8) at encfs_wrapper.cpp:237
        fd = {14, 15}
        status_fd = {16, 17}
        __PRETTY_FUNCTION__ = "int encfs_stash_mount(const char*, const char*, const char*, int, bool, char**)"
        pid = 1992
        status = 0
        pfd = {fd = 16, events = 1, revents = 0}
#3  0x0000000000408ccd in on_mount_check_item_toggled (mi=<optimized out>, idx=<optimized out>) at main.cpp:291
        d = 0x186e680
        password = 0x186e490 "504 Class of '28"
        message = 0x0
#4  0x0000003052e10108 in g_closure_invoke (closure=0x1834920, return_value=return_value@entry=0x0, n_param_values=1, param_values=param_values@entry=0x7fff24202a90, invocation_hint=invocation_hint@entry=0x7fff24202a30) at gclosure.c:777
        marshal = 0x3052e11e10 <g_cclosure_marshal_VOID__VOID>
        marshal_data = 0x0
        in_marshal = 0
        real_closure = 0x1834900
        __PRETTY_FUNCTION__ = "g_closure_invoke"
#5  0x0000003052e2251d in signal_emit_unlocked_R (node=node@entry=0x16a3400, detail=detail@entry=0, instance=instance@entry=0x183d050, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fff24202a90) at gsignal.c:3582
        tmp = <optimized out>
        handler = 0x7f13b000baa0
        accumulator = 0x0
        emission = {next = 0x7fff24202e40, instance = 0x183d050, ihint = {signal_id = 98, detail = 0, run_type = G_SIGNAL_RUN_FIRST}, state = EMISSION_RUN, chain_type = 4}
        handler_list = 0x7f13b000baa0
        return_accu = 0x0
        accu = {g_type = 0, data = {{v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}, {v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}}}
        signal_id = 98
        max_sequential_handler_number = 751
        return_value_altered = 1
#6  0x0000003052e2a732 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fff24202c18) at gsignal.c:3326
        instance_and_params = 0x7fff24202a90
        signal_return_type = <optimized out>
        param_values = 0x7fff24202aa8
        node = <optimized out>
        i = <optimized out>
        n_params = <optimized out>
        __PRETTY_FUNCTION__ = "g_signal_emit_valist"
#7  0x0000003052e2aa02 in g_signal_emit (instance=instance@entry=0x183d050, signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3382
        var_args = {{gp_offset = 24, fp_offset = 48, overflow_arg_area = 0x7fff24202cf0, reg_save_area = 0x7fff24202c30}}
#8  0x00000035e8ca5148 in IA__gtk_check_menu_item_toggled (check_menu_item=0x183d050) at gtkcheckmenuitem.c:299
No locals.
#9  gtk_check_menu_item_activate (menu_item=0x183d050) at gtkcheckmenuitem.c:419
        check_menu_item = 0x183d050
#10 0x0000003052e10108 in g_closure_invoke (closure=closure@entry=0x16a4fa0, return_value=return_value@entry=0x0, n_param_values=1, param_values=param_values@entry=0x7fff24202eb0, invocation_hint=invocation_hint@entry=0x7fff24202e50) at gclosure.c:777
        marshal = 0x3052e0ea00 <g_type_class_meta_marshal>
        marshal_data = 0x378
        in_marshal = 0
        real_closure = 0x16a4f80
        __PRETTY_FUNCTION__ = "g_closure_invoke"
#11 0x0000003052e21d1f in signal_emit_unlocked_R (node=node@entry=0x16b6510, detail=detail@entry=0, instance=instance@entry=0x183d050, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fff24202eb0) at gsignal.c:3512
        accumulator = 0x0
        emission = {next = 0x7fff24203340, instance = 0x183d050, ihint = {signal_id = 94, detail = 0, run_type = G_SIGNAL_RUN_FIRST}, state = EMISSION_RUN, chain_type = 23546560}
        handler_list = <optimized out>
        return_accu = 0x0
        accu = {g_type = 0, data = {{v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}, {v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}}}
        signal_id = 94
        max_sequential_handler_number = 751
        return_value_altered = <optimized out>
#12 0x0000003052e2a732 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fff24203038) at gsignal.c:3326
        instance_and_params = 0x7fff24202eb0
        signal_return_type = <optimized out>
        param_values = 0x7fff24202ec8
        node = <optimized out>
        i = <optimized out>
        n_params = <optimized out>
        __PRETTY_FUNCTION__ = "g_signal_emit_valist"
#13 0x0000003052e2aa02 in g_signal_emit (instance=instance@entry=0x183d050, signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3382
        var_args = {{gp_offset = 24, fp_offset = 48, overflow_arg_area = 0x7fff24203110, reg_save_area = 0x7fff24203050}}
#14 0x00000035e8e685ec in IA__gtk_widget_activate (widget=widget@entry=0x183d050) at gtkwidget.c:5048
        __PRETTY_FUNCTION__ = "IA__gtk_widget_activate"
#15 0x00000035e8d56e2d in IA__gtk_menu_shell_activate_item (menu_shell=0x181f270, menu_item=0x183d050, force_deactivate=<optimized out>) at gtkmenushell.c:1303
        slist = <optimized out>
        shells = 0x176bb40 = {0x181f270}
        deactivate = <optimized out>
        __PRETTY_FUNCTION__ = "IA__gtk_menu_shell_activate_item"
#16 0x00000035e8d571dc in gtk_menu_shell_button_release (widget=0x181f270, event=<optimized out>) at gtkmenushell.c:730
        submenu = 0x0
        menu_item = 0x183d050
        deactivate = 1
        menu_shell = 0x181f270
        priv = 0x181f250
#17 0x00000035e8d420cc in _gtk_marshal_BOOLEAN__BOXED (closure=0x16a8620, return_value=0x7fff24203300, n_param_values=<optimized out>, param_values=0x7fff242033b0, invocation_hint=<optimized out>, marshal_data=<optimized out>) at gtkmarshalers.c:86
        callback = 0x35e8d4a780 <gtk_menu_button_release>
        cc = <optimized out>
        data1 = 0x181f270
        data2 = 0x16a2960
        v_return = <optimized out>
        __PRETTY_FUNCTION__ = "_gtk_marshal_BOOLEAN__BOXED"
#18 0x0000003052e10108 in g_closure_invoke (closure=closure@entry=0x16a8620, return_value=return_value@entry=0x7fff24203300, n_param_values=2, param_values=param_values@entry=0x7fff242033b0, invocation_hint=invocation_hint@entry=0x7fff24203350) at gclosure.c:777
        marshal = 0x3052e0ea00 <g_type_class_meta_marshal>
        marshal_data = 0x160
        in_marshal = 0
        real_closure = 0x16a8600
        __PRETTY_FUNCTION__ = "g_closure_invoke"
#19 0x0000003052e222db in signal_emit_unlocked_R (node=<optimized out>, detail=detail@entry=0, instance=instance@entry=0x181f270, emission_return=emission_return@entry=0x7fff24203480, instance_and_params=instance_and_params@entry=0x7fff242033b0) at gsignal.c:3620
        accumulator = 0x16a8670
        emission = {next = 0x0, instance = 0x181f270, ihint = {signal_id = 34, detail = 0, run_type = G_SIGNAL_RUN_LAST}, state = EMISSION_RUN, chain_type = 23816720}
        handler_list = 0x0
        return_accu = 0x7fff24203300
        accu = {g_type = 20, data = {{v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}, {v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}}}
        signal_id = 34
        max_sequential_handler_number = 751
        return_value_altered = 0
#20 0x0000003052e29c9f in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fff24203548) at gsignal.c:3336
        return_value = {g_type = 20, data = {{v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}, {v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}}}
        error = 0x0
        rtype = 20
        static_scope = 0
        instance_and_params = 0x7fff242033b0
        signal_return_type = <optimized out>
        param_values = 0x7fff242033c8
        node = <optimized out>
        i = <optimized out>
        n_params = <optimized out>
        __PRETTY_FUNCTION__ = "g_signal_emit_valist"
#21 0x0000003052e2aa02 in g_signal_emit (instance=instance@entry=0x181f270, signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3382
        var_args = {{gp_offset = 32, fp_offset = 48, overflow_arg_area = 0x7fff24203620, reg_save_area = 0x7fff24203560}}
#22 0x00000035e8e69924 in gtk_widget_event_internal (widget=widget@entry=0x181f270, event=event@entry=0x1832c40) at gtkwidget.c:5017
        signal_num = <optimized out>
        return_val = 0
#23 0x00000035e8e69bf9 in IA__gtk_widget_event (widget=widget@entry=0x181f270, event=event@entry=0x1832c40) at gtkwidget.c:4814
        __PRETTY_FUNCTION__ = "IA__gtk_widget_event"
#24 0x00000035e8d40314 in IA__gtk_propagate_event (widget=0x181f270, event=0x1832c40) at gtkmain.c:2490
        tmp = <optimized out>
        handled_event = <optimized out>
        __PRETTY_FUNCTION__ = "IA__gtk_propagate_event"
#25 0x00000035e8d406db in IA__gtk_main_do_event (event=0x1832c40) at gtkmain.c:1685
        event_widget = <optimized out>
        grab_widget = 0x183d050
        window_group = <optimized out>
        rewritten_event = <optimized out>
        tmp_list = <optimized out>
        __PRETTY_FUNCTION__ = "IA__gtk_main_do_event"
#26 0x00000035e945ed0c in gdk_event_dispatch (source=source@entry=0x1671c70, callback=<optimized out>, user_data=<optimized out>) at gdkevents-x11.c:2403
        display = <optimized out>
        event = 0x1832c40
#27 0x0000003052248246 in g_main_dispatch (context=0x1671d60) at gmain.c:3058
        dispatch = 0x35e945ecc0 <gdk_event_dispatch>
        was_in_call = 0
        user_data = 0x0
        callback = 0x0
        cb_funcs = 0x0
        cb_data = 0x0
        need_destroy = <optimized out>
        current_source_link = {data = 0x1671c70, next = 0x0}
        source = 0x1671c70
        current = 0x16e1bb0
        i = 0
#28 g_main_context_dispatch (context=context@entry=0x1671d60) at gmain.c:3634
No locals.
#29 0x0000003052248598 in g_main_context_iterate (context=0x1671d60, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3705
        max_priority = 2147483647
        timeout = 500
        some_ready = 1
        nfds = <optimized out>
        allocated_nfds = 4
        fds = 0x1825a40
#30 0x000000305224899a in g_main_loop_run (loop=0x1825a20) at gmain.c:3899
        __PRETTY_FUNCTION__ = "g_main_loop_run"
#31 0x00000035e8d3f797 in IA__gtk_main () at gtkmain.c:1257
        tmp_list = 0x0
        functions = 0x0
        init = <optimized out>
        loop = 0x1825a20
#32 0x0000000000404d18 in main (argc=1, argv=0x7fff24203988) at main.cpp:693
        it = <optimized out>
(gdb) 


Version-Release number of selected component (if applicable):
cryptkeeper-0.9.5-7.fc19.x86_64
glibc-2.17.90-1.fc20.x86_64

How reproducible:
Every time


Steps to Reproduce:
1. Start cryptkeeper
2. mount encrypted FS
3. unmount encrypted FS -> segfault

Actual results:


Expected results:


Additional info:
Comment 1 Tom London 2013-06-10 09:52:46 EDT
Should have include the following above:

[tbl@tlondon x86_64]$ rpm -qf /usr/share/glib-2.0/gdb/gobject.py
glib2-devel-2.37.1-1.fc20.x86_64
[tbl@tlondon x86_64]$
Comment 2 Tom London 2013-06-10 10:20:37 EDT
Looks like the crash is occurring when strcmp() dereferences 'mnt_dir_expanded' in the 'for' loop:


bool is_mounted(const char *mount_dir)
{
        FILE *f = setmntent("/etc/mtab", "r");
        char *mount_dir_expanded = realpath(mount_dir, NULL);
        if (mount_dir_expanded == NULL) {
                // no such file or dir, ...
                // so: not mounted
                //        perror("cryptkeeper, is_mounted");
                return false;
        }
        for (;;) {
                char *mnt_dir_expanded;
                struct mntent *m = getmntent(f);
                if (!m) break;
                mnt_dir_expanded = realpath(m->mnt_dir, NULL);
                if (strcmp(mount_dir_expanded, mnt_dir_expanded)==0) {
                        free(mnt_dir_expanded);
                        return true;
                }
        }
        return false;
}

So the call to 'realpath()' is returning NULL.

Appears that this can happen if there is a permission issue:

       EACCES Read or search permission was denied for a component of the path
              prefix.

On a hunch, I put SELinux into permissive mode (via 'setenforce 0'), and retried.

This time, no segfault.

No AVCs, so I will have dig deeper to figure out what access is being denied, and then file against SELinux.

Not sure cryptkeeper should segfault in this case however....
Comment 3 Tom London 2013-06-18 09:52:38 EDT
Upon some thought, I'm thinking that the cryptkeeper code needs changing.

I believe the SELinux access that is being prevented is when the call to realpath() is attempting to access the full path of every mountpoint.

This AVC is 'dontaudit-ed', so one would normally not see it, but the code does not expect the call to realpath() to return NULL.

The simplest fix would be to modify the code to recognize a NULL return and just continue to the next mount point.

A better(?) fix could be changing the code to scan /proc/mounts directly, and to bypass the call to realpath() on the scanned mount point.

I'll post a patch (for the simple fix) below.
Comment 4 Tom London 2013-06-18 09:55:08 EDT
Created attachment 762496 [details]
Patch to encfs_wrapper.cpp to check for realpath() returning NULL

Simplest patch to avoid segfaults when there is a mountpoint that a user doesn't have the right access permissions....
Comment 5 Fedora End Of Life 2013-09-16 10:08:24 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 20 development cycle.
Changing version to '20'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora20
Comment 6 Fedora End Of Life 2015-05-29 05:06:49 EDT
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 7 Fedora End Of Life 2015-06-29 08:00:12 EDT
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

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