ec2: Replace mmap with malloc implementation.