Skip alignment for forked enclaves
Skip alignment for forked enclaves

SGX now mmaps twice the original size for the enclave, and unmaps the
unecessary memory after doing the alignment with the new kernel. This is
causing issues for Asylo fork, as after a fork on the host, mapping the
memory with twice the size may be conflicting with the existing
untrusted memory, including the ones mapped during enclave creation, and
the snapshot used to restore the enclave. This change skips those steps
for forked enclave, as in that case the address is from an existing
enclave and we know they are aligned.
Also unmap the enclave memory before reserving them in the child process
because the new kernel leaves now leaves VMAs in the enclave address
space in the child after fork, which is not needed in Asylo fork and
causing mmap to fail.

PiperOrigin-RevId: 302522921
Change-Id: I39fe50170f576c2241ad91548cec971671e8795c

google/asylo,google/asylo,google/asylo,google/asylo,google/asylo,google/asylo