================
@@ -652,75 +709,169 @@ PlatformAndroid::FindProcesses(const
ProcessInstanceInfoMatch &match_info,
return 0;
}
- // Use 'pidof' command to get PIDs for the process name.
- // Quote the process name to handle special characters (spaces, etc.)
- std::string pidof_output;
- StreamString command;
- command.Printf("pidof '%s'", process_name.c_str());
- error = adb->Shell(command.GetData(), seconds(5), &pidof_output);
+ std::string ps_output;
+ error = adb->Shell("ps -A -o PID,ARGS", seconds(5), &ps_output);
----------------
emrekultursay wrote:
> Agreed. It would be surprising to me if I ran `platform process list` and it
> applied some kind of extra filtering.
That is the Android (Linux) security model.
- Android sets `hidepid=2`
https://android.googlesource.com/platform/system/core/+/c39ba5a
- Here's hidepid semantics:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0499680a42141d86417a8fbaa8c8db806bea1201
On Android, when running inside a process/package, you are not **supposed to**
see other processes, by design.
- When lldb-server runs inside a package/user, it should only see the processes
in the package.
- When lldb-server runs as shell or root on the Android device, it will already
have access to all process on the system.
By using this adb-based approach, you are bypassing the security model. On a
non-Android Linux machine that was configured with hidepid=2, I don't think you
will see processes from other users. That means this PR is actually introducing
behavior that is inconsistent across Android and Linux (and goes against the
security model).
https://github.com/llvm/llvm-project/pull/164333
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits