1*2c2f96dcSApple OSS Distributions #include <errno.h>
2*2c2f96dcSApple OSS Distributions #include <stdlib.h>
3*2c2f96dcSApple OSS Distributions #include <libgen.h>
4*2c2f96dcSApple OSS Distributions #include <limits.h>
5*2c2f96dcSApple OSS Distributions #include <mach-o/dyld.h>
6*2c2f96dcSApple OSS Distributions #include <sys/types.h>
7*2c2f96dcSApple OSS Distributions #include <sys/sysctl.h>
8*2c2f96dcSApple OSS Distributions #include <xlocale.h>
9*2c2f96dcSApple OSS Distributions
10*2c2f96dcSApple OSS Distributions #include <darwintest.h>
11*2c2f96dcSApple OSS Distributions #include <darwintest_utils.h>
12*2c2f96dcSApple OSS Distributions
13*2c2f96dcSApple OSS Distributions #include "drop_priv.h"
14*2c2f96dcSApple OSS Distributions #include "test_utils.h"
15*2c2f96dcSApple OSS Distributions
16*2c2f96dcSApple OSS Distributions #if ENTITLED
17*2c2f96dcSApple OSS Distributions #define SET_TREATMENT_ID set_treatment_id_entitled
18*2c2f96dcSApple OSS Distributions #define SET_TREATMENT_ID_DESCR "Can set treatment id with entitlement"
19*2c2f96dcSApple OSS Distributions #else /* ENTITLED */
20*2c2f96dcSApple OSS Distributions #define SET_TREATMENT_ID set_treatment_id_unentitled
21*2c2f96dcSApple OSS Distributions #define SET_TREATMENT_ID_DESCR "Can't set treatment id without entitlement"
22*2c2f96dcSApple OSS Distributions #endif /* ENTITLED */
23*2c2f96dcSApple OSS Distributions
24*2c2f96dcSApple OSS Distributions T_DECL(SET_TREATMENT_ID, "Verifies that EXPERIMENT sysctls can only be set with the entitlement", T_META_ASROOT(false))
25*2c2f96dcSApple OSS Distributions {
26*2c2f96dcSApple OSS Distributions #define TEST_STR "testing"
27*2c2f96dcSApple OSS Distributions #define IDENTIFIER_LENGTH 36
28*2c2f96dcSApple OSS Distributions
29*2c2f96dcSApple OSS Distributions int ret;
30*2c2f96dcSApple OSS Distributions errno_t err;
31*2c2f96dcSApple OSS Distributions char val[IDENTIFIER_LENGTH + 1] = {0};
32*2c2f96dcSApple OSS Distributions size_t len = sizeof(val);
33*2c2f96dcSApple OSS Distributions char new_val[IDENTIFIER_LENGTH + 1] = {0};
34*2c2f96dcSApple OSS Distributions
35*2c2f96dcSApple OSS Distributions if (!is_development_kernel()) {
36*2c2f96dcSApple OSS Distributions T_SKIP("skipping test on release kernel");
37*2c2f96dcSApple OSS Distributions }
38*2c2f96dcSApple OSS Distributions
39*2c2f96dcSApple OSS Distributions strlcpy(new_val, TEST_STR, sizeof(new_val));
40*2c2f96dcSApple OSS Distributions if (running_as_root()) {
41*2c2f96dcSApple OSS Distributions drop_priv();
42*2c2f96dcSApple OSS Distributions }
43*2c2f96dcSApple OSS Distributions
44*2c2f96dcSApple OSS Distributions ret = sysctlbyname("kern.trial_treatment_id", val, &len, new_val, strlen(new_val));
45*2c2f96dcSApple OSS Distributions err = errno;
46*2c2f96dcSApple OSS Distributions #if ENTITLED
47*2c2f96dcSApple OSS Distributions len = sizeof(val);
48*2c2f96dcSApple OSS Distributions memset(new_val, 0, sizeof(new_val));
49*2c2f96dcSApple OSS Distributions T_ASSERT_POSIX_SUCCESS(ret, "set kern.trial_treatment_id");
50*2c2f96dcSApple OSS Distributions /* Cleanup. Set it back to the empty string. */
51*2c2f96dcSApple OSS Distributions ret = sysctlbyname("kern.trial_treatment_id", val, &len, new_val, 1);
52*2c2f96dcSApple OSS Distributions T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "reset kern.trial_treatment_id");
53*2c2f96dcSApple OSS Distributions #else
54*2c2f96dcSApple OSS Distributions T_ASSERT_POSIX_FAILURE(ret, EPERM, "set kern.trial_treatment_id");
55*2c2f96dcSApple OSS Distributions #endif /* ENTITLED */
56*2c2f96dcSApple OSS Distributions }
57*2c2f96dcSApple OSS Distributions
58*2c2f96dcSApple OSS Distributions #if ENTITLED
59*2c2f96dcSApple OSS Distributions /* Check min and max value limits on numeric factors */
60*2c2f96dcSApple OSS Distributions T_DECL(experiment_factor_numeric_limits,
61*2c2f96dcSApple OSS Distributions "Can only set factors within the legal range.",
62*2c2f96dcSApple OSS Distributions T_META_ASROOT(false))
63*2c2f96dcSApple OSS Distributions {
64*2c2f96dcSApple OSS Distributions #define kMinVal 5 /* The min value allowed for the testing factor. */
65*2c2f96dcSApple OSS Distributions #define kMaxVal 10 /* The max value allowed for the testing factor. */
66*2c2f96dcSApple OSS Distributions errno_t err;
67*2c2f96dcSApple OSS Distributions int ret;
68*2c2f96dcSApple OSS Distributions unsigned int current_val;
69*2c2f96dcSApple OSS Distributions size_t len = sizeof(current_val);
70*2c2f96dcSApple OSS Distributions unsigned int new_val;
71*2c2f96dcSApple OSS Distributions
72*2c2f96dcSApple OSS Distributions if (running_as_root()) {
73*2c2f96dcSApple OSS Distributions drop_priv();
74*2c2f96dcSApple OSS Distributions }
75*2c2f96dcSApple OSS Distributions new_val = kMinVal - 1;
76*2c2f96dcSApple OSS Distributions ret = sysctlbyname("kern.testing_experiment_factor", ¤t_val, &len, &new_val, sizeof(new_val));
77*2c2f96dcSApple OSS Distributions err = errno;
78*2c2f96dcSApple OSS Distributions T_ASSERT_POSIX_FAILURE(ret, EINVAL, "set kern.testing_experiment_factor below range.");
79*2c2f96dcSApple OSS Distributions
80*2c2f96dcSApple OSS Distributions new_val = kMaxVal + 1;
81*2c2f96dcSApple OSS Distributions ret = sysctlbyname("kern.testing_experiment_factor", ¤t_val, &len, &new_val, sizeof(new_val));
82*2c2f96dcSApple OSS Distributions err = errno;
83*2c2f96dcSApple OSS Distributions T_ASSERT_POSIX_FAILURE(ret, EINVAL, "set kern.testing_experiment_factor above range.");
84*2c2f96dcSApple OSS Distributions
85*2c2f96dcSApple OSS Distributions new_val = kMaxVal;
86*2c2f96dcSApple OSS Distributions ret = sysctlbyname("kern.testing_experiment_factor", ¤t_val, &len, &new_val, sizeof(new_val));
87*2c2f96dcSApple OSS Distributions T_ASSERT_POSIX_SUCCESS(ret, "set kern.testing_experiment_factor at top of range.");
88*2c2f96dcSApple OSS Distributions
89*2c2f96dcSApple OSS Distributions new_val = kMinVal;
90*2c2f96dcSApple OSS Distributions ret = sysctlbyname("kern.testing_experiment_factor", ¤t_val, &len, &new_val, sizeof(new_val));
91*2c2f96dcSApple OSS Distributions T_ASSERT_POSIX_SUCCESS(ret, "set kern.testing_experiment_factor at bottom of range.");
92*2c2f96dcSApple OSS Distributions }
93*2c2f96dcSApple OSS Distributions
94*2c2f96dcSApple OSS Distributions static uint64_t original_libmalloc_experiment_value = 0;
95*2c2f96dcSApple OSS Distributions
96*2c2f96dcSApple OSS Distributions static void
reset_libmalloc_experiment(void)97*2c2f96dcSApple OSS Distributions reset_libmalloc_experiment(void)
98*2c2f96dcSApple OSS Distributions {
99*2c2f96dcSApple OSS Distributions int ret = sysctlbyname("kern.libmalloc_experiments", NULL, NULL, &original_libmalloc_experiment_value, sizeof(original_libmalloc_experiment_value));
100*2c2f96dcSApple OSS Distributions T_ASSERT_POSIX_SUCCESS(ret, "reset kern.libmalloc_experiments");
101*2c2f96dcSApple OSS Distributions }
102*2c2f96dcSApple OSS Distributions
103*2c2f96dcSApple OSS Distributions static void
set_libmalloc_experiment(uint64_t val)104*2c2f96dcSApple OSS Distributions set_libmalloc_experiment(uint64_t val)
105*2c2f96dcSApple OSS Distributions {
106*2c2f96dcSApple OSS Distributions T_LOG("Setting kern.libmalloc_experiments to %llu", val);
107*2c2f96dcSApple OSS Distributions size_t len = sizeof(original_libmalloc_experiment_value);
108*2c2f96dcSApple OSS Distributions int ret = sysctlbyname("kern.libmalloc_experiments", &original_libmalloc_experiment_value, &len, &val, sizeof(val));
109*2c2f96dcSApple OSS Distributions T_ASSERT_POSIX_SUCCESS(ret, "set kern.libmalloc_experiments");
110*2c2f96dcSApple OSS Distributions T_ATEND(reset_libmalloc_experiment);
111*2c2f96dcSApple OSS Distributions }
112*2c2f96dcSApple OSS Distributions
113*2c2f96dcSApple OSS Distributions #define PRINT_APPLE_ARRAY_TOOL "tools/print_apple_array"
114*2c2f96dcSApple OSS Distributions /*
115*2c2f96dcSApple OSS Distributions * Spawns a new binary and returns the contents of its apple array
116*2c2f96dcSApple OSS Distributions * (after libsystem initialization).
117*2c2f96dcSApple OSS Distributions */
118*2c2f96dcSApple OSS Distributions static char **
get_apple_array(size_t * num_array_entries,const char * filename)119*2c2f96dcSApple OSS Distributions get_apple_array(size_t *num_array_entries, const char * filename)
120*2c2f96dcSApple OSS Distributions {
121*2c2f96dcSApple OSS Distributions if (filename == NULL) {
122*2c2f96dcSApple OSS Distributions filename = PRINT_APPLE_ARRAY_TOOL;
123*2c2f96dcSApple OSS Distributions }
124*2c2f96dcSApple OSS Distributions int ret;
125*2c2f96dcSApple OSS Distributions char stdout_path[MAXPATHLEN] = "apple_array.txt";
126*2c2f96dcSApple OSS Distributions dt_resultfile(stdout_path, MAXPATHLEN);
127*2c2f96dcSApple OSS Distributions int exit_status = 0, signum = 0;
128*2c2f96dcSApple OSS Distributions char binary_path[MAXPATHLEN], binary_dir[MAXPATHLEN];
129*2c2f96dcSApple OSS Distributions char *char_ret;
130*2c2f96dcSApple OSS Distributions const static size_t kMaxNumArguments = 256;
131*2c2f96dcSApple OSS Distributions size_t linecap = 0;
132*2c2f96dcSApple OSS Distributions ssize_t linelen = 0;
133*2c2f96dcSApple OSS Distributions char **apple_array;
134*2c2f96dcSApple OSS Distributions char **line = NULL;
135*2c2f96dcSApple OSS Distributions size_t num_lines = 0;
136*2c2f96dcSApple OSS Distributions FILE *stdout_f = NULL;
137*2c2f96dcSApple OSS Distributions uint32_t name_size = MAXPATHLEN;
138*2c2f96dcSApple OSS Distributions
139*2c2f96dcSApple OSS Distributions ret = _NSGetExecutablePath(binary_path, &name_size);
140*2c2f96dcSApple OSS Distributions T_QUIET; T_ASSERT_EQ(ret, 0, "_NSGetExecutablePath");
141*2c2f96dcSApple OSS Distributions char_ret = dirname_r(binary_path, binary_dir);
142*2c2f96dcSApple OSS Distributions T_QUIET; T_ASSERT_TRUE(char_ret != NULL, "dirname_r");
143*2c2f96dcSApple OSS Distributions snprintf(binary_path, MAXPATHLEN, "%s/%s", binary_dir, filename);
144*2c2f96dcSApple OSS Distributions
145*2c2f96dcSApple OSS Distributions char *launch_tool_args[] = {
146*2c2f96dcSApple OSS Distributions binary_path,
147*2c2f96dcSApple OSS Distributions NULL
148*2c2f96dcSApple OSS Distributions };
149*2c2f96dcSApple OSS Distributions pid_t child_pid;
150*2c2f96dcSApple OSS Distributions ret = dt_launch_tool(&child_pid, launch_tool_args, false, stdout_path, NULL);
151*2c2f96dcSApple OSS Distributions T_WITH_ERRNO; T_ASSERT_EQ(ret, 0, "dt_launch_tool: %s", binary_path);
152*2c2f96dcSApple OSS Distributions
153*2c2f96dcSApple OSS Distributions ret = dt_waitpid(child_pid, &exit_status, &signum, 60 * 5);
154*2c2f96dcSApple OSS Distributions T_ASSERT_EQ(ret, 1, "dt_waitpid");
155*2c2f96dcSApple OSS Distributions T_QUIET; T_ASSERT_EQ(exit_status, 0, "dt_waitpid: exit_status");
156*2c2f96dcSApple OSS Distributions T_QUIET; T_ASSERT_EQ(signum, 0, "dt_waitpid: signum");
157*2c2f96dcSApple OSS Distributions
158*2c2f96dcSApple OSS Distributions stdout_f = fopen(stdout_path, "r");
159*2c2f96dcSApple OSS Distributions T_WITH_ERRNO; T_ASSERT_NOTNULL(stdout_f, "open(%s)", stdout_path);
160*2c2f96dcSApple OSS Distributions apple_array = calloc(kMaxNumArguments, sizeof(char *));
161*2c2f96dcSApple OSS Distributions T_QUIET; T_ASSERT_NOTNULL(apple_array, "calloc: %lu\n", sizeof(char *) * kMaxNumArguments);
162*2c2f96dcSApple OSS Distributions while (num_lines < kMaxNumArguments) {
163*2c2f96dcSApple OSS Distributions line = &(apple_array[num_lines++]);
164*2c2f96dcSApple OSS Distributions linecap = 0;
165*2c2f96dcSApple OSS Distributions linelen = getline(line, &linecap, stdout_f);
166*2c2f96dcSApple OSS Distributions if (linelen == -1) {
167*2c2f96dcSApple OSS Distributions break;
168*2c2f96dcSApple OSS Distributions }
169*2c2f96dcSApple OSS Distributions }
170*2c2f96dcSApple OSS Distributions *num_array_entries = num_lines - 1;
171*2c2f96dcSApple OSS Distributions
172*2c2f96dcSApple OSS Distributions ret = fclose(stdout_f);
173*2c2f96dcSApple OSS Distributions T_ASSERT_POSIX_SUCCESS(ret, "fclose(%s)", stdout_path);
174*2c2f96dcSApple OSS Distributions
175*2c2f96dcSApple OSS Distributions return apple_array;
176*2c2f96dcSApple OSS Distributions }
177*2c2f96dcSApple OSS Distributions
178*2c2f96dcSApple OSS Distributions #define LIBMALLOC_EXPERIMENT_FACTORS_KEY "MallocExperiment="
179*2c2f96dcSApple OSS Distributions
180*2c2f96dcSApple OSS Distributions #define HARDENED_RUNTIME_KEY "HardenedRuntime="
181*2c2f96dcSApple OSS Distributions
182*2c2f96dcSApple OSS Distributions
183*2c2f96dcSApple OSS Distributions /*
184*2c2f96dcSApple OSS Distributions * Get the value of the key in the apple array.
185*2c2f96dcSApple OSS Distributions * Returns true iff the key is present.
186*2c2f96dcSApple OSS Distributions */
187*2c2f96dcSApple OSS Distributions static bool
get_apple_array_key(char ** apple_array,size_t num_array_entries,uint64_t * factors,const char * key)188*2c2f96dcSApple OSS Distributions get_apple_array_key(char **apple_array, size_t num_array_entries, uint64_t *factors, const char *key)
189*2c2f96dcSApple OSS Distributions {
190*2c2f96dcSApple OSS Distributions bool found = false;
191*2c2f96dcSApple OSS Distributions for (size_t i = 0; i < num_array_entries; i++) {
192*2c2f96dcSApple OSS Distributions char *str = apple_array[i];
193*2c2f96dcSApple OSS Distributions if (strstr(str, key)) {
194*2c2f96dcSApple OSS Distributions found = true;
195*2c2f96dcSApple OSS Distributions if (factors != NULL) {
196*2c2f96dcSApple OSS Distributions str = strchr(str, '=');
197*2c2f96dcSApple OSS Distributions T_ASSERT_NOTNULL(str, "skip over =");
198*2c2f96dcSApple OSS Distributions ++str;
199*2c2f96dcSApple OSS Distributions *factors = strtoull_l(str, NULL, 16, NULL);
200*2c2f96dcSApple OSS Distributions }
201*2c2f96dcSApple OSS Distributions break;
202*2c2f96dcSApple OSS Distributions }
203*2c2f96dcSApple OSS Distributions }
204*2c2f96dcSApple OSS Distributions return found;
205*2c2f96dcSApple OSS Distributions }
206*2c2f96dcSApple OSS Distributions
207*2c2f96dcSApple OSS Distributions /* libmalloc relies on these values not changing. If they change,
208*2c2f96dcSApple OSS Distributions * you need to update the values in that project as well */
209*2c2f96dcSApple OSS Distributions __options_decl(HR_flags_t, uint32_t, {
210*2c2f96dcSApple OSS Distributions BrowserHostEntitlementMask = 0x01,
211*2c2f96dcSApple OSS Distributions BrowserGPUEntitlementMask = 0x02,
212*2c2f96dcSApple OSS Distributions BrowserNetworkEntitlementMask = 0x04,
213*2c2f96dcSApple OSS Distributions BrowserWebContentEntitlementMask = 0x08,
214*2c2f96dcSApple OSS Distributions });
215*2c2f96dcSApple OSS Distributions
216*2c2f96dcSApple OSS Distributions T_DECL(libmalloc_hardened_binary_present,
217*2c2f96dcSApple OSS Distributions "hardened binary flags show up in apple array",
218*2c2f96dcSApple OSS Distributions T_META_ASROOT(false))
219*2c2f96dcSApple OSS Distributions {
220*2c2f96dcSApple OSS Distributions uint64_t apple_array_val = 0;
221*2c2f96dcSApple OSS Distributions size_t num_array_entries = 0;
222*2c2f96dcSApple OSS Distributions char **apple_array;
223*2c2f96dcSApple OSS Distributions bool found = false;
224*2c2f96dcSApple OSS Distributions
225*2c2f96dcSApple OSS Distributions /* These are the entitlements on the HR1 binary */
226*2c2f96dcSApple OSS Distributions uint32_t mask_val = BrowserHostEntitlementMask | BrowserGPUEntitlementMask | BrowserWebContentEntitlementMask;
227*2c2f96dcSApple OSS Distributions apple_array = get_apple_array(&num_array_entries, "tools/print_apple_array_HR1");
228*2c2f96dcSApple OSS Distributions found = get_apple_array_key(apple_array, num_array_entries, &apple_array_val, HARDENED_RUNTIME_KEY);
229*2c2f96dcSApple OSS Distributions T_ASSERT_TRUE(found, "Found " HARDENED_RUNTIME_KEY " in apple array");
230*2c2f96dcSApple OSS Distributions T_ASSERT_EQ(apple_array_val, mask_val, "Bitmask value matches");
231*2c2f96dcSApple OSS Distributions
232*2c2f96dcSApple OSS Distributions /* These are the entitlements on the HR2 binary */
233*2c2f96dcSApple OSS Distributions mask_val = BrowserGPUEntitlementMask | BrowserNetworkEntitlementMask;
234*2c2f96dcSApple OSS Distributions apple_array = get_apple_array(&num_array_entries, "tools/print_apple_array_HR2");
235*2c2f96dcSApple OSS Distributions found = get_apple_array_key(apple_array, num_array_entries, &apple_array_val, HARDENED_RUNTIME_KEY);
236*2c2f96dcSApple OSS Distributions T_ASSERT_TRUE(found, "Found " HARDENED_RUNTIME_KEY " in apple array");
237*2c2f96dcSApple OSS Distributions T_ASSERT_EQ(apple_array_val, mask_val, "Bitmask value matches");
238*2c2f96dcSApple OSS Distributions free(apple_array);
239*2c2f96dcSApple OSS Distributions }
240*2c2f96dcSApple OSS Distributions
241*2c2f96dcSApple OSS Distributions
242*2c2f96dcSApple OSS Distributions T_DECL(libmalloc_hardened_binary_absent,
243*2c2f96dcSApple OSS Distributions "hardened binary flags do not show up in apple array for normal third party processes",
244*2c2f96dcSApple OSS Distributions T_META_ASROOT(false))
245*2c2f96dcSApple OSS Distributions {
246*2c2f96dcSApple OSS Distributions uint64_t new_val, apple_array_val = 0;
247*2c2f96dcSApple OSS Distributions size_t num_array_entries = 0;
248*2c2f96dcSApple OSS Distributions char **apple_array;
249*2c2f96dcSApple OSS Distributions bool found = false;
250*2c2f96dcSApple OSS Distributions apple_array = get_apple_array(&num_array_entries, NULL); // todo apple_array_3p?
251*2c2f96dcSApple OSS Distributions found = get_apple_array_key(apple_array, num_array_entries, &apple_array_val, HARDENED_RUNTIME_KEY);
252*2c2f96dcSApple OSS Distributions T_ASSERT_TRUE(!found, "Did not find " HARDENED_RUNTIME_KEY " in apple array");
253*2c2f96dcSApple OSS Distributions free(apple_array);
254*2c2f96dcSApple OSS Distributions }
255*2c2f96dcSApple OSS Distributions
256*2c2f96dcSApple OSS Distributions T_DECL(libmalloc_experiment,
257*2c2f96dcSApple OSS Distributions "libmalloc experiment flags show up in apple array if we're doing an experiment",
258*2c2f96dcSApple OSS Distributions T_META_ASROOT(false))
259*2c2f96dcSApple OSS Distributions {
260*2c2f96dcSApple OSS Distributions uint64_t new_val, apple_array_val = 0;
261*2c2f96dcSApple OSS Distributions size_t num_array_entries = 0;
262*2c2f96dcSApple OSS Distributions char **apple_array;
263*2c2f96dcSApple OSS Distributions bool found = false;
264*2c2f96dcSApple OSS Distributions
265*2c2f96dcSApple OSS Distributions if (running_as_root()) {
266*2c2f96dcSApple OSS Distributions drop_priv();
267*2c2f96dcSApple OSS Distributions }
268*2c2f96dcSApple OSS Distributions new_val = (1ULL << 63) - 1;
269*2c2f96dcSApple OSS Distributions set_libmalloc_experiment(new_val);
270*2c2f96dcSApple OSS Distributions
271*2c2f96dcSApple OSS Distributions apple_array = get_apple_array(&num_array_entries, NULL);
272*2c2f96dcSApple OSS Distributions found = get_apple_array_key(apple_array, num_array_entries, &apple_array_val, LIBMALLOC_EXPERIMENT_FACTORS_KEY);
273*2c2f96dcSApple OSS Distributions T_ASSERT_TRUE(found, "Found " LIBMALLOC_EXPERIMENT_FACTORS_KEY " in apple array");
274*2c2f96dcSApple OSS Distributions T_ASSERT_EQ(apple_array_val, new_val, "Experiment value matches");
275*2c2f96dcSApple OSS Distributions free(apple_array);
276*2c2f96dcSApple OSS Distributions }
277*2c2f96dcSApple OSS Distributions
278*2c2f96dcSApple OSS Distributions T_DECL(libmalloc_experiment_not_in_array,
279*2c2f96dcSApple OSS Distributions "libmalloc experiment flags do not show up in apple array if we're not doing an experiment",
280*2c2f96dcSApple OSS Distributions T_META_ASROOT(false))
281*2c2f96dcSApple OSS Distributions {
282*2c2f96dcSApple OSS Distributions size_t num_array_entries = 0;
283*2c2f96dcSApple OSS Distributions char **apple_array;
284*2c2f96dcSApple OSS Distributions bool found = false;
285*2c2f96dcSApple OSS Distributions
286*2c2f96dcSApple OSS Distributions if (running_as_root()) {
287*2c2f96dcSApple OSS Distributions drop_priv();
288*2c2f96dcSApple OSS Distributions }
289*2c2f96dcSApple OSS Distributions set_libmalloc_experiment(0);
290*2c2f96dcSApple OSS Distributions
291*2c2f96dcSApple OSS Distributions apple_array = get_apple_array(&num_array_entries, NULL);
292*2c2f96dcSApple OSS Distributions found = get_apple_array_key(apple_array, num_array_entries, NULL, LIBMALLOC_EXPERIMENT_FACTORS_KEY);
293*2c2f96dcSApple OSS Distributions T_ASSERT_TRUE(!found, "Did not find " LIBMALLOC_EXPERIMENT_FACTORS_KEY " in apple array");
294*2c2f96dcSApple OSS Distributions free(apple_array);
295*2c2f96dcSApple OSS Distributions }
296*2c2f96dcSApple OSS Distributions #endif /* ENTITLED */
297