Each call to mach_thread_self adds another MACH_PORT_RIGHT_SEND
refcount. For each call to mach_thread_self, you need to call
mach_port_deallocate on the result.
(This does not apply to mach_task_self.)
| // | |
| // main.m | |
| // TeslaClient | |
| // | |
| // Created by Scott Knight on 6/11/19. | |
| // Copyright © 2019 Scott Knight. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> |
| # Call this inside the bin directory of a build of the Swift compiler, | |
| # e.g. build/Xcode-ReleaseAssert/swift-macosx-x86_64/Release/bin. | |
| # | |
| # Adjust the path to match your Xode installation or pick a different binary to dump. | |
| # | |
| # Tested with Xcode 12.0 beta 2. | |
| # | |
| # Note: I used a Swift 5.3 compiler build from a few weeks ago that I had laying around. | |
| # Because of ABI stability, I don't think the swift-reflection-dump version has to match | |
| # the compiler version that was used to build the binary, but I'm not 100% sure. |
| # IDA (disassembler) and Hex-Rays (decompiler) plugin for Apple AMX | |
| # | |
| # WIP research. (This was edited to add more info after someone posted it to | |
| # Hacker News. Click "Revisions" to see full changes.) | |
| # | |
| # Copyright (c) 2020 dougallj | |
| # Based on Python port of VMX intrinsics plugin: | |
| # Copyright (c) 2019 w4kfu - Synacktiv |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <pthread/pthread.h> | |
| #include <mach/mach.h> | |
| struct ool_msg { | |
| mach_msg_header_t hdr; | |
| mach_msg_body_t body; | |
| mach_msg_ool_ports_descriptor_t ool_ports[]; | |
| }; |
To build this:
$ swiftc -emit-object XCBBuildServiceFix.swift -O
$ clang XCBBuildServiceFix.o XCBBuildServiceFix.s -shared -o libXCBBuildServiceFix.dylib -O -L /usr/lib/swift/ -lswiftCore -F /Applications/Xcode.app/Contents/SharedFrameworks/XCBuild.framework/Versions/Current/PlugIns/XCBBuildService.bundle/Contents/Frameworks/ -framework XCBUtil -framework XCBProtocolThen inject the result into XCBBuildService, which launches from /Applications/Xcode.app/Contents/SharedFrameworks/XCBuild.framework/Versions/Current/PlugIns/XCBBuildService.bundle/Contents/MacOS/XCBBuildService, using your injection tool of choice.