1 /*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "devices.h"
18
19 #include <errno.h>
20 #include <fnmatch.h>
21 #include <sys/sysmacros.h>
22 #include <unistd.h>
23
24 #include <chrono>
25 #include <filesystem>
26 #include <memory>
27 #include <string>
28 #include <string_view>
29 #include <thread>
30
31 #include <android-base/chrono_utils.h>
32 #include <android-base/file.h>
33 #include <android-base/logging.h>
34 #include <android-base/stringprintf.h>
35 #include <android-base/strings.h>
36 #include <fs_mgr.h>
37 #include <libdm/dm.h>
38 #include <private/android_filesystem_config.h>
39 #include <selinux/android.h>
40 #include <selinux/selinux.h>
41
42 #include "selabel.h"
43 #include "util.h"
44
45 using namespace std::chrono_literals;
46
47 using android::base::Basename;
48 using android::base::Dirname;
49 using android::base::ReadFileToString;
50 using android::base::Readlink;
51 using android::base::Realpath;
52 using android::base::Split;
53 using android::base::StartsWith;
54 using android::base::StringPrintf;
55 using android::base::Trim;
56
57 namespace android {
58 namespace init {
59
60 /* Given a path that may start with a PCI device, populate the supplied buffer
61 * with the PCI domain/bus number and the peripheral ID and return 0.
62 * If it doesn't start with a PCI device, or there is some error, return -1 */
FindPciDevicePrefix(const std::string & path,std::string * result)63 static bool FindPciDevicePrefix(const std::string& path, std::string* result) {
64 result->clear();
65
66 if (!StartsWith(path, "/devices/pci")) return false;
67
68 /* Beginning of the prefix is the initial "pci" after "/devices/" */
69 std::string::size_type start = 9;
70
71 /* End of the prefix is two path '/' later, capturing the domain/bus number
72 * and the peripheral ID. Example: pci0000:00/0000:00:1f.2 */
73 auto end = path.find('/', start);
74 if (end == std::string::npos) return false;
75
76 end = path.find('/', end + 1);
77 if (end == std::string::npos) return false;
78
79 auto length = end - start;
80 if (length <= 4) {
81 // The minimum string that will get to this check is 'pci/', which is malformed,
82 // so return false
83 return false;
84 }
85
86 *result = path.substr(start, length);
87 return true;
88 }
89
90 /* Given a path that may start with a virtual block device, populate
91 * the supplied buffer with the virtual block device ID and return 0.
92 * If it doesn't start with a virtual block device, or there is some
93 * error, return -1 */
FindVbdDevicePrefix(const std::string & path,std::string * result)94 static bool FindVbdDevicePrefix(const std::string& path, std::string* result) {
95 result->clear();
96
97 if (!StartsWith(path, "/devices/vbd-")) return false;
98
99 /* Beginning of the prefix is the initial "vbd-" after "/devices/" */
100 std::string::size_type start = 13;
101
102 /* End of the prefix is one path '/' later, capturing the
103 virtual block device ID. Example: 768 */
104 auto end = path.find('/', start);
105 if (end == std::string::npos) return false;
106
107 auto length = end - start;
108 if (length == 0) return false;
109
110 *result = path.substr(start, length);
111 return true;
112 }
113
114 // Given a path that may start with a virtual dm block device, populate
115 // the supplied buffer with the dm module's instantiated name.
116 // If it doesn't start with a virtual block device, or there is some
117 // error, return false.
FindDmDevice(const Uevent & uevent,std::string * name,std::string * uuid)118 static bool FindDmDevice(const Uevent& uevent, std::string* name, std::string* uuid) {
119 if (!StartsWith(uevent.path, "/devices/virtual/block/dm-")) return false;
120 if (uevent.action == "remove") return false; // Avoid error spam from ioctl
121
122 dev_t dev = makedev(uevent.major, uevent.minor);
123
124 auto& dm = android::dm::DeviceMapper::Instance();
125 return dm.GetDeviceNameAndUuid(dev, name, uuid);
126 }
127
Permissions(const std::string & name,mode_t perm,uid_t uid,gid_t gid,bool no_fnm_pathname)128 Permissions::Permissions(const std::string& name, mode_t perm, uid_t uid, gid_t gid,
129 bool no_fnm_pathname)
130 : name_(name),
131 perm_(perm),
132 uid_(uid),
133 gid_(gid),
134 prefix_(false),
135 wildcard_(false),
136 no_fnm_pathname_(no_fnm_pathname) {
137 // Set 'prefix_' or 'wildcard_' based on the below cases:
138 //
139 // 1) No '*' in 'name' -> Neither are set and Match() checks a given path for strict
140 // equality with 'name'
141 //
142 // 2) '*' only appears as the last character in 'name' -> 'prefix'_ is set to true and
143 // Match() checks if 'name' is a prefix of a given path.
144 //
145 // 3) '*' appears elsewhere -> 'wildcard_' is set to true and Match() uses fnmatch()
146 // with FNM_PATHNAME to compare 'name' to a given path.
147 auto wildcard_position = name_.find('*');
148 if (wildcard_position != std::string::npos) {
149 if (wildcard_position == name_.length() - 1) {
150 prefix_ = true;
151 name_.pop_back();
152 } else {
153 wildcard_ = true;
154 }
155 }
156 }
157
Match(const std::string & path) const158 bool Permissions::Match(const std::string& path) const {
159 if (prefix_) return StartsWith(path, name_);
160 if (wildcard_)
161 return fnmatch(name_.c_str(), path.c_str(), no_fnm_pathname_ ? 0 : FNM_PATHNAME) == 0;
162 return path == name_;
163 }
164
MatchWithSubsystem(const std::string & path,const std::string & subsystem) const165 bool SysfsPermissions::MatchWithSubsystem(const std::string& path,
166 const std::string& subsystem) const {
167 std::string path_basename = Basename(path);
168 if (name().find(subsystem) != std::string::npos) {
169 if (Match("/sys/class/" + subsystem + "/" + path_basename)) return true;
170 if (Match("/sys/bus/" + subsystem + "/devices/" + path_basename)) return true;
171 }
172 return Match(path);
173 }
174
SetPermissions(const std::string & path) const175 void SysfsPermissions::SetPermissions(const std::string& path) const {
176 std::string attribute_file = path + "/" + attribute_;
177 LOG(VERBOSE) << "fixup " << attribute_file << " " << uid() << " " << gid() << " " << std::oct
178 << perm();
179
180 if (access(attribute_file.c_str(), F_OK) == 0) {
181 if (chown(attribute_file.c_str(), uid(), gid()) != 0) {
182 PLOG(ERROR) << "chown(" << attribute_file << ", " << uid() << ", " << gid()
183 << ") failed";
184 }
185 if (chmod(attribute_file.c_str(), perm()) != 0) {
186 PLOG(ERROR) << "chmod(" << attribute_file << ", " << perm() << ") failed";
187 }
188 }
189 }
190
GetPartitionNameForDevice(const std::string & query_device)191 std::string DeviceHandler::GetPartitionNameForDevice(const std::string& query_device) {
192 static const auto partition_map = [] {
193 std::vector<std::pair<std::string, std::string>> partition_map;
194 auto parser = [&partition_map](const std::string& key, const std::string& value) {
195 if (key != "androidboot.partition_map") {
196 return;
197 }
198 for (const auto& map : Split(value, ";")) {
199 auto map_pieces = Split(map, ",");
200 if (map_pieces.size() != 2) {
201 LOG(ERROR) << "Expected a comma separated device,partition mapping, but found '"
202 << map << "'";
203 continue;
204 }
205 partition_map.emplace_back(map_pieces[0], map_pieces[1]);
206 }
207 };
208 android::fs_mgr::ImportKernelCmdline(parser);
209 android::fs_mgr::ImportBootconfig(parser);
210 return partition_map;
211 }();
212
213 for (const auto& [device, partition] : partition_map) {
214 if (query_device == device) {
215 return partition;
216 }
217 }
218 return {};
219 }
220
221 // Given a path that may start with a platform device, find the parent platform device by finding a
222 // parent directory with a 'subsystem' symlink that points to the platform bus.
223 // If it doesn't start with a platform device, return false
FindPlatformDevice(std::string path,std::string * platform_device_path) const224 bool DeviceHandler::FindPlatformDevice(std::string path, std::string* platform_device_path) const {
225 platform_device_path->clear();
226
227 // Uevents don't contain the mount point, so we need to add it here.
228 path.insert(0, sysfs_mount_point_);
229
230 std::string directory = Dirname(path);
231
232 while (directory != "/" && directory != ".") {
233 std::string subsystem_link_path;
234 if (Realpath(directory + "/subsystem", &subsystem_link_path) &&
235 (subsystem_link_path == sysfs_mount_point_ + "/bus/platform" ||
236 subsystem_link_path == sysfs_mount_point_ + "/bus/amba")) {
237 // We need to remove the mount point that we added above before returning.
238 directory.erase(0, sysfs_mount_point_.size());
239 *platform_device_path = directory;
240 return true;
241 }
242
243 auto last_slash = path.rfind('/');
244 if (last_slash == std::string::npos) return false;
245
246 path.erase(last_slash);
247 directory = Dirname(path);
248 }
249
250 return false;
251 }
252
FixupSysPermissions(const std::string & upath,const std::string & subsystem) const253 void DeviceHandler::FixupSysPermissions(const std::string& upath,
254 const std::string& subsystem) const {
255 // upaths omit the "/sys" that paths in this list
256 // contain, so we prepend it...
257 std::string path = "/sys" + upath;
258
259 for (const auto& s : sysfs_permissions_) {
260 if (s.MatchWithSubsystem(path, subsystem)) s.SetPermissions(path);
261 }
262
263 if (!skip_restorecon_ && access(path.c_str(), F_OK) == 0) {
264 LOG(VERBOSE) << "restorecon_recursive: " << path;
265 if (selinux_android_restorecon(path.c_str(), SELINUX_ANDROID_RESTORECON_RECURSE) != 0) {
266 PLOG(ERROR) << "selinux_android_restorecon(" << path << ") failed";
267 }
268 }
269 }
270
GetDevicePermissions(const std::string & path,const std::vector<std::string> & links) const271 std::tuple<mode_t, uid_t, gid_t> DeviceHandler::GetDevicePermissions(
272 const std::string& path, const std::vector<std::string>& links) const {
273 // Search the perms list in reverse so that ueventd.$hardware can override ueventd.rc.
274 for (auto it = dev_permissions_.crbegin(); it != dev_permissions_.crend(); ++it) {
275 if (it->Match(path) || std::any_of(links.cbegin(), links.cend(),
276 [it](const auto& link) { return it->Match(link); })) {
277 return {it->perm(), it->uid(), it->gid()};
278 }
279 }
280 /* Default if nothing found. */
281 return {0600, 0, 0};
282 }
283
MakeDevice(const std::string & path,bool block,int major,int minor,const std::vector<std::string> & links) const284 void DeviceHandler::MakeDevice(const std::string& path, bool block, int major, int minor,
285 const std::vector<std::string>& links) const {
286 auto[mode, uid, gid] = GetDevicePermissions(path, links);
287 mode |= (block ? S_IFBLK : S_IFCHR);
288
289 std::string secontext;
290 if (!SelabelLookupFileContextBestMatch(path, links, mode, &secontext)) {
291 PLOG(ERROR) << "Device '" << path << "' not created; cannot find SELinux label";
292 return;
293 }
294 if (!secontext.empty()) {
295 setfscreatecon(secontext.c_str());
296 }
297
298 gid_t new_group = -1;
299
300 dev_t dev = makedev(major, minor);
301 /* Temporarily change egid to avoid race condition setting the gid of the
302 * device node. Unforunately changing the euid would prevent creation of
303 * some device nodes, so the uid has to be set with chown() and is still
304 * racy. Fixing the gid race at least fixed the issue with system_server
305 * opening dynamic input devices under the AID_INPUT gid. */
306 if (setegid(gid)) {
307 PLOG(ERROR) << "setegid(" << gid << ") for " << path << " device failed";
308 goto out;
309 }
310 /* If the node already exists update its SELinux label and the file mode to handle cases when
311 * it was created with the wrong context and file mode during coldboot procedure. */
312 if (mknod(path.c_str(), mode, dev) && (errno == EEXIST) && !secontext.empty()) {
313 char* fcon = nullptr;
314 int rc = lgetfilecon(path.c_str(), &fcon);
315 if (rc < 0) {
316 PLOG(ERROR) << "Cannot get SELinux label on '" << path << "' device";
317 goto out;
318 }
319
320 bool different = fcon != secontext;
321 freecon(fcon);
322
323 if (different && lsetfilecon(path.c_str(), secontext.c_str())) {
324 PLOG(ERROR) << "Cannot set '" << secontext << "' SELinux label on '" << path
325 << "' device";
326 }
327
328 struct stat s;
329 if (stat(path.c_str(), &s) == 0) {
330 if (gid != s.st_gid) {
331 new_group = gid;
332 }
333 if (mode != s.st_mode) {
334 if (chmod(path.c_str(), mode) != 0) {
335 PLOG(ERROR) << "Cannot chmod " << path << " to " << mode;
336 }
337 }
338 } else {
339 PLOG(ERROR) << "Cannot stat " << path;
340 }
341 }
342
343 out:
344 if (chown(path.c_str(), uid, new_group) < 0) {
345 PLOG(ERROR) << "Cannot chown " << path << " " << uid << " " << new_group;
346 }
347 if (setegid(AID_ROOT)) {
348 PLOG(FATAL) << "setegid(AID_ROOT) failed";
349 }
350
351 if (!secontext.empty()) {
352 setfscreatecon(nullptr);
353 }
354 }
355
356 // replaces any unacceptable characters with '_', the
357 // length of the resulting string is equal to the input string
SanitizePartitionName(std::string * string)358 void SanitizePartitionName(std::string* string) {
359 const char* accept =
360 "abcdefghijklmnopqrstuvwxyz"
361 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
362 "0123456789"
363 "_-.";
364
365 if (!string) return;
366
367 std::string::size_type pos = 0;
368 while ((pos = string->find_first_not_of(accept, pos)) != std::string::npos) {
369 (*string)[pos] = '_';
370 }
371 }
372
GetBlockDeviceSymlinks(const Uevent & uevent) const373 std::vector<std::string> DeviceHandler::GetBlockDeviceSymlinks(const Uevent& uevent) const {
374 std::string device;
375 std::string type;
376 std::string partition;
377 std::string uuid;
378
379 if (FindPlatformDevice(uevent.path, &device)) {
380 // Skip /devices/platform or /devices/ if present
381 static constexpr std::string_view devices_platform_prefix = "/devices/platform/";
382 static constexpr std::string_view devices_prefix = "/devices/";
383
384 if (StartsWith(device, devices_platform_prefix)) {
385 device = device.substr(devices_platform_prefix.length());
386 } else if (StartsWith(device, devices_prefix)) {
387 device = device.substr(devices_prefix.length());
388 }
389
390 type = "platform";
391 } else if (FindPciDevicePrefix(uevent.path, &device)) {
392 type = "pci";
393 } else if (FindVbdDevicePrefix(uevent.path, &device)) {
394 type = "vbd";
395 } else if (FindDmDevice(uevent, &partition, &uuid)) {
396 std::vector<std::string> symlinks = {"/dev/block/mapper/" + partition};
397 if (!uuid.empty()) {
398 symlinks.emplace_back("/dev/block/mapper/by-uuid/" + uuid);
399 }
400 return symlinks;
401 } else {
402 return {};
403 }
404
405 std::vector<std::string> links;
406
407 LOG(VERBOSE) << "found " << type << " device " << device;
408
409 auto link_path = "/dev/block/" + type + "/" + device;
410
411 bool is_boot_device = boot_devices_.find(device) != boot_devices_.end();
412 if (!uevent.partition_name.empty()) {
413 std::string partition_name_sanitized(uevent.partition_name);
414 SanitizePartitionName(&partition_name_sanitized);
415 if (partition_name_sanitized != uevent.partition_name) {
416 LOG(VERBOSE) << "Linking partition '" << uevent.partition_name << "' as '"
417 << partition_name_sanitized << "'";
418 }
419 links.emplace_back(link_path + "/by-name/" + partition_name_sanitized);
420 // Adds symlink: /dev/block/by-name/<partition_name>.
421 if (is_boot_device) {
422 links.emplace_back("/dev/block/by-name/" + partition_name_sanitized);
423 }
424 } else if (is_boot_device) {
425 // If we don't have a partition name but we are a partition on a boot device, create a
426 // symlink of /dev/block/by-name/<device_name> for symmetry.
427 links.emplace_back("/dev/block/by-name/" + uevent.device_name);
428 auto partition_name = GetPartitionNameForDevice(uevent.device_name);
429 if (!partition_name.empty()) {
430 links.emplace_back("/dev/block/by-name/" + partition_name);
431 }
432 }
433
434 std::string model;
435 if (ReadFileToString("/sys/class/block/" + uevent.device_name + "/queue/zoned", &model) &&
436 !StartsWith(model, "none")) {
437 links.emplace_back("/dev/block/by-name/zoned_device");
438 links.emplace_back("/dev/sys/block/by-name/zoned_device");
439 }
440
441 auto last_slash = uevent.path.rfind('/');
442 links.emplace_back(link_path + "/" + uevent.path.substr(last_slash + 1));
443
444 return links;
445 }
446
RemoveDeviceMapperLinks(const std::string & devpath)447 static void RemoveDeviceMapperLinks(const std::string& devpath) {
448 std::vector<std::string> dirs = {
449 "/dev/block/mapper",
450 "/dev/block/mapper/by-uuid",
451 };
452 for (const auto& dir : dirs) {
453 if (access(dir.c_str(), F_OK) != 0) continue;
454
455 std::unique_ptr<DIR, decltype(&closedir)> dh(opendir(dir.c_str()), closedir);
456 if (!dh) {
457 PLOG(ERROR) << "Failed to open directory " << dir;
458 continue;
459 }
460
461 struct dirent* dp;
462 std::string link_path;
463 while ((dp = readdir(dh.get())) != nullptr) {
464 if (dp->d_type != DT_LNK) continue;
465
466 auto path = dir + "/" + dp->d_name;
467 if (Readlink(path, &link_path) && link_path == devpath) {
468 unlink(path.c_str());
469 }
470 }
471 }
472 }
473
HandleDevice(const std::string & action,const std::string & devpath,bool block,int major,int minor,const std::vector<std::string> & links) const474 void DeviceHandler::HandleDevice(const std::string& action, const std::string& devpath, bool block,
475 int major, int minor, const std::vector<std::string>& links) const {
476 if (action == "add") {
477 MakeDevice(devpath, block, major, minor, links);
478 }
479
480 // Handle device-mapper nodes.
481 // On kernels <= 5.10, the "add" event is fired on DM_DEV_CREATE, but does not contain name
482 // information until DM_TABLE_LOAD - thus, we wait for a "change" event.
483 // On kernels >= 5.15, the "add" event is fired on DM_TABLE_LOAD, followed by a "change"
484 // event.
485 if (action == "add" || (action == "change" && StartsWith(devpath, "/dev/block/dm-"))) {
486 for (const auto& link : links) {
487 std::string target;
488 if (StartsWith(link, "/dev/block/")) {
489 target = devpath;
490 } else if (StartsWith(link, "/dev/sys/block/")) {
491 target = "/sys/class/block/" + Basename(devpath);
492 } else {
493 LOG(ERROR) << "Unrecognized link type: " << link;
494 continue;
495 }
496
497 if (!mkdir_recursive(Dirname(link), 0755)) {
498 PLOG(ERROR) << "Failed to create directory " << Dirname(link);
499 }
500
501 if (symlink(target.c_str(), link.c_str())) {
502 if (errno != EEXIST) {
503 PLOG(ERROR) << "Failed to symlink " << devpath << " to " << link;
504 } else if (std::string link_path;
505 Readlink(link, &link_path) && link_path != devpath) {
506 PLOG(ERROR) << "Failed to symlink " << devpath << " to " << link
507 << ", which already links to: " << link_path;
508 }
509 }
510 }
511 }
512
513 if (action == "remove") {
514 if (StartsWith(devpath, "/dev/block/dm-")) {
515 RemoveDeviceMapperLinks(devpath);
516 }
517 for (const auto& link : links) {
518 std::string link_path;
519 if (Readlink(link, &link_path) && link_path == devpath) {
520 unlink(link.c_str());
521 }
522 }
523 unlink(devpath.c_str());
524 }
525 }
526
HandleAshmemUevent(const Uevent & uevent)527 void DeviceHandler::HandleAshmemUevent(const Uevent& uevent) {
528 if (uevent.device_name == "ashmem") {
529 static const std::string boot_id_path = "/proc/sys/kernel/random/boot_id";
530 std::string boot_id;
531 if (!ReadFileToString(boot_id_path, &boot_id)) {
532 PLOG(ERROR) << "Cannot duplicate ashmem device node. Failed to read " << boot_id_path;
533 return;
534 };
535 boot_id = Trim(boot_id);
536
537 Uevent dup_ashmem_uevent = uevent;
538 dup_ashmem_uevent.device_name += boot_id;
539 dup_ashmem_uevent.path += boot_id;
540 HandleUevent(dup_ashmem_uevent);
541 }
542 }
543
HandleUevent(const Uevent & uevent)544 void DeviceHandler::HandleUevent(const Uevent& uevent) {
545 if (uevent.action == "add" || uevent.action == "change" ||
546 uevent.action == "bind" || uevent.action == "online") {
547 FixupSysPermissions(uevent.path, uevent.subsystem);
548 }
549
550 // if it's not a /dev device, nothing to do
551 if (uevent.major < 0 || uevent.minor < 0) return;
552
553 std::string devpath;
554 std::vector<std::string> links;
555 bool block = false;
556
557 if (uevent.subsystem == "block") {
558 block = true;
559 devpath = "/dev/block/" + Basename(uevent.path);
560
561 if (StartsWith(uevent.path, "/devices")) {
562 links = GetBlockDeviceSymlinks(uevent);
563 }
564 } else if (const auto subsystem =
565 std::find(subsystems_.cbegin(), subsystems_.cend(), uevent.subsystem);
566 subsystem != subsystems_.cend()) {
567 devpath = subsystem->ParseDevPath(uevent);
568 } else if (uevent.subsystem == "usb") {
569 if (!uevent.device_name.empty()) {
570 devpath = "/dev/" + uevent.device_name;
571 } else {
572 // This imitates the file system that would be created
573 // if we were using devfs instead.
574 // Minors are broken up into groups of 128, starting at "001"
575 int bus_id = uevent.minor / 128 + 1;
576 int device_id = uevent.minor % 128 + 1;
577 devpath = StringPrintf("/dev/bus/usb/%03d/%03d", bus_id, device_id);
578 }
579 } else if (StartsWith(uevent.subsystem, "usb")) {
580 // ignore other USB events
581 return;
582 } else if (uevent.subsystem == "misc" && StartsWith(uevent.device_name, "dm-user/")) {
583 devpath = "/dev/dm-user/" + uevent.device_name.substr(8);
584 } else if (uevent.subsystem == "misc" && uevent.device_name == "vfio/vfio") {
585 devpath = "/dev/" + uevent.device_name;
586 } else {
587 devpath = "/dev/" + Basename(uevent.path);
588 }
589
590 mkdir_recursive(Dirname(devpath), 0755);
591
592 HandleDevice(uevent.action, devpath, block, uevent.major, uevent.minor, links);
593
594 // Duplicate /dev/ashmem device and name it /dev/ashmem<boot_id>.
595 // TODO(b/111903542): remove once all users of /dev/ashmem are migrated to libcutils API.
596 HandleAshmemUevent(uevent);
597 }
598
ColdbootDone()599 void DeviceHandler::ColdbootDone() {
600 skip_restorecon_ = false;
601 }
602
DeviceHandler(std::vector<Permissions> dev_permissions,std::vector<SysfsPermissions> sysfs_permissions,std::vector<Subsystem> subsystems,std::set<std::string> boot_devices,bool skip_restorecon)603 DeviceHandler::DeviceHandler(std::vector<Permissions> dev_permissions,
604 std::vector<SysfsPermissions> sysfs_permissions,
605 std::vector<Subsystem> subsystems, std::set<std::string> boot_devices,
606 bool skip_restorecon)
607 : dev_permissions_(std::move(dev_permissions)),
608 sysfs_permissions_(std::move(sysfs_permissions)),
609 subsystems_(std::move(subsystems)),
610 boot_devices_(std::move(boot_devices)),
611 skip_restorecon_(skip_restorecon),
612 sysfs_mount_point_("/sys") {}
613
DeviceHandler()614 DeviceHandler::DeviceHandler()
615 : DeviceHandler(std::vector<Permissions>{}, std::vector<SysfsPermissions>{},
616 std::vector<Subsystem>{}, std::set<std::string>{}, false) {}
617
618 } // namespace init
619 } // namespace android
620