From 7bca6ad19e54e2edc4ec9cfa10da20a26e294334 Mon Sep 17 00:00:00 2001 From: Pwn20wnd Date: Sat, 9 Mar 2019 23:30:26 +0300 Subject: Merge pwn's changes to support arm64e via rebase --- inject.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'inject.m') diff --git a/inject.m b/inject.m index 64eacd2..5f39e2b 100644 --- a/inject.m +++ b/inject.m @@ -150,15 +150,15 @@ NSArray *filteredHashes(uint64_t trust_chain, NSDictionary *hashes) { #endif } -int injectTrustCache(NSArray *files, uint64_t trust_chain) { +int injectTrustCache(NSArray *files, uint64_t trust_chain, int (*pmap_load_trust_cache)(uint64_t, size_t)) +{ @autoreleasepool { struct trust_mem mem; uint64_t kernel_trust = 0; mem.next = rk64(trust_chain); mem.count = 0; - *(uint64_t *)&mem.uuid[0] = 0xabadbabeabadbabe; - *(uint64_t *)&mem.uuid[8] = 0xabadbabeabadbabe; + arc4random_buf(&mem.uuid, 16); NSMutableDictionary *hashes = [NSMutableDictionary new]; int errors=0; @@ -190,7 +190,7 @@ int injectTrustCache(NSArray *files, uint64_t trust_chain) { return errors; } - size_t length = (sizeof(mem) + hashesToInject * TRUST_CDHASH_LEN + 0xFFFF) & ~0xFFFF; + size_t length = (sizeof(mem) + hashesToInject * TRUST_CDHASH_LEN + 0x3FFF) & ~0x3FFF; char *buffer = malloc(hashesToInject * TRUST_CDHASH_LEN); if (buffer == NULL) { fprintf(stderr, "Unable to allocate memory for cdhashes: %s\n", strerror(errno)); @@ -206,7 +206,7 @@ int injectTrustCache(NSArray *files, uint64_t trust_chain) { mem.count = hashesToInject; kwrite(kernel_trust, &mem, sizeof(mem)); kwrite(kernel_trust + sizeof(mem), buffer, mem.count * TRUST_CDHASH_LEN); - wk64(trust_chain, kernel_trust); + pmap_load_trust_cache(kernel_trust, length); return (int)errors; } -- cgit v1.2.3