From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: Christoph Egger <Christoph.Egger@amd.com>,
Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH 4.0-testing 01/10] libxc: Do not use dom0 physmem as parameter to lzma decoder
Date: Mon, 11 Feb 2013 13:12:44 +0000 [thread overview]
Message-ID: <1360588373-779-1-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1360588355.20449.34.camel@zakaz.uk.xensource.com>
From: Ian Jackson <Ian.Jackson@eu.citrix.com>
It's not clear why a userspace lzma decode would want to use that
particular value, what bearing it has on anything or why it would
assume it could use 1/3 of the total RAM in the system (potentially
quite a large amount of RAM) as opposed to any other limit number.
Instead, hardcode 32Mby.
This reverts 22830:c80960244942, removes the xc_get_physmem/physmem
function entirely, and replaces the expression at the call site with a
fixed constant.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@eu.citrix.com>
Cc: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
tools/libxc/xc_dom_bzimageloader.c | 23 +----------------------
1 files changed, 1 insertions(+), 22 deletions(-)
diff --git a/tools/libxc/xc_dom_bzimageloader.c b/tools/libxc/xc_dom_bzimageloader.c
index 398dbff..aa5abc7 100644
--- a/tools/libxc/xc_dom_bzimageloader.c
+++ b/tools/libxc/xc_dom_bzimageloader.c
@@ -149,27 +149,6 @@ static int xc_try_bzip2_decode(
#include <lzma.h>
-static uint64_t physmem(void)
-{
- uint64_t ret = 0;
- const long pagesize = sysconf(_SC_PAGESIZE);
- const long pages = sysconf(_SC_PHYS_PAGES);
-
- if ( (pagesize != -1) || (pages != -1) )
- {
- /*
- * According to docs, pagesize * pages can overflow.
- * Simple case is 32-bit box with 4 GiB or more RAM,
- * which may report exactly 4 GiB of RAM, and "long"
- * being 32-bit will overflow. Casting to uint64_t
- * hopefully avoids overflows in the near future.
- */
- ret = (uint64_t)(pagesize) * (uint64_t)(pages);
- }
-
- return ret;
-}
-
static int xc_try_lzma_decode(
struct xc_dom_image *dom, void **blob, size_t *size)
{
@@ -182,7 +161,7 @@ static int xc_try_lzma_decode(
int outsize;
const char *msg;
- ret = lzma_alone_decoder(&stream, physmem() / 3);
+ ret = lzma_alone_decoder(&stream, 32*1024*1024);
if ( ret != LZMA_OK )
{
xc_dom_printf("LZMA: Failed to init stream decoder\n");
--
1.7.2.5
next prev parent reply other threads:[~2013-02-11 13:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-11 13:12 [PATCH 4.0-testing 00/10] XSA-{25, 27, 33, 36}: Backports for 4.0 (for Debian update) Ian Campbell
2013-02-11 13:12 ` Ian Campbell [this message]
2013-02-11 13:12 ` [PATCH 4.0-testing 02/10] libxc: builder: limit maximum size of kernel/ramdisk Ian Campbell
2013-02-11 13:12 ` [PATCH 4.0-testing 03/10] hvm: Limit the size of large HVM op batches Ian Campbell
2013-02-11 13:12 ` [PATCH 4.0-testing 04/10] x86/mm: Fix loop increment in paging_log_dirty_range() Ian Campbell
2013-02-11 13:12 ` [PATCH 4.0-testing 05/10] VT-d: fix interrupt remapping source validation for devices behind legacy bridges Ian Campbell
2013-02-11 13:12 ` [PATCH 4.0-testing 06/10] AMD IOMMU: Fix an interrupt remapping issue Ian Campbell
2013-02-11 13:12 ` [PATCH 4.0-testing 07/10] ACPI: acpi_table_parse() should return handler's error code Ian Campbell
2013-02-11 13:12 ` [PATCH 4.0-testing 08/10] AMD, IOMMU: Clean up old entries in remapping tables when creating new one Ian Campbell
2013-02-11 13:12 ` [PATCH 4.0-testing 09/10] AMD, IOMMU: Disable IOMMU if SATA Combined mode is on Ian Campbell
2013-02-11 13:12 ` [PATCH 4.0-testing 10/10] AMD, IOMMU: Make per-device interrupt remapping table default Ian Campbell
2013-02-12 9:44 ` [PATCH 4.0-testing 00/10] XSA-{25, 27, 33, 36}: Backports for 4.0 (for Debian update) Jan Beulich
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=1360588373-779-1-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Christoph.Egger@amd.com \
--cc=ian.jackson@eu.citrix.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).