kernel symbol marked with “T” in /proc/kallsyms is not exported

后端 未结 2 1171
情歌与酒
情歌与酒 2020-12-03 19:34

Symbol machine_power_off is marked with \"T\" in /proc/kallsyms:

$ grep -w machine_power_off /proc/kallsyms 
ffffffff8102391b T mac         


        
2条回答
  •  我在风中等你
    2020-12-03 20:18

    To use kernel symbols that are global, but not exported (such as the machine_power_off symbol that you mention), you can use kallsyms_lookup in your module code:

    #include 
    
    static void (*machine_power_off_p)(void);
    machine_power_off_p = (void*) kallsyms_lookup_name("machine_power_off");
    

    Now you can call the machine_power_off function via the machine_power_off_p pointer:

    (*machine_power_off_p)();
    

提交回复
热议问题