From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
Stefan Bader <stefan.bader@canonical.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [18/70] xen: p2m: correctly initialize partial p2m leaf
Date: Tue, 22 Feb 2011 14:16:57 -0800 [thread overview]
Message-ID: <20110222221838.863586483@clark.kroah.org> (raw)
In-Reply-To: <20110222222003.GA15831@kroah.com>
2.6.37-stable review patch. If anyone has any objections, please let us know.
------------------
From: Stefan Bader <stefan.bader@canonical.com>
commit 8e1b4cf2108488ccfb9a3e7ed7cd85a435e01d4b upstream.
After changing the p2m mapping to a tree by
commit 58e05027b530ff081ecea68e38de8d59db8f87e0
xen: convert p2m to a 3 level tree
and trying to boot a DomU with 615MB of memory, the following crash was
observed in the dump:
kernel direct mapping tables up to 26f00000 @ 1ec4000-1fff000
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<c0107397>] xen_set_pte+0x27/0x60
*pdpt = 0000000000000000 *pde = 0000000000000000
Adding further debug statements showed that when trying to set up
pfn=0x26700 the returned mapping was invalid.
pfn=0x266ff calling set_pte(0xc1fe77f8, 0x6b3003)
pfn=0x26700 calling set_pte(0xc1fe7800, 0x3)
Although the last_pfn obtained from the startup info is 0x26700, which
should in turn not be hit, the additional 8MB which are added as extra
memory normally seem to be ok. This lead to looking into the initial
p2m tree construction, which uses the smaller value and assuming that
there is other code handling the extra memory.
When the p2m tree is set up, the leaves are directly pointed to the
array which the domain builder set up. But if the mapping is not on a
boundary that fits into one p2m page, this will result in the last leaf
being only partially valid. And as the invalid entries are not
initialized in that case, things go badly wrong.
I am trying to fix that by checking whether the current leaf is a
complete map and if not, allocate a completely new page and copy only
the valid pointers there. This may not be the most efficient or elegant
solution, but at least it seems to allow me booting DomUs with memory
assignments all over the range.
BugLink: http://bugs.launchpad.net/bugs/686692
[v2: Redid a bit of commit wording and fixed a compile warning]
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
arch/x86/xen/mmu.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -395,7 +395,25 @@ void __init xen_build_dynamic_phys_to_ma
p2m_top[topidx] = mid;
}
- p2m_top[topidx][mididx] = &mfn_list[pfn];
+ /*
+ * As long as the mfn_list has enough entries to completely
+ * fill a p2m page, pointing into the array is ok. But if
+ * not the entries beyond the last pfn will be undefined.
+ * And guessing that the 'what-ever-there-is' does not take it
+ * too kindly when changing it to invalid markers, a new page
+ * is allocated, initialized and filled with the valid part.
+ */
+ if (unlikely(pfn + P2M_PER_PAGE > max_pfn)) {
+ unsigned long p2midx;
+ unsigned long *p2m = extend_brk(PAGE_SIZE, PAGE_SIZE);
+ p2m_init(p2m);
+
+ for (p2midx = 0; pfn + p2midx < max_pfn; p2midx++) {
+ p2m[p2midx] = mfn_list[pfn + p2midx];
+ }
+ p2m_top[topidx][mididx] = p2m;
+ } else
+ p2m_top[topidx][mididx] = &mfn_list[pfn];
}
}
next prev parent reply other threads:[~2011-02-22 22:34 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 22:20 [00/70] 2.6.37.2-stable review Greg KH
2011-02-22 22:16 ` [01/70] NFSD: memory corruption due to writing beyond the stat array Greg KH
2011-02-22 22:16 ` [02/70] [SCSI] mptfusion: mptctl_release is required in mptctl.c Greg KH
2011-02-22 22:16 ` [03/70] [SCSI] mptfusion: Fix Incorrect return value in mptscsih_dev_reset Greg KH
2011-02-22 22:16 ` [04/70] drm/i915/sdvo: If we have an EDID confirm it matches the mode of the connection Greg KH
2011-02-22 22:16 ` [05/70] drm/radeon/kms: fix interlaced modes on dce4+ Greg KH
2011-02-22 22:16 ` [06/70] drm/radeon: fix memory debugging since d961db75ce86a84f1f04e91ad1014653ed7d9f46 Greg KH
2011-02-22 22:16 ` [07/70] drm/radeon/kms: add connector table for mac g5 9600 Greg KH
2011-02-22 22:16 ` [08/70] drm/radeon/kms: improve 6xx/7xx CS error output Greg KH
2011-02-22 22:16 ` [09/70] drm/radeon/kms: add bounds checking to avivo pll algo Greg KH
2011-02-22 22:16 ` [10/70] drm/radeon/kms: hopefully fix pll issues for real (v3) Greg KH
2011-02-22 22:16 ` [11/70] drm/nouveau: Only select ACPI_VIDEO if its dependencies are met Greg KH
2011-02-22 22:16 ` [12/70] vt: fix issue when fbcon wants to takeover a second time Greg KH
2011-02-22 22:16 ` [13/70] ARM: 6606/1: sa1100: Fix platform device registration Greg KH
2011-02-22 22:16 ` [14/70] HID: magicmouse: Dont report REL_{X, Y} for Magic Trackpad Greg KH
2011-02-22 22:16 ` [15/70] perf timechart: Adjust perf timechart to the new power events Greg KH
2011-02-23 0:17 ` Thomas Renninger
2011-02-24 18:22 ` Greg KH
2011-02-22 22:16 ` [16/70] x86: Clear irqstack thread_info Greg KH
2011-02-22 22:16 ` [17/70] drm/i915: make DP training try a little harder Greg KH
2011-02-22 22:16 ` Greg KH [this message]
2011-02-22 22:16 ` [19/70] xen/p2m: Mark INVALID_P2M_ENTRY the mfn_list past max_pfn Greg KH
2011-02-22 22:16 ` [20/70] [media] [v3,media] av7110: check for negative array offset Greg KH
2011-02-22 22:17 ` [21/70] xfs: fix dquot shaker deadlock Greg KH
2011-02-22 22:17 ` [22/70] HID: add Add Cando touch screen 10.1-inch product id Greg KH
2011-02-22 22:17 ` [23/70] HID: Switch turbox/mosart touchscreen to hid-mosart Greg KH
2011-02-22 22:17 ` [24/70] CRED: Fix kernel panic upon security_file_alloc() failure Greg KH
2011-02-22 22:17 ` [25/70] btrfs: prevent heap corruption in btrfs_ioctl_space_info() Greg KH
2011-02-22 22:17 ` [26/70] CRED: Fix BUG() upon security_cred_alloc_blank() failure Greg KH
2011-02-22 22:17 ` [27/70] CRED: Fix memory and refcount leaks upon security_prepare_creds() failure Greg KH
2011-02-22 22:17 ` [28/70] staging: brcm80211: bugfix for softmac crash on multi cpu configurations Greg KH
2011-02-23 2:23 ` [Stable-review] " Ben Hutchings
2011-02-23 7:40 ` Arend van Spriel
2011-02-23 18:06 ` Greg KH
2011-02-23 20:24 ` Arend van Spriel
2011-02-24 13:10 ` Roland Vossen
2011-02-24 18:21 ` Greg KH
2011-02-24 20:47 ` Arend van Spriel
2011-02-25 0:13 ` [stable] " Greg KH
2011-02-22 22:17 ` [29/70] security: add cred argument to security_capable() Greg KH
2011-02-22 22:17 ` [30/70] pci: use security_capable() when checking capablities during config space read Greg KH
2011-02-22 22:17 ` [31/70] ACPI / Wakeup: Enable button GPEs unconditionally during initialization Greg KH
2011-02-22 22:17 ` [32/70] nfsd: correctly handle return value from nfsd_map_name_to_* Greg KH
2011-02-22 22:17 ` [33/70] x86, hotplug: Fix powersavings with offlined cores on AMD Greg KH
2011-02-22 22:17 ` [34/70] s390: remove task_show_regs Greg KH
2011-02-22 22:17 ` [35/70] x86, mrst: Set correct APB timer IRQ affinity for secondary cpu Greg KH
2011-02-22 22:17 ` [36/70] PM / Hibernate: Return error code when alloc_image_page() fails Greg KH
2011-02-22 22:17 ` [37/70] drm/radeon/kms: add missing frac fb div flag for dce4+ Greg KH
2011-02-22 22:17 ` [38/70] fs/partitions: Validate map_count in Mac partition tables Greg KH
2011-02-22 22:17 ` [39/70] workqueue: wake up a worker when a rescuer is leaving a gcwq Greg KH
2011-02-22 22:17 ` [40/70] workqueue: make sure MAYDAY_INITIAL_TIMEOUT is at least 2 jiffies long Greg KH
2011-02-22 22:17 ` [41/70] net: deinit automatic LIST_HEAD Greg KH
2011-02-22 22:17 ` [42/70] iwl3945: remove plcp check Greg KH
2011-02-22 22:17 ` [43/70] ALSA: HDA: Add position_fix quirk for an Asus device Greg KH
2011-02-22 22:17 ` [44/70] ALSA: caiaq - Fix possible string-buffer overflow Greg KH
2011-02-22 22:17 ` [45/70] ALSA: HDA: Do not announce false surround in Conexant auto Greg KH
2011-02-22 22:17 ` [46/70] hwmon: (lm85) extend to support EMC6D103 chips Greg KH
2011-02-22 22:17 ` [47/70] x86, AMD, PCI: Add AMD northbridge PCI device id for CPU families 12h and 14h Greg KH
2011-02-22 22:17 ` [48/70] hwmon: (k10temp) add support for AMD Family 12h/14h CPUs Greg KH
2011-02-22 22:17 ` [49/70] hwmon: (jc42) fix type mismatch Greg KH
2011-02-22 22:17 ` [50/70] hwmon: (jc42) more helpful documentation Greg KH
2011-02-22 22:17 ` [51/70] hwmon: (jc42) do not allow writing to locked registers Greg KH
2011-02-22 22:17 ` [52/70] netfilter: fix race in conntrack between dump_table and destroy Greg KH
2011-02-22 22:17 ` [53/70] netfilter: ctnetlink: fix missing refcount increment during dumps Greg KH
2011-02-22 22:17 ` [54/70] [media] radio-aimslab.c needs #include <linux/delay.h> Greg KH
2011-02-22 22:17 ` [55/70] ARM: Ensure predictable endian state on signal handler entry Greg KH
2011-02-22 22:17 ` [56/70] ARM: Keep exit text/data around for SMP_ON_UP Greg KH
2011-02-22 22:17 ` [57/70] cifs: fix handling of scopeid in cifs_convert_address Greg KH
2011-02-22 22:17 ` [58/70] cifs: Fix regression in LANMAN (LM) auth code Greg KH
2011-02-22 22:17 ` [59/70] acer-wmi: Fix capitalisation of GUID Greg KH
2011-02-22 22:17 ` [60/70] pcmcia: re-enable Zoomed Video support Greg KH
2011-02-22 22:17 ` [61/70] eCryptfs: Copy up lower inode attrs in getattr Greg KH
2011-02-22 22:17 ` [62/70] genirq: Prevent access beyond allocated_irqs bitmap Greg KH
2011-02-22 22:17 ` [63/70] genirq: Disable the SHIRQ_DEBUG call in request_threaded_irq for now Greg KH
2011-02-22 22:17 ` [64/70] perf: Fix throttle logic Greg KH
2011-02-22 22:17 ` [65/70] ASoC: WM8903: Fix mic detection enable logic Greg KH
2011-02-22 22:17 ` [66/70] net: can: janz-ican3: world-writable sysfs termination file Greg KH
2011-02-22 22:17 ` [67/70] platform: x86: acer-wmi: world-writable sysfs threeg file Greg KH
2011-02-22 22:17 ` [68/70] platform: x86: asus_acpi: world-writable procfs files Greg KH
2011-02-22 22:17 ` [69/70] platform: x86: tc1100-wmi: world-writable sysfs wireless and jogdial files Greg KH
2011-02-22 22:17 ` [70/70] Revert: tpm_tis: Use timeouts returned from TPM Greg KH
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=20110222221838.863586483@clark.kroah.org \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--cc=stefan.bader@canonical.com \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®