Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Thread

double free or corruption

double free or corruption

2007-01-23 by Nerijus Baliunas

Hello,

I am using 3.1.4, but I got crashes earlier too. Decided to troubleshoot it.
How can I run milter-greylist from gdb? I tried gdb ./milter-greylist,
r -P /var/milter-greylist/milter-greylist.pid -p /var/milter-greylist/milter-greylist.sock -D,
but it stops after the first email (when it wants to print "(unknown id): addr
superafu.de[81.169.170.70] from <xxx@...> to <xxx@...> delayed
for 00:02:00 (ACL 103)" I assume). So I just ran
./milter-greylist -P /var/milter-greylist/milter-greylist.pid -p /var/milter-greylist/milter-greylist.sock -D
After about half a day it crashed:
*** glibc detected *** double free or corruption (!prev): 0x0a5441a8 ***
Aborted

How can I troubleshoot it?

Regards,
Nerijus

Re: [milter-greylist] double free or corruption

2007-01-23 by manu@netbsd.org

Nerijus Baliunas <nerijus@...> wrote:

> I am using 3.1.4, but I got crashes earlier too. Decided to troubleshoot
> it. How can I run milter-greylist from gdb? I tried gdb ./milter-greylist,
> r -P /var/milter-greylist/milter-greylist.pid -p
> /var/milter-greylist/milter-greylist.sock -D, but it stops after the first
> email (when it wants to print "(unknown id): addr
> superafu.de[81.169.170.70] from <xxx@...> to <xxx@...> delayed for
> 00:02:00 (ACL 103)" I assume).

How does it stops? 

> So I just ran ./milter-greylist -P
> /var/milter-greylist/milter-greylist.pid -p
> /var/milter-greylist/milter-greylist.sock -D After about half a day it
> crashed: *** glibc detected *** double free or corruption (!prev):
> 0x0a5441a8 *** Aborted
> 
> How can I troubleshoot it?

Do you have a core dump? If you do, you can open it from gdb. Issue help
target to discover the command to open a core. On my favourite system, I
do this like this:

$ gdb milter-greylist
(gdb) target netbsd-core milter-greylist.core

And then I can run bt to see where it crashed.

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@...

Re: [milter-greylist] double free or corruption

2007-01-26 by Nerijus Baliunas

On Tue, 23 Jan 2007 23:40:52 +0100 manu@... wrote:

> > I am using 3.1.4, but I got crashes earlier too. Decided to troubleshoot
> > it. How can I run milter-greylist from gdb? I tried gdb ./milter-greylist,
> > r -P /var/milter-greylist/milter-greylist.pid -p
> > /var/milter-greylist/milter-greylist.sock -D, but it stops after the first
> > email (when it wants to print "(unknown id): addr
> > superafu.de[81.169.170.70] from <xxx@...> to <xxx@...> delayed for
> > 00:02:00 (ACL 103)" I assume).
> 
> How does it stops? 

Program received signal SIGTTOU, Stopped (tty output). But I found out that it
happens only when I run it from mc shell, it works when I run it from pure bash.

> > So I just ran ./milter-greylist -P
> > /var/milter-greylist/milter-greylist.pid -p
> > /var/milter-greylist/milter-greylist.sock -D After about half a day it
> > crashed: *** glibc detected *** double free or corruption (!prev):
> > 0x0a5441a8 *** Aborted
> > 
> > How can I troubleshoot it?
> 
> Do you have a core dump?

No, even after ulimit -c unlimited it didn't produce core file. But as now
I was able to run milter-greylist under gdb:

[Thread -1239950416 (LWP 7915) exited]
[New Thread -1239950416 (LWP 7920)]
(unknown id): addr 69.90.101.137 from <journal@...> rcpt <gintaras@...>: autowhitelisted for 72:00:00
*** glibc detected *** double free or corruption (!prev): 0x099f3430 ***

Program received signal SIGABRT, Aborted.
[Switching to Thread -1239950416 (LWP 7920)]
0x00b8a7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) bt
#0  0x00b8a7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x00bca7a5 in raise () from /lib/tls/libc.so.6
#2  0x00bcc209 in abort () from /lib/tls/libc.so.6
#3  0x00bfe71a in __libc_message () from /lib/tls/libc.so.6
#4  0x00c04fbf in _int_free () from /lib/tls/libc.so.6
#5  0x00c0533a in free () from /lib/tls/libc.so.6
#6  0x0804a829 in mlfi_close (ctx=0x99f3430) at milter-greylist.c:1036
#7  0x0805e788 in mi_engine ()
#8  0x0805ccd6 in mi_handle_session ()
#9  0x0805c394 in mi_thread_handle_wrapper ()
#10 0x00d00371 in start_thread () from /lib/tls/libpthread.so.0
#11 0x00c6affe in clone () from /lib/tls/libc.so.6

Anything else I should check? I didn't exit from gdb yet.

Regards,
Nerijus

Re: [milter-greylist] double free or corruption

2007-01-26 by manu@netbsd.org

Nerijus Baliunas <nerijus@...> wrote:

> (gdb) bt
> #0  0x00b8a7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
> #1  0x00bca7a5 in raise () from /lib/tls/libc.so.6
> #2  0x00bcc209 in abort () from /lib/tls/libc.so.6
> #3  0x00bfe71a in __libc_message () from /lib/tls/libc.so.6
> #4  0x00c04fbf in _int_free () from /lib/tls/libc.so.6
> #5  0x00c0533a in free () from /lib/tls/libc.so.6
> #6  0x0804a829 in mlfi_close (ctx=0x99f3430) at milter-greylist.c:1036
> #7  0x0805e788 in mi_engine ()
> #8  0x0805ccd6 in mi_handle_session ()
> #9  0x0805c394 in mi_thread_handle_wrapper ()
> #10 0x00d00371 in start_thread () from /lib/tls/libpthread.so.0
> #11 0x00c6affe in clone () from /lib/tls/libc.so.6
> 
> Anything else I should check? I didn't exit from gdb yet.

frame 6
You should see you crashed on:
                free(priv->priv_buf);

You are using content filtering (body or header clause), right?

Then apply this patch and tell me that it does not happen anymore.

Index: milter-greylist.c
===================================================================
RCS file: /milter-greylist/milter-greylist/milter-greylist.c,v
retrieving revision 1.156
diff -U4 -r1.156 milter-greylist.c
--- milter-greylist.c   18 Jan 2007 15:04:28 -0000      1.156
+++ milter-greylist.c   26 Jan 2007 20:27:12 -0000
@@ -727,8 +727,9 @@
        /* Gather data saved from a previous call */
        if (priv->priv_buf) {
                memcpy(b->b_lines, priv->priv_buf, priv->priv_buflen);
                free(priv->priv_buf);
+               priv->priv_buf = NULL;
        }
        memcpy(b->b_lines + priv->priv_buflen, chunk, i + 1);
        b->b_lines[linelen] = '\0';
        priv->priv_buflen = 0;


-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@...

Re: [milter-greylist] double free or corruption

2007-01-29 by Nerijus Baliunas

On Fri, 26 Jan 2007 21:30:14 +0100 manu@... wrote:

> > Anything else I should check? I didn't exit from gdb yet.
> 
> frame 6
> You should see you crashed on:
>                 free(priv->priv_buf);

Yes.

> You are using content filtering (body or header clause), right?

I use MailScanner, which modifies Postfix queue files.

> Then apply this patch and tell me that it does not happen anymore.

Yes, it didn't crash for 2 days, so it seems it is fixed, thanks!

Regards,
Nerijus

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.