Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1302309

Re: [PATCH 2/2] module: deal with the failure of complete_formation

From "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] module: deal with the failure of complete_formation
Date 2016-01-06 02:20 +0100
Message-ID <qNKVA-2ww-11@gated-at.bofh.it> (permalink)
References <qJu2Z-8rQ-1@gated-at.bofh.it> <qJuFH-sh-3@gated-at.bofh.it> <qNKLT-2s3-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2016/1/6 9:01, Steven Rostedt wrote:
> On Fri, 25 Dec 2015 15:03:13 +0800
> "Qiu, PeiyangX" <peiyangx.qiu@intel.com> wrote:
>
>> From: Qiu Peiyang <peiyangx.qiu@intel.com>
>>
>> complete_formation might fail. kernel need clean up
>> ftrace records of the module.
>>
>> The patch fixes it by tuning the operation sequence in
>> complete_formation. After complete_formation checks
>> verify_export_symbols, call ftrace_module_init to init
>> ftrace records.
>>
>> Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
>> Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>
>> ---
>>  kernel/module.c | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/kernel/module.c b/kernel/module.c
>> index 8f051a1..0a67c4e 100644
>> --- a/kernel/module.c
>> +++ b/kernel/module.c
>> @@ -3373,6 +3373,11 @@ static int complete_formation(struct module *mod, struct load_info *info)
>>  	/* This relies on module_mutex for list integrity. */
>>  	module_bug_finalize(info->hdr, info->sechdrs, mod);
>>  
>> +	mutex_unlock(&module_mutex);
>> +
> First of all, this is buggy. You can't just move the locking of
> module_mutex. That is needed to modify mod->state.
>
> Second of all, you are solving this wrong. I guess we should add
> ftrace_module_init_fail() function to cover the cases where the module
> can fail before calling do_init_module(), as if that happens it does
> not call the module going notifiers.

It's a good idea although ftrace_module_init_fail might be complicated.

Thanks,
Yanmin

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/2] module: deal with the failure of complete_formation Steven Rostedt <rostedt@goodmis.org> - 2016-01-06 02:10 +0100
  Re: [PATCH 2/2] module: deal with the failure of complete_formation "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> - 2016-01-06 02:20 +0100
    Re: [PATCH 2/2] module: deal with the failure of complete_formation Steven Rostedt <rostedt@goodmis.org> - 2016-01-06 02:30 +0100
      Re: [PATCH 2/2] module: deal with the failure of complete_formation "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> - 2016-01-06 02:50 +0100
        Re: [PATCH 2/2] module: deal with the failure of complete_formation Steven Rostedt <rostedt@goodmis.org> - 2016-01-06 03:00 +0100

csiph-web