On Sunday, August 21, 2005 at 02:28AM, Javier Fern?ndez-Sanguino Pe?a wrote:
On Sat, Aug 20, 2005 at 07:11:43PM -0500, Mike Hokenson wrote:
Your assessment looks quite correct. Libselinux does this:

void freecon(security_context_t con)
{
       free(con);
}

So it might be the source of the error. This code was introduced by
#264320. I'm going to upload a new version right away, please let
me now if this fixes the bug.

I just noticed I was building cron w/out selinux support. :P

Here's a backtrace of a -g:

#0  0x400a4e69 in free () from /lib/tls/libc.so.6
(gdb) bt
#0  0x400a4e69 in free () from /lib/tls/libc.so.6
#1  0x40033e6c in freecon () from /lib/libselinux.so.1
#2  0x0804af20 in free_user (u=0x8056008) at ../user.c:136
#3 0x0804a778 in process_crontab (uname=0xbfc5e5f8 "root", fname=0xbfc5e5f8 "root", tabname=0xbfc5c5f6 "crontabs/root", statbuf=0xbfc5e800, new_db=0xbfc5e858, old_db=0xbfc5e8b8)
   at ../database.c:424
#4  0x0804ab67 in load_database (old_db=0xbfc5e8b8) at ../database.c:238
#5  0x0804a263 in main (argc=1, argv=0xbfc5e954) at ../cron.c:166
(gdb)
Which still pretty much leads back to the same place...

I'm not sure what your patch looks like, but just testing for a NULL 
u->scontext didn't work, I had to do this:

--- user.c.orig 2005-08-20 18:01:22.000000000 -0500
+++ user.c      2005-08-20 19:43:59.000000000 -0500
@@ -133,7 +133,8 @@
               free_entry(e);
       }
#ifdef WITH_SELINUX
-        freecon(u->scontext);
+        if (u->scontext)
+                freecon(u->scontext);
#endif
       free(u);
}
@@ -175,6 +176,8 @@
       u->crontab = NULL;

#ifdef WITH_SELINUX
+        u->scontext = NULL;
+
        if (is_selinux_enabled() > 0) {
            char *sname=uname;
            if (pw==NULL) {

I originally pulled the other u->scontext = NULL;, but wasn't sure if the 
security context would ever be set when get_security_context() returns -1. It's 
working right now without, been runnin for 10 minutes.

Mike


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to