Description
Writing a somewhat long-ish description in the hopes that this might make a good starter bug for somebody who is not scared of a little assembly.
XNU doesn't do auxv the way other platforms do; instead, it has a sort of addendum to envp, i.e. more env-style key-value pairs after the sentinel NULL at the end of envp. The (generally?) first of these begins executable_path=
and contains the path of the running binary.
If we are running assimilated on x86_64 XNU, that value is the only reliable way we have of locating the path of the running binary for use in GetProgramExecutableName
(and hence the ZipOS /zip filesystem.)
In libc/crt/crt.S
, the pseudo-auxv is currently zeroed out:
Lines 104 to 111 in 06d916b
It would be good if the executable path were stored in __program_executable_name
prior to this happening, if we are running assimilated.