Bug 794 - Segfault with LD_DEBUG=ALL
Summary: Segfault with LD_DEBUG=ALL
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.3.4
: P2 normal
Target Milestone: ---
Assignee: Roland McGrath
Depends on:
Reported: 2005-03-17 14:32 UTC by Paul Brook
Modified: 2018-04-19 14:59 UTC (History)
1 user (show)

See Also:
Last reconfirmed:
fweimer: security-

Patch to fix bug (372 bytes, patch)
2005-03-17 14:34 UTC, Paul Brook
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Brook 2005-03-17 14:32:06 UTC
I'm getting a segfault when setting LD_DEBUG=all
The segfault occurs because we end up doing something equivalent to 
_dl_debug_printf("%s", NULL);

I't quite possible that this is a bug elsewhere, but given this routine is
specifically for debugging purposes it sems sensible to make it robust to
unusual input.
Comment 1 Paul Brook 2005-03-17 14:34:13 UTC
Created attachment 438 [details]
Patch to fix bug

Fixes bug by printing "(null)" as appropriate, like normal printf does.
Comment 2 Roland McGrath 2005-03-17 21:09:49 UTC
This report lacks a test case.  If this is an arm-specific problem, please
figure out whether it happens only in some arm-specific code.  

Note that Target is a meaningless field for libc.
If you want to indicate the platform of interest, that's Host.
Comment 3 Paul Brook 2005-03-18 03:40:36 UTC
This happened with an internal modified version of glibc, and only      
occurred because another bit of glibc was broken.   
However tracking down that bug would probably have been easier if     
_dl_debug_printf didn't segfault.  Tracking back a fault is much easier when 
you can see the debug output going wrong, rather than trying to deal with 
segfaults on a target without a working gdb. 
The issue is not specific to a particular target. 
Comment 4 GOTO Masanori 2005-03-20 02:06:07 UTC
In most case, passing NULL to _dl_debug_printf("%s") is glibc's bug.
It's small improvement for such a special case.  Committers,
please judge to put it or not.
Comment 5 Roland McGrath 2005-03-20 06:39:41 UTC
I don't think it's warranted.  It seems as likely to mask a bug as to make
debugging easier.