summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Swierczek <t.swierczek@samsung.com>2024-07-08 09:40:50 +0200
committerTomasz Swierczek <t.swierczek@samsung.com>2024-07-08 11:26:02 +0200
commit6eb9b744aca11f7eb427c5fb42d39ac23dca2d0a (patch)
tree11d19a6a0cf4c0dad54acbced044985d7e90a603
parent6fb3b38cdd65f104de1c61321bc15ce5c9a6672d (diff)
downloadsecurity-manager-6eb9b744aca11f7eb427c5fb42d39ac23dca2d0a.tar.gz
security-manager-6eb9b744aca11f7eb427c5fb42d39ac23dca2d0a.tar.bz2
security-manager-6eb9b744aca11f7eb427c5fb42d39ac23dca2d0a.zip
Add more warning logs for performance analysis on release builds
Change-Id: Ie83e2768d4da2208e1e4666b2c1969b2c38e2a6a
-rw-r--r--src/common/service_impl.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp
index 71e748c3..9c8ae492 100644
--- a/src/common/service_impl.cpp
+++ b/src/common/service_impl.cpp
@@ -361,11 +361,13 @@ int ServiceImpl::labelPaths(const pkg_paths &paths,
return ret;
}
+ LogWarning("Determinig if paths are legal");
// check if paths are inside of legal directories
if (!pathsCheck(paths, pkgLegalBaseDirs))
return SECURITY_MANAGER_ERROR_NOT_PATH_OWNER;
if (isSharedRO) {
+ LogWarning("Labeling shared_ro paths");
// Label shared_ro base paths for bind mounting
labelSharedPaths(homePath, pkgName);
// If there are corresponding paths in skel, label them too
@@ -373,12 +375,14 @@ int ServiceImpl::labelPaths(const pkg_paths &paths,
labelSharedPaths(skelDir, pkgName);
}
// register paths
+ LogWarning("Labeling other paths");
for (const auto &pkgPath : paths) {
const std::string &path = pkgPath.first;
app_install_path_type pathType = static_cast<app_install_path_type>(pkgPath.second);
SmackLabels::setupPath(pkgName, path, pathType, authorHash);
}
+ LogWarning("Labeling base paths");
for (const auto &basePath : pkgLegalBaseDirs) {
if (containSubDir(basePath, paths)) {
SmackLabels::setupPkgBasePath(basePath);
@@ -568,6 +572,7 @@ int ServiceImpl::appInstall(const Credentials &creds, app_inst_req &req)
try {
// initial checks
+ LogWarning("appInstall started for pkg " << req.pkgName << ", checking package in DB started...");
ret = appInstallInitialChecks(creds, req);
if (ret != SECURITY_MANAGER_SUCCESS)
return ret;
@@ -594,12 +599,15 @@ int ServiceImpl::appInstall(const Credentials &creds, app_inst_req &req)
for (auto &app : req.apps) {
// [db] add app
+ LogWarning("Adding privileges for app " << app.appName << " into security-manager's db");
appInstallPrivileges(app, req, ih);
// [cynara] update app policy
+ LogWarning("Configuring privileges for app " << app.appName << " in cynara");
appInstallCynaraPolicies(app, req, ih);
}
// [db] update shared ro
+ LogWarning("Configuring SharedRO status");
bool isAppSharedRO = isSharedRO(req.pkgPaths);
if (isAppSharedRO)
m_privilegeDb.SetSharedROPackage(req.pkgName);
@@ -608,6 +616,7 @@ int ServiceImpl::appInstall(const Credentials &creds, app_inst_req &req)
trans.commit();
LogDebug("Application installation commited to database");
+ LogWarning("Configuring permissible file");
Smack::Labels newLabels;
getPkgLabels(req.pkgName, newLabels);
@@ -615,6 +624,7 @@ int ServiceImpl::appInstall(const Credentials &creds, app_inst_req &req)
tryUpdatePermissibleFile(req.uid, req.installationType, newLabels, oldLabels);
// label paths
+ LogWarning("Configuring package paths");
ret = labelPaths(req.pkgPaths,
req.pkgName,
static_cast<app_install_type>(req.installationType),
@@ -624,7 +634,9 @@ int ServiceImpl::appInstall(const Credentials &creds, app_inst_req &req)
return ret;
// apply and merge Smack rules for apps and pkg
+ LogWarning("Configuring smack rules for package");
ret = appInstallSmackRules(req, ih);
+ LogWarning("End of app registration in security-manager (server side)");
return ret;
} catch (const PrivilegeDb::Exception::IOError &e) {
LogError("Cannot access application database: " << e.DumpToString());
@@ -664,6 +676,7 @@ int ServiceImpl::appUpdate(const Credentials &creds, app_inst_req &req)
try {
// initial checks
+ LogWarning("appUpdate started for pkg " << req.pkgName << ", checking package in DB started...");
ret = appInstallInitialChecks(creds, req);
if (ret != SECURITY_MANAGER_SUCCESS)
return ret;
@@ -675,6 +688,7 @@ int ServiceImpl::appUpdate(const Credentials &creds, app_inst_req &req)
Smack::Labels oldLabels;
if (ih.isUserPkgInstalled) {
+ LogWarning("Package already installed, need to remove some packages");
getPkgLabels(req.pkgName, oldLabels);
// search for installed apps in the request
std::vector<std::string> requestedApps;
@@ -701,6 +715,7 @@ int ServiceImpl::appUpdate(const Credentials &creds, app_inst_req &req)
app_inst_req::app tmpApp;
tmpApp.appName = appName;
reqUninstall.apps.push_back(tmpApp);
+ LogWarning("app to uninstall: " << appName);
}
appUninstall(creds, reqUninstall);
}
@@ -711,12 +726,15 @@ int ServiceImpl::appUpdate(const Credentials &creds, app_inst_req &req)
for (auto &app : req.apps) {
// [db] add app
+ LogWarning("Adding privileges for app " << app.appName << " into security-manager's db");
appInstallPrivileges(app, req, ih);
// [cynara] update app policy
+ LogWarning("Configuring privileges for app " << app.appName << " in cynara");
appInstallCynaraPolicies(app, req, ih);
}
// [db] update shared ro
+ LogWarning("Configuring SharedRO status");
bool isAppSharedRO = isSharedRO(req.pkgPaths);
m_privilegeDb.SetSharedROPackage(req.pkgName, isAppSharedRO);
@@ -729,9 +747,11 @@ int ServiceImpl::appUpdate(const Credentials &creds, app_inst_req &req)
getPkgLabels(req.pkgName, newLabels);
// update permissible set
+ LogWarning("Configuring permissible file");
tryUpdatePermissibleFile(req.uid, req.installationType, newLabels, oldLabels);
// label paths
+ LogWarning("Configuring package paths");
ret = labelPaths(req.pkgPaths,
req.pkgName,
static_cast<app_install_type>(req.installationType),
@@ -741,7 +761,9 @@ int ServiceImpl::appUpdate(const Credentials &creds, app_inst_req &req)
return ret;
// apply and merge Smack rules for apps and pkg
+ LogWarning("Configuring smack rules for package");
ret = appInstallSmackRules(req, ih);
+ LogWarning("End of app registration in security-manager (server side)");
return ret;
} catch (const PrivilegeDb::Exception::IOError &e) {
LogError("Cannot access application database: " << e.DumpToString());