[Bug 741] ULOGD segfaults on init

bugzilla-daemon at bugzilla.netfilter.org bugzilla-daemon at bugzilla.netfilter.org
Fri Dec 9 01:20:06 CET 2011


http://bugzilla.netfilter.org/show_bug.cgi?id=741





--- Comment #2 from martin barrowcliff <martinbarrowcliff at gmail.com>  2011-12-09 01:20:06 ---
I have been told that the ulogd2 git actually builds and runs on 64 bit
systems.
But nobody has confirmed it actually works on x86-32. 

I have absolutely NO problem using the older beta4; it always compiles and runs
on my ATOM-330. 
But not matter what I have tried the git version segfaults.
Also, last update to the git version was 3 months ago and unrelated.

So I looked at both source dirs for the changes to the offending files.
Here's my diff between the one that works for me, and the one that segfaults.
Not much change but therin is a problem. Line 23?

--- old.ulogd-2.0.0beta4/src/ulogd.c    2010-06-17 10:30:43.000000000 -0400
+++ ulogd2/src/ulogd.c  2011-12-08 11:55:09.000000000 -0500
@@ -762,6 +762,15 @@
        return 0;
 }

+static int pluginstance_stop(struct ulogd_pluginstance *npi)
+{
+       if (--npi->plugin->usage > 0 &&
+           npi->plugin->input.type == ULOGD_DTYPE_SOURCE) {
+               return 0;
+       }
+       return 1;
+}
+
 static int create_stack_start_instances(struct ulogd_pluginstance_stack
*stack)
 {
        int ret;
@@ -839,6 +848,7 @@
                        ret = -ENODEV;
                        goto out;
                }
+               pl->usage++;

                /* allocate */
                pi = pluginstance_alloc_init(pl, pi_id, stack);
@@ -989,8 +999,8 @@

        llist_for_each_entry(stack, &ulogd_pi_stacks, stack_list) {
                llist_for_each_entry_safe(pi, npi, &stack->list, list) {
-                       if (((pi->plugin->priv_size == 0) || pi->private[0])
-                                       && *pi->plugin->stop) {
+                       if ((pi->plugin->priv_size > 0 || *pi->plugin->stop) &&
+                           pluginstance_stop(pi)) {
                                ulogd_log(ULOGD_DEBUG, "calling stop for %s\n",
                                          pi->plugin->name);
                                (*pi->plugin->stop)(pi);
@@ -1037,7 +1047,7 @@
        unload_plugins();
 #endif

-       if (logfile != NULL  && logfile != stdout) {
+       if (logfile != NULL  && logfile != stdout && logfile != &syslog_dummy)
{
                fclose(logfile);
                logfile = NULL;
        }
@@ -1218,7 +1228,7 @@
                if (fork()) {
                        exit(0);
                }
-               if (logfile != stdout && logfile != &syslog_dummy)
+               if (logfile != stdout)
                        fclose(stdout);
                fclose(stderr);
                fclose(stdin);
--- old.ulogd-2.0.0beta4/include/ulogd/ulogd.h  2010-06-17 11:07:33.000000000
-0400
+++ ulogd2/include/ulogd/ulogd.h        2011-12-08 11:55:09.000000000 -0500
@@ -208,6 +208,8 @@
        char name[ULOGD_MAX_KEYLEN+1];
        /* ID for this plugin (dynamically assigned) */
        unsigned int id;
+       /* how many stacks are using this plugin? initially set to zero. */
+       unsigned int usage;

        struct ulogd_keyset input;
        struct ulogd_keyset output;


Marty B.



-- 
Configure bugmail: http://bugzilla.netfilter.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are watching all bug changes.



More information about the netfilter-buglog mailing list