Linux DTrace development list
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: Jacob Carlborg <doob@me.com>
Cc: dtrace@lists.linux.dev
Subject: Re: [PATCH 1/3] libdtrace: resolve BTF type tags when importing BTF into CTF
Date: Fri, 24 Jul 2026 16:09:16 -0400	[thread overview]
Message-ID: <amPGbDumUAKSXjuD@oracle.com> (raw)
In-Reply-To: <20260720133100.77573-2-doob@me.com>

On Mon, Jul 20, 2026 at 03:30:58PM +0200, Jacob Carlborg wrote:
> Without this fix, running any DTrace commands results in:
> 
> ```
> dtrace: invalid probe specifier ::::
> "/usr/lib64/dtrace/6.12.0/procfs.d", line 131: operator -> cannot be
> applied to pointer to type "void"; must be applied to a struct or
> union pointer
> ```
> 
> The issue occurs on kernels which have BTF with type tags. The fix is
> to treat `BTF_KIND_TYPE_TAG` as a transparent modifier, resolving
> straight to `type->type`.

Thanks for catching this.  There is another place that needs fixing as far
as I can see...  In dt_btf_real_type_by_id() we also need to handle
BTF_KIND_TYPE_TAG as a transparent modifier, I believe.

> 
> Signed-off-by: Jacob Carlborg <doob@me.com>
> ---
>  libdtrace/dt_btf.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/libdtrace/dt_btf.c b/libdtrace/dt_btf.c
> index 1f793397..1414dd1e 100644
> --- a/libdtrace/dt_btf.c
> +++ b/libdtrace/dt_btf.c
> @@ -672,10 +672,28 @@ dt_btf_add_to_ctf(dtrace_hdl_t *dtp, dt_btf_t *btf, ctf_dict_t *ctf,
> 
>                 return ctfid == CTF_ERR ? dt_ctf_error(dtp, ctf) : ctfid;
>         }
> +       case BTF_KIND_TYPE_TAG: {
> +               /*
> +                * A type tag (e.g. __rcu, __user, __percpu) is a transparent
> +                * annotation on the type it wraps.  CTF has no equivalent, so
> +                * we resolve straight through to the underlying type, just as
> +                * we do for const/volatile/restrict.  Treating it as ignored
> +                * (mapping it to void) would leave every tagged member -- such
> +                * as task_struct.real_parent (__rcu) -- resolving to "void",
> +                * which breaks translator compilation on kernels whose BTF
> +                * carries type tags.
> +                */
> +               ctfid = dt_btf_add_to_ctf(dtp, btf, ctf, type->type);
> +               if (ctfid == CTF_ERR)
> +                       return CTF_ERR;         /* errno already set */
> +
> +               btf->ctfids[type_id] = ctfid;
> +
> +               return ctfid;
> +       }
>         case BTF_KIND_VAR:
>         case BTF_KIND_DATASEC:
>         case BTF_KIND_DECL_TAG:
> -       case BTF_KIND_TYPE_TAG:
>         case BTF_KIND_ENUM64:
>         case BTF_KIND_FUNC:
>                 return btf->ctfids[0];          /* Ignored for CTF */
> --
> 2.50.1 (Apple Git-155)
> 
> 
> 

  reply	other threads:[~2026-07-24 20:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 13:30 [PATCH 0/3] Fix DTrace on modern kernels and in containers Jacob Carlborg
2026-07-20 13:30 ` [PATCH 1/3] libdtrace: resolve BTF type tags when importing BTF into CTF Jacob Carlborg
2026-07-24 20:09   ` Kris Van Hees [this message]
2026-07-20 13:30 ` [PATCH 2/3] libdtrace: derive io provider dev_name from the device model Jacob Carlborg
2026-07-20 13:31 ` [PATCH 3/3] libdtrace: match BEGIN/END PID in the tracer's own PID namespace Jacob Carlborg
2026-07-20 16:33 ` [PATCH 0/3] Fix DTrace on modern kernels and in containers Kris Van Hees
2026-07-21  6:27   ` Jacob Carlborg
2026-07-25 18:04 ` [PATCH v2 " Jacob Carlborg
2026-07-25 18:04   ` [PATCH v2 1/3] libdtrace: resolve BTF type tags transparently Jacob Carlborg
2026-07-25 18:04   ` [PATCH v2 2/3] libdtrace: derive io provider dev_name from the device model Jacob Carlborg
2026-07-25 18:04   ` [PATCH v2 3/3] libdtrace: match BEGIN/END PID in the tracer's own PID namespace Jacob Carlborg

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=amPGbDumUAKSXjuD@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=doob@me.com \
    --cc=dtrace@lists.linux.dev \
    /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