public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug tapsets/26184] New: fullpath_struct_file does not handle struct dentry on 5.6.19-300.fc32.x86_64
@ 2021-05-26 21:26 guillaume at morinfr dot org
  2021-05-26 22:06 ` [Bug tapsets/26184] " guillaume at morinfr dot org
  2022-03-22 18:15 ` wcohen at redhat dot com
  0 siblings, 2 replies; 4+ messages in thread
From: guillaume at morinfr dot org @ 2021-05-26 21:26 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=26184

            Bug ID: 26184
           Summary: fullpath_struct_file does not handle struct dentry on
                    5.6.19-300.fc32.x86_64
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tapsets
          Assignee: systemtap at sourceware dot org
          Reporter: craig.ringer at 2ndquadrant dot com
                CC: guillaume at morinfr dot org
  Target Milestone: ---
                CC: guillaume at morinfr dot org

Created attachment 12671
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12671&action=edit
Output from fullpath_struct_file

fullpath_struct_file fails in dentry.stp with "type definition 'dentry' not
found". Full error output will be provided as attachment.

Command:

$ stap -v -c /bin/false -e 'probe process.begin { printf("%s",
fullpath_struct_file(task_current(), current_exe_file())); exit(); }'

semantic error: type definition 'dentry' not found in '': operator '@cast' at
/usr/share/systemtap/tapset/linux/dentry.stp:64:15
        source:         s = & @cast(dentry, "dentry")->d_name;

... more errors ... (see attached)

$ uname -r
5.6.19-300.fc32.x86_64

$ rpm -q systemtap
systemtap-4.3-1.fc32.x86_64

$ stap --version
Systemtap translator/driver (version 4.3/0.179, rpm 4.3-1.fc32)
Copyright (C) 2005-2020 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
tested kernel versions: 2.6.32 ... 5.7.0
enabled features: AVAHI BOOST_STRING_REF DYNINST BPF JAVA PYTHON3 LIBRPM
LIBSQLITE3 LIBVIRT LIBXML2 NLS NSS READLINE MONITOR_LIBS


The failing command simplifies to:


$ stap -v -c /bin/false -e 'probe process.begin { printf("%s", d_name(0));
exit(); }'

--- Comment #1 from Craig Ringer <craig.ringer at 2ndquadrant dot com> ---
*** Bug 26185 has been marked as a duplicate of this bug. ***

--- Comment #2 from Craig Ringer <craig.ringer at 2ndquadrant dot com> ---
*** Bug 26186 has been marked as a duplicate of this bug. ***

--- Comment #3 from Craig Ringer <craig.ringer at 2ndquadrant dot com> ---
Checked latest git 403e92779, same outcome:

WARNING: Potential type mismatch in reassignment: identifier 'root_dentry' at
/usr/local/systemtap/share/systemtap/tapset/linux/dentry.stp:246:3
 source:                root_dentry = @cast(task, "task_struct",
"kernel")->fs->root->dentry
                        ^

--- Comment #4 from Craig Ringer <craig.ringer at 2ndquadrant dot com> ---
Well, similar anyway; it runs, then dies with

ERROR: read fault [man error::fault] at 0x10 near operator '->' at
/usr/local/systemtap/share/systemtap/tapset/linux/dentry.stp:267:19

but the warnings from the latest git match the errors from the packaged
version.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

* [Bug tapsets/26184] fullpath_struct_file does not handle struct dentry on 5.6.19-300.fc32.x86_64
  2021-05-26 21:26 [Bug tapsets/26184] New: fullpath_struct_file does not handle struct dentry on 5.6.19-300.fc32.x86_64 guillaume at morinfr dot org
@ 2021-05-26 22:06 ` guillaume at morinfr dot org
  2022-03-22 18:15 ` wcohen at redhat dot com
  1 sibling, 0 replies; 4+ messages in thread
From: guillaume at morinfr dot org @ 2021-05-26 22:06 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=26184

--- Comment #5 from Guillaume Morin <guillaume at morinfr dot org> ---
This appears to be still present in systemtap 4.5.

This simple workaround seems to fix the problem:

--- a/tapset/linux/dentry.stp  2021-05-26 17:44:48.283925000 -0400
+++ b/tapset/linux/dentry.stp        2021-05-26 17:44:59.122807962 -0400
@@ -264,7 +264,7 @@
                        /* RHEL7+ kernels */
                        if (! @type_member_defined("vfsmount", mnt_parent)) {
                                /* Global root? */
-                               if (mnt != mnt->mnt_parent) {
+                               if (mnt && mnt != mnt->mnt_parent) {
                                        dentry = mnt->mnt_mountpoint
                                        vfsmnt = & mnt->mnt_parent->mnt
                                        mnt = mnt->mnt_parent

However, mnt should not be 0 at that point in the code. The mnt var should be
defined if @type_member_defined("mount", mnt_parent) is true and it should be
the case in any kernel released in the past 10 years.

_But_ I verified that it does not evaluate to true with the example given by
the original reporter (stap -v -c /bin/false -e 'probe process.begin {
printf("%s\n", fullpath_struct_file(task_current(), current_exe_file()));
exit(); }').

I also can reproduce with a completely different example (a longer one). I
could provide it if necessary but the original reproducer is simple enough.

It does look like a bug similar to
https://sourceware.org/bugzilla/show_bug.cgi?id=20672

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

* [Bug tapsets/26184] fullpath_struct_file does not handle struct dentry on 5.6.19-300.fc32.x86_64
  2021-05-26 21:26 [Bug tapsets/26184] New: fullpath_struct_file does not handle struct dentry on 5.6.19-300.fc32.x86_64 guillaume at morinfr dot org
  2021-05-26 22:06 ` [Bug tapsets/26184] " guillaume at morinfr dot org
@ 2022-03-22 18:15 ` wcohen at redhat dot com
  1 sibling, 0 replies; 4+ messages in thread
From: wcohen at redhat dot com @ 2022-03-22 18:15 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=26184

William Cohen <wcohen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |wcohen at redhat dot com
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #6 from William Cohen <wcohen at redhat dot com> ---
This looks to be fixed by commit 3739d47c4cc427ce4818d884f429a3efa85c38ae 

$ uname -a
Linux fedora32 5.11.22-100.fc32.x86_64 #1 SMP Wed May 19 18:58:25 UTC 2021
x86_64 x86_64 x86_64 GNU/Linux
$ sudo ../install/bin/stap -v -c /bin/false -e 'probe process.begin {
printf("%s", fullpath_struct_file(task_current(), current_exe_file())); exit();
}'
Pass 1: parsed user script and 482 library scripts using
330920virt/94860res/17164shr/77736data kb, in 110usr/30sys/145real ms.
Pass 2: analyzed script: 1 probe, 31 functions, 2 embeds, 0 globals using
492840virt/258500res/18852shr/239656data kb, in 1190usr/390sys/1602real ms.
Pass 3: translated to C into
"/tmp/stapZC6Ukv/stap_e758ceff27992605c6d07aaf7c9484a8_14053_src.c" using
492840virt/258628res/18980shr/239656data kb, in 0usr/60sys/69real ms.
Pass 4: compiled C into "stap_e758ceff27992605c6d07aaf7c9484a8_14053.ko" in
11480usr/1640sys/13231real ms.
Pass 5: starting run.
WARNING: Child process exited with status 1
/home/wcohen/systemtap_write/install/libexec/systemtap/stapioWARNING:
/home/wcohen/systemtap_write/install/bin/staprun exited with status: 1
Pass 5: run completed in 10usr/30sys/301real ms.
Pass 5: run failed.  [man error::pass5]

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

* [Bug tapsets/26184] fullpath_struct_file does not handle struct dentry on 5.6.19-300.fc32.x86_64
@ 2020-07-13  6:48 Craig Ringer
  0 siblings, 0 replies; 4+ messages in thread
From: Craig Ringer @ 2020-07-13  6:48 UTC (permalink / raw)
  To: systemtap

Hi all

Bugzilla failed to generate mail on this bug so I'm posting it directly.
It's a compilation issue on recent kernels relating to struct dentry that
prevents the use of tapset functions such as fullpath_struct_file() .

Noticed while trying to determine the actual path of the process being
attached to.

I had a bit of a look in the headers but I admit I quickly got lost.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 2ndQuadrant - PostgreSQL Solutions for the Enterprise

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

end of thread, other threads:[~2022-03-22 18:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 21:26 [Bug tapsets/26184] New: fullpath_struct_file does not handle struct dentry on 5.6.19-300.fc32.x86_64 guillaume at morinfr dot org
2021-05-26 22:06 ` [Bug tapsets/26184] " guillaume at morinfr dot org
2022-03-22 18:15 ` wcohen at redhat dot com
  -- strict thread matches above, loose matches on Subject: below --
2020-07-13  6:48 Craig Ringer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).