Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support local Anisette generation #2

Open
malmeloo opened this issue Jan 1, 2024 · 4 comments
Open

Support local Anisette generation #2

malmeloo opened this issue Jan 1, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@malmeloo
Copy link
Owner

malmeloo commented Jan 1, 2024

Support local anisette header generation using pyprovision.

@malmeloo malmeloo added the enhancement New feature or request label Jan 1, 2024
@biemster
Copy link

I doubt this can be included in the pypi package, since building pyprovision requires a D compiler which is not really a default install usually.
This might be possible however (on x86-64) if this could run with cosmopolitan: Smoothstep/apple-gen#1 (and if they finally add anisette support)

@malmeloo
Copy link
Owner Author

I have don't have much experience with lower-lever languages, but I was actually messing with this yesterday and it's pretty simple to build a python wheel that includes libprovision.so. The downside is that it still relies on externally installed libraries; I did briefly try to "repair" the wheel using https://github.com/pypa/auditwheel, but it wasn't able to find all external dependencies. That would still require a separate wheel for each architecture / OS / python version though, and would probably be tricky in terms of licensing, to say the least.

That project looks quite interesting though, worth keeping an eye at!

@JayFoxRox
Copy link

I've just made https://github.com/JayFoxRox/pyprovision-uc public.
I'm not sure when I'll get around to finalizing and packaging it up. For now, you can probably install it via pip git install:

pip3 install --user -U git+https://github.com/JayFoxRox/pyprovision-uc.git#egg=pyprovision-uc

I made this when I wasn't able to make pyprovision / D compiler work on my setup within a couple of hours.

It's still unfinished and still needs to be cleaned up.
But I've been using a version of this (similar to the one I made public) for a couple of weeks by now.

I had a lot of problems with the stat syscall emulation, so the code is particularly unclean there.

There's also good chances that there's issues with endianess or 32-bit (because I'm using host ctypes for ARM guest code).
I'm running this on macOS on M1 (so far) and most things appear to be right.
I'll move my local installation to a raspberry pi 4 soon (and plan to test armv7 soon and aarch64 in a couple of weeks) - I'll fix up any issues I'll find.

There's also a chance that the VM will become unstable over time.
The emulated memory layout shows that I had to workaround some of the worst issues.
So what I have working now is the bare minimum.
I usually spawn a new Python process for every request, so improving it much further is not of interest to me.

I also plan to modify the API a bit in the future - I don't like how it operates on a real filesystem.

Also CC @Dadoum and @biemster

@malmeloo
Copy link
Owner Author

Oh that's really cool! I just tried it out myself and while I did have to fix some things (create the directories, some debugPrint issues), it runs perfectly otherwise. Most of the code looks like black magic to me, but if you need help with anything else (refactoring?) let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants