composite
composite copied to clipboard
Static check: RETYPE KERN or USER to UNTYPED wouldn't work
Based on the code review, RETYPE to COSFRAME wouldn't work because it calls pgtbl_get_cosframe()
which is an API to get a COSFRAME and would return -EPERM
if this is not UNTYPED/COSFRAME memory. Maybe we need an equivalent get function to get TYPED frame and call it instead.
REF: https://github.com/gparmer/Composite/blob/ppos/src/kernel/capinv.c#L1240
Please make it clear what the problem is. I don't understand, and I've read this about 5 times ;-)
The problem is with the Kernel API for Retyping User/Kernel typed memory to Untyped COS Frame: CAPTBL_OP_MEM_RETYPE2FRAME
. https://github.com/gparmer/Composite/blob/ppos/src/kernel/capinv.c#L1235-L1246
The purpose of this API as I understand is to Retype KMEM(kernel memory) or UMEM(user memory) to COSFRAME (untyped memory). But instead of Looking up for the Typed memory using some pgtbl_get_kmem
/pgtbl_get_umem
equivalent, calls pgtbl_get_cosframe
which only works on COSFRAME (untyped) and returns failure(-EPERM
) if we are looking up for KMEM/UMEM typed memory.
Hence, this Kernel API(CAPTBL_OP_MEM_RETYPE2FRAME
) would always fail when we try to Retype User
/Kernel
Memory to Untyped
(FRAME).