Linux DTrace development list
 help / color / mirror / Atom feed
* [PATCH] test: fix another use of a kernel variable
@ 2024-08-02 15:56 Kris Van Hees
  2024-08-02 17:28 ` Eugene Loh
  0 siblings, 1 reply; 3+ messages in thread
From: Kris Van Hees @ 2024-08-02 15:56 UTC (permalink / raw)
  To: dtrace, dtrace-devel

Yet another case where lack datatype information for kernel variable
(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/tst.linkmode.r  | 2 +-
 test/unittest/options/tst.linkmode.sh | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

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.
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] test: fix another use of a kernel variable
  2024-08-02 15:56 [PATCH] test: fix another use of a kernel variable Kris Van Hees
@ 2024-08-02 17:28 ` Eugene Loh
  2024-08-02 17:51   ` Kris Van Hees
  0 siblings, 1 reply; 3+ messages in thread
From: Eugene Loh @ 2024-08-02 17:28 UTC (permalink / raw)
  To: Kris Van Hees, dtrace, dtrace-devel

Reviewed-by: Eugene Loh <eugene.loh@oracle.com>

But has an effort been made to clean out the last of these?  E.g., with 
"git grep linux_banner", I also see:

test/unittest/options/err.D_ASRELO.kdefs.d: trace((string)`linux_banner);
test/unittest/options/tst.knodefs.sh:   -Sn 'BEGIN { 
trace((string)`linux_banner); exit(0); }' 2>&1 | \
test/unittest/tracemem/tst.tracemem.d:  p = (char *)`linux_banner;      
/* first 14 chars are "Linux version " */

The nodef cases... maybe not an issue but perhaps at least for stylistic 
consistency?

On 8/2/24 11:56, Kris Van Hees wrote:
> Yet another case where lack datatype information for kernel variable

s/lack/lack of/
s/kernel/a kernel/

> (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/tst.linkmode.r  | 2 +-
>   test/unittest/options/tst.linkmode.sh | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
>
> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] test: fix another use of a kernel variable
  2024-08-02 17:28 ` Eugene Loh
@ 2024-08-02 17:51   ` Kris Van Hees
  0 siblings, 0 replies; 3+ messages in thread
From: Kris Van Hees @ 2024-08-02 17:51 UTC (permalink / raw)
  To: Eugene Loh; +Cc: Kris Van Hees, dtrace, dtrace-devel

On Fri, Aug 02, 2024 at 01:28:09PM -0400, Eugene Loh wrote:
> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
> 
> But has an effort been made to clean out the last of these?  E.g., with "git
> grep linux_banner", I also see:
> 
> test/unittest/options/err.D_ASRELO.kdefs.d: trace((string)`linux_banner);
> test/unittest/options/tst.knodefs.sh:   -Sn 'BEGIN {
> trace((string)`linux_banner); exit(0); }' 2>&1 | \
> test/unittest/tracemem/tst.tracemem.d:  p = (char *)`linux_banner;      /*
> first 14 chars are "Linux version " */
> 
> The nodef cases... maybe not an issue but perhaps at least for stylistic
> consistency?

I'll have a look.  I am not trying to be all-exhaustive about this just yet
because there is a higher priority, but yes, I definitely don't mind fixing
what we easily find.

> On 8/2/24 11:56, Kris Van Hees wrote:
> > Yet another case where lack datatype information for kernel variable
> 
> s/lack/lack of/
> s/kernel/a kernel/
> 
> > (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/tst.linkmode.r  | 2 +-
> >   test/unittest/options/tst.linkmode.sh | 4 ++--
> >   2 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-02 17:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-02 15:56 [PATCH] test: fix another use of a kernel variable Kris Van Hees
2024-08-02 17:28 ` Eugene Loh
2024-08-02 17:51   ` Kris Van Hees

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox