From ff53761db422fcf79398bd72c63342cb2c79f206 Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 20 May 2021 15:50:08 -0400 Subject: download.sh: Add script --- download.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 download.sh diff --git a/download.sh b/download.sh new file mode 100755 index 0000000..3c3d0cc --- /dev/null +++ b/download.sh @@ -0,0 +1,5 @@ +#!/bin/sh +TEMP=$(mktemp -d) +wget -q -P${TEMP} https://opensource.apple.com/tarballs/${1}/${1}-${2}.tar.gz +tar xf ${TEMP}/${1}-${2}.tar.gz -C ${1} --strip-components=1 +echo "${2}" > ${1}/.apple_version -- cgit v1.2.3-56-ge451 From 27554072ccc744d561cc9c27a15c3cccba954145 Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 20 May 2021 16:16:39 -0400 Subject: download.sh: Make way better --- download.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/download.sh b/download.sh index 3c3d0cc..54b86a8 100755 --- a/download.sh +++ b/download.sh @@ -1,5 +1,14 @@ #!/bin/sh -TEMP=$(mktemp -d) -wget -q -P${TEMP} https://opensource.apple.com/tarballs/${1}/${1}-${2}.tar.gz -tar xf ${TEMP}/${1}-${2}.tar.gz -C ${1} --strip-components=1 -echo "${2}" > ${1}/.apple_version +version="$(basename $(curl -s https://opensource.apple.com/tarballs/${1}/ | \ + pup 'table tbody tr td a:not([href="./../"]) text{}' -c | \ + sort -V | tail -n 1) .tar.gz | \ + rev | cut -d- -f 1 | rev)" +if [ "$( echo -e "${version}\n$(cat ${1}/.apple_version)" | sort -V | tail -n 1)" = "$(cat ${1}/.apple_version)" ]; then + echo "${1} - $(cat ${1}/.apple_version)" +else + echo "${1} - $(cat ${1}/.apple_version) -> ${version}" + TEMP=$(mktemp -d) + wget -q -P${TEMP} https://opensource.apple.com/tarballs/${1}/${1}-${version}.tar.gz + tar xf ${TEMP}/${1}-${2}.tar.gz -C ${1} --strip-components=1 + echo "${version}" > ${1}/.apple_version +fi -- cgit v1.2.3-56-ge451 From 7739e61b2da1ba7ba21047f2e7f6467380b015c4 Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 20 May 2021 16:16:58 -0400 Subject: update.sh: Add script --- update.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 update.sh diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..db4fe55 --- /dev/null +++ b/update.sh @@ -0,0 +1,6 @@ +#!/bin/sh +for pkg in adv_cmds basic_cmds bootstrap_cmds developer_cmds \ + diskdev_cmds doc_cmds file_cmds mail_cmds misc_cmds network_cmds \ + patch_cmds remote_cmds shell_cmds system_cmds text_cmds; do + ./download.sh "${pkg}" +done -- cgit v1.2.3-56-ge451 From ed99accf1cdb931cc66a5224997b6438136d0200 Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 20 May 2021 16:18:23 -0400 Subject: download.sh: Fix --- download.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download.sh b/download.sh index 54b86a8..38c7d48 100755 --- a/download.sh +++ b/download.sh @@ -9,6 +9,6 @@ else echo "${1} - $(cat ${1}/.apple_version) -> ${version}" TEMP=$(mktemp -d) wget -q -P${TEMP} https://opensource.apple.com/tarballs/${1}/${1}-${version}.tar.gz - tar xf ${TEMP}/${1}-${2}.tar.gz -C ${1} --strip-components=1 + tar xf ${TEMP}/${1}-${version}.tar.gz -C ${1} --strip-components=1 echo "${version}" > ${1}/.apple_version fi -- cgit v1.2.3-56-ge451 From 591e92d95c376763dde539fadf0498bd1358073d Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 20 May 2021 16:21:11 -0400 Subject: adv_cmds: Update to 176.100.1 --- adv_cmds/.apple_version | 2 +- adv_cmds/ps/entitlements.plist | 4 +--- adv_cmds/ps/tasks.c | 16 +++++++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/adv_cmds/.apple_version b/adv_cmds/.apple_version index 1057e9a..054f7a2 100644 --- a/adv_cmds/.apple_version +++ b/adv_cmds/.apple_version @@ -1 +1 @@ -176 +176.100.1 diff --git a/adv_cmds/ps/entitlements.plist b/adv_cmds/ps/entitlements.plist index eaaf1de..cdf0e9e 100644 --- a/adv_cmds/ps/entitlements.plist +++ b/adv_cmds/ps/entitlements.plist @@ -2,9 +2,7 @@ - com.apple.system-task-ports - - task_for_pid-allow + com.apple.system-task-ports.read diff --git a/adv_cmds/ps/tasks.c b/adv_cmds/ps/tasks.c index 4548b56..d2fcb07 100644 --- a/adv_cmds/ps/tasks.c +++ b/adv_cmds/ps/tasks.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -22,8 +23,9 @@ #include "ps.h" #include +#include -extern kern_return_t task_for_pid(task_port_t task, pid_t pid, task_port_t *target); +extern kern_return_t task_read_for_pid(task_port_t task, pid_t pid, task_port_t *target); #define STATE_MAX 7 @@ -96,7 +98,11 @@ int get_task_info (KINFO *ki) ki->state = STATE_MAX; pid = KI_PROC(ki)->p_pid; - if (task_for_pid(mach_task_self(), pid, &ki->task) != KERN_SUCCESS) { + error = task_read_for_pid(mach_task_self(), pid, &ki->task); + if (error != KERN_SUCCESS) { +#ifdef DEBUG + mach_error("Error calling task_read_for_pid()", error); +#endif return(1); } info_count = TASK_BASIC_INFO_COUNT; @@ -110,8 +116,8 @@ int get_task_info (KINFO *ki) } { vm_region_basic_info_data_64_t b_info; - vm_address_t address = GLOBAL_SHARED_TEXT_SEGMENT; - vm_size_t size; + mach_vm_address_t address = GLOBAL_SHARED_TEXT_SEGMENT; + mach_vm_size_t size; mach_port_t object_name; /* @@ -120,7 +126,7 @@ int get_task_info (KINFO *ki) * the 2 segments that are used for split libraries */ info_count = VM_REGION_BASIC_INFO_COUNT_64; - error = vm_region_64(ki->task, &address, &size, VM_REGION_BASIC_INFO, + error = mach_vm_region(ki->task, &address, &size, VM_REGION_BASIC_INFO, (vm_region_info_t)&b_info, &info_count, &object_name); if (error == KERN_SUCCESS) { if (b_info.reserved && size == (SHARED_TEXT_REGION_SIZE) && -- cgit v1.2.3-56-ge451 From f5569153b7df6d141164c27040ef0076732f2da7 Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 20 May 2021 16:22:02 -0400 Subject: file_cmds: 321.100.10.0.1 --- file_cmds/.apple_version | 2 +- file_cmds/compress/compress.c | 18 +++++-- file_cmds/cp/utils.c | 50 ++++++++++++++--- file_cmds/file_cmds.xcodeproj/project.pbxproj | 34 ++++++++++++ file_cmds/mtree/commoncrypto.c | 3 +- file_cmds/mtree/compare.c | 17 ++++-- file_cmds/mtree/extern.h | 2 +- file_cmds/mtree/mtree.8 | 3 ++ file_cmds/mtree/mtree.c | 14 ++--- file_cmds/mtree/spec.c | 10 +++- file_cmds/mtree/verify.c | 4 +- file_cmds/tests/cp.sh | 23 ++++++++ file_cmds/tests/file_cmds.plist | 36 +++++++++++++ file_cmds/tests/touch.sh | 14 +++++ file_cmds/touch/touch.c | 77 +++++++++++++++------------ 15 files changed, 244 insertions(+), 63 deletions(-) create mode 100644 file_cmds/tests/cp.sh create mode 100644 file_cmds/tests/touch.sh diff --git a/file_cmds/.apple_version b/file_cmds/.apple_version index 8ede599..15c4458 100644 --- a/file_cmds/.apple_version +++ b/file_cmds/.apple_version @@ -1 +1 @@ -321.40.3 +321.100.10.0.1 diff --git a/file_cmds/compress/compress.c b/file_cmds/compress/compress.c index 26da7fa..97c70f2 100644 --- a/file_cmds/compress/compress.c +++ b/file_cmds/compress/compress.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD: src/usr.bin/compress/compress.c,v 1.23 2010/12/11 08:32:16 j #include #include #include +#include #include #include @@ -382,14 +383,21 @@ err: if (ofp) { void setfile(const char *name, struct stat *fs) { - static struct timeval tv[2]; + struct attrlist ts_req = {}; + struct { + struct timespec mtime; + struct timespec atime; + } set_ts; fs->st_mode &= S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO; - TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atimespec); - TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtimespec); - if (utimes(name, tv)) - cwarn("utimes: %s", name); + ts_req.bitmapcount = ATTR_BIT_MAP_COUNT; + ts_req.commonattr = ATTR_CMN_MODTIME | ATTR_CMN_ACCTIME; + set_ts.mtime = fs->st_mtimespec; + set_ts.atime = fs->st_atimespec; + + if (setattrlist(name, &ts_req, &set_ts, sizeof(set_ts), 0)) + cwarn("setattrlist: %s", name); /* * Changing the ownership probably won't succeed, unless we're root diff --git a/file_cmds/cp/utils.c b/file_cmds/cp/utils.c index af05cc3..feecc0c 100644 --- a/file_cmds/cp/utils.c +++ b/file_cmds/cp/utils.c @@ -69,10 +69,22 @@ __FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.46 2005/09/05 04:36:08 csjp Exp $"); #include "extern.h" #define cp_pct(x,y) (int)(100.0 * (double)(x) / (double)(y)) +/* Memory strategy threshold, in pages: if physmem is larger then this, use a + * large buffer */ +#define PHYSPAGES_THRESHOLD (32*1024) + +/* Maximum buffer size in bytes - do not allow it to grow larger than this */ +#define BUFSIZE_MAX (2*1024*1024) + +/* Small (default) buffer size in bytes. It's inefficient for this to be + * smaller than MAXPHYS */ +#define BUFSIZE_SMALL (MAXPHYS) + int copy_file(const FTSENT *entp, int dne) { - static char buf[MAXBSIZE]; + static char *buf = NULL; + static size_t bufsize; struct stat *fs; int ch, checkch, from_fd, rval, to_fd; ssize_t rcount; @@ -258,8 +270,23 @@ copy_file(const FTSENT *entp, int dne) } else #endif { + if (buf == NULL) { + /* + * Note that buf and bufsize are static. If + * malloc() fails, it will fail at the start + * and not copy only some files. + */ + if (sysconf(_SC_PHYS_PAGES) > + PHYSPAGES_THRESHOLD) + bufsize = MIN(BUFSIZE_MAX, MAXPHYS * 8); + else + bufsize = BUFSIZE_SMALL; + buf = malloc(bufsize); + if (buf == NULL) + err(1, "Not enough memory"); + } wtotal = 0; - while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) { + while ((rcount = read(from_fd, buf, bufsize)) > 0) { for (bufp = buf, wresid = rcount; ; bufp += wcount, wresid -= wcount) { wcount = write(to_fd, bufp, wresid); @@ -382,19 +409,28 @@ copy_special(struct stat *from_stat, int exists) int setfile(struct stat *fs, int fd) { - static struct timeval tv[2]; + struct attrlist ts_req = {}; struct stat ts; int rval, gotstat, islink, fdval; + struct { + struct timespec mtime; + struct timespec atime; + } set_ts; rval = 0; fdval = fd != -1; islink = !fdval && S_ISLNK(fs->st_mode); fs->st_mode &= S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO; + unsigned int options = islink ? FSOPT_NOFOLLOW : 0; + + ts_req.bitmapcount = ATTR_BIT_MAP_COUNT; + ts_req.commonattr = ATTR_CMN_MODTIME | ATTR_CMN_ACCTIME; + set_ts.mtime = fs->st_mtimespec; + set_ts.atime = fs->st_atimespec; - TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atimespec); - TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtimespec); - if (fdval ? futimes(fd, tv) : (islink ? lutimes(to.p_path, tv) : utimes(to.p_path, tv))) { - warn("%sutimes: %s", fdval ? "f" : (islink ? "l" : ""), to.p_path); + if (fdval ? fsetattrlist(fd, &ts_req, &set_ts, sizeof(set_ts), options) : + setattrlist(to.p_path, &ts_req, &set_ts, sizeof(set_ts), options)) { + warn("%ssetattrlist: %s", fdval ? "f" : "", to.p_path); rval = 1; } if (fdval ? fstat(fd, &ts) : (islink ? lstat(to.p_path, &ts) : diff --git a/file_cmds/file_cmds.xcodeproj/project.pbxproj b/file_cmds/file_cmds.xcodeproj/project.pbxproj index e4e94ec..dcf7d02 100644 --- a/file_cmds/file_cmds.xcodeproj/project.pbxproj +++ b/file_cmds/file_cmds.xcodeproj/project.pbxproj @@ -111,6 +111,8 @@ isa = PBXAggregateTarget; buildConfigurationList = FC8A8C8114B655ED001B97AD /* Build configuration list for PBXAggregateTarget "executables" */; buildPhases = ( + D178BEFA253DAE01001FC103 /* Copy plist */, + D178BF21253DAE2E001FC103 /* Copy tests */, ); dependencies = ( FC8A8C8414B655FD001B97AD /* PBXTargetDependency */, @@ -213,6 +215,10 @@ 3E966CF01FB2218A0019F7A1 /* chgrp.sh in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3E966CEB1FB2214F0019F7A1 /* chgrp.sh */; }; 729D06D8230B5E42000716E5 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 729D06D7230B5E42000716E5 /* CoreFoundation.framework */; }; 7D0A20EA2499364700F0F6D7 /* metrics.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D0A20E92499364700F0F6D7 /* metrics.c */; }; + D178BEFB253DAE2A001FC103 /* file_cmds.plist in Copy plist */ = {isa = PBXBuildFile; fileRef = 3E966CEC1FB2214F0019F7A1 /* file_cmds.plist */; }; + D178BF22253DAE42001FC103 /* chgrp.sh in Copy tests */ = {isa = PBXBuildFile; fileRef = 3E966CEB1FB2214F0019F7A1 /* chgrp.sh */; }; + D178BF48253DAE45001FC103 /* touch.sh in Copy tests */ = {isa = PBXBuildFile; fileRef = D11B5750253C22BD009A59BF /* touch.sh */; }; + D1B4221F25762FC8003E3A47 /* cp.sh in Copy tests */ = {isa = PBXBuildFile; fileRef = D1B421D325762E9E003E3A47 /* cp.sh */; }; FC8A8A2814B6486E001B97AD /* chflags.c in Sources */ = {isa = PBXBuildFile; fileRef = FCB1BDCC14B6460C0070FACB /* chflags.c */; }; FC8A8BE414B6494B001B97AD /* chflags.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = FCB1BDCB14B6460C0070FACB /* chflags.1 */; }; FC8A8BE514B64958001B97AD /* chmod.c in Sources */ = {isa = PBXBuildFile; fileRef = FCB1BDD014B6460C0070FACB /* chmod.c */; }; @@ -851,6 +857,30 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D178BEFA253DAE01001FC103 /* Copy plist */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /AppleInternal/CoreOS/BATS/unit_tests; + dstSubfolderSpec = 0; + files = ( + D178BEFB253DAE2A001FC103 /* file_cmds.plist in Copy plist */, + ); + name = "Copy plist"; + runOnlyForDeploymentPostprocessing = 0; + }; + D178BF21253DAE2E001FC103 /* Copy tests */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /AppleInternal/Tests/file_cmds; + dstSubfolderSpec = 0; + files = ( + D1B4221F25762FC8003E3A47 /* cp.sh in Copy tests */, + D178BF48253DAE45001FC103 /* touch.sh in Copy tests */, + D178BF22253DAE42001FC103 /* chgrp.sh in Copy tests */, + ); + name = "Copy tests"; + runOnlyForDeploymentPostprocessing = 0; + }; FC8A8B0F14B648D7001B97AD /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -1203,6 +1233,8 @@ 729D06D7230B5E42000716E5 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 7D0A20E82499364700F0F6D7 /* metrics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = metrics.h; sourceTree = ""; }; 7D0A20E92499364700F0F6D7 /* metrics.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = metrics.c; sourceTree = ""; }; + D11B5750253C22BD009A59BF /* touch.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = touch.sh; sourceTree = ""; }; + D1B421D325762E9E003E3A47 /* cp.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = cp.sh; sourceTree = ""; }; FC8A8B1214B648D7001B97AD /* chmod */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = chmod; sourceTree = BUILT_PRODUCTS_DIR; }; FC8A8B1A14B648E0001B97AD /* chown */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = chown; sourceTree = BUILT_PRODUCTS_DIR; }; FC8A8B2214B648E3001B97AD /* cksum */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = cksum; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1591,6 +1623,8 @@ children = ( 3E966CEB1FB2214F0019F7A1 /* chgrp.sh */, 3E966CEC1FB2214F0019F7A1 /* file_cmds.plist */, + D11B5750253C22BD009A59BF /* touch.sh */, + D1B421D325762E9E003E3A47 /* cp.sh */, ); path = tests; sourceTree = ""; diff --git a/file_cmds/mtree/commoncrypto.c b/file_cmds/mtree/commoncrypto.c index 11e97ce..0ac621c 100644 --- a/file_cmds/mtree/commoncrypto.c +++ b/file_cmds/mtree/commoncrypto.c @@ -105,7 +105,8 @@ xattr_info * SHA256_Path_XATTRs(char *path, char *buf) { xattr_info *ai = NULL; - if (mflag) { + // mflag is passed during manifest comparision while xflag is used to generate the specification + if (mflag || xflag) { ai = get_xdstream_privateid(path, buf); } else { ai = calculate_SHA256_XATTRs(path, buf); diff --git a/file_cmds/mtree/compare.c b/file_cmds/mtree/compare.c index e585928..366f12f 100644 --- a/file_cmds/mtree/compare.c +++ b/file_cmds/mtree/compare.c @@ -534,11 +534,18 @@ typeerr: LABEL; int supported; struct timespec ptimespec = ptime(p->fts_accpath, &supported); if (!supported) { - LABEL; - (void)printf("%stime added to parent folder expected %.24s.%09ld found that it is not supported\n", - tab, ctime(&s->st_ptimespec.tv_sec), s->st_ptimespec.tv_nsec); - tab = "\t"; - } else if (supported && ((s->st_ptimespec.tv_sec != ptimespec.tv_sec) || + if (mflag) { + ptimespec.tv_sec = 0; + ptimespec.tv_nsec = 0; + supported = 1; + } else { + LABEL; + (void)printf("%stime added to parent folder expected %.24s.%09ld found that it is not supported\n", + tab, ctime(&s->st_ptimespec.tv_sec), s->st_ptimespec.tv_nsec); + tab = "\t"; + } + } + if (supported && ((s->st_ptimespec.tv_sec != ptimespec.tv_sec) || (s->st_ptimespec.tv_nsec != ptimespec.tv_nsec))) { if (!mflag) { LABEL; diff --git a/file_cmds/mtree/extern.h b/file_cmds/mtree/extern.h index 47533c2..fb7ea83 100644 --- a/file_cmds/mtree/extern.h +++ b/file_cmds/mtree/extern.h @@ -61,7 +61,7 @@ const char * ftype(u_int type); extern int ftsoptions; extern u_int keys; extern int lineno; -extern int dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, wflag, mflag, tflag; +extern int dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, wflag, mflag, tflag, xflag; extern int insert_mod, insert_birth, insert_access, insert_change, insert_parent; extern struct timespec ts; #ifdef MAXPATHLEN diff --git a/file_cmds/mtree/mtree.8 b/file_cmds/mtree/mtree.8 index 1aa529a..fb7cff8 100644 --- a/file_cmds/mtree/mtree.8 +++ b/file_cmds/mtree/mtree.8 @@ -148,6 +148,9 @@ This occurs when the directory is a symbolic link. Remove any files in the file hierarchy that are not described in the specification. .\" ========== +.It Fl S +Skip calculating the digest of the extended attributes of the file. +.\" ========== .It Fl s Ar seed Display a single checksum to the standard error output that represents all of the files for which the keyword diff --git a/file_cmds/mtree/mtree.c b/file_cmds/mtree/mtree.c index edf0cce..46cc2ae 100644 --- a/file_cmds/mtree/mtree.c +++ b/file_cmds/mtree/mtree.c @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD: src/usr.sbin/mtree/mtree.c,v 1.29 2004/06/04 19:29:28 ru Exp #define SECONDS_IN_A_DAY (60 * 60 * 24) int ftsoptions = FTS_PHYSICAL; -int cflag, dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, Uflag, wflag, mflag, tflag; +int cflag, dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, Uflag, wflag, mflag, tflag, xflag; int insert_mod, insert_birth, insert_access, insert_change, insert_parent; struct timespec ts; u_int keys; @@ -101,7 +101,7 @@ main(int argc, char *argv[]) atexit(do_cleanup); atexit(print_metrics_to_file); - while ((ch = getopt(argc, argv, "cdef:iK:k:LnPp:qrs:UuwxX:m:F:t:E:")) != -1) + while ((ch = getopt(argc, argv, "cdef:iK:k:LnPp:qrs:UuwxX:m:F:t:E:S")) != -1) switch((char)ch) { case 'c': cflag = 1; @@ -216,8 +216,10 @@ main(int argc, char *argv[]) } else { set_metrics_file(file); } - break; - + break; + case 'S': + xflag = 1; + break; case '?': default: RECORD_FAILURE(92, WARN_USAGE); @@ -279,7 +281,7 @@ main(int argc, char *argv[]) status = mtree_verifyspec(spec1); if (Uflag & (status == MISMATCHEXIT)) { status = 0; - } else { + } else if (status) { RECORD_FAILURE(100, status); } if (mflag && CFDictionaryGetCount(dict)) { @@ -296,7 +298,7 @@ static void usage(void) { (void)fprintf(stderr, -"usage: mtree [-LPUcdeinqruxw] [-f spec] [-f spec] [-K key] [-k key] [-p path] [-s seed]\n" +"usage: mtree [-LPUScdeinqruxw] [-f spec] [-K key] [-k key] [-p path] [-s seed] [-m xml dictionary] [-t timestamp]\n" "\t[-X excludes]\n"); exit(1); } diff --git a/file_cmds/mtree/spec.c b/file_cmds/mtree/spec.c index f15d857..4119124 100644 --- a/file_cmds/mtree/spec.c +++ b/file_cmds/mtree/spec.c @@ -186,6 +186,7 @@ set(char *t, NODE *ip) mode_t *m; int value; char *ep; + char *l; for (; (kw = strtok(t, "= \t\n")); t = NULL) { ip->flags |= type = parsekey(kw, &value); @@ -415,14 +416,19 @@ set(char *t, NODE *ip) } break; case F_XATTRS: - ep = strtok(val,"."); + /* + * Note this is nested inside an strtok loop, + * strtok_r must be used to preserve the strtok context + * of the loop. + */ + ep = strtok_r(val,".", &l); ip->xattrsdigest = strdup(ep); if (!ip->xattrsdigest) { error = errno; RECORD_FAILURE(54, error); errc(1, error, "strdup"); } - val = strtok(NULL,"."); + val = strtok_r(NULL,".", &l); if (val) { ip->xdstream_priv_id = strtoull(val, &ep, 10); if (*ep) { diff --git a/file_cmds/mtree/verify.c b/file_cmds/mtree/verify.c index 7471652..4978098 100644 --- a/file_cmds/mtree/verify.c +++ b/file_cmds/mtree/verify.c @@ -70,7 +70,9 @@ mtree_verifyspec(FILE *fi) RECORD_FAILURE(60, WARN_MISMATCH); return rval; } else { - RECORD_FAILURE(61, WARN_MISMATCH); + if (mval != 0) { + RECORD_FAILURE(61, WARN_MISMATCH); + } return mval; } } diff --git a/file_cmds/tests/cp.sh b/file_cmds/tests/cp.sh new file mode 100644 index 0000000..24afa56 --- /dev/null +++ b/file_cmds/tests/cp.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# Regression test for 69452380 +function regression_69452380() +{ + echo "Verifying that cp -p preserves symlink's attributes, rather than the attributes of the symlink's target." + test_dir=`mktemp -d /tmp/69452380_src_XXXX` + touch ${test_dir}/target + mkdir ${test_dir}/link_dir + # Create symlink (must use relative path for the failure to occur) + cd ${test_dir}/link_dir + ln -s ../target link + # cp (with attribute preservation) the test dir containing both the + # target and the link (in a subdirectory) to a new dir. + # Prior to 69452380, this failed because we followed the symlink to + # try and preserve attributes for a non-existing file, instead of + # preserving the attributes of the symlink itself. + cp -R -P -p ${test_dir} /tmp/69452380_tgt_${RANDOM} +} + +set -eu -o pipefail + +regression_69452380 diff --git a/file_cmds/tests/file_cmds.plist b/file_cmds/tests/file_cmds.plist index 4e4d135..337d4b4 100644 --- a/file_cmds/tests/file_cmds.plist +++ b/file_cmds/tests/file_cmds.plist @@ -8,6 +8,42 @@ Tests + + Command + + /bin/sh + cp.sh + + AsRoot + + TestName + cp + WhenToRun + + PRESUBMISSION + NIGHTLY + + WorkingDirectory + /AppleInternal/Tests/file_cmds + + + Command + + /bin/sh + touch.sh + + AsRoot + + TestName + touch + WhenToRun + + PRESUBMISSION + NIGHTLY + + WorkingDirectory + /AppleInternal/Tests/file_cmds + Command diff --git a/file_cmds/tests/touch.sh b/file_cmds/tests/touch.sh new file mode 100644 index 0000000..d38684d --- /dev/null +++ b/file_cmds/tests/touch.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +file_name=`mktemp /tmp/XXXXXX` +file_ctime=`/usr/bin/stat -f%c ${file_name}` + +/usr/bin/touch $file_name +file_mtime=`/usr/bin/stat -f%m ${file_name}` + +if [ "$file_ctime" -gt "$file_mtime" ]; then + echo "file's mod time ($file_mtime) should be later than the file's creation time ($file_ctime)" + exit 1 +fi + +exit 0 diff --git a/file_cmds/touch/touch.c b/file_cmds/touch/touch.c index aca5b90..ccfcb9f 100644 --- a/file_cmds/touch/touch.c +++ b/file_cmds/touch/touch.c @@ -48,6 +48,7 @@ __used static const char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93"; #include #include #include +#include #include #include @@ -59,10 +60,15 @@ __used static const char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93"; #include #include +typedef struct { + struct timespec mtime; + struct timespec atime; +} set_ts; + int rw(char *, struct stat *, int); -void stime_arg1(char *, struct timeval *); -void stime_arg2(char *, int, struct timeval *); -void stime_file(char *, struct timeval *); +void stime_arg1(char *, set_ts *); +void stime_arg2(char *, int, set_ts *); +void stime_file(char *, set_ts *); int timeoffset(char *); void usage(char *); @@ -70,19 +76,24 @@ int main(int argc, char *argv[]) { struct stat sb; - struct timeval tv[2]; int (*stat_f)(const char *, struct stat *); int (*utimes_f)(const char *, const struct timeval *); int Aflag, aflag, cflag, fflag, mflag, ch, fd, len, rval, timeset; char *p; char *myname; + struct attrlist ts_req = { + .bitmapcount = ATTR_BIT_MAP_COUNT, + .commonattr = ATTR_CMN_MODTIME | ATTR_CMN_ACCTIME, + }; + set_ts ts_struct = {}; myname = basename(argv[0]); Aflag = aflag = cflag = fflag = mflag = timeset = 0; stat_f = stat; utimes_f = utimes; - if (gettimeofday(&tv[0], NULL)) - err(1, "gettimeofday"); + if (clock_gettime(CLOCK_REALTIME, &ts_struct.mtime)) + err(1, "clock_gettime"); + ts_struct.atime = ts_struct.mtime; while ((ch = getopt(argc, argv, "A:acfhmr:t:")) != -1) switch(ch) { @@ -108,11 +119,11 @@ main(int argc, char *argv[]) break; case 'r': timeset = 1; - stime_file(optarg, tv); + stime_file(optarg, &ts_struct); break; case 't': timeset = 1; - stime_arg1(optarg, tv); + stime_arg1(optarg, &ts_struct); break; case '?': default: @@ -132,9 +143,9 @@ main(int argc, char *argv[]) * that time once and for all here. */ if (aflag) - tv[0].tv_sec += Aflag; + ts_struct.atime.tv_sec += Aflag; if (mflag) - tv[1].tv_sec += Aflag; + ts_struct.mtime.tv_sec += Aflag; Aflag = 0; /* done our job */ } } else { @@ -148,11 +159,9 @@ main(int argc, char *argv[]) len = p - argv[0]; if (*p == '\0' && (len == 8 || len == 10)) { timeset = 1; - stime_arg2(*argv++, len == 10, tv); + stime_arg2(*argv++, len == 10, &ts_struct); } } - /* Both times default to the same. */ - tv[1] = tv[0]; } if (*argv == NULL) @@ -187,9 +196,9 @@ main(int argc, char *argv[]) } if (!aflag) - TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec); + ts_struct.atime = sb.st_atimespec; if (!mflag) - TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtimespec); + ts_struct.mtime = sb.st_mtimespec; /* * We're adjusting the times based on the file times, not a @@ -197,17 +206,17 @@ main(int argc, char *argv[]) */ if (Aflag) { if (aflag) { - TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec); - tv[0].tv_sec += Aflag; + ts_struct.atime = sb.st_atimespec; + ts_struct.atime.tv_sec += Aflag; } if (mflag) { - TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtimespec); - tv[1].tv_sec += Aflag; + ts_struct.mtime = sb.st_mtimespec; + ts_struct.mtime.tv_sec += Aflag; } } - /* Try utimes(2). */ - if (!utimes_f(*argv, tv)) + /* Try setattrlist(2). */ + if (!setattrlist(*argv, &ts_req, &ts_struct, sizeof(ts_struct), 0)) continue; /* If the user specified a time, nothing else we can do. */ @@ -241,14 +250,14 @@ main(int argc, char *argv[]) #define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2; void -stime_arg1(char *arg, struct timeval *tvp) +stime_arg1(char *arg, set_ts *tsp) { time_t now; struct tm *t; int yearset; char *p; /* Start with the current time. */ - now = tvp[0].tv_sec; + now = tsp->atime.tv_sec; if ((t = localtime(&now)) == NULL) err(1, "localtime"); /* [[CC]YY]MMDDhhmm[.SS] */ @@ -293,21 +302,21 @@ stime_arg1(char *arg, struct timeval *tvp) } t->tm_isdst = -1; /* Figure out DST. */ - tvp[0].tv_sec = tvp[1].tv_sec = mktime(t); - if (tvp[0].tv_sec == -1) + tsp->atime.tv_sec = tsp->mtime.tv_sec = mktime(t); + if (tsp->atime.tv_sec == -1) terr: errx(1, "out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]"); - tvp[0].tv_usec = tvp[1].tv_usec = 0; + tsp->atime.tv_nsec = tsp->mtime.tv_nsec = 0; } void -stime_arg2(char *arg, int year, struct timeval *tvp) +stime_arg2(char *arg, int year, set_ts *tsp) { time_t now; struct tm *t; /* Start with the current time. */ - now = tvp[0].tv_sec; + now = tsp->atime.tv_sec; if ((t = localtime(&now)) == NULL) err(1, "localtime"); @@ -323,12 +332,12 @@ stime_arg2(char *arg, int year, struct timeval *tvp) } t->tm_isdst = -1; /* Figure out DST. */ - tvp[0].tv_sec = tvp[1].tv_sec = mktime(t); - if (tvp[0].tv_sec == -1) + tsp->atime.tv_sec = tsp->mtime.tv_sec = mktime(t); + if (tsp->atime.tv_sec == -1) errx(1, "out of range or illegal time specification: MMDDhhmm[yy]"); - tvp[0].tv_usec = tvp[1].tv_usec = 0; + tsp->atime.tv_nsec = tsp->mtime.tv_nsec = 0; } /* Calculate a time offset in seconds, given an arg of the format [-]HHMMSS. */ @@ -362,14 +371,14 @@ timeoffset(char *arg) } void -stime_file(char *fname, struct timeval *tvp) +stime_file(char *fname, set_ts *ts_struct) { struct stat sb; if (stat(fname, &sb)) err(1, "%s", fname); - TIMESPEC_TO_TIMEVAL(tvp, &sb.st_atimespec); - TIMESPEC_TO_TIMEVAL(tvp + 1, &sb.st_mtimespec); + ts_struct->atime = sb.st_atimespec; + ts_struct->mtime = sb.st_mtimespec; } int -- cgit v1.2.3-56-ge451 From 861289845fcf7dbe9b289d9695fe6808ff13be2b Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 20 May 2021 16:22:52 -0400 Subject: system_cmds: Update to 880.100.5 --- system_cmds/.apple_version | 2 +- system_cmds/lsmp.tproj/common.h | 15 +- system_cmds/lsmp.tproj/entitlements.plist | 4 +- system_cmds/lsmp.tproj/lsmp.c | 18 +- system_cmds/lsmp.tproj/port_details.c | 30 +- system_cmds/lsmp.tproj/task_details.c | 111 ++-- system_cmds/nvram.tproj/entitlements.plist | 8 + system_cmds/nvram.tproj/nvram.c | 585 +++++++++++---------- system_cmds/system_cmds.xcodeproj/project.pbxproj | 4 + .../taskpolicy.tproj/taskpolicy-entitlements.plist | 2 +- system_cmds/taskpolicy.tproj/taskpolicy.c | 5 +- .../vm_purgeable_stat.tproj/entitlements.plist | 2 +- .../vm_purgeable_stat.tproj/vm_purgeable_stat.c | 7 +- system_cmds/zprint.tproj/zprint.c | 2 + 14 files changed, 415 insertions(+), 380 deletions(-) create mode 100644 system_cmds/nvram.tproj/entitlements.plist diff --git a/system_cmds/.apple_version b/system_cmds/.apple_version index 9e0e819..f6c5d7f 100644 --- a/system_cmds/.apple_version +++ b/system_cmds/.apple_version @@ -1 +1 @@ -880.60.2 +880.100.5 diff --git a/system_cmds/lsmp.tproj/common.h b/system_cmds/lsmp.tproj/common.h index 9a47012..a059eb5 100644 --- a/system_cmds/lsmp.tproj/common.h +++ b/system_cmds/lsmp.tproj/common.h @@ -25,6 +25,7 @@ #define system_cmds_common_h #include +#include #include "json.h" #define PROC_NAME_LEN 100 @@ -46,7 +47,7 @@ extern struct prog_configs lsmp_config; /* exception port information */ struct exc_port_info { mach_msg_type_number_t count; - mach_port_t ports[EXC_TYPES_COUNT]; + ipc_info_port_t ports_info[EXC_TYPES_COUNT]; exception_mask_t masks[EXC_TYPES_COUNT]; exception_behavior_t behaviors[EXC_TYPES_COUNT]; thread_state_flavor_t flavors[EXC_TYPES_COUNT]; @@ -74,7 +75,7 @@ struct k2n_table_node *k2n_table_lookup(struct k2n_table_node **table, natural_t /* private structure to wrap up per-task info */ typedef struct my_per_task_info { - task_t task; + task_read_t task; pid_t pid; vm_address_t task_kobject; ipc_info_space_t info; @@ -181,12 +182,12 @@ char *copy_voucher_detail(mach_port_t task, mach_port_name_t voucher, JSON_t jso /* mach port related functions */ const char * kobject_name(natural_t kotype); -void get_receive_port_context(task_t taskp, mach_port_name_t portname, mach_port_context_t *context); -int get_recieve_port_status(task_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info); +void get_receive_port_context(task_read_t taskp, mach_port_name_t portname, mach_port_context_t *context); +int get_recieve_port_status(task_read_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info); void show_task_mach_ports(my_per_task_info_t *taskinfo, uint32_t taskCount, my_per_task_info_t *allTaskInfos, JSON_t json); /* task and thread related helper functions */ -kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_t target_task); +kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_read_t target_task); my_per_task_info_t * allocate_taskinfo_memory(uint32_t taskCount); void deallocate_taskinfo_memory(my_per_task_info_t *data); kern_return_t print_task_exception_info(my_per_task_info_t *taskinfo, JSON_t json); @@ -195,8 +196,8 @@ my_per_task_info_t * get_taskinfo_by_kobject(natural_t kobj); void get_exc_behavior_string(exception_behavior_t b, char *out_string, size_t len); void get_exc_mask_string(exception_mask_t m, char *out_string, size_t len); -kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t *sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info); -kern_return_t get_ipc_info_from_lsmp_spaceinfo(mach_port_t port_name, ipc_info_name_t *out_sendright); +kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info); +kern_return_t get_taskinfo_of_receiver_by_send_right_info(ipc_info_port_t sendright_info, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info); /* basic util functions */ uint32_t print_hex_data(char *outstr, uint32_t maxlen, char *prefix, char *desc, void *addr, int len); diff --git a/system_cmds/lsmp.tproj/entitlements.plist b/system_cmds/lsmp.tproj/entitlements.plist index b7b4e6c..cdf0e9e 100644 --- a/system_cmds/lsmp.tproj/entitlements.plist +++ b/system_cmds/lsmp.tproj/entitlements.plist @@ -2,9 +2,7 @@ - task_for_pid-allow - - com.apple.system-task-ports + com.apple.system-task-ports.read diff --git a/system_cmds/lsmp.tproj/lsmp.c b/system_cmds/lsmp.tproj/lsmp.c index 71a7c68..114c5b6 100644 --- a/system_cmds/lsmp.tproj/lsmp.c +++ b/system_cmds/lsmp.tproj/lsmp.c @@ -19,6 +19,7 @@ * * @APPLE_LICENSE_HEADER_END@ */ +#include #include #include #include @@ -32,7 +33,7 @@ #include "json.h" #if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR) -#define TASK_FOR_PID_USAGE_MESG "\nPlease check your boot-args to ensure you have access to task_for_pid()." +#define TASK_FOR_PID_USAGE_MESG "\nPlease check your boot-args to ensure you have access to task_read_for_pid()." #else #define TASK_FOR_PID_USAGE_MESG "" #endif @@ -72,7 +73,7 @@ static void print_task_info(my_per_task_info_t *taskinfo, mach_msg_type_number_t int main(int argc, char *argv[]) { kern_return_t ret; - task_t aTask; + task_read_t aTask; my_per_task_info_t *taskinfo = NULL; task_array_t tasks; char *progname = "lsmp"; @@ -153,10 +154,10 @@ int main(int argc, char *argv[]) { mach_port_deallocate(mach_task_self(), psets[0]); vm_deallocate(mach_task_self(), (vm_address_t)psets, (vm_size_t)psetCount * sizeof(mach_port_t)); - /* convert the processor-set-priv to a list of tasks for the processor set */ - ret = processor_set_tasks(pset_priv, &tasks, &taskCount); + /* convert the processor-set-priv to a list of task read ports for the processor set */ + ret = processor_set_tasks_with_flavor(pset_priv, TASK_FLAVOR_READ, &tasks, &taskCount); if (ret != KERN_SUCCESS) { - fprintf(stderr, "processor_set_tasks() failed: %s\n", mach_error_string(ret)); + fprintf(stderr, "processor_set_tasks_with_flavor() failed: %s\n", mach_error_string(ret)); exit(1); } mach_port_deallocate(mach_task_self(), pset_priv); @@ -164,7 +165,7 @@ int main(int argc, char *argv[]) { /* swap my current instances port to be last to collect all threads and exception port info */ int myTaskPosition = -1; for (int i = 0; i < taskCount; i++) { - if (tasks[i] == mach_task_self()){ + if (mach_task_is_self(tasks[i])){ myTaskPosition = i; break; } @@ -181,7 +182,7 @@ int main(int argc, char *argv[]) { { fprintf(stderr, "warning: should run as root for best output (cross-ref to other tasks' ports).\n"); /* just the one process */ - ret = task_for_pid(mach_task_self(), lsmp_config.pid, &aTask); + ret = task_read_for_pid(mach_task_self(), lsmp_config.pid, &aTask); if (ret != KERN_SUCCESS) { fprintf(stderr, "task_for_pid() failed: %s %s\n", mach_error_string(ret), TASK_FOR_PID_USAGE_MESG); exit(1); @@ -200,8 +201,9 @@ int main(int argc, char *argv[]) { continue; } - if (psettaskinfo[i].pid == lsmp_config.pid) + if (psettaskinfo[i].pid == lsmp_config.pid) { taskinfo = &psettaskinfo[i]; + } } JSON_OBJECT_BEGIN(lsmp_config.json_output); diff --git a/system_cmds/lsmp.tproj/port_details.c b/system_cmds/lsmp.tproj/port_details.c index fb888e4..69fc9be 100644 --- a/system_cmds/lsmp.tproj/port_details.c +++ b/system_cmds/lsmp.tproj/port_details.c @@ -232,7 +232,7 @@ char * copy_voucher_detail(mach_port_t task, mach_port_name_t voucher, JSON_t js return voucher_outstr; } -void get_receive_port_context(task_t taskp, mach_port_name_t portname, mach_port_context_t *context) { +void get_receive_port_context(task_read_t taskp, mach_port_name_t portname, mach_port_context_t *context) { if (context == NULL) { return; } @@ -248,7 +248,7 @@ void get_receive_port_context(task_t taskp, mach_port_name_t portname, mach_port return; } -int get_recieve_port_status(task_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info){ +int get_recieve_port_status(task_read_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info){ if (info == NULL) { return -1; } @@ -625,13 +625,19 @@ static void show_task_table_entry(ipc_info_name_t *entry, my_per_task_info_t *ta 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 (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_CONTROL) || (kotype == IKOT_TASK_NAME)) { + + 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_CONTROL) || + (kotype == IKOT_TASK_READ) || + (kotype == IKOT_TASK_INSPECT) || + (kotype == IKOT_TASK_NAME)) { if (taskinfo->task_kobject == kobject) { /* neat little optimization since in most cases tasks have themselves in their ipc space */ JSON_OBJECT_SET(json, pid, %d, taskinfo->pid); @@ -645,7 +651,9 @@ static void show_task_table_entry(ipc_info_name_t *entry, my_per_task_info_t *ta } } - if (kotype == IKOT_THREAD_CONTROL) { + if ((kotype == IKOT_THREAD_CONTROL) || + (kotype == IKOT_THREAD_READ) || + (kotype == IKOT_THREAD_INSPECT)) { for (int i = 0; i < taskinfo->threadCount; i++) { if (taskinfo->threadInfos[i].th_kobject == kobject) { printf(" (%#llx)", taskinfo->threadInfos[i].th_id); @@ -673,7 +681,7 @@ static void show_task_table_entry(ipc_info_name_t *entry, my_per_task_info_t *ta /* not kobject - find the receive right holder */ my_per_task_info_t *recv_holder_taskinfo; mach_port_name_t recv_name = MACH_PORT_NULL; - if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right(entry, &recv_holder_taskinfo, &recv_name)) { + if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right(*entry, &recv_holder_taskinfo, &recv_name)) { mach_port_status_t port_status; mach_port_info_ext_t info; mach_port_context_t port_context = (mach_port_context_t)0; diff --git a/system_cmds/lsmp.tproj/task_details.c b/system_cmds/lsmp.tproj/task_details.c index bf9ef51..123f8aa 100644 --- a/system_cmds/lsmp.tproj/task_details.c +++ b/system_cmds/lsmp.tproj/task_details.c @@ -139,7 +139,7 @@ void deallocate_taskinfo_memory(my_per_task_info_t *data){ } } -kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_t target_task) +kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_read_t target_task) { int i; kern_return_t ret = KERN_SUCCESS; @@ -149,10 +149,10 @@ kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_t target_ taskinfo->task = target_task; pid_for_task(target_task, &taskinfo->pid); - ret = task_get_exception_ports(taskinfo->task, EXC_MASK_ALL, taskinfo->exceptionInfo.masks, &taskinfo->exceptionInfo.count, taskinfo->exceptionInfo.ports, taskinfo->exceptionInfo.behaviors, taskinfo->exceptionInfo.flavors); + ret = task_get_exception_ports_info(taskinfo->task, EXC_MASK_ALL, taskinfo->exceptionInfo.masks, &taskinfo->exceptionInfo.count, taskinfo->exceptionInfo.ports_info, taskinfo->exceptionInfo.behaviors, taskinfo->exceptionInfo.flavors); if (ret != KERN_SUCCESS) { - fprintf(stderr, "task_get_exception_ports() failed: pid:%d error: %s\n",taskinfo->pid, mach_error_string(ret)); + fprintf(stderr, "task_get_exception_ports_info() failed: pid:%d error: %s\n",taskinfo->pid, mach_error_string(ret)); taskinfo->pid = 0; } @@ -180,9 +180,9 @@ kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_t target_ mach_msg_type_number_t th_info_count = THREAD_IDENTIFIER_INFO_COUNT; struct exc_port_info *excinfo = &(taskinfo->threadExceptionInfos[i]); - ret = thread_get_exception_ports(threadPorts[i], EXC_MASK_ALL, excinfo->masks, &excinfo->count, excinfo->ports, excinfo->behaviors, excinfo->flavors); + ret = thread_get_exception_ports_info(threadPorts[i], EXC_MASK_ALL, excinfo->masks, &excinfo->count, excinfo->ports_info, excinfo->behaviors, excinfo->flavors); if (ret != KERN_SUCCESS){ - fprintf(stderr, "thread_get_exception_ports() failed: pid: %d thread: %d error %s\n", taskinfo->pid, threadPorts[i], mach_error_string(ret)); + fprintf(stderr, "thread_get_exception_ports_info() failed: pid: %d thread: %d error %s\n", taskinfo->pid, threadPorts[i], mach_error_string(ret)); } if (excinfo->count != 0) { @@ -236,8 +236,9 @@ kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_t target_ proc_pid_to_name(taskinfo->pid, taskinfo->processName); ret = mach_port_kernel_object(mach_task_self(), taskinfo->task, &kotype, (unsigned *)&kobject); - - if (ret == KERN_SUCCESS && kotype == IKOT_TASK_CONTROL) { + + /* Now that we are using read ports, kotype should be checked against IKOT_TASK_READ */ + if (ret == KERN_SUCCESS && kotype == IKOT_TASK_READ) { taskinfo->task_kobject = kobject; taskinfo->valid = TRUE; } @@ -307,23 +308,32 @@ kern_return_t print_task_exception_info(my_per_task_info_t *taskinfo, JSON_t jso boolean_t header_required = TRUE; for (int i = 0; i < taskinfo->exceptionInfo.count; i++) { - if (taskinfo->exceptionInfo.ports[i] != MACH_PORT_NULL) { + if (taskinfo->exceptionInfo.ports_info[i].iip_port_object != 0) { + my_per_task_info_t * _found_task; + if (header_required) { - printf(" exc_port flavor mask \n"); + printf(" exc_port_object receiver_task flavor mask \n"); header_required = FALSE; } get_exc_behavior_string(taskinfo->exceptionInfo.behaviors[i], behavior_string, sizeof(behavior_string)); get_exc_mask_string(taskinfo->exceptionInfo.masks[i], mask_string, sizeof(mask_string)); JSON_OBJECT_BEGIN(json); - JSON_OBJECT_SET(json, port, "0x%08x", taskinfo->exceptionInfo.ports[i]); + JSON_OBJECT_SET(json, port_object, "0x%08x", taskinfo->exceptionInfo.ports_info[i].iip_port_object); + JSON_OBJECT_SET(json, receiver_object, "0x%08x", taskinfo->exceptionInfo.ports_info[i].iip_receiver_object); JSON_OBJECT_SET(json, flavor, "0x%03x", taskinfo->exceptionInfo.flavors[i]); JSON_OBJECT_SET(json, behavior, "%s", behavior_string); JSON_OBJECT_SET(json, mask, "%s", mask_string); JSON_OBJECT_END(json); // exception port - - printf(" 0x%08x 0x%03x <%s> %s \n" , taskinfo->exceptionInfo.ports[i], taskinfo->exceptionInfo.flavors[i], behavior_string, mask_string); + + _found_task = get_taskinfo_by_kobject((natural_t)taskinfo->exceptionInfo.ports_info[i].iip_receiver_object); + + printf(" 0x%08x (%d) %s 0x%03x <%s> %s \n", + taskinfo->exceptionInfo.ports_info[i].iip_port_object, + _found_task->pid, + _found_task->processName, + taskinfo->exceptionInfo.flavors[i], behavior_string, mask_string); } } @@ -389,39 +399,35 @@ kern_return_t print_task_threads_special_ports(my_per_task_info_t *taskinfo, JSO for (int i = 0; i < excinfo->count; i++) { JSON_OBJECT_BEGIN(json); - if (excinfo->ports[i] != MACH_PORT_NULL) { + if (excinfo->ports_info[i].iip_port_object != 0) { if (header_required) { - printf("\n exc_port flavor mask -> name owner\n"); + printf("\n exc_port_object exc_port_receiver flavor mask -> name owner\n"); header_required = FALSE; } get_exc_behavior_string(excinfo->behaviors[i], behavior_string, sizeof(behavior_string)); get_exc_mask_string(excinfo->masks[i], mask_string, sizeof(mask_string)); - JSON_OBJECT_SET(json, port, "0x%08x", excinfo->ports[i]); + JSON_OBJECT_SET(json, port_object, "0x%08x", excinfo->ports_info[i].iip_port_object); + JSON_OBJECT_SET(json, receiver_object, "0x%08x", excinfo->ports_info[i].iip_receiver_object); JSON_OBJECT_SET(json, flavor, "0x%03x", excinfo->flavors[i]); JSON_OBJECT_SET(json, behavior, "%s", behavior_string); JSON_OBJECT_SET(json, mask, "%s", mask_string); - printf(" 0x%08x 0x%03x <%s> %s " , excinfo->ports[i], excinfo->flavors[i], behavior_string, mask_string); - - ipc_info_name_t actual_sendinfo; - if (KERN_SUCCESS == get_ipc_info_from_lsmp_spaceinfo(excinfo->ports[i], &actual_sendinfo)) { - my_per_task_info_t *recv_holder_taskinfo; - mach_port_name_t recv_name = MACH_PORT_NULL; - if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right(&actual_sendinfo, &recv_holder_taskinfo, &recv_name)) { - - JSON_OBJECT_SET(json, name, "0x%08x", recv_name); - JSON_OBJECT_SET(json, ipc-object, "0x%08x", actual_sendinfo.iin_object); - JSON_OBJECT_SET(json, pid, %d, recv_holder_taskinfo->pid); - JSON_OBJECT_SET(json, process, "%s", recv_holder_taskinfo->processName); - - printf(" -> 0x%08x 0x%08x (%d) %s\n", - recv_name, - actual_sendinfo.iin_object, - recv_holder_taskinfo->pid, - recv_holder_taskinfo->processName); - } - + printf(" 0x%08x 0x%08x 0x%03x <%s> %s " , excinfo->ports_info[i].iip_port_object, excinfo->ports_info[i].iip_receiver_object, excinfo->flavors[i], behavior_string, mask_string); + + my_per_task_info_t *recv_holder_taskinfo; + mach_port_name_t recv_name = MACH_PORT_NULL; + if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right_info(excinfo->ports_info[i], &recv_holder_taskinfo, &recv_name)) { + JSON_OBJECT_SET(json, name, "0x%08x", recv_name); + JSON_OBJECT_SET(json, ipc-object, "0x%08x", excinfo->ports_info[i].iip_port_object); + JSON_OBJECT_SET(json, pid, %d, recv_holder_taskinfo->pid); + JSON_OBJECT_SET(json, process, "%s", recv_holder_taskinfo->processName); + + printf(" -> 0x%08x 0x%08x (%d) %s\n", + recv_name, + excinfo->ports_info[i].iip_port_object, + recv_holder_taskinfo->pid, + recv_holder_taskinfo->processName); } else { fprintf(stderr, "failed to find"); } @@ -463,14 +469,14 @@ my_per_task_info_t * get_taskinfo_by_kobject(natural_t kobj) { return retval; } -kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t *sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info) +static kern_return_t _get_taskinfo_of_receiver_by_send_right(natural_t kobject, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info) { *out_taskinfo = &NOT_FOUND_TASK_INFO; struct k2n_table_node *k2nnode; - for (int j = 0; j < global_taskcount; j++) { - if ((k2nnode = k2n_table_lookup(global_taskinfo[j].k2ntable, sendright->iin_object))) { - assert(k2nnode->info_name->iin_object == sendright->iin_object); + for (unsigned int j = 0; j < global_taskcount; j++) { + if ((k2nnode = k2n_table_lookup(global_taskinfo[j].k2ntable, kobject))) { + assert(k2nnode->info_name->iin_object == kobject); if (k2nnode->info_name->iin_type & MACH_PORT_TYPE_RECEIVE) { *out_taskinfo = &global_taskinfo[j]; @@ -483,25 +489,12 @@ kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t *sendright, return KERN_FAILURE; } -kern_return_t get_ipc_info_from_lsmp_spaceinfo(mach_port_t port_name, ipc_info_name_t *out_sendright){ - kern_return_t retval = KERN_FAILURE; - bzero(out_sendright, sizeof(ipc_info_name_t)); - my_per_task_info_t *mytaskinfo = NULL; - for (int i = global_taskcount - 1; i >= 0; i--){ - if (global_taskinfo[i].task == mach_task_self()){ - mytaskinfo = &global_taskinfo[i]; - break; - } - } - if (mytaskinfo) { - for (int k = 0; k < mytaskinfo->tableCount; k++) { - if (port_name == mytaskinfo->table[k].iin_name){ - bcopy(&mytaskinfo->table[k], out_sendright, sizeof(ipc_info_name_t)); - retval = KERN_SUCCESS; - break; - } - } - } - return retval; +kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info) +{ + return _get_taskinfo_of_receiver_by_send_right(sendright.iin_object, out_taskinfo, out_recv_info); +} +kern_return_t get_taskinfo_of_receiver_by_send_right_info(ipc_info_port_t sendright_info, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info) +{ + return _get_taskinfo_of_receiver_by_send_right(sendright_info.iip_port_object, out_taskinfo, out_recv_info); } diff --git a/system_cmds/nvram.tproj/entitlements.plist b/system_cmds/nvram.tproj/entitlements.plist new file mode 100644 index 0000000..9866704 --- /dev/null +++ b/system_cmds/nvram.tproj/entitlements.plist @@ -0,0 +1,8 @@ + + + + + com.apple.private.iokit.system-nvram-internal-allow + + + diff --git a/system_cmds/nvram.tproj/nvram.c b/system_cmds/nvram.tproj/nvram.c index 20d1927..b10ab2e 100644 --- a/system_cmds/nvram.tproj/nvram.c +++ b/system_cmds/nvram.tproj/nvram.c @@ -33,26 +33,27 @@ cc -o nvram nvram.c -framework CoreFoundation -framework IOKit -Wall #include // Prototypes -static void UsageMessage(char *message); -static void ParseFile(char *fileName); -static void ParseXMLFile(char *fileName); +static void UsageMessage(const char *message); +static void ParseFile(const char *fileName); +static void ParseXMLFile(const char *fileName); static void SetOrGetOFVariable(char *str); -static kern_return_t GetOFVariable(char *name, CFStringRef *nameRef, - CFTypeRef *valueRef); -static kern_return_t SetOFVariable(char *name, char *value); -static void DeleteOFVariable(char *name); +static kern_return_t GetOFVariable(const char *name, CFStringRef *nameRef, + CFTypeRef *valueRef); +static kern_return_t SetOFVariable(const char *name, const char *value); +static void DeleteOFVariable(const char *name); static void PrintOFVariables(void); static void PrintOFVariable(const void *key,const void *value,void *context); static void SetOFVariableFromFile(const void *key, const void *value, void *context); static void ClearOFVariables(void); static void ClearOFVariable(const void *key,const void *value,void *context); -static CFTypeRef ConvertValueToCFTypeRef(CFTypeID typeID, char *value); +static CFTypeRef ConvertValueToCFTypeRef(CFTypeID typeID, const char *value); -static void NVRamSyncNow(char *name); +static void NVRamSyncNow(void); // Global Variables -static char *gToolName; static io_registry_entry_t gOptionsRef; +static io_registry_entry_t gSystemOptionsRef; +static io_registry_entry_t gSelectedOptionsRef; static bool gUseXML; static bool gUseForceSync; @@ -85,12 +86,7 @@ int main(int argc, char **argv) char *str, errorMessage[256]; kern_return_t result; mach_port_t masterPort; - int argcount = 0; - - // Get the name of the command. - gToolName = strrchr(argv[0], '/'); - if (gToolName != 0) gToolName++; - else gToolName = argv[0]; + int argcount = 0; result = IOMasterPort(bootstrap_port, &masterPort); if (result != KERN_SUCCESS) { @@ -103,106 +99,125 @@ int main(int argc, char **argv) errx(1, "nvram is not supported on this system"); } + gSystemOptionsRef = IORegistryEntryFromPath(masterPort, "IOService:/options/options-system"); + + gSelectedOptionsRef = gOptionsRef; + for (cnt = 1; cnt < argc; cnt++) { str = argv[cnt]; if (str[0] == '-' && str[1] != 0) { // Parse the options. for (str += 1 ; *str; str++) { - switch (*str) { - case 'p' : + switch (*str) { + case 'p' : #if TARGET_OS_BRIDGE - if (gBridgeToIntel) { - fprintf(stderr, "-p not supported for Mac NVRAM store.\n"); - return 1; - } + if (gBridgeToIntel) { + fprintf(stderr, "-p not supported for Mac NVRAM store.\n"); + return 1; + } #endif - PrintOFVariables(); - break; + PrintOFVariables(); + break; - case 'x' : - gUseXML = true; - break; + case 'x' : + gUseXML = true; + break; - case 'f': + case 'f': #if TARGET_OS_BRIDGE - if (gBridgeToIntel) { - fprintf(stderr, "-f not supported for Mac NVRAM store.\n"); - return 1; - } + if (gBridgeToIntel) { + fprintf(stderr, "-f not supported for Mac NVRAM store.\n"); + return 1; + } #endif - cnt++; - if (cnt < argc && *argv[cnt] != '-') { - ParseFile(argv[cnt]); - } else { - UsageMessage("missing filename"); - } - break; - - case 'd': - cnt++; - if (cnt < argc && *argv[cnt] != '-') { + cnt++; + if (cnt < argc && *argv[cnt] != '-') { + ParseFile(argv[cnt]); + } else { + UsageMessage("missing filename"); + } + break; + + case 'd': + cnt++; + if (cnt < argc && *argv[cnt] != '-') { #if TARGET_OS_BRIDGE - if (gBridgeToIntel) { - if ((result = DeleteMacOFVariable(argv[cnt])) != KERN_SUCCESS) { + if (gBridgeToIntel) { + if ((result = DeleteMacOFVariable(argv[cnt])) != KERN_SUCCESS) { errx(1, "Error deleting variable - '%s': %s (0x%08x)", argv[cnt], mach_error_string(result), result); + } } - } - else + else #endif - { - DeleteOFVariable(argv[cnt]); - } - } else { - UsageMessage("missing name"); - } - break; + { + DeleteOFVariable(argv[cnt]); + } + } else { + UsageMessage("missing name"); + } + break; - case 'c': + case 'c': #if TARGET_OS_BRIDGE - if (gBridgeToIntel) { - fprintf(stderr, "-c not supported for Mac NVRAM store.\n"); - return 1; - } + if (gBridgeToIntel) { + fprintf(stderr, "-c not supported for Mac NVRAM store.\n"); + return 1; + } #endif - ClearOFVariables(); - break; - case 's': - // -s option is unadvertised -- advises the kernel more forcibly to - // commit the variable to nonvolatile storage - gUseForceSync = true; - break; + ClearOFVariables(); + break; + case 's': + // -s option is unadvertised -- advises the kernel more forcibly to + // commit the variable to nonvolatile storage + gUseForceSync = true; + break; #if TARGET_OS_BRIDGE - case 'm': - // used to set nvram variables on the Intel side - // from the ARM side (Bridge -> Mac) - fprintf(stdout, "Using Mac NVRAM store.\n"); - - LinkMacNVRAMSymbols(); - gBridgeToIntel = true; - break; + case 'm': + // used to set nvram variables on the Intel side + // from the ARM side (Bridge -> Mac) + fprintf(stdout, "Using Mac NVRAM store.\n"); + + LinkMacNVRAMSymbols(); + gBridgeToIntel = true; + break; #endif - default: - strcpy(errorMessage, "no such option as --"); - errorMessage[strlen(errorMessage)-1] = *str; - UsageMessage(errorMessage); - } + case 'z': + // -z option is unadvertised -- attempts to use the options-system node + // to write to the system NVRAM region if available + if (gSystemOptionsRef) { + fprintf(stderr, "Selecting options-system node.\n"); + gSelectedOptionsRef = gSystemOptionsRef; + } else { + fprintf(stderr, "No options-system node, using options.\n"); + } + break; + + default: + strcpy(errorMessage, "no such option as --"); + errorMessage[strlen(errorMessage)-1] = *str; + UsageMessage(errorMessage); + } + } + } else { + // Other arguments will be firmware variable requests. + argcount++; + SetOrGetOFVariable(str); } - } else { - // Other arguments will be firmware variable requests. - argcount++; - SetOrGetOFVariable(str); - } } // radar:25206371 if (argcount == 0 && gUseForceSync == true) { - NVRamSyncNow(""); + NVRamSyncNow(); } IOObjectRelease(gOptionsRef); + if (gSystemOptionsRef) { + IOObjectRelease(gSystemOptionsRef); + } + return 0; } @@ -210,11 +225,11 @@ int main(int argc, char **argv) // // Print the usage information and exit. // -static void UsageMessage(char *message) +static void UsageMessage(const char *message) { warnx("(usage: %s)", message); - printf("%s [-x] [-p] [-f filename] [-d name] [-c] name[=value] ...\n", gToolName); + printf("nvram [-x] [-p] [-f filename] [-d name] [-c] name[=value] ...\n"); printf("\t-x use XML format for printing or reading variables\n"); printf("\t (must appear before -p or -f)\n"); printf("\t-p print all firmware variables\n"); @@ -252,7 +267,7 @@ enum { // // Open and parse the specified file. // -static void ParseFile(char *fileName) +static void ParseFile(const char *fileName) { long state, ni = 0, vi = 0; int tc; @@ -282,72 +297,72 @@ static void ParseFile(char *fileName) ni = 0; vi = 0; if (tc == '#') { - state = kScanComment; + state = kScanComment; } else if (tc == '\n') { - // state stays kFirstColumn. + // state stays kFirstColumn. } else if (isspace(tc)) { - state = kFindName; + state = kFindName; } else { - state = kCollectName; - name[ni++] = tc; + state = kCollectName; + name[ni++] = tc; } break; case kScanComment : if (tc == '\n') { - state = kFirstColumn; + state = kFirstColumn; } else { - // state stays kScanComment. + // state stays kScanComment. } break; case kFindName : if (tc == '\n') { - state = kFirstColumn; + state = kFirstColumn; } else if (isspace(tc)) { - // state stays kFindName. + // state stays kFindName. } else { - state = kCollectName; - name[ni++] = tc; + state = kCollectName; + name[ni++] = tc; } break; case kCollectName : if (tc == '\n') { - name[ni] = 0; - warnx("Name must be followed by white space - '%s'", name); - state = kFirstColumn; + name[ni] = 0; + warnx("Name must be followed by white space - '%s'", name); + state = kFirstColumn; } else if (isspace(tc)) { - state = kFindValue; + state = kFindValue; } else { - name[ni++] = tc; - // state staus kCollectName. + name[ni++] = tc; + // state staus kCollectName. } break; case kFindValue : case kContinueValue : if (tc == '\n') { - state = kSetenv; + state = kSetenv; } else if (isspace(tc)) { - // state stays kFindValue or kContinueValue. + // state stays kFindValue or kContinueValue. } else { - state = kCollectValue; - value[vi++] = tc; + state = kCollectValue; + value[vi++] = tc; } break; case kCollectValue : if (tc == '\n') { - if (value[vi-1] == '\\') { - value[vi-1] = '\r'; - state = kContinueValue; - } else { - state = kSetenv; - } + if (value[vi-1] == '\\') { + value[vi-1] = '\r'; + state = kContinueValue; + } else { + state = kSetenv; + } } else { - // state stays kCollectValue. - value[vi++] = tc; + // state stays kCollectValue. + value[vi++] = tc; } break; } @@ -373,71 +388,71 @@ static void ParseFile(char *fileName) // Open and parse the specified file in XML format, // and set variables appropriately. // -static void ParseXMLFile(char *fileName) +static void ParseXMLFile(const char *fileName) { - CFPropertyListRef plist; - int fd; - struct stat sb; - char *buffer; - CFReadStreamRef stream; - CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0; - - fd = open(fileName, O_RDONLY | O_NOFOLLOW, S_IFREG); - if (fd == -1) { - errx(1, "Could not open %s: %s", fileName, strerror(errno)); - } + CFPropertyListRef plist; + int fd; + struct stat sb; + char *buffer; + CFReadStreamRef stream; + CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0; + + fd = open(fileName, O_RDONLY | O_NOFOLLOW, S_IFREG); + if (fd == -1) { + errx(1, "Could not open %s: %s", fileName, strerror(errno)); + } - if (fstat(fd, &sb) == -1) { - errx(1, "Could not fstat %s: %s", fileName, strerror(errno)); - } + if (fstat(fd, &sb) == -1) { + errx(1, "Could not fstat %s: %s", fileName, strerror(errno)); + } - if (sb.st_size > UINT32_MAX) { - errx(1, "too big for our purposes"); - } + if (sb.st_size > UINT32_MAX) { + errx(1, "too big for our purposes"); + } - buffer = malloc((size_t)sb.st_size); - if (buffer == NULL) { - errx(1, "Could not allocate buffer"); - } + buffer = malloc((size_t)sb.st_size); + if (buffer == NULL) { + errx(1, "Could not allocate buffer"); + } - if (read(fd, buffer, (size_t)sb.st_size) != sb.st_size) { - errx(1, "Could not read %s: %s", fileName, strerror(errno)); - } + if (read(fd, buffer, (size_t)sb.st_size) != sb.st_size) { + errx(1, "Could not read %s: %s", fileName, strerror(errno)); + } - close(fd); + close(fd); - stream = CFReadStreamCreateWithBytesNoCopy(kCFAllocatorDefault, - (const UInt8 *)buffer, - (CFIndex)sb.st_size, - kCFAllocatorNull); - if (stream == NULL) { - errx(1, "Could not create stream from serialized data"); - } + stream = CFReadStreamCreateWithBytesNoCopy(kCFAllocatorDefault, + (const UInt8 *)buffer, + (CFIndex)sb.st_size, + kCFAllocatorNull); + if (stream == NULL) { + errx(1, "Could not create stream from serialized data"); + } - if (!CFReadStreamOpen(stream)) { - errx(1, "Could not open the stream"); - } + if (!CFReadStreamOpen(stream)) { + errx(1, "Could not open the stream"); + } - plist = CFPropertyListCreateWithStream(kCFAllocatorDefault, - stream, - (CFIndex)sb.st_size, - kCFPropertyListImmutable, - &format, - NULL); + plist = CFPropertyListCreateWithStream(kCFAllocatorDefault, + stream, + (CFIndex)sb.st_size, + kCFPropertyListImmutable, + &format, + NULL); - if (plist == NULL) { - errx(1, "Error parsing XML file"); - } + if (plist == NULL) { + errx(1, "Error parsing XML file"); + } - CFReadStreamClose(stream); + CFReadStreamClose(stream); - CFRelease(stream); + CFRelease(stream); - free(buffer); + free(buffer); - CFDictionaryApplyFunction(plist, &SetOFVariableFromFile, 0); + CFDictionaryApplyFunction(plist, &SetOFVariableFromFile, 0); - CFRelease(plist); + CFRelease(plist); } // SetOrGetOFVariable(str) @@ -447,14 +462,14 @@ static void ParseXMLFile(char *fileName) // static void SetOrGetOFVariable(char *str) { - long set = 0; - long append = 0; - char *name; - char *value; + long set = 0; + long append = 0; + const char *name; + char *value; CFStringRef nameRef = NULL; CFTypeRef valueRef = NULL; CFMutableStringRef appended = NULL; - kern_return_t result; + kern_return_t result; // OF variable name is first. name = str; @@ -521,7 +536,8 @@ static void SetOrGetOFVariable(char *str) #endif { result = SetOFVariable(name, value); - NVRamSyncNow(name); /* Try syncing the new data to device, best effort! */ + /* Try syncing the new data to device, best effort! */ + NVRamSyncNow(); } if (result != KERN_SUCCESS) { errx(1, "Error setting variable - '%s': %s", name, @@ -530,9 +546,9 @@ static void SetOrGetOFVariable(char *str) } else { PrintOFVariable(nameRef, valueRef, 0); } - if ( nameRef ) CFRelease(nameRef); - if ( valueRef ) CFRelease(valueRef); - if ( appended ) CFRelease(appended); + if (nameRef) CFRelease(nameRef); + if (valueRef) CFRelease(valueRef); + if (appended) CFRelease(appended); } #if TARGET_OS_BRIDGE @@ -586,16 +602,16 @@ static kern_return_t LinkMacNVRAMSymbols() // Get the named firmware variable. // Return it and it's symbol in valueRef and nameRef. // -static kern_return_t GetOFVariable(char *name, CFStringRef *nameRef, - CFTypeRef *valueRef) +static kern_return_t GetOFVariable(const char *name, CFStringRef *nameRef, + CFTypeRef *valueRef) { *nameRef = CFStringCreateWithCString(kCFAllocatorDefault, name, - kCFStringEncodingUTF8); + kCFStringEncodingUTF8); if (*nameRef == 0) { errx(1, "Error creating CFString for key %s", name); } - *valueRef = IORegistryEntryCreateCFProperty(gOptionsRef, *nameRef, 0, 0); + *valueRef = IORegistryEntryCreateCFProperty(gSelectedOptionsRef, *nameRef, 0, 0); if (*valueRef == 0) return kIOReturnNotFound; return KERN_SUCCESS; @@ -619,59 +635,59 @@ static kern_return_t GetMacOFVariable(char *name, char **value) // // Set or create an firmware variable with name and value. // -static kern_return_t SetOFVariable(char *name, char *value) +static kern_return_t SetOFVariable(const char *name, const char *value) { CFStringRef nameRef; CFTypeRef valueRef; CFTypeID typeID; kern_return_t result = KERN_SUCCESS; - nameRef = CFStringCreateWithCString(kCFAllocatorDefault, name, - kCFStringEncodingUTF8); - if (nameRef == 0) { - errx(1, "Error creating CFString for key %s", name); - } + nameRef = CFStringCreateWithCString(kCFAllocatorDefault, name, + kCFStringEncodingUTF8); + if (nameRef == 0) { + errx(1, "Error creating CFString for key %s", name); + } - valueRef = IORegistryEntryCreateCFProperty(gOptionsRef, nameRef, 0, 0); - if (valueRef) { - typeID = CFGetTypeID(valueRef); - CFRelease(valueRef); - - valueRef = ConvertValueToCFTypeRef(typeID, value); - if (valueRef == 0) { - errx(1, "Error creating CFTypeRef for value %s", value); - } result = IORegistryEntrySetCFProperty(gOptionsRef, nameRef, valueRef); - } else { - while (1) { - // In the default case, try data, string, number, then boolean. - - valueRef = ConvertValueToCFTypeRef(CFDataGetTypeID(), value); - if (valueRef != 0) { - result = IORegistryEntrySetCFProperty(gOptionsRef, nameRef, valueRef); - if (result == KERN_SUCCESS) break; - } + valueRef = IORegistryEntryCreateCFProperty(gSelectedOptionsRef, nameRef, 0, 0); + if (valueRef) { + typeID = CFGetTypeID(valueRef); + CFRelease(valueRef); - valueRef = ConvertValueToCFTypeRef(CFStringGetTypeID(), value); - if (valueRef != 0) { - result = IORegistryEntrySetCFProperty(gOptionsRef, nameRef, valueRef); - if (result == KERN_SUCCESS) break; - } + valueRef = ConvertValueToCFTypeRef(typeID, value); + if (valueRef == 0) { + errx(1, "Error creating CFTypeRef for value %s", value); + } result = IORegistryEntrySetCFProperty(gSelectedOptionsRef, nameRef, valueRef); + } else { + while (1) { + // In the default case, try data, string, number, then boolean. - valueRef = ConvertValueToCFTypeRef(CFNumberGetTypeID(), value); - if (valueRef != 0) { - result = IORegistryEntrySetCFProperty(gOptionsRef, nameRef, valueRef); - if (result == KERN_SUCCESS) break; - } + valueRef = ConvertValueToCFTypeRef(CFDataGetTypeID(), value); + if (valueRef != 0) { + result = IORegistryEntrySetCFProperty(gSelectedOptionsRef, nameRef, valueRef); + if (result == KERN_SUCCESS) break; + } - valueRef = ConvertValueToCFTypeRef(CFBooleanGetTypeID(), value); - if (valueRef != 0) { - result = IORegistryEntrySetCFProperty(gOptionsRef, nameRef, valueRef); - if (result == KERN_SUCCESS) break; - } + valueRef = ConvertValueToCFTypeRef(CFStringGetTypeID(), value); + if (valueRef != 0) { + result = IORegistryEntrySetCFProperty(gSelectedOptionsRef, nameRef, valueRef); + if (result == KERN_SUCCESS) break; + } - break; - } - } + valueRef = ConvertValueToCFTypeRef(CFNumberGetTypeID(), value); + if (valueRef != 0) { + result = IORegistryEntrySetCFProperty(gSelectedOptionsRef, nameRef, valueRef); + if (result == KERN_SUCCESS) break; + } + + valueRef = ConvertValueToCFTypeRef(CFBooleanGetTypeID(), value); + if (valueRef != 0) { + result = IORegistryEntrySetCFProperty(gSelectedOptionsRef, nameRef, valueRef); + if (result == KERN_SUCCESS) break; + } + + break; + } + } CFRelease(nameRef); @@ -689,8 +705,7 @@ static kern_return_t SetMacOFVariable(char *name, char *value) // // Delete the named firmware variable. // -// -static void DeleteOFVariable(char *name) +static void DeleteOFVariable(const char *name) { SetOFVariable(kIONVRAMDeletePropertyKey, name); } @@ -698,16 +713,16 @@ static void DeleteOFVariable(char *name) #if TARGET_OS_BRIDGE static kern_return_t DeleteMacOFVariable(char *name) { - return deleteNVRAMVariable_fptr(gNvramInterface, name); + return deleteNVRAMVariable_fptr(gNvramInterface, name); } #endif -static void NVRamSyncNow(char *name) +static void NVRamSyncNow(void) { if (!gUseForceSync) { - SetOFVariable(kIONVRAMSyncNowPropertyKey, name); + SetOFVariable(kIONVRAMSyncNowPropertyKey, kIONVRAMSyncNowPropertyKey); } else { - SetOFVariable(kIONVRAMForceSyncNowPropertyKey, name); + SetOFVariable(kIONVRAMForceSyncNowPropertyKey, kIONVRAMForceSyncNowPropertyKey); } } @@ -720,7 +735,7 @@ static void PrintOFVariables(void) kern_return_t result; CFMutableDictionaryRef dict; - result = IORegistryEntryCreateCFProperties(gOptionsRef, &dict, 0, 0); + result = IORegistryEntryCreateCFProperties(gSelectedOptionsRef, &dict, 0, 0); if (result != KERN_SUCCESS) { errx(1, "Error getting the firmware variables: %s", mach_error_string(result)); } @@ -764,7 +779,7 @@ static void PrintOFVariable(const void *key, const void *value, void *context) char *valueBuffer = 0; const char *valueString = 0; uint32_t number; - long length; + long length; CFTypeID typeID; if (gUseXML) { @@ -826,18 +841,18 @@ static void PrintOFVariable(const void *key, const void *value, void *context) else { dataBuffer = malloc(length * 3 + 1); if (dataBuffer != 0) { - dataPtr = CFDataGetBytePtr(value); - for (cnt = cnt2 = 0; cnt < length; cnt++) { - dataChar = dataPtr[cnt]; - if (isprint(dataChar) && dataChar != '%') { - dataBuffer[cnt2++] = dataChar; - } else { - sprintf(dataBuffer + cnt2, "%%%02x", dataChar); - cnt2 += 3; - } - } - dataBuffer[cnt2] = '\0'; - valueString = dataBuffer; + dataPtr = CFDataGetBytePtr(value); + for (cnt = cnt2 = 0; cnt < length; cnt++) { + dataChar = dataPtr[cnt]; + if (isprint(dataChar) && dataChar != '%') { + dataBuffer[cnt2++] = dataChar; + } else { + sprintf(dataBuffer + cnt2, "%%%02x", dataChar); + cnt2 += 3; + } + } + dataBuffer[cnt2] = '\0'; + valueString = dataBuffer; } } } else { @@ -861,7 +876,7 @@ static void ClearOFVariables(void) kern_return_t result; CFMutableDictionaryRef dict; - result = IORegistryEntryCreateCFProperties(gOptionsRef, &dict, 0, 0); + result = IORegistryEntryCreateCFProperties(gSelectedOptionsRef, &dict, 0, 0); if (result != KERN_SUCCESS) { errx(1, "Error getting the firmware variables: %s", mach_error_string(result)); } @@ -873,7 +888,7 @@ static void ClearOFVariables(void) static void ClearOFVariable(const void *key, const void *value, void *context) { kern_return_t result; - result = IORegistryEntrySetCFProperty(gOptionsRef, + result = IORegistryEntrySetCFProperty(gSelectedOptionsRef, CFSTR(kIONVRAMDeletePropertyKey), key); if (result != KERN_SUCCESS) { assert(CFGetTypeID(key) == CFStringGetTypeID()); @@ -902,38 +917,40 @@ static void ClearOFVariable(const void *key, const void *value, void *context) // // Convert the value into a CFType given the typeID. // -static CFTypeRef ConvertValueToCFTypeRef(CFTypeID typeID, char *value) +static CFTypeRef ConvertValueToCFTypeRef(CFTypeID typeID, const char *value) { CFTypeRef valueRef = 0; long cnt, cnt2, length; unsigned long number, tmp; if (typeID == CFBooleanGetTypeID()) { - if (!strcmp("true", value)) valueRef = kCFBooleanTrue; - else if (!strcmp("false", value)) valueRef = kCFBooleanFalse; + if (!strcmp("true", value)) valueRef = kCFBooleanTrue; + else if (!strcmp("false", value)) valueRef = kCFBooleanFalse; } else if (typeID == CFNumberGetTypeID()) { - number = strtol(value, 0, 0); - valueRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, - &number); + number = strtol(value, 0, 0); + valueRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, + &number); } else if (typeID == CFStringGetTypeID()) { - valueRef = CFStringCreateWithCString(kCFAllocatorDefault, value, - kCFStringEncodingUTF8); + valueRef = CFStringCreateWithCString(kCFAllocatorDefault, value, + kCFStringEncodingUTF8); } else if (typeID == CFDataGetTypeID()) { - length = strlen(value); - for (cnt = cnt2 = 0; cnt < length; cnt++, cnt2++) { - if (value[cnt] == '%') { - if (!ishexnumber(value[cnt + 1]) || - !ishexnumber(value[cnt + 2])) return 0; - number = toupper(value[++cnt]) - '0'; - if (number > 9) number -= 7; - tmp = toupper(value[++cnt]) - '0'; - if (tmp > 9) tmp -= 7; - number = (number << 4) + tmp; - value[cnt2] = number; - } else value[cnt2] = value[cnt]; - } - valueRef = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, (const UInt8 *)value, - cnt2, kCFAllocatorDefault); + length = strlen(value); + char valueCopy[length + 1]; + + for (cnt = cnt2 = 0; cnt < length; cnt++, cnt2++) { + if (value[cnt] == '%') { + if ((cnt + 2 > length) || + !ishexnumber(value[cnt + 1]) || + !ishexnumber(value[cnt + 2])) return 0; + number = toupper(value[++cnt]) - '0'; + if (number > 9) number -= 7; + tmp = toupper(value[++cnt]) - '0'; + if (tmp > 9) tmp -= 7; + number = (number << 4) + tmp; + valueCopy[cnt2] = number; + } else valueCopy[cnt2] = value[cnt]; + } + valueRef = CFDataCreate(kCFAllocatorDefault, (const UInt8 *)valueCopy, cnt2); } else return 0; return valueRef; @@ -943,23 +960,23 @@ static void SetOFVariableFromFile(const void *key, const void *value, void *cont { kern_return_t result; - result = IORegistryEntrySetCFProperty(gOptionsRef, key, value); + result = IORegistryEntrySetCFProperty(gSelectedOptionsRef, key, value); if ( result != KERN_SUCCESS ) { - long nameLen; - char *nameBuffer; - char *nameString; - - // Get the variable's name. - nameLen = CFStringGetMaximumSizeForEncoding(CFStringGetLength(key), - kCFStringEncodingUTF8) + 1; - nameBuffer = malloc(nameLen); - if( nameBuffer && CFStringGetCString(key, nameBuffer, nameLen, kCFStringEncodingUTF8) ) - nameString = nameBuffer; - else { - warnx("Unable to convert property name to C string"); - nameString = ""; - } - errx(1, "Error setting variable - '%s': %s", nameString, - mach_error_string(result)); + long nameLen; + char *nameBuffer; + char *nameString; + + // Get the variable's name. + nameLen = CFStringGetMaximumSizeForEncoding(CFStringGetLength(key), + kCFStringEncodingUTF8) + 1; + nameBuffer = malloc(nameLen); + if( nameBuffer && CFStringGetCString(key, nameBuffer, nameLen, kCFStringEncodingUTF8) ) + nameString = nameBuffer; + else { + warnx("Unable to convert property name to C string"); + nameString = ""; + } + errx(1, "Error setting variable - '%s': %s", nameString, + mach_error_string(result)); } } diff --git a/system_cmds/system_cmds.xcodeproj/project.pbxproj b/system_cmds/system_cmds.xcodeproj/project.pbxproj index ba1a85a..1236f49 100644 --- a/system_cmds/system_cmds.xcodeproj/project.pbxproj +++ b/system_cmds/system_cmds.xcodeproj/project.pbxproj @@ -2428,6 +2428,7 @@ 97999D301AE84C7600E8B10F /* lskq.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; name = lskq.1; path = lskq.tproj/lskq.1; sourceTree = ""; }; 97999D311AE84C7600E8B10F /* lskq.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = lskq.c; path = lskq.tproj/lskq.c; sourceTree = ""; }; A7C0927020EC491E0068148E /* passwd.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = passwd.entitlements; sourceTree = ""; }; + AD5BBC612551B27F007F6508 /* entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = entitlements.plist; sourceTree = ""; }; ADA9007717679A8C00161ADF /* purge */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = purge; sourceTree = BUILT_PRODUCTS_DIR; }; ADA900791767A02700161ADF /* purge.8 */ = {isa = PBXFileReference; lastKnownFileType = text; path = purge.8; sourceTree = ""; }; ADA9007A1767A02700161ADF /* purge.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = purge.c; sourceTree = ""; }; @@ -3604,6 +3605,7 @@ BA4FD2791372FAFA0025925C /* nvram.tproj */ = { isa = PBXGroup; children = ( + AD5BBC612551B27F007F6508 /* entitlements.plist */, BA4FD27B1372FAFA0025925C /* nvram.8 */, BA4FD27C1372FAFA0025925C /* nvram.c */, ); @@ -7377,6 +7379,7 @@ 1873300218CBD4A700275344 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = nvram.tproj/entitlements.plist; HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/local/include"; INSTALL_PATH = /usr/sbin; PRODUCT_NAME = nvram; @@ -8331,6 +8334,7 @@ BAE589A4137836A00049DD3B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = nvram.tproj/entitlements.plist; HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/local/include"; INSTALL_PATH = /usr/sbin; PRODUCT_NAME = nvram; diff --git a/system_cmds/taskpolicy.tproj/taskpolicy-entitlements.plist b/system_cmds/taskpolicy.tproj/taskpolicy-entitlements.plist index 39c14ef..f0bf565 100644 --- a/system_cmds/taskpolicy.tproj/taskpolicy-entitlements.plist +++ b/system_cmds/taskpolicy.tproj/taskpolicy-entitlements.plist @@ -2,7 +2,7 @@ - com.apple.security.cs.debugger.root + com.apple.private.task_policy diff --git a/system_cmds/taskpolicy.tproj/taskpolicy.c b/system_cmds/taskpolicy.tproj/taskpolicy.c index 3260bb6..5bc9684 100644 --- a/system_cmds/taskpolicy.tproj/taskpolicy.c +++ b/system_cmds/taskpolicy.tproj/taskpolicy.c @@ -22,6 +22,7 @@ * @APPLE_LICENSE_HEADER_END@ */ +#include #include #include #include @@ -196,9 +197,9 @@ int main(int argc, char * argv[]) qosinfo.task_throughput_qos_tier != THROUGHPUT_QOS_TIER_UNSPECIFIED){ mach_port_t task; if (pid) { - ret = task_for_pid(mach_task_self(), pid, &task); + ret = task_name_for_pid(mach_task_self(), pid, &task); if (ret != KERN_SUCCESS) { - err(EX_SOFTWARE, "task_for_pid(%d) failed", pid); + err(EX_SOFTWARE, "task_name_for_pid(%d) failed", pid); return EX_OSERR; } } else { diff --git a/system_cmds/vm_purgeable_stat.tproj/entitlements.plist b/system_cmds/vm_purgeable_stat.tproj/entitlements.plist index b21dbd8..2ee8d1e 100644 --- a/system_cmds/vm_purgeable_stat.tproj/entitlements.plist +++ b/system_cmds/vm_purgeable_stat.tproj/entitlements.plist @@ -2,7 +2,7 @@ - task_for_pid-allow + com.apple.system-task-ports.inspect diff --git a/system_cmds/vm_purgeable_stat.tproj/vm_purgeable_stat.c b/system_cmds/vm_purgeable_stat.tproj/vm_purgeable_stat.c index bfef539..330704d 100644 --- a/system_cmds/vm_purgeable_stat.tproj/vm_purgeable_stat.c +++ b/system_cmds/vm_purgeable_stat.tproj/vm_purgeable_stat.c @@ -22,6 +22,7 @@ * @APPLE_LICENSE_HEADER_END@ */ +#include #include #include #include @@ -87,7 +88,7 @@ int get_task_from_pid(int pid, task_t *task) fprintf(stderr, "%s\n", PRIV_ERR_MSG); return -1; } - kr = task_for_pid(mach_task_self(), pid, task); + kr = task_inspect_for_pid(mach_task_self(), pid, task); if (kr != KERN_SUCCESS) { fprintf(stderr, "Failed to get task port for pid: %d\n", pid); return -1; @@ -127,9 +128,9 @@ int get_system_tasks(task_array_t *tasks, mach_msg_type_number_t *count) vm_deallocate(mach_task_self(), (vm_address_t)psets, (vm_size_t)psetCount * sizeof(mach_port_t)); /* convert the processor-set-priv to a list of tasks for the processor set */ - ret = processor_set_tasks(pset_priv, tasks, count); + ret = processor_set_tasks_with_flavor(pset_priv, TASK_FLAVOR_INSPECT, tasks, count); if (ret != KERN_SUCCESS) { - fprintf(stderr, "processor_set_tasks() failed: %s\n", mach_error_string(ret)); + fprintf(stderr, "processor_set_tasks_with_flavor() failed: %s\n", mach_error_string(ret)); return -1; } mach_port_deallocate(mach_task_self(), pset_priv); diff --git a/system_cmds/zprint.tproj/zprint.c b/system_cmds/zprint.tproj/zprint.c index 5c90f2d..97f31e4 100644 --- a/system_cmds/zprint.tproj/zprint.c +++ b/system_cmds/zprint.tproj/zprint.c @@ -670,7 +670,9 @@ kern_vm_tag_name(uint64_t tag) case (VM_KERN_MEMORY_REASON): name = "VM_KERN_MEMORY_REASON"; break; case (VM_KERN_MEMORY_SKYWALK): name = "VM_KERN_MEMORY_SKYWALK"; break; case (VM_KERN_MEMORY_LTABLE): name = "VM_KERN_MEMORY_LTABLE"; break; + case (VM_KERN_MEMORY_HV): name = "VM_KERN_MEMORY_HV"; break; case (VM_KERN_MEMORY_ANY): name = "VM_KERN_MEMORY_ANY"; break; + case (VM_KERN_MEMORY_RETIRED): name = "VM_KERN_MEMORY_RETIRED"; break; default: name = NULL; break; } if (name) { -- cgit v1.2.3-56-ge451 From 985f8904c132bc258df18a82941d93d4470c6b5e Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 20 May 2021 16:23:47 -0400 Subject: bootstrap_cmds: Update to 121.100.1 --- bootstrap_cmds/.apple_version | 2 +- bootstrap_cmds/migcom.tproj/server.c | 8 ++++-- bootstrap_cmds/migcom.tproj/user.c | 54 ++++++++---------------------------- 3 files changed, 18 insertions(+), 46 deletions(-) diff --git a/bootstrap_cmds/.apple_version b/bootstrap_cmds/.apple_version index ca285c2..8e50c91 100644 --- a/bootstrap_cmds/.apple_version +++ b/bootstrap_cmds/.apple_version @@ -1 +1 @@ -116.100.1 +121.100.1 diff --git a/bootstrap_cmds/migcom.tproj/server.c b/bootstrap_cmds/migcom.tproj/server.c index 7bbed53..5b22b46 100644 --- a/bootstrap_cmds/migcom.tproj/server.c +++ b/bootstrap_cmds/migcom.tproj/server.c @@ -921,6 +921,8 @@ static void WriteCheckMsgSize(FILE *file, argument_t *arg) { routine_t *rt = arg->argRoutine; + ipc_type_t *it = arg->argType; + ipc_type_t *btype = it->itElement; if (arg->argCount && !arg->argSameCount) WriteRequestNDRConvertIntRepOneArgUse(file, arg->argCount); @@ -928,7 +930,8 @@ WriteCheckMsgSize(FILE *file, argument_t *arg) fprintf(file, "#if\t__MigTypeCheck\n"); /* verify that the user-code-provided count does not exceed the maximum count allowed by the type. */ - fprintf(file, "\t" "if ( In%dP->%s > %d )\n", arg->argCount->argRequestPos, arg->argCount->argMsgField, arg->argType->itNumber); + fprintf(file, "\t" "if ( In%dP->%s > %d )\n", arg->argCount->argRequestPos, + arg->argCount->argMsgField, it->itNumber/btype->itNumber); fputs("\t\t" "return MIG_BAD_ARGUMENTS;\n", file); /* ...end... */ @@ -955,7 +958,8 @@ WriteCheckMsgSize(FILE *file, argument_t *arg) fprintf(file, "#if\t__MigTypeCheck\n"); /* verify that the user-code-provided count does not exceed the maximum count allowed by the type. */ - fprintf(file, "\t" "if ( In%dP->%s > %d )\n", arg->argCount->argRequestPos, arg->argCount->argMsgField, arg->argType->itNumber); + fprintf(file, "\t" "if ( In%dP->%s > %d )\n", arg->argCount->argRequestPos, + arg->argCount->argMsgField, it->itNumber/btype->itNumber); fputs("\t\t" "return MIG_BAD_ARGUMENTS;\n", file); /* ...end... */ diff --git a/bootstrap_cmds/migcom.tproj/user.c b/bootstrap_cmds/migcom.tproj/user.c index 839732d..6e9d27c 100644 --- a/bootstrap_cmds/migcom.tproj/user.c +++ b/bootstrap_cmds/migcom.tproj/user.c @@ -55,14 +55,6 @@ #include "utils.h" #include "global.h" -#ifndef DISABLE_SPECIAL_REPLY_PORT_IN_CHROOT -#define DISABLE_SPECIAL_REPLY_PORT_IN_CHROOT 1 -#endif - -#ifndef DISABLE_SPECIAL_REPLY_PORT_IN_SIMULATOR -#define DISABLE_SPECIAL_REPLY_PORT_IN_SIMULATOR 1 -#endif - #ifndef USE_IMMEDIATE_SEND_TIMEOUT #define USE_IMMEDIATE_SEND_TIMEOUT 0 #endif @@ -196,29 +188,9 @@ WriteMyIncludes(FILE *file, statement_t *stats) fprintf(file, "\n"); fprintf(file, "#include \n"); fprintf(file, "#include \n"); -#if DISABLE_SPECIAL_REPLY_PORT_IN_SIMULATOR - fprintf(file, "#ifndef __MigCanUseSpecialReplyPort\n"); - fprintf(file, "#if TARGET_OS_SIMULATOR\n"); - fprintf(file, "#define __MigCanUseSpecialReplyPort 0\n"); - fprintf(file, "#define mig_get_special_reply_port() MACH_PORT_DEAD\n"); - fprintf(file, "#define mig_dealloc_special_reply_port(port) __builtin_trap()\n"); - fprintf(file, "#endif\n"); - fprintf(file, "#endif /* __MigCanUseSpecialReplyPort */\n"); -#endif -#if DISABLE_SPECIAL_REPLY_PORT_IN_CHROOT - fprintf(file, "#ifndef __MigCanUseSpecialReplyPort\n"); - fprintf(file, "#if TARGET_OS_OSX\n"); - fprintf(file, "extern _Bool _os_xbs_chrooted;\n"); - fprintf(file, "#define __MigCanUseSpecialReplyPort (!_os_xbs_chrooted)\n"); - fprintf(file, "#endif\n"); - fprintf(file, "#endif /* __MigCanUseSpecialReplyPort */\n"); -#endif - fprintf(file, "#ifndef __MigCanUseSpecialReplyPort\n"); - fprintf(file, "#define __MigCanUseSpecialReplyPort 1\n"); - fprintf(file, "#endif /* __MigCanUseSpecialReplyPort */\n"); fprintf(file, "#ifndef __MigSpecialReplyPortMsgOption\n"); - fprintf(file, "#define __MigSpecialReplyPortMsgOption (__MigCanUseSpecialReplyPort ? " - "(MACH_SEND_SYNC_OVERRIDE|MACH_SEND_SYNC_USE_THRPRI|MACH_RCV_SYNC_WAIT) : MACH_MSG_OPTION_NONE)\n"); + fprintf(file, "#define __MigSpecialReplyPortMsgOption " + "(MACH_SEND_SYNC_OVERRIDE|MACH_SEND_SYNC_USE_THRPRI|MACH_RCV_SYNC_WAIT)\n"); fprintf(file, "#endif /* __MigSpecialReplyPortMsgOption */\n"); } /* @@ -256,11 +228,7 @@ WriteOneMachErrorDefine(FILE *file, char *name, boolean_t timeout, boolean_t Spe fprintf(file, "\tcase MACH_SEND_INVALID_DATA: \\\n"); fprintf(file, "\tcase MACH_SEND_INVALID_DEST: \\\n"); fprintf(file, "\tcase MACH_SEND_INVALID_HEADER: \\\n"); - if (SpecialReplyPort) { - fprintf(file, "\t\tif (!__MigCanUseSpecialReplyPort) { \\\n"); - fprintf(file, "\t\t\tmig_put_reply_port(InP->Head.msgh_reply_port); \\\n"); - fprintf(file, "\t\t} \\\n"); - } else { + if (!SpecialReplyPort) { fprintf(file, "\t\tmig_put_reply_port(InP->Head.msgh_reply_port); \\\n"); } fprintf(file, "\t\tbreak; \\\n"); @@ -270,11 +238,7 @@ WriteOneMachErrorDefine(FILE *file, char *name, boolean_t timeout, boolean_t Spe } fprintf(file, "\tdefault: \\\n"); if (SpecialReplyPort) { - fprintf(file, "\t\tif (__MigCanUseSpecialReplyPort) { \\\n"); - fprintf(file, "\t\t\tmig_dealloc_special_reply_port(InP->Head.msgh_reply_port); \\\n"); - fprintf(file, "\t\t} else { \\\n"); - fprintf(file, "\t\t\tmig_dealloc_reply_port(InP->Head.msgh_reply_port); \\\n"); - fprintf(file, "\t\t} \\\n"); + fprintf(file, "\t\tmig_dealloc_special_reply_port(InP->Head.msgh_reply_port); \\\n"); } else { fprintf(file, "\t\tmig_dealloc_reply_port(InP->Head.msgh_reply_port); \\\n"); } @@ -392,7 +356,7 @@ WriteRequestHead(FILE *file, routine_t *rt) else if (rt->rtOneWay) fprintf(file, "\tInP->%s = MACH_PORT_NULL;\n", rt->rtReplyPort->argMsgField); else if (rt->rtUseSpecialReplyPort) - fprintf(file, "\tInP->%s = __MigCanUseSpecialReplyPort ? mig_get_special_reply_port() : mig_get_reply_port();\n", rt->rtReplyPort->argMsgField); + fprintf(file, "\tInP->%s = mig_get_special_reply_port();\n", rt->rtReplyPort->argMsgField); else fprintf(file, "\tInP->%s = mig_get_reply_port();\n", rt->rtReplyPort->argMsgField); @@ -1967,6 +1931,8 @@ static void WriteCheckMsgSize(FILE *file, argument_t *arg) { routine_t *rt = arg->argRoutine; + ipc_type_t *it = arg->argType; + ipc_type_t *btype = it->itElement; /* If there aren't any more Out args after this, then we can use the msgh_size_delta value directly in @@ -1981,7 +1947,8 @@ WriteCheckMsgSize(FILE *file, argument_t *arg) /* * emit code to verify that the server-code-provided count does not exceed the maximum count allowed by the type. */ - fprintf(file, "\t" "if ( Out%dP->%s > %d )\n", arg->argCount->argReplyPos, arg->argCount->argMsgField, arg->argType->itNumber); + fprintf(file, "\t" "if ( Out%dP->%s > %d )\n", arg->argCount->argReplyPos, + arg->argCount->argMsgField, it->itNumber/btype->itNumber); fputs("\t\t" "return MIG_TYPE_ERROR;\n", file); /* ...end... */ @@ -2010,7 +1977,8 @@ WriteCheckMsgSize(FILE *file, argument_t *arg) /* * emit code to verify that the server-code-provided count does not exceed the maximum count allowed by the type. */ - fprintf(file, "\t" "if ( Out%dP->%s > %d )\n", arg->argCount->argReplyPos, arg->argCount->argMsgField, arg->argType->itNumber); + fprintf(file, "\t" "if ( Out%dP->%s > %d )\n", arg->argCount->argReplyPos, + arg->argCount->argMsgField, it->itNumber/btype->itNumber); fputs("\t\t" "return MIG_TYPE_ERROR;\n", file); /* ...end... */ -- cgit v1.2.3-56-ge451 From b0cb46e01441d9301304213176bca5172b816a82 Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 20 May 2021 16:23:48 -0400 Subject: diskdev_cmds: Update to 667.100.2 --- diskdev_cmds/.apple_version | 2 +- diskdev_cmds/mount.tproj/mount.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/diskdev_cmds/.apple_version b/diskdev_cmds/.apple_version index fdc6407..fddf545 100644 --- a/diskdev_cmds/.apple_version +++ b/diskdev_cmds/.apple_version @@ -1 +1 @@ -667.40.1 +667.100.2 diff --git a/diskdev_cmds/mount.tproj/mount.c b/diskdev_cmds/mount.tproj/mount.c index ace7cbe..b5905a6 100644 --- a/diskdev_cmds/mount.tproj/mount.c +++ b/diskdev_cmds/mount.tproj/mount.c @@ -243,10 +243,7 @@ setup_preboot_mounts(int pass) const bind_mount_t preboot_mnts[] = { {.bm_mnt_prefix = PREBOOT_VOL_MOUNTPOINT, .bm_mnt_to = "/usr/standalone/firmware", - .bm_mandatory = true}, - {.bm_mnt_prefix = PREBOOT_VOL_MOUNTPOINT, - .bm_mnt_to = "/usr/local/standalone/firmware", - .bm_mandatory = false} + .bm_mandatory = true} }; const bind_mount_t hw_mnts[] = { @@ -463,7 +460,7 @@ main(argc, argv) continue; if (hasopt(fs->fs_mntops, "noauto")) continue; - if (!strcmp(fs->fs_vfstype, "nfs")) { + if (!strcmp(fs->fs_vfstype, "nfs") || !strcmp(fs->fs_vfstype, "url")) { if (hasopt(fs->fs_mntops, "net")) continue; /* check if already mounted */ -- cgit v1.2.3-56-ge451 From 6b8f9d46455ced6257444b094a6c040b90a3b48c Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 20 May 2021 16:23:48 -0400 Subject: doc_cmds: Update to 53.100.1 --- doc_cmds/.apple_version | 2 +- doc_cmds/doc_cmds.plist | 122 +++++++++++++++++++++--------------------------- doc_cmds/doc_cmds.txt | 35 -------------- 3 files changed, 55 insertions(+), 104 deletions(-) diff --git a/doc_cmds/.apple_version b/doc_cmds/.apple_version index 39a27b5..1d966dd 100644 --- a/doc_cmds/.apple_version +++ b/doc_cmds/.apple_version @@ -1 +1 @@ -53.60.1 +53.100.1 diff --git a/doc_cmds/doc_cmds.plist b/doc_cmds/doc_cmds.plist index a9ea197..ccb9f91 100644 --- a/doc_cmds/doc_cmds.plist +++ b/doc_cmds/doc_cmds.plist @@ -1,72 +1,58 @@ + + - - OpenSourceProject - checknr - OpenSourceVersion - 2004-09-18 - OpenSourceWebsiteURL - http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/checknr/ - OpenSourceCVS - cvs -d freebsdanoncvs@anoncvs.FreeBSD.org:/home/ncvs co checknr - OpenSourceImportDate - 2004-09-18 - OpenSourceLicense - BSD - OpenSourceLicenseFile - doc_cmds.txt - - - OpenSourceProject - colcrt - OpenSourceVersion - 2004-09-18 - OpenSourceWebsiteURL - http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/colcrt/ - OpenSourceCVS - cvs -d freebsdanoncvs@anoncvs.FreeBSD.org:/home/ncvs co colcrt - OpenSourceImportDate - 2004-09-18 - OpenSourceLicense - BSD - OpenSourceLicenseFile - doc_cmds.txt - - - OpenSourceProject - getNAME - OpenSourceVersion - 2004-09-18 - OpenSourceWebsiteURL - http://www.freebsd.org/cgi/cvsweb.cgi/src/libexec/getNAME/ - OpenSourceCVS - cvs -d freebsdanoncvs@anoncvs.FreeBSD.org:/home/ncvs co getNAME - OpenSourceImportDate - 2004-09-18 - OpenSourceLicense - BSD - OpenSourceLicenseFile - doc_cmds.txt - - - OpenSourceProject - makewhatis - OpenSourceVersion - 2004-09-18 - OpenSourceWebsiteURL - http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/makewhatis/ - OpenSourceCVS - cvs -d freebsdanoncvs@anoncvs.FreeBSD.org:/home/ncvs co makewhatis - OpenSourceImportDate - 2004-09-18 - OpenSourceModifications - - 3806865 - - OpenSourceLicense - BSD - OpenSourceLicenseFile - doc_cmds.txt - + + OpenSourceProject + checknr + OpenSourceVersion + 2004-09-18 + OpenSourceWebsiteURL + http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/checknr/ + OpenSourceCVS + cvs -d freebsdanoncvs@anoncvs.FreeBSD.org:/home/ncvs co checknr + OpenSourceImportDate + 2004-09-18 + OpenSourceLicense + BSD + OpenSourceLicenseFile + doc_cmds.txt + + + OpenSourceProject + colcrt + OpenSourceVersion + 2004-09-18 + OpenSourceWebsiteURL + http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/colcrt/ + OpenSourceCVS + cvs -d freebsdanoncvs@anoncvs.FreeBSD.org:/home/ncvs co colcrt + OpenSourceImportDate + 2004-09-18 + OpenSourceLicense + BSD + OpenSourceLicenseFile + doc_cmds.txt + + + OpenSourceProject + makewhatis + OpenSourceVersion + 2004-09-18 + OpenSourceWebsiteURL + http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/makewhatis/ + OpenSourceCVS + cvs -d freebsdanoncvs@anoncvs.FreeBSD.org:/home/ncvs co makewhatis + OpenSourceImportDate + 2004-09-18 + OpenSourceModifications + + 3806865 + + OpenSourceLicense + BSD + OpenSourceLicenseFile + doc_cmds.txt + diff --git a/doc_cmds/doc_cmds.txt b/doc_cmds/doc_cmds.txt index 873a785..d70cd40 100644 --- a/doc_cmds/doc_cmds.txt +++ b/doc_cmds/doc_cmds.txt @@ -68,41 +68,6 @@ colcrt: * SUCH DAMAGE. */ -getNAME: - -/*- - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - makewhatis: /*- -- cgit v1.2.3-56-ge451 From 8d788054a62508f8d1b93067be16fb73f987ca8e Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 20 May 2021 16:23:48 -0400 Subject: network_cmds: Update to 606.100.3 --- network_cmds/.apple_version | 2 +- network_cmds/netstat.tproj/ipsec.c | 8 ++++++- network_cmds/netstat.tproj/netstat.1 | 1 + network_cmds/netstat.tproj/route.c | 3 +++ .../network_cmds.xcodeproj/project.pbxproj | 26 +++++++++++++--------- network_cmds/route.tproj/route.c | 2 +- 6 files changed, 28 insertions(+), 14 deletions(-) diff --git a/network_cmds/.apple_version b/network_cmds/.apple_version index 25cc648..b2c184d 100644 --- a/network_cmds/.apple_version +++ b/network_cmds/.apple_version @@ -1 +1 @@ -606.40.1 +606.100.3 diff --git a/network_cmds/netstat.tproj/ipsec.c b/network_cmds/netstat.tproj/ipsec.c index 0eab162..393f053 100644 --- a/network_cmds/netstat.tproj/ipsec.c +++ b/network_cmds/netstat.tproj/ipsec.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2012 Apple Inc. All rights reserved. + * Copyright (c) 2008-2012, 2021 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -159,6 +159,12 @@ static struct val2str ipsec_espnames[] = { { SADB_X_EALG_BLOWFISHCBC, "blowfish-cbc", }, #ifdef SADB_X_EALG_RIJNDAELCBC { SADB_X_EALG_RIJNDAELCBC, "rijndael-cbc", }, +#endif +#ifdef SADB_X_EALG_AES_GCM + { SADB_X_EALG_AES_GCM, "aes-gcm", }, +#endif +#ifdef SADB_X_EALG_CHACHA20POLY1305 + { SADB_X_EALG_CHACHA20POLY1305, "chacha20-poly1305", }, #endif { -1, NULL }, }; diff --git a/network_cmds/netstat.tproj/netstat.1 b/network_cmds/netstat.tproj/netstat.1 index 61ab843..5e2abee 100644 --- a/network_cmds/netstat.tproj/netstat.1 +++ b/network_cmds/netstat.tproj/netstat.1 @@ -395,6 +395,7 @@ U RTF_UP Route usable W RTF_WASCLONED Route was generated as a result of cloning X RTF_XRESOLVE External daemon translates proto to link address Y RTF_PROXY Proxying; cloned routes will not be scoped +g RTF_GLOBAL Route to a destination of the global internet (policy hint) .El .Pp Direct routes are created for each interface attached to the local host; diff --git a/network_cmds/netstat.tproj/route.c b/network_cmds/netstat.tproj/route.c index 943e3c8..31e2bea 100644 --- a/network_cmds/netstat.tproj/route.c +++ b/network_cmds/netstat.tproj/route.c @@ -120,6 +120,9 @@ struct bits { { RTF_IFREF, 'i' }, { RTF_PROXY, 'Y' }, { RTF_ROUTER, 'r' }, +#ifdef RTF_GLOBAL + { RTF_GLOBAL, 'g' }, +#endif /* RTF_GLOBAL */ { 0 } }; diff --git a/network_cmds/network_cmds.xcodeproj/project.pbxproj b/network_cmds/network_cmds.xcodeproj/project.pbxproj index cce64f8..3c5a36d 100755 --- a/network_cmds/network_cmds.xcodeproj/project.pbxproj +++ b/network_cmds/network_cmds.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 52; objects = { /* Begin PBXAggregateTarget section */ @@ -240,7 +240,8 @@ "$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).h", "$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE)_xdr.c", ); - script = "/usr/bin/rpcgen -h -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.h ${INPUT_FILE_PATH}\n/usr/bin/rpcgen -c -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}_xdr.c ${INPUT_FILE_PATH}"; + runOncePerArchitecture = 0; + script = "/usr/bin/rpcgen -h -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.h ${INPUT_FILE_PATH}\n/usr/bin/rpcgen -c -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}_xdr.c ${INPUT_FILE_PATH}\n"; }; /* End PBXBuildRule section */ @@ -3097,6 +3098,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -3134,7 +3136,7 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = network_cmds; - SDKROOT = iphoneos; + SDKROOT = iphoneos.internal; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -4141,6 +4143,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPRESSION = lossless; + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; ENABLE_TESTABILITY = YES; @@ -4167,6 +4170,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPRESSION = "respect-asset-catalog"; + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -4247,7 +4251,7 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = network_cmds; - SDKROOT = iphoneos; + SDKROOT = iphoneos.internal; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -4257,7 +4261,7 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = network_cmds; - SDKROOT = iphoneos; + SDKROOT = iphoneos.internal; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -4633,8 +4637,8 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; PRODUCT_NAME = "All-EmbeddedOther"; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; + SDKROOT = iphoneos.internal; + SUPPORTED_PLATFORMS = "appletvos watchos"; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -4646,8 +4650,8 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_FIX_AND_CONTINUE = NO; PRODUCT_NAME = "All-EmbeddedOther"; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; + SDKROOT = iphoneos.internal; + SUPPORTED_PLATFORMS = "appletvos watchos"; TARGETED_DEVICE_FAMILY = "1,2"; ZERO_LINK = NO; }; @@ -4657,8 +4661,8 @@ isa = XCBuildConfiguration; buildSettings = { PRODUCT_NAME = "All-EmbeddedOther"; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; + SDKROOT = iphoneos.internal; + SUPPORTED_PLATFORMS = "appletvos watchos"; TARGETED_DEVICE_FAMILY = "1,2"; }; name = "Ignore Me"; diff --git a/network_cmds/route.tproj/route.c b/network_cmds/route.tproj/route.c index 9f7f4bd..54fb858 100644 --- a/network_cmds/route.tproj/route.c +++ b/network_cmds/route.tproj/route.c @@ -1266,7 +1266,7 @@ char routeflags[] = "\011CLONING\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE\016b016" "\017PROTO2\020PROTO1\021PRCLONING\022WASCLONED\023PROTO3\024b024" "\025PINNED\026LOCAL\027BROADCAST\030MULTICAST\031IFSCOPE\032CONDEMNED" -"\033IFREF\034PROXY\035ROUTER"; +"\033IFREF\034PROXY\035ROUTER\037GLOBAL"; char ifnetflags[] = "\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6b6\7RUNNING\010NOARP" "\011PPROMISC\012ALLMULTI\013OACTIVE\014SIMPLEX\015LINK0\016LINK1" -- cgit v1.2.3-56-ge451