[PATCH] systemtap: Fix probe definition for 'rpc_tls_context_new'

Peter Krempa via Devel posted 1 patch 1 week, 6 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/93f95785faeef3755277ca19a50919c2aa9dc819.1773158655.git.pkrempa@redhat.com
src/libvirt_probes.d | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] systemtap: Fix probe definition for 'rpc_tls_context_new'
Posted by Peter Krempa via Devel 1 week, 6 days ago
From: Peter Krempa <pkrempa@redhat.com>

Commit d249170bf609d2c modified the arguments of 'virNetTLSContextNew'
which has a systemtap probe point defined. This in turn meant that the
probe point needed to be modified too.

Unfortunately the systemtap generator doesn't handle double pointers
correctly and in fact systemtap doesn't even seem to have a possibility
to fetch a list of strings from userspace natively. This meant that an
invalid probe definition was generated:

  probe libvirt.rpc.tls_context_new = process("/usr/lib64/libvirt.so").mark("rpc_tls_context_new") {
    ctxt = $arg1;
    cacert = user_string($arg2);
    cacrl = user_string($arg3);
    *cert = $arg4;
    *keys = $arg5;
    sanityCheckCert = $arg6;
    requireValidCert = $arg7;
    isServer = $arg8;
  }

Leading to the following failure:

  # stap -ve 'probe oneshot {exit()}'
  parse error: expected literal string or number
          saw: operator '*' at /usr/share/systemtap/tapset/libvirt_probes-64.stp:204:3
       source:   *cert = $arg4;
                 ^
  1 parse error.

To address the issue declare the 'cert' and 'keys' parameters as
'void *', we can't really do anything else as string lists aren't
supported,  which will make our generator generate correct code once
again.

Resolves: https://issues.redhat.com/browse/RHEL-153832
Fixes: d249170bf609d2cb89c36477b0f9ca0908f25985
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/libvirt_probes.d | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libvirt_probes.d b/src/libvirt_probes.d
index d9e75d9797..16d1decf46 100644
--- a/src/libvirt_probes.d
+++ b/src/libvirt_probes.d
@@ -54,7 +54,7 @@ provider libvirt {
 	# file: src/rpc/virnettlscontext.c
 	# prefix: rpc
 	probe rpc_tls_context_new(void *ctxt, const char *cacert, const char *cacrl,
-				  const char **cert, const char **keys,
+				  void *cert, void *keys,
 				  int sanityCheckCert, int requireValidCert, int isServer);
 	probe rpc_tls_context_dispose(void *ctxt);
 	probe rpc_tls_context_session_allow(void *ctxt, void *sess, const char *dname);
-- 
2.53.0
Re: [PATCH] systemtap: Fix probe definition for 'rpc_tls_context_new'
Posted by Daniel P. Berrangé via Devel 1 week, 6 days ago
On Tue, Mar 10, 2026 at 05:04:15PM +0100, Peter Krempa via Devel wrote:
> From: Peter Krempa <pkrempa@redhat.com>
> 
> Commit d249170bf609d2c modified the arguments of 'virNetTLSContextNew'
> which has a systemtap probe point defined. This in turn meant that the
> probe point needed to be modified too.
> 
> Unfortunately the systemtap generator doesn't handle double pointers
> correctly and in fact systemtap doesn't even seem to have a possibility
> to fetch a list of strings from userspace natively. This meant that an
> invalid probe definition was generated:
> 
>   probe libvirt.rpc.tls_context_new = process("/usr/lib64/libvirt.so").mark("rpc_tls_context_new") {
>     ctxt = $arg1;
>     cacert = user_string($arg2);
>     cacrl = user_string($arg3);
>     *cert = $arg4;
>     *keys = $arg5;
>     sanityCheckCert = $arg6;
>     requireValidCert = $arg7;
>     isServer = $arg8;
>   }
> 
> Leading to the following failure:
> 
>   # stap -ve 'probe oneshot {exit()}'
>   parse error: expected literal string or number
>           saw: operator '*' at /usr/share/systemtap/tapset/libvirt_probes-64.stp:204:3
>        source:   *cert = $arg4;
>                  ^
>   1 parse error.
> 
> To address the issue declare the 'cert' and 'keys' parameters as
> 'void *', we can't really do anything else as string lists aren't
> supported,  which will make our generator generate correct code once
> again.
> 
> Resolves: https://issues.redhat.com/browse/RHEL-153832
> Fixes: d249170bf609d2cb89c36477b0f9ca0908f25985
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  src/libvirt_probes.d | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Err, I already fixed it with:

  commit cb33103c4afbce68134be112ecc5d0251e542650
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Mon Feb 16 10:00:48 2026 +0000

    scripts: avoid matching 'char **' as string for systemtap
    


> 
> diff --git a/src/libvirt_probes.d b/src/libvirt_probes.d
> index d9e75d9797..16d1decf46 100644
> --- a/src/libvirt_probes.d
> +++ b/src/libvirt_probes.d
> @@ -54,7 +54,7 @@ provider libvirt {
>  	# file: src/rpc/virnettlscontext.c
>  	# prefix: rpc
>  	probe rpc_tls_context_new(void *ctxt, const char *cacert, const char *cacrl,
> -				  const char **cert, const char **keys,
> +				  void *cert, void *keys,
>  				  int sanityCheckCert, int requireValidCert, int isServer);
>  	probe rpc_tls_context_dispose(void *ctxt);
>  	probe rpc_tls_context_session_allow(void *ctxt, void *sess, const char *dname);
> -- 
> 2.53.0
> 

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|

Re: [PATCH] systemtap: Fix probe definition for 'rpc_tls_context_new'
Posted by Peter Krempa via Devel 1 week, 6 days ago
On Tue, Mar 10, 2026 at 16:21:17 +0000, Daniel P. Berrangé wrote:
> On Tue, Mar 10, 2026 at 05:04:15PM +0100, Peter Krempa via Devel wrote:
> > From: Peter Krempa <pkrempa@redhat.com>
> > 
> > Commit d249170bf609d2c modified the arguments of 'virNetTLSContextNew'
> > which has a systemtap probe point defined. This in turn meant that the
> > probe point needed to be modified too.
> > 
> > Unfortunately the systemtap generator doesn't handle double pointers
> > correctly and in fact systemtap doesn't even seem to have a possibility
> > to fetch a list of strings from userspace natively. This meant that an
> > invalid probe definition was generated:
> > 
> >   probe libvirt.rpc.tls_context_new = process("/usr/lib64/libvirt.so").mark("rpc_tls_context_new") {
> >     ctxt = $arg1;
> >     cacert = user_string($arg2);
> >     cacrl = user_string($arg3);
> >     *cert = $arg4;
> >     *keys = $arg5;
> >     sanityCheckCert = $arg6;
> >     requireValidCert = $arg7;
> >     isServer = $arg8;
> >   }
> > 
> > Leading to the following failure:
> > 
> >   # stap -ve 'probe oneshot {exit()}'
> >   parse error: expected literal string or number
> >           saw: operator '*' at /usr/share/systemtap/tapset/libvirt_probes-64.stp:204:3
> >        source:   *cert = $arg4;
> >                  ^
> >   1 parse error.
> > 
> > To address the issue declare the 'cert' and 'keys' parameters as
> > 'void *', we can't really do anything else as string lists aren't
> > supported,  which will make our generator generate correct code once
> > again.
> > 
> > Resolves: https://issues.redhat.com/browse/RHEL-153832
> > Fixes: d249170bf609d2cb89c36477b0f9ca0908f25985
> > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> > ---
> >  src/libvirt_probes.d | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Err, I already fixed it with:
> 
>   commit cb33103c4afbce68134be112ecc5d0251e542650
>   Author: Daniel P. Berrangé <berrange@redhat.com>
>   Date:   Mon Feb 16 10:00:48 2026 +0000
> 
>     scripts: avoid matching 'char **' as string for systemtap

IIUC that changed '*cert = user_string($arg4)' to '*cert = $arg4', but
systemtap still moans about '*cert' being invalid syntax. And changing
the argument from 'char **' to 'char *' would feel really wrong, so
'void *' seems better for a generic pointer.
Re: [PATCH] systemtap: Fix probe definition for 'rpc_tls_context_new'
Posted by Peter Krempa via Devel 1 week, 6 days ago
On Tue, Mar 10, 2026 at 17:37:16 +0100, Peter Krempa via Devel wrote:
> On Tue, Mar 10, 2026 at 16:21:17 +0000, Daniel P. Berrangé wrote:
> > On Tue, Mar 10, 2026 at 05:04:15PM +0100, Peter Krempa via Devel wrote:
> > > From: Peter Krempa <pkrempa@redhat.com>
> > > 
> > > Commit d249170bf609d2c modified the arguments of 'virNetTLSContextNew'
> > > which has a systemtap probe point defined. This in turn meant that the
> > > probe point needed to be modified too.
> > > 
> > > Unfortunately the systemtap generator doesn't handle double pointers
> > > correctly and in fact systemtap doesn't even seem to have a possibility
> > > to fetch a list of strings from userspace natively. This meant that an
> > > invalid probe definition was generated:
> > > 
> > >   probe libvirt.rpc.tls_context_new = process("/usr/lib64/libvirt.so").mark("rpc_tls_context_new") {
> > >     ctxt = $arg1;
> > >     cacert = user_string($arg2);
> > >     cacrl = user_string($arg3);
> > >     *cert = $arg4;
> > >     *keys = $arg5;
> > >     sanityCheckCert = $arg6;
> > >     requireValidCert = $arg7;
> > >     isServer = $arg8;
> > >   }
> > > 
> > > Leading to the following failure:
> > > 
> > >   # stap -ve 'probe oneshot {exit()}'
> > >   parse error: expected literal string or number
> > >           saw: operator '*' at /usr/share/systemtap/tapset/libvirt_probes-64.stp:204:3
> > >        source:   *cert = $arg4;
> > >                  ^
> > >   1 parse error.
> > > 
> > > To address the issue declare the 'cert' and 'keys' parameters as
> > > 'void *', we can't really do anything else as string lists aren't
> > > supported,  which will make our generator generate correct code once
> > > again.
> > > 
> > > Resolves: https://issues.redhat.com/browse/RHEL-153832
> > > Fixes: d249170bf609d2cb89c36477b0f9ca0908f25985
> > > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> > > ---
> > >  src/libvirt_probes.d | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > Err, I already fixed it with:
> > 
> >   commit cb33103c4afbce68134be112ecc5d0251e542650
> >   Author: Daniel P. Berrangé <berrange@redhat.com>
> >   Date:   Mon Feb 16 10:00:48 2026 +0000
> > 
> >     scripts: avoid matching 'char **' as string for systemtap
> 
> IIUC that changed '*cert = user_string($arg4)' to '*cert = $arg4', but
> systemtap still moans about '*cert' being invalid syntax. And changing
> the argument from 'char **' to 'char *' would feel really wrong, so
> 'void *' seems better for a generic pointer.

Other possibility is to strip any amount of leading '*' rather than just
1 in the script generating the argument names.
Re: [PATCH] systemtap: Fix probe definition for 'rpc_tls_context_new'
Posted by Daniel P. Berrangé via Devel 1 week, 6 days ago
On Tue, Mar 10, 2026 at 05:39:20PM +0100, Peter Krempa wrote:
> On Tue, Mar 10, 2026 at 17:37:16 +0100, Peter Krempa via Devel wrote:
> > On Tue, Mar 10, 2026 at 16:21:17 +0000, Daniel P. Berrangé wrote:
> > > On Tue, Mar 10, 2026 at 05:04:15PM +0100, Peter Krempa via Devel wrote:
> > > > From: Peter Krempa <pkrempa@redhat.com>
> > > > 
> > > > Commit d249170bf609d2c modified the arguments of 'virNetTLSContextNew'
> > > > which has a systemtap probe point defined. This in turn meant that the
> > > > probe point needed to be modified too.
> > > > 
> > > > Unfortunately the systemtap generator doesn't handle double pointers
> > > > correctly and in fact systemtap doesn't even seem to have a possibility
> > > > to fetch a list of strings from userspace natively. This meant that an
> > > > invalid probe definition was generated:
> > > > 
> > > >   probe libvirt.rpc.tls_context_new = process("/usr/lib64/libvirt.so").mark("rpc_tls_context_new") {
> > > >     ctxt = $arg1;
> > > >     cacert = user_string($arg2);
> > > >     cacrl = user_string($arg3);
> > > >     *cert = $arg4;
> > > >     *keys = $arg5;
> > > >     sanityCheckCert = $arg6;
> > > >     requireValidCert = $arg7;
> > > >     isServer = $arg8;
> > > >   }
> > > > 
> > > > Leading to the following failure:
> > > > 
> > > >   # stap -ve 'probe oneshot {exit()}'
> > > >   parse error: expected literal string or number
> > > >           saw: operator '*' at /usr/share/systemtap/tapset/libvirt_probes-64.stp:204:3
> > > >        source:   *cert = $arg4;
> > > >                  ^
> > > >   1 parse error.
> > > > 
> > > > To address the issue declare the 'cert' and 'keys' parameters as
> > > > 'void *', we can't really do anything else as string lists aren't
> > > > supported,  which will make our generator generate correct code once
> > > > again.
> > > > 
> > > > Resolves: https://issues.redhat.com/browse/RHEL-153832
> > > > Fixes: d249170bf609d2cb89c36477b0f9ca0908f25985
> > > > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> > > > ---
> > > >  src/libvirt_probes.d | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > Err, I already fixed it with:
> > > 
> > >   commit cb33103c4afbce68134be112ecc5d0251e542650
> > >   Author: Daniel P. Berrangé <berrange@redhat.com>
> > >   Date:   Mon Feb 16 10:00:48 2026 +0000
> > > 
> > >     scripts: avoid matching 'char **' as string for systemtap
> > 
> > IIUC that changed '*cert = user_string($arg4)' to '*cert = $arg4', but
> > systemtap still moans about '*cert' being invalid syntax. And changing
> > the argument from 'char **' to 'char *' would feel really wrong, so
> > 'void *' seems better for a generic pointer.
> 
> Other possibility is to strip any amount of leading '*' rather than just
> 1 in the script generating the argument names.

Yeah, stripping leading * is what I /intended/ to do, but clearly
failed to remember to actually do :-(


With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|