Bug 208880 - Pointless file(1) error message while detecting ELF 64-bit file
Summary: Pointless file(1) error message while detecting ELF 64-bit file
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: file
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Martin Bacovsky
QA Contact:
URL:
Whiteboard:
: 207918 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-10-02 14:29 UTC by Jindrich Novy
Modified: 2013-07-02 23:17 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2007-01-09 19:30:31 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Testing file. (17.10 KB, application/octet-stream)
2006-10-02 14:30 UTC, Jindrich Novy
no flags Details
file-note-debuginfo.patch (2.45 KB, patch)
2006-10-17 14:48 UTC, Jakub Jelinek
no flags Details | Diff

Description Jindrich Novy 2006-10-02 14:29:24 UTC
Description of problem:
file(1) reports message "bad note name size 0x80000da4" while recognizing file
format of some ELF 64bit files.

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

How reproducible:
Run file(1) on the attached file.

Steps to Reproduce:
1. file 411toppm.debug
  
Actual results:
ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), bad note name size
0x80000da4, dynamically linked (uses shared libs), not stripped

Expected results:
ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), dynamically linked (uses
shared libs), not stripped

Additional info:
Erratum 2006:0651.

Comment 1 Jindrich Novy 2006-10-02 14:30:52 UTC
Created attachment 137546 [details]
Testing file.

Comment 2 Martin Bacovsky 2006-10-06 10:47:17 UTC
File checks, if note name size is greater then 0x80000000 if it is, file
complains. Do you have idea where to check whether note name size can be of such
size?

Comment 3 Jakub Jelinek 2006-10-06 11:42:55 UTC
The file is the stripped-into-separate-file debuginfo, in which sections that
are present in the stripped file are made SHT_NOBITS and not present at all.
So, file needs to check for SHT_NOBITS .note sections and don't look at them
at all.  Currently it just reads some completely unrelated data (probably
part of one of the .debug_* sections).

Comment 4 Tim Waugh 2006-10-09 11:30:04 UTC
*** Bug 207918 has been marked as a duplicate of this bug. ***

Comment 6 Jakub Jelinek 2006-10-17 14:48:40 UTC
Created attachment 138685 [details]
file-note-debuginfo.patch

Proposed patch.  While it would be possible to do what I proposed (i.e.
for each PT_NOTE look up in section header table in which section the virtual
address falls in and test if it is not SHT_NOBITS), this is far easier and
faster
and has a nice side-effect that it doesn't duplication information in file
output.  Unpatched file will e.g. say:
file /bin/bash
/bin/bash: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for
GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9,
stripped
(note the .note.ABI-tag section being parsed and printed twice, once when found
through PT_NOTE, once when found through SHT_NOTE).  When the executable has
a section header table, then it is safe to assume that either there will be
a SHT_NOTE section corresponding to the PT_NOTE program header, or it will be
SHT_NOBITS in a debuginfo file (at which point it is not present).

Comment 7 Martin Bacovsky 2007-01-09 19:30:31 UTC
Thanks for patch. I'm sorry for delay in resolving this issue. This problem
should be fixed in file-4.19-1.fc7.


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