[PATCH 2/v2] Fix "mount" MNT_CURSOR (kernels 5.8-6.7):
Fix "mount" MNT_CURSOR entries (kernels 5.8-6.7):
crash> mount > mount.out
WARNING: cannot get super_block from vfsmnt: 0xff35d65eb1cc1820
crash> struct mount.mnt.mnt_sb,mnt.mnt_flags -x 0xff35d65eb1cc1820
  mnt.mnt_sb = 0x0,
  mnt.mnt_flags = 0x10000000,
When crashing with running "findmnt" commands, the mount list will
have entries with mnt.mnt_flags==MNT_CURSOR (and mnt.mnt_sb==NULL).
Such entries should be skipped without errors.
Signed-off-by: Georges Aureau <georges.aureau(a)hpe.com>
--
 defs.h    |  2 ++
 filesys.c | 15 +++++++++++++++
 symbols.c |  4 ++++
 3 files changed, 21 insertions(+)
diff --git a/defs.h b/defs.h
index 156ac02..3fd7d89 100644
--- a/defs.h
+++ b/defs.h
@@ -2274,6 +2274,8 @@ struct offset_table {                    /* stash of commonly-used
offsets */
        long request_queue_tag_set;
        long blk_mq_tag_set_flags;
        long blk_mq_tag_set_shared_tags;
+       long vfsmount_mnt_flags;
+       long proc_mounts_cursor;
 };
 struct size_table {         /* stash of commonly-used sizes */
diff --git a/filesys.c b/filesys.c
index 8d13807..1f8803d 100644
--- a/filesys.c
+++ b/filesys.c
@@ -1367,6 +1367,10 @@ cmd_mount(void)
        close_tmpfile();
 }
+/* For kernels 5.8-6.7, we're skipping show mount cursor entries.
+ */
+#define MNT_CURSOR             0x10000000
+
 /*
  *  Do the work for cmd_mount();
  */
@@ -1492,6 +1496,15 @@ show_mounts(ulong one_vfsmount, int flags, struct task_context
*namespace_contex
                sbp = ULONG(vfsmount_buf + OFFSET(vfsmount_mnt_sb));
                if (!IS_KVADDR(sbp)) {
+                       if (sbp == 0 && VALID_MEMBER(proc_mounts_cursor)
&&
+                           VALID_MEMBER(vfsmount_mnt_flags)) {
+                               int mnt_flags = INT(vfsmount_buf +
OFFSET(vfsmount_mnt_flags));
+                               if (mnt_flags == MNT_CURSOR) {
+                                       if (CRASHDEBUG(1))
+                                               fprintf(stderr,"skipped cursor
vfsmnt: 0x%lx\n", *vfsmnt);
+                                       continue;
+                               }
+                       }
                        error(WARNING, "cannot get super_block from vfsmnt:
0x%lx\n", *vfsmnt);
                        continue;
                }
@@ -2081,6 +2094,8 @@ vfs_init(void)
        if (INVALID_MEMBER(vfsmount_mnt_devname))
                MEMBER_OFFSET_INIT(mount_mnt_mountpoint,
                        "mount", "mnt_mountpoint");
+       MEMBER_OFFSET_INIT(vfsmount_mnt_flags, "vfsmount",
"mnt_flags");
+       MEMBER_OFFSET_INIT(proc_mounts_cursor, "proc_mounts",
"cursor");
        MEMBER_OFFSET_INIT(mount_mnt, "mount", "mnt");
        MEMBER_OFFSET_INIT(namespace_root, "namespace", "root");
        MEMBER_OFFSET_INIT(task_struct_nsproxy, "task_struct",
"nsproxy");
diff --git a/symbols.c b/symbols.c
index 112bcc6..fd91c2e 100644
--- a/symbols.c
+++ b/symbols.c
@@ -10691,6 +10691,10 @@ dump_offset_table(char *spec, ulong makestruct)
                OFFSET(vfsmount_mnt_mountpoint));
         fprintf(fp, "           vfsmount_mnt_parent: %ld\n",
                OFFSET(vfsmount_mnt_parent));
+        fprintf(fp, "            vfsmount_mnt_flags: %ld\n",
+               OFFSET(vfsmount_mnt_flags));
+        fprintf(fp, "            proc_mounts_cursor: %ld\n",
+               OFFSET(proc_mounts_cursor));
        fprintf(fp, "              mount_mnt_parent: %ld\n",
                OFFSET(mount_mnt_parent));
        fprintf(fp, "          mount_mnt_mountpoint: %ld\n",