#asahi-gpu · 2022-02-14 13:36
marcanbut yeah, without protecting PPL data, this is a bit pointless isn't it#asahi-gpu · 2022-02-14 13:36
marcanthe page tables are indeed readonly though, AFAICT#asahi-gpu · 2022-02-14 13:33
marcanunless I'm confused about the MMU maps#asahi-gpu · 2022-02-14 13:31
marcanso you can just redirect TTBR0 to any page table you want by changing the GPTBAT base#asahi-gpu · 2022-02-14 13:30
marcanand then reads the TTBR0 from that for context switches#asahi-gpu · 2022-02-14 13:30
marcanas far as I can tell it reads the GPTBAT base from a random global that is not in a PPL-only write protected page?#asahi-gpu · 2022-02-14 13:30
marcanhmm... I don't think this MiniPPL is very well done#asahi-gpu · 2022-02-14 12:21
phirethough, that might not enough to satisfy the people conserned about backdoors. It would be a racecondition to replace the pagetables before too much of the agx-asc firmware runs#asahi-gpu · 2022-02-14 12:20
svenhrm... unless they also limit the physical addresses that are allowed to contain code like they do for the XNU kernel#asahi-gpu · 2022-02-14 12:19
sven(including the code running in GL2)#asahi-gpu · 2022-02-14 12:18
svenyeah. if we can modify the full pagetable we can just map the firmware (or parts of it) somewhere else#asahi-gpu · 2022-02-14 12:18
sveni didn't follow the pagetable discussion, but I think that if you control whatever TTBR0/1 points to you can even hijack the GL2 code#asahi-gpu · 2022-02-14 12:16
phireDoes that mean since we have control over the pagetables, we could hijack all of the agx-asc firmware except for the GFX level?#asahi-gpu · 2022-02-14 12:13
svenwe can only disable the first one#asahi-gpu · 2022-02-14 12:13
svenone for the kernel and one for the co-processor firmware#asahi-gpu · 2022-02-14 12:13
sventhey have two CTRR regions#asahi-gpu · 2022-02-14 12:13
svenalmost!#asahi-gpu · 2022-02-14 12:13
phiredidn't we have to disable CTRR to boot m1n1, or am I thinking of something else?#asahi-gpu · 2022-02-14 12:13
sventhey do the same for XNU but that protection can be disabled in 1TR#asahi-gpu · 2022-02-14 12:12
sveni think apple calls that CTRR. iBoot loads the firmware of all co-procs into a memory region and setups CTRR to write protect it#asahi-gpu · 2022-02-14 12:12
phireoh, that region is write protected?#asahi-gpu · 2022-02-14 12:11
Jamie[m]1and it's loaded early in boot, right?#asahi-gpu · 2022-02-14 12:11
svenit's in a region of RAM that's write protected#asahi-gpu · 2022-02-14 12:11
sven*replace#asahi-gpu · 2022-02-14 12:11
svenso we can't easily replaced the firmware#asahi-gpu · 2022-02-14 12:11
phireas an alternative to auditing#asahi-gpu · 2022-02-14 12:11
phireWhat I'm wondering is could we take the bulk of apple's gfx-asc firmware, but replace the GFX level code with our own code?#asahi-gpu · 2022-02-14 12:09
svenGXF is what apple called "guarded exception level". it's a lateral level to EL2 called GL2 with a different interpretation of pagetable permissions and usually the only code that gets to modify pagetables#asahi-gpu · 2022-02-14 12:09
sveni'm not sure i understand that question#asahi-gpu · 2022-02-14 12:08
phireif GXF is so small, could we rewrite it, and then graft the rest of apple's firmware onto it?#asahi-gpu · 2022-02-14 12:04
svenand then there was ofc that one kernel with llvm bitcode released under the open source license. that should contain full symbols and then some for GXF as well :D#asahi-gpu · 2022-02-14 12:03
sven*release#asahi-gpu · 2022-02-14 12:03
svenbut then they were removed the next released again#asahi-gpu · 2022-02-14 12:02
sveniirc GXF also has (had?) some symbols in some XNU kernel#asahi-gpu · 2022-02-14 12:02
phiresometimes the 3rd field, for the compute work submission#asahi-gpu · 2022-02-14 12:01
phireFrom what I can see, context switching is controlled by second field in work submission commands. #asahi-gpu · 2022-02-14 12:00
marcanI think that's good enough for the "no, really, Apple don't have a backdoor here" argument#asahi-gpu · 2022-02-14 12:00
marcanand by the nature of it, if it can guarantee those PTs never point to crazyland, then all we need to do is audit the GXF code (which is one page) to convince ourselves that there is no backdoor#asahi-gpu · 2022-02-14 11:59
marcanthe cool thing is the GXF stuff somehow has symbols here#asahi-gpu · 2022-02-14 11:59
marcanphire: it does have a function to switch TTBR0 around to different contexts#asahi-gpu · 2022-02-14 11:43
marcanyeah#asahi-gpu · 2022-02-14 11:38
phireI guess if the ARM core never touches the lower address range, it doesn't need to care about the gpu contexts and handle updates to gpu-region-base#asahi-gpu · 2022-02-14 11:36
marcannot from gpu-region-base; those are patch args to the firmware#asahi-gpu · 2022-02-14 11:36
phireso it just copies the two entires from gpu-region-base into into TTBR0 and TTBR1?#asahi-gpu · 2022-02-14 11:35
marcanthe firmware calls gpu-region-base "UAT GPTBAT" fwiw#asahi-gpu · 2022-02-14 11:34
marcanthe ARM does not have that PT level, TTBRs are sysregs#asahi-gpu · 2022-02-14 11:34
marcangpu-region-base is the TTBRs, right?#asahi-gpu · 2022-02-14 11:28
phireIt gets pointed at gfx-shared-region-base, and not gpu-region-base?#asahi-gpu · 2022-02-14 11:25
phireit doesn't seem to be far off, from what I can tell. But I don't know the ARM MMU very well