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

Dave Anderson
2013-09-16T19:45:34Z

Recent testing on very large memory systems dictates that an
update is required for the compressed kdump header generated
by makedumpfile.

The dumpfile header has this field, which was inherited from
the old "diskdump" facility:

struct disk_dump_header {
...
unsigned int max_mapnr; /* = max_mapnr */
...

and which, among other things, is used by the crash utility as a
delimiter to determine whether a physical address read request is
legitimate. And obviously the field cannot handle PFN values greater
than 32-bits.

The makedumpfile source code does have its own max_mapnr representation
in its DumpInfo structure in "makedumpfile.h":

struct DumpInfo {
...
unsigned long long max_mapnr; /* number of page descriptor */
...

But in its "diskdump_mod.h" file, it carries forward the old diskdump
header format, which has the 32-bit field:

struct disk_dump_header {
...
unsigned int max_mapnr; /* = max_mapnr */
...

And here in "makedumpfile.c", the inadvertent truncation occurs
when the PFN is greater than 32-bits:

int
write_kdump_header(void)
{
...
dh->max_mapnr = info->max_mapnr;
...

The 32-bit field has also been carried forward into the SADUMP header
as well, which has this in "sadump_mod.h":

struct sadump_header {
...
uint32_t max_mapnr; /* = max_mapnr */
...

And when these header structures change, the crash utility will need
to be changed accordingly.

Preferably for backwards-compatibility, a new header_version can be
created, with the new expanded field located in the kdump_sub_header
so that the original base structure can remain as-is. But I leave that
up to the maintainers.

Thanks,
Dave