mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
libxc: Verify Magic number when reading dump
The xen core files record a magic number, but when they are loaded it isn't checked. This patch resolves this. Signed-Off-By: Horms <horms@verge.net.au>
This commit is contained in:
1 parent
67c8319788
commit
9603c69e65
3 files changed
+9
-1
No files matched your search
@@ -61,7 +61,7 @@ xc_domain_dumpcore(int xc_handle,
|
||||
|
||||
nr_pages = info.nr_pages;
|
||||
|
||||
header.xch_magic = 0xF00FEBED;
|
||||
header.xch_magic = XC_CORE_MAGIC;
|
||||
header.xch_nr_vcpus = nr_vcpus;
|
||||
header.xch_nr_pages = nr_pages;
|
||||
header.xch_ctxt_offset = sizeof(struct xc_core_header);
|
||||
|
||||
@@ -111,6 +111,13 @@ xc_waitdomain_core(
|
||||
if (read(domfd, &header, sizeof(header)) != sizeof(header))
|
||||
return -1;
|
||||
|
||||
if (header.xch_magic != XC_CORE_MAGIC) {
|
||||
printf("Magic number missmatch: 0x%08x (file) != "
|
||||
" 0x%08x (code)\n", header.xch_magic,
|
||||
XC_CORE_MAGIC);
|
||||
return -1;
|
||||
}
|
||||
|
||||
nr_pages = header.xch_nr_pages;
|
||||
nr_vcpus = header.xch_nr_vcpus;
|
||||
pages_offset = header.xch_pages_offset;
|
||||
|
||||
@@ -92,6 +92,7 @@ typedef struct xc_core_header {
|
||||
unsigned int xch_pages_offset;
|
||||
} xc_core_header_t;
|
||||
|
||||
#define XC_CORE_MAGIC 0xF00FEBED
|
||||
|
||||
long xc_ptrace_core(
|
||||
int xc_handle,
|
||||
|
||||