From 1eb963f179e8adc517ab35085b9d88efabb8ca85 Mon Sep 17 00:00:00 2001 From: Steveice10 Date: Mon, 19 Dec 2016 22:16:07 -0800 Subject: [PATCH] Disable interrupts in SVC-mode functions, fix misplaced waithax_cleanup. --- source/hax/khax.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/hax/khax.c b/source/hax/khax.c index 51d4c29..29ecff0 100644 --- a/source/hax/khax.c +++ b/source/hax/khax.c @@ -16,6 +16,8 @@ static volatile u32 khax_write32_kernel_addr; static volatile u32 khax_write32_kernel_value; static void khax_read32_kernel_priv() { + asm volatile("cpsid aif"); + khax_read32_kernel_result = *(u32*) khax_read32_kernel_addr; } @@ -26,6 +28,8 @@ static u32 khax_read32_kernel(u32 addr) { } static void khax_write32_kernel_priv() { + asm volatile("cpsid aif"); + *(u32*) khax_write32_kernel_addr = khax_write32_kernel_value; } @@ -63,7 +67,7 @@ bool khax_execute() { osSetSpeedupEnable(false); khax_backdoor = waithax_backdoor; - khax_cleanup = NULL; + khax_cleanup = waithax_cleanup; } else { printf("khax: Executing svchax...\n"); @@ -75,7 +79,7 @@ bool khax_execute() { } khax_backdoor = (void (*)(void (*func)())) svcBackdoor; - khax_cleanup = waithax_cleanup; + khax_cleanup = NULL; } printf("khax: Kernel exploit executed successfully.\n");