Re: [BUG] [compressed kdump / SADUMP] makedumpfile header truncation error

Dave Anderson
2013-09-17T13:24:00Z

----- Original Message -----
> On 09/17/2013 03:33 PM, HATAYAMA Daisuke wrote:
> > (2013/09/17 16:12), Jingbai Ma wrote:
> >> On 09/17/2013 02:55 PM, HATAYAMA Daisuke wrote:
> >>
> >> int32_t, int64_t, uint64_t, etc ... are parts of C99 standard:
> >> http://en.wikipedia.org/wiki/C_data_types
> >> All there types have been supported by GCC, so them should work on all
> >> the architectures.
> >>
> >> Although change these persistent data structure will affect both
> >> makedumpfile and crash utility, but we will benefit from the
> >> consistent data structures independent from architectures. We can
> >> analyze a dumpfile on a OS with different architecture than the
> >> crashed OS.
> >>
> >>
> >
> > I know stdint.h things and usefulness if we can use crash and makedumpfile
> > for a multiple architectures on single arch. In fact, crash already supports
> > cross platform build among some architectures thanks to Dave.

But only if the host and target architectures have the same endian-ness and
whose data type sizes match.

The only problem that has ever been seen with the current header declarations
is if an x86 crash binary is built to support the 32-bit ARM architecture.
For x86, the 64-bit off_t variables can start on a 4-byte boundary, but on ARM,
they have to start on an 8-byte boundary. That being the case, the off_t
offset_vmcoreinfo is at offset 20 when built on an x86, and at offset 24
when built on ARM:

struct kdump_sub_header {
unsigned long phys_base;
int dump_level; /* header_version 1 and later */
int split; /* header_version 2 and later */
unsigned long start_pfn; /* header_version 2 and later */
unsigned long end_pfn; /* header_version 2 and later */
off_t offset_vmcoreinfo; /* header_version 3 and later */
unsigned long size_vmcoreinfo; /* header_version 3 and later */
off_t offset_note; /* header_version 4 and later */
unsigned long size_note; /* header_version 4 and later */
off_t offset_eraseinfo; /* header_version 5 and later */
unsigned long size_eraseinfo; /* header_version 5 and later */
};

So for that anomoly, crash has to support a kdump_sub_header_ARM_target
structure that has a pad integer after the end_pfn variable.

> >
> > My question came from the fact that it looks like you introduced a single
> > modified kdump_sub_header structure for all the architectures. They might
> > have different combination of length between int and long and maybe
> > also have other each architecture specific incompatibility. It wouldn't
> > work well.
> >
> > But from your reply, I think you mean a fully new header for
> > kdump-compressed
> > format, right? If so, it must work well. But of course you need to modify
> > both of makedumpfile and crash utility to support it.
> >
>
> Yes, I would like to have a new header for kdump-compressed format. But
> I'm not sure how much code will be affected in makedumpfile and crash utility.
> I'm still under investigating, any ideas would be appreciated.

The challenging part will be the requirement to maintain backwards-compatibility,
at least in the crash utility. And backwards-compatibility would also be required
in makedumpfile, right? For example, if you want to re-filter an older compressed
kdump.

But if -- as has been done so far -- an increment of the header_version in the
disk_dump_header to signal an additional field in the kdump_sub_header would be
trivial to implement.

Dave