diff options
author | comex | 2015-03-01 23:07:15 -0500 |
---|---|---|
committer | comex | 2015-03-01 23:07:15 -0500 |
commit | 7f24621bec0b0a5b3cab9ec2dfc68929a2d49d25 (patch) | |
tree | 7c227bfa4d8010e23b726eed8efb6bc51746e3f5 /darwin-bootstrap | |
parent | seems to work (diff) | |
download | substitute-7f24621bec0b0a5b3cab9ec2dfc68929a2d49d25.tar.gz |
A number of critical fixes painstakingly discovered in the slowest way possible.
Diffstat (limited to 'darwin-bootstrap')
-rw-r--r-- | darwin-bootstrap/ib-log.h | 2 | ||||
-rw-r--r-- | darwin-bootstrap/posixspawn-hook.c | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/darwin-bootstrap/ib-log.h b/darwin-bootstrap/ib-log.h index c80ae63..536b1a7 100644 --- a/darwin-bootstrap/ib-log.h +++ b/darwin-bootstrap/ib-log.h @@ -41,4 +41,4 @@ static inline void ib_log_hex(const void *buf, size_t size) { free(hex); } -#define IB_VERBOSE 1 +#define IB_VERBOSE 0 diff --git a/darwin-bootstrap/posixspawn-hook.c b/darwin-bootstrap/posixspawn-hook.c index 86c3d01..ee6a1cb 100644 --- a/darwin-bootstrap/posixspawn-hook.c +++ b/darwin-bootstrap/posixspawn-hook.c @@ -59,7 +59,8 @@ static bool spawn_unrestrict(pid_t pid, bool should_resume, bool is_exec) { const char *is_exec_s = is_exec ? "1" : "0"; const char *argv[] = {prog, pid_s, should_resume_s, is_exec_s, NULL}; pid_t prog_pid; - if (old_posix_spawn(&prog_pid, prog, NULL, NULL, (char **) argv, NULL)) { + char *env[] = {"_MSSafeMode=1", NULL}; + if (old_posix_spawn(&prog_pid, prog, NULL, NULL, (char **) argv, env)) { ib_log("posixspawn-hook: couldn't start unrestrict - oh well..."); return false; } @@ -67,7 +68,8 @@ static bool spawn_unrestrict(pid_t pid, bool should_resume, bool is_exec) { /* reap intermediate to avoid zombie - if it doesn't work, not a big deal */ if (waitpid(prog_pid, &xstat, 0) == -1) ib_log("posixspawn-hook: couldn't waitpid"); - ib_log("unrestrict xstat=%x", xstat); + if (IB_VERBOSE) + ib_log("unrestrict xstat=%x", xstat); return true; } @@ -182,7 +184,14 @@ static int hook_posix_spawn_generic(__typeof__(posix_spawn) *old, else goto skip; } else { - if (!strcmp(path, "/Library/Substitute/Helpers/substituted")) + /* substituted obviously doesn't want to have bundle_loader run in it + * and try to contact substituted. I am not sure why notifyd is an + * issue. Some libc functions (localtime) synchronously contact it, + * which launchd could be calling, but I haven't caught it in the act. + * XXX I'd like to be completely sure that notifyd and nothing else is + * a problem. */ + if (!strcmp(path, "/Library/Substitute/Helpers/substituted") || + !strcmp(path, "/usr/sbin/notifyd")) goto skip; else dylib_to_add = bl_dylib; @@ -442,5 +451,4 @@ static void init() { end: if (im) substitute_close_image(im); - } |