vmm: add cpu segment note for coredump

The crash tool use a special note segment which named 'QEMU' to
analyze kaslr info and so on. If we don't add the 'QEMU' note
segment, crash tool can't find linux version to move on.

For now, the most convenient way is to add 'QEMU' note segment to
make crash tool happy.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
This commit is contained in:
Yi Wang
2022-05-24 10:39:55 +08:00
committed by Sebastien Boeuf
parent 0e65ca4a6c
commit ccb604e1e1
3 changed files with 364 additions and 5 deletions

View File

@@ -17,11 +17,9 @@ use crate::config::{
UserDeviceConfig, ValidationError, VdpaConfig, VmConfig, VsockConfig,
};
#[cfg(feature = "guest_debug")]
use crate::coredump::DumpState;
#[cfg(feature = "guest_debug")]
use crate::coredump::{Elf64Writable, NoteDescType};
#[cfg(feature = "guest_debug")]
use crate::coredump::{GuestDebuggable, GuestDebuggableError};
use crate::coredump::{
CpuElf64Writable, DumpState, Elf64Writable, GuestDebuggable, GuestDebuggableError, NoteDescType,
};
use crate::cpu;
use crate::device_manager::{Console, DeviceManager, DeviceManagerError, PtyPair};
use crate::device_tree::DeviceTree;
@@ -3052,6 +3050,15 @@ impl GuestDebuggable for Vm {
self.write_note(&coredump_state)?;
self.write_loads(&coredump_state)?;
self.cpu_manager
.lock()
.unwrap()
.cpu_write_elf64_note(&coredump_state)?;
self.cpu_manager
.lock()
.unwrap()
.cpu_write_vmm_note(&coredump_state)?;
self.memory_manager
.lock()
.unwrap()