lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 3 Jul 2019 09:28:43 +0800
From:   Zhiqiang Liu <liuzhiqiang26@...wei.com>
To:     Jessica Yu <jeyu@...nel.org>
CC:     <rusty@...tcorp.com.au>, <kay.sievers@...y.org>,
        <clabbe.montjoie@...il.com>, <linux-kernel@...r.kernel.org>,
        "wangxiaogang (F)" <wangxiaogang3@...wei.com>,
        "Zhoukang (A)" <zhoukang7@...wei.com>,
        Mingfangsen <mingfangsen@...wei.com>
Subject: Re: [PATCH] module: add usage links when calling ref_module func

On 2019/7/1 21:55, Jessica Yu wrote:
> +++ Zhiqiang Liu [28/06/19 20:32 +0800]:
>> From: Zhiqiang Liu <liuzhiqiang26@...wei.com>
>>
>> Problem: Users can call ref_module func in their modules to construct
>> relationships with other modules. However, the holders
>> '/sys/module/<mod-name>/holders' of the target module donot include
>> the users` module. So lsmod command misses detailed info of 'Used by'.
>>
>> Here, we will add usage link of a to b's holder_dir.
>>
>> Fixes: 9bea7f239 ("module: fix bne2 "gave up waiting for init of module libcrc32c")
> 
> I think we can drop this tag; it doesn't fix a bug specifically
> introduced by that particular commit.
> 
Thanks for your reply.
I will remove the Fixes tag in v2 patch.

>> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@...wei.com>
>> ---
>> kernel/module.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/kernel/module.c b/kernel/module.c
>> index 80c7c09584cf..11c6aff37b1f 100644
>> --- a/kernel/module.c
>> +++ b/kernel/module.c
>> @@ -871,6 +871,11 @@ int ref_module(struct module *a, struct module *b)
>>         module_put(b);
>>         return err;
>>     }
>> +
>> +    err = sysfs_create_link(b->holders_dir, &a->mkobj.kobj, a->name);
>> +    if (err)
>> +        return err;
> 
> We need to fix the error handling here - the module_use struct
> allocated in the call to add_module_usage() needs to be freed (you
> could just modify add_module_usage() to return the use pointer so that
> it's easier to free from within ref_module()), module_put() needs to
> be called, and the use struct should be removed from its respective
> lists (see module_unload_free()).
> 
Thanks again for your advice.
We will modify add_module_usage func to return the use pointer as your suggestion.
In the error handling, We will call module_put() and call list_del() to remove the use.

> Thanks,
> 
> Jessica
> 
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ