Skip to content

drgn script to list module parameters (both built-in and loadable modules) by searching 'struct kernel_param' info in memory.

Notifications You must be signed in to change notification settings

t-msn/list_modparam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Description

drgn script to list module parameters (both built-in and loadable modules) by searching 'struct kernel_param' info in memory. This scirpt will also show module parameters which are hidden in '/sys/module/<module name>/parameters'.

Note that this script searches a global variable corresponding to the parameter and print its value. This is rather a PoC and not fully validated.

Limitations:

  • duplicate symbols are not resolved
  • array parameters are not handled properly

Example:

# built-in module
$ modinfo -n thermal
(builtin)
$ modinfo -p thermal
act:Disable or override all lowest active trip points. (int)
crt:Disable or lower all critical trip points. (int)
tzp:Thermal zone polling frequency, in 1/10 seconds. (int)
nocrt:Set to take no action upon ACPI thermal zone critical trips points. (int)
off:Set to disable ACPI thermal support. (int)
psv:Disable or override all passive trip points. (int)

# some parameters are hidden in sysfs
$ grep -r "" /sys/module/thermal/parameters/
/sys/module/thermal/parameters/act:1:0
/sys/module/thermal/parameters/tzp:1:0
/sys/module/thermal/parameters/psv:1:0
/sys/module/thermal/parameters/crt:1:0

$ sudo ./list_modparam.py thermal
thermal
        psv = (int)0
        off = (int)0 **symbol name duplicates, value might be incorrect**
        nocrt = (int)0
        tzp = (int)0
        crt = (int)0
        act = (int)0

# loadable module
$ modinfo -n orangefs
/lib/modules/5.19.14-200.fc36.x86_64/kernel/fs/orangefs/orangefs.ko.xz
$ modinfo -p orangefs
hash_table_size:size of hash table for operations in progress (int)
module_parm_debug_mask:debugging level (see orangefs-debug.h for values) (ulong)
op_timeout_secs:Operation timeout in seconds (int)
slot_timeout_secs:Slot timeout in seconds (int)
$ modprobe orangefs

$ grep -r "" /sys/module/orangefs/parameters/
/sys/module/orangefs/parameters/module_parm_debug_mask:1:0

$ sudo ./list_modparam.py orangefs
orangefs
        slot_timeout_secs = (int)900
        op_timeout_secs = (int)20
        module_parm_debug_mask = (ulong)0
        hash_table_size = (int)509

About

drgn script to list module parameters (both built-in and loadable modules) by searching 'struct kernel_param' info in memory.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages