Open CuriousTommy opened 4 months ago
@CKegel If you (or your team) want to work on this, I don't mind assigning this ticket to you.
I wouldn't mind taking it up - I'd just like to get of clarity regarding the appropriate fix. It seems like a simple search and replace as I currently understand it, but that seems off.
It seems like a simple search and replace as I currently understand it, but that seems off.
Assuming that everything works fine (you're able to access the bash shell), that is pretty much what you have to do. With that being said, I would ask you to make sure that the code doesn't go into the simulator logic (inside the if ( (rootPath != NULL) )
scope). You can use of __simple_printf
to verify the code path dyld
takes.
However, if you run into the following issues:
dyld
still executes the code inside the if ( (rootPath != NULL) )
Then you will need to do some additional research/debugging to find the fix.
This looks like something we can take care of. I'll start looking into it now.
@CuriousTommy we have attempted changing the enviornment variable name to DARLING_DYLD_ROOT_PATH
but are no longer able to bring up the shell. We've been trying to debug this for a bit but are stumped. The error we recieve is:
Bootstrapping the container with launchd... Cannot open /usr/lib/dyld: No such file or directory Error connecting to shellspawn in the container (/home/user/.darling/var/run/shellspawn.sock): No such file or directory
Any insight would be appreciated.
I renenge my previous comment, we were not applying the change to all appropriate locations (darlingserver
, mldr
, and vchroot
). We are still unable to launch bash, this time as a result of dyld failing to load libSystem
. The output is included below:
Bootstrapping the container with launchd... dyld: Library not loaded: /usr/lib/libSystem.B.dylib Referenced from: /usr/libexec/darling/vchroot Reason: image not found abort_with_payload: reason: dyld: No shared cache present Library not loaded: /usr/lib/libSystem.B.dylib Referenced from: /usr/libexec/darling/vchroot Reason: image not found; code: 1 Cannot open mnt namespace file: No such file or directory
This is the same issue I was encountering a while ago, so dyld is likely getting lost somewhere. Looking through binaries on the host confirms that libSystem.B is indeed there, so right now it's a matter of finding what else is referencing DYLD_ROOT_PATH. I couldn't find anything outside of external/dyld that references it (other than what we've already replaced), and print statements seem to indicate that dyld2.cpp isn't being reached before the error.
I wonder if something has gone horribly wrong with the vchroot expand method...
Now that I think about it, it's not too surprising that this is not working (since I ran into this issue when working on ARM64 support)
What type of issue did you run into on ARM64?
What type of issue did you run into on ARM64?
It was the stat structure being different on ARM64: https://github.com/darlinghq/darling-xnu/commit/51f070bf4ba15a9d0384a81f118f6a43f0fa7c11
Edit: But this is probably not the reason why this is not working.
Background
It turns out that
dyld
uses theDYLD_ROOT_PATH
environment variable.https://github.com/darlinghq/darling-dyld/blob/63f667cf06d7ed59553adebb0c8d70a117135ac9/src/dyld2.cpp#L6598-L6612
This is an issue since
darlingserver
,mldr
, andvchroot
also use the same environment variable.https://github.com/darlinghq/darlingserver/blob/62a3321e98cbc9bc9d52c8f6f0d588e65c789954/src/darlingserver.cpp#L269
https://github.com/darlinghq/darling/blob/25afbc76428c39c3909e9efcf5caef1140425211/src/startup/mldr/mldr.c#L522-L529 https://github.com/darlinghq/darling/blob/25afbc76428c39c3909e9efcf5caef1140425211/src/vchroot/vchroot.c#L49
Solution
A proper fix would be to reword the
DYLD_ROOT_PATH
environment variable name (thatdarlingserver
,mldr
, andvchroot
uses) to something that is more specific to Darling (ex:DARLING_DYLD_ROOT_PATH
).