blob: b49f138a7ff5bca228f75e135781caf7ac4a2183 [file] [log] [blame]
Thiébaud Weksteenf24b4572021-11-26 09:12:41 +11001# Copyright 2021 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070015from optparse import OptionParser
16from optparse import Option, OptionValueError
17import os
Dan Cashman91d398d2017-09-26 12:58:29 -070018import mini_parser
Inseob Kim4912a242022-07-25 11:30:02 +090019import pkgutil
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070020import policy
Dan Cashman91d398d2017-09-26 12:58:29 -070021from policy import MatchPathPrefix
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070022import re
Inseob Kim4912a242022-07-25 11:30:02 +090023import shutil
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070024import sys
Inseob Kim4912a242022-07-25 11:30:02 +090025import tempfile
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070026
Jeff Vander Stoep1fc06822017-05-31 15:36:07 -070027DEBUG=False
Inseob Kim3a9ac6f2022-07-19 14:27:36 +090028SHARED_LIB_EXTENSION = '.dylib' if sys.platform == 'darwin' else '.so'
Jeff Vander Stoep1fc06822017-05-31 15:36:07 -070029
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070030'''
31Use file_contexts and policy to verify Treble requirements
32are not violated.
33'''
Joel Galensonb0d74a12020-07-27 09:30:34 -070034coredomainAllowlist = {
Steven Moreland000ec932020-04-02 16:20:31 -070035 # TODO: how do we make sure vendor_init doesn't have bad coupling with
36 # /vendor? It is the only system process which is not coredomain.
Tom Cherry9c778042018-01-25 11:31:09 -080037 'vendor_init',
Joel Galensonb0d74a12020-07-27 09:30:34 -070038 # TODO(b/152813275): need to avoid allowlist for rootdir
Steven Moreland000ec932020-04-02 16:20:31 -070039 "modprobe",
40 "slideshow",
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070041 }
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070042
43class scontext:
44 def __init__(self):
45 self.fromSystem = False
46 self.fromVendor = False
47 self.coredomain = False
48 self.appdomain = False
49 self.attributes = set()
50 self.entrypoints = []
51 self.entrypointpaths = []
Steven Moreland000ec932020-04-02 16:20:31 -070052 self.error = ""
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070053
Jeff Vander Stoep1fc06822017-05-31 15:36:07 -070054def PrintScontexts():
55 for d in sorted(alldomains.keys()):
56 sctx = alldomains[d]
Thiébaud Weksteenf24b4572021-11-26 09:12:41 +110057 print(d)
58 print("\tcoredomain="+str(sctx.coredomain))
59 print("\tappdomain="+str(sctx.appdomain))
60 print("\tfromSystem="+str(sctx.fromSystem))
61 print("\tfromVendor="+str(sctx.fromVendor))
62 print("\tattributes="+str(sctx.attributes))
63 print("\tentrypoints="+str(sctx.entrypoints))
64 print("\tentrypointpaths=")
Jeff Vander Stoep1fc06822017-05-31 15:36:07 -070065 if sctx.entrypointpaths is not None:
66 for path in sctx.entrypointpaths:
Thiébaud Weksteenf24b4572021-11-26 09:12:41 +110067 print("\t\t"+str(path))
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070068
69alldomains = {}
70coredomains = set()
71appdomains = set()
72vendordomains = set()
Jeff Vander Stoep370a52f2018-02-08 09:54:59 -080073pol = None
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070074
Dan Cashman91d398d2017-09-26 12:58:29 -070075# compat vars
76alltypes = set()
77oldalltypes = set()
78compatMapping = None
Tri Voe3f4f772018-09-28 17:21:08 -070079pubtypes = set()
Dan Cashman91d398d2017-09-26 12:58:29 -070080
81# Distinguish between PRODUCT_FULL_TREBLE and PRODUCT_FULL_TREBLE_OVERRIDE
82FakeTreble = False
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -070083
84def GetAllDomains(pol):
85 global alldomains
86 for result in pol.QueryTypeAttribute("domain", True):
87 alldomains[result] = scontext()
88
89def GetAppDomains():
90 global appdomains
91 global alldomains
92 for d in alldomains:
93 # The application of the "appdomain" attribute is trusted because core
94 # selinux policy contains neverallow rules that enforce that only zygote
95 # and runas spawned processes may transition to processes that have
96 # the appdomain attribute.
97 if "appdomain" in alldomains[d].attributes:
98 alldomains[d].appdomain = True
99 appdomains.add(d)
100
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700101def GetCoreDomains():
102 global alldomains
103 global coredomains
104 for d in alldomains:
Steven Moreland000ec932020-04-02 16:20:31 -0700105 domain = alldomains[d]
Dan Cashman91d398d2017-09-26 12:58:29 -0700106 # TestCoredomainViolations will verify if coredomain was incorrectly
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700107 # applied.
Steven Moreland000ec932020-04-02 16:20:31 -0700108 if "coredomain" in domain.attributes:
109 domain.coredomain = True
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700110 coredomains.add(d)
111 # check whether domains are executed off of /system or /vendor
Joel Galensonb0d74a12020-07-27 09:30:34 -0700112 if d in coredomainAllowlist:
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700113 continue
Steven Moreland000ec932020-04-02 16:20:31 -0700114 # TODO(b/153112003): add checks to prevent app domains from being
115 # incorrectly labeled as coredomain. Apps don't have entrypoints as
116 # they're always dynamically transitioned to by zygote.
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700117 if d in appdomains:
118 continue
Steven Moreland000ec932020-04-02 16:20:31 -0700119 # TODO(b/153112747): need to handle cases where there is a dynamic
120 # transition OR there happens to be no context in AOSP files.
121 if not domain.entrypointpaths:
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700122 continue
Steven Moreland000ec932020-04-02 16:20:31 -0700123
124 for path in domain.entrypointpaths:
125 vendor = any(MatchPathPrefix(path, prefix) for prefix in
126 ["/vendor", "/odm"])
127 system = any(MatchPathPrefix(path, prefix) for prefix in
128 ["/init", "/system_ext", "/product" ])
129
130 # only mark entrypoint as system if it is not in legacy /system/vendor
131 if MatchPathPrefix(path, "/system/vendor"):
132 vendor = True
133 elif MatchPathPrefix(path, "/system"):
134 system = True
135
136 if not vendor and not system:
137 domain.error += "Unrecognized entrypoint for " + d + " at " + path + "\n"
138
139 domain.fromSystem = domain.fromSystem or system
140 domain.fromVendor = domain.fromVendor or vendor
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700141
142###
143# Add the entrypoint type and path(s) to each domain.
144#
145def GetDomainEntrypoints(pol):
146 global alldomains
Dan Cashman91d398d2017-09-26 12:58:29 -0700147 for x in pol.QueryExpandedTERule(tclass=set(["file"]), perms=set(["entrypoint"])):
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700148 if not x.sctx in alldomains:
149 continue
150 alldomains[x.sctx].entrypoints.append(str(x.tctx))
151 # postinstall_file represents a special case specific to A/B OTAs.
152 # Update_engine mounts a partition and relabels it postinstall_file.
153 # There is no file_contexts entry associated with postinstall_file
154 # so skip the lookup.
155 if x.tctx == "postinstall_file":
156 continue
Jeff Vander Stoep1fc06822017-05-31 15:36:07 -0700157 entrypointpath = pol.QueryFc(x.tctx)
158 if not entrypointpath:
159 continue
160 alldomains[x.sctx].entrypointpaths.extend(entrypointpath)
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700161###
162# Get attributes associated with each domain
163#
164def GetAttributes(pol):
165 global alldomains
166 for domain in alldomains:
167 for result in pol.QueryTypeAttribute(domain, False):
168 alldomains[domain].attributes.add(result)
169
Dan Cashman91d398d2017-09-26 12:58:29 -0700170def GetAllTypes(pol, oldpol):
171 global alltypes
172 global oldalltypes
173 alltypes = pol.GetAllTypes(False)
174 oldalltypes = oldpol.GetAllTypes(False)
175
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700176def setup(pol):
177 GetAllDomains(pol)
178 GetAttributes(pol)
179 GetDomainEntrypoints(pol)
180 GetAppDomains()
181 GetCoreDomains()
182
Dan Cashman91d398d2017-09-26 12:58:29 -0700183# setup for the policy compatibility tests
Tri Voe3f4f772018-09-28 17:21:08 -0700184def compatSetup(pol, oldpol, mapping, types):
Dan Cashman91d398d2017-09-26 12:58:29 -0700185 global compatMapping
Tri Voe3f4f772018-09-28 17:21:08 -0700186 global pubtypes
Dan Cashman91d398d2017-09-26 12:58:29 -0700187
188 GetAllTypes(pol, oldpol)
189 compatMapping = mapping
Tri Voe3f4f772018-09-28 17:21:08 -0700190 pubtypes = types
Dan Cashman91d398d2017-09-26 12:58:29 -0700191
192def DomainsWithAttribute(attr):
193 global alldomains
194 domains = []
195 for domain in alldomains:
196 if attr in alldomains[domain].attributes:
197 domains.append(domain)
198 return domains
199
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700200#############################################################
201# Tests
202#############################################################
203def TestCoredomainViolations():
204 global alldomains
205 # verify that all domains launched from /system have the coredomain
206 # attribute
207 ret = ""
Steven Moreland000ec932020-04-02 16:20:31 -0700208
209 for d in alldomains:
210 domain = alldomains[d]
211 if domain.fromSystem and domain.fromVendor:
212 ret += "The following domain is system and vendor: " + d + "\n"
213
214 for domain in alldomains.values():
215 ret += domain.error
216
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700217 violators = []
218 for d in alldomains:
219 domain = alldomains[d]
220 if domain.fromSystem and "coredomain" not in domain.attributes:
221 violators.append(d);
222 if len(violators) > 0:
223 ret += "The following domain(s) must be associated with the "
224 ret += "\"coredomain\" attribute because they are executed off of "
225 ret += "/system:\n"
226 ret += " ".join(str(x) for x in sorted(violators)) + "\n"
227
228 # verify that all domains launched form /vendor do not have the coredomain
229 # attribute
230 violators = []
231 for d in alldomains:
232 domain = alldomains[d]
233 if domain.fromVendor and "coredomain" in domain.attributes:
234 violators.append(d)
235 if len(violators) > 0:
236 ret += "The following domains must not be associated with the "
237 ret += "\"coredomain\" attribute because they are executed off of "
238 ret += "/vendor or /system/vendor:\n"
239 ret += " ".join(str(x) for x in sorted(violators)) + "\n"
240
241 return ret
242
243###
Tri Voe3f4f772018-09-28 17:21:08 -0700244# Make sure that any new public type introduced in the new policy that was not
245# present in the old policy has been recorded in the mapping file.
Dan Cashman91d398d2017-09-26 12:58:29 -0700246def TestNoUnmappedNewTypes():
247 global alltypes
248 global oldalltypes
249 global compatMapping
Tri Voe3f4f772018-09-28 17:21:08 -0700250 global pubtypes
Dan Cashman91d398d2017-09-26 12:58:29 -0700251 newt = alltypes - oldalltypes
252 ret = ""
253 violators = []
254
255 for n in newt:
Tri Voe3f4f772018-09-28 17:21:08 -0700256 if n in pubtypes and compatMapping.rTypeattributesets.get(n) is None:
Dan Cashman91d398d2017-09-26 12:58:29 -0700257 violators.append(n)
258
259 if len(violators) > 0:
Tri Voe3f4f772018-09-28 17:21:08 -0700260 ret += "SELinux: The following public types were found added to the "
261 ret += "policy without an entry into the compatibility mapping file(s) "
Tri Vo438684b2018-09-29 17:47:10 -0700262 ret += "found in private/compat/V.v/V.v[.ignore].cil, where V.v is the "
263 ret += "latest API level.\n"
Tri Vo14519382019-01-06 18:17:32 -0800264 ret += " ".join(str(x) for x in sorted(violators)) + "\n\n"
265 ret += "See examples of how to fix this:\n"
Tri Vo462c9c42019-08-09 10:27:46 -0700266 ret += "https://android-review.googlesource.com/c/platform/system/sepolicy/+/781036\n"
267 ret += "https://android-review.googlesource.com/c/platform/system/sepolicy/+/852612\n"
Dan Cashman91d398d2017-09-26 12:58:29 -0700268 return ret
269
270###
271# Make sure that any public type removed in the current policy has its
272# declaration added to the mapping file for use in non-platform policy
273def TestNoUnmappedRmTypes():
274 global alltypes
275 global oldalltypes
276 global compatMapping
277 rmt = oldalltypes - alltypes
278 ret = ""
279 violators = []
280
281 for o in rmt:
282 if o in compatMapping.pubtypes and not o in compatMapping.types:
283 violators.append(o)
284
285 if len(violators) > 0:
286 ret += "SELinux: The following formerly public types were removed from "
287 ret += "policy without a declaration in the compatibility mapping "
Tri Vo438684b2018-09-29 17:47:10 -0700288 ret += "found in private/compat/V.v/V.v[.ignore].cil, where V.v is the "
289 ret += "latest API level.\n"
Tri Vo14519382019-01-06 18:17:32 -0800290 ret += " ".join(str(x) for x in sorted(violators)) + "\n\n"
291 ret += "See examples of how to fix this:\n"
Tri Vo462c9c42019-08-09 10:27:46 -0700292 ret += "https://android-review.googlesource.com/c/platform/system/sepolicy/+/822743\n"
Dan Cashman91d398d2017-09-26 12:58:29 -0700293 return ret
294
295def TestTrebleCompatMapping():
296 ret = TestNoUnmappedNewTypes()
297 ret += TestNoUnmappedRmTypes()
298 return ret
299
300def TestViolatorAttribute(attribute):
301 global FakeTreble
302 ret = ""
303 if FakeTreble:
304 return ret
305
306 violators = DomainsWithAttribute(attribute)
307 if len(violators) > 0:
308 ret += "SELinux: The following domains violate the Treble ban "
309 ret += "against use of the " + attribute + " attribute: "
310 ret += " ".join(str(x) for x in sorted(violators)) + "\n"
311 return ret
312
313def TestViolatorAttributes():
Steven Moreland5c0a0a82019-05-13 17:06:50 -0700314 ret = ""
Dan Cashman91d398d2017-09-26 12:58:29 -0700315 ret += TestViolatorAttribute("socket_between_core_and_vendor_violators")
316 ret += TestViolatorAttribute("vendor_executes_system_violators")
317 return ret
318
Jeff Vander Stoep370a52f2018-02-08 09:54:59 -0800319# TODO move this to sepolicy_tests
320def TestCoreDataTypeViolations():
321 global pol
322 return pol.AssertPathTypesDoNotHaveAttr(["/data/vendor/", "/data/vendor_ce/",
323 "/data/vendor_de/"], [], "core_data_file_type")
324
Dan Cashman91d398d2017-09-26 12:58:29 -0700325###
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700326# extend OptionParser to allow the same option flag to be used multiple times.
327# This is used to allow multiple file_contexts files and tests to be
328# specified.
329#
330class MultipleOption(Option):
331 ACTIONS = Option.ACTIONS + ("extend",)
332 STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
333 TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",)
334 ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",)
335
336 def take_action(self, action, dest, opt, value, values, parser):
337 if action == "extend":
338 values.ensure_value(dest, []).append(value)
339 else:
340 Option.take_action(self, action, dest, opt, value, values, parser)
341
Dan Cashman91d398d2017-09-26 12:58:29 -0700342Tests = {"CoredomainViolations": TestCoredomainViolations,
Jeff Vander Stoep370a52f2018-02-08 09:54:59 -0800343 "CoreDatatypeViolations": TestCoreDataTypeViolations,
Dan Cashman91d398d2017-09-26 12:58:29 -0700344 "TrebleCompatMapping": TestTrebleCompatMapping,
345 "ViolatorAttributes": TestViolatorAttributes}
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700346
Inseob Kim4912a242022-07-25 11:30:02 +0900347def do_main(libpath):
348 """
349 Args:
350 libpath: string, path to libsepolwrap.so
351 """
352 global pol, FakeTreble
353
Inseob Kim6fa8efd2021-12-29 13:56:14 +0900354 usage = "treble_sepolicy_tests "
Dan Cashman91d398d2017-09-26 12:58:29 -0700355 usage += "-f nonplat_file_contexts -f plat_file_contexts "
356 usage += "-p curr_policy -b base_policy -o old_policy "
357 usage +="-m mapping file [--test test] [--help]"
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700358 parser = OptionParser(option_class=MultipleOption, usage=usage)
Dan Cashman91d398d2017-09-26 12:58:29 -0700359 parser.add_option("-b", "--basepolicy", dest="basepolicy", metavar="FILE")
Tri Voe3f4f772018-09-28 17:21:08 -0700360 parser.add_option("-u", "--base-pub-policy", dest="base_pub_policy",
361 metavar="FILE")
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700362 parser.add_option("-f", "--file_contexts", dest="file_contexts",
363 metavar="FILE", action="extend", type="string")
Dan Cashman91d398d2017-09-26 12:58:29 -0700364 parser.add_option("-m", "--mapping", dest="mapping", metavar="FILE")
365 parser.add_option("-o", "--oldpolicy", dest="oldpolicy", metavar="FILE")
366 parser.add_option("-p", "--policy", dest="policy", metavar="FILE")
367 parser.add_option("-t", "--test", dest="tests", action="extend",
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700368 help="Test options include "+str(Tests))
Dan Cashman91d398d2017-09-26 12:58:29 -0700369 parser.add_option("--fake-treble", action="store_true", dest="faketreble",
370 default=False)
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700371
372 (options, args) = parser.parse_args()
373
374 if not options.policy:
Dan Cashman91d398d2017-09-26 12:58:29 -0700375 sys.exit("Must specify current monolithic policy file\n" + parser.usage)
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700376 if not os.path.exists(options.policy):
377 sys.exit("Error: policy file " + options.policy + " does not exist\n"
378 + parser.usage)
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700379 if not options.file_contexts:
380 sys.exit("Error: Must specify file_contexts file(s)\n" + parser.usage)
381 for f in options.file_contexts:
382 if not os.path.exists(f):
383 sys.exit("Error: File_contexts file " + f + " does not exist\n" +
384 parser.usage)
385
Tri Voe3f4f772018-09-28 17:21:08 -0700386 # Mapping files and public platform policy are only necessary for the
387 # TrebleCompatMapping test.
Thiébaud Weksteenf24b4572021-11-26 09:12:41 +1100388 if options.tests is None or options.tests == "TrebleCompatMapping":
Jeff Vander Stoepfe0910c2017-11-20 13:25:47 -0800389 if not options.basepolicy:
Tri Voe3f4f772018-09-28 17:21:08 -0700390 sys.exit("Must specify the current platform-only policy file\n"
391 + parser.usage)
Jeff Vander Stoepfe0910c2017-11-20 13:25:47 -0800392 if not options.mapping:
Tri Voe3f4f772018-09-28 17:21:08 -0700393 sys.exit("Must specify a compatibility mapping file\n"
394 + parser.usage)
Jeff Vander Stoepfe0910c2017-11-20 13:25:47 -0800395 if not options.oldpolicy:
Tri Voe3f4f772018-09-28 17:21:08 -0700396 sys.exit("Must specify the previous monolithic policy file\n"
397 + parser.usage)
398 if not options.base_pub_policy:
399 sys.exit("Must specify the current platform-only public policy "
400 + ".cil file\n" + parser.usage)
Inseob Kim6fa8efd2021-12-29 13:56:14 +0900401 basepol = policy.Policy(options.basepolicy, None, libpath)
402 oldpol = policy.Policy(options.oldpolicy, None, libpath)
Jeff Vander Stoepfe0910c2017-11-20 13:25:47 -0800403 mapping = mini_parser.MiniCilParser(options.mapping)
Tri Voe3f4f772018-09-28 17:21:08 -0700404 pubpol = mini_parser.MiniCilParser(options.base_pub_policy)
405 compatSetup(basepol, oldpol, mapping, pubpol.types)
Jeff Vander Stoepfe0910c2017-11-20 13:25:47 -0800406
Dan Cashman91d398d2017-09-26 12:58:29 -0700407 if options.faketreble:
408 FakeTreble = True
409
Inseob Kim6fa8efd2021-12-29 13:56:14 +0900410 pol = policy.Policy(options.policy, options.file_contexts, libpath)
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700411 setup(pol)
412
Jeff Vander Stoep1fc06822017-05-31 15:36:07 -0700413 if DEBUG:
414 PrintScontexts()
415
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700416 results = ""
417 # If an individual test is not specified, run all tests.
Dan Cashman91d398d2017-09-26 12:58:29 -0700418 if options.tests is None:
419 for t in Tests.values():
420 results += t()
421 else:
422 for tn in options.tests:
423 t = Tests.get(tn)
424 if t:
425 results += t()
426 else:
427 err = "Error: unknown test: " + tn + "\n"
428 err += "Available tests:\n"
429 for tn in Tests.keys():
430 err += tn + "\n"
431 sys.exit(err)
Jeff Vander Stoepbdfc0302017-05-25 09:53:47 -0700432
433 if len(results) > 0:
434 sys.exit(results)
Inseob Kim4912a242022-07-25 11:30:02 +0900435
436if __name__ == '__main__':
437 temp_dir = tempfile.mkdtemp()
438 try:
439 libname = "libsepolwrap" + SHARED_LIB_EXTENSION
440 libpath = os.path.join(temp_dir, libname)
441 with open(libpath, "wb") as f:
442 blob = pkgutil.get_data("treble_sepolicy_tests", libname)
443 if not blob:
444 sys.exit("Error: libsepolwrap does not exist. Is this binary corrupted?\n")
445 f.write(blob)
446 do_main(libpath)
447 finally:
448 shutil.rmtree(temp_dir)