The debug pipe created in the candidate process has a "User" label.
As a result, smack deny occurs when app process try to access the debug pipe.
Also, since debugging is performed only in standalone mode, the debug pipe does not be used in the candidate process
#include <dlfcn.h>
#include <signal.h>
#include <dlfcn.h>
#include <signal.h>
#include <string>
#include <fstream>
#include <string>
#include <fstream>
+static void removeDebugPipe()
+{
+ DIR *dir;
+ struct dirent* entry;
+ char debugPipeFiles[PATH_MAX];;
+ sprintf(debugPipeFiles, "/tmp/clr-debug-pipe-%d-", getpid());
+
+ dir = opendir("/tmp");
+ if (dir == nullptr) {
+ _ERR("Fail to open /tmp directory");
+ return;
+ }
+
+ while ((entry = readdir(dir)) != nullptr) {
+ std::string path = concatPath("/tmp", entry->d_name);
+ if (path.find(debugPipeFiles) != std::string::npos) {
+ if (!removeFile(path)) {
+ _ERR("Fail to remove file (%s)", path.c_str());
+ }
+ }
+ }
+
+ closedir(dir);
+}
+
void preload()
{
typedef void (*PreloadDelegate)();
void preload()
{
typedef void (*PreloadDelegate)();
// preload libraries and manage dlls for optimizing startup time
preload();
// preload libraries and manage dlls for optimizing startup time
preload();
+
+ // The debug pipe created in the candidate process has a "User" label.
+ // As a result, smack deny occurs when app process try to access the debug pipe.
+ // Also, since debugging is performed only in standalone mode,
+ // the debug pipe doesnot be used in the candidate process.
+ // So, to avoid smack deny error, delete unused debug pipe files.
+ removeDebugPipe();