8000 android: Omit user when uid has no passwd entry by kkuehl · Pull Request #1298 · frida/frida-core · GitHub
[go: up one dir, main page]

Skip to content

android: Omit user when uid has no passwd entry - #1298

Merged
oleavr merged 1 commit into
frida:mainfrom
kkuehl:fix/android-helper-unresolvable-uid
Nov 23, 2026
Merged

oleavr merged 1 commit into
frida:mainfrom
kkuehl:fix/android-helper-unresolvable-uid

Conversation

@kkuehl
@kkuehl kkuehl commented Nov 21, 2026 •
Copy link
Copy Markdown
Contributor

Listing processes on Android with scope metadata or full fails completely when any process runs as a uid that getpwuid() cannot resolve:

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

resolveUserIdToName() wraps the exception from getpwuid() in a RuntimeException, which propagates out of enumerateProcesses(), so one such process loses the whole list. Scope minimal is unaffected, as it never looks the user up.

I hit this on an arm64 device running Android 17, where com.google.android.as runs as uid 30145, which has no passwd entry (id -nu 30145 fails there too).

The fix makes the Android helper behave like the Linux backend: it always provides uid, and leaves user out when the uid has no passwd entry.

The dex

helper.dex is rebuilt with the Makefile. The original revision of this PR was built with d8 8.10.9-dev from build-tools 36.0.0, the android-37 jar, and JDK 25, which reproduced the committed dex from the unmodified source. The amended revision was rebuilt with d8 9.0.3-dev from build-tools 36.1.0, the android-36 jar (ANDROID_API_LEVEL=36), and JDK 25. Rebuilding the previous revision's source with that setup gives identical bytecode, differing only in the D8 version marker, so the dex differs only by this change.

Testing

A small program against the devkit that gets the local device and lists processes with FRIDA_SCOPE_FULL, run as root on the device:

  • without the fix it fails with the exception above
  • with the original revision of this PR, it listed 205 processes, reporting user="30145" for that one

The amended revision, which reports uid=30145 and no user for that process instead, has not yet been tested on a device.

@kkuehl kkuehl mentioned this pull request Nov 21, 2026
< 8000 div class="flex-shrink-0 my-1 tmp-my-md-0 tmp-ml-md-3"> Merged
Instead of failing the whole process enumeration when a process runs
as a uid that getpwuid() cannot resolve. Also always provide the uid,
like the Linux backend does.
@oleavr
oleavr force-pushed the fix/android-helper-unresolvable-uid branch from 700cafe to e56e865 Compare November 23, 2026 14:49
@oleavr oleavr changed the title android: Show uid when it has no passwd entry android: Omit user when uid has no passwd entry Nov 23, 2026
@oleavr
oleavr merged commit 5a00b81 into frida:main Nov 23, 2026
@oleavr
oleavr commented Nov 23, 2026
Copy link
Copy Markdown
Member

Thanks! 🙌 Amended slightly so we're consistent with the other backends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0