#
…

2022-10-06

00:28loki_val has quit [Remote host closed the connection]
00:29crabbedhaloablut has joined #asahi-re
01:03amateurece has left #asahi-re [#asahi-re]
01:38riker77_ has joined #asahi-re
01:43riker77 has quit [Ping timeout: 480 seconds]
01:43riker77_ is now known as riker77
02:12yrlf has quit [Quit: The Lounge - https://thelounge.chat]
02:13yrlf has joined #asahi-re
02:21amarioguy2 is now known as amarioguy
02:43Jamie[m]by firmware properties you mean the things set with command 6?
02:52Jamie[m]oh yeah i see
06:53opticron has quit [Remote host closed the connection]
06:53opticron has joined #asahi-re
07:01MajorBiscuit has joined #asahi-re
07:05Jamie[m]alright, i'm going to do something awful
07:07Jamie[m]on the assumption that it's sane to try doing AVD just with direct register poking and maybe a little custom firmware, I'm gonna see if I can get the firmware running in an emulated cortex-m3, proxying peripheral read/writes back to the hardware
07:07Jamie[m]and interrupts from the hardware
07:08Jamie[m]so we can treat all of macos PLUS the firmware as a single black box
07:08Jamie[m]and feed video in -> watch register accesses come out
07:12sveni think you mean s/aweful/amazing/
07:18Jamie[m]i think the awful/amazing verdict will probably be decided by whether i do this in c in m1n1 or as a proxyclient script
07:34Major_Biscuit has joined #asahi-re
07:36MajorBiscuit has quit [Ping timeout: 480 seconds]
07:37m5zs7k has quit [Ping timeout: 480 seconds]
07:40m5zs7k has joined #asahi-re
08:05goldsoultheory has joined #asahi-re
08:08pjakobsson has quit [Remote host closed the connection]
08:11millenialhacker has quit [Ping timeout: 480 seconds]
08:24compassion has quit [Quit: Ping timeout (120 seconds)]
08:24compassion has joined #asahi-re
08:31millenialhacker has joined #asahi-re
08:53rqou_Jamie[m]: i'm literally trying that right this moment
08:53rqou_except Unicorn Engine is behaving like the flaky pile of hacks it is
08:54rqou_Jamie[m]: got any good cortex-m3 emulators?
08:56chadmed[m]doesnt qemu?
08:57rqou_well, Unicorn Engine wraps qemu
08:57rqou_but it's flaking out in a way that doesn't make sense
09:00rqou_my hook for emulating MMIO triggers only once, but only for one of the address ranges
09:00rqou_a different address range works correctly
09:05rqou_wtf, of course
09:05rqou_Unicorn Engine is working fine on my x86_64 laptop
09:05rqou_so something is just broken in Unicorn on some combination of macOS/aarch64/m1
09:05rqou_epic fail time
09:07chadmed[m]there is no disappointment quite like "oh, it just doesnt work on my machine... ok then" except maybe being served a cold pizza
09:33Jamie[m]rqou_: awesome haha
09:34Jamie[m]m3 is tiny enough that I was thinking of emulating the periphals used (basically nothing) myself
09:34Jamie[m](basically just the nvic i think?
09:35Jamie[m]but wasn't sure what to use for actually running the code, unicorn is probably what i would have begrudgingly settled on
09:40rqou_well, i've just hooked up the firmware in unicorn engine and i can successfully send the start session command and get its reply
09:40rqou_with a hack-tastic fake NVIC
09:40Jamie[m]hey matrix turned my > : 3 into a :3
09:40Jamie[m]that does not convey the evilness of my :3
09:41Jamie[m]are you forwarding peripheral register access to the real peripherals?
09:41Jamie[m]yeah you must be if mailbox is working right?
09:42rqou_no i'm not
09:42rqou_100% software right now
09:42rqou_fake mailbox
09:43j`eyJamie[m]: on irc we see the > ;)
09:43Jamie[m]oh good haha
09:52Jamie[m]so the strategy i had in mind is:
09:52Jamie[m]+ use hv to override writes to the firmware region, instead writing a firmware where all the exception vectors just go to a while(true) {} that doesn't touch memory*
09:52Jamie[m]+ hook it up so that the sram region is backed by the actual real sram region, as are the decoder/dma/etc peripherals
09:52Jamie[m]+ double-check that there's memory barrier stuff to ensure all the sram region accesses are immediately reflected (if necessary?)
09:53Jamie[m]+ run the whole thing under hv'd macos, watching using hooks on the peripherals etc
09:53Jamie[m]**todo: figure out how to make the real-device exception handlers not interfere with the sram by putting stuff on the stack
09:57rqou_oh right now i'm doing something slightly different of "feed captured commands into an emulated firmware and see what it spits out"
09:57rqou_the emulated firmware gets all the way to trying to poke the PIODMA peripheral now
09:57Jamie[m]i guess that is easier than REing the firmware with all the dynamic varaiables that actually just point to 0x10000000 haha :P:P
09:58Jamie[m](part of my reason for doing this was to isolate and understand the behaviour of the DMA peripherals, but I get the impression that you already understand them much more than I do)
09:59rqou_the "PIODMA" block itself is used only in the dumbest possible way by the firmware
09:59rqou_no idea about any of the other actually-video-related DMA
10:00rqou_but yeah, PIODMA has been pushed for a few days now
10:00Jamie[m]oh sweeet
10:00rqou_as well as all of mailbox (which has been there for... quite a while)
10:01rqou_ok, all except RUN_CONTROL
10:01Jamie[m]awesome i hadn't seen this stuff
10:01Jamie[m]btw have i got my offsets wrong or is DMACFGMEMSRC serving a dual purpose where it seems to be read from as a "is the dma currently busy" register?
10:01rqou_i think you have it wrong
10:03Jamie[m]hmm yep i sure do
10:04Jamie[m]oh i think i typed all these peripheral names from tunables into binaryninja by hand lmao
10:04Jamie[m]that would explain some mistakes :P
10:05Jamie[m]yeah i just put MEMSRC at +4 directly after CFG instead of leaving a gap haha
10:09Jamie[m]if this works out we can outdo lina by writing not just the kernel module in rust but also the firmware :P
10:09rqou_might be less confusing than apple's
10:11chadmed[m]surely it will be possible to come up with something with a simpler interface than what apple have done
10:11chadmed[m]like do we even need to worry about fairplay at all?
10:11Jamie[m]if it lets us do fairplay then fairplay is broken
10:13rqou_i was going to ignore anything related to fairplay for now
10:13rqou_although we _might_ be able to play SD trailers etc. that don't require a secure boot chain
10:13rqou_anyways
10:14rqou_this actually gets all the way through to enabling the codec hardware IRQs
10:14rqou_next i would need to dump some frame params, and actually implement the piodma copy
10:16Jamie[m]i might see if i can implement my proxy-to-actual-hardware thing tonight
10:16Jamie[m]"mum can we have m1n1 hv" "we have m1n1 hv at home" m1n1 hv at home:" etc etc
10:22rqou_good night, good luck
10:23Jamie[m]gotta finish this driver before the next apple hardware cycle when the term M3 becomes too ambiguous :P
10:23nicolas17 has joined #asahi-re
11:06goldsoultheory has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
11:06goldsoultheory has joined #asahi-re
11:07goldsoultheory has quit []
11:18goldsoultheory has joined #asahi-re
11:37amarioguyalright perfect, i'll start working on this
11:37svenI have reverse the Gigalocker file as well
11:37sven(The xART thing)
11:38svenit’s essentially just a key vakue store with constant size blocks
11:38sveneach blocks is a key/Val and protected with a common crc
11:38sveni can paste that later as well
11:38amarioguyplease do that'd be helpful
11:40sventhe hard part is the sks ipc anyway
11:40svenI’d recommend to load the kext symbols into the hv and then use bt() inside the tracer
11:41sventhat’s how I found that sks ipc hash fwiw
11:42nicolas17oh like a packet checksum?
11:42amarioguysven: yep - should get a full KDK setup rolling
11:43svenkdk doesn’t help
11:43sventhe regular kexts have enough symbols usually because they export everything
11:43svennicolas17: something like that, dunno why it’s there tbh
11:44svenit’s sha256 iirc
11:44svenwhich is a bit overkill for a simple checksum
11:44jonmasters has quit [Read error: No route to host]
11:44linxz has quit [Read error: No route to host]
11:44Manouchehri has quit [Read error: No route to host]
11:44jonmasters has joined #asahi-re
11:44svenI think it stuffs some identifier of the userspace client that called the function in there
11:44svenso maybe to protect again evil userspace something something?
11:45svenvery weird either way
11:45amarioguymight be to protect against attacks from a malicious mailbox request?
11:45linxz has joined #asahi-re
11:46svenif you have access to those regs you can just compute the hash yourself
11:46svenwhich is why it doesn’t really make sense
11:48nicolas17sven: there's a Continuity protocol that uses something like "s=sha512(payload); hash = s[0..15] xor s[16..31] xor ..."
11:48nicolas17I don't know why they went for sha512 instead of 256 and why they didn't just truncate it instead of xoring pieces of it to make it fit in the BTLE packet
11:48Manouchehri has joined #asahi-re
11:48nicolas17(also I think it's actually more than 16 bits, I don't remember exactly)
11:50nicolas17oh right, it's 8 bytes
11:52nicolas17 has quit [Quit: lunch]
13:10nicolas17 has joined #asahi-re
13:50nicolas17 has quit [Ping timeout: 480 seconds]
14:28nicolas17 has joined #asahi-re
14:47nicolas17 has quit [Ping timeout: 480 seconds]
15:45goldsoultheory has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
15:51nicolas17 has joined #asahi-re
16:00goldsoultheory has joined #asahi-re
16:32nicolas17 has quit [Ping timeout: 480 seconds]
16:34goldsoultheory has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
16:43goldsoultheory has joined #asahi-re
16:46genhack[m] has joined #asahi-re
16:52genhack[m]Hi everyone! I have a question about this beautiful project, through uboot is it possible to read the syscfg and write it back?
16:57svenassuming you mean the syscfg stored on the NOR flash, no
16:58svenyou'd need to boot a linux kernel with SPI support and the NOR node enabled in the device tree and then be brave enough to actually write your modifications back
17:05Major_Biscuit has quit [Ping timeout: 480 seconds]
17:06goldsoultheory has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
17:07goldsoultheory has joined #asahi-re
17:09goldsoultheory has quit []
17:11genhack[m]thanks sven for the reply, the rom should be the soc eep. (on schematics) if I understood correctly the W25Q64. My question was instead addressed to nand, that is, if they contain a Syscfg partition (like ios).
17:11svensyscfg is on the NOR flash on these machines
17:12genhack[m]this is strange no sn is inside of the nor
17:13genhack[m]sn bt or wifi
17:14goldsoultheory has joined #asahi-re
17:14genhack[m]so if i change the nand bga110 the apple configurator will restore the nand without any mod?
17:15svenwhy are you trying to do that?
17:15sveni have no idea what apple configurator will do in that case
17:16genhack[m]256gb to 1tb nand
17:43goldsoultheory has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
17:43goldsoultheory has joined #asahi-re
17:45goldsoultheory has quit []
17:51goldsoultheory has joined #asahi-re
18:34goldsoultheory has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
18:35goldsoultheory has joined #asahi-re
18:35goldsoultheory has quit []
18:51goldsoultheory has joined #asahi-re
20:13illenialhackerm has joined #asahi-re
20:15millenialhacker has quit [Ping timeout: 480 seconds]
20:40goldsoultheory has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
20:40goldsoultheory has joined #asahi-re
20:41goldsoultheory has quit []
20:46goldsoultheory has joined #asahi-re
21:30jakebot6022 has quit [Quit: The Lounge - https://thelounge.chat]
21:32arisu has quit []
21:49goldsoultheory has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:50goldsoultheory has joined #asahi-re
21:51goldsoultheory has quit []
21:53jakebot6022 has joined #asahi-re
21:55goldsoultheory has joined #asahi-re
23:33bisko has joined #asahi-re
…