mbox series

[0/5] dump: Add custom arch section support

Message ID 20220310111608.3362-1-frankja@linux.ibm.com (mailing list archive)
Headers show
Series dump: Add custom arch section support | expand

Message

Janosch Frank March 10, 2022, 11:16 a.m. UTC
Architectures already provide custom cpu data via elf notes but
there's currently no way for an architecture to add other custom data
to dumps.

s390x for instance needs to store special data in the dump when
dumping protected guests so the vm owner can decrypt the dump and
access the vm data.

Similar to the cpu notes which work by using hooks we introduce new
hooks to add custom sections. The ArchDumpInfo struct now contains
three new functions hooks that the architectures can set:

void (*arch_sections_add_fn)(void *opaque);
This function can be used to manipulate the number of sections and the
size of the cummulative section data.

uint64_t (*arch_sections_write_hdr_fn)(void *opaque, uint8_t *buff);
This function is used to write the elf headers for the custom sections
so architectures can control all values in the section headers.

void (*arch_sections_write_fn)(void *opaque, uint8_t *buff);
Lastly this function is used to write out the section data.


To make section identification easier we also introduce section string
table support.

Based on:
https://lore.kernel.org/qemu-devel/20220310110854.2701-1-frankja@linux.ibm.com/T/#t


Janosch Frank (5):
  dump: Allocate header
  dump: Split write of section headers and data and add a prepare step
  dump: Reorder struct DumpState
  dump/dump: Add section string table support
  dump/dump: Add arch section support

 dump/dump.c                | 338 +++++++++++++++++++++++++++----------
 include/sysemu/dump-arch.h |  27 +++
 include/sysemu/dump.h      |  24 ++-
 3 files changed, 294 insertions(+), 95 deletions(-)