public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Eugene Loh <eugene.loh@oracle.com>
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [DTrace-devel] [PATCH] Relocation processing of STBSZ in ERROR's get_bvar() is too early
Date: Mon, 16 Sep 2024 13:28:31 -0400	[thread overview]
Message-ID: <be42b132-04ef-b6d3-7ab1-397aa66aebfe@oracle.com> (raw)
In-Reply-To: <ZuT6mHTMPMn2W9FH@oracle.com>

On 9/13/24 22:53, Kris Van Hees wrote:
> I don't thibk this is the right solution.  There are other values that are
> resolved as a relocation in dt_link_construct() and that could be found in
> an ERROR clause and thus get resolved before the correct value is known.
>
> Instead, I think we need to simply move the construction of the dt_error
> program into dt_bpf_load_progs().  I should have done that when I split
> up program construction and loading into two distinct phases.
>
> I'll post an alternative patch in a moment...

Thanks.  I confess I posted this patch impatiently, with the uneasy 
suspicion that the relocation was simply being performed at the wrong time.

> On Fri, Sep 13, 2024 at 07:36:04PM -0400, eugene.loh--- via DTrace-devel wrote:
>> From: Eugene Loh <eugene.loh@oracle.com>
>>
>> When we call dtrace_go(), we do something like this:
>>
>>      dt_bpf_make_progs()
>>          dt_program_construct()        // just for ERROR
>>              dt_link()
>>                  dt_link_construct()
>>      dt_bpf_gmap_create()
>>      dt_bpf_load_progs()               // other
>>              dt_link()
>>                  dt_link_construct()
>>
>> In dt_link_construct() we dive down and find dt_get_bvar().  One of the
>> relocations is to supply the value of STBSZ.  The first dt_link() is for
>> ERROR, while the subsequent calls in dt_bpf_load_progs() are for other
>> clauses -- that is, two separate versions of dt_get_bvar() are used.
>> Meanwhile, the value of STBSZ is not set until dt_bpf_gmap_create().
>> This means that the ERROR copy of dt_get_bvar() does not have STBSZ set
>> properly. This means that if ERROR accesses probeprov or probename,
>> dt_get_bvar() returns the beginning of the string table, which is a NUL
>> terminator.
>>
>> Change dt_bpf_reloc_prog() -- which performs relocation processing for
>> BPF maps, necessarily after dt_bpf_gmap_create()! -- to check STBSZ
>> and set its value if necessary.

      reply	other threads:[~2024-09-16 17:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-13 23:36 [PATCH] Relocation processing of STBSZ in ERROR's get_bvar() is too early eugene.loh
2024-09-14  2:53 ` [DTrace-devel] " Kris Van Hees
2024-09-16 17:28   ` Eugene Loh [this message]

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=be42b132-04ef-b6d3-7ab1-397aa66aebfe@oracle.com \
    --to=eugene.loh@oracle.com \
    --cc=dtrace-devel@oss.oracle.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