public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "raeburn at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug bpf/28748] New: systemtap bpf unsupported functions and other failures
Date: Wed, 05 Jan 2022 22:02:12 +0000	[thread overview]
Message-ID: <bug-28748-6586@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=28748

            Bug ID: 28748
           Summary: systemtap bpf unsupported functions and other failures
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: bpf
          Assignee: systemtap at sourceware dot org
          Reporter: raeburn at redhat dot com
  Target Milestone: ---

Bugzilla only offers me “unspecified” for a version; I’m working with:

  Systemtap translator/driver (version 4.6/0.186, rpm 4.6-4.fc35)
  Copyright (C) 2005-2021 Red Hat, Inc. and others
  This is free software; see the source for copying conditions.
  tested kernel versions: 2.6.32 ... 5.15.0-rc7
  enabled features: AVAHI BOOST_STRING_REF DYNINST BPF JAVA PYTHON3 LIBRPM
LIBSQLITE3 LIBVIRT LIBXML2 NLS NSS READLINE MONITOR_LIBS

on a Fedora 5.15.7-200.fc35.x86_64 kernel.

I was trying a script with kernel-module probes which, first, were failing to
find the variable I wanted to examine at the lines I wanted, right after a
function returns, so I tried probes on the function (saving the pointer passed)
and the corresponding .return probe (fetch the value at the saved location and
print it out), but the .return probe never fired. (I see this issue has come up
on the mailing list around the same time I was running into it

This is an out-of-kernel module, built using standard kernel makefile supplied
options. The function call was between object files but LTO might be enabled.

After a bit of frustration, I decided to try the BPF back end and see if I got
any different results. (For all I know, perhaps the probe point determination
and local variable locating code are common, and the experiment could be a
waste of time. But I don’t know, so I decided to try it out.)

Unfortunately (but perhaps not surprisingly, it still being in early stages of
development), the results were worse:

 * deleting an array isn’t supported
 * kernel_long() and kernel_pointer() aren’t recognized (“unresolved function”)
 * tid() isn’t supported (“bpfinterp.cxx:1127: unknown helper function”)
 * “Error creating probe 0: Invalid or incomplete multibyte or wide character”
though all my own strings seem to be ASCII as far as I can see

This last one is coming from a fairly stripped down input file:

  probe module("uds").function("wait_for_pending_searches")
  {
    printf("%d: wfps\n", tid());
  }

The function being probed is a static function
  static void wait_for_pending_searches(struct page_cache *cache,
                                        unsigned int physical_page) …
which is called from two places in its source file.

If I strip it down further — just a “begin” probe, printing its own thread id —
that’s when I get the “unknown helper function”. Looking at bpfinterp.cxx, it
appears that BPF_FUNC_get_current_pid_tgid is supplied somewhere (hardcoded in
tapset/bpf/context.stp?) but not implemented in the interpreter.

Looking at other “call BPF_FUNC_…” lines in tapset/bpf and comparing against
stapbpf/bpfinterp.cxx, I’d hazard a guess that uses of
BPF_FUNC_get_current_uid_gid, BPF_FUNC_get_smp_processor_id, and
BPF_FUNC_gtod_get_ns might also hit problems. And calls to gid(), uid(), and
cpu() all generate the same error. Calling gettimeofday_ns() seems to be okay
though…

The last point took me a while to figure out, actually, as printf("%d",…) works
just fine normally for “long” values, but in BPF mode I seem to need the %ld
format or the value gets truncated to 32 bits. No warning is given about the
truncation, though all the necessary type info should be available.

So… is there a list somewhere of what is or is not expected to work with the
BPF back end? I see the stapbpf man page and its list of probes and some other
general info, but it’s not very detailed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

             reply	other threads:[~2022-01-05 22:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 22:02 raeburn at redhat dot com [this message]
2022-03-22 21:16 ` [Bug bpf/28748] " wcohen at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28748-6586@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).