Bug 25442

Summary: non-static data causes segfault in syslog
Product: [Retired] Red Hat Linux Reporter: Ian Pilcher <pilcher>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Aaron Brown <abrown>
Severity: high Docs Contact:
Priority: medium    
Version: 7.0CC: fweimer
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-02-01 02:09:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ian Pilcher 2001-02-01 02:09:35 UTC
This may be a gcc problem; I'm not smart enough to tell . . .

Compiling/running a C program with 4 non-static global character pointers
causes a
segfault in any call to syslog.  See the example code in "Additional
Information."  If the
data is static, the segfault does not occur.

Reproducible: Always
Steps to Reproduce:
1.  Compile the example program below.
2.  Run it.
	

Actual Results:  Segfault

Expected Results:  It shouldn't segfault

#include <syslog.h>

char *job, *host, *user, *time;

int main (int argc, const char *argv[])
{
    syslog (LOG_ERR, "error message");
    return 0;
}

Comment 1 Jakub Jelinek 2001-02-01 16:01:32 UTC
This is fault on your side, you should not define time as global variable when
you call a function which calls time() because then libc calls resolves
time to your variable (that's how ELF symbol resolution works).