[okl4-developer] Questions about pd_ref and roottask pagefault

Nelson Tam nelson at ok-labs.com
Tue Apr 15 16:11:21 EST 2008


Hi Yang,

On 09/04/2008, at 5:05 PM, yangxi wrote:
>
> Yesterday, I re-installed UBUNTU to my laptop, with the same toolchain
> but there is a roottask pagefault. When I copy the build system to
> paulaner and compile it, the roottask disappear.
>
> I figure out the reason is that in function get_pd(iguana_server.c),
> there is the_pd = (struct pd *)(pd_ref & ~IID_MASK). But the return
> value of pd_create(malloc in it) function is not always align on 8  
> bytes
> bound. For example it return 0x80027824 for struct pd *. So the get_pd
> will return the NULL and the pd_ext_l4_space(_pd) does not check  
> whether
> it is NULL and read the address of _pd->extension. After I change  
> the_pd
> = (struct pd*)(pd_ref), there is no page fault.
>
> My question is
> 1)What is the function of (struct pd *)(pd_ref &~IID_MASK), what is  
> the
> function of the low 3 bits of pd_ref?
> 2)If iguana use the low three bits for other security function, why
> malloc will return a pointer not align on 8 bytes?

Each objref_t returned by Iguana should be aligned to 8 bytes.  As  
you've correctly noted, the last 3 bits of each objref_t is used to  
represent the rwx permissions on the object.  That's why pd and thread  
objects in Iguana are not malloc()'ed, but allocated from a pool of  
free structures.

Can you please confirm whether there is a malloc() in pd_create()?   
There shouldn't be one if you're using the 1.5 public release.
--
(nt)

Nelson Tam

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1560 bytes
Desc: not available
Url : http://lists.okl4.org/pipermail/developer/attachments/20080415/aa55a611/attachment.bin 


More information about the Developer mailing list