crash.types.slab module
***********************

class crash.types.slab.KmemCache(name: str, gdb_obj: Value)

   Bases: "ABC"

   SLUB = False

   SlabFlags = {'ACCOUNT': 67108864, 'CACHE_DMA': 16384, 'CONSISTENCY_CHECKS': 256, 'DEBUG_OBJECTS': 4194304, 'FAILSLAB': 33554432, 'HWCACHE_ALIGN': 8192, 'MEM_SPREAD': 1048576, 'NOLEAKTRACE': 8388608, 'NOTRACK': 16777216, 'PANIC': 262144, 'POISON': 2048, 'RECLAIM_ACCOUNT': 131072, 'RED_ZONE': 1024, 'STORE_USER': 65536, 'TRACE': 2097152, 'TYPESAFE_BY_RCU': 524288}

   alien_cache_type_exists = False

   buffer_size_name = None

   abstract check_all() -> None

   classmethod check_kmem_cache_node_type(gdbtype: Type) -> None

   classmethod check_kmem_cache_type(gdbtype: Type) -> None

   classmethod create(name: str, gdb_obj: Value) -> KmemCache

   abstract get_allocated_objects() -> Iterable[int]

   has_flag(flag_name: str) -> bool

   head_name = 'list'

   abstract list_all(verbosity: int) -> None

   nodelists_name = None

   percpu_cache = None

   percpu_name = None

   slub_debug_compiled = True

   tracks_full_slabs() -> bool

exception crash.types.slab.KmemCacheNotFound

   Bases: "RuntimeError"

   The specified kmem_cache could not be found.

class crash.types.slab.KmemCacheSLAB(name: str, gdb_obj: Value)

   Bases: "KmemCache"

   buffer_size: int

   check_all() -> None

   check_array_caches() -> None

   get_allocated_objects() -> Iterable[int]

   get_array_caches() -> Dict[int, Dict[str, int | str]]

   get_slabs_of_type(node: Value, slabtype: int, reverse: bool = False, exact_cycles: bool = False) -> Iterable[SlabSLAB]

   list_all(verbosity: int) -> None

   classmethod setup_alien_cache_type(gdbtype: Type) -> None

   slab_list_fullname = {0: 'slabs_partial', 1: 'slabs_full', 2: 'slabs_free'}

   slab_list_name = {0: 'partial', 1: 'full', 2: 'free'}

class crash.types.slab.KmemCacheSLUB(name: str, gdb_obj: Value)

   Bases: "KmemCache"

   check_all() -> None

   get_allocated_objects() -> Iterable[int]

   list_all(verbosity: int) -> None

   process_all(flags: ProcessingFlags) -> None

   red_left_pad() -> int

   slub_process_once() -> None

class crash.types.slab.ProcessingFlags(print_level: int = 0)

   Bases: "object"

class crash.types.slab.Slab(gdb_obj: Value, kmem_cache: KmemCache)

   Bases: "ABC"

   A common superclass representing a slab, i.e. a collection of
   objects on a single (possibly high-order) page.

   Parameters:
      * **gdb_obj** -- The structure to wrap, of type "struct slab" or
        "struct page".

      * **kmem_cache** -- The kmem_cache instance the slab belongs to.

   gdb_obj

      The structure being wrapped. The value is of type "struct slab"
      or "struct page".

      Type:
         "gdb.Value"

   address

      Address of the structure being wrapped.

      Type:
         "int"

   kmem_cache

      The cache the slab belongs to.

      Type:
         "KmemCache"

   free

      Set of addresses of free objects in the slab.

      Type:
         "Set[int]"

   nr_objects (

      obj:>>`<<int): Total number of objects in the slab.

   nr_inuse (

      obj:>>`<<int): Number of allocated objects in the slab.

   nr_free (

      obj:>>`<<int): Number of free objects in the slab.

   abstract contains_obj(addr: int) -> Tuple[bool, int, str | None]

      Returns whether the slab contains an object at given address.

      Parameters:
         **addr** -- Address of object to check.

      Returns:
         A tuple with object information. contains ("bool"): Whether
         addr points inside valid object

            range.

         address ("int"): Starting address of the object. Might be
            returned even if contains is False, when addr falls e.g.
            into a red zone or padding of an object.

         description ("str"): Optional description of where addr
         points
            to in case it's not a valid object.

      Return type:
         "(contains, address, description)"

   abstract find_obj(addr: int) -> int | None

      Returns starting address of object in slab.

      Parameters:
         **addr** -- Address of the object to find.

      Returns:
         Starting address of the object, or None if the address
            does not fall into the slab's range. Note that while
            object address might be returned, addr might still be
            outside of valid range. Use contains_obj() to verify.

      Return type:
         "int"

   abstract classmethod from_list_head(list_head: Value, kmem_cache: KmemCache) -> Slab

      Create Slab oject wrapper from a "gdb.Value" object of "struct
      list_head" type.

   abstract classmethod from_page(page: Page) -> Slab

      Create Slab object wrapper from a "Page" struct page wrapper.

   abstract get_allocated_objects() -> Iterable[int]

      Generates object addresses for all allocated objects in the
      slab.

   abstract long_header() -> str

      Return a long header consisting of slab's address, role and
      stats.

   abstract obj_in_use(addr: int) -> Tuple[bool, str | None]

      Returns information about whether object is allocated (in use)
      or free.

      Arg:
         addr: Base address of object to check, obtained e.g. by
         find.obj()

      Returns:
         obj:*(in_use, free_details): A tuple with information. in_use
         (:obj:`bool*): Whether object is currently in use.
         free_details ("str"): If an object is in some special cache

            of free objects (e.g. per-cpu), a short description of
            such cache.

   populate_free() -> None

      Make sure the set of free objects is populated

   abstract print_objects() -> None

      Print all objects in slab, indicating if they are free or
      allocated.

   abstract short_header() -> str

      Return a short header consisting of slab's address and role.

class crash.types.slab.SlabSLAB(gdb_obj: Value, kmem_cache: KmemCacheSLAB, error: bool = False)

   Bases: "Slab"

   AC_ALIEN = 'alien'

   AC_PERCPU = 'percpu'

   AC_SHARED = 'shared'

   BUFCTL_END = 4294967295

   bufctl_type: Type

   check(slabtype: int, nid: int) -> int

   classmethod check_bufctl_type(gdbtype: Type) -> None

   classmethod check_page_type(gdbtype: Type) -> None

   classmethod check_slab_type(gdbtype: Type) -> None

   contains_obj(addr: int) -> Tuple[bool, int, str | None]

      Returns whether the slab contains an object at given address.

      Parameters:
         **addr** -- Address of object to check.

      Returns:
         A tuple with object information. contains ("bool"): Whether
         addr points inside valid object

            range.

         address ("int"): Starting address of the object. Might be
            returned even if contains is False, when addr falls e.g.
            into a red zone or padding of an object.

         description ("str"): Optional description of where addr
         points
            to in case it's not a valid object.

      Return type:
         "(contains, address, description)"

   find_obj(addr: int) -> int | None

      Returns starting address of object in slab.

      Parameters:
         **addr** -- Address of the object to find.

      Returns:
         Starting address of the object, or None if the address
            does not fall into the slab's range. Note that while
            object address might be returned, addr might still be
            outside of valid range. Use contains_obj() to verify.

      Return type:
         "int"

   classmethod from_addr(slab_addr: int, kmem_cache: int | KmemCacheSLAB) -> SlabSLAB

   classmethod from_list_head(list_head: Value, kmem_cache: KmemCache) -> SlabSLAB

      Create Slab oject wrapper from a "gdb.Value" object of "struct
      list_head" type.

   classmethod from_page(page: Page) -> SlabSLAB

      Create Slab object wrapper from a "Page" struct page wrapper.

   get_allocated_objects() -> Iterable[int]

      Generates object addresses for all allocated objects in the
      slab.

   get_objects() -> Iterable[int]

   kmem_cache: KmemCacheSLAB

   long_header() -> str

      Return a long header consisting of slab's address, role and
      stats.

   obj_in_use(addr: int) -> Tuple[bool, str | None]

      Returns information about whether object is allocated (in use)
      or free.

      Arg:
         addr: Base address of object to check, obtained e.g. by
         find.obj()

      Returns:
         obj:*(in_use, free_details): A tuple with information. in_use
         (:obj:`bool*): Whether object is currently in use.
         free_details ("str"): If an object is in some special cache

            of free objects (e.g. per-cpu), a short description of
            such cache.

   page_slab: bool = False

   print_objects() -> None

      Print all objects in slab, indicating if they are free or
      allocated.

   real_slab_type: Type

   short_header() -> str

      Return a short header consisting of slab's address and role.

   slab_free = 2

   slab_full = 1

   slab_list_head: str = 'list'

   slab_partial = 0

class crash.types.slab.SlabSLUB(gdb_obj: Value, kmem_cache: KmemCacheSLUB)

   Bases: "Slab"

   contains_obj(addr: int) -> Tuple[bool, int, str | None]

      Returns whether the slab contains an object at given address.

      Parameters:
         **addr** -- Address of object to check.

      Returns:
         A tuple with object information. contains ("bool"): Whether
         addr points inside valid object

            range.

         address ("int"): Starting address of the object. Might be
            returned even if contains is False, when addr falls e.g.
            into a red zone or padding of an object.

         description ("str"): Optional description of where addr
         points
            to in case it's not a valid object.

      Return type:
         "(contains, address, description)"

   find_obj(addr: int) -> int | None

      Returns starting address of object in slab.

      Parameters:
         **addr** -- Address of the object to find.

      Returns:
         Starting address of the object, or None if the address
            does not fall into the slab's range. Note that while
            object address might be returned, addr might still be
            outside of valid range. Use contains_obj() to verify.

      Return type:
         "int"

   classmethod from_list_head(list_head: Value, kmem_cache: KmemCache) -> SlabSLUB

      Create Slab oject wrapper from a "gdb.Value" object of "struct
      list_head" type.

   classmethod from_page(page: Page) -> SlabSLUB

      Create Slab object wrapper from a "Page" struct page wrapper.

   classmethod from_page_obj(page: Value) -> SlabSLUB

   get_allocated_objects() -> Iterable[int]

      Generates object addresses for all allocated objects in the
      slab.

   get_objects() -> Iterable[int]

   kmem_cache: KmemCacheSLUB

   long_header() -> str

      Return a long header consisting of slab's address, role and
      stats.

   obj_in_use(addr: int) -> Tuple[bool, str | None]

      Returns information about whether object is allocated (in use)
      or free.

      Arg:
         addr: Base address of object to check, obtained e.g. by
         find.obj()

      Returns:
         obj:*(in_use, free_details): A tuple with information. in_use
         (:obj:`bool*): Whether object is currently in use.
         free_details ("str"): If an object is in some special cache

            of free objects (e.g. per-cpu), a short description of
            such cache.

   print_objects() -> None

      Print all objects in slab, indicating if they are free or
      allocated.

   short_header() -> str

      Return a short header consisting of slab's address and role.

   slab_role() -> str

   warn_frozen(expected: int, header: str) -> None

crash.types.slab.atomic_long_read(val: Value) -> int

crash.types.slab.col_bold(msg: str) -> str

crash.types.slab.col_error(msg: str) -> str

crash.types.slab.kmem_cache_from_addr(addr: int) -> KmemCache

crash.types.slab.kmem_cache_from_name(name: str) -> KmemCache

crash.types.slab.kmem_cache_get_all() -> ValuesView[KmemCache]

crash.types.slab.print_flags(val: int, names: Dict[str, int]) -> str

crash.types.slab.slab_from_obj_addr(addr: int) -> Slab | None

crash.types.slab.slab_from_page(page: Page) -> Slab
