Don't bootstrap ARM32 processes

This commit is contained in:
shinyquagsire23 2019-07-20 18:33:46 -06:00
parent 0422802aeb
commit 7d28e045d8
3 changed files with 28 additions and 7 deletions

View File

@ -6,6 +6,8 @@
#pragma once
#include "../types.h"
#include "../arm/thread_context.h"
#define LIBNX_NO_EXTRA_ADAPT
#include "svc_extra.h"
/// Pseudo handle for the current process.

View File

@ -18,7 +18,13 @@ typedef struct {
u64 tid;
u64 pid;
char name[12];
u32 mmuFlags;
u32 isA64 : 1;
u32 addrSpace : 3;
u32 enableDebug : 1;
u32 enableAslr : 1;
u32 useSysMemBlocks : 1;
u32 poolPartition : 4;
u32 unused : 22;
u64 userExceptionContextAddr;
};
@ -54,6 +60,7 @@ typedef enum {
DebugEvent_Exception=4, ///< Exception
} DebugEvent;
#ifndef LIBNX_NO_EXTRA_ADAPT
/**
* @brief Gets an incoming debug event from a debugging session.
* @return Result code.
@ -64,3 +71,4 @@ inline Result svcGetDebugEventInfo(DebugEventInfo* event_out, Handle debug)
{
return svcGetDebugEvent((u8*)event_out, debug);
}
#endif

View File

@ -116,16 +116,20 @@ void hijack_pid(u64 pid)
SaltySD_printf("SaltySD: found AttachProcess event:\n");
SaltySD_printf(" tid %016llx pid %016llx\n", eventinfo.tid, eventinfo.pid);
SaltySD_printf(" name %s\n", eventinfo.name);
SaltySD_printf(" mmuflags %08x exception %016llx\n", eventinfo.mmuFlags, eventinfo.userExceptionContextAddr);
SaltySD_printf(" isA64 %01x addrSpace %01x enableDebug %01x\n", eventinfo.isA64, eventinfo.addrSpace, eventinfo.enableDebug);
SaltySD_printf(" enableAslr %01x useSysMemBlocks %01x poolPartition %01x\n", eventinfo.enableAslr, eventinfo.useSysMemBlocks, eventinfo.poolPartition);
SaltySD_printf(" exception %016llx\n", eventinfo.userExceptionContextAddr);
if (!eventinfo.isA64)
{
SaltySD_printf("SaltySD: ARM32 applications are not supported, aborting bootstrap...\n");
goto abort_bootstrap;
}
if (eventinfo.tid <= 0x010000000000FFFF)
{
SaltySD_printf("SaltySD: TID %016llx is a system application, aborting bootstrap...\n", eventinfo.tid);
free(tids);
already_hijacking = false;
svcCloseHandle(debug);
return;
goto abort_bootstrap;
}
}
else
@ -138,6 +142,13 @@ void hijack_pid(u64 pid)
hijack_bootstrap(&debug, pid, tids[0]);
free(tids);
return;
abort_bootstrap:
free(tids);
already_hijacking = false;
svcCloseHandle(debug);
}
Result handleServiceCmd(int cmd)