m1n1.trace.agx: Add exploit mitigation

Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
Asahi Lina 2023-02-25 16:21:17 +09:00
parent 6d3e594903
commit 7ad099a5b6

View file

@ -612,9 +612,19 @@ class AGXTracer(ASCTracer):
stream.meta_fn = lambda a, b: self.meta_gpuvm(context, a, b) stream.meta_fn = lambda a, b: self.meta_gpuvm(context, a, b)
return stream return stream
def mitigate_exploits(self):
def hook(addr, val, width):
return 0 # Begone, GPU kernel mode in user contexts
for i in range(1, 64):
addr = self.gpu_region + i * 16 + 8
self.hv.add_tracer(irange(addr, 8), "UATMitigation", TraceMode.HOOK, None, hook)
def start(self): def start(self):
super().start() super().start()
#self.mitigate_exploits()
self.clear_ttbr_tracers() self.clear_ttbr_tracers()
self.clear_uatmap_tracers() self.clear_uatmap_tracers()
self.add_ttbr_tracers() self.add_ttbr_tracers()