From: Rusty Russell <rusty@rustcorp.com.au>
To: Wanlong Gao <gaowanlong@huawei.com>,
akpm@linux-foundation.org, jeyu@redhat.com
Cc: Xie XiuQi <xiexiuqi@huawei.com>,
gaowanlong@huawei.com, linux-kernel@vger.kernel.org,
john.wanghui@huawei.com, wencongyang2@huawei.com,
guijianfeng@huawei.com, Jessica Yu <jeyu@redhat.com>
Subject: Re: [PATCH] modpost: abort if a module name is too long
Date: Sat, 27 May 2017 10:57:56 +0930 [thread overview]
Message-ID: <87a85z142r.fsf@rustcorp.com.au> (raw)
In-Reply-To: <2eab8ec4-1dfc-1157-2d0f-bb31399fa39b@huawei.com>
Wanlong Gao <gaowanlong@huawei.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@huawei.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@huawei.com>
>> Signed-off-by: Xie XiuQi <xiexiuqi@huawei.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);
>>
next prev parent reply other threads:[~2017-05-27 10:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-20 7:46 [PATCH] modpost: abort if a module name is too long Xie XiuQi
2017-05-25 6:11 ` Wanlong Gao
2017-05-27 1:27 ` Rusty Russell [this message]
2017-05-29 9:10 ` Jessica Yu
2017-05-31 2:23 ` Wanlong Gao
2017-05-31 3:30 ` Jessica Yu
2017-05-31 3:39 ` Wanlong Gao
2017-05-31 3:48 ` Wanlong Gao
2017-06-01 11:51 ` Wanlong Gao
2017-06-01 23:23 ` Jessica Yu
2017-06-02 3:04 ` Wanlong Gao
2017-06-02 3:44 ` Wanlong Gao
2017-06-05 2:09 ` Jessica Yu
2017-06-06 1:07 ` Wanlong Gao
2017-06-07 3:41 ` Jessica Yu
2017-06-21 16:09 ` Jessica Yu
2017-06-22 1:11 ` Wanlong Gao
2017-06-22 14:25 ` Jessica Yu
2017-06-22 14:57 ` Wanlong Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a85z142r.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=akpm@linux-foundation.org \
--cc=gaowanlong@huawei.com \
--cc=guijianfeng@huawei.com \
--cc=jeyu@redhat.com \
--cc=john.wanghui@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wencongyang2@huawei.com \
--cc=xiexiuqi@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.