Skip to content

add 'uptr' function to mark userland pointer#97

Merged
wkz merged 7 commits into
iovisor:masterfrom
Sutter099:feature/uptr
Aug 19, 2025
Merged

add 'uptr' function to mark userland pointer#97
wkz merged 7 commits into
iovisor:masterfrom
Sutter099:feature/uptr

Conversation

@Sutter099

Copy link
Copy Markdown

Introduce the uptr() function and 'user' hint from @stschake's work to enable explicit marking of userland pointers. This allows expressions like str(uptr(arg0)) to correctly read user memory, resolving the issue where kernel and user pointers could not be distinguished.

As discussed in issue #87, this change enables correct filename printing in probes such as:

kprobe:do_sys_openat2 { printf("%v(%v): %s\n", comm, uid, str(uptr(arg1))); }

Sutter099 and others added 7 commits August 12, 2025 11:30
Add explicit markers '-- probe' and '-- ast' in dump output to improve
readability.

Signed-off-by: Ze Huang <zehuang@qti.qualcomm.com>
Add a uptr(x) function that can mark a value as a userland pointer,
causing e.g. str(uptr(arg0)) to do the right thing and not try to read
the value as kernel memory.

Signed-off-by: Stefan Schake <stschake@gmail.com>
Signed-off-by: Ze Huang <zehuang@qti.qualcomm.com>
Before this change, an invalid probe would cause an error message to
be emitted, but execution still proceeded.

Make sure that we abort the entire session if all requested probes can
not be used.
Add start/stop hooks to providers, and run BEGIN/END probes from
there, rather than having a bunch of special cases sprinkled
throughout libply.c.
Intermittently, a command like `ply -c "sleep 1" '<some-probe>'` would
not terminate after the sleep process terminated.

This was because the old logic relied on SIGCHLD being delivered to
ply while blocked on ply_loop(). In other cases, it would be lost and
the ply process would hang until terminated with a SIGINT or similar.

Fix this by letting the user of libply get a copy of the fds to poll
and then calling ply_service() whenever an event comes in. This way,
we can fold in the signal monitoring into the main loop using a
signalfd, which libply does not have to be aware of.
@wkz wkz merged commit e882e05 into iovisor:master Aug 19, 2025
3 checks passed
@wkz

wkz commented Aug 19, 2025

Copy link
Copy Markdown
Collaborator

Thank you @Sutter099, and @stschake!

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