Loading init/builtins.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -205,7 +205,7 @@ static int do_mkdir(const std::vector<std::string>& args) { mode = std::strtoul(args[2].c_str(), 0, 8); } ret = make_dir(args[1].c_str(), mode); ret = make_dir(args[1].c_str(), mode, sehandle); /* chmod in case the directory already exists */ if (ret == -1 && errno == EEXIST) { ret = fchmodat(AT_FDCWD, args[1].c_str(), mode, AT_SYMLINK_NOFOLLOW); Loading Loading @@ -809,7 +809,7 @@ static int do_wait_for_prop(const std::vector<std::string>& args) { * Callback to make a directory from the ext4 code */ static int do_installkeys_ensure_dir_exists(const char* dir) { if (make_dir(dir, 0700) && errno != EEXIST) { if (make_dir(dir, 0700, sehandle) && errno != EEXIST) { return -1; } Loading init/descriptors.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ int SocketInfo::Create(const std::string& context) const { int flags = ((type() == "stream" ? SOCK_STREAM : (type() == "dgram" ? SOCK_DGRAM : SOCK_SEQPACKET))); return create_socket(name().c_str(), flags, perm(), uid(), gid(), context.c_str()); return create_socket(name().c_str(), flags, perm(), uid(), gid(), context.c_str(), sehandle); } const std::string SocketInfo::key() const { Loading init/devices.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -54,7 +54,11 @@ #include "ueventd.h" #include "util.h" extern struct selabel_handle *sehandle; #ifdef _INIT_INIT_H #error "Do not include init.h in files used by ueventd or watchdogd; it will expose init's globals" #endif static selabel_handle* sehandle; static android::base::unique_fd device_fd; Loading Loading @@ -554,7 +558,7 @@ std::vector<std::string> get_block_device_symlinks(uevent* uevent) { } static void make_link_init(const std::string& oldpath, const std::string& newpath) { if (mkdir_recursive(dirname(newpath.c_str()), 0755)) { if (mkdir_recursive(dirname(newpath.c_str()), 0755, sehandle)) { PLOG(ERROR) << "Failed to create directory " << dirname(newpath.c_str()); } Loading Loading @@ -599,7 +603,7 @@ static void handle_block_device_event(uevent* uevent) { if (uevent->major < 0 || uevent->minor < 0) return; const char* base = "/dev/block/"; make_dir(base, 0755); make_dir(base, 0755, sehandle); std::string name = android::base::Basename(uevent->path); std::string devpath = base + name; Loading Loading @@ -641,7 +645,7 @@ static void handle_generic_device_event(uevent* uevent) { devpath = "/dev/" + android::base::Basename(uevent->path); } mkdir_recursive(android::base::Dirname(devpath), 0755); mkdir_recursive(android::base::Dirname(devpath), 0755, sehandle); auto links = get_character_device_symlinks(uevent); Loading init/init.h +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,9 @@ #include <string> // Note: These globals are *only* valid in init, so they should not be used in ueventd, // watchdogd, or any files that may be included in those, such as devices.cpp and util.cpp. // TODO: Have an Init class and remove all globals. extern const char *ENV[32]; extern std::string default_console; extern struct selabel_handle *sehandle; Loading init/property_service.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -659,7 +659,7 @@ void start_property_service() { property_set("ro.property_service.version", "2"); property_set_fd = create_socket(PROP_SERVICE_NAME, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0666, 0, 0, NULL); 0666, 0, 0, nullptr, sehandle); if (property_set_fd == -1) { PLOG(ERROR) << "start_property_service socket creation failed"; exit(1); Loading Loading
init/builtins.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -205,7 +205,7 @@ static int do_mkdir(const std::vector<std::string>& args) { mode = std::strtoul(args[2].c_str(), 0, 8); } ret = make_dir(args[1].c_str(), mode); ret = make_dir(args[1].c_str(), mode, sehandle); /* chmod in case the directory already exists */ if (ret == -1 && errno == EEXIST) { ret = fchmodat(AT_FDCWD, args[1].c_str(), mode, AT_SYMLINK_NOFOLLOW); Loading Loading @@ -809,7 +809,7 @@ static int do_wait_for_prop(const std::vector<std::string>& args) { * Callback to make a directory from the ext4 code */ static int do_installkeys_ensure_dir_exists(const char* dir) { if (make_dir(dir, 0700) && errno != EEXIST) { if (make_dir(dir, 0700, sehandle) && errno != EEXIST) { return -1; } Loading
init/descriptors.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ int SocketInfo::Create(const std::string& context) const { int flags = ((type() == "stream" ? SOCK_STREAM : (type() == "dgram" ? SOCK_DGRAM : SOCK_SEQPACKET))); return create_socket(name().c_str(), flags, perm(), uid(), gid(), context.c_str()); return create_socket(name().c_str(), flags, perm(), uid(), gid(), context.c_str(), sehandle); } const std::string SocketInfo::key() const { Loading
init/devices.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -54,7 +54,11 @@ #include "ueventd.h" #include "util.h" extern struct selabel_handle *sehandle; #ifdef _INIT_INIT_H #error "Do not include init.h in files used by ueventd or watchdogd; it will expose init's globals" #endif static selabel_handle* sehandle; static android::base::unique_fd device_fd; Loading Loading @@ -554,7 +558,7 @@ std::vector<std::string> get_block_device_symlinks(uevent* uevent) { } static void make_link_init(const std::string& oldpath, const std::string& newpath) { if (mkdir_recursive(dirname(newpath.c_str()), 0755)) { if (mkdir_recursive(dirname(newpath.c_str()), 0755, sehandle)) { PLOG(ERROR) << "Failed to create directory " << dirname(newpath.c_str()); } Loading Loading @@ -599,7 +603,7 @@ static void handle_block_device_event(uevent* uevent) { if (uevent->major < 0 || uevent->minor < 0) return; const char* base = "/dev/block/"; make_dir(base, 0755); make_dir(base, 0755, sehandle); std::string name = android::base::Basename(uevent->path); std::string devpath = base + name; Loading Loading @@ -641,7 +645,7 @@ static void handle_generic_device_event(uevent* uevent) { devpath = "/dev/" + android::base::Basename(uevent->path); } mkdir_recursive(android::base::Dirname(devpath), 0755); mkdir_recursive(android::base::Dirname(devpath), 0755, sehandle); auto links = get_character_device_symlinks(uevent); Loading
init/init.h +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,9 @@ #include <string> // Note: These globals are *only* valid in init, so they should not be used in ueventd, // watchdogd, or any files that may be included in those, such as devices.cpp and util.cpp. // TODO: Have an Init class and remove all globals. extern const char *ENV[32]; extern std::string default_console; extern struct selabel_handle *sehandle; Loading
init/property_service.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -659,7 +659,7 @@ void start_property_service() { property_set("ro.property_service.version", "2"); property_set_fd = create_socket(PROP_SERVICE_NAME, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0666, 0, 0, NULL); 0666, 0, 0, nullptr, sehandle); if (property_set_fd == -1) { PLOG(ERROR) << "start_property_service socket creation failed"; exit(1); Loading