8000 linux: Make syscall-trace strings valid UTF-8 by washedbeast · Pull Request #1285 · frida/frida-core · GitHub
[go: up one dir, main page]

Skip to content

linux: Make syscall-trace strings valid UTF-8 - #1285

Merged
oleavr merged 1 commit into
frida:mainfrom
washedbeast:syscall-trace-valid-utf8
Nov 5, 2026
Merged

oleavr merged 1 commit into
frida:mainfrom
washedbeast:syscall-trace-valid-utf8

Conversation

@washedbeast
Copy link
Copy Markdown
Contributor

frida-server crashes (SIGSEGV) when the syscall-trace service is asked for symbols of, or events from, a process that uses a file or socket whose name is not valid UTF-8.

g_variant_new_string() returns NULL for invalid UTF-8 (after a GLib-CRITICAL), and the g_variant_ref_sink() that Vala adds around it then dereferences the NULL. Two places feed it bytes that come straight from /proc/<pid>/maps or the kernel:

  • resolve-symbols: the module paths of the process. They come from /proc/<pid>/maps and from the dentry paths of eBPF MAP_CREATE events.
  • read-events: string arguments such as the path passed to openat(), and AF_UNIX socket paths such as the address passed to connect().

Both are now passed through make_valid (), so invalid sequences become U+FFFD. Valid strings are unchanged and the wire format stays the same.

The eBPF paths are not specific to #1284: on main and on the 17.25.2 release, a process that maps a file named dat\xffxy after attach, calls openat() on data\xff, or calls connect() on the socket path s\xff takes frida-server down. The /proc/<pid>/maps path becomes reachable with #1284, which lets such lines through instead of dropping the whole parse.

Tested on Ubuntu 24.04.5 (aarch64, kernel 6.8.0-117-generic) with release builds of frida-server (./configure defaults), sending the requests frida-strace sends (get-signatures, add-targets, read-events, resolve-stacks, resolve-symbols):

Case main main + this change
mapped file /data/t/dat\xffxy (eBPF map event) server exits 139 module /data/t/dat�xy, server alive
openat("/data/t/data\xff") server exits 139 in read-events string argument /data/t/data�, server alive
connect() to /data/t/s\xff, or to the abstract name \xff\xfe server exits 139 in read-events address /data/t/s� or ��, server alive
mapped file /data/t/datéx (valid UTF-8) alive, datéx alive, datéx
ASCII names alive alive

With #1284 (9fd003d9), a traced process started from /data/t/yes\xff also exits 139 on resolve-symbols; with this change on top, the module list contains /data/t/yes� and the server stays up.

No test is added: the repository has none for the syscall-trace service, and exercising it needs eBPF privileges.

g_variant_new_string() returns NULL when given invalid UTF-8, and the
g_variant_ref_sink() that Vala adds around it then dereferences the
NULL, crashing frida-server.

Module paths in resolve-symbols, and string arguments and AF_UNIX
socket paths in read-events, come from /proc/<pid>/maps and from the
kernel, so they can hold any byte. Replace invalid sequences before
they go into a GVariant.
@oleavr
oleavr commented Nov 5, 2026
Copy link
Copy Markdown
Member

Thanks! 🙌

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