]> git.saurik.com Git - apple/system_cmds.git/commitdiff
system_cmds-854.100.3.tar.gz macos-10154 macos-10155 macos-10156 v854.100.3
authorApple <opensource@apple.com>
Fri, 1 May 2020 18:18:21 +0000 (18:18 +0000)
committerApple <opensource@apple.com>
Fri, 1 May 2020 18:18:21 +0000 (18:18 +0000)
iosim.tproj/iosim.c
login.tproj/login.entitlements [new file with mode: 0644]
lsmp.tproj/common.h
lsmp.tproj/port_details.c
passwd.tproj/passwd.entitlements
system_cmds.xcodeproj/project.pbxproj

index 3fde5d1cbd42950582a74483799bf7df18b7340c..cc37ad002bbb4b5e836f307f6e1bed485fd39823 100644 (file)
@@ -17,6 +17,7 @@
 #include <CoreFoundation/CoreFoundation.h>
 #include "panic.h"
 #include <IOKit/IOKitLib.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include "panic.h"
 #include <IOKit/IOKitLib.h>
+#include <spawn.h>
 
 #define IO_MODE_SEQ            0
 #define IO_MODE_RANDOM         1
 
 #define IO_MODE_SEQ            0
 #define IO_MODE_RANDOM         1
@@ -92,6 +93,7 @@ void print_test_setup(int value, char *option, char *units, char *comment);
 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);
 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)
 
 void
 print_usage(void)
@@ -254,7 +256,7 @@ void assertASP(CFRunLoopTimerRef timer, void *info )
 
        // Assert ASP
        printf("Command : %s\n", command);
 
        // Assert ASP
        printf("Command : %s\n", command);
-       system(command);
+       system_cmd(command);
 
        // Panic the system as well
        panic("IO time > QoS timeout");
 
        // Panic the system as well
        panic("IO time > QoS timeout");
@@ -583,12 +585,12 @@ int main(int argc, char *argv[])
                        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));
                        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);
        }
                }
        } 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();
        setup_process_io_policy(io_tier);
 
        setup_qos_device();
@@ -637,3 +639,22 @@ int main(int argc, char *argv[])
 
        pthread_exit(0);
 }
 
        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;
+}
diff --git a/login.tproj/login.entitlements b/login.tproj/login.entitlements
new file mode 100644 (file)
index 0000000..6e47a16
--- /dev/null
@@ -0,0 +1,10 @@
+<?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>
index 35014c1be929241f19f20ede3048b3cb49e6b695..8ab5eabfbeec9753f66cb3b4227581583caf8ea1 100644 (file)
@@ -123,7 +123,7 @@ typedef struct my_per_task_info {
 #define IKOT_LOCK_SET             24
 #define IKOT_CLOCK                25
 #define IKOT_CLOCK_CTRL           26
 #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_NAMED_ENTRY          28
 #define IKOT_IOKIT_CONNECT        29
 #define IKOT_IOKIT_OBJECT         30
@@ -135,7 +135,12 @@ typedef struct my_per_task_info {
 #define IKOT_TASK_RESUME          36
 #define IKOT_VOUCHER              37
 #define IKOT_VOUCHER_ATTR_CONTROL 38
 #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     */
 
 
 #define IKOT_MAX_TYPE             (IKOT_UNKNOWN+1)     /* # of IKOT_ types     */
 
 
index 619bf02484200b8031173b47a227aaf4503ad8f2..de852463dacb2fbae5bbe941accd37bff2bf417a 100644 (file)
@@ -26,6 +26,7 @@
 #include <libproc.h>
 #include <assert.h>
 #include <mach/mach.h>
 #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"
 #include <mach/mach_voucher.h>
 #include "common.h"
 #include "json.h"
@@ -60,7 +61,7 @@ const char * kobject_name(natural_t kotype)
         case IKOT_LOCK_SET:         return "LOCK-SET";
         case IKOT_CLOCK:            return "CLOCK";
         case IKOT_CLOCK_CTRL:       return "CLOCK-CONTROL";
         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_NAMED_ENTRY:      return "NAMED-MEMORY";
         case IKOT_IOKIT_CONNECT:    return "IOKIT-CONNECT";
         case IKOT_IOKIT_OBJECT:     return "IOKIT-OBJECT";
@@ -72,6 +73,10 @@ const char * kobject_name(natural_t kotype)
         case IKOT_TASK_RESUME:      return "TASK_RESUME";
         case IKOT_VOUCHER:          return "VOUCHER";
         case IKOT_VOUCHER_ATTR_CONTROL: return "VOUCHER_ATTR_CONTROL";
         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";
        }
         case IKOT_UNKNOWN:
         default:                    return "UNKNOWN";
        }
@@ -307,6 +312,8 @@ static void show_task_table_entry(ipc_info_name_t *entry, my_per_task_info_t *ta
     int sendrights = 0;
     unsigned int kotype = 0;
     vm_offset_t kobject = (vm_offset_t)0;
     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) {
 
     /* skip empty slots in the table */
     if ((entry->iin_type & MACH_PORT_TYPE_ALL_RIGHTS) == 0) {
@@ -598,13 +605,29 @@ static void show_task_table_entry(ipc_info_name_t *entry, my_per_task_info_t *ta
            (send) ? sendrights : 0);
 
     /* converting to kobjects is not always supported */
            (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);
                                   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));
     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 */
         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 */
index 71bd7ea69402d2578fe97362dfa6d3fb875c4248..6e47a16a4f57da1b867b685a15416c7f8fa110db 100644 (file)
@@ -4,5 +4,7 @@
 <dict>
        <key>com.apple.private.opendirectoryd.identity</key>
        <true/>
 <dict>
        <key>com.apple.private.opendirectoryd.identity</key>
        <true/>
+       <key>com.apple.private.security.clear-library-validation</key>
+       <true/>
 </dict>
 </plist>
 </dict>
 </plist>
index f52edfb854daf032fd391b514d1f2ee8700fb861..400fceec28ce387f6f4a9399cfa0e78f90998220 100644 (file)
                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>"; };
                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; };
                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 = (
                BA4FD2591372FAFA0025925C /* login.tproj */ = {
                        isa = PBXGroup;
                        children = (
+                               43A96C7223D2DAAE0033235B /* login.entitlements */,
                                BA4FD25B1372FAFA0025925C /* klogin.c */,
                                BA4FD25C1372FAFA0025925C /* login.1 */,
                                BA4FD25D1372FAFA0025925C /* login.c */,
                                BA4FD25B1372FAFA0025925C /* klogin.c */,
                                BA4FD25C1372FAFA0025925C /* login.1 */,
                                BA4FD25D1372FAFA0025925C /* login.c */,
                18732FFB18CBD4A700275344 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                18732FFB18CBD4A700275344 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CODE_SIGN_ENTITLEMENTS = login.tproj/login.entitlements;
                                "GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*][arch=*]" = (
                                        "$(inherited)",
                                        USE_PAM,
                                "GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*][arch=*]" = (
                                        "$(inherited)",
                                        USE_PAM,
                BA473DB21377B2230005CC19 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                BA473DB21377B2230005CC19 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CODE_SIGN_ENTITLEMENTS = login.tproj/login.entitlements;
                                "GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*][arch=*]" = (
                                        "$(inherited)",
                                        USE_PAM,
                                "GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*][arch=*]" = (
                                        "$(inherited)",
                                        USE_PAM,