lkml.org 
[lkml]   [2014]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] xen/setup: add paranoid index check and warning
From
On Tue, Oct 14, 2014 at 9:09 AM, David Vrabel <david.vrabel@citrix.com> wrote:
> On 14/10/14 15:04, Martin Kelly wrote:
>> On 10/14/2014 02:22 AM, David Vrabel wrote:
>>> On 14/10/14 02:19, Martin Kelly wrote:
>>>> In a call to set_phys_range_identity, i-1 is used without checking that
>>>> i is non-zero. Although unlikely, a bug in the code before it could
>>>> cause the value to be 0, leading to erroneous behavior. This patch adds
>>>> a check against 0 value and a corresponding warning.
>>>
>>> This can only happen if the toolstack supplies a memory map with zero
>>> entries. I could see justification for adding a panic at the top of
>>> this function in this case, but I can't see the usefulness of this warning.
>>>
>>
>> Yes, a panic is probably appropriate. What do you think about the
>> relative merits of panicing in the callers vs. in the
>> sanitize_e820_map function itself (thus to avoid a bunch of similar
>> error checks in the callers)?
>
> For Xen, it should panic immediately after getting the memory map.
>
> You will note that there is fallback code for the case when no memory
> map is provided. But I do not think this should be used in the case
> where the toolstack provided an empty memory map.
>
> David

Sounds like the flow should be as follows:
1) Ask Xen for the memory map.
2) If no memory map is provided, use fallback code.
3) If the memory map has 0 entries, panic.

I will revise the patch to do that.


\
 
 \ /
  Last update: 2014-10-14 19:01    [W:0.047 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site