Skip to content

Commit

Permalink
Set UID for the logcat
Browse files Browse the repository at this point in the history
Required on latest Samsung devices on Nougat.
  • Loading branch information
rovo89 committed Oct 6, 2017
1 parent 150e75a commit 39b8b94
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xposed_logcat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/prctl.h>
#include <unistd.h>

#include "xposed.h"
Expand All @@ -33,7 +34,11 @@ char marker[50];

static void execLogcat() {
// Ensure that we're allowed to read all log entries
if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0) {
ALOGE("Failed to keep capabilities: %s", strerror(errno));
}
setresgid(AID_LOG, AID_LOG, AID_LOG);
setresuid(AID_LOG, AID_LOG, AID_LOG);
int8_t keep[] = { CAP_SYSLOG, -1 };
xposed::dropCapabilities(keep);

Expand Down

0 comments on commit 39b8b94

Please sign in to comment.