Hi Nathaniel, On 3/2/2022 8:57 AM, Nathaniel McCallum wrote: > Perhaps it would be better for us to have a shared understanding on > how the patches as posted are supposed to work in the most common > cases? I'm thinking here of projects such as Enarx, Gramine and > Occulum, which all have a similar process. Namely they execute an > executable (called exec in the below chart) which has things like > syscalls handled by a shim. These two components (shim and exec) are > supported by a non-enclave userspace runtime. Given this common > architectural pattern, this is how I understand adding pages via an > exec call to mmap() to work. > > https://mermaid.live/edit#pako:eNp1k81qwzAQhF9F6NRCAu1Vh0BIRemhoeSHBuIettYmFpElVZZLQ8i7144sJ8aOT2bmY3d2vT7R1AikjBb4U6JO8UXC3kGeaFI9FpyXqbSgPTmg06j6uiu1lzn2jSKTA2XwD9NEB31uPBLzi-6iMpLnYB8Wn4-kOBYpKBW52iXj8WQSmzEy5Zvt01ewG5HUQN2UEc7nK77YPjdALd64GWih8NpkALGwR_JtzOGAaKXexyTKGEt2pgoMaXahgj5Qgk9nM_6xGvDDJpsmOyiVv0LB62B8un4dBDrLiLPeWciCL9fvvKVQizhSG6stFz9Df7sxUpcYitR-SodFO2A_Vw-7l4nzzduqjX9bKJxOHDDeBB3RHF0OUlS3faq1hPoMqzulrHoVGPZOE32u0NIK8MiF9MZRtgNV4IhC6c3yqFPKvCsxQs3_0VDnfzf-CPg > > This only covers adding RW pages. I haven't even tackled permission > changes yet. Is that understanding correct? If not, please provide an > alternative sequence diagram to explain how you expect this to be > used. Please find my attempt linked below: https://mermaid.live/edit#pako:eNqFUsFqAjEQ_ZWQUwsK7XUPgthQeqiUVang9jAkoxu6m2yzWVsR_72J2WTbKnSOb97MvPeSI-VaIM1oix8dKo4PEnYG6kIRVw0YK7lsQFlSghGfYPCy845GYXWJm05ZWV8ZaEt55QB-IS9UwOfaItF7NGc0I3UNzU3-ekvaQ8uhqiLPd8l4PJnEYxmZsvXm7i20e5B4QlA5rAqMgJJfG9Ixg21X2ctVXn9GGJsvWb65729FSZXWDdlqpxx46Qzu-gB8-cHzhhim2zKdzdjLcuAAt3IPzv6Qkq84EdxGM3492UJS-cdSpLHp6nEgCPz3RjI5NPvAlRisJjspOsbWT8sUyc_MwjuynC1Wzyw9EB3RGk0NUrgvePRYQW2J7tNQd5sKDN5ooU6O2jXCiWZCWm1otoWqxRGFzurFQXGaWdNhJPXfuGedvgFejOuH The changes include: * Move mmap() to occur before attempting EACCEPT on the addresses. This is required for EACCEPT (as well as any subsequent access from within the enclave) to be able to access the pages. * Remove AEX[1] to the runtime within the loop. After EAUG returns execution will return to the instruction pointer that triggered the #PF, EACCEPT, this will cause the EACCEPT to be run again, this time succeeding. This is based on the implementation within this series. When supporting the new ioctl() requested by Jarkko there will be an additional ioctl() required before the loop. Reinette