Search code examples
androidpermissionsadbstraceuid

Uid issues between two applications for the 'strace' command


I'm going to use the strace -p <myPid> command between two applications.

However, strace command does not work with other applications (it works well for itself).

This is the error message:

attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted
Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf

If the command error occurs because of the difference of uid, can I fix modifies the uid?

Or is there any other solutions?


Solution

  • I did not exactly resolve on this issue, there are some problems figured out.

    This issue is associated with setUid permission and android SE.

    First of all, then build a android version 4.0.3, so I flashed an image file to a reference Phone.

    And after giving the permission of setUid STRACE, it works well.(android SE was released above 4.3)

    However, version 4.4.2 android SE were blocking the access process. (Galaxy series can not be released because the android SE and KNOX interact with each other.)

    Unfortunately, now I don't have an extra reference phone, turn off the android SE, I can't try running the command STRACE.(I'll update as soon as possible.)