Comment: | Obfuscate tagged pointers |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tagged-pointers |
Files: | files | file ages | folders |
SHA3-256: |
0bfac2b513ffa8da5f5e30d98283ac93 |
User & Date: | js on 2020-07-12 11:50:29 |
Other Links: | branch diff | manifest | tags |
2020-07-12
| ||
13:31 | lookup-asm-arm-elf.S: Obfuscate tagged pointers check-in: 761d528376 user: js tags: tagged-pointers | |
11:50 | Obfuscate tagged pointers check-in: 0bfac2b513 user: js tags: tagged-pointers | |
10:54 | Merge trunk into branch "tagged-pointers" check-in: be250b4fb3 user: js tags: tagged-pointers | |
Modified src/OFObject.m from [f5834cd36c] to [a224615e89].
︙ | |||
325 326 327 328 329 330 331 332 333 334 335 336 337 338 | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | + + + + + | #endif objc_setEnumerationMutationHandler(enumerationMutationHandler); do { of_hash_seed = of_random32(); } while (of_hash_seed == 0); #ifdef OF_OBJFW_RUNTIME objc_setTaggedPointerSecret(sizeof(uintptr_t) == 4 ? (uintptr_t)of_random32() : (uintptr_t)of_random64()); #endif } + (void)unload { } + (void)initialize |
︙ |
Modified src/runtime/ObjFWRT.h from [852e5138d0] to [b42f831278].
︙ | |||
240 241 242 243 244 245 246 247 248 249 250 251 252 253 | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | + | objc_enumeration_mutation_handler_t _Nullable handler); extern id _Nullable objc_constructInstance(Class _Nullable class_, void *_Nullable bytes); extern void *_Nullable objc_destructInstance(id _Nullable object); extern void *_Null_unspecified objc_autoreleasePoolPush(void); extern void objc_autoreleasePoolPop(void *_Null_unspecified pool); extern id _Nullable _objc_rootAutorelease(id _Nullable object); extern void objc_setTaggedPointerSecret(uintptr_t secret); extern int objc_registerTaggedPointerClass(Class _Nonnull class); extern Class _Nullable object_getTaggedPointerClass(id _Nonnull object); extern uintptr_t object_getTaggedPointerValue(id _Nonnull object); extern id _Nullable objc_createTaggedPointer(int class, uintptr_t value); /* * Used by the compiler, but can also be called manually. |
︙ |
Modified src/runtime/amiga-glue.m from [3dbec0ba16] to [d21e9a60b6].
︙ | |||
796 797 798 799 800 801 802 | 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | + + + + + + + + - + - + - + - + | glue_objc_hashtable_free PPC_PARAMS(struct objc_hashtable *table) { M68K_ARG(struct objc_hashtable *, table, a0) objc_hashtable_free(table); } void __saveds glue_objc_setTaggedPointerSecret PPC_PARAMS(uintptr_t secret) { M68K_ARG(uintptr_t, secret, d0) objc_setTaggedPointerSecret(secret); } |
Modified src/runtime/amiga-library.m from [7a20b4c30e] to [8a86d7c3a3].
︙ | |||
143 144 145 146 147 148 149 150 151 152 153 154 155 156 | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | + | extern void glue_objc_autoreleasePoolPop(void); extern id glue__objc_rootAutorelease(void); extern struct objc_hashtable *glue_objc_hashtable_new(void); extern void glue_objc_hashtable_set(void); extern void *glue_objc_hashtable_get(void); extern void glue_objc_hashtable_delete(void); extern void glue_objc_hashtable_free(void); extern void glue_objc_setTaggedPointerSecret(void); extern int glue_objc_registerTaggedPointerClass(void); extern Class _Nullable glue_object_getTaggedPointerClass(void); extern uintptr_t glue_object_getTaggedPointerValue(void); extern id _Nullable glue_objc_createTaggedPointer(void); #ifdef OF_MORPHOS const ULONG __abox__ = 1; |
︙ | |||
673 674 675 676 677 678 679 680 681 682 683 684 685 686 | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | + | (CONST_APTR)glue_objc_autoreleasePoolPop, (CONST_APTR)glue__objc_rootAutorelease, (CONST_APTR)glue_objc_hashtable_new, (CONST_APTR)glue_objc_hashtable_set, (CONST_APTR)glue_objc_hashtable_get, (CONST_APTR)glue_objc_hashtable_delete, (CONST_APTR)glue_objc_hashtable_free, (CONST_APTR)glue_objc_setTaggedPointerSecret, (CONST_APTR)glue_objc_registerTaggedPointerClass, (CONST_APTR)glue_object_getTaggedPointerClass, (CONST_APTR)glue_object_getTaggedPointerValue, (CONST_APTR)glue_objc_createTaggedPointer, (CONST_APTR)-1, #ifdef OF_MORPHOS (CONST_APTR)FUNCARRAY_END |
︙ |
Modified src/runtime/amigaos3.sfd from [a0d1b4c012] to [5fcef80cc6].
︙ | |||
86 87 88 89 90 91 92 93 94 95 96 97 | 86 87 88 89 90 91 92 93 94 95 96 97 98 | + | * The following functions are private! Don't use! struct objc_hashtable *_Nonnull glue_objc_hashtable_new(objc_hashtable_hash_func hash, objc_hashtable_equal_func equal, uint32_t size)(a0,a1,d0) void glue_objc_hashtable_set(struct objc_hashtable *_Nonnull table, const void *_Nonnull key, const void *_Nonnull object)(a0,a1,a2) void *_Nullable glue_objc_hashtable_get(struct objc_hashtable *_Nonnull table, const void *_Nonnull key)(a0,a1) void glue_objc_hashtable_delete(struct objc_hashtable *_Nonnull table, const void *_Nonnull key)(a0,a1) void glue_objc_hashtable_free(struct objc_hashtable *_Nonnull table)(a0) * Public functions again void glue_objc_setTaggedPointerSecret(uintptr_t secret)(d0) int glue_objc_registerTaggedPointerClass(Class _Nonnull class_)(a0) Class _Nullable glue_object_getTaggedPointerClass(id _Nonnull object)(a0) uintptr_t glue_object_getTaggedPointerValue(id _Nonnull object)(a0) id _Nullable glue_objc_createTaggedPointer(int class_, uintptr_t value)(d0,d1) ==end |
Modified src/runtime/lookup-asm/lookup-asm-x86-elf.S from [d8beb6d9cc] to [3e4a512a7a].
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | - - - + + + + + | 0: call get_eip add eax, offset _GLOBAL_OFFSET_TABLE_ lea eax, [eax+\not_found@GOTOFF] jmp eax .Ltagged_pointer_\name: |
︙ |
Modified src/runtime/lookup-asm/lookup-asm-x86_64-elf.S from [82960b8628] to [1f89a766d7].
︙ | |||
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | + + | test rax, rax jz short \not_found@PLT ret .Ltagged_pointer_\name: mov rax, [rip+objc_tagged_pointer_secret@GOTPCREL] xor rdi, [rax] and dil, 0xE movzx r8, dil mov rax, [rip+objc_tagged_pointer_classes@GOTPCREL] mov r8, [rax+r8*4] mov r8, [r8+64] |
︙ |
Modified src/runtime/lookup-asm/lookup-asm-x86_64-macho.S from [b9237d1cde] to [e2943741c9].
︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | + + | test rax, rax jz $1 ret Ltagged_pointer_$0: mov rax, [rip+objc_tagged_pointer_secret@GOTPCREL] xor rdi, [rax] and dil, 0xE movzx r8, dil mov rax, [rip+_objc_tagged_pointer_classes] mov r8, [rax+r8*4] mov r8, [r8+64] |
︙ |
Modified src/runtime/morphos-clib.h from [003198598f] to [f477f1a478].
︙ | |||
81 82 83 84 85 86 87 88 89 90 91 | 81 82 83 84 85 86 87 88 89 90 91 92 | + | /* The following functions are private! Don't use! */ struct objc_hashtable *glue_objc_hashtable_new(objc_hashtable_hash_func, objc_hashtable_equal_func, uint32_t); void glue_objc_hashtable_set(struct objc_hashtable *, const void *, const void *); void *glue_objc_hashtable_get(struct objc_hashtable *, const void *); void glue_objc_hashtable_delete(struct objc_hashtable *, const void *); void glue_objc_hashtable_free(struct objc_hashtable *); /* Public functions again */ void glue_objc_setTaggedPointerSecret(uintptr_t); int glue_objc_registerTaggedPointerClass(Class); Class _Nullable glue_object_getTaggedPointerClass(id); uintptr_t glue_object_getTaggedPointerValue(id); id glue_objc_createTaggedPointer(int, uintptr_t); |
Modified src/runtime/morphos.fd from [705f1d62db] to [43f04663ca].
︙ | |||
84 85 86 87 88 89 90 91 92 93 94 95 | 84 85 86 87 88 89 90 91 92 93 94 95 96 | + | * The following functions are private! Don't use! glue_objc_hashtable_new(hash,equal,size)(sysv,r12base) glue_objc_hashtable_set(table,key,object)(sysv,r12base) glue_objc_hashtable_get(table,key)(sysv,r12base) glue_objc_hashtable_delete(table,key)(sysv,r12base) glue_objc_hashtable_free(table)(sysv,r12base) * Public functions again glue_objc_setTaggedPointerSecret(secret)(sysv,r12base) glue_objc_registerTaggedPointerClass(class_)(sysv,r12base) glue_object_getTaggedPointerClass(object)(sysv,r12base) glue_object_getTaggedPointerValue(object)(sysv,r12base) glue_objc_createTaggedPointer(class_,value)(sysv,r12base) ##end |
Modified src/runtime/tagged-pointer.m from [eeba4c306c] to [696420866c].
︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | + + + + + + + | #import "private.h" #define TAGGED_POINTER_BITS 4 #define NUM_TAGGED_POINTER_CLASSES (1 << (TAGGED_POINTER_BITS - 1)) Class objc_tagged_pointer_classes[NUM_TAGGED_POINTER_CLASSES]; static int taggedPointerClassesCount; uintptr_t objc_tagged_pointer_secret; void objc_setTaggedPointerSecret(uintptr_t secret) { objc_tagged_pointer_secret = secret & ~(uintptr_t)1; } int objc_registerTaggedPointerClass(Class class) { int i; objc_global_mutex_lock(); |
︙ | |||
44 45 46 47 48 49 50 | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | - + - + - + | return i; } Class object_getTaggedPointerClass(id object) { |