函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\module.c Create Date:2022-07-27 11:59:58
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Allocate and load the module: note that size of section 0 is alwayszero, and we rely on this for optional sections.

函数原型:static int load_module(struct load_info *info, const char __user *uargs, int flags)

返回类型:int

参数:

类型参数名称
struct load_info *info
const char __user *uargs
intflags
3789  err等于0
3792  err等于Sanity checks against invalid binaries, wrong arch, weird elf version.
3793  如果err则转到:free_copy
3796  err等于Set up our basic convenience variables (pointers to section headers,* search for module section index etc), and do some basic section* verification.* Set info->mod to the temporary copy of the module in info->hdr. The final one
3797  如果err则转到:free_copy
3800  如果blacklisted(name)则
3801  err等于负EPERM
3802  转到:free_copy
3805  err等于module_sig_check(info, flags)
3806  如果err则转到:free_copy
3809  err等于rewrite_section_headers(info, flags)
3810  如果err则转到:free_copy
3814  如果非check_modstruct_version(info, pointer to module in temporary copy, freed at end of load_module() )则
3815  err等于负ENOEXEC
3816  转到:free_copy
3820  mod等于layout_and_allocate(info, flags)
3821  如果是错误
3822  err等于错误
3823  转到:free_copy
3826  audit_log_kern_module( Unique handle for this module )
3829  err等于We try to place it in the list now to make sure it's unique before* we dedicate too many resources. In particular, temporary percpu* memory exhaustion.
3830  如果err则转到:free_module
3844  err等于percpu_modalloc(mod, info)
3845  如果err则转到:unlink_mod
3849  err等于module_unload_init(mod)
3850  如果err则转到:unlink_mod
3853  init_param_lock(mod)
3857  err等于find_module_sections(mod, info)
3858  如果err则转到:free_unload
3861  err等于check_module_license_and_versions(mod)
3862  如果err则转到:free_unload
3866  setup_modinfo(mod, info)
3869  err等于Change all symbols so that st_value encodes the pointer directly.
3870  如果err小于0则转到:free_modinfo
3873  err等于apply_relocations(mod, info)
3874  如果err小于0则转到:free_modinfo
3877  err等于post_relocation(mod, info)
3878  如果err小于0则转到:free_modinfo
3881  flush_module_icache(mod)
3884  The command line arguments (may be mangled). People like keeping pointers to this stuff 等于We don't want strings.h stuff being used by user stuff by accident
3885  如果是错误
3886  err等于错误
3887  转到:free_arch_cleanup
3890  dynamic_debug_setup(mod, debug, num_debug)
3893  ftrace_module_init(mod)
3896  err等于complete_formation(mod, info)
3897  如果err则转到:ddebug_cleanup
3900  err等于prepare_coming_module(mod)
3901  如果err则转到:bug_cleanup
3905  after_dashes等于解析参数
3908  如果是错误
3909  err等于错误
3910  转到:coming_cleanup
3911  否则如果after_dashes
3912  打印警告信息("%s: parameters '%s' after `--' ignored\n", Unique handle for this module , after_dashes)
3917  err等于/sys/module/foo/sections stuff* J. Corbet
3918  如果err小于0则转到:coming_cleanup
3921  如果is_livepatch_module(mod)则
3922  err等于Persist Elf information about a module. Copy the Elf header,* section header table, section string table, and symtab section* index from info to mod->klp_info.
3923  如果err小于0则转到:sysfs_cleanup
3928  free_copy(info)
3931  trace_module_load(mod)
3933  返回:This is where the real work happens.* Keep it uninlined to provide a reliable breakpoint target, e.g. for the gdb* helper command 'lx-symbols'.
3935  sysfs_cleanup :
3936  mod_sysfs_teardown(mod)
3937  coming_cleanup :
3938  state等于 Going away.
3939  destroy_params(kp, num_kp)
3940  blocking_notifier_call_chain( & module_notify_list, Going away. , mod)
3942  klp_module_going(mod)
3943  bug_cleanup :
3945  mutex_lock( & Mutex protects:* 1) List of modules (also safely readable with preempt_disable),* 2) module_use links,* 3) module_addr_min/module_addr_max.* (delete and add uses RCU list operations). )
3946  module_bug_cleanup(mod)
3947  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
3949  ddebug_cleanup :
3950  ftrace_release_mod(mod)
3951  dynamic_debug_remove(mod, debug)
3952  Wait for a grace period to elapse. But it is illegal to invoke* synchronize_rcu() from within an RCU read-side critical section.* Therefore, any legal call to synchronize_rcu() is a quiescent
3953  kfree( The command line arguments (may be mangled). People like keeping pointers to this stuff )
3954  free_arch_cleanup :
3955  module_arch_cleanup(mod)
3956  free_modinfo :
3957  free_modinfo(mod)
3958  free_unload :
3959  module_unload_free(mod)
3960  unlink_mod :
3961  mutex_lock( & Mutex protects:* 1) List of modules (also safely readable with preempt_disable),* 2) module_use links,* 3) module_addr_min/module_addr_max.* (delete and add uses RCU list operations). )
3963  删除不需要重新初始化的列表项
3964  mod_tree_remove(mod)
3965  wake_up_all( & Waiting for a module to finish initializing? )
3967  Wait for a grace period to elapse. But it is illegal to invoke* synchronize_rcu() from within an RCU read-side critical section.* Therefore, any legal call to synchronize_rcu() is a quiescent
3968  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
3969  free_module :
3971  lockdep_free_key_range( The actual code + data. , Total size. )
3973  mod is no longer valid after this!
3974  free_copy :
3975  free_copy(info)
3976  返回:err
调用者
名称描述
SYSCALL_DEFINE3
SYSCALL_DEFINE3