View Issue Details

IDProjectCategoryView StatusLast Update
0004065unrealircdpublic2012-11-21 22:23
ReporterJimini Assigned Toohnobinki  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Platformamd64OSGentoo / Gentoo HardenedOS Version3.0.4-r4 / 3.1.6
Fixed in Version3.2.10-rc1 
Summary0004065: UnrealIRCd crashes when logging to syslog-ng
DescriptionWhen "syslog" is chosen as logging target (instead of /var/log/unrealircd/ircd.log), UnrealIRCd crashes, when something should be logged. Logging to a file works without any problem.
Error messages in syslog:
unrealircd[3425] general protection ip:7f8077bf26bf sp:7fff8889ffa0 error:0 in libc-2.13.so[7f8077bab000+182000]
unrealircd[21796]: segfault at 7f0000000000 ip 00007f938931f6bf sp 00007fffa069e1a0 error 4 in libc-2.13.so[7f93892d8000+182000]
unrealircd[13499]: segfault at 339c7201 ip 00007fe7598cc6bf sp 00007ffff07baa60 error 4 in libc-2.13.so[7fe759885000+182000]
unrealircd[13143]: segfault at 339c7201 ip 00007ffff695e6bf sp 00007fffffffca50 error 4 in libc-2.13.so[7ffff6917000+182000]
Steps To Reproduce- choose "syslog" as logging target in unrealircd.conf
- wait, until something happens on the server (a client connects etc.)
Additional InformationUsed software:
unrealircd-3.2.9
syslog-ng-3.2.5
glibc-2.13-4
Gentoo Linux 3.1.6 / Gentoo Hardened 3.0.4-r4 (tested and reproduced on two systems)
TagsNo tags attached.
3rd party modules

Activities

Jimini

2012-01-02 00:34

reporter   ~0016848

Last edited: 2012-01-02 00:35

Here is a little backtrace:
#0 0x00007ffff723d5bf in vfprintf () from /lib64/libc.so.6
No symbol table info available.
#1 0x00007ffff72e418f in __vfprintf_chk () from /lib64/libc.so.6
No symbol table info available.
#2 0x00007ffff72cc981 in __vsyslog_chk () from /lib64/libc.so.6
No symbol table info available.
#3 0x000000000043c097 in ircd_log ()
No symbol table info available.
#4 0x00007ffff6ba4180 in ?? ()
No symbol table info available.
#5 0x00007ffff7fca6d8 in ?? ()
No symbol table info available.
#6 0x00007ffff7265d92 in vsnprintf () from /lib64/libc.so.6
No symbol table info available.
#7 0x00007ffff7246583 in snprintf () from /lib64/libc.so.6
No symbol table info available.
0000008 0x00007ffff7270ad0 in malloc () from /lib64/libc.so.6
No symbol table info available.
#9 0x00000000004413a9 in deliver_it ()
No symbol table info available.
#10 0x0000000000000000 in ?? ()
No symbol table info available.

syzop

2012-01-02 01:11

administrator   ~0016849

Last edited: 2012-01-02 01:12

Thanks for the report.

Could you run './unreal backtrace'? I hope it will give a slightly more useful backtrace.

On first glance I can't spot the error. Then again, I only looked for a minute ;)

Another thing you could try, if possible, is:
1) Open include/setup.h, and change the line:
   #define HAVE_VSYSLOG /**/
   to:
   // #define HAVE_VSYSLOG /**/
2) Run: make clean install
3) Re-start the IRCd

Then it will use the syslog() function instead of vsyslog(), might help.

PS: I'm off to bed again ;)

ohnobinki

2012-01-02 22:08

reporter   ~0016850

To workaround, do:

# ac_cv_func_vsyslog=no emerge -1v unrealircd

Looking at the source code, I think the cause is pretty obvious so you needn't go try to post more backtraces. It was also easy to reproduce, even on non-hardened. Fixed in http://hg.unrealircd.org/hg/unreal/rev/79158ef9417c :

- Fix misuse of stdarg.h macros when calling vsyslog() (0004065 by Jimini).

I might commit the patch or workaround to Gentoo's net-irc/unrealircd ebuild if you want...

syzop

2012-01-02 22:49

administrator   ~0016851

I actually wonder why we have that vsyslog() ability in the first place, given that we already have built the buffer it seems a waste to do all the format string stuff all over again.

- Ditch vsyslog() as it's only a waste of CPU, inspired by 0004065.
http://hg.unrealircd.org/hg/unreal/rev/6518968ca480

If you could the honors of re-running autoconf, binki? Because when I do it, it would remove some stuff due to an older autoconf version ;)

ohnobinki

2012-01-03 06:56

reporter   ~0016852

Ran autoconf for you.

Yeah, having the buf populated unnecessarily when if vsyslog() is used, did look pointless. Dropping it makes sense if all other methods of logging are using the buffer anyway, that way we avoid potential inconsistency and more bug of this sort in the future too :-).

syzop

2012-01-03 12:51

administrator   ~0016853

Indeed. Thanks!

Jimini

2012-11-21 09:22

reporter   ~0017235

Unfortunately, I have to reopen this report. With glibc-2.15-r3, UnrealIRCd (3.2.9) crashes when logging to syslog:
[73180.246620] unrealircd[7882] general protection ip:7ff40a176ce8 sp:7ffffc129f10 error:0 in libc-2.15.so[7ff40a12d000+1a2000]

If I log to a file, everything runs fine.
If you need more information, please let me know.

syzop

2012-11-21 20:12

administrator   ~0017236

Could you test on 3.2.10-rc1? The changes/fixes from binki & me from above are in that version (and not in 3.2.9).

Jimini

2012-11-21 20:36

reporter   ~0017237

Last edited: 2012-11-21 20:37

I built 3.2.10-rc1 by hand and started it without any problems or errors. Of course, logging to syslog worked fine.

Edit: is it possible to say, when this version will be avaible via the official repositories?

syzop

2012-11-21 22:23

administrator   ~0017238

Great. Glad to hear it's fixed.

There are official downloads for 3.2.10-rc1 on www.unrealircd.com

Or did you want to ask when rc2 or 3.2.10 are released? Sorry, no ETA for that.

As for whatever version gentoo uses, I presume they only upgrade when 3.2.10 stable is released (which is what I'd do too, if I were them).

Issue History

Date Modified Username Field Change
2012-01-01 20:43 Jimini New Issue
2012-01-02 00:34 Jimini Note Added: 0016848
2012-01-02 00:35 Jimini Note Edited: 0016848
2012-01-02 01:11 syzop Note Added: 0016849
2012-01-02 01:12 syzop Note Edited: 0016849
2012-01-02 22:08 ohnobinki Note Added: 0016850
2012-01-02 22:08 ohnobinki Status new => resolved
2012-01-02 22:08 ohnobinki Fixed in Version => 3.2.10-rc1
2012-01-02 22:08 ohnobinki Resolution open => fixed
2012-01-02 22:08 ohnobinki Assigned To => ohnobinki
2012-01-02 22:49 syzop Note Added: 0016851
2012-01-03 06:56 ohnobinki Note Added: 0016852
2012-01-03 12:51 syzop Note Added: 0016853
2012-11-21 09:22 Jimini Note Added: 0017235
2012-11-21 09:22 Jimini Status resolved => feedback
2012-11-21 09:22 Jimini Resolution fixed => reopened
2012-11-21 20:12 syzop Note Added: 0017236
2012-11-21 20:36 Jimini Note Added: 0017237
2012-11-21 20:37 Jimini Note Edited: 0017237
2012-11-21 22:23 syzop Note Added: 0017238
2012-11-21 22:23 syzop Status feedback => resolved
2012-11-21 22:23 syzop Resolution reopened => fixed