From 66f49dfab51b4144f4bd9cbb27502bd07f66bf44 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 24 Feb 2024 04:20:28 -0800 Subject: [PATCH] Remove unnecessary lock usage --- native/src/sepolicy/include/sepolicy.hpp | 3 --- native/src/sepolicy/rules.cpp | 8 +++++--- native/src/sepolicy/statement.cpp | 7 ------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/native/src/sepolicy/include/sepolicy.hpp b/native/src/sepolicy/include/sepolicy.hpp index 836c6ada4..69d6f048f 100644 --- a/native/src/sepolicy/include/sepolicy.hpp +++ b/native/src/sepolicy/include/sepolicy.hpp @@ -24,10 +24,7 @@ using token_list = std::vector; using argument = std::pair; using argument_list = std::vector; -const argument &all_xperm(); - #define ALL nullptr -#define ALL_XPERM all_xperm() struct sepolicy { using c_str = const char *; diff --git a/native/src/sepolicy/rules.cpp b/native/src/sepolicy/rules.cpp index 377070703..68031f0fd 100644 --- a/native/src/sepolicy/rules.cpp +++ b/native/src/sepolicy/rules.cpp @@ -26,9 +26,11 @@ void sepolicy::magisk_rules() { allow(SEPOL_PROC_DOMAIN, ALL, ALL, ALL); // Allow us to do any ioctl if (impl->db->policyvers >= POLICYDB_VERSION_XPERMS_IOCTL) { - allowxperm(SEPOL_PROC_DOMAIN, ALL, "blk_file", ALL_XPERM); - allowxperm(SEPOL_PROC_DOMAIN, ALL, "fifo_file", ALL_XPERM); - allowxperm(SEPOL_PROC_DOMAIN, ALL, "chr_file", ALL_XPERM); + argument all; + all.first.push_back(nullptr); + allowxperm(SEPOL_PROC_DOMAIN, ALL, "blk_file", all); + allowxperm(SEPOL_PROC_DOMAIN, ALL, "fifo_file", all); + allowxperm(SEPOL_PROC_DOMAIN, ALL, "chr_file", all); } // Create unconstrained file type diff --git a/native/src/sepolicy/statement.cpp b/native/src/sepolicy/statement.cpp index 5e7b488c8..e6553c5c2 100644 --- a/native/src/sepolicy/statement.cpp +++ b/native/src/sepolicy/statement.cpp @@ -8,13 +8,6 @@ using namespace std; -const argument &all_xperm() { - static argument arg; - if (arg.first.empty()) - arg.first.push_back(nullptr); - return arg; -} - static const char *type_msg_1 = R"EOF("allow *source_type *target_type *class *perm_set" "deny *source_type *target_type *class *perm_set"