Bug 672826

Summary: Feature request: make crash support vmcore.flat files generated by makedumpfile
Product: [Fedora] Fedora Reporter: Dave Allan <dallan>
Component: crashAssignee: Dave Anderson <anderson>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 14CC: anderson, jburke, oomichi, tachibana
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-25 17:50:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Perl script with the same function as makedumpfile -R. none

Description Dave Allan 2011-01-26 14:45:49 UTC
Description of problem:
I attempted to run crash on a vmcore generated by my F14 box, but crash would not read the vmcore in the format netdump generated it.  I was able to get the vmcore into a format readable by crash by executing:

cat "vmcore.flat" | makedumpfile -R "vmcore"

Version-Release number of selected component (if applicable):
crash 5.0.6-2.fc14
crash 5.1.1 from people.redhat.com

Looking at the manpage for makedumpfile, it looks like this is expected behavior, but I had to google for how to get around it, so I think crash should at least detect & report this situation and how to fix it, if it can't do the conversion itself.

Comment 1 Dave Anderson 2011-01-26 15:09:41 UTC
netdump?

Anyway, yes, that is the expected behaviour, i.e., the vmcore.flat must
be reformatted as indicated in the makedumpfile man page.

But you're right, it would be nice.  I remember bringing this up to the
makedumpfile author/maintainers when they first introduced it, i.e., 
I asked them why they couldn't write up crash utility patch to just read
the "flat" dumpfile format.  But for a reason I cannot recall (?), they
were adamant against doing that.  I wish I could remember why, especially
since huge chunks of the makedumpfile source code was lifted from the
crash utility sources.

Anyway, I'll append this to my TODO list, and revisit it when I get
the time...

Comment 2 Dave Anderson 2011-01-26 15:15:46 UTC
Ken'ichi and Masaki,

Is there any reason why the crash utility could not be patched
to be able to read the "vmcore.flat" format?

Thanks,
  Dave

Comment 3 Dave Allan 2011-01-26 16:12:47 UTC
(In reply to comment #1)
> netdump?

Sorry, I'm 2+ years out of date with kernel dump work; that should be kdump. <sigh>

Comment 4 Masaki Tachibana 2011-01-27 05:42:36 UTC
Created attachment 475528 [details]
Perl script with the same function as makedumpfile -R.

Comment 5 Masaki Tachibana 2011-01-27 06:36:32 UTC
Hi.

I have found the following mail.
And I have attached the Perl script from makedumpfile 1.3.7.
We thought that rearranging flattened format data to a readable dumpfile by perl script was good enough.
(Though I do not think that it is used after all by Red Hat.)

P.S.

I think that modifying crash utility is possible.

Thanks.

-----------------------------------------------------
To: Dave Anderson <anderson>
From: "Ken'ichi Ohmichi" <oomichi.nec.co.jp>
Date: Fri, 26 Jan 2007 13:59:55 +0900
Cc: Neil Horman <nhorman>,fastboot.org
Subject: Re: [Fastboot] [PATCH] makedumpfile: SSH transporting (Re: Dumping
	to a remote host by makedumpfile.)


Hi Dave,

2007/01/19 11:06:23 -0500, Dave Anderson <anderson> wrote:
>Ah, OK, so the "-x vmlinux" references above could be
>substituted with "-i config_file".
>
>I'm still curious whether:
>
>(1) the "de-flattening" step could be easily ported to the
>    crash utility so it could be made to read the flattened
>    format file.

Porting the re-arranging (de-flattening) step into the crash utility
is only for the crash utility, so gdb cannot read the flattened format
file. I want a solution for both gdb and the crash utility.

Instead of the crash utility reading the flattened format file,
I think that it is good to create a perl script for re-arranging
flattened format data to a readable dumpfile. Perl script does not
depend on architecture, and a lot of systems have perl command.
User transports the perl script, and he transports a dumpfile to a
remote host with running this script. After completing transportion,
The perl script of a remote host is deleted.

Commandline example:
  The filename of the script is "re-arrange.pl".
  1. Transport the script.
     # scp re-arrange.pl user@remote:re-arrange.pl
  2. Transport a dumpfile. 
     # makedumpfile -F -cd31 -i config /proc/vmcore | ssh user@remote "./re-arrange.pl dumpfile"
  3. Delete the script
     # ssh user@remote "rm ./re-arrange.pl"

I created the perl script for re-arranging flattened format data,
and I attached the perl script and a new makedumpfile patch.
An old makedumpfile patch (sent on 2007/01/19) did not support
transporting of a dumpfile between different endian hosts, and I
created a new patch for it. But I have not tested the script
between different endian hosts, because I have only intel systems
(little endian).
If you find problems, please let me know them.


>(2) there can be another option to create an ELF vmcore file
>    from a compressed dumpfile, so that gdb can be used if
>    necessary.

I want to complete SSH transporting support first.
Let's have discussion about the above feature after SSH transporting support.


Thanks
Ken'ichi Ohmichi
-----------------------------------------------------

Comment 6 Dave Anderson 2011-01-27 10:33:26 UTC
(1) There is no benefit to using the perl script (which is already part
of the kexec-tools package) vs. using makedumpfile -R".  They both
require the use of a secondary step in order to transform the dumpfile,
which is what this feature request is trying to avoid.

(2) The fact that gdb would not be able be use the flat dumpfile is
not important.  

So the question is whether it would be possible to have the vmcore.flat
file be a "supported" dumpfile format.

Comment 7 Dave Anderson 2011-01-27 11:44:48 UTC
For crash utility support, there basically needs to be two capabilities:

(1) recognize the vmcore.flat header as a "flat" format file, and
(2) a read_vmcore_flat() function, which seeks to and reads a requested
    physical address.  (similar to read_diskdump(), read_kdump(), etc.)

I'm presuming that there are actually 2 vmcore.flat formats, depending
upon whether "makedumpfile -c" was used?

In any case, is/are there "read a physical address" function(s) in the
makedumpfile source code that can be essentially "ported" to the crash
utility?

Comment 8 Ken'ichi Ohmichi 2011-01-28 05:39:11 UTC
> In any case, is/are there "read a physical address" function(s) in the
> makedumpfile source code that can be essentially "ported" to the crash
> utility?

That's right.
I am making some patches of the crash utility for supporting the flattened
format directly.
When completing them, I will post them.

Comment 9 Ken'ichi Ohmichi 2011-01-28 07:33:47 UTC
I posted the patch for implementing the above in the following mail.
https://www.redhat.com/archives/crash-utility/2011-January/msg00080.html

Could you please review/test it ?

Comment 10 Dave Anderson 2011-01-28 14:42:28 UTC
(In reply to comment #9)
> I posted the patch for implementing the above in the following mail.
> https://www.redhat.com/archives/crash-utility/2011-January/msg00080.html
> 
> Could you please review/test it ?

I sure will, Ken'ichi, and as we say in English: You are the *man*!

Thanks!!!

Comment 11 Dave Anderson 2011-02-01 18:29:19 UTC
Thanks again, Ken'ichi -- I have reviewed, tested, modified slightly, and
queued your patch for the next upstream crash release:

Re: [Crash-utility] [PATCH] crash: Support a dumpfile in the flattened format.
https://www.redhat.com/archives/crash-utility/2011-February/msg00001.html

Comment 12 Dave Anderson 2011-02-25 17:50:20 UTC
Fixed in upstream version 5.1.2:

http://people.redhat.com/anderson/crash.changelog#5_1_2:

5.1.2    - Added the /dev/crash memory driver Makefile and source file to
         [ ... cut ... ] 

         - Implemented support for makedumpfile's "vmcore.flat" dumpfile format.
           It is no longer necessary to revert the flat dumpfile back into an 
           ELF vmcore or compressed kdump vmcore with "makedumpfile -R", or with
           the "makedumpfile-R.pl" script.  Without the patch, attempting to use
           a flat dumpfile fails with the message "crash: vmcore.flat: not a 
           supported file format".
           (oomichi.nec.co.jp)

Available in Fedora 5.1.2-2:

http://people.redhat.com/anderson/crash.changelog#5_1_2_2:

5.1.2-2  - Fixes for the gdb-7.0 sources to address gcc-4.6 compile failures of:
           [ ... cut ... ]

           Available in Fedora Rawhide devel branch:
             build: crash-5.1.2-2.fc16
               http://koji.fedoraproject.org/koji/buildinfo?buildID=230817

           Available in Fedora 15 branch:
             build: crash-5.1.2-2.fc15
               http://koji.fedoraproject.org/koji/buildinfo?buildID=230818

           (02/25/11)