CKM: Gdbbacktrace tries to become root 15/39915/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 26 May 2015 09:51:44 +0000 (11:51 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 26 May 2015 09:55:41 +0000 (11:55 +0200)
[Problem] When gdbbacktrace is executed as ordinary user it has no permissions
to attach with gdb or unlink output file.
[Solution] Add seteuid/gid(0) in the beginning of gdbbacktrace.

[Verification] Run any failing test that uses ScopedAccessProvider with uid/gid
There should be no "gdbbacktrace() failed: No backtrace information"

Change-Id: I8997ad1d8d1368402333e40b55ee4f5cb1b79005

src/framework/src/gdbbacktrace.cpp

index 4d84cd0..7443252 100644 (file)
@@ -141,6 +141,9 @@ std::string gdbbacktrace(void)
 {
     std::string ret;
 
+    // Try to become root again so gdb and unlink is possible
+    setegid(0);
+    seteuid(0);
     pid_t childPid = fork();
     switch (childPid) {
         case -1: