Bug 832660 - seaudit fails to start
Summary: seaudit fails to start
Alias: None
Product: Fedora
Classification: Fedora
Component: setools
Version: 17
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Chris PeBenito
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2012-06-16 10:03 UTC by hannes
Modified: 2013-02-15 17:38 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2013-01-12 00:24:21 UTC
Type: Bug

Attachments (Terms of Use)
patch for g_cond_timed_wait (763 bytes, patch)
2012-08-19 11:48 UTC, Lars S. Jensen
no flags Details | Diff
patch for building the java part (SWIG issue) (759 bytes, patch)
2012-08-19 11:52 UTC, Lars S. Jensen
no flags Details | Diff
the spec to build the patchs (24.89 KB, patch)
2012-08-19 12:18 UTC, Lars S. Jensen
no flags Details | Diff

Description hannes 2012-06-16 10:03:44 UTC
Description of problem:
I was trying to monitor my audit logs but seaudit refuses to start properly. I also confirmed this with a user in #selinux.
It fails with the following error message:
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_cond_timedwait': Invalid argument.  Aborting.

No matter if I start it as user (with authorisation) or directly from a root-console.

Version-Release number of selected component (if applicable):

How reproducible:

Actual results:
Flickering window for a second and then exit.

Additional info:

sestatus -v
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      26

Process contexts:
Current context:                unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
Init context:                   system_u:system_r:init_t:s0
/usr/sbin/sshd                  system_u:system_r:sshd_t:s0-s0:c0.c1023

File contexts:
Controlling terminal:           unconfined_u:object_r:user_devpts_t:s0
/etc/passwd                     system_u:object_r:passwd_file_t:s0
/etc/shadow                     system_u:object_r:shadow_t:s0
/bin/bash                       system_u:object_r:shell_exec_t:s0
/bin/login                      system_u:object_r:login_exec_t:s0
/bin/sh                         system_u:object_r:bin_t:s0 -> system_u:object_r:shell_exec_t:s0
/sbin/agetty                    system_u:object_r:getty_exec_t:s0
/sbin/init                      system_u:object_r:bin_t:s0 -> system_u:object_r:init_exec_t:s0
/sbin/mingetty                  system_u:object_r:getty_exec_t:s0
/usr/sbin/sshd                  system_u:object_r:sshd_exec_t:s0

Comment 1 RR 2012-06-20 16:25:49 UTC
I can confirm,

# uname -a: 
Linux localhost 3.4.2-4.fc17.i686.PAE #1 SMP Thu Jun 14 22:11:26 UTC 2012 i686 i686 i386 GNU/Linux

# rpm -qa | grep setools:


Gtk-Message: Failed to load module "pk-gtk-module"
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_cond_timedwait': Zły argument.  Aborting.

Gtk-Message: Failed to load module "pk-gtk-module"
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_cond_timedwait': Invalid argument.  Aborting.

After creating empty ".seaudit" file in root home directory, I can view main seaudit window, but when I choose File->Open Log->/var/log/audit/audit.log seaudit is terminating with information:
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_cond_timedwait': Invalid argument.  Aborting. 

This same situation is when I'm trying to open policy.27 (File->Open Policy->/etc/selinux/targeted/policy/policy.27)

Comment 2 RR 2012-06-22 06:39:43 UTC
OK, more info

Fedora 17 clean installation, system - default, Gnome Desktop - default. No devels beside selinux-policy-devel, no additional libraries.

# rpm -qa | grep selinux

For me it isn't problem with Selinux because
# setenforce 0
# getenforce
# seaudit
Gtk-Message: Failed to load module "pk-gtk-module"
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_cond_timedwait': Invalid argument.  Aborting.

After copying "/usr/share/setools-3.3/dot_seaudit" to "/root/.seaudit" seaudit refuses to start but after removing line "DEFAULT_LOG_FILE /var/log/audit/audit.log" from "/root/.seaudit" there is no problem with opening empty main seaudit window. The rest is like in Comment 1 (above)

Comment 3 Lars S. Jensen 2012-08-17 15:25:49 UTC
From the backtrack in #841692 and my backtrack; I can see that the call to
g_cond_wait_until (cond=cond@entry=0x9679970, mutex=mutex@entry=0x96f6ad8, end_time=-1342712251375396)
have a negative time value: end_time=-1342712251375396
and it calls pthread_cond_timedwait() that returns EINVAL
  From pthread_cond_timedwait():  EINVAL The value specified by cond, mutex, or abstime is invalid.
The negative time is the calculation in glib deprecated/gthread-deprecated.c:1581:
    end_time += g_get_monotonic_time () - g_get_real_time ();
That cause the negative time value. (all time types are signed).

Comment 4 Lars S. Jensen 2012-08-18 07:35:59 UTC
The call to g_cond_wait_until is done with the obsolete call g_cond_timed_wait(progress->cond, progress->mutex, &wait_time); in progress.c:105

The g_cond_timed_wait() shall have a absolut time but it is call with a relative time in line 102:  GTimeVal wait_time = { 0, 50000 }; 

replace the code something like this:
     gint64 end_time;
     end_time = g_get_monotonic_time () + 50000; // need to be set before each wait
      g_cond_wait_until(progress->cond, progress->mutex,end_time);

Comment 5 Lars S. Jensen 2012-08-19 11:48:58 UTC
Created attachment 605474 [details]
patch for g_cond_timed_wait

Comment 6 Lars S. Jensen 2012-08-19 11:52:26 UTC
Created attachment 605475 [details]
patch for building the java part (SWIG issue)

Comment 7 Lars S. Jensen 2012-08-19 12:18:19 UTC
Created attachment 605481 [details]
the spec to build the patchs

Here are the 3 file (spec + 2 patchs) to build the fix for fc17 as setools-3.3.7-25.fc17.src.rpm

It look like the SWIG is not creating SWIGTYPE_p_int.java in libqpol/swig/java/..
So I added the patch and required swig version to be 2.0.7 from 1.3.28.
The spec had already changed the config file to use AC_PROG_SWIG(2.0.0)
and I removed workaround for gcc 4.3 + gnu99 + swig-generated code.

Comment 8 Reinhard 2012-12-11 22:14:31 UTC
Same error here on F18-prerelease, using setools-3.3.7-28.fc18.x86_64

Comment 9 Fedora Update System 2012-12-17 21:37:06 UTC
setools-3.3.7-31.fc18 has been submitted as an update for Fedora 18.

Comment 10 Fedora Update System 2012-12-18 21:26:05 UTC
Package setools-3.3.7-31.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing setools-3.3.7-31.fc18'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 11 hannes 2012-12-19 05:46:53 UTC
Are you going to backport this update to f17 as well? Thanks.

Comment 12 Daniel Walsh 2012-12-19 14:51:55 UTC
Sure building now.

Comment 13 Reinhard 2012-12-20 18:13:48 UTC
Package setools-3.3.7-31.fc18 works for me

Comment 14 Fedora Update System 2013-01-12 00:24:23 UTC
setools-3.3.7-31.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 RR 2013-02-15 17:38:08 UTC
Working OK with Fedora 18.

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