[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] xen/arm: Fix crash if last memory section is bigger than 1gb



setup_xenheap_mappings setup head memory on Arm 32 has a limit of 1gb.
On system with large memory is possible that there are no blocks of memory
smaller than 1gb leading xenheap_pages to be more than 1gb.
This cause memory errors trying to access heap after the 1gb limit.

Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>
---
 xen/arch/arm/setup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 446de8a..e223d1b 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -509,6 +509,7 @@ static void __init setup_mm(unsigned long
dtb_paddr, size_t dtb_size)
     heap_pages = ram_pages;
     xenheap_pages = (heap_pages/8 + 0x1fffUL) & ~0x1fffUL;
     xenheap_pages = max(xenheap_pages, 128UL<<(20-PAGE_SHIFT));
+    xenheap_pages = min(xenheap_pages, 1UL<<(30-PAGE_SHIFT));

     do
     {
-- 
1.9.1


No problems,
  Frediano


2014-10-02 15:30 GMT+01:00 Julien Grall <julien.grall@xxxxxxxxxx>:
> Hi Frediano,
>
> In general, we add in the subject the version of the subject (for
> instance [PATCH v3]).
>
> Sorry to ask you few others changes. The title doesn't seem suitable,
> it's not a workaround (it would mean it's temporary) but an error in the
> code.
>
> On 10/02/2014 03:07 PM, Frediano Ziglio wrote:
>> setup_xenheap_mappings setup head memory on Arm 32 has a limit of 1gb.
>> On system with large memory is possible that there are no blocks of memory
>> smaller than 1gb leading xenheap_pages to be more than 1gb.
>> This cause memory errors trying to access heap after the 1gb limit.
>>
>> Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>
>> ---
>>  xen/arch/arm/setup.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
>> index 446de8a..e223d1b 100644
>> --- a/xen/arch/arm/setup.c
>> +++ b/xen/arch/arm/setup.c
>> @@ -509,6 +509,7 @@ static void __init setup_mm(unsigned long
>> dtb_paddr, size_t dtb_size)
>>      heap_pages = ram_pages;
>>      xenheap_pages = (heap_pages/8 + 0x1fffUL) & ~0x1fffUL;
>>      xenheap_pages = max(xenheap_pages, 128UL<<(20-PAGE_SHIFT));
>> +    xenheap_pages = min(xenheap_pages, 1UL<<(30-PAGE_SHIFT));
>
> Can you also update the comment above, saying we are requesting at most 1G?
>
> With this 2 minors changes:
>
> Reviewed-by: Julien Grall <julien.grall@xxxxxxxxxx>
>
> Regards,
>
> --
> Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.