diff options
| author | Tom Cherry <tomcherry@google.com> | 2017-05-01 17:10:09 -0700 |
|---|---|---|
| committer | Tom Cherry <tomcherry@google.com> | 2017-05-01 17:22:49 -0700 |
| commit | e7656b7200d934d6f77df422d6d3dee469230dea (patch) | |
| tree | 9ef0aa7484486d201006d9dfd6f9deb03db0fc1b /init/util_test.cpp | |
| parent | 6a8314c8bfa4a182ddf560609ebb514ec30b32bf (diff) | |
| download | system_core-e7656b7200d934d6f77df422d6d3dee469230dea.tar.gz system_core-e7656b7200d934d6f77df422d6d3dee469230dea.tar.bz2 system_core-e7656b7200d934d6f77df422d6d3dee469230dea.zip | |
ueventd: do not reference init's sehandle
Init exposes a global 'sehandle' that ueventd references as part of
devices.cpp and util.cpp. This is particularly dangerous in
device_init() in which both uevent and init write to this global.
This change creates a separate local copy for devices.cpp and puts
restrictions on where init.h can be included to make sure the global
used by init is not reference by non-init code. Future changes to
init should remove this global.
Test: Boot bullhead
Change-Id: Ifefa9e1932e9d647d06cca2618f5c8e5a7a85460
Diffstat (limited to 'init/util_test.cpp')
| -rw-r--r-- | init/util_test.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/init/util_test.cpp b/init/util_test.cpp index b8b409a1a..ac23a326e 100644 --- a/init/util_test.cpp +++ b/init/util_test.cpp @@ -128,15 +128,10 @@ TEST(util, is_dir) { EXPECT_FALSE(is_dir(tf.path)); } -// sehandle is needed for make_dir() -// TODO: Remove once sehandle is encapsulated -#include <selinux/label.h> -selabel_handle* sehandle; - TEST(util, mkdir_recursive) { TemporaryDir test_dir; std::string path = android::base::StringPrintf("%s/three/directories/deep", test_dir.path); - EXPECT_EQ(0, mkdir_recursive(path, 0755)); + EXPECT_EQ(0, mkdir_recursive(path, 0755, nullptr)); std::string path1 = android::base::StringPrintf("%s/three", test_dir.path); EXPECT_TRUE(is_dir(path1.c_str())); std::string path2 = android::base::StringPrintf("%s/three/directories", test_dir.path); @@ -148,7 +143,7 @@ TEST(util, mkdir_recursive) { TEST(util, mkdir_recursive_extra_slashes) { TemporaryDir test_dir; std::string path = android::base::StringPrintf("%s/three////directories/deep//", test_dir.path); - EXPECT_EQ(0, mkdir_recursive(path, 0755)); + EXPECT_EQ(0, mkdir_recursive(path, 0755, nullptr)); std::string path1 = android::base::StringPrintf("%s/three", test_dir.path); EXPECT_TRUE(is_dir(path1.c_str())); std::string path2 = android::base::StringPrintf("%s/three/directories", test_dir.path); |
