RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1278872 - .debug_pubnames length is too large
Summary: .debug_pubnames length is too large
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gcc
Version: 7.0
Hardware: All
OS: All
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact: Michael Petlan
Tomas Capek
URL:
Whiteboard:
Depends On:
Blocks: 1297579 1313485
TreeView+ depends on / blocked
 
Reported: 2015-11-06 15:41 UTC by Todd Allen
Modified: 2016-11-04 06:26 UTC (History)
5 users (show)

Fixed In Version: gcc-4.8.5-6.el7
Doc Type: Bug Fix
Doc Text:
Prior to this update, GCC could generate too big .debug_pubnames debug section, when using the -gpubname command-line option and if there are enumeration types in the system header files. This problem has been optimized in such a way that the .debug_pubnames length is now reasonable.
Clone Of:
Environment:
Last Closed: 2016-11-04 06:26:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Example program (681 bytes, application/x-gzip)
2015-11-06 15:41 UTC, Todd Allen
no flags Details
Patch against gcc-4.8.2 to correct the problem (706 bytes, patch)
2015-11-06 15:42 UTC, Todd Allen
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 68229 0 P3 RESOLVED .debug_pubnames length field is too large 2020-09-23 07:53:41 UTC
Red Hat Product Errata RHBA-2016:2433 0 normal SHIPPED_LIVE gcc bug fix and enhancement update 2016-11-03 14:01:11 UTC

Description Todd Allen 2015-11-06 15:41:11 UTC
Created attachment 1090710 [details]
Example program

Description of problem:
When building with -gpubnames, the length value in the .debug_pubnames can be too large.  It happens when the C source uses #include's of header files with enumeration types (e.g. <libio.h> via <stdio.h>).

Version-Release number of selected component (if applicable):
gcc-4.8.3-9.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. tar zxvhf progtest.tar.gz
2. make
3.

Actual results:
The readelf of progtest.o with symbols main & variable.
The readelf of libtest.o  with symbols f, i & pt.
The readelf of progtest.x with only symbols main & variable.

Expected results:
The readelf of progtest.o with symbols main & variable.
The readelf of libtest.o  with symbols f, i & pt.
The readelf of progtest.x with all the above symbols: main, variable, f, i & pt.


Additional info:

The problem occurs if there are enum types in the system header files that are not marked for emission in the object file.  size_of_pubnames() still counts them, but output_pubnames() does not emit them.  So the size ends up being too large.

This is a big problem for dwarf readers because, when reading a linked executable, they will use the length field for the contribution from one object file to determine the location of the contribution for the next object file.  If it's wrong, they can skip whole contributions and possibly (likely) end up at a random byte in the middle of some subsequent contribution.

I'll include an example.  This example is small enough that the result is that the contribution from the second object file is skipped entirely and it overruns the end of the section.  It would require a few more object files before there was enough material for it to end up in the middle of a subsequent contribution.

Comment 1 Todd Allen 2015-11-06 15:42:49 UTC
Created attachment 1090716 [details]
Patch against gcc-4.8.2 to correct the problem

Yeah, the patch code is clumsy.  I wrote it that way to mirror the use of a continue in output_pubnames().  It's fixed in gcc-4.9.0 by Sterling Augustine, 2013-07-25 more cleanly, but I was going for a minimal patch.

Comment 6 Michael Petlan 2016-07-25 09:39:49 UTC
test fails with gcc-4.8.5-4.el7
test passes for gcc-4.8.5-9.el7

VERIFIED

Comment 8 errata-xmlrpc 2016-11-04 06:26:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2433.html


Note You need to log in before you can comment on or make changes to this bug.