Linux DTrace development list
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: Eugene Loh <eugene.loh@oracle.com>
Cc: Kris Van Hees <kris.van.hees@oracle.com>,
	dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH v2] test: fix another use of a kernel variable
Date: Fri, 2 Aug 2024 18:08:48 -0400	[thread overview]
Message-ID: <Zq1Y8M2lPHxJEYwX@oracle.com> (raw)
In-Reply-To: <e6e325dd-d515-715f-13c2-a6d698174ba3@oracle.com>

On Fri, Aug 02, 2024 at 05:46:09PM -0400, Eugene Loh wrote:
> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
> 
> Not sure if you want to change the subject line to something more
> grammatically correct or more specific.  E.g.,
> 
>         test: fix other uses of kernel variable "linux_banner"

I'll fix the subject line.

> On 8/2/24 16:38, Kris Van Hees wrote:
> > Yet another case where lack datatype information for kernel variable
> 
> s/another case/other cases/
> s/lack/lack of/
> 
> And though I know you don't intend to be exhaustive with this patch and
> though I don't understand the underlying issue well, what about
> 
>     test/unittest/io/check_io_probe_args.sh
>         printf("BEGIN { printf(\"%%d %%s\\n\", %s, stringof(`major_names[%s
> % 255]->name)); }\n",
> 
>     test/unittest/printf/tst.str.d
>         printf("command line = %s", stringof(vmlinux`saved_command_line));

These do not need the &-operator because of their use of stringof().

> > (i.e. lack of CTF, and BTF does not provide it) requires an explicit
> > use of the &-operator.
> > 
> > Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> > ---
> >   test/unittest/options/err.D_ASRELO.kdefs.d | 2 +-
> >   test/unittest/options/tst.knodefs.sh       | 2 +-
> >   test/unittest/options/tst.linkmode.r       | 2 +-
> >   test/unittest/options/tst.linkmode.sh      | 4 ++--
> >   test/unittest/tracemem/tst.tracemem.d      | 2 +-
> >   5 files changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/test/unittest/options/err.D_ASRELO.kdefs.d b/test/unittest/options/err.D_ASRELO.kdefs.d
> > index 0a42fc6e..06bfe24e 100644
> > --- a/test/unittest/options/err.D_ASRELO.kdefs.d
> > +++ b/test/unittest/options/err.D_ASRELO.kdefs.d
> > @@ -14,6 +14,6 @@
> >   /* @@runtest-opts: -xerrtags -xlinkmode=dynamic -xknodefs -xkdefs */
> >   BEGIN {
> > -	trace((string)`linux_banner);
> > +	trace((string)&`linux_banner);
> >   	exit(0);
> >   }
> > diff --git a/test/unittest/options/tst.knodefs.sh b/test/unittest/options/tst.knodefs.sh
> > index 532d7eca..da65c49f 100755
> > --- a/test/unittest/options/tst.knodefs.sh
> > +++ b/test/unittest/options/tst.knodefs.sh
> > @@ -9,7 +9,7 @@
> >   dtrace=$1
> >   $dtrace $dt_flags -xlinkmode=dynamic -xknodefs \
> > -	-Sn 'BEGIN { trace((string)`linux_banner); exit(0); }' 2>&1 | \
> > +	-Sn 'BEGIN { trace((string)&`linux_banner); exit(0); }' 2>&1 | \
> >   	awk '/^KREL/ {
> >   		print;
> >   		while (getline == 1) {
> > diff --git a/test/unittest/options/tst.linkmode.r b/test/unittest/options/tst.linkmode.r
> > index 4b453f56..acbf8025 100644
> > --- a/test/unittest/options/tst.linkmode.r
> > +++ b/test/unittest/options/tst.linkmode.r
> > @@ -14,4 +14,4 @@ Linux version
> >   -- @@stderr --
> >   dtrace: failed to set -x linkmode: Invalid value for specified option
> > -dtrace: invalid probe specifier BEGIN { trace((string)`linux_banner); exit(0); }: relocation remains against kernel symbol vmlinux`linux_banner (offset {ptr})
> > +dtrace: invalid probe specifier BEGIN { trace((string)&`linux_banner); exit(0); }: relocation remains against kernel symbol vmlinux`linux_banner (offset {ptr})
> > diff --git a/test/unittest/options/tst.linkmode.sh b/test/unittest/options/tst.linkmode.sh
> > index 4e28f8bd..07045fd5 100755
> > --- a/test/unittest/options/tst.linkmode.sh
> > +++ b/test/unittest/options/tst.linkmode.sh
> > @@ -1,7 +1,7 @@
> >   #!/bin/bash
> >   #
> >   # Oracle Linux DTrace.
> > -# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
> > +# Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
> >   # Licensed under the Universal Permissive License v 1.0 as shown at
> >   # http://oss.oracle.com/licenses/upl.
> >   #
> > @@ -12,7 +12,7 @@ dtrace=$1
> >   function mytest() {
> >   	echo try $1
> > -	$dtrace $1 -qn 'BEGIN { trace((string)`linux_banner); exit(0); }' | cut -c-14
> > +	$dtrace $1 -qn 'BEGIN { trace((string)&`linux_banner); exit(0); }' | cut -c-14
> >   }
> >   # Test different link modes.
> > diff --git a/test/unittest/tracemem/tst.tracemem.d b/test/unittest/tracemem/tst.tracemem.d
> > index 716b119f..fa838454 100644
> > --- a/test/unittest/tracemem/tst.tracemem.d
> > +++ b/test/unittest/tracemem/tst.tracemem.d
> > @@ -14,7 +14,7 @@
> >   #pragma D option quiet
> >   BEGIN {
> > -	p = (char *)`linux_banner;	/* first 14 chars are "Linux version " */
> > +	p = (char *)&`linux_banner;	/* first 14 chars are "Linux version " */
> >   	/* try tracemem() with various sizes */

      reply	other threads:[~2024-08-02 22:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02 20:38 [PATCH v2] test: fix another use of a kernel variable Kris Van Hees
2024-08-02 21:46 ` Eugene Loh
2024-08-02 22:08   ` 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=Zq1Y8M2lPHxJEYwX@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=eugene.loh@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