[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200420181931.GJ11244@42.do-not-panic.com>
Date: Mon, 20 Apr 2020 18:19:31 +0000
From: Luis Chamberlain <mcgrof@...nel.org>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc: Shuah Khan <shuah@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Jessica Yu <jeyu@...nel.org>, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org,
Markus Elfring <Markus.Elfring@....de>,
Xuefeng Li <lixuefeng@...ngson.cn>
Subject: Re: [PATCH v3 3/4] kmod: Return directly if module name is empty in
request_module()
On Mon, Apr 20, 2020 at 08:33:54PM +0800, Tiezhu Yang wrote:
> If module name is empty, it is better to return directly at the beginning
> of request_module() without doing the needless call_modprobe() operation.
>
> Call trace:
>
> request_module()
> |
> |
> __request_module()
> |
> |
> call_modprobe()
> |
> |
> call_usermodehelper_exec() -- retval = sub_info->retval;
> |
> |
> call_usermodehelper_exec_work()
> |
> |
> call_usermodehelper_exec_sync() -- sub_info->retval = ret;
> |
> | --> call_usermodehelper_exec_async() --> do_execve()
> |
> kernel_wait4(pid, (int __user *)&ret, 0, NULL);
>
> sub_info->retval is 256 after call kernel_wait4(), the function
> call_usermodehelper_exec() returns sub_info->retval which is 256,
> then call_modprobe() and __request_module() returns 256.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
Thanks for looking into this. I still cannot find where
userspace it returns 256. Can you? If I run modprobe without
an argument I see 1 returned.
At least kmod [0] has a series of cmd helper structs, the one for modprobe
seems to be kmod_cmd_compat_modprobe, and I can see -1 returned which
can be converted to 255. It can also return EXIT_FAILURE or EXIT_SUCCESS
and /usr/include/stdlib.h defines these as 1 and 0 respectively.
https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/
Luis
Powered by blists - more mailing lists