Bug 603142

Summary: [RHEL6] crash needs to support (or distinguish between) both upstream version 9 and RHEL5 version 9
Product: Red Hat Enterprise Linux 6 Reporter: Dave Anderson <anderson>
Component: crashAssignee: Dave Anderson <anderson>
Status: CLOSED CURRENTRELEASE QA Contact: Han Pingtian <phan>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: mkenneth, pbonzini, phan, qcai, quintela, virt-maint, ykaul
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: crash-5.0.0-19.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 603027 Environment:
Last Closed: 2010-11-10 20:04:19 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:
Bug Depends On: 603026, 603027    
Bug Blocks:    

Description Dave Anderson 2010-06-11 16:34:08 UTC
+++ This bug was initially created as a clone of Bug #603027 +++

+++ This bug was initially created as a clone of Bug #603026 +++

Commit a82c8e4d836121cec49ccd9031438a3110f2e192 bumped the CPU version to 9, however the format is very different from the version 9 of upstream QEMU.  This causes problems in crash, which uses QEMU's savefiles as kvm core dumps.

Until now, the differences did nothing problematic, but for version 9 upstream does this:

                int32_t pending_irq = (int32_t) get_be32 (fp);
                if (pending_irq >= 0)
                        dx86->kvm.int_bitmap[pending_irq / 64] |=

instead of this:

                for (i = 0; i < 4; i++)
                        dx86->kvm.int_bitmap[i] = get_be64 (fp);

(Source code from qemu-load.c in git://git.engineering.redhat.com/users/pbonzini/qemu-reader.git).  In other words, the first 32 bits of the bitmap are treated as an index, causing an out-of-bounds access.

Of course, adding a "<= 255" check is easily done, but it's only a matter of time until RHEL5's version will hit 12 and we'll have serious problems handling both RHEL5 and RHEL6 dumps.

I suggest adding a fake __rhel5 section in the dumps for 5.5.z and 5.6, so that we can look for that in crash.  I'll attach the patch soon.

--- Additional comment from pbonzini on 2010-06-11 07:45:06 EDT ---

Created an attachment (id=423247)
patch to add support for RHEL5.6 and RHEL6

This patch is relative to crash5.0.4p12, and it adds complete support for RHEL5.6 and RHEL6.

With this patch it is also possible to load the registers for all CPUs, which may be useful---maybe crash can show the values to the user?

--- Additional comment from pbonzini on 2010-06-11 07:46:22 EDT ---

Created an attachment (id=423248)
incremental RHEL5-only patch

This patch, on top of the previous, is suitable for RHEL5.5.z, RHEL5.6, and RHEL6 as it allows reading dumps that do not have a __rhel5 marker.  It is not suitable for upstream.

--- Additional comment from pbonzini on 2010-06-11 07:51:01 EDT ---

Created an attachment (id=423250)
patch to add support for RHEL5.6 and RHEL6

fixed version of attachment 423247 [details]

--- Additional comment from anderson on 2010-06-11 12:32:57 EDT ---

> This patch, on top of the previous, is suitable for RHEL5.5.z, RHEL5.6, and
> RHEL6 as it allows reading dumps that do not have a __rhel5 marker.  It is not
> suitable for upstream.

In off-line discussions, it's been noted that the upstream version of crash
should *always* work with RHEL dumpfiles, so both patches will be applied
upstream, and the RHEL5 and RHEL6 versions of crash will follow upstream.

I have tested the patches against a RHEL5 KVM guest dumpfile taken from
a RHEL6 host, and it works OK.

I do not have a sample RHEL5 KVM guest dumpfile taken from a RHEL5 host, 
but Paolo has indicated that he will make one available to me for testing.

When that dumpfile is available for testing, I'll devel_ack this BZ and continue
the process.

I'll also clone this BZ for RHEL6.

Thanks,
  Dave

Comment 1 Dave Anderson 2010-06-11 16:37:22 UTC
The supplied patch-set has been successfully tested with a RHEL6 KVM guest
running on a RHEL6 host.

Comment 2 Dave Anderson 2010-06-11 16:38:36 UTC
(In reply to comment #1)
> The supplied patch-set has been successfully tested with a RHEL6 KVM guest
> running on a RHEL6 host.    

That should read: 

  successfully tested with a RHEL5 KVM guest running on a RHEL6 host.

Comment 3 RHEL Program Management 2010-06-11 16:52:55 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 6 Han Pingtian 2010-09-03 06:48:43 UTC
Verified with -23.el6:

[hpt@hpt 603142]$ strings 23/bin/crash|grep __rhel
__rhel5

Comment 7 releng-rhel@redhat.com 2010-11-10 20:04:19 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.