public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: Nick Alcock <nick.alcock@oracle.com>
Cc: Kris Van Hees <kris.van.hees@oracle.com>,
	dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH v4] trace: print alloca pointers as actual pointer values
Date: Thu, 18 Sep 2025 10:45:20 -0400	[thread overview]
Message-ID: <aMwbAODOA4QZ2E6V@oracle.com> (raw)
In-Reply-To: <87zfaroqwz.fsf@esperi.org.uk>

On Thu, Sep 18, 2025 at 02:01:48PM +0100, Nick Alcock wrote:
> On 17 Sep 2025, Kris Van Hees spake thusly:
> 
> > On Wed, Sep 17, 2025 at 04:03:33PM +0100, Nick Alcock wrote:
> >> On 16 Sep 2025, Kris Van Hees verbalised:
> >> 
> >> > Because alloca pointers are stored internally as offsets into the
> >> > scratchmem area, they were printed as small integers.  They are
> >> > now printed as actual pointer values into kernel space.
> >> >
> >> > Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> >> 
> >> So... the change is to generate real pointers for children of alloca
> >> nodes too, and scalarize more aggressively? I don't really see what the
> >> second part has to do with this change (and more specifically why it
> >> didn't cause problems before now).
> >
> > It doesn't cause problems - it is just not what should happen.  Since an alloca
> > pointer is a pointer into kernel space one would expect (and legacy behaviour
> > shows this) that printing it would give us an address value in kernel space.
> > Without this patchm we print the *offset* into the scratch memory area, which
> > is certainly not a valid pointer in kernel space.
> 
> Ooh true!
> 
> > Because of how code generation is done, it unfortunately requires slightly more
> > complex logic to know which values to convert into actual pointer values in
> > order to store them in the trace output buffer.  An extra complication is that,
> > if we are storing the pointer value into the trace event buffer, some versions
> > of the verifier will complain if it is a value that is marked as an address
> > into a BPF map.  That is why it needs to be scalarized.
> 
> Aha, this is saying "if this is not being dereferenced, but instead we
> want its literal value" (e.g. for pointer printing) "scalarize it to
> lose its mapdom". Presumably we know that the result of such a REF
> operation will never be dereferenced, since after scalarization we can't
> dereference it?

Yes.

      reply	other threads:[~2025-09-18 14:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16 18:26 [PATCH v4] trace: print alloca pointers as actual pointer values Kris Van Hees
2025-09-16 22:53 ` Eugene Loh
2025-09-17 15:03 ` Nick Alcock
2025-09-17 15:29   ` Kris Van Hees
2025-09-18 13:01     ` Nick Alcock
2025-09-18 14:45       ` Kris Van Hees [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=aMwbAODOA4QZ2E6V@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=nick.alcock@oracle.com \
    /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