From: seolheui, kim Date: Mon, 14 Jan 2019 07:37:54 +0000 (+0900) Subject: Stop units with the same pid and pgid X-Git-Tag: submit/tizen_4.0/20190130.090735~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F197575%2F6;p=platform%2Fcore%2Fsecurity%2Fode.git Stop units with the same pid and pgid Change-Id: I4ddba0760664ebb5424d623c93a9bd26d83951c6 Signed-off-by: seolheui, kim --- diff --git a/server/internal-encryption.cpp b/server/internal-encryption.cpp index b2de48a..d27fda9 100644 --- a/server/internal-encryption.cpp +++ b/server/internal-encryption.cpp @@ -208,6 +208,12 @@ void stopSystemdUnits() } for (pid_t pid : runtime::FileUser::getList(INTERNAL_PATH, true)) { + auto pgid = ::getpgid(pid); + if (pgid > 0 && pid != pgid) { + WARN(SINK, "PGID doesn't match - pgid : " + std::to_string(pgid) + ", pid : " + std::to_string(pid)); + continue; + } + try { char *unit = nullptr; systemDBus.methodcall("org.freedesktop.systemd1", @@ -227,8 +233,7 @@ void stopSystemdUnits() std::string unescapedName(tmp); free(tmp); - if (unescapedName.find("dbus", 0, 4) == std::string::npos) - unitsToStop.insert(unescapedName); + unitsToStop.insert(unescapedName); } catch (runtime::Exception &e) { ERROR(SINK, "Killing process: " + std::to_string(pid)); ::kill(pid, SIGKILL);