Bug 504417

Summary: file -s is not able to detect swap signature on ppc
Product: Red Hat Enterprise Linux 5 Reporter: Milan Broz <mbroz>
Component: fileAssignee: Jan Kaluža <jkaluza>
Status: CLOSED ERRATA QA Contact: BaseOS QE <qe-baseos-auto>
Severity: medium Docs Contact:
Priority: low    
Version: 5.3CC: ksrot, ovasik, pvrabec
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64   
OS: Linux   
Whiteboard:
Fixed In Version: file-4.17-17 Doc Type: Bug Fix
Doc Text:
Cause: PPC swapspace signature is located at different offset than swapspace signature on different architectures. Consequence: File didn't recognize swap on PPC. Fix: New magic pattern has been added to detect swap on PPC. Result: File now identifies swapspace on PPC as "Linux/ppc swap file"
Story Points: ---
Clone Of:
: 530083 (view as bug list) Environment:
Last Closed: 2012-02-21 05:45:53 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:
Attachments:
Description Flags
swap file created by dd-ing /dev/zero and mkswap(8)ing afterwards
none
a patch none

Description Milan Broz 2009-06-06 15:51:04 UTC
Description of problem:

file utility do not understant swap signature on PPC platform
(or maybe the problem is 4k vs 64k page size)

x86_64:
  # mkswap /dev/sdb
  Setting up swapspace version 1, size = 320072929 kB
  # file -s /dev/sdb
  /dev/sdb: Linux/i386 swap file (new style) 1 (4K pages) size 78142805 pages
  # rpm -q file
  file-4.17-15.el5_3.1.x86_64

ppc:
  # mkswap /dev/sdb
  Setting up swapspace version 1, size = 73407397 kB
  # file -s /dev/sdb
  /dev/sdb: data
  # rpm -q file
  file-4.17-15.el5_3.1.ppc

file utility should probably detect swap on all supported platforms.

Comment 1 Daniel Novotny 2009-10-09 14:08:49 UTC
the ppc swap is vastly different than the i386/x86_64 one: we will need a new magic

I created a ppc swapfile and will analyze this

Comment 2 Daniel Novotny 2009-10-09 14:14:29 UTC
Created attachment 364252 [details]
swap file created by dd-ing /dev/zero and mkswap(8)ing afterwards

an interesting thing:

[root@ibm-js20-02 ~]# dd if=/dev/zero of=swap.ppc bs=4k count=16
16+0 records in
16+0 records out
65536 bytes (66 kB) copied, 0.000857522 seconds, 76.4 MB/s
[root@ibm-js20-02 ~]# mkswap swap.ppc 
mkswap: error: swap area needs to be at least 655kB



so I created a larger file. the signature is quite long way down in the file:

[dnovotny@dhcp-0-118 file-testfiles]$ od -c swap.ppc
0000000  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
0002000  \0  \0  \0 001  \0  \0  \0  \v  \0  \0  \0  \0  \0  \0  \0  \0
0002020  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
0177760  \0  \0  \0  \0  \0  \0   S   W   A   P   S   P   A   C   E   2
0200000  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
3100000

Comment 3 Daniel Novotny 2009-10-20 12:00:53 UTC
Created attachment 365333 [details]
a patch

adding new magic

Comment 7 RHEL Program Management 2010-08-09 18:26:05 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 9 RHEL Program Management 2011-01-11 20:39:08 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 10 RHEL Program Management 2011-01-11 22:34:03 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 11 RHEL Program Management 2011-05-31 13:28:23 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 16 Jan Kaluža 2012-01-05 09:43:52 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: PPC swapspace signature is located at different offset than swapspace signature on different architectures.

Consequence: File didn't recognize swap on PPC.

Fix: New magic pattern has been added to detect swap on PPC.

Result: File now identifies swapspace on PPC as "Linux/ppc swap file"

Comment 17 errata-xmlrpc 2012-02-21 05:45:53 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.

http://rhn.redhat.com/errata/RHBA-2012-0201.html