| 64 | static const std::string adbPathPrefix = "/data/adb"; |
| 65 | |
| 66 | static bool anomaly(MountRootResolver mrs, const MountInfo &mount) { |
| 67 | const std::string resolved_root = mrs.resolveRoot(mount); |
| 68 | if (resolved_root.starts_with(adbPathPrefix) || mount.getMountPoint().starts_with(adbPathPrefix)) { |
| 69 | return true; |
| 70 | } |
| 71 | const auto& fs_type = mount.getFsType(); |
| 72 | const auto& mnt_src = mount.getMountSource(); |
| 73 | if (toumount_sources.count(mnt_src)) { |
| 74 | return true; |
| 75 | } |
| 76 | if (fs_type == "overlay") { |
| 77 | if (toumount_sources.count(mnt_src)) { |
| 78 | return true; |
| 79 | } |
| 80 | const auto& fm = mount.getMountOptions().flagmap; |
| 81 | if (fm.count("lowerdir") && fm.at("lowerdir").starts_with(adbPathPrefix)) { |
| 82 | return true; |
| 83 | } |
| 84 | if (fm.count("upperdir") && fm.at("upperdir").starts_with(adbPathPrefix)) { |
| 85 | return true; |
| 86 | } |
| 87 | if (fm.count("workdir") && fm.at("workdir").starts_with(adbPathPrefix)) { |
| 88 | return true; |
| 89 | } |
| 90 | } else if (fs_type == "tmpfs") { |
| 91 | if (toumount_sources.count(mnt_src)) { |
| 92 | return true; |
| 93 | } |
| 94 | } |
| 95 | return false; |
| 96 | } |
| 97 | |
| 98 | static bool anomaly(const MountRuleParser::MountRule& rule, MountRootResolver mrs, const MountInfo &mount) { |
| 99 | const std::string resolvedRoot = mrs.resolveRoot(mount); |
no test coverage detected