#include <CoreFoundation/CoreFoundation.h>
#include "panic.h"
#include <IOKit/IOKitLib.h>
+#include <spawn.h>
#define IO_MODE_SEQ 0
#define IO_MODE_RANDOM 1
void setup_process_io_policy(int io_tier);
void setup_qos_device(void);
void print_latency_histogram(int64_t *data, int latency_bins, int latency_bin_size, double io_count);
+int system_cmd(char *command);
void
print_usage(void)
// Assert ASP
printf("Command : %s\n", command);
- system(command);
+ system_cmd(command);
// Panic the system as well
panic("IO time > QoS timeout");
snprintf(fname, MAX_FILENAME, "iosim-%d-%d", (int)getpid(), i);
snprintf(dd_command, MAX_CMD_SIZE, "dd if=/dev/urandom of=%s bs=4096 count=%d", fname, file_size);
printf("Creating file %s of size %lld...\n", fname, ((int64_t)file_size * 4096));
- system(dd_command);
+ system_cmd(dd_command);
}
} else {
printf("Using user specified file %s for all threads...\n", user_fname);
}
- system("purge");
+ system_cmd("purge");
setup_process_io_policy(io_tier);
setup_qos_device();
pthread_exit(0);
}
+
+extern char **environ;
+
+int system_cmd(char *command)
+{
+ // workaround for rdar://problem/53281655
+ pid_t pid;
+ char *argv[] = {"sh", "-c", command, NULL};
+ int status;
+ status = posix_spawn(&pid, "/bin/sh", NULL, NULL, argv, environ);
+ if (status == 0) {
+ if (waitpid(pid, &status, 0) != -1) {
+ return status;
+ } else {
+ perror("waitpid");
+ }
+ }
+ return -1;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>com.apple.private.opendirectoryd.identity</key>
+ <true/>
+ <key>com.apple.private.security.clear-library-validation</key>
+ <true/>
+</dict>
+</plist>
#define IKOT_LOCK_SET 24
#define IKOT_CLOCK 25
#define IKOT_CLOCK_CTRL 26
-#define IKOT_IOKIT_SPARE 27
+#define IKOT_IOKIT_IDENT 27
#define IKOT_NAMED_ENTRY 28
#define IKOT_IOKIT_CONNECT 29
#define IKOT_IOKIT_OBJECT 30
#define IKOT_TASK_RESUME 36
#define IKOT_VOUCHER 37
#define IKOT_VOUCHER_ATTR_CONTROL 38
-#define IKOT_UNKNOWN 39 /* magic catchall */
+#define IKOT_WORK_INTERVAL 39
+#define IKOT_UX_HANDLER 40
+#define IKOT_UEXT_OBJECT 41
+#define IKOT_ARCADE_REG 42
+
+#define IKOT_UNKNOWN 43 /* magic catchall */
#define IKOT_MAX_TYPE (IKOT_UNKNOWN+1) /* # of IKOT_ types */
#include <libproc.h>
#include <assert.h>
#include <mach/mach.h>
+//#include <mach/mach_port.h.h>
#include <mach/mach_voucher.h>
#include "common.h"
#include "json.h"
case IKOT_LOCK_SET: return "LOCK-SET";
case IKOT_CLOCK: return "CLOCK";
case IKOT_CLOCK_CTRL: return "CLOCK-CONTROL";
- case IKOT_IOKIT_SPARE: return "IOKIT-SPARE";
+ case IKOT_IOKIT_IDENT: return "IOKIT-IDENT";
case IKOT_NAMED_ENTRY: return "NAMED-MEMORY";
case IKOT_IOKIT_CONNECT: return "IOKIT-CONNECT";
case IKOT_IOKIT_OBJECT: return "IOKIT-OBJECT";
case IKOT_TASK_RESUME: return "TASK_RESUME";
case IKOT_VOUCHER: return "VOUCHER";
case IKOT_VOUCHER_ATTR_CONTROL: return "VOUCHER_ATTR_CONTROL";
+ case IKOT_WORK_INTERVAL: return "WORK_INTERVAL";
+ case IKOT_UX_HANDLER: return "UX_HANDLER";
+ case IKOT_UEXT_OBJECT: return "UEXT_OBJECT";
+ case IKOT_ARCADE_REG: return "ARCADE_REG";
case IKOT_UNKNOWN:
default: return "UNKNOWN";
}
int sendrights = 0;
unsigned int kotype = 0;
vm_offset_t kobject = (vm_offset_t)0;
+ kobject_description_t desc;
+ mach_vm_address_t kaddr;
/* skip empty slots in the table */
if ((entry->iin_type & MACH_PORT_TYPE_ALL_RIGHTS) == 0) {
(send) ? sendrights : 0);
/* converting to kobjects is not always supported */
- ret = mach_port_kernel_object(taskinfo->task,
+
+ desc[0] = '\0';
+ ret = mach_port_kobject_description(taskinfo->task,
+ entry->iin_name,
+ &kotype, &kaddr,
+ desc);
+ if (KERN_SUCCESS == ret) {
+ kobject = (unsigned) kaddr;
+ } else {
+ ret = mach_port_kernel_object(taskinfo->task,
entry->iin_name,
&kotype, (unsigned *)&kobject);
+ }
+
if (ret == KERN_SUCCESS && kotype != 0) {
JSON_OBJECT_SET(json, identifier, "0x%08x", (natural_t)kobject);
JSON_OBJECT_SET(json, type, "%s", kobject_name(kotype));
- printf(" 0x%08x %s", (natural_t)kobject, kobject_name(kotype));
+ if (desc[0]) {
+ JSON_OBJECT_SET(json, description, "%s", desc);
+ printf(" 0x%08x %s %s", (natural_t)kobject, kobject_name(kotype), desc);
+ } else {
+ printf(" 0x%08x %s", (natural_t)kobject, kobject_name(kotype));
+ }
if ((kotype == IKOT_TASK_RESUME) || (kotype == IKOT_TASK) || (kotype == IKOT_TASK_NAME)) {
if (taskinfo->task_kobject == kobject) {
/* neat little optimization since in most cases tasks have themselves in their ipc space */
<dict>
<key>com.apple.private.opendirectoryd.identity</key>
<true/>
+ <key>com.apple.private.security.clear-library-validation</key>
+ <true/>
</dict>
</plist>
3521C8562245AB52001B3201 /* cpuctl.tproj */ = {isa = PBXFileReference; lastKnownFileType = folder; path = cpuctl.tproj; sourceTree = "<group>"; };
358407CD2245AC09006A0D8E /* cpuctl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = cpuctl.c; path = cpuctl.tproj/cpuctl.c; sourceTree = "<group>"; };
358407CF2245AC32006A0D8E /* cpuctl.8 */ = {isa = PBXFileReference; lastKnownFileType = text; name = cpuctl.8; path = cpuctl.tproj/cpuctl.8; sourceTree = "<group>"; };
+ 43A96C7223D2DAAE0033235B /* login.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = login.entitlements; sourceTree = "<group>"; };
550C19E01804C55E001DA380 /* iosim.1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.man; path = iosim.1; sourceTree = "<group>"; };
550C19E11804C55E001DA380 /* iosim.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = iosim.c; sourceTree = "<group>"; };
550C19EB1804D226001DA380 /* iosim */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = iosim; sourceTree = BUILT_PRODUCTS_DIR; };
BA4FD2591372FAFA0025925C /* login.tproj */ = {
isa = PBXGroup;
children = (
+ 43A96C7223D2DAAE0033235B /* login.entitlements */,
BA4FD25B1372FAFA0025925C /* klogin.c */,
BA4FD25C1372FAFA0025925C /* login.1 */,
BA4FD25D1372FAFA0025925C /* login.c */,
18732FFB18CBD4A700275344 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CODE_SIGN_ENTITLEMENTS = login.tproj/login.entitlements;
"GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*][arch=*]" = (
"$(inherited)",
USE_PAM,
BA473DB21377B2230005CC19 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CODE_SIGN_ENTITLEMENTS = login.tproj/login.entitlements;
"GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*][arch=*]" = (
"$(inherited)",
USE_PAM,