crash.subsystem.filesystem.mount module

The crash.subsystem.filesystem.mount module contains helpers used to access the file system namespace.

NOTE: Linux v3.3 split struct mount from struct vfsmount. Prior kernels do not have struct mount. In functions documented as using a gdb.Value describing a struct mount, a struct vfsmount will be required and/or returned instead.

class crash.subsystem.filesystem.mount.Mount[source]

Bases: object

classmethod check_task_interface(init_task: gdb.Symbol) → None[source]

Check which interface to iterating over mount structures is in use

Meant to be used as a SymbolCallback.

Parameters:init_task – The init_task symbol.
for_each_mount(task: gdb.Value) → Iterator[gdb.Value][source]
init_fs_root
crash.subsystem.filesystem.mount.d_path(mnt: gdb.Value, dentry: gdb.Value, root: gdb.Value = None) → str[source]

Returns a file system path described by a mount and dentry

Parameters:
  • mnt – The mount structure for the start of the path
  • dentry – The dentry for the start of the path. The value must be of type struct dentry.
  • root – The mount structure at which to stop resolution. If unspecified or None, the current root of the namespace is used.
Returns:

The path in string form

Return type:

str

Raises:

gdb.NotAvailableError – The target value was not available.

crash.subsystem.filesystem.mount.for_each_mount(task: gdb.Value = None) → Iterator[gdb.Value][source]

Iterate over each mountpoint in the namespace of the specified task

If no task is given, the init_task symbol is used.

The type of the mount structure returned depends on whether struct mount exists on the kernel version being debugged structure.

Parameters:task – The task which contains the namespace to iterate. The gdb.Value must describe a struct task_struct. If unspecified, the value for the init_task symbol will be used.
Yields:gdb.Value – A mountpoint attached to the namespace. The value will be of type struct mount structure .
Raises:gdb.NotAvailableError – The target value is not available.
crash.subsystem.filesystem.mount.mount_device(mnt: gdb.Value) → str[source]

Returns the device name that this mount is using

Parameters:mnt – The mount structure for which to get the device name
Returns:The device name in string form
Return type:str
Raises:gdb.NotAvailableError – The target value was not available.
crash.subsystem.filesystem.mount.mount_flags(mnt: gdb.Value, show_hidden: bool = False) → str[source]

Returns the human-readable flags of the struct mount structure.

Parameters:
  • mnt – The mount structure for which to return flags
  • show_hidden – Whether to return hidden flags
Returns:

The mount flags in human-readable form

Return type:

str

crash.subsystem.filesystem.mount.mount_fstype(mnt: gdb.Value) → str[source]

Returns the file system type of the mount

Parameters:mnt – The mount structure for which to return the file system type
Returns:The file system type of the mount in string form
Return type:str
crash.subsystem.filesystem.mount.mount_root(mnt: gdb.Value) → gdb.Value[source]

Returns the struct dentry corresponding to the root of a mount

Parameters:mnt – The mount structure for which to return the root dentry
Returns:
The dentry that corresponds to the root of
the mount. The value will be of type struct dentry.
Return type:gdb.Value
crash.subsystem.filesystem.mount.mount_super(mnt: gdb.Value) → gdb.Value[source]

Returns the struct super_block associated with a mount

Parameters:mnt – The mount structure for which to return the super_block
Returns:
The super_block associated with the mount.
The value will be of type struct super_block.
Return type:gdb.Value