Bug 139867 - mail/isoqlog catch segmentation fault under AMD64
Summary: mail/isoqlog catch segmentation fault under AMD64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-23 17:40 UTC by Bartosz Stec
Modified: 2010-11-15 15:30 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bartosz Stec 2009-10-23 17:40:01 UTC
It has been spotem some time ago here: http://lists.freebsd.org/pipermail/freebsd-questions/2009-April/196808.html

isoqlog just drops core after reading config file under amd64 with segmentation fault

How-To-Repeat: # isoqlog
Year: 2009 Month: 10
outputdir:/usr/local/share/sqstat/exim
htmldir:/usr/local/share/isoqlog/htmltemp
logtype:exim
logstore:/var/log/exim/mainlog
langfile:/usr/local/share/isoqlog/lang/polish
maxsender:1000
maxreceiver:1000
maxtotal:1000
maxbyte:1000
hostname: mainframe.kkip.pl
Domains <hidden>
Domains <hidden>
Domains <hidden>
Segmentation fault (core dumped)
Comment 1 Edwin Groothuis freebsd_committer 2009-10-25 21:06:41 UTC
Maintainer of mail/isoqlog,

Please note that PR ports/139867 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/139867

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer 2009-10-25 21:06:43 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Philip M. Gollucci freebsd_committer 2010-01-18 07:26:49 UTC
ping....
Comment 4 Stefan Walter freebsd_committer 2010-05-16 08:49:54 UTC
Hi Bartosz, hi Omer!

Omer: Could you please have a look at Bartosz's problem report for
mail/isoqlog at [1]?

Bartosz: Are you still seeing the problem you reported in ports/139867
[1], or has it been resolved in the meantime?

I do not have a fix for the segmentation fault and I don't use isoqlog,
but it would probably help if you could send a followup to the problem
report and add a backtrace so Omer or someone else can look at it.

Best regards,
Stefan

[1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/139867
Comment 5 Stefan Walter freebsd_committer 2010-05-16 08:50:27 UTC
Responsible Changed
From-To: freebsd-ports-bugs->stefan

Track this.
Comment 6 Bartosz Stec 2010-05-17 11:06:43 UTC
On 2010-05-16 09:49, Stefan Walter wrote:
> Hi Bartosz, hi Omer!
>
>    
Oh, hi! I almost forgot about this PR ;) Thanks for answer!
> Bartosz: Are you still seeing the problem you reported in ports/139867
> [1], or has it been resolved in the meantime?
>    
The problem is still there, with world rebuilded yesterday and rebuilded 
isoqlog, with and without make.conf variables set - it still drops core 
with segmentation fault.
> I do not have a fix for the segmentation fault and I don't use isoqlog,
> but it would probably help if you could send a followup to the problem
> report and add a backtrace so Omer or someone else can look at it.
>
> Best regards,
> Stefan
>
> [1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/139867
>    
I'm new to unix debugging so a litlle guide would be helpful if what I 
provided below isn't enough. I've recompiled isoqlog with "CFLAGS=-pipe 
-g" and execute it to catch core. Here's the dbg output:

    # gdb /usr/local/bin/isoqlog isoqlog.core
    GNU gdb 6.1.1 [FreeBSD]
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and
    you are
    welcome to change it and/or distribute copies of it under certain
    conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for
    details.
    This GDB was configured as "amd64-marcel-freebsd"...(no debugging
    symbols found)...
    Core was generated by `isoqlog'.
    Program terminated with signal 11, Segmentation fault.
    Reading symbols from /lib/libc.so.7...(no debugging symbols
    found)...done.
    Loaded symbols for /lib/libc.so.7
    Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols
    found)...done.
    Loaded symbols for /libexec/ld-elf.so.1
    #0  0x000000000040af20 in ?? ()
    (gbd)


Should I recompile something to add debugging symbols? If yes - what and 
how? Backtrace shows a lot of cryptic lines and ends with:

    (gdb) backtrace
    #0  0x000000000040af20 in ?? ()
    #1  0x0000000000408d8b in ?? ()
    #2  0x0000000000409366 in ?? ()
    #3  0x00000000004034c3 in ?? ()
    (...)
    #695 0x0000000000000001 in ?? ()
    #696 0x00007fffffffea80 in ?? ()
    #697 0x000000000000001c in ?? ()
    Cannot access memory at address 0x800000000000

Comment 7 Stefan Walter freebsd_committer 2010-05-18 09:44:24 UTC
Hi Bartosz,

Bartosz Stec, 17.05.10, 12:06h CEST:

> I'm new to unix debugging so a litlle guide would be helpful if what I 
> provided below isn't enough. I've recompiled isoqlog with "CFLAGS=-pipe 
> -g" and execute it to catch core. Here's the dbg output:

the program is compiled with debugging symbols that way, but the binary is
still stripped during "make install". Can you please set WITH_DEBUG=yes in
/etc/make.conf, reinstall the port without overriding CFLAGS and then
acquire a new backtrace?

Regards,
Stefan

p.s.: Please send followups to the PR as plain text only, not HTML, as
it's hardly readable in the web interface.
Comment 8 Bartosz Stec 2010-05-18 11:55:49 UTC
W dniu 2010-05-18 10:44, Stefan Walter pisze:
> Hi Bartosz,
>
> Bartosz Stec, 17.05.10, 12:06h CEST:
>
>    
>> I'm new to unix debugging so a litlle guide would be helpful if what I
>> provided below isn't enough. I've recompiled isoqlog with "CFLAGS=-pipe
>> -g" and execute it to catch core. Here's the dbg output:
>>      
> the program is compiled with debugging symbols that way, but the binary is
> still stripped during "make install". Can you please set WITH_DEBUG=yes in
> /etc/make.conf, reinstall the port without overriding CFLAGS and then
> acquire a new backtrace?
>
>    

Thanks for the hint, here's backtrace ( I've changed domain name to 
domain.com for privacy):

    # gdb /usr/local/bin/isoqlog isoqlog.core
    GNU gdb 6.1.1 [FreeBSD]
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and
    you are
    welcome to change it and/or distribute copies of it under certain
    conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for
    details.
    This GDB was configured as "amd64-marcel-freebsd"...
    Core was generated by `isoqlog'.
    Program terminated with signal 11, Segmentation fault.
    Reading symbols from /lib/libc.so.7...done.
    Loaded symbols for /lib/libc.so.7
    Reading symbols from /libexec/ld-elf.so.1...done.
    Loaded symbols for /libexec/ld-elf.so.1
    #0  0x000000000040b50a in sortDomainUsersFrom (domain=0x800a1ccd0
    "domain.com") at Data.c:224
    224                                     if (tmp1->from_cnt >
    tmp2->from_cnt)
    (gdb) bt
    #0  0x000000000040b50a in sortDomainUsersFrom (domain=0x800a1ccd0
    "domain.com") at Data.c:224
    #1  0x0000000000404fa8 in createDailyHtml (f=0x800a3b400
    "/usr/local/www/sarg/exim/domain.com/2010/5/18.html", d=0x800a1ccd0)
    at Html.c:206
    #2  0x0000000000404910 in createHtml () at Html.c:83
    #3  0x000000000040361a in main (argc=1, argv=0x7fffffffea48) at
    main.c:74
    (gdb)

Maybe this could be helpful too:

    # cat isoqlog.conf
    #isoqlog Configuration file

    logtype     = "exim"                            # log type
    qmai-multilog, qmail-syslog, sendmail, postfix
    logstore    = "/var/log/exim/mainlog"                           #
    domainsfile = "/usr/local/etc/isoqlog.domains"          #
    outputdir   = "/usr/local/www/sarg/exim"                        #
    html output directory
    htmldir     = "/usr/local/share/isoqlog/htmltemp"
    langfile    = "/usr/local/share/isoqlog/lang/polish"
    hostname    = "my.domain.com"

    maxsender   = 100
    maxreceiver = 100
    maxtotal    = 100

    maxbyte     = 100

> p.s.: Please send followups to the PR as plain text only, not HTML, as
> it's hardly readable in the web interface.
>    

Sorry for that, my thunderbird client was set to auto choose format and 
I forgot to manually change it to plain text.

-- 
Bartosz Stec
Comment 9 Stefan Walter freebsd_committer 2010-05-18 12:47:28 UTC
Bartosz Stec, 18.05.10, 12:55h CEST:

> Thanks for the hint, here's backtrace ( I've changed domain name to 
> domain.com for privacy):

Thanks for the backtrace. Omer, can you have a look at this problem?

Regards,
Stefan
Comment 10 dfilter service freebsd_committer 2010-06-27 18:36:26 UTC
stefan      2010-06-27 17:36:13 UTC

  FreeBSD ports repository

  Modified files:
    mail/isoqlog         Makefile 
  Log:
  Mark as BROKEN on amd64: produces segmentation faults when run.
  
  PR:             139867
  Submitted by:   Bartosz Stec <admin@kkip.pl>
  Approved by:    maintainer timeout (8 months)
  Feature safe:   yes
  
  Revision  Changes    Path
  1.12      +7 -1      ports/mail/isoqlog/Makefile
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 11 Stefan Walter freebsd_committer 2010-06-30 15:14:08 UTC
Hi Bartosz,

looking at the build log on an amd64 system, I see a lot of warnings like
this one:

Data.c: In function 'sortDomainUsersFrom':
Data.c:221: warning: cast to pointer from integer of different size
Data.c:222: warning: cast to pointer from integer of different size

It looks like incorrect use of pointers Data.c and in Html.c (at least
these are the obvious ones). It happens to work on i386 because the
pointer size matches the size of int there.

Since Omer does not respond, I assume the isoqlog project is unmaintained
and someone else would have to fix it... How good are your C skills? ;-)
(I actually think it shouldn't take too much to fix it, but I don't know
when I would get to it, especially since I don't use this software at
all.)

Regards,
Stefan
Comment 12 Bartosz Stec 2010-06-30 15:31:04 UTC
On 2010-06-30 16:14, Stefan Walter wrote:
> Hi Bartosz,
>
> looking at the build log on an amd64 system, I see a lot of warnings like
> this one:
>
> Data.c: In function 'sortDomainUsersFrom':
> Data.c:221: warning: cast to pointer from integer of different size
> Data.c:222: warning: cast to pointer from integer of different size
>
> It looks like incorrect use of pointers Data.c and in Html.c (at least
> these are the obvious ones). It happens to work on i386 because the
> pointer size matches the size of int there.
>
> Since Omer does not respond, I assume the isoqlog project is unmaintained
> and someone else would have to fix it... How good are your C skills? ;-)
> (I actually think it shouldn't take too much to fix it, but I don't know
> when I would get to it, especially since I don't use this software at
> all.)
>
> Regards,
> Stefan
>    
Now it looks like a challenge to me ;-) My C skills are also 
'umaintained' for some years, maybe it's a good opportunity to change 
that. Your explanation looks sane to me, I'll see what I can do.

Cheers,
Bartosz Stec
Comment 13 Stefan Walter freebsd_committer 2010-08-02 17:49:27 UTC
Responsible Changed
From-To: stefan->freebsd-ports-bugs

Return this PR to the pool - I currently do not have the time to take care of 
it.
Comment 14 Tilman Keskinoz freebsd_committer 2010-08-09 16:25:29 UTC
I mechanical changed the code to compile w/o warning

http://people.freebsd.org/~arved/stuff/patch-isoqlog

Can you try to test if the program now works better for you?
Comment 15 Philip M. Gollucci freebsd_committer 2010-09-17 00:23:15 UTC
State Changed
From-To: feedback->open

Feedback received
Comment 16 Stefan Walter freebsd_committer 2010-11-11 12:54:42 UTC
Hi Bartosz,

have you given Tilman's patch (see [1]) a try? Does it fix the problem
with mail/isoqlog for you?

Regards,
Stefan

[1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/139867
Comment 17 Bartosz Stec 2010-11-15 13:02:58 UTC
Unfortunately Tilmans patch doesn't change anything in my case:

    # gdb /usr/local/bin/isoqlog isoqlog.core
    GNU gdb 6.1.1 [FreeBSD]
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and
    you are
    welcome to change it and/or distribute copies of it under certain
    conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for
    details.
    This GDB was configured as "amd64-marcel-freebsd"...
    Core was generated by `isoqlog'.
    Program terminated with signal 11, Segmentation fault.
    Reading symbols from /lib/libc.so.7...done.
    Loaded symbols for /lib/libc.so.7
    Reading symbols from /libexec/ld-elf.so.1...done.
    Loaded symbols for /libexec/ld-elf.so.1
    #0  0x000000000040b50a in sortDomainUsersFrom (domain=0x800a1ccd0
    "domain.com")
         at Data.c:224
    224                                     if (tmp1->from_cnt >
    tmp2->from_cnt)
    (gdb) bt
    #0  0x000000000040b50a in sortDomainUsersFrom (domain=0x800a1ccd0
    "domain.com")
         at Data.c:224
    #1  0x0000000000404fa8 in createDailyHtml (
         f=0x800a3b400
    "/usr/local/www/sarg/exim/domain.com/2010/11/15.html",
         d=0x800a1ccd0) at Html.c:206
    #2  0x0000000000404910 in createHtml () at Html.c:83
    #3  0x000000000040361a in main (argc=1, argv=0x7fffffffea40) at
    main.c:74

Backtrace output is the same as before. Here's build log, and warnings 
are still there:
http://pastebin.com/eAVda465

I patched a port by hashing BROKEN line and then I fetched patch file to 
mail/isoqlog/files. I also tried to patch manually, which was 
succesfull, but with the same result.
Comment 18 Stefan Walter freebsd_committer 2010-11-15 13:49:25 UTC
Hi Bartosz,

Bartosz Stec, 15.11.10, 14:02h CET:

> I patched a port by hashing BROKEN line and then I fetched patch file to 
> mail/isoqlog/files. I also tried to patch manually, which was 
> succesfull, but with the same result.

looking at Tilman's patch, I see it's not a patch to be placed into the
files/ directory, but a patch to modify the port. Please copy the patch
file to the port's directory and run "patch < patch-isoqlog". It should
create a couple of files in the files/ directory. After that, retry to
build/install the port.

Regards,
Stefan
Comment 19 Bartosz Stec 2010-11-15 14:05:06 UTC
>> I patched a port by hashing BROKEN line and then I fetched patch file to
>> mail/isoqlog/files. I also tried to patch manually, which was
>> succesfull, but with the same result.
> looking at Tilman's patch, I see it's not a patch to be placed into the
> files/ directory, but a patch to modify the port. Please copy the patch
> file to the port's directory and run "patch<  patch-isoqlog". It should
> create a couple of files in the files/ directory. After that, retry to
> build/install the port.
>
> Regards,
> Stefan
You're right, I tried it several ways but none of them was right I 
suppose :) Patching directly from port directory after '#make extract' 
fixed warnings and segfault is gone too.
Thanks for your good work Tilman!
Comment 20 dfilter service freebsd_committer 2010-11-15 15:24:59 UTC
stefan      2010-11-15 15:24:54 UTC

  FreeBSD ports repository

  Modified files:
    mail/isoqlog         Makefile 
  Added files:
    mail/isoqlog/files   patch-Data.c patch-Data.h 
  Log:
  - Fix segmentation faults on amd64.
  - Reset maintainer due to multiple long response timeouts.
  
  PR:             139867
  Submitted by:   Bartosz Stec <admin@kkip.pl>
  Patch by:       arved
  
  Revision  Changes    Path
  1.13      +2 -5      ports/mail/isoqlog/Makefile
  1.1       +119 -0    ports/mail/isoqlog/files/patch-Data.c (new)
  1.1       +20 -0     ports/mail/isoqlog/files/patch-Data.h (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 21 Stefan Walter freebsd_committer 2010-11-15 15:25:24 UTC
State Changed
From-To: open->closed

Patch committed, thanks!