Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 163306

Summary: Reading or assigning global h_errno variable causes a memory violation report from mudflap
Product: [Fedora] Fedora Reporter: Vesselin Peev <vesselinpeev>
Component: gccAssignee: Frank Ch. Eigler <fche>
Status: CLOSED WONTFIX QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 8CC: goemon, jakub
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-09 06:53:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Vesselin Peev 2005-07-14 22:35:57 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Fedora/1.0.4-1.3.1 Firefox/1.0.4

Description of problem:
Simply reading or writing to the h_errno global variable gives out a read/write violation in mudflap.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Compile the program

#include <stdio.h>
#include <netdb.h>
int main()
printf("%d", h_errno);
return 0;

and the program

#include <netdb.h>
int main()
h_errno = 0;
return 0;

with mudflap enabled, i.e.

gcc -fmudflap prog1.c -lmudflap -o prog1
gcc -fmudflap prog2.c -lmudflap -o prog2

2. Run prog1 and prog2.

Actual Results:  When prog1 is run, this is what I get:

mudflap violation 1 (check/read): time=1121380261.574621 ptr=0xb7eff6b4 size=4
pc=0xb7f09322 location=`a.cpp:6 (main)'
      /usr/lib/ [0xb7f09322]
      ./a.out(main+0x81) [0x8048839]
      /usr/lib/ [0xb7f0a04e]
Nearby object 1: checked region begins 17B after and ends 20B after
mudflap object 0x80cb430: name=`errno area'
bounds=[0xb7eff6a0,0xb7eff6a3] size=4 area=static check=0r/0w liveness=0
alloc time=1121380261.574591 pc=0xb7f09e0a
number of nearby objects: 1

When prog2 is run, the report is similar, but it says "(check/write)", instead of "(check/read)" -- because h_errno is written to.

Expected Results:  There should have been no violation messages.

Additional info:

Comment 1 Jakub Jelinek 2005-07-15 08:33:17 UTC
That's a mudflap bug.  (*__h_errno_location()) (which is what h_errno expands
to) is a thread local storage variable similarly to errno (*__errno_location()).
libmudflap has special quirks for errno, but not for h_errno (and I guess
not for _res either, and I wonder if any other thread local storage variable).

Comment 2 Vesselin Peev 2005-07-15 12:30:15 UTC
Jakub, cool, thanks! May I ask why the need for h_errno to expand to a thread 
local storage variable if gethostbyname is not reentrant, and it (global 
h_errno) isn't used by the reentrant equivalent gethostbyname_r?

Comment 3 Jakub Jelinek 2005-07-15 12:33:14 UTC
h_errno is used in many other functions, some of which are reentrant.

Comment 4 Frank Ch. Eigler 2005-09-23 22:04:21 UTC
Is there a complete list of such variables someplace?  Failing that, I'll add
h_errno support to gcc mainline, and consider backporting.

Comment 5 Dan Hollis 2005-10-07 22:49:44 UTC
mudflap is very buggy atm, i get violations just reading from argv[] :)

Comment 6 Frank Ch. Eigler 2005-10-07 23:26:10 UTC
(In reply to comment #5)
> mudflap is very buggy atm, i get violations just reading from argv[] :)

This would be a separate problem.  Make sure you pass -fmudflap to the link
stage too.  If you do, and you still encounter this, please open a separate
bugzilla with a sample program.

Comment 7 Christian Iseli 2007-01-22 10:50:31 UTC
This report targets the FC3 or FC4 products, which have now been EOL'd.

Could you please check that it still applies to a current Fedora release, and
either update the target product or close it ?


Comment 8 petrosyan 2008-02-18 22:21:14 UTC
this bug is still present in Fedora 8, gcc-4.1.2-33

Comment 9 Bug Zapper 2008-11-26 06:51:48 UTC
This message is a reminder that Fedora 8 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 8.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '8'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 8's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 8 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here:

Comment 10 Bug Zapper 2009-01-09 06:53:28 UTC
Fedora 8 changed to end-of-life (EOL) status on 2009-01-07. Fedora 8 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.