mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 09:47:01 +02:00
more test
This commit is contained in:
1 parent
dc2ce0f947
commit
070c181a91
2 files changed
+22
-12
No files matched your search
+10
-1
@@ -185,6 +185,15 @@ setenv_ra1n:
|
||||
return -1;
|
||||
}
|
||||
LOG(LOG_VERBOSE2, "%s spawned successfully", checkra1n_path);
|
||||
#if defined(__APPLE__)
|
||||
#if TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR
|
||||
waitpid(pid, NULL, WUNTRACED);
|
||||
ret = ptrace(PT_DETACH, pid, NULL, 0);
|
||||
|
||||
if (ret)
|
||||
LOG(LOG_WARNING, "Cannot ptrace(PT_DETACH): %d (%s)", errno, strerror(errno));
|
||||
#endif
|
||||
#endif
|
||||
sleep(2);
|
||||
if (ext_checkra1n == NULL) {
|
||||
unlink(checkra1n_path);
|
||||
@@ -192,7 +201,7 @@ setenv_ra1n:
|
||||
checkra1n_path = NULL;
|
||||
}
|
||||
waitpid(pid, NULL, 0);
|
||||
if (!external_pongo && pongo_path != NULL) {
|
||||
if (!external_pongo && pongo_path != NULL) {
|
||||
unlink(pongo_path);
|
||||
}
|
||||
if (pongo_path != NULL) free(pongo_path);
|
||||
|
||||
+12
-11
@@ -6,6 +6,7 @@
|
||||
#include <mach-o/dyld.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <spawn.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <TargetConditionals.h>
|
||||
@@ -16,6 +17,11 @@ extern char **environ;
|
||||
extern char ***_NSGetArgv(void);
|
||||
extern int *_NSGetArgc(void);
|
||||
|
||||
#define CS_OPS_STATUS 0
|
||||
#define CS_DEBUGGED 0x10000000
|
||||
|
||||
int csops(pid_t pid, unsigned int ops, void *useraddr, size_t usersize);
|
||||
|
||||
__attribute__((constructor)) void ctor(void)
|
||||
{
|
||||
char ***argvp = _NSGetArgv();
|
||||
@@ -28,17 +34,12 @@ __attribute__((constructor)) void ctor(void)
|
||||
char **argv = *argvp;
|
||||
|
||||
#if TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR
|
||||
if (argc == 2 && strcmp(argv[1], "__CHECKRA1N_JIT_PLEASE__") == 0) {
|
||||
assert(ptrace(PT_TRACE_ME, 0, 0, 0) == 0);
|
||||
exit(0);
|
||||
} else {
|
||||
char exe_path[PATH_MAX];
|
||||
uint32_t exe_path_size = PATH_MAX;
|
||||
assert(_NSGetExecutablePath(exe_path, &exe_path_size) == 0);
|
||||
pid_t pid;
|
||||
assert(posix_spawnp(&pid, exe_path, NULL, NULL, (char*[]){"__CHECKRA1N_JIT_PLEASE__",NULL}, environ) == 0);
|
||||
assert(waitpid(pid, NULL, 0) == pid);
|
||||
}
|
||||
assert(ptrace(PT_TRACE_ME, 0, 0, 0) == 0);
|
||||
uint32_t csflags;
|
||||
assert(csops(getpid(), CS_OPS_STATUS, &csflags, sizeof(csflags)) == 0);
|
||||
|
||||
if (!(csflags & CS_DEBUGGED))
|
||||
printf("WARNING: CS_DEBUGGED is not set (0x%x)\n", csflags);
|
||||
#endif
|
||||
|
||||
char *c1_path = getenv("LIBCHECKRA1NHELPER_CHECKRA1N_PATH");
|
||||
|
||||
Reference in new issue
Block a user