Loading cmds/dumpstate/DumpstateInternal.cpp +18 −6 Original line number Diff line number Diff line Loading @@ -98,13 +98,25 @@ bool DropRootUser() { capheader.version = _LINUX_CAPABILITY_VERSION_3; capheader.pid = 0; capdata[CAP_TO_INDEX(CAP_SYSLOG)].permitted = CAP_TO_MASK(CAP_SYSLOG); capdata[CAP_TO_INDEX(CAP_SYSLOG)].effective = CAP_TO_MASK(CAP_SYSLOG); capdata[0].inheritable = 0; capdata[1].inheritable = 0; if (capget(&capheader, &capdata[0]) != 0) { MYLOGE("capget failed: %s\n", strerror(errno)); return false; } const uint32_t cap_syslog_mask = CAP_TO_MASK(CAP_SYSLOG); const uint32_t cap_syslog_index = CAP_TO_INDEX(CAP_SYSLOG); bool has_cap_syslog = (capdata[cap_syslog_index].effective & cap_syslog_mask) != 0; memset(&capdata, 0, sizeof(capdata)); if (has_cap_syslog) { // Only attempt to keep CAP_SYSLOG if it was present to begin with. capdata[cap_syslog_index].permitted |= cap_syslog_mask; capdata[cap_syslog_index].effective |= cap_syslog_mask; } if (capset(&capheader, &capdata[0]) < 0) { MYLOGE("capset failed: %s\n", strerror(errno)); if (capset(&capheader, &capdata[0]) != 0) { MYLOGE("capset({%#x, %#x}) failed: %s\n", capdata[0].effective, capdata[1].effective, strerror(errno)); return false; } Loading cmds/dumpstate/dumpstate.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -176,6 +176,11 @@ static std::vector<DumpData>* GetDumpFds(const std::string& dir_path, std::unique_ptr<std::vector<DumpData>> dump_data(new std::vector<DumpData>()); std::unique_ptr<DIR, decltype(&closedir)> dump_dir(opendir(dir_path.c_str()), closedir); if (dump_dir == nullptr) { MYLOGW("Unable to open directory %s: %s\n", dir_path.c_str(), strerror(errno)); return dump_data.release(); } struct dirent* entry = nullptr; while ((entry = readdir(dump_dir.get()))) { if (entry->d_type != DT_REG) { Loading @@ -191,13 +196,13 @@ static std::vector<DumpData>* GetDumpFds(const std::string& dir_path, android::base::unique_fd fd( TEMP_FAILURE_RETRY(open(abs_path.c_str(), O_RDONLY | O_CLOEXEC | O_NOFOLLOW | O_NONBLOCK))); if (fd == -1) { MYLOGW("Unable to open dump file: %s %s\n", abs_path.c_str(), strerror(errno)); MYLOGW("Unable to open dump file %s: %s\n", abs_path.c_str(), strerror(errno)); break; } struct stat st = {}; if (fstat(fd, &st) == -1) { MYLOGW("Unable to stat dump file: %s %s\n", abs_path.c_str(), strerror(errno)); MYLOGW("Unable to stat dump file %s: %s\n", abs_path.c_str(), strerror(errno)); continue; } Loading cmds/lshal/ListCommand.cpp +7 −6 Original line number Diff line number Diff line Loading @@ -280,7 +280,8 @@ void ListCommand::postprocess() { "The Clients / Clients CMD column shows all process that have ever dlopen'ed \n" "the library and successfully fetched the passthrough implementation."); mImplementationsTable.setDescription( "All available passthrough implementations (all -impl.so files)"); "All available passthrough implementations (all -impl.so files).\n" "These may return subclasses through their respective HIDL_FETCH_I* functions."); } static inline bool findAndBumpVersion(vintf::ManifestHal* hal, const vintf::Version& version) { Loading Loading @@ -394,11 +395,11 @@ void ListCommand::dumpVintf(const NullableOStream<std::ostream>& out) const { interfaces[interfaceName].instances.insert(instanceName); } if (!manifest.add(vintf::ManifestHal{ .format = vintf::HalFormat::HIDL, .name = fqName.package(), .versions = {version}, .transportArch = {transport, arch}, .interfaces = interfaces})) { vintf::HalFormat::HIDL, std::string{fqName.package()}, {version}, {transport, arch}, std::move(interfaces)})) { err() << "Warning: cannot add hal '" << fqInstanceName << "'" << std::endl; } } Loading libs/vr/libpdx_uds/service_endpoint.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -594,9 +594,10 @@ Status<void> Endpoint::MessageReceive(Message* message) { if (socket_fd_ && event.data.fd == socket_fd_.Get()) { auto status = AcceptConnection(message); if (!status) auto reenable_status = ReenableEpollEvent(socket_fd_.Borrow()); if (!reenable_status) return reenable_status; return status; return ReenableEpollEvent(socket_fd_.Borrow()); } BorrowedHandle channel_fd{event.data.fd}; Loading Loading
cmds/dumpstate/DumpstateInternal.cpp +18 −6 Original line number Diff line number Diff line Loading @@ -98,13 +98,25 @@ bool DropRootUser() { capheader.version = _LINUX_CAPABILITY_VERSION_3; capheader.pid = 0; capdata[CAP_TO_INDEX(CAP_SYSLOG)].permitted = CAP_TO_MASK(CAP_SYSLOG); capdata[CAP_TO_INDEX(CAP_SYSLOG)].effective = CAP_TO_MASK(CAP_SYSLOG); capdata[0].inheritable = 0; capdata[1].inheritable = 0; if (capget(&capheader, &capdata[0]) != 0) { MYLOGE("capget failed: %s\n", strerror(errno)); return false; } const uint32_t cap_syslog_mask = CAP_TO_MASK(CAP_SYSLOG); const uint32_t cap_syslog_index = CAP_TO_INDEX(CAP_SYSLOG); bool has_cap_syslog = (capdata[cap_syslog_index].effective & cap_syslog_mask) != 0; memset(&capdata, 0, sizeof(capdata)); if (has_cap_syslog) { // Only attempt to keep CAP_SYSLOG if it was present to begin with. capdata[cap_syslog_index].permitted |= cap_syslog_mask; capdata[cap_syslog_index].effective |= cap_syslog_mask; } if (capset(&capheader, &capdata[0]) < 0) { MYLOGE("capset failed: %s\n", strerror(errno)); if (capset(&capheader, &capdata[0]) != 0) { MYLOGE("capset({%#x, %#x}) failed: %s\n", capdata[0].effective, capdata[1].effective, strerror(errno)); return false; } Loading
cmds/dumpstate/dumpstate.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -176,6 +176,11 @@ static std::vector<DumpData>* GetDumpFds(const std::string& dir_path, std::unique_ptr<std::vector<DumpData>> dump_data(new std::vector<DumpData>()); std::unique_ptr<DIR, decltype(&closedir)> dump_dir(opendir(dir_path.c_str()), closedir); if (dump_dir == nullptr) { MYLOGW("Unable to open directory %s: %s\n", dir_path.c_str(), strerror(errno)); return dump_data.release(); } struct dirent* entry = nullptr; while ((entry = readdir(dump_dir.get()))) { if (entry->d_type != DT_REG) { Loading @@ -191,13 +196,13 @@ static std::vector<DumpData>* GetDumpFds(const std::string& dir_path, android::base::unique_fd fd( TEMP_FAILURE_RETRY(open(abs_path.c_str(), O_RDONLY | O_CLOEXEC | O_NOFOLLOW | O_NONBLOCK))); if (fd == -1) { MYLOGW("Unable to open dump file: %s %s\n", abs_path.c_str(), strerror(errno)); MYLOGW("Unable to open dump file %s: %s\n", abs_path.c_str(), strerror(errno)); break; } struct stat st = {}; if (fstat(fd, &st) == -1) { MYLOGW("Unable to stat dump file: %s %s\n", abs_path.c_str(), strerror(errno)); MYLOGW("Unable to stat dump file %s: %s\n", abs_path.c_str(), strerror(errno)); continue; } Loading
cmds/lshal/ListCommand.cpp +7 −6 Original line number Diff line number Diff line Loading @@ -280,7 +280,8 @@ void ListCommand::postprocess() { "The Clients / Clients CMD column shows all process that have ever dlopen'ed \n" "the library and successfully fetched the passthrough implementation."); mImplementationsTable.setDescription( "All available passthrough implementations (all -impl.so files)"); "All available passthrough implementations (all -impl.so files).\n" "These may return subclasses through their respective HIDL_FETCH_I* functions."); } static inline bool findAndBumpVersion(vintf::ManifestHal* hal, const vintf::Version& version) { Loading Loading @@ -394,11 +395,11 @@ void ListCommand::dumpVintf(const NullableOStream<std::ostream>& out) const { interfaces[interfaceName].instances.insert(instanceName); } if (!manifest.add(vintf::ManifestHal{ .format = vintf::HalFormat::HIDL, .name = fqName.package(), .versions = {version}, .transportArch = {transport, arch}, .interfaces = interfaces})) { vintf::HalFormat::HIDL, std::string{fqName.package()}, {version}, {transport, arch}, std::move(interfaces)})) { err() << "Warning: cannot add hal '" << fqInstanceName << "'" << std::endl; } } Loading
libs/vr/libpdx_uds/service_endpoint.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -594,9 +594,10 @@ Status<void> Endpoint::MessageReceive(Message* message) { if (socket_fd_ && event.data.fd == socket_fd_.Get()) { auto status = AcceptConnection(message); if (!status) auto reenable_status = ReenableEpollEvent(socket_fd_.Borrow()); if (!reenable_status) return reenable_status; return status; return ReenableEpollEvent(socket_fd_.Borrow()); } BorrowedHandle channel_fd{event.data.fd}; Loading