Workaround for systemtap issue : Oracle Tracing [registration error (rc 0) !]

This is my third blog post about an issue that we may encounter with uprobes and the recent kernel/oracle version.

As the name of this article suggest i will show here how we can put a probe point on oracle functions using systemtap based on the workaround that i described previously.

Systemtap use uprobes for user space probing through the uprobes API.We are interested here in function “uprobe_register” Ref

* uprobe_register – register a probe
* @inode: the file in which the probe has to be placed.
* @offset: offset from the start of the file.
* @uc: information on howto handle the probe..
* Apart from the access refcount, uprobe_register() takes a creation
* refcount (thro alloc_uprobe) if and only if this @uprobe is getting
* inserted into the rbtree (i.e first consumer for a @inode:@offset
* tuple). Creation refcount stops uprobe_unregister from freeing the
* @uprobe even before the register operation is complete. Creation
* refcount is released when the last @uc for the @uprobe
* unregisters.
* Return errno if it cannot successully install probes
* else return 0 (success)
int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)

As explained in my first post we can still put a porbe point at the second instruction (The First instrction is NOP : 2 BYTES) so all i have to do is this :

Download systemtap :

Modify : ./runtime/linux/uprobes-inode.c

stapiu_register (struct inode* inode, struct stapiu_consumer* c)
if (!c->return_p) {
c->consumer.handler = stapiu_probe_prehandler;
} else {
c->consumer.ret_handler = stapiu_retprobe_prehandler;
return EINVAL;
return uprobe_register (inode, c->offset + 2, &c->consumer);

static void
stapiu_unregister (struct inode* inode, struct stapiu_consumer* c)
uprobe_unregister (inode, c->offset + 2, &c->consumer);

Install systemtap :

make all && make install

That’s all !

We can now trace our process :

Capture 04

Let’s take a look at the function prologue :

Capture 03

All is good !

UPDATE 29/03/2018 : Another workaround is also available here

That’s it 😀

2 thoughts on “Workaround for systemtap issue : Oracle Tracing [registration error (rc 0) !]

  1. Eww yuck yuck yuck yuck. Be careful! This will change -all- uprobes, even if they were resolved to valid addresses.

    • Hi Franck, thank you for your comment ! Indeed i was aware of that, but this is only meant to be used as a workaround for the issue i described in part one where it’s not possible for some reason to put a probe point on the first instruction of oracle functions (ex:”kskthewt”) which is “xchg %ax,%ax”. So this systemtap build should be used only in this context. I used this trick as i haven’t found a similar way to perf (putting a probe point on the second instruction) : perf probe -x oracle kskthewt+2 timestamp=%di event=%si.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s