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

Tcp tunnel #119

Open
wants to merge 65 commits into
base: ipod_touch_2g_tunnel
Choose a base branch
from
Open

Conversation

jeppojeps
Copy link

TCP Tunnel - compilation ready

devos50 and others added 21 commits November 8, 2023 19:49
Added image
Fix the configure command for apple silicon macs in RUNNING.MD
This commit is intended to address the issue of stack smashing being detected when running QEMU-IOS on Microsoft Windows built with MINGW64, which causes the emulator to be unable to run.
Make qemu-ios easier to compile on Microsoft Windows
Check if Bootrom/NOR/NAND files exist before attempting to use
updated build instructions for linux & windows
@jeppojeps
Copy link
Author

@devos50 take a look and try compilation and running of normal flows, with some luck in the next days I'll start to debug the user space

@devos50
Copy link
Owner

devos50 commented Jan 8, 2024

Very nice! I'll try to check it out tonight 👍

@devos50
Copy link
Owner

devos50 commented Jan 9, 2024

I got it to compile 🎉. However, it looks like the commit history diverted from the target branch (probably because I rebased the ipod_touch_2g branch and force-pushed my changes). However, cherry-picking 3ed141c on top of the ipod_touch_2g seems to work correctly.

I'm really looking forward to seeing if you can get the guest side running!

@jeppojeps
Copy link
Author

jeppojeps commented Jan 9, 2024 via email

@jeppojeps
Copy link
Author

OK so, extra analysis, the architecture of the tcp-tunnel also requires a custom injected driver in the kernel, that they have used for multiple purposes. I don't discard the idea, but for fuzzing and for basic host-to-guest communication it requires a bit of extra time. Especially with respect to I/O and bash the usb approach seems more straightforward, given that the firmware already has a driver for that.

@devos50
Copy link
Owner

devos50 commented Jan 24, 2024

the architecture of the tcp-tunnel also requires a custom injected driver in the kernel, that they have used for multiple purposes.

I see. I have a bit of progress on the USB side though, mostly using a modified version of this code. I am able to send some bytes to the guest from my own Python script through a TCP socket. The guest USB should be fine now and the next step would be to setup another VM that acts as host. I did notice that the iPhone 6 emulator also implemented functionality for the guest to act as host, but that project and code is much more complicated. For now I guess the most important thing is to get a communication channel between the iPod Touch emulator and idevicerestore functional. I'll keep you posted!

BTW, I saw on X that you managed to do a basic system call, great stuff! 🎉

@jeppojeps
Copy link
Author

yeah, to be precise I executed /bin/bash -c ls / I had to import the right .so and everything but as you can see it works. To give more help, some of the binaries are from redsn0w and some others compiled by myself

@jeppojeps
Copy link
Author

jeppojeps commented Jan 24, 2024 via email

@jeppojeps
Copy link
Author

jeppojeps commented Jan 30, 2024

So what I found out is that it is possible to mask interrupts through swi 0x80, hence you can load r0 with an arbitrary value, i.e. 500 and call swi 0x80 as you would on Intel call int 0x80. Henceforth that is how I have made communication work e2e between guest and host. Though the helper function uses cpu_rw_debug or alike to write directly in guest memory through the buffer address that I put in r1 while calling the syscall. This effectively implements an hypercall.

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

Successfully merging this pull request may close these issues.

10 participants