Bug 115331 - uncertain outcome about loading module
Summary: uncertain outcome about loading module
Status: NEW
Alias: None
Product: Other
Classification: Unclassified
Component: Modules (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: other_modules
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-27 15:00 UTC by jackyzhao
Modified: 2016-03-27 15:00 UTC (History)
0 users

See Also:
Kernel Version: 3.10.97
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description jackyzhao 2016-03-27 15:00:20 UTC
Hi,I have a problem about loading module.The funciont do_init_module in 3.10.97 kernel is:
--------------------------------------------------------------------------------
/* This is where the real work happens */
static int do_init_module(struct module *mod)
{
	int ret = 0;

	/*
	 * We want to find out whether @mod uses async during init.  Clear
	 * PF_USED_ASYNC.  async_schedule*() will set it.
	 */
	current->flags &= ~PF_USED_ASYNC;

	blocking_notifier_call_chain(&module_notify_list,
			MODULE_STATE_COMING, mod);

	/* Set RO and NX regions for core */
	set_section_ro_nx(mod->module_core,
				mod->core_text_size,
				mod->core_ro_size,
				mod->core_size);

	/* Set RO and NX regions for init */
	set_section_ro_nx(mod->module_init,
				mod->init_text_size,
				mod->init_ro_size,
				mod->init_size);

	do_mod_ctors(mod);
	/* Start the module */
	if (mod->init != NULL)
		ret = do_one_initcall(mod->init);
	if (ret < 0) {
		/* Init routine failed: abort.  Try to protect us from
                   buggy refcounters. */
		mod->state = MODULE_STATE_GOING;
		synchronize_sched();
		module_put(mod);
		blocking_notifier_call_chain(&module_notify_list,
					     MODULE_STATE_GOING, mod);
		free_module(mod);
		wake_up_all(&module_wq);
		return ret;
	}
	if (ret > 0) {
		printk(KERN_WARNING
"%s: '%s'->init suspiciously returned %d, it should follow 0/-E convention\n"
"%s: loading module anyway...\n",
		       __func__, mod->name, ret,
		       __func__);
		dump_stack();
	}
      ...
--------------------------------------------------------------------------------
My question is when my module_init defined as:
    void __init__ func_init(*)
then the ret of func_init(*) will be alterable,it depends on specifically running enviroment,that's what we want?

Note You need to log in before you can comment on or make changes to this bug.