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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a85z142r.fsf@rustcorp.com.au>
Date:   Sat, 27 May 2017 10:57:56 +0930
From:   Rusty Russell <rusty@...tcorp.com.au>
To:     Wanlong Gao <gaowanlong@...wei.com>, akpm@...ux-foundation.org,
        jeyu@...hat.com
Cc:     Xie XiuQi <xiexiuqi@...wei.com>, gaowanlong@...wei.com,
        linux-kernel@...r.kernel.org, john.wanghui@...wei.com,
        wencongyang2@...wei.com, guijianfeng@...wei.com,
        Jessica Yu <jeyu@...hat.com>
Subject: Re: [PATCH] modpost: abort if a module name is too long

Wanlong Gao <gaowanlong@...wei.com> writes:
> Folks,
>
> Any comments?

I've CC'd the module maintainer, who can help with this :_

Cheers,
Rusty.

> On 2017/5/20 15:46, Xie XiuQi wrote:
>> From: Wanlong Gao <gaowanlong@...wei.com>
>> 
>> Module name has a limited length, but currently the build system
>> allows the build finishing even if the module name is too long.
>> 
>>   CC      /root/kprobe_example/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.mod.o
>> /root/kprobe_example/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.mod.c:9:2:
>> warning: initializer-string for array of chars is too long [enabled by default]
>>   .name = KBUILD_MODNAME,
>>   ^
>> 
>> but it's merely a warning.
>> 
>> This patch adds the check of the module name length in modpost and stops
>> the build properly.
>> 
>> Signed-off-by: Wanlong Gao <gaowanlong@...wei.com>
>> Signed-off-by: Xie XiuQi <xiexiuqi@...wei.com>
>> ---
>>  scripts/mod/modpost.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>> 
>> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
>> index 30d752a..db11c57 100644
>> --- a/scripts/mod/modpost.c
>> +++ b/scripts/mod/modpost.c
>> @@ -2166,6 +2166,17 @@ static int add_versions(struct buffer *b, struct module *mod)
>>  {
>>  	struct symbol *s, *exp;
>>  	int err = 0;
>> +	const char *mod_name;
>> +
>> +	mod_name = strrchr(mod->name, '/');
>> +	if (mod_name == NULL)
>> +		mod_name = mod->name;
>> +	else
>> +		mod_name++;
>> +	if (strlen(mod_name) >= MODULE_NAME_LEN) {
>> +		merror("module name is too long [%s.ko]\n", mod->name);
>> +		return 1;
>> +	}
>>  
>>  	for (s = mod->unres; s; s = s->next) {
>>  		exp = find_symbol(s->name);
>> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ