Mailing List Archive

dbmail-smtp segfaults on dual AMD Opteron 64-bit system
dbmail 2.0rc2 segfaults on my dual opteron system. I've tried using both MySQL and PostgreSQL to see if it was something tied to a particular RDBMS backend, but that doesn't seem to be the case.

dbmail-smtp segfaults as soon as it hits an empty line (the break of the header from the message body) when dbmail is trying to deliver to a local user's mailbox.

I've included backtraces from both mysql and postgresql. Looks like something messes with the header pointer to me. I tried tracking it down but wasn't able to put enough time into it. I hope this may give those of you who know the code better an idea of what might be happening. If you need more information let me know.

System:
SuSE Linux Enterprise Server 8.2 AMD64
Kernel 2.4.21
PostgreSQL 7.2.2
MySQL 3.23.52
dbmail 2.0rc2
postfix 1.1.12

backtrace from dbmail-smtp + mysql db gives:
#0 0x0000002a9567a399 in mysql_sub_escape_string () from /usr/lib64/libmysqlclient.so.10
#1 0x0000000040004dc1 in db_insert_message_block_physmessage (block=0x60 <Address 0x60 out of bounds>,
block_size=76, physmessage_id=7, messageblk_idnr=0x7fbffff1e8) at db.c:809
#2 0x0000000040004ee9 in db_insert_message_block (block=0x60 <Address 0x60 out of bounds>, block_size=76,
message_idnr=548682068456, messageblk_idnr=0x2a95f9a057) at db.c:850
#3 0x000000004000c3bd in store_message_temp (instream=0x7fbffff100,
header=0x60 <Address 0x60 out of bounds>, headersize=76, temp_message_idnr=0x7fbffff2a8) at pipe.c:570
#4 0x000000004000bf08 in insert_messages (instream=0x2a95e6b5c0,
header=0x4012a5a0 "From: polito@blackbeanie.net\nTo: polito@love.local\nSubject: this is a test\n\n",
headersize=76, users=0x2a95f9a057, errusers=0x4011d6e0, returnpath=0x7fbffff350, users_are_usernames=0,
deliver_to_mailbox=0x0, headerfields=0x4011d6a0) at pipe.c:339
#5 0x000000004000d2e6 in main (argc=-1778802601, argv=0x7fbffff3e8) at main.c:193
#6 0x0000002a95c80087 in __libc_start_main () from /lib64/libc.so.6
#7 0x0000000040001d5a in _start ()

backtrace from dbmail-smtp + postgresql db gives:
#0 0x0000002a95675287 in PQescapeString () from /usr/lib64/libpq.so.2
#1 0x0000000040004cd1 in db_insert_message_block_physmessage (block=0x60 <Address 0x60 out of bounds>,
block_size=76, physmessage_id=282, messageblk_idnr=0x7fbffff1e8) at db.c:809
#2 0x0000000040004df9 in db_insert_message_block (block=0x60 <Address 0x60 out of bounds>, block_size=76,
message_idnr=548682068456, messageblk_idnr=0x47) at db.c:850
#3 0x000000004000c2cd in store_message_temp (instream=0x7fbffff1e8,
header=0x60 <Address 0x60 out of bounds>, headersize=76, temp_message_idnr=0x7fbffff2a8) at pipe.c:570
#4 0x000000004000be18 in insert_messages (instream=0x2a959935c0,
header=0x4014ae70 "From: polito@blackbeanie.net\nTo: polito@love.local\nSubject: this is a test\n\n",
headersize=76, users=0x47, errusers=0x4011d340, returnpath=0x7fbffff350, users_are_usernames=0,
deliver_to_mailbox=0x0, headerfields=0x4011d300) at pipe.c:339
#5 0x000000004000d1f6 in main (argc=71, argv=0x7fbffff3e8) at main.c:193
#6 0x0000002a957a8087 in __libc_start_main () from /lib64/libc.so.6
#7 0x0000000040001c6a in _start ()

Blessings in Jesus,
Paul F. De La Cruz
Re: dbmail-smtp segfaults on dual AMD Opteron 64-bit system [ In reply to ]
If you could attach a message that causes the crash, we can confirm that it
doesn't crash on other systems. I have access to an Alpha running Tru64 and a
SPARC running Solaris, so I can test on those platforms to see if maybe it's a
consistent 64-bit thing.

I have a fairly big patch ready that gives pipe.c consistent handling of error
cases, allowing both dbmail-smtp and dbmail-lmtpd to report back about what's
happening. Some of the data flow that I'm looking at in the trace (basically,
that header is getting lost) have been moved around a little bit, const
keywords added, and other goodies like that.

Aaron


"Paul F. De La Cruz" <polito@blackbeanie.net> said:

> dbmail 2.0rc2 segfaults on my dual opteron system. I've tried using both
MySQL and PostgreSQL to see if it was something tied to a particular RDBMS
backend, but that doesn't seem to be the case.
>
> dbmail-smtp segfaults as soon as it hits an empty line (the break of the
header from the message body) when dbmail is trying to deliver to a local
user's mailbox.
>
> I've included backtraces from both mysql and postgresql. Looks like
something messes with the header pointer to me. I tried tracking it down but
wasn't able to put enough time into it. I hope this may give those of you who
know the code better an idea of what might be happening. If you need more
information let me know.
>
> System:
> SuSE Linux Enterprise Server 8.2 AMD64
> Kernel 2.4.21
> PostgreSQL 7.2.2
> MySQL 3.23.52
> dbmail 2.0rc2
> postfix 1.1.12
>
> backtrace from dbmail-smtp + mysql db gives:
> #0 0x0000002a9567a399 in mysql_sub_escape_string () from
/usr/lib64/libmysqlclient.so.10
> #1 0x0000000040004dc1 in db_insert_message_block_physmessage (block=0x60
<Address 0x60 out of bounds>,
> block_size=76, physmessage_id=7, messageblk_idnr=0x7fbffff1e8) at db.c:809
> #2 0x0000000040004ee9 in db_insert_message_block (block=0x60 <Address 0x60
out of bounds>, block_size=76,
> message_idnr=548682068456, messageblk_idnr=0x2a95f9a057) at db.c:850
> #3 0x000000004000c3bd in store_message_temp (instream=0x7fbffff100,
> header=0x60 <Address 0x60 out of bounds>, headersize=76,
temp_message_idnr=0x7fbffff2a8) at pipe.c:570
> #4 0x000000004000bf08 in insert_messages (instream=0x2a95e6b5c0,
> header=0x4012a5a0 "From: polito@blackbeanie.net\nTo:
polito@love.local\nSubject: this is a test\n\n",
> headersize=76, users=0x2a95f9a057, errusers=0x4011d6e0,
returnpath=0x7fbffff350, users_are_usernames=0,
> deliver_to_mailbox=0x0, headerfields=0x4011d6a0) at pipe.c:339
> #5 0x000000004000d2e6 in main (argc=-1778802601, argv=0x7fbffff3e8) at
main.c:193
> #6 0x0000002a95c80087 in __libc_start_main () from /lib64/libc.so.6
> #7 0x0000000040001d5a in _start ()
>
> backtrace from dbmail-smtp + postgresql db gives:
> #0 0x0000002a95675287 in PQescapeString () from /usr/lib64/libpq.so.2
> #1 0x0000000040004cd1 in db_insert_message_block_physmessage (block=0x60
<Address 0x60 out of bounds>,
> block_size=76, physmessage_id=282, messageblk_idnr=0x7fbffff1e8) at db.c:809
> #2 0x0000000040004df9 in db_insert_message_block (block=0x60 <Address 0x60
out of bounds>, block_size=76,
> message_idnr=548682068456, messageblk_idnr=0x47) at db.c:850
> #3 0x000000004000c2cd in store_message_temp (instream=0x7fbffff1e8,
> header=0x60 <Address 0x60 out of bounds>, headersize=76,
temp_message_idnr=0x7fbffff2a8) at pipe.c:570
> #4 0x000000004000be18 in insert_messages (instream=0x2a959935c0,
> header=0x4014ae70 "From: polito@blackbeanie.net\nTo:
polito@love.local\nSubject: this is a test\n\n",
> headersize=76, users=0x47, errusers=0x4011d340, returnpath=0x7fbffff350,
users_are_usernames=0,
> deliver_to_mailbox=0x0, headerfields=0x4011d300) at pipe.c:339
> #5 0x000000004000d1f6 in main (argc=71, argv=0x7fbffff3e8) at main.c:193
> #6 0x0000002a957a8087 in __libc_start_main () from /lib64/libc.so.6
> #7 0x0000000040001c6a in _start ()
>
> Blessings in Jesus,
> Paul F. De La Cruz
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>



--
Re: dbmail-smtp segfaults on dual AMD Opteron 64-bit system [ In reply to ]
Really it is any message that comes in on my system that causes dbmail-smtp to sig11.

I did a manual run of dbmail-smtp as 'cat test.txt | dbmail-smtp -d polito' using the following as the test.txt file:

--- start ---
From: polito@blackbeanie.net
To: polito@love.local
Subject: this is a test

Test message

This is the end of it.
--- end ---

And then I also tried typing in the contents directly into dbmail-smtp and it kept accepting input until I hit enter twice (ie, \n\n was sent) and that's when it segfaulted with signal 11.

This problem was also seen on RC1 which had me waiting for RC2 hoping the segfault mentioned by Ilja on the news was the one I was experiencing. Turned out it must have been something else.

Thanks for all the hard work on dbmail, I sure hope you're able to squish this bug (well, hoping you can reproduce it first).

Paul

---------- Original Message -------------
Subject: Re: [Dbmail-dev] dbmail-smtp segfaults on dual AMD Opteron 64-bit system
From: "Aaron Stone" <aaron@serendipity.palo-alto.ca.us>

If you could attach a message that causes the crash, we can confirm that it
doesn't crash on other systems.
Re: dbmail-smtp segfaults on dual AMD Opteron 64-bit system [ In reply to ]
""Paul F. De La Cruz"" <polito@blackbeanie.net> said:

> Really it is any message that comes in on my system that causes dbmail-smtp
to sig11.
>
> I did a manual run of dbmail-smtp as 'cat test.txt | dbmail-smtp -d polito'
using the following as the test.txt file:
>
> --- start ---
> From: polito@blackbeanie.net
> To: polito@love.local
> Subject: this is a test
>
> Test message
>
> This is the end of it.
> --- end ---
>
> And then I also tried typing in the contents directly into dbmail-smtp and
it kept accepting input until I hit enter twice (ie, \n\n was sent) and that's
when it segfaulted with signal 11.
>
> This problem was also seen on RC1 which had me waiting for RC2 hoping the
segfault mentioned by Ilja on the news was the one I was experiencing. Turned
out it must have been something else.
>
> Thanks for all the hard work on dbmail, I sure hope you're able to squish
this bug (well, hoping you can reproduce it first).
>
> Paul
>
> ---------- Original Message -------------
> Subject: Re: [Dbmail-dev] dbmail-smtp segfaults on dual AMD Opteron 64-bit
system
> From: "Aaron Stone" <aaron@serendipity.palo-alto.ca.us>
>
> If you could attach a message that causes the crash, we can confirm that it
> doesn't crash on other systems.
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>



--
Re: dbmail-smtp segfaults on dual AMD Opteron 64-bit system [ In reply to ]
Hmm... well, I can't speak for the crash yet, because I don't see it happening
on my box, but I do see that dbmail-smtp is exiting without setting a non-zero
exit code both when trying to delivery to a nonexistant user and/or when not
finding the internal_delivery_user. So I'll post my patch this evening, after
I do some testing on my SPARC. Hopefully it's just a 64-bit thing!

Aaron


"Paul F. De La Cruz" <polito@blackbeanie.net> said:

> Really it is any message that comes in on my system that causes dbmail-smtp
> to sig11.
>
> I did a manual run of dbmail-smtp as 'cat test.txt | dbmail-smtp -d polito'
> using the following as the test.txt file:
>
> --- start ---
> From: polito@blackbeanie.net
> To: polito@love.local
> Subject: this is a test
>
> Test message
>
> This is the end of it.
> --- end ---
>
> And then I also tried typing in the contents directly into dbmail-smtp and
> it kept accepting input until I hit enter twice (ie, \n\n was sent) and
> that's when it segfaulted with signal 11.
>
> This problem was also seen on RC1 which had me waiting for RC2 hoping the
> segfault mentioned by Ilja on the news was the one I was experiencing.
> Turned out it must have been something else.
>
> Thanks for all the hard work on dbmail, I sure hope you're able to squish
> this bug (well, hoping you can reproduce it first).
>
> Paul
>

--
Re: dbmail-smtp segfaults on dual AMD Opteron 64-bit system [ In reply to ]
obviously some pointers are pointing the wrong way here, the address of
the header data changes from 0x4012a5a0 to 0x60 at once? Perhaps the
fastest way to fix this is to grant access to ilja and/or aaron on your
system - would this be possible, Paul?

regards roel

Op 9-feb-04 om 21:26 heeft Paul F. De La Cruz het volgende geschreven:

> #3 0x000000004000c3bd in store_message_temp (instream=0x7fbffff100,
> header=0x60 <Address 0x60 out of bounds>, headersize=76,
> temp_message_idnr=0x7fbffff2a8) at pipe.c:570
> #4 0x000000004000bf08 in insert_messages (instream=0x2a95e6b5c0,
> header=0x4012a5a0 "From: polito@blackbeanie.net\nTo:
> polito@love.local\nSubject: this is a test\n\n",
> headersize=76, users=0x2a95f9a057, errusers=0x4011d6e0,
> returnpath=0x7fbffff350, users_are_usernames=0,
> deliver_to_mailbox=0x0, headerfields=0x4011d6a0) at pipe.c:339
>

_________________________
R.A. Rozendaal
IC&S
T: +31 30 63 55 736
F: +31 30 63 55 731
www.ic-s.nl
Re: dbmail-smtp segfaults on dual AMD Opteron 64-bit system [ In reply to ]
also, i see you issue the command

dbmail-smtp -d polito

normally, you would pass an emailaddress to dbmail-smtp using the -d
option (it searches the aliases table). Of course it still shouldn't
segfault but does it segfault too when you use the -u or the -n
options?

regards roel


Op 10-feb-04 om 4:03 heeft Paul F. De La Cruz het volgende geschreven:

> Really it is any message that comes in on my system that causes
> dbmail-smtp to sig11.
>
> I did a manual run of dbmail-smtp as 'cat test.txt | dbmail-smtp -d
> polito' using the following as the test.txt file:
>
> --- start ---
> From: polito@blackbeanie.net
> To: polito@love.local
> Subject: this is a test
>
> Test message
>
> This is the end of it.
> --- end ---
>
> And then I also tried typing in the contents directly into dbmail-smtp
> and it kept accepting input until I hit enter twice (ie, \n\n was
> sent) and that's when it segfaulted with signal 11.
>
> This problem was also seen on RC1 which had me waiting for RC2 hoping
> the segfault mentioned by Ilja on the news was the one I was
> experiencing. Turned out it must have been something else.
>
> Thanks for all the hard work on dbmail, I sure hope you're able to
> squish this bug (well, hoping you can reproduce it first).
>
> Paul
>
> ---------- Original Message -------------
> Subject: Re: [Dbmail-dev] dbmail-smtp segfaults on dual AMD Opteron
> 64-bit system
> From: "Aaron Stone" <aaron@serendipity.palo-alto.ca.us>
>
> If you could attach a message that causes the crash, we can confirm
> that it
> doesn't crash on other systems.
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>

_________________________
R.A. Rozendaal
IC&S
T: +31 30 63 55 736
F: +31 30 63 55 731
www.ic-s.nl
Re: dbmail-smtp segfaults on dual AMD Opteron 64-bit system [ In reply to ]
I've tried finding the problem using Valgrind. No success. I did find a
memory leak in create_unique_id() in misc.c though. Some memory
allocated for an md5 string was not freed.

But I had no luck in finding anything related to this segfault.

I'll continue on hunting the bug(s)!

Ilja

Roel Rozendaal - IC&S wrote:

> obviously some pointers are pointing the wrong way here, the address of
> the header data changes from 0x4012a5a0 to 0x60 at once? Perhaps the
> fastest way to fix this is to grant access to ilja and/or aaron on your
> system - would this be possible, Paul?
>
> regards roel
>
> Op 9-feb-04 om 21:26 heeft Paul F. De La Cruz het volgende geschreven:
>
>> #3 0x000000004000c3bd in store_message_temp (instream=0x7fbffff100,
>> header=0x60 <Address 0x60 out of bounds>, headersize=76,
>> temp_message_idnr=0x7fbffff2a8) at pipe.c:570
>> #4 0x000000004000bf08 in insert_messages (instream=0x2a95e6b5c0,
>> header=0x4012a5a0 "From: polito@blackbeanie.net\nTo:
>> polito@love.local\nSubject: this is a test\n\n",
>> headersize=76, users=0x2a95f9a057, errusers=0x4011d6e0,
>> returnpath=0x7fbffff350, users_are_usernames=0,
>> deliver_to_mailbox=0x0, headerfields=0x4011d6a0) at pipe.c:339
>>
>
> _________________________
> R.A. Rozendaal
> IC&S
> T: +31 30 63 55 736
> F: +31 30 63 55 731
> www.ic-s.nl
>
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev

--
IC&S
Stadhouderslaan 57
3583 JD Utrecht

PGP-key:
http://www.ic-s.nl/keys/ilja.txt
Re: dbmail-smtp segfaults on dual AMD Opteron 64-bit system [ In reply to ]
In reply to your other message about executing 'dbmail-smtp -d polito', I have used the other methods and they all fail.

I have created an account for Ilja and Aaron on my system. I have Ilja's GPG key so I could send him the login details encrypted, but I don't have Aaron's or know if he has one or not.

I'll contact them directly to give them the details.

Thanks again,
Paul

---------- Original Message -------------
Subject: Re: [Dbmail-dev] dbmail-smtp segfaults on dual AMD Opteron 64-bit system
Date: Tue, 10 Feb 2004 09:58:01 +0100
From: Roel Rozendaal - IC&S <roel@ic-s.nl>

obviously some pointers are pointing the wrong way here, the address of
the header data changes from 0x4012a5a0 to 0x60 at once? Perhaps the
fastest way to fix this is to grant access to ilja and/or aaron on your
system - would this be possible, Paul?