1

systemtap registration error.

WARNING: probe process("/home/user/a.out").function("func").return inode-offset 00000000468ed0c6 registration error (rc -5)
WARNING: probe process("/home/user/a.out").function("func").call inode-offset 00000000468ed0c6 registration error (rc -5)
WARNING: task_finder mmap inode-uprobes callback for task 28532 failed: -5

I am learning systemtap. I have a process which calls a function in a while loop. When I start systemtap using "stap -v test.stp" to probe the userspace function, I get the registration error. Following is the complete screen shot;

Pass 1: parsed user script and 465 library scripts using 112640virt/48788res/6452shr/42636data kb, in 100usr/20sys/123real ms.
Pass 2: analyzed script: 3 probes, 2 functions, 4 embeds, 3 globals using 114256virt/51968res/7840shr/44252data kb, in 50usr/110sys/162real ms.
Pass 3: using cached /root/.systemtap/cache/66/stap_662fe7689c5fb5d6ef569e8246fa1c8a_3296.c
Pass 4: using cached /root/.systemtap/cache/66/stap_662fe7689c5fb5d6ef569e8246fa1c8a_3296.ko
Pass 5: starting run.
WARNING: probe process("/home/admin/a.out").function("func").return inode-offset 00000000468ed0c6 registration error (rc 0)
WARNING: probe process("/home/admin/a.out").function("func").call inode-offset 00000000468ed0c6 registration error (rc 0)
^CERROR: empty aggregate near operator '@max' at test.stp:6:37
WARNING: Number of errors: 1, skipped probes: 0
WARNING: /usr/bin/staprun exited with status: 1
Pass 5: run completed in 0usr/20sys/9318real ms.
Pass 5: run failed.  [man error::pass5]

test.stp

probe process("/home/user/a.out").function("func").return {
  stats <<< gettimeofday_ns() - @entry(gettimeofday_ns())
}
probe end {
  printf("max/avg/min: %d/%d/%d\n", @max(stats), @avg(stats), @min(stats))
  print(@hist_log(stats))
}
global stats

test.c

#include <stdlib.h>
#include <unistd.h>
void func()
{
        printf("Hello\n");
    sleep(1);
}
int main()
{
    while (1)
    {
          func();
    }
}

1 Answer 1

3

systemtap does not support overlays/union filesystems. The systemtap userspace code has to be changed to get the real inode of a file if it is in overlayfs. For this the systemtap need to be code changed and built. Download systemtap source code make changes in the file uprobes-inode.c . The change is to use the d_backing_inode to find inode. Need to make changes in two places.

    inode_1 = d_backing_inode(d_real((struct dentry *) dentry, NULL, 0, 0)); //use inode_1 in the following function.
    if ((vm_flags & VM_EXEC) && !(vm_flags & VM_WRITE))
        rc = stapiu_change_plus(target, task, addr, length,
                    offset, vm_flags, inode_1);
        //          offset, vm_flags, dentry->d_inode);

    vm_file = stap_find_exe_file(mm);
    if (vm_file) {
        if (vm_file->f_path.dentry)
        {
            //inode = vm_file->f_path.dentry->d_inode;
            inode = d_backing_inode(d_real((struct dentry *) vm_file->f_path.dentry, NULL, 0, 0));
        
        }
        fput(vm_file);
2
  • so what should we do to fix that?
    – Cong Wu
    Commented Jun 15, 2021 at 9:33
  • This is a crucial patch for systemtap to be able to work inside a container, although as of Linux 5.10 d_real() seems to accept only first 2 arguments instead of 4. Also inode_1 is not initialized, so that needs to be taken care of. Commented Oct 5, 2022 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.