seaudit: 'pthread_cond_timedwait': Invalid argument.

Bug #1220618 reported by Domen Puncer
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
setools (Fedora)
Fix Released
Undecided
setools (Ubuntu)
Fix Released
Undecided
Unassigned
Precise
Won't Fix
Undecided
Unassigned

Bug Description

I suspect this might be the same bug as https://bugzilla.redhat.com/show_bug.cgi?id=832660 .

$ cat /etc/issue
Ubuntu 12.04.2 LTS \n \l

$ seaudit
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_cond_timedwait': Invalid argument. Aborting.
Aborted (core dumped)

Core was generated by `seaudit'.
Program terminated with signal 6, Aborted.
#0 0x00007f2ece86c425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007f2ece86c425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f2ece86fb8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007f2ecf2653e3 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007f2ecf2ce93c in g_cond_wait_until () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x000000000041f369 in progress_wait ()
#5 0x0000000000421d0b in toplevel_open_log ()
#6 0x0000000000420068 in ?? ()
#7 0x00007f2ecf292d53 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#8 0x00007f2ecf2930a0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#9 0x00007f2ecf29349a in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#10 0x00007f2ed01e02f7 in gtk_main () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#11 0x0000000000413d45 in main ()

Revision history for this message
In , hannes (hannes-redhat-bugs-1) wrote :

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:
seaudit
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):
setools-gui-3.3.7-24.fc17.x86_64

How reproducible:
Always

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

Revision history for this message
In , RR (rr-redhat-bugs) wrote :

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:
setools-libs-tcl-3.3.7-24.fc17.i686
setools-3.3.7-24.fc17.i686
setools-libs-python-3.3.7-24.fc17.i686
setools-console-3.3.7-24.fc17.i686
setools-gui-3.3.7-24.fc17.i686
setools-libs-3.3.7-24.fc17.i686

#locale
LANG=pl_PL.utf8
LC_CTYPE="pl_PL.utf8"
LC_NUMERIC="pl_PL.utf8"
LC_TIME="pl_PL.utf8"
LC_COLLATE="pl_PL.utf8"
LC_MONETARY="pl_PL.utf8"
LC_MESSAGES="pl_PL.utf8"
LC_PAPER="pl_PL.utf8"
LC_NAME="pl_PL.utf8"
LC_ADDRESS="pl_PL.utf8"
LC_TELEPHONE="pl_PL.utf8"
LC_MEASUREMENT="pl_PL.utf8"
LC_IDENTIFICATION="pl_PL.utf8"
LC_ALL=

#seaudit
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.

#LANG=C
#LC_ALL=C
#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 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)

Revision history for this message
In , RR (rr-redhat-bugs) wrote :

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
libselinux-utils-2.1.10-3.fc17.i686
selinux-policy-devel-3.10.0-132.fc17.noarch
libselinux-2.1.10-3.fc17.i686
selinux-policy-doc-3.10.0-132.fc17.noarch
selinux-policy-3.10.0-132.fc17.noarch
libselinux-python-2.1.10-3.fc17.i686
selinux-policy-targeted-3.10.0-132.fc17.noarch

For me it isn't problem with Selinux because
# setenforce 0
# getenforce
Permissive
# 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)

Revision history for this message
In , Lars (lars-redhat-bugs) wrote :

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).

Revision history for this message
In , Lars (lars-redhat-bugs) wrote :

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;
and
     end_time = g_get_monotonic_time () + 50000; // need to be set before each wait
      g_cond_wait_until(progress->cond, progress->mutex,end_time);

Revision history for this message
In , Lars (lars-redhat-bugs) wrote :

Created attachment 605474
patch for g_cond_timed_wait

Revision history for this message
In , Lars (lars-redhat-bugs) wrote :

Created attachment 605475
patch for building the java part (SWIG issue)

Revision history for this message
In , Lars (lars-redhat-bugs) wrote :

Created attachment 605481
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.

Revision history for this message
In , Reinhard (reinhard-redhat-bugs) wrote :

Same error here on F18-prerelease, using setools-3.3.7-28.fc18.x86_64

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

setools-3.3.7-31.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/setools-3.3.7-31.fc18

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

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:
https://admin.fedoraproject.org/updates/FEDORA-2012-20567/setools-3.3.7-31.fc18
then log in and leave karma (feedback).

Revision history for this message
In , hannes (hannes-redhat-bugs-1) wrote :

Are you going to backport this update to f17 as well? Thanks.

Revision history for this message
In , Daniel (daniel-redhat-bugs) wrote :

Sure building now.

Revision history for this message
In , Reinhard (reinhard-redhat-bugs) wrote :

Package setools-3.3.7-31.fc18 works for me

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

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.

Revision history for this message
In , RR (rr-redhat-bugs) wrote :

Working OK with Fedora 18.

Revision history for this message
Domen Puncer (domen) wrote :

I can also trigger the same bug with sediffx (after selecting two policies it crashes in the same way).

description: updated
Revision history for this message
Laurent Bigonville (bigon) wrote :

Hi,

I think that the initial crash with seaudit should be fixed in 3.3.8-1 (the patch proposed in the RH bugzilla has been applied and I cannot reproduce this)

Unfortunately sediffx is still crashing when loading the 2 policies

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package setools - 3.3.8-3

---------------
setools (3.3.8-3) unstable; urgency=medium

  * Team upload.
  * debian/control: Bump Standards-Version to 3.9.5 (no further changes)
  * Add debian/patches/fix-sediffx-crash.patch: Fix sediffx crash (LP:
    #1220618)

 -- Laurent Bigonville <email address hidden> Fri, 27 Dec 2013 17:43:56 +0100

Changed in setools (Ubuntu):
status: New → Fix Released
Revision history for this message
Domen Puncer (domen) wrote :

This is still a bug in Ubuntu 12.04.2 LTS

$ sediffx sepolicy ';' data/security/sepolicy
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_cond_timedwait': Invalid argument. Aborting.
Aborted (core dumped)

$ sudo aptitude show setools
Package: setools
State: installed
Automatically installed: no
Version: 3.3.6.ds-7.2ubuntu4

Changed in setools (Ubuntu):
status: Fix Released → New
Changed in setools (Ubuntu):
status: New → Fix Released
Changed in setools (Fedora):
importance: Unknown → Undecided
status: Unknown → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote :

The Precise Pangolin has reached end of life, so this bug will not be fixed for that release

Changed in setools (Ubuntu Precise):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.