Blob Blame History Raw
commit f6d68366654176541487a8916c3b61c5b1207736
Author: William Cohen <wcohen@redhat.com>
Date:   Mon Nov 19 14:23:15 2018 -0500

    Adjust the vfs_open to provide cred variable with 4.18 kernels
    
    The kernel's git commit ae2bb293a3e8adbc54d08cede5afc22929030c03
    removed the cred argument from the vfs_open.  Thus, there is no $cred
    target variable available.  This missing target variable lives on as a
    field in the $file target variable.  The patch makes the tapset use
    that field if the $cred target variable is not available.  Fixing this
    allows the slowvfs.stp example to work with newer linux 4.18 kernels.

diff --git a/tapset/linux/vfs.stp b/tapset/linux/vfs.stp
index 1fe71ae..7505dfa 100644
--- a/tapset/linux/vfs.stp
+++ b/tapset/linux/vfs.stp
@@ -1296,7 +1296,7 @@ probe vfs.open = kernel.function("vfs_open") ?
 {
         name = "vfs.open"
         path = $path
-        cred = $cred
+        cred = @defined($cred) ? $cred : $file->f_cred
         pathname = fullpath_struct_path($path)
         argstr = sprintf("%s, %p", pathname, $cred)
 }
@@ -1311,6 +1311,6 @@ probe vfs.open.return = kernel.function("vfs_open").return ?
 	error_str = error ? errno_str(error) : ""
 
         path = @entry($path)
-        cred = @entry($cred)
+        cred = @entry(@defined($cred) ? $cred : $file->f_cred)
         pathname = fullpath_struct_path(@entry($path))
 }