#asahi · 2021-05-07 17:25
svenlet me check again#asahi · 2021-05-07 17:25
svenmaz: maybe#asahi · 2021-05-07 12:23
svenand I'm very much looking forward to using that secure enclave from linux#asahi · 2021-05-07 12:22
svenyes#asahi · 2021-05-07 12:19
svenit's a much better idea :-)#asahi · 2021-05-07 12:19
sventhat's why I wouldn't really call the Secure Enclave a replacement#asahi · 2021-05-07 12:18
svensecure world runs on the same processor as the non-secure world which introduces all kinds of attack vectors#asahi · 2021-05-07 12:17
svenmarshmallow: kinda of. I'd rather compare it with a smart card though#asahi · 2021-05-06 12:48
svenapple never used trust zone for that afaik#asahi · 2021-05-06 12:48
svenmarshmallow: thanks! Secure Enclave is an entirely separate processor#asahi · 2021-05-06 07:08
svenguarded execution stuff: brief docs at https://github.com/AsahiLinux/docs/wiki/HW:-SPRR-and-GXF, code at https://github.com/AsahiLinux/m1n1/pull/53 and me trying this whole blogging thing at https://blog.svenpeter.dev/posts/m1_sprr_gxf/#asahi · 2021-05-05 21:11
svenit's far from "ready" once 5.13 is released#asahi · 2021-05-05 18:54
svennight :D#asahi · 2021-05-05 18:53
svenokay, let me clean up my current code which just disables the mmu for p.gl1_call and then write some documentation (and/or a blog post because it's kinda awesome how you can figure this all out by (un)educated guesswork)#asahi · 2021-05-05 18:52
sven:-)#asahi · 2021-05-05 18:51
svenmakes sense#asahi · 2021-05-05 18:51
svenohh... yeah#asahi · 2021-05-05 18:50
svenoh, so you mean enable SPRR/GXF in call() and disable it before a return? that should work#asahi · 2021-05-05 18:49
svenand the malloc stuff#asahi · 2021-05-05 18:49
svenso then we probably just need to move the stack to a rw alias#asahi · 2021-05-05 18:49
svennice#asahi · 2021-05-05 18:48
svenit kinda already works if you keep the MMU disabled ofc#asahi · 2021-05-05 18:48
svenyeah, so if you don't care about rwx it's very simple to let m1n1 run with sprr as well#asahi · 2021-05-05 18:48
svenyes#asahi · 2021-05-05 18:47
sveni'm pretty sure they *want* to run xnu in el1#asahi · 2021-05-05 18:47
svenyou just need com.apple.private.hypervisor or something like that#asahi · 2021-05-05 18:47
svenbut i'm pretty sure you can enable it#asahi · 2021-05-05 18:47
svenso all this crap is disabled from hypervisor.framework#asahi · 2021-05-05 18:46
svenyeah#asahi · 2021-05-05 18:46
sven(or GL2 for that matter. that thing is aliased to SYS_ELR_GL2 as well)#asahi · 2021-05-05 18:45
svennope, only from GL1 itself#asahi · 2021-05-05 18:45
sven#define SYS_ELR_GL1 sys_reg(3, 6, 15, 10, 6)#asahi · 2021-05-05 18:45
svensec#asahi · 2021-05-05 18:45
sveni've got all of them :D#asahi · 2021-05-05 18:44
svenfirst one enables sprr, second one the guarded stuff#asahi · 2021-05-05 18:44
sven#define SYS_GXF_CONFIG_EL1 sys_reg(3, 6, 15, 1, 2)#asahi · 2021-05-05 18:43
sven#define SYS_SPRR_CONFIG_EL1 sys_reg(3, 6, 15, 1, 0)#asahi · 2021-05-05 18:43
svensure#asahi · 2021-05-05 18:43
svenor the msrs?#asahi · 2021-05-05 18:43
svengexit?#asahi · 2021-05-05 18:41
svenyeah, yeah, working on it now :D#asahi · 2021-05-05 18:41
svenyou get ELR,FAR,etc._GL1#asahi · 2021-05-05 18:41
svenyou'll probably need to emulate the GL1 msrs#asahi · 2021-05-05 18:41
svenyes#asahi · 2021-05-05 18:40
svenbut i think you can just fake the guarded stuff#asahi · 2021-05-05 18:39
svenand with SPRR you no longer get rwx pages#asahi · 2021-05-05 18:39
svenbecause you need SPRR enabled in EL2 to make it work in EL1#asahi · 2021-05-05 18:39
svenyeah, so that's gonna be ugly#asahi · 2021-05-05 18:39
svenokay, that makes sense#asahi · 2021-05-05 18:39
svenoh