From: David Vrabel <david.vrabel@citrix.com>
To: xen-devel@lists.xen.org
Cc: David Vrabel <david.vrabel@citrix.com>,
Jan Beulich <jan.beulich@suse.com>
Subject: [PATCH 2/2] kexec: fail image loads if the page tables cannot be built
Date: Wed, 13 Nov 2013 14:43:49 +0000 [thread overview]
Message-ID: <1384353829-3917-3-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1384353829-3917-1-git-send-email-david.vrabel@citrix.com>
From: David Vrabel <david.vrabel@citrix.com>
CID 1128566
If an image source page is allocated in kimage_alloc_page() but the
machine_kexec_add_page() fails, the image may appear to load
succesfully but it will not execute. The relocation will fault
(rebooting the host) when trying to copy the source page, as it is not
mapped.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
xen/common/kimage.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/xen/common/kimage.c b/xen/common/kimage.c
index 5c3e3b3..91943f1 100644
--- a/xen/common/kimage.c
+++ b/xen/common/kimage.c
@@ -592,6 +592,7 @@ static struct page_info *kimage_alloc_page(struct kexec_image *image,
*/
struct page_info *page;
paddr_t addr;
+ int ret;
/*
* Walk through the list of destination pages, and see if I have a
@@ -656,7 +657,13 @@ static struct page_info *kimage_alloc_page(struct kexec_image *image,
}
}
found:
- machine_kexec_add_page(image, page_to_maddr(page), page_to_maddr(page));
+ ret = machine_kexec_add_page(image, page_to_maddr(page),
+ page_to_maddr(page));
+ if ( ret < 0 )
+ {
+ free_domheap_page(page);
+ return NULL;
+ }
return page;
}
--
1.7.2.5
next prev parent reply other threads:[~2013-11-13 14:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 14:43 [PATCHv1 0/2]: Xen: kexec coverity fixes David Vrabel
2013-11-13 14:43 ` [PATCH 1/2] kexec: fix kexec_lock use in kexec_swap_images() David Vrabel
2013-11-13 14:43 ` David Vrabel [this message]
2013-11-13 14:47 ` [PATCHv1 0/2]: Xen: kexec coverity fixes Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1384353829-3917-3-git-send-email-david.vrabel@citrix.com \
--to=david.vrabel@citrix.com \
--cc=jan.beulich@suse.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).