Bug 90607 - bad Elf32_Phdr.p_filesz for PT_DYNAMIC
bad Elf32_Phdr.p_filesz for PT_DYNAMIC
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: binutils (Show other bugs)
9
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-05-10 13:54 EDT by John Reiser
Modified: 2007-04-18 12:53 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-07 10:06:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
assembly-language test case (348 bytes, text/plain)
2003-05-10 13:56 EDT, John Reiser
no flags Details
loader script which triggers the bug (435 bytes, text/plain)
2003-05-10 13:56 EDT, John Reiser
no flags Details
Makefile containing commands which generate bad PT_DYNAMIC (124 bytes, text/plain)
2003-05-10 13:58 EDT, John Reiser
no flags Details

  None (edit)
Description John Reiser 2003-05-10 13:54:20 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
ld generates incorrect output for PT_DYNAMIC in some cases.  After using the
attached bug.S source file and bug.lts loader script and Makefile, then readelf
of the loaded output reports
-----
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  DYNAMIC        0x000000 0x008000b8 0x008000b8 0x00000 0x00010 R   0x4
  LOAD           0x000000 0x00800000 0x00800000 0x000a2 0x000a2 RWE 0x1000
  LOAD           0x0000a4 0x008000a4 0x008000a4 0x00014 0x00014 RW  0x1000
 
 Section to Segment mapping:
  Segment Sections...
   00
   01     .text
   02     .data
-----
which has a bad FileSiz for PT_DYNAMIC (0 instead of 0x10) and a missing
.dynamic section  in the list for Segment 02.


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

How reproducible:
Always

Steps to Reproduce:
1. Get attached files bug.S, bug.lds, Makefile.
2. Run 'make'.
3. Inspect output of readelf for PT_DYNAMIC.FileSize, and missing placement of
.dynamic section in Segment mapping.
    

Actual Results:
There are 8 section headers, starting at offset 0x100:
 
Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00800094 000094 00000e 00  AX  0   0  4
  [ 2] .data             PROGBITS        008000a4 0000a4 000014 00  WA  0   0  4
  [ 3] .bss              NOBITS          008000b8 0000b8 000000 00  WA  0   0  4
  [ 4] .dynamic          DYNAMIC         008000b8 0000b8 000010 08      0   0  4
  [ 5] .shstrtab         STRTAB          00000000 0000c8 000035 00      0   0  1
  [ 6] .symtab           SYMTAB          00000000 000240 000140 10      7   d  4
  [ 7] .strtab           STRTAB          00000000 000380 000066 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)
 
Elf file type is EXEC (Executable file)
Entry point 0x800094
There are 3 program headers, starting at offset 52
 
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  DYNAMIC        0x000000 0x008000b8 0x008000b8 0x00000 0x00010 R   0x4
  LOAD           0x000000 0x00800000 0x00800000 0x000a2 0x000a2 RWE 0x1000
  LOAD           0x0000a4 0x008000a4 0x008000a4 0x00014 0x00014 RW  0x1000
 
 Section to Segment mapping:
  Segment Sections...
   00
   01     .text
   02     .data


Expected Results:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  DYNAMIC        0x000000 0x008000b8 0x008000b8 0x00010 0x00010 R   0x4
##                                              ^^^^^^^

 Section to Segment mapping:
  Segment Sections...
   00
   01     .text
   02     .data .dynamic
##              ^^^^^^^^


Additional info:
Comment 1 John Reiser 2003-05-10 13:56:15 EDT
Created attachment 91599 [details]
assembly-language test case

generates small .text, .data, and .dynamic sections
Comment 2 John Reiser 2003-05-10 13:56:51 EDT
Created attachment 91600 [details]
loader script which triggers the bug
Comment 3 John Reiser 2003-05-10 13:58:08 EDT
Created attachment 91601 [details]
Makefile containing commands which generate bad PT_DYNAMIC
Comment 4 Jakub Jelinek 2004-10-07 10:06:56 EDT
Seems to work just fine with binutils-2.15.91.0.2-8
(although you should never create linker generated sections yourself
in the assembly).

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