v_insert() in Mem_space class for ARM architecture

Alexander Warg alexander.warg at os.inf.tu-dresden.de
Wed Oct 19 09:36:13 CEST 2011


On Tue, 2011-10-18 at 10:49 +0900, Jung Hyun Yoo wrote:
> Hi,
> 
> 
> 
> During looking into the source code of v_insert() function in
> mem_space-arm.cpp file, I found two cases where it returns improper
> Mem_space::Status.
> 
> 
> 
> Case #1
> When the size parameter of v_insert() is 0x100000 (that is, section mapping
> is asked), and the entry in the corresponding first-level page table
> indicates a coarse second-level page table (that is, it’s already valid) and
> only the entry in the second-level table is invalid:
> v_insert() function returns Insert_OK status.
> But it seems proper to return Insert_err_exists because there is already
> valid entry and inserting a new entry fails.

In this case, the Page_table::walk function returns an entry in the
coarse page table, not the first level, and the size check in v_insert
leads to an Insert_err_exists. So this should be correct.



> Case #2
> When the size parameter of v_insert() is 0x1000 (that is, 4KB small page
> mapping is asked), and the memory allocation for creating a coarse
> second-level page table fails in Page_table::walk() function:
> v_insert() returns Insert_OK status.
> But it seems proper to return Insert_err_nomem because due to memory
> shortage inserting a new entry fails.

This case is really a bug, so I fixed it, thanks. In that case
Page_table::walk returns the invalid first-level entry and an additional
size check in v_insert fixes the wrong behavior.


-- 
Alex





More information about the l4-hackers mailing list